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

geonetwork / geonetwork-ui / 15971579562

30 Jun 2025 11:23AM UTC coverage: 83.816% (+2.4%) from 81.421%
15971579562

Pull #1276

github

web-flow
Merge afa61a11c into 47d0cd11c
Pull Request #1276: (wip) Write config viz

3474 of 4659 branches covered (74.57%)

Branch coverage included in aggregate %.

38 of 43 new or added lines in 7 files covered. (88.37%)

4 existing lines in 1 file now uncovered.

9986 of 11400 relevant lines covered (87.6%)

274.21 hits per line

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

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

26
@Component({
27
  selector: 'gn-ui-data-view',
28
  templateUrl: './data-view.component.html',
29
  styleUrls: ['./data-view.component.css'],
30
  changeDetection: ChangeDetectionStrategy.OnPush,
31
  standalone: true,
32
  imports: [
33
    CommonModule,
34
    DropdownSelectorComponent,
35
    TableViewComponent,
36
    TranslateDirective,
37
    TranslatePipe,
38
    ChartViewComponent,
39
    PopupAlertComponent,
40
  ],
41
})
42
export class DataViewComponent {
1✔
43
  @Input() mode: 'table' | 'chart'
44
  @Input() displaySource = true
8✔
45
  @Input() set exceedsLimit(value: boolean) {
46
    this.excludeWfs$.next(value)
×
47
  }
48
  _selectedView = ''
8✔
49
  @Input() set selectedView(value: string) {
NEW
50
    this._selectedView = value
×
51
    if (value !== 'map') {
×
52
      this.linkSelected.emit(this.selectedLink$.value)
×
53
    }
54
  }
55
  @Output() chartConfig$ = new BehaviorSubject<DatavizChartConfigModel>(null)
8✔
56
  @Output() linkSelected = new EventEmitter<DatasetOnlineResource>()
8✔
57
  cacheActive$ = this.mdViewFacade.isHighUpdateFrequency$.pipe(
8✔
58
    map((highF) => !highF)
×
59
  )
60
  excludeWfs$ = new BehaviorSubject(false)
8✔
61
  compatibleDataLinks$ = combineLatest([
8✔
62
    this.mdViewFacade.dataLinks$,
63
    this.mdViewFacade.geoDataLinks$,
64
  ]).pipe(
65
    map(([dataLinks, geoDataLinks]) => {
66
      const a = [...dataLinks, ...geoDataLinks]
4✔
67
      a.sort((a, b) => getLinkPriority(b) - getLinkPriority(a))
20✔
68
      return a
4✔
69
    })
70
  )
71
  dropdownChoices$ = this.compatibleDataLinks$.pipe(
8✔
72
    tap((links) => {
73
      if (links.indexOf(this.selectedLink$.value) === -1) {
4✔
74
        this.selectLink(JSON.stringify(links[0]))
4✔
75
      }
76
    }),
77
    map((links) =>
78
      links.map((link) => ({
16✔
79
        label: getLinkLabel(link),
80
        value: JSON.stringify(link),
81
      }))
82
    )
83
  )
84
  selectedLink$ = new BehaviorSubject<DatasetOnlineResource>(null)
8✔
85

86
  hidePreview$ = this.excludeWfs$.pipe(
8✔
87
    map((excludeWfs) => this.mode === 'chart' && excludeWfs)
9✔
88
  )
89

90
  constructor(private mdViewFacade: MdViewFacade) {}
8!
91

92
  setChartConfig(event: DatavizChartConfigModel) {
93
    this.mdViewFacade.setChartConfig(event)
3✔
94
  }
95

96
  selectLink(linkAsString: string) {
97
    const link: DatasetOnlineResource = JSON.parse(linkAsString)
6✔
98
    if (this._selectedView && this._selectedView !== 'map') {
6!
NEW
99
      this.linkSelected.emit(link)
×
100
    }
101
    link.url = new URL(link.url)
6✔
102
    this.selectedLink$.next(link)
6✔
103
  }
104
}
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