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

geonetwork / geonetwork-ui / 14268286450

04 Apr 2025 03:02PM UTC coverage: 84.275% (+2.5%) from 81.764%
14268286450

Pull #1193

github

web-flow
Merge 5df097990 into 4fa0a0afc
Pull Request #1193: Section subsection rework

1587 of 2126 branches covered (74.65%)

Branch coverage included in aggregate %.

5080 of 5785 relevant lines covered (87.81%)

10.3 hits per line

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

65.63
/libs/ui/elements/src/lib/api-card/api-card.component.ts
1
import { DatasetServiceDistribution } from '@geonetwork-ui/common/domain/model/record'
1✔
2
import {
1✔
3
  ChangeDetectionStrategy,
4
  Component,
5
  EventEmitter,
6
  Input,
7
  OnChanges,
8
  OnInit,
9
  Output,
10
  SimpleChanges,
11
} from '@angular/core'
12
import { CommonModule } from '@angular/common'
1✔
13
import { CopyTextButtonComponent } from '@geonetwork-ui/ui/inputs'
1✔
14
import { TranslateModule } from '@ngx-translate/core'
1✔
15
import { MatTooltipModule } from '@angular/material/tooltip'
1✔
16
import { NgIcon, provideIcons } from '@ng-icons/core'
1✔
17
import { iconoirSettings } from '@ng-icons/iconoir'
1✔
18

19
type CardSize = 'L' | 'M' | 'S' | 'XS'
20

21
@Component({
22
  selector: 'gn-ui-api-card',
23
  templateUrl: './api-card.component.html',
24
  styleUrls: ['./api-card.component.css'],
25
  changeDetection: ChangeDetectionStrategy.OnPush,
26
  standalone: true,
27
  imports: [
28
    CommonModule,
29
    CopyTextButtonComponent,
30
    TranslateModule,
31
    MatTooltipModule,
32
    NgIcon,
33
  ],
34
  viewProviders: [
35
    provideIcons({
36
      iconoirSettings,
37
    }),
38
  ],
39
})
40
export class ApiCardComponent implements OnInit, OnChanges {
1✔
41
  private _size: 'L' | 'M' | 'S' | 'XS'
42
  @Input() link: DatasetServiceDistribution
43
  @Input() currentLink: DatasetServiceDistribution
44
  private readonly sizeClassMap: Record<CardSize, string> = {
3✔
45
    L: 'gn-ui-card-l py-2 px-5 flex-row',
46
    M: 'gn-ui-card-m py-2 px-5 flex-row',
47
    S: 'gn-ui-card-s p-4 flex-col',
48
    XS: 'gn-ui-card-xs py-2 px-5 flex-row',
49
  }
50

51
  @Input() set size(value: CardSize) {
52
    this._size = value
×
53
    this.cardClass = this.sizeClassMap[value]
×
54
  }
55
  get size(): 'L' | 'M' | 'S' | 'XS' {
56
    return this._size
9✔
57
  }
58
  cardClass = ''
3✔
59
  displayApiFormButton: boolean
60
  currentlyActive = false
3✔
61
  @Output() openRecordApiForm: EventEmitter<DatasetServiceDistribution> =
3✔
62
    new EventEmitter<DatasetServiceDistribution>()
63

64
  get generatedText() {
65
    return this.link.accessServiceProtocol === 'wfs'
×
66
      ? 'datahub.search.filter.generatedByWfs'
67
      : 'datahub.search.filter.generatedByAPI'
68
  }
69

70
  ngOnInit() {
71
    this.displayApiFormButton =
4✔
72
      this.link.accessServiceProtocol === 'ogcFeatures' ||
4!
73
      this.link.accessServiceProtocol === 'wfs' ||
74
      this.link.accessServiceProtocol === 'GPFDL'
75
  }
76

77
  ngOnChanges(changes: SimpleChanges) {
78
    this.currentlyActive =
×
79
      changes.currentLink.currentValue === this.link ? true : false
×
80
  }
81

82
  openRecordApiFormPanel() {
83
    if (this.displayApiFormButton) {
1✔
84
      this.currentlyActive = !this.currentlyActive
1✔
85
      this.openRecordApiForm.emit(this.currentlyActive ? this.link : undefined)
1!
86
    }
87
  }
88
}
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