• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

geonetwork / geonetwork-ui / 13791370062

11 Mar 2025 03:04PM UTC coverage: 85.728%. First build
13791370062

Pull #1151

github

web-flow
Merge da86234ef into 08209a396
Pull Request #1151: [Datahub] Activate cache according to update frequency

1373 of 1770 branches covered (77.57%)

Branch coverage included in aggregate %.

16 of 17 new or added lines in 5 files covered. (94.12%)

3895 of 4375 relevant lines covered (89.03%)

284.17 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

93.94
/libs/feature/record/src/lib/data-view/data-view.component.ts
1
import {
1✔
2
  ChangeDetectionStrategy,
3
  Component,
4
  Input,
5
  Output,
6
} from '@angular/core'
7
import { getLinkLabel, getLinkPriority } from '@geonetwork-ui/util/shared'
1✔
8
import { BehaviorSubject, combineLatest } from 'rxjs'
1✔
9
import { map, tap } from 'rxjs/operators'
1✔
10
import { MdViewFacade } from '../state'
1✔
11
import { DatavizConfigurationModel } from '@geonetwork-ui/common/domain/model/dataviz/dataviz-configuration.model'
12
import { DatasetOnlineResource } from '@geonetwork-ui/common/domain/model/record'
13
import { DropdownSelectorComponent } from '@geonetwork-ui/ui/inputs'
1✔
14
import {
1✔
15
  ChartViewComponent,
16
  TableViewComponent,
17
} from '@geonetwork-ui/feature/dataviz'
18
import { CommonModule } from '@angular/common'
1✔
19
import { TranslateModule } from '@ngx-translate/core'
1✔
20

21
@Component({
22
  selector: 'gn-ui-data-view',
23
  templateUrl: './data-view.component.html',
24
  styleUrls: ['./data-view.component.css'],
25
  changeDetection: ChangeDetectionStrategy.OnPush,
26
  standalone: true,
27
  imports: [
28
    CommonModule,
29
    DropdownSelectorComponent,
30
    TableViewComponent,
31
    TranslateModule,
32
    ChartViewComponent,
33
  ],
34
})
35
export class DataViewComponent {
1✔
36
  @Input() mode: 'table' | 'chart'
37
  @Input() displaySource = true
7✔
38
  @Output() chartConfig$ = new BehaviorSubject<DatavizConfigurationModel>(null)
7✔
39
  cacheActive$ = this.mdViewFacade.isHighUpdateFrequency$.pipe(
7✔
NEW
40
    map((highF) => !highF)
×
41
  )
42
  compatibleDataLinks$ = combineLatest([
7✔
43
    this.mdViewFacade.dataLinks$,
44
    this.mdViewFacade.geoDataLinks$,
45
  ]).pipe(
46
    map(([dataLinks, geoDataLinks]) => {
47
      const a = [...dataLinks, ...geoDataLinks]
3✔
48
      a.sort((a, b) => getLinkPriority(b) - getLinkPriority(a))
15✔
49
      return a
3✔
50
    })
51
  )
52
  dropdownChoices$ = this.compatibleDataLinks$.pipe(
7✔
53
    tap((links) => {
54
      if (links.indexOf(this.selectedLink$.value) === -1) {
3✔
55
        this.selectedLink$.next(links[0])
3✔
56
      }
57
    }),
58
    map((links) =>
59
      links.map((link) => ({
12✔
60
        label: getLinkLabel(link),
61
        value: JSON.stringify(link),
62
      }))
63
    )
64
  )
65
  selectedLink$ = new BehaviorSubject<DatasetOnlineResource>(null)
7✔
66

67
  constructor(private mdViewFacade: MdViewFacade) {}
7!
68

69
  setChartConfig(event: DatavizConfigurationModel) {
70
    this.mdViewFacade.setChartConfig(event)
3✔
71
  }
72

73
  selectLink(linkAsString: string) {
74
    const link: DatasetOnlineResource = JSON.parse(linkAsString)
1✔
75
    link.url = new URL(link.url)
1✔
76
    this.selectedLink$.next(link)
1✔
77
  }
78
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc