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

geonetwork / geonetwork-ui / 12069834722

28 Nov 2024 01:27PM UTC coverage: 83.926% (+0.2%) from 83.736%
12069834722

push

github

jahow
chore: fix formatting on PULL_REQUEST_TEMPLATE.md

3159 of 4250 branches covered (74.33%)

Branch coverage included in aggregate %.

9116 of 10376 relevant lines covered (87.86%)

201.75 hits per line

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

88.89
/libs/feature/record/src/lib/data-view-web-component/data-view-web-component.component.ts
1
import {
2✔
2
  ChangeDetectionStrategy,
3
  Component,
4
  Inject,
5
  Input,
6
} from '@angular/core'
7
import { Configuration } from '@geonetwork-ui/data-access/gn4'
2✔
8
import { MdViewFacade } from '../state'
2✔
9
import { BehaviorSubject, combineLatest, map } from 'rxjs'
2✔
10
import { GN_UI_VERSION } from '../gn-ui-version.token'
2✔
11
import { CopyTextButtonComponent } from '@geonetwork-ui/ui/inputs'
2✔
12
import { CommonModule } from '@angular/common'
2✔
13
import { TranslateModule } from '@ngx-translate/core'
2✔
14

15
@Component({
16
  selector: 'gn-ui-data-view-web-component',
17
  templateUrl: './data-view-web-component.component.html',
18
  styleUrls: ['./data-view-web-component.component.css'],
19
  changeDetection: ChangeDetectionStrategy.OnPush,
20
  standalone: true,
21
  imports: [CommonModule, CopyTextButtonComponent, TranslateModule],
22
})
23
export class DataViewWebComponentComponent {
2✔
24
  viewType$ = new BehaviorSubject<string>('map')
5✔
25
  @Input()
26
  set viewType(value: string) {
27
    this.viewType$.next(value)
×
28
  }
29
  webComponentHtml$ = combineLatest(
5✔
30
    this.viewType$,
31
    this.facade.chartConfig$,
32
    this.facade.metadata$
33
  ).pipe(
34
    map(([viewType, config, metadata]) => {
35
      if (viewType === 'chart') {
12✔
36
        if (config) {
8✔
37
          const { aggregation, xProperty, yProperty, chartType } = config
8✔
38
          return `<script src="https://cdn.jsdelivr.net/gh/geonetwork/geonetwork-ui@wc-dist-${
8✔
39
            this.version
40
          }/gn-wc.js"></script>
41
  <gn-dataset-view-chart
42
          api-url="${new URL(
43
            this.config.basePath,
44
            window.location.origin
45
          ).toString()}"
46
          dataset-id="${metadata.uniqueIdentifier}"
47
          aggregation="${aggregation}"
48
          x-property="${xProperty}"
49
          y-property="${yProperty}"
50
          chart-type="${chartType}"
51
          primary-color="#0f4395"
52
          secondary-color="#8bc832"
53
          main-color="#555"
54
          background-color="#fdfbff"
55
          main-font="'Inter', sans-serif"
56
          title-font="'DM Serif Display', serif"
57
  ></gn-dataset-view-chart>`
58
        }
59
        return ''
×
60
      } else if (viewType === 'table') {
4✔
61
        return `<script src="https://cdn.jsdelivr.net/gh/geonetwork/geonetwork-ui@wc-dist-${
2✔
62
          this.version
63
        }/gn-wc.js"></script>
64
  <gn-dataset-view-table
65
          api-url="${new URL(
66
            this.config.basePath,
67
            window.location.origin
68
          ).toString()}"
69
          dataset-id="${metadata.uniqueIdentifier}"
70
          primary-color="#0f4395"
71
          secondary-color="#8bc832"
72
          main-color="#555"
73
          background-color="#fdfbff"
74
          main-font="'Inter', sans-serif"
75
          title-font="'DM Serif Display', serif"
76
  ></gn-dataset-view-table>`
77
      } else {
78
        return `<script src="https://cdn.jsdelivr.net/gh/geonetwork/geonetwork-ui@wc-dist-${
2✔
79
          this.version
80
        }/gn-wc.js"></script>
81
<gn-dataset-view-map
82
        api-url="${new URL(
83
          this.config.basePath,
84
          window.location.origin
85
        ).toString()}"
86
        dataset-id="${metadata.uniqueIdentifier}"
87
        primary-color="#0f4395"
88
        secondary-color="#8bc832"
89
        main-color="#555"
90
        background-color="#fdfbff"
91
        main-font="'Inter', sans-serif"
92
        title-font="'DM Serif Display', serif"
93
></gn-dataset-view-map>`
94
      }
95
    })
96
  )
97

98
  constructor(
99
    @Inject(Configuration) private config: Configuration,
5!
100
    @Inject(GN_UI_VERSION) private version: string,
5✔
101
    private facade: MdViewFacade
5✔
102
  ) {}
103
}
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