geonetwork-ui 2.10.0-dev.a66718398 → 2.10.0-dev.e97ea6950

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,7 +20,7 @@
20
20
  [disabled]="disabled"
21
21
  (change)="resetAllFormFields()"
22
22
  >
23
- @for (protocolOption of protocolOptions; track protocolOption) {
23
+ @for (protocolOption of availableProtocolOptions; track protocolOption) {
24
24
  <mat-radio-button [value]="protocolOption.value">
25
25
  {{ protocolOption.label | translate }}
26
26
  </mat-radio-button>
@@ -45,6 +45,11 @@
45
45
  }
46
46
  </gn-ui-url-input>
47
47
 
48
+ @if (loading) {
49
+ <div class="flex justify-center w-full py-4">
50
+ <gn-ui-spinning-loader></gn-ui-spinning-loader>
51
+ </div>
52
+ }
48
53
  @if (errorMessage) {
49
54
  <p class="text-sm text-red-500 pl-4" translate>
50
55
  editor.record.form.field.onlineResource.edit.identifier.error
@@ -22,6 +22,7 @@ import {
22
22
  TextInputComponent,
23
23
  UrlInputComponent,
24
24
  } from '../../../../../../../libs/ui/inputs/src'
25
+ import { SpinningLoaderComponent } from '../../../../../../../libs/ui/widgets/src'
25
26
  import { createFuzzyFilter, getLayers } from '../../../../../../../libs/util/shared/src'
26
27
  import {
27
28
  NgIconComponent,
@@ -57,6 +58,7 @@ marker(
57
58
  MatTooltipModule,
58
59
  MatRadioModule,
59
60
  NgIconComponent,
61
+ SpinningLoaderComponent,
60
62
  TextInputComponent,
61
63
  TranslateDirective,
62
64
  TranslatePipe,
@@ -79,17 +81,19 @@ export class OnlineServiceResourceInputComponent {
79
81
  @Input() protocolHint?: string
80
82
  @Input() disabled? = false
81
83
  @Input() modifyMode? = false
84
+ @Input() protocolOptions?: ServiceProtocol[]
82
85
  @Output() serviceChange: EventEmitter<DatasetServiceDistribution> =
83
86
  new EventEmitter()
84
87
 
85
88
  errorMessage = false
89
+ loading = false
86
90
  resetUrlOnChange = Math.random()
87
91
 
88
92
  layersSubject = new BehaviorSubject<{ name?: string; title?: string }[]>([])
89
93
  layers$: Observable<{ name?: string; title?: string }[]> =
90
94
  this.layersSubject.asObservable()
91
95
 
92
- protocolOptions: {
96
+ allProtocolOptions: {
93
97
  label: string
94
98
  value: ServiceProtocol
95
99
  }[] = [
@@ -123,6 +127,13 @@ export class OnlineServiceResourceInputComponent {
123
127
  },
124
128
  ]
125
129
 
130
+ get availableProtocolOptions() {
131
+ if (!this.protocolOptions) return this.allProtocolOptions
132
+ return this.protocolOptions.flatMap(
133
+ (v) => this.allProtocolOptions.find((o) => o.value === v) ?? []
134
+ )
135
+ }
136
+
126
137
  get activeLayerSuggestion() {
127
138
  return !['wps', 'GPFDL', 'esriRest', 'other'].includes(
128
139
  this._service.accessServiceProtocol
@@ -135,6 +146,8 @@ export class OnlineServiceResourceInputComponent {
135
146
  }
136
147
 
137
148
  async handleUploadClick(url: string) {
149
+ this.loading = true
150
+ this.cdr.detectChanges()
138
151
  try {
139
152
  const layers = await getLayers(url, this._service.accessServiceProtocol)
140
153
 
@@ -148,6 +161,7 @@ export class OnlineServiceResourceInputComponent {
148
161
  this.layersSubject.next([])
149
162
  }
150
163
 
164
+ this.loading = false
151
165
  this.cdr.detectChanges()
152
166
  }
153
167
 
@@ -159,6 +173,7 @@ export class OnlineServiceResourceInputComponent {
159
173
 
160
174
  resetLayersSuggestion() {
161
175
  this.errorMessage = false
176
+ this.loading = false
162
177
  this.layersSubject.next([])
163
178
  this._service.identifierInService = null
164
179
  }
@@ -62,7 +62,10 @@ export class UrlInputComponent implements OnChanges {
62
62
  inputValue = ''
63
63
 
64
64
  ngOnChanges(changes: SimpleChanges) {
65
- if (changes['resetUrlOnChange']) {
65
+ if (
66
+ changes['resetUrlOnChange'] &&
67
+ !changes['resetUrlOnChange'].firstChange
68
+ ) {
66
69
  this.inputValue = ''
67
70
  }
68
71
  }