geonetwork-ui 2.4.1-dev.1d2ade24e → 2.4.1-dev.2804667fa

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.
Files changed (97) hide show
  1. package/esm2022/libs/api/metadata-converter/src/lib/gn4/gn4.converter.mjs +3 -4
  2. package/esm2022/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.mjs +2 -5
  3. package/esm2022/libs/api/metadata-converter/src/lib/gn4/types/metadata.model.mjs +1 -1
  4. package/esm2022/libs/api/repository/src/lib/gn4/gn4-repository.mjs +3 -7
  5. package/esm2022/libs/common/domain/src/lib/repository/records-repository.interface.mjs +1 -1
  6. package/esm2022/libs/feature/editor/src/lib/+state/editor.actions.mjs +1 -2
  7. package/esm2022/libs/feature/editor/src/lib/+state/editor.effects.mjs +1 -4
  8. package/esm2022/libs/feature/editor/src/lib/+state/editor.facade.mjs +1 -5
  9. package/esm2022/libs/feature/editor/src/lib/+state/editor.reducer.mjs +1 -5
  10. package/esm2022/libs/feature/editor/src/lib/+state/editor.selectors.mjs +4 -5
  11. package/esm2022/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.mjs +10 -80
  12. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.mjs +23 -36
  13. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.mjs +3 -4
  14. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.mjs +3 -3
  15. package/esm2022/libs/feature/search/src/lib/results-table/results-table-container.component.mjs +1 -1
  16. package/esm2022/libs/ui/inputs/src/lib/url-input/url-input.component.mjs +2 -7
  17. package/esm2022/libs/ui/layout/src/lib/interactive-table/interactive-table.component.mjs +4 -9
  18. package/esm2022/libs/ui/search/src/lib/results-table/results-table.component.mjs +7 -10
  19. package/esm2022/libs/util/shared/src/lib/links/link-utils.mjs +1 -37
  20. package/esm2022/translations/de.json +0 -6
  21. package/esm2022/translations/en.json +0 -6
  22. package/esm2022/translations/es.json +0 -6
  23. package/esm2022/translations/fr.json +0 -6
  24. package/esm2022/translations/it.json +1 -9
  25. package/esm2022/translations/nl.json +0 -6
  26. package/esm2022/translations/pt.json +0 -6
  27. package/fesm2022/geonetwork-ui.mjs +305 -498
  28. package/fesm2022/geonetwork-ui.mjs.map +1 -1
  29. package/libs/api/metadata-converter/src/lib/gn4/gn4.converter.d.ts.map +1 -1
  30. package/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.d.ts.map +1 -1
  31. package/libs/api/metadata-converter/src/lib/gn4/types/metadata.model.d.ts +0 -1
  32. package/libs/api/metadata-converter/src/lib/gn4/types/metadata.model.d.ts.map +1 -1
  33. package/libs/api/repository/src/lib/gn4/gn4-repository.d.ts +0 -1
  34. package/libs/api/repository/src/lib/gn4/gn4-repository.d.ts.map +1 -1
  35. package/libs/common/domain/src/lib/repository/records-repository.interface.d.ts +0 -1
  36. package/libs/common/domain/src/lib/repository/records-repository.interface.d.ts.map +1 -1
  37. package/libs/feature/editor/src/lib/+state/editor.actions.d.ts +0 -5
  38. package/libs/feature/editor/src/lib/+state/editor.actions.d.ts.map +1 -1
  39. package/libs/feature/editor/src/lib/+state/editor.effects.d.ts +0 -3
  40. package/libs/feature/editor/src/lib/+state/editor.effects.d.ts.map +1 -1
  41. package/libs/feature/editor/src/lib/+state/editor.facade.d.ts +0 -2
  42. package/libs/feature/editor/src/lib/+state/editor.facade.d.ts.map +1 -1
  43. package/libs/feature/editor/src/lib/+state/editor.reducer.d.ts +0 -1
  44. package/libs/feature/editor/src/lib/+state/editor.reducer.d.ts.map +1 -1
  45. package/libs/feature/editor/src/lib/+state/editor.selectors.d.ts +0 -1
  46. package/libs/feature/editor/src/lib/+state/editor.selectors.d.ts.map +1 -1
  47. package/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.d.ts +5 -44
  48. package/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.d.ts.map +1 -1
  49. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.d.ts +4 -4
  50. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.d.ts.map +1 -1
  51. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.d.ts +1 -1
  52. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.d.ts.map +1 -1
  53. package/libs/ui/elements/src/lib/record-api-form/record-api-form.component.d.ts +1 -1
  54. package/libs/ui/inputs/src/lib/url-input/url-input.component.d.ts +2 -3
  55. package/libs/ui/inputs/src/lib/url-input/url-input.component.d.ts.map +1 -1
  56. package/libs/ui/layout/src/lib/interactive-table/interactive-table.component.d.ts +1 -2
  57. package/libs/ui/layout/src/lib/interactive-table/interactive-table.component.d.ts.map +1 -1
  58. package/libs/ui/search/src/lib/results-table/results-table.component.d.ts +2 -3
  59. package/libs/ui/search/src/lib/results-table/results-table.component.d.ts.map +1 -1
  60. package/libs/util/shared/src/lib/links/link-utils.d.ts +1 -2
  61. package/libs/util/shared/src/lib/links/link-utils.d.ts.map +1 -1
  62. package/package.json +1 -1
  63. package/src/libs/api/metadata-converter/src/lib/gn4/gn4.converter.ts +3 -4
  64. package/src/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.ts +1 -8
  65. package/src/libs/api/metadata-converter/src/lib/gn4/types/metadata.model.ts +0 -1
  66. package/src/libs/api/repository/src/lib/gn4/gn4-repository.ts +2 -9
  67. package/src/libs/common/domain/src/lib/repository/records-repository.interface.ts +1 -1
  68. package/src/libs/common/fixtures/src/lib/elasticsearch/full-response.fixtures.ts +2 -2
  69. package/src/libs/common/fixtures/src/lib/elasticsearch/search-responses.fixtures.ts +16 -16
  70. package/src/libs/common/fixtures/src/lib/records.fixtures.ts +0 -1
  71. package/src/libs/feature/editor/src/lib/+state/editor.actions.ts +0 -5
  72. package/src/libs/feature/editor/src/lib/+state/editor.effects.ts +0 -15
  73. package/src/libs/feature/editor/src/lib/+state/editor.facade.ts +0 -5
  74. package/src/libs/feature/editor/src/lib/+state/editor.reducer.ts +0 -6
  75. package/src/libs/feature/editor/src/lib/+state/editor.selectors.ts +3 -8
  76. package/src/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.html +7 -39
  77. package/src/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.ts +4 -100
  78. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.html +1 -1
  79. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.ts +19 -31
  80. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.html +9 -11
  81. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.ts +2 -3
  82. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.html +2 -2
  83. package/src/libs/ui/inputs/src/lib/url-input/url-input.component.ts +1 -9
  84. package/src/libs/ui/layout/src/lib/interactive-table/interactive-table.component.html +1 -12
  85. package/src/libs/ui/layout/src/lib/interactive-table/interactive-table.component.ts +6 -4
  86. package/src/libs/ui/search/src/lib/results-table/results-table.component.html +2 -15
  87. package/src/libs/ui/search/src/lib/results-table/results-table.component.ts +5 -6
  88. package/src/libs/util/shared/src/lib/links/link-utils.ts +1 -48
  89. package/tailwind.base.config.js +0 -2
  90. package/translations/de.json +0 -6
  91. package/translations/en.json +0 -6
  92. package/translations/es.json +0 -6
  93. package/translations/fr.json +0 -6
  94. package/translations/it.json +1 -9
  95. package/translations/nl.json +0 -6
  96. package/translations/pt.json +0 -6
  97. package/translations/sk.json +0 -6
@@ -124,9 +124,9 @@ export const elasticHitsOnlyFixture = () => ({
124
124
  sourceCatalogue: '6731be1e-6533-44e0-9b8a-580b45e36e80',
125
125
  link: [],
126
126
  },
127
- edit: true,
127
+ edit: false,
128
128
  owner: false,
129
- isPublishedToAll: true,
129
+ isPublishedToAll: false,
130
130
  view: false,
131
131
  notify: false,
132
132
  download: false,
@@ -203,9 +203,9 @@ export const elasticHitsOnlyFixture = () => ({
203
203
  userSavedCount: '4',
204
204
  link: [],
205
205
  },
206
- edit: true,
206
+ edit: false,
207
207
  owner: false,
208
- isPublishedToAll: true,
208
+ isPublishedToAll: false,
209
209
  view: false,
210
210
  notify: false,
211
211
  download: false,
@@ -299,7 +299,7 @@ export const elasticSummaryHitsFixture = () => ({
299
299
  userSavedCount: '5',
300
300
  },
301
301
  sort: [1660176316000],
302
- edit: true,
302
+ edit: false,
303
303
  owner: false,
304
304
  isPublishedToAll: true,
305
305
  view: true,
@@ -370,7 +370,7 @@ export const elasticSummaryHitsFixture = () => ({
370
370
  userSavedCount: '0',
371
371
  },
372
372
  sort: [1660089739000],
373
- edit: true,
373
+ edit: false,
374
374
  owner: false,
375
375
  isPublishedToAll: true,
376
376
  view: true,
@@ -428,7 +428,7 @@ export const elasticSummaryHitsFixture = () => ({
428
428
  userSavedCount: '0',
429
429
  },
430
430
  sort: [1660089729000],
431
- edit: true,
431
+ edit: false,
432
432
  owner: false,
433
433
  isPublishedToAll: true,
434
434
  view: true,
@@ -1531,7 +1531,7 @@ export const elasticServiceMetadataHistsFixture = () => ({
1531
1531
  },
1532
1532
  ],
1533
1533
  },
1534
- edit: true,
1534
+ edit: false,
1535
1535
  canReview: false,
1536
1536
  owner: false,
1537
1537
  isPublishedToAll: true,
@@ -1715,7 +1715,7 @@ export const elasticServiceMetadataHistsFixture = () => ({
1715
1715
  op3: ['1', '25', '14688'],
1716
1716
  op6: ['1', '14688'],
1717
1717
  op5: ['1', '14688'],
1718
- edit: true,
1718
+ edit: false,
1719
1719
  canReview: false,
1720
1720
  owner: false,
1721
1721
  isPublishedToAll: true,
@@ -2369,7 +2369,7 @@ export const elasticServiceMetadataHistsFixture = () => ({
2369
2369
  inspireAnnexForFirstTheme: 'iii',
2370
2370
  userSavedCount: '0',
2371
2371
  },
2372
- edit: true,
2372
+ edit: false,
2373
2373
  canReview: false,
2374
2374
  owner: false,
2375
2375
  isPublishedToAll: true,
@@ -2796,7 +2796,7 @@ export const elasticServiceMetadataHistsFixture = () => ({
2796
2796
  uuid: 'ebef2115-bee5-40bb-b5cc-4593d82ba334',
2797
2797
  op0: '1',
2798
2798
  resourceType: ['dataset', 'map', 'map/static'],
2799
- edit: true,
2799
+ edit: false,
2800
2800
  canReview: false,
2801
2801
  owner: false,
2802
2802
  isPublishedToAll: true,
@@ -4920,7 +4920,7 @@ export const elasticReuseMetadataHitsFixture = () => ({
4920
4920
  },
4921
4921
  ],
4922
4922
  },
4923
- edit: true,
4923
+ edit: false,
4924
4924
  canReview: false,
4925
4925
  owner: false,
4926
4926
  isPublishedToAll: true,
@@ -5148,7 +5148,7 @@ export const elasticReuseMetadataHitsFixture = () => ({
5148
5148
  op3: '1',
5149
5149
  op6: '1',
5150
5150
  op5: '1',
5151
- edit: true,
5151
+ edit: false,
5152
5152
  canReview: false,
5153
5153
  owner: false,
5154
5154
  isPublishedToAll: true,
@@ -12690,7 +12690,7 @@ export const elasticReuseMetadataHitsFixture = () => ({
12690
12690
  inspireAnnexForFirstTheme: 'iii',
12691
12691
  userSavedCount: '0',
12692
12692
  },
12693
- edit: true,
12693
+ edit: false,
12694
12694
  canReview: false,
12695
12695
  owner: false,
12696
12696
  isPublishedToAll: true,
@@ -13022,7 +13022,7 @@ export const elasticReuseMetadataHitsFixture = () => ({
13022
13022
  userSavedCount: '0',
13023
13023
  sourceCatalogue: 'ce008f24-8e0d-45a8-97f8-9f10399f0190',
13024
13024
  },
13025
- edit: true,
13025
+ edit: false,
13026
13026
  canReview: false,
13027
13027
  owner: false,
13028
13028
  isPublishedToAll: true,
@@ -13349,7 +13349,7 @@ export const elasticReuseMetadataHitsFixture = () => ({
13349
13349
  userSavedCount: '0',
13350
13350
  sourceCatalogue: 'ce008f24-8e0d-45a8-97f8-9f10399f0190',
13351
13351
  },
13352
- edit: true,
13352
+ edit: false,
13353
13353
  canReview: false,
13354
13354
  owner: false,
13355
13355
  isPublishedToAll: true,
@@ -159,7 +159,6 @@ As such, **it is not very interesting at all.**`,
159
159
  defaultLanguage: 'en',
160
160
  extras: {
161
161
  isPublishedToAll: true,
162
- edit: true,
163
162
  },
164
163
  },
165
164
  {
@@ -55,8 +55,3 @@ export const isPublished = createAction(
55
55
  '[Editor] Record Saved But Not Published',
56
56
  props<{ isPublished: boolean }>()
57
57
  )
58
-
59
- export const canEditRecord = createAction(
60
- '[Editor] User can edit record',
61
- props<{ canEditRecord: boolean }>()
62
- )
@@ -152,19 +152,4 @@ export class EditorEffects {
152
152
  )
153
153
  )
154
154
  )
155
-
156
- checkCanEditRecord$ = createEffect(() =>
157
- this.actions$.pipe(
158
- ofType(EditorActions.openRecord),
159
- map(({ record }) => record.uniqueIdentifier),
160
- switchMap((uniqueIdentifier) =>
161
- this.recordsRepository.canEditRecord(uniqueIdentifier)
162
- ),
163
- map((canEditRecord) =>
164
- EditorActions.canEditRecord({
165
- canEditRecord: canEditRecord,
166
- })
167
- )
168
- )
169
- )
170
155
  }
@@ -33,7 +33,6 @@ export class EditorFacade {
33
33
  select(EditorSelectors.selectHasRecordChanged)
34
34
  )
35
35
  isPublished$ = this.store.pipe(select(EditorSelectors.selectIsPublished))
36
- canEditRecord$ = this.store.pipe(select(EditorSelectors.selectCanEditRecord))
37
36
 
38
37
  openRecord(record: CatalogRecord, recordSource: string) {
39
38
  this.store.dispatch(
@@ -72,8 +71,4 @@ export class EditorFacade {
72
71
  isPublished(isPublished: boolean) {
73
72
  this.store.dispatch(EditorActions.isPublished({ isPublished }))
74
73
  }
75
-
76
- canEditRecord(canEditRecord: boolean) {
77
- this.store.dispatch(EditorActions.canEditRecord({ canEditRecord }))
78
- }
79
74
  }
@@ -25,7 +25,6 @@ export interface EditorState {
25
25
  currentPage: number
26
26
  hasRecordChanged: { user: string; date: Date }
27
27
  isPublished: boolean
28
- canEditRecord: boolean
29
28
  }
30
29
 
31
30
  export interface EditorPartialState {
@@ -42,7 +41,6 @@ export const initialEditorState: EditorState = {
42
41
  currentPage: 0,
43
42
  hasRecordChanged: null,
44
43
  isPublished: true,
45
- canEditRecord: true,
46
44
  }
47
45
 
48
46
  const reducer = createReducer(
@@ -112,10 +110,6 @@ const reducer = createReducer(
112
110
  on(EditorActions.isPublished, (state, { isPublished }) => ({
113
111
  ...state,
114
112
  isPublished: isPublished,
115
- })),
116
- on(EditorActions.canEditRecord, (state, { canEditRecord }) => ({
117
- ...state,
118
- canEditRecord: canEditRecord,
119
113
  }))
120
114
  )
121
115
 
@@ -43,11 +43,11 @@ export const selectCurrentPage = createSelector(
43
43
  export const selectRecordSections = createSelector(
44
44
  selectEditorState,
45
45
  (state: EditorState) => {
46
- const currentPageConfig = state.editorConfig.pages[state.currentPage]
47
- if (!currentPageConfig) {
46
+ const currentPage = state.editorConfig.pages[state.currentPage]
47
+ if (!currentPage) {
48
48
  return [] as EditorSectionWithValues[]
49
49
  }
50
- return currentPageConfig.sections.map((section) => ({
50
+ return currentPage.sections.map((section) => ({
51
51
  ...section,
52
52
  fieldsWithValues: section.fields.map((fieldConfig) => ({
53
53
  config: fieldConfig,
@@ -66,8 +66,3 @@ export const selectIsPublished = createSelector(
66
66
  selectEditorState,
67
67
  (state: EditorState) => state.isPublished
68
68
  )
69
-
70
- export const selectCanEditRecord = createSelector(
71
- selectEditorState,
72
- (state: EditorState) => state.canEditRecord
73
- )
@@ -17,7 +17,6 @@
17
17
  class="flex flex-row gap-[8px]"
18
18
  [(ngModel)]="service.accessServiceProtocol"
19
19
  [disabled]="disabled"
20
- (change)="resetAllFormFields()"
21
20
  >
22
21
  <mat-radio-button
23
22
  *ngFor="let protocolOption of protocolOptions"
@@ -31,60 +30,29 @@
31
30
  <div class="flex flex-col gap-4">
32
31
  <gn-ui-url-input
33
32
  class="w-full"
34
- (uploadClick)="handleUploadClick($event)"
35
- (valueChange)="handleUrlValueChange($event)"
33
+ (valueChange)="handleUrlChange($event)"
36
34
  [disabled]="disabled"
37
35
  [value]="url"
38
- [showValidateButton]="activeLayerSuggestion"
36
+ [showValidateButton]="false"
39
37
  >
40
- <ng-content *ngIf="activeLayerSuggestion">
41
- <ng-icon name="iconoirCloudUpload"></ng-icon>
42
- </ng-content>
38
+ <ng-icon name="iconoirCloudUpload"></ng-icon>
43
39
  </gn-ui-url-input>
44
40
 
45
- <p class="text-sm text-red-500 pl-4" *ngIf="errorMessage" translate>
46
- editor.record.form.field.onlineResource.edit.identifier.error
47
- </p>
48
-
49
41
  <gn-ui-text-input
50
42
  class="grow border-b border-gray-300 pb-4"
51
43
  [(value)]="service.identifierInService"
52
44
  [placeholder]="getIdentifierPlaceholder() | translate"
53
45
  data-cy="identifier-in-service"
54
46
  [disabled]="disabled"
55
- *ngIf="
56
- !activeLayerSuggestion ||
57
- (url && errorMessage) ||
58
- (modifyMode && (layers$ | async).length === 0)
59
- "
60
47
  ></gn-ui-text-input>
61
- <gn-ui-autocomplete
62
- class="border-b border-gray-300 pb-4"
63
- [placeholder]="
64
- 'editor.record.form.field.onlineResource.edit.identifier.select.label'
65
- | translate
66
- "
67
- [action]="autoCompleteAction"
68
- (itemSelected)="handleSelectValue($event)"
69
- [displayWithFn]="displayWithFn"
70
- [minCharacterCount]="0"
71
- [clearOnSelection]="false"
72
- *ngIf="activeLayerSuggestion && (layers$ | async)?.length > 0"
73
- >
74
- </gn-ui-autocomplete>
48
+
75
49
  <gn-ui-button
76
50
  (buttonClick)="submitIdentifier(service.identifierInService)"
77
- [disabled]="disabled || !service.identifierInService"
51
+ [disabled]="disabled || !service.identifierInService || !url"
78
52
  type="primary"
79
- *ngIf="
80
- !modifyMode &&
81
- ((activeLayerSuggestion && (layers$ | async)) ||
82
- !activeLayerSuggestion ||
83
- (url && errorMessage))
84
- "
85
53
  >
86
- <span class="text-white font-bold" translate>
87
- editor.record.form.field.onlineResource.edit.identifier.submit</span
54
+ <span class="text-white font-bold" translate
55
+ >editor.record.form.field.onlineResource.edit.identifier.submit</span
88
56
  >
89
57
  </gn-ui-button>
90
58
  </div>
@@ -1,12 +1,10 @@
1
1
  import { CommonModule } from '@angular/common'
2
2
  import {
3
3
  ChangeDetectionStrategy,
4
- ChangeDetectorRef,
5
4
  Component,
6
5
  EventEmitter,
7
6
  Input,
8
7
  OnChanges,
9
- OnInit,
10
8
  Output,
11
9
  } from '@angular/core'
12
10
  import { FormsModule } from '@angular/forms'
@@ -18,7 +16,6 @@ import {
18
16
  ServiceProtocol,
19
17
  } from '../../../../../../../libs/common/domain/src/lib/model/record'
20
18
  import {
21
- AutocompleteComponent,
22
19
  ButtonComponent,
23
20
  TextInputComponent,
24
21
  UrlInputComponent,
@@ -30,15 +27,6 @@ import {
30
27
  provideNgIconsConfig,
31
28
  } from '@ng-icons/core'
32
29
  import { iconoirCloudUpload } from '@ng-icons/iconoir'
33
- import { createFuzzyFilter, getLayers } from '../../../../../../../libs/util/shared/src'
34
- import {
35
- BehaviorSubject,
36
- debounceTime,
37
- distinctUntilChanged,
38
- map,
39
- Observable,
40
- switchMap,
41
- } from 'rxjs'
42
30
 
43
31
  @Component({
44
32
  selector: 'gn-ui-online-service-resource-input',
@@ -47,7 +35,6 @@ import {
47
35
  changeDetection: ChangeDetectionStrategy.OnPush,
48
36
  standalone: true,
49
37
  imports: [
50
- AutocompleteComponent,
51
38
  ButtonComponent,
52
39
  CommonModule,
53
40
  FormsModule,
@@ -65,23 +52,18 @@ import {
65
52
  }),
66
53
  ],
67
54
  })
68
- export class OnlineServiceResourceInputComponent implements OnChanges, OnInit {
69
- @Input() service: DatasetServiceDistribution
55
+ export class OnlineServiceResourceInputComponent implements OnChanges {
56
+ @Input() service: Omit<DatasetServiceDistribution, 'url'>
70
57
  @Input() protocolHint?: string
71
58
  @Input() disabled? = false
72
- @Input() modifyMode? = false
73
59
  @Output() urlChange: EventEmitter<string> = new EventEmitter()
74
60
  @Output() identifierSubmit: EventEmitter<{
75
61
  url: string
76
62
  identifier: string
77
63
  }> = new EventEmitter()
78
64
 
79
- errorMessage = false
80
65
  selectedProtocol: ServiceProtocol
81
- url = ''
82
- layersSubject = new BehaviorSubject<{ name: string; title: string }[]>([])
83
- layers$: Observable<{ name: string; title: string }[]> =
84
- this.layersSubject.asObservable()
66
+ url: string
85
67
 
86
68
  protocolOptions: {
87
69
  label: string
@@ -117,14 +99,6 @@ export class OnlineServiceResourceInputComponent implements OnChanges, OnInit {
117
99
  },
118
100
  ]
119
101
 
120
- constructor(private cdr: ChangeDetectorRef) {}
121
-
122
- get activeLayerSuggestion() {
123
- return !['wps', 'GPFDL', 'esriRest', 'other'].includes(
124
- this.service.accessServiceProtocol
125
- )
126
- }
127
-
128
102
  ngOnChanges() {
129
103
  this.selectedProtocol =
130
104
  this.protocolOptions.find(
@@ -132,48 +106,8 @@ export class OnlineServiceResourceInputComponent implements OnChanges, OnInit {
132
106
  )?.value ?? 'other'
133
107
  }
134
108
 
135
- ngOnInit() {
136
- if (this.service.url) {
137
- this.url = this.service.url.toString()
138
- }
139
- }
140
-
141
- handleUrlValueChange(url: string) {
109
+ handleUrlChange(url: string) {
142
110
  this.url = url
143
- this.service.url = url ? new URL(url) : undefined
144
- this.resetLayersSuggestion()
145
- this.urlChange.emit(this.url)
146
- }
147
-
148
- async handleUploadClick(url: string) {
149
- this.url = url
150
-
151
- try {
152
- const layers = await getLayers(url, this.service.accessServiceProtocol)
153
-
154
- if (layers.length === 0) {
155
- throw new Error('No layers found')
156
- }
157
-
158
- this.layersSubject.next([...layers])
159
- } catch (e) {
160
- this.errorMessage = true
161
- this.layersSubject.next([])
162
- }
163
-
164
- this.cdr.detectChanges()
165
- }
166
-
167
- resetAllFormFields() {
168
- this.url = ''
169
- this.service.url = null
170
- this.resetLayersSuggestion()
171
- }
172
-
173
- resetLayersSuggestion() {
174
- this.errorMessage = false
175
- this.layersSubject.next([])
176
- this.service.identifierInService = null
177
111
  }
178
112
 
179
113
  submitIdentifier(identifier: string) {
@@ -189,34 +123,4 @@ export class OnlineServiceResourceInputComponent implements OnChanges, OnInit {
189
123
  ? `${baseKey}.wps`
190
124
  : baseKey
191
125
  }
192
-
193
- /**
194
- * gn-ui-autocomplete
195
- */
196
- displayWithFn(item: { name: string; title: string }) {
197
- return item.title
198
- ? `${item.title} ${item.name ? `(${item.name})` : ''}`
199
- : item.name
200
- }
201
-
202
- /**
203
- * gn-ui-autocomplete
204
- */
205
- autoCompleteAction = (query: string) => {
206
- const fuzzyFilter = createFuzzyFilter(query)
207
- return this.layers$.pipe(
208
- switchMap((layers) => [
209
- layers.filter((layer) => fuzzyFilter(layer.name)),
210
- ]),
211
- debounceTime(100),
212
- distinctUntilChanged()
213
- )
214
- }
215
-
216
- /**
217
- * gn-ui-autocomplete
218
- */
219
- handleSelectValue(val: { name: string; title: string }) {
220
- this.service.identifierInService = val.name
221
- }
222
126
  }
@@ -2,7 +2,7 @@
2
2
  <gn-ui-dropdown-selector
3
3
  [title]="label"
4
4
  [showTitle]="false"
5
- [choices]="choices"
5
+ [choices]="licenceOptions"
6
6
  [selected]="selectedLicence"
7
7
  (selectValue)="handleLicenceSelection($event)"
8
8
  [extraBtnClass]="'input-as-button gn-ui-text-input'"
@@ -26,47 +26,35 @@ type Licence = {
26
26
  })
27
27
  export class FormFieldLicenseComponent implements OnInit {
28
28
  @Input() label: string
29
- @Input() recordLicences: Constraint[] = []
30
- @Output() recordLicencesChange: EventEmitter<Constraint[]> =
29
+ @Input() recordConstraints: Constraint[] = []
30
+ @Output() recordConstraintsChange: EventEmitter<Constraint[]> =
31
31
  new EventEmitter()
32
32
 
33
- choices: Licence[] = AVAILABLE_LICENSES.map((license) => ({
34
- label: marker(`editor.record.form.license.${license}`),
35
- value: license,
36
- }))
37
-
38
33
  selectedLicence: string
39
34
 
40
35
  ngOnInit(): void {
41
- if (this.recordLicences.length === 0) {
42
- this.selectedLicence = 'unknown'
43
- } else {
44
- this.selectedLicence = this.recordLicences.find((constraint) => {
45
- return this.choices.find((licence) => {
46
- return licence.value === constraint.text
47
- })
48
- })?.text
49
- }
50
-
36
+ // get the licence from the record constraints if it is one of the open data licence list
37
+ this.selectedLicence = this.recordConstraints.find((constraint) => {
38
+ return this.licenceOptions.find((licence) => {
39
+ return licence.value === constraint.text
40
+ })
41
+ })?.text
42
+ // otherwise pre-select the first licence option
51
43
  if (this.selectedLicence === undefined) {
52
- this.choices = [
53
- {
54
- value: this.recordLicences[0].text,
55
- label: this.recordLicences[0].text,
56
- },
57
- ...this.choices,
58
- ]
59
- this.selectedLicence = this.recordLicences[0].text
44
+ this.selectedLicence = this.licenceOptions[0].value // cannot select 'etalab' as default as this would toggle the OpenData Toggle
45
+ this.recordConstraintsChange.emit([{ text: this.selectedLicence }])
60
46
  }
61
47
  }
62
48
 
49
+ get licenceOptions(): Licence[] {
50
+ return AVAILABLE_LICENSES.map((license) => ({
51
+ label: marker(`editor.record.form.license.${license}`),
52
+ value: license,
53
+ }))
54
+ }
55
+
63
56
  handleLicenceSelection(licenceValue: string) {
64
57
  this.selectedLicence = licenceValue
65
- if (licenceValue === 'unknown') {
66
- this.recordLicencesChange.emit([])
67
- return
68
- } else {
69
- this.recordLicencesChange.emit([{ text: licenceValue }])
70
- }
58
+ this.recordConstraintsChange.emit([{ text: licenceValue }])
71
59
  }
72
60
  }
@@ -21,6 +21,7 @@
21
21
  <gn-ui-online-service-resource-input
22
22
  [service]="newService"
23
23
  [disabled]="disabled$ | async"
24
+ (urlChange)="handleServiceUrlChange($event)"
24
25
  (identifierSubmit)="handleIdentifierSubmit($event)"
25
26
  ></gn-ui-online-service-resource-input>
26
27
  </div>
@@ -54,22 +55,19 @@
54
55
  [(value)]="onlineResource.description"
55
56
  ></gn-ui-text-area>
56
57
  </div>
57
- <ng-container *ngIf="onlineResource.type === 'service'; else urlInput">
58
+ <ng-container *ngIf="onlineResource.type === 'service'">
58
59
  <span class="w-full border-b border-gray-300"></span>
59
60
  <gn-ui-online-service-resource-input
60
61
  [service]="onlineResource"
61
- [modifyMode]="true"
62
62
  ></gn-ui-online-service-resource-input>
63
63
  </ng-container>
64
- <ng-template #urlInput>
65
- <span class="w-full border-b border-gray-300"></span>
66
- <gn-ui-url-input
67
- class="w-full"
68
- [disabled]="true"
69
- [value]="onlineResource.url"
70
- [showValidateButton]="false"
71
- ></gn-ui-url-input>
72
- </ng-template>
64
+ <span class="w-full border-b border-gray-300"></span>
65
+ <gn-ui-url-input
66
+ class="w-full"
67
+ [disabled]="true"
68
+ [value]="onlineResource.url"
69
+ [showValidateButton]="false"
70
+ ></gn-ui-url-input>
73
71
  </div>
74
72
  </ng-template>
75
73
  </div>
@@ -92,12 +92,11 @@ export class FormFieldOnlineResourcesComponent {
92
92
  notLinkResources: OnlineNotLinkResource[] = []
93
93
  uploadProgress = undefined
94
94
  uploadSubscription: Subscription = null
95
- newService = <DatasetServiceDistribution>{
95
+ newService = {
96
96
  type: 'service',
97
97
  accessServiceProtocol: 'ogcFeatures',
98
98
  identifierInService: '',
99
- url: undefined,
100
- }
99
+ } as Omit<DatasetServiceDistribution, 'url'>
101
100
 
102
101
  protected MAX_UPLOAD_SIZE_MB = MAX_UPLOAD_SIZE_MB
103
102
 
@@ -112,8 +112,8 @@
112
112
  <ng-container *ngSwitchCase="'licenses'">
113
113
  <gn-ui-form-field-license
114
114
  [label]="config.labelKey! | translate"
115
- [recordLicences]="valueAsConstraints"
116
- (recordLicencesChange)="valueChange.emit($event)"
115
+ [recordConstraints]="valueAsConstraints"
116
+ (recordConstraintsChange)="valueChange.emit($event)"
117
117
  ></gn-ui-form-field-license>
118
118
  </ng-container>
119
119
 
@@ -4,9 +4,7 @@ import {
4
4
  Component,
5
5
  EventEmitter,
6
6
  Input,
7
- OnChanges,
8
7
  Output,
9
- SimpleChanges,
10
8
  } from '@angular/core'
11
9
  import { CommonModule } from '@angular/common'
12
10
  import { ButtonComponent } from '../button/button.component'
@@ -31,7 +29,7 @@ import { iconoirArrowUp, iconoirLink } from '@ng-icons/iconoir'
31
29
  ],
32
30
  changeDetection: ChangeDetectionStrategy.OnPush,
33
31
  })
34
- export class UrlInputComponent implements OnChanges {
32
+ export class UrlInputComponent {
35
33
  @Input() set value(v: string) {
36
34
  // we're making sure to only update the input if the URL representation of it has changed; otherwise we keep it identical
37
35
  // to avoid glitches when starting to write a URL and having some characters added/replaced automatically
@@ -59,12 +57,6 @@ export class UrlInputComponent implements OnChanges {
59
57
 
60
58
  constructor(private cd: ChangeDetectorRef) {}
61
59
 
62
- ngOnChanges(changes: SimpleChanges) {
63
- if (changes['value']) {
64
- this.inputValue = changes['value'].currentValue
65
- }
66
- }
67
-
68
60
  handleInput(event: Event) {
69
61
  const value = (event.target as HTMLInputElement).value
70
62
  this.inputValue = value