geonetwork-ui 2.4.0 → 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 (153) hide show
  1. package/esm2022/libs/api/metadata-converter/src/lib/iso19139/utils/update-frequency.mapper.mjs +6 -62
  2. package/esm2022/libs/api/metadata-converter/src/lib/iso19139/write-parts.mjs +19 -1
  3. package/esm2022/libs/api/repository/src/lib/gn4/gn4-repository.mjs +24 -17
  4. package/esm2022/libs/common/domain/src/lib/model/record/metadata.model.mjs +27 -1
  5. package/esm2022/libs/common/domain/src/lib/repository/records-repository.interface.mjs +1 -1
  6. package/esm2022/libs/data-access/gn4/src/openapi/api/records.api.service.mjs +7 -1
  7. package/esm2022/libs/feature/editor/src/lib/+state/editor.actions.mjs +2 -1
  8. package/esm2022/libs/feature/editor/src/lib/+state/editor.effects.mjs +15 -14
  9. package/esm2022/libs/feature/editor/src/lib/+state/editor.facade.mjs +10 -4
  10. package/esm2022/libs/feature/editor/src/lib/+state/editor.reducer.mjs +6 -4
  11. package/esm2022/libs/feature/editor/src/lib/+state/editor.selectors.mjs +2 -2
  12. package/esm2022/libs/feature/editor/src/lib/components/constraint-card/constraint-card.component.mjs +3 -3
  13. package/esm2022/libs/feature/editor/src/lib/components/generic-keywords/generic-keywords.component.mjs +3 -3
  14. package/esm2022/libs/feature/editor/src/lib/components/import-record/import-record.component.mjs +2 -2
  15. package/esm2022/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.mjs +45 -9
  16. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.mjs +7 -12
  17. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.mjs +16 -12
  18. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.mjs +7 -13
  19. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-spatial-extent/form-field-spatial-extent.component.mjs +3 -3
  20. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-update-frequency/form-field-update-frequency.component.mjs +36 -60
  21. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.mjs +3 -3
  22. package/esm2022/libs/feature/editor/src/lib/components/record-form/record-form.component.mjs +3 -3
  23. package/esm2022/libs/feature/editor/src/lib/fields.config.mjs +11 -15
  24. package/esm2022/libs/feature/editor/src/lib/services/editor.service.mjs +9 -5
  25. package/esm2022/libs/feature/search/src/lib/results-table/results-table-container.component.mjs +3 -4
  26. package/esm2022/libs/ui/dataviz/src/lib/figure/figure.component.mjs +3 -3
  27. package/esm2022/libs/ui/elements/src/index.mjs +3 -2
  28. package/esm2022/libs/ui/elements/src/lib/image-input/image-input.component.mjs +213 -0
  29. package/esm2022/libs/ui/elements/src/lib/ui-elements.module.mjs +19 -13
  30. package/esm2022/libs/ui/inputs/src/index.mjs +5 -6
  31. package/esm2022/libs/ui/inputs/src/lib/button/button.component.mjs +2 -1
  32. package/esm2022/libs/ui/inputs/src/lib/file-input/file-input.component.mjs +5 -5
  33. package/esm2022/libs/ui/inputs/src/lib/ui-inputs.module.mjs +19 -25
  34. package/esm2022/libs/ui/inputs/src/lib/url-input/url-input.component.mjs +6 -6
  35. package/esm2022/libs/ui/search/src/lib/results-table/results-table.component.mjs +3 -6
  36. package/esm2022/translations/de.json +47 -17
  37. package/esm2022/translations/en.json +27 -16
  38. package/esm2022/translations/es.json +45 -15
  39. package/esm2022/translations/fr.json +31 -20
  40. package/esm2022/translations/it.json +261 -231
  41. package/esm2022/translations/nl.json +45 -15
  42. package/esm2022/translations/pt.json +45 -15
  43. package/fesm2022/geonetwork-ui.mjs +1352 -1160
  44. package/fesm2022/geonetwork-ui.mjs.map +1 -1
  45. package/libs/api/metadata-converter/src/lib/iso19139/utils/update-frequency.mapper.d.ts.map +1 -1
  46. package/libs/api/metadata-converter/src/lib/iso19139/write-parts.d.ts.map +1 -1
  47. package/libs/api/repository/src/lib/gn4/gn4-repository.d.ts +3 -3
  48. package/libs/api/repository/src/lib/gn4/gn4-repository.d.ts.map +1 -1
  49. package/libs/common/domain/src/lib/model/record/metadata.model.d.ts +2 -1
  50. package/libs/common/domain/src/lib/model/record/metadata.model.d.ts.map +1 -1
  51. package/libs/common/domain/src/lib/repository/records-repository.interface.d.ts +3 -3
  52. package/libs/common/domain/src/lib/repository/records-repository.interface.d.ts.map +1 -1
  53. package/libs/data-access/gn4/src/openapi/api/records.api.service.d.ts +3 -0
  54. package/libs/data-access/gn4/src/openapi/api/records.api.service.d.ts.map +1 -1
  55. package/libs/feature/editor/src/lib/+state/editor.actions.d.ts +5 -2
  56. package/libs/feature/editor/src/lib/+state/editor.actions.d.ts.map +1 -1
  57. package/libs/feature/editor/src/lib/+state/editor.effects.d.ts +3 -2
  58. package/libs/feature/editor/src/lib/+state/editor.effects.d.ts.map +1 -1
  59. package/libs/feature/editor/src/lib/+state/editor.facade.d.ts +3 -2
  60. package/libs/feature/editor/src/lib/+state/editor.facade.d.ts.map +1 -1
  61. package/libs/feature/editor/src/lib/+state/editor.reducer.d.ts +1 -1
  62. package/libs/feature/editor/src/lib/+state/editor.reducer.d.ts.map +1 -1
  63. package/libs/feature/editor/src/lib/+state/editor.selectors.d.ts +1 -1
  64. package/libs/feature/editor/src/lib/+state/editor.selectors.d.ts.map +1 -1
  65. package/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.d.ts +11 -2
  66. package/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.d.ts.map +1 -1
  67. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.d.ts +1 -4
  68. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.d.ts.map +1 -1
  69. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.d.ts +5 -4
  70. 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
  71. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.d.ts +1 -4
  72. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.d.ts.map +1 -1
  73. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-update-frequency/form-field-update-frequency.component.d.ts +1 -1
  74. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-update-frequency/form-field-update-frequency.component.d.ts.map +1 -1
  75. package/libs/feature/editor/src/lib/fields.config.d.ts.map +1 -1
  76. package/libs/feature/editor/src/lib/services/editor.service.d.ts +1 -1
  77. package/libs/feature/editor/src/lib/services/editor.service.d.ts.map +1 -1
  78. package/libs/feature/search/src/lib/results-table/results-table-container.component.d.ts +0 -1
  79. package/libs/feature/search/src/lib/results-table/results-table-container.component.d.ts.map +1 -1
  80. package/libs/ui/elements/src/index.d.ts +2 -1
  81. package/libs/ui/elements/src/index.d.ts.map +1 -1
  82. package/libs/ui/elements/src/lib/image-input/image-input.component.d.ts.map +1 -0
  83. package/libs/ui/elements/src/lib/ui-elements.module.d.ts +2 -1
  84. package/libs/ui/elements/src/lib/ui-elements.module.d.ts.map +1 -1
  85. package/libs/ui/inputs/src/index.d.ts +4 -5
  86. package/libs/ui/inputs/src/index.d.ts.map +1 -1
  87. package/libs/ui/inputs/src/lib/button/button.component.d.ts +1 -1
  88. package/libs/ui/inputs/src/lib/button/button.component.d.ts.map +1 -1
  89. package/libs/ui/inputs/src/lib/file-input/file-input.component.d.ts +1 -1
  90. package/libs/ui/inputs/src/lib/file-input/file-input.component.d.ts.map +1 -1
  91. package/libs/ui/inputs/src/lib/ui-inputs.module.d.ts +6 -7
  92. package/libs/ui/inputs/src/lib/ui-inputs.module.d.ts.map +1 -1
  93. package/libs/ui/inputs/src/lib/url-input/url-input.component.d.ts +2 -2
  94. package/libs/ui/inputs/src/lib/url-input/url-input.component.d.ts.map +1 -1
  95. package/libs/ui/search/src/lib/results-table/results-table.component.d.ts +1 -2
  96. package/libs/ui/search/src/lib/results-table/results-table.component.d.ts.map +1 -1
  97. package/package.json +1 -1
  98. package/src/libs/api/metadata-converter/src/lib/iso19139/utils/update-frequency.mapper.ts +9 -62
  99. package/src/libs/api/metadata-converter/src/lib/iso19139/write-parts.ts +18 -0
  100. package/src/libs/api/repository/src/lib/gn4/gn4-repository.ts +47 -28
  101. package/src/libs/common/domain/src/lib/model/record/metadata.model.ts +29 -7
  102. package/src/libs/common/domain/src/lib/repository/records-repository.interface.ts +4 -3
  103. package/src/libs/common/fixtures/src/lib/records.fixtures.ts +162 -0
  104. package/src/libs/data-access/gn4/src/openapi/api/records.api.service.ts +24 -4
  105. package/src/libs/feature/editor/src/lib/+state/editor.actions.ts +5 -1
  106. package/src/libs/feature/editor/src/lib/+state/editor.effects.ts +42 -31
  107. package/src/libs/feature/editor/src/lib/+state/editor.facade.ts +10 -9
  108. package/src/libs/feature/editor/src/lib/+state/editor.reducer.ts +12 -12
  109. package/src/libs/feature/editor/src/lib/+state/editor.selectors.ts +5 -5
  110. package/src/libs/feature/editor/src/lib/components/constraint-card/constraint-card.component.html +1 -1
  111. package/src/libs/feature/editor/src/lib/components/generic-keywords/generic-keywords.component.html +1 -1
  112. package/src/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.html +31 -6
  113. package/src/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.ts +47 -2
  114. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.html +1 -10
  115. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.ts +1 -7
  116. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.html +3 -18
  117. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.ts +12 -8
  118. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.html +0 -9
  119. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.ts +3 -9
  120. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-spatial-extent/form-field-spatial-extent.component.html +6 -6
  121. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-update-frequency/form-field-update-frequency.component.ts +46 -74
  122. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.html +4 -1
  123. package/src/libs/feature/editor/src/lib/components/record-form/record-form.component.html +3 -6
  124. package/src/libs/feature/editor/src/lib/fields.config.ts +10 -14
  125. package/src/libs/feature/editor/src/lib/services/editor.service.ts +18 -16
  126. package/src/libs/feature/search/src/lib/results-table/results-table-container.component.html +0 -1
  127. package/src/libs/feature/search/src/lib/results-table/results-table-container.component.ts +0 -3
  128. package/src/libs/ui/dataviz/src/lib/figure/figure.component.html +1 -0
  129. package/src/libs/ui/elements/src/index.ts +2 -1
  130. package/src/libs/ui/{inputs → elements}/src/lib/image-input/image-input.component.html +4 -19
  131. package/src/libs/ui/{inputs → elements}/src/lib/image-input/image-input.component.ts +13 -9
  132. package/src/libs/ui/elements/src/lib/ui-elements.module.ts +13 -10
  133. package/src/libs/ui/inputs/src/index.ts +4 -5
  134. package/src/libs/ui/inputs/src/lib/button/button.component.ts +2 -1
  135. package/src/libs/ui/inputs/src/lib/file-input/file-input.component.ts +1 -1
  136. package/src/libs/ui/inputs/src/lib/ui-inputs.module.ts +22 -25
  137. package/src/libs/ui/inputs/src/lib/url-input/url-input.component.html +5 -3
  138. package/src/libs/ui/inputs/src/lib/url-input/url-input.component.ts +1 -1
  139. package/src/libs/ui/search/src/lib/results-table/results-table.component.html +8 -4
  140. package/src/libs/ui/search/src/lib/results-table/results-table.component.ts +0 -1
  141. package/translations/de.json +47 -17
  142. package/translations/en.json +27 -16
  143. package/translations/es.json +45 -15
  144. package/translations/fr.json +31 -20
  145. package/translations/it.json +261 -231
  146. package/translations/nl.json +45 -15
  147. package/translations/pt.json +45 -15
  148. package/translations/sk.json +45 -15
  149. package/esm2022/libs/ui/inputs/src/lib/image-input/image-input.component.mjs +0 -214
  150. package/libs/ui/inputs/src/lib/image-input/image-input.component.d.ts.map +0 -1
  151. package/src/libs/api/metadata-converter/src/lib/dcat-ap/utils/update-frequency.mapper.ts +0 -67
  152. /package/libs/ui/{inputs → elements}/src/lib/image-input/image-input.component.d.ts +0 -0
  153. /package/src/libs/ui/{inputs → elements}/src/lib/image-input/image-input.component.css +0 -0
@@ -14,9 +14,6 @@ export class EditorFacade {
14
14
 
15
15
  record$ = this.store.pipe(select(EditorSelectors.selectRecord))
16
16
  recordSource$ = this.store.pipe(select(EditorSelectors.selectRecordSource))
17
- alreadySavedOnce$ = this.store.pipe(
18
- select(EditorSelectors.selectRecordAlreadySavedOnce)
19
- )
20
17
  saving$ = this.store.pipe(select(EditorSelectors.selectRecordSaving))
21
18
  saveError$ = this.store.pipe(
22
19
  select(EditorSelectors.selectRecordSaveError),
@@ -35,14 +32,14 @@ export class EditorFacade {
35
32
  hasRecordChanged$ = this.store.pipe(
36
33
  select(EditorSelectors.selectHasRecordChanged)
37
34
  )
35
+ isPublished$ = this.store.pipe(select(EditorSelectors.selectIsPublished))
38
36
 
39
- openRecord(
40
- record: CatalogRecord,
41
- recordSource: string,
42
- alreadySavedOnce: boolean
43
- ) {
37
+ openRecord(record: CatalogRecord, recordSource: string) {
44
38
  this.store.dispatch(
45
- EditorActions.openRecord({ record, recordSource, alreadySavedOnce })
39
+ EditorActions.openRecord({
40
+ record,
41
+ recordSource,
42
+ })
46
43
  )
47
44
  this.setCurrentPage(0)
48
45
  }
@@ -70,4 +67,8 @@ export class EditorFacade {
70
67
  checkHasRecordChanged(record: CatalogRecord) {
71
68
  this.store.dispatch(EditorActions.hasRecordChangedSinceDraft({ record }))
72
69
  }
70
+
71
+ isPublished(isPublished: boolean) {
72
+ this.store.dispatch(EditorActions.isPublished({ isPublished }))
73
+ }
73
74
  }
@@ -18,13 +18,13 @@ export const EDITOR_FEATURE_KEY = 'editor'
18
18
  export interface EditorState {
19
19
  record: CatalogRecord | null
20
20
  recordSource: string | null
21
- alreadySavedOnce: boolean
22
21
  saving: boolean
23
22
  saveError: SaveRecordError | null
24
23
  changedSinceSave: boolean
25
24
  editorConfig: EditorConfig
26
25
  currentPage: number
27
26
  hasRecordChanged: { user: string; date: Date }
27
+ isPublished: boolean
28
28
  }
29
29
 
30
30
  export interface EditorPartialState {
@@ -34,27 +34,23 @@ export interface EditorPartialState {
34
34
  export const initialEditorState: EditorState = {
35
35
  record: null,
36
36
  recordSource: null,
37
- alreadySavedOnce: false,
38
37
  saving: false,
39
38
  saveError: null,
40
39
  changedSinceSave: false,
41
40
  editorConfig: DEFAULT_CONFIGURATION,
42
41
  currentPage: 0,
43
42
  hasRecordChanged: null,
43
+ isPublished: true,
44
44
  }
45
45
 
46
46
  const reducer = createReducer(
47
47
  initialEditorState,
48
- on(
49
- EditorActions.openRecord,
50
- (state, { record, recordSource, alreadySavedOnce }) => ({
51
- ...state,
52
- changedSinceSave: false,
53
- recordSource: recordSource ?? null,
54
- alreadySavedOnce,
55
- record,
56
- })
57
- ),
48
+ on(EditorActions.openRecord, (state, { record, recordSource }) => ({
49
+ ...state,
50
+ changedSinceSave: false,
51
+ recordSource: recordSource ?? null,
52
+ record,
53
+ })),
58
54
  on(EditorActions.saveRecord, (state) => ({
59
55
  ...state,
60
56
  saving: true,
@@ -110,6 +106,10 @@ const reducer = createReducer(
110
106
  on(EditorActions.hasRecordChangedSinceDraftSuccess, (state, { changes }) => ({
111
107
  ...state,
112
108
  hasRecordChanged: changes,
109
+ })),
110
+ on(EditorActions.isPublished, (state, { isPublished }) => ({
111
+ ...state,
112
+ isPublished: isPublished,
113
113
  }))
114
114
  )
115
115
 
@@ -30,11 +30,6 @@ export const selectRecordChangedSinceSave = createSelector(
30
30
  (state: EditorState) => state.changedSinceSave
31
31
  )
32
32
 
33
- export const selectRecordAlreadySavedOnce = createSelector(
34
- selectEditorState,
35
- (state: EditorState) => state.alreadySavedOnce
36
- )
37
-
38
33
  export const selectEditorConfig = createSelector(
39
34
  selectEditorState,
40
35
  (state: EditorState) => state.editorConfig
@@ -66,3 +61,8 @@ export const selectHasRecordChanged = createSelector(
66
61
  selectEditorState,
67
62
  (state: EditorState) => state.hasRecordChanged
68
63
  )
64
+
65
+ export const selectIsPublished = createSelector(
66
+ selectEditorState,
67
+ (state: EditorState) => state.isPublished
68
+ )
@@ -22,7 +22,7 @@
22
22
  class="mt-3.5"
23
23
  [value]="constraint_.url?.toString()"
24
24
  (valueChange)="handleURLChange($event)"
25
- [showUploadButton]="false"
25
+ [showValidateButton]="false"
26
26
  >
27
27
  </gn-ui-url-input>
28
28
  </div>
@@ -1,4 +1,4 @@
1
- <div class="flex flex-col gap-3">
1
+ <div class="flex flex-col gap-4">
2
2
  <gn-ui-autocomplete
3
3
  [placeholder]="placeholder"
4
4
  [displayWithFn]="displayWithFn"
@@ -11,7 +11,7 @@
11
11
  help
12
12
  </span>
13
13
  </div>
14
- <div class="flex flex-row items-center gap-[16px] h-[48px]">
14
+ <div class="flex flex-row items-center gap-4 h-[48px]">
15
15
  <mat-radio-group
16
16
  aria-labelledby="example-radio-group-label"
17
17
  class="flex flex-row gap-[8px]"
@@ -26,8 +26,33 @@
26
26
  </mat-radio-button>
27
27
  </mat-radio-group>
28
28
  </div>
29
- <gn-ui-text-input
30
- [(value)]="service.identifierInService"
31
- data-cy="identifier-in-service"
32
- [disabled]="disabled"
33
- ></gn-ui-text-input>
29
+
30
+ <div class="flex flex-col gap-4">
31
+ <gn-ui-url-input
32
+ class="w-full"
33
+ (valueChange)="handleUrlChange($event)"
34
+ [disabled]="disabled"
35
+ [value]="url"
36
+ [showValidateButton]="false"
37
+ >
38
+ <ng-icon name="iconoirCloudUpload"></ng-icon>
39
+ </gn-ui-url-input>
40
+
41
+ <gn-ui-text-input
42
+ class="grow border-b border-gray-300 pb-4"
43
+ [(value)]="service.identifierInService"
44
+ [placeholder]="getIdentifierPlaceholder() | translate"
45
+ data-cy="identifier-in-service"
46
+ [disabled]="disabled"
47
+ ></gn-ui-text-input>
48
+
49
+ <gn-ui-button
50
+ (buttonClick)="submitIdentifier(service.identifierInService)"
51
+ [disabled]="disabled || !service.identifierInService || !url"
52
+ type="primary"
53
+ >
54
+ <span class="text-white font-bold" translate
55
+ >editor.record.form.field.onlineResource.edit.identifier.submit</span
56
+ >
57
+ </gn-ui-button>
58
+ </div>
@@ -2,8 +2,10 @@ import { CommonModule } from '@angular/common'
2
2
  import {
3
3
  ChangeDetectionStrategy,
4
4
  Component,
5
+ EventEmitter,
5
6
  Input,
6
7
  OnChanges,
8
+ Output,
7
9
  } from '@angular/core'
8
10
  import { FormsModule } from '@angular/forms'
9
11
  import { MatRadioModule } from '@angular/material/radio'
@@ -13,8 +15,18 @@ import {
13
15
  DatasetServiceDistribution,
14
16
  ServiceProtocol,
15
17
  } from '../../../../../../../libs/common/domain/src/lib/model/record'
16
- import { TextInputComponent } from '../../../../../../../libs/ui/inputs/src'
18
+ import {
19
+ ButtonComponent,
20
+ TextInputComponent,
21
+ UrlInputComponent,
22
+ } from '../../../../../../../libs/ui/inputs/src'
17
23
  import { TranslateModule } from '@ngx-translate/core'
24
+ import {
25
+ NgIconComponent,
26
+ provideIcons,
27
+ provideNgIconsConfig,
28
+ } from '@ng-icons/core'
29
+ import { iconoirCloudUpload } from '@ng-icons/iconoir'
18
30
 
19
31
  @Component({
20
32
  selector: 'gn-ui-online-service-resource-input',
@@ -23,20 +35,35 @@ import { TranslateModule } from '@ngx-translate/core'
23
35
  changeDetection: ChangeDetectionStrategy.OnPush,
24
36
  standalone: true,
25
37
  imports: [
38
+ ButtonComponent,
26
39
  CommonModule,
40
+ FormsModule,
27
41
  MatTooltipModule,
28
42
  MatRadioModule,
29
- FormsModule,
43
+ NgIconComponent,
30
44
  TextInputComponent,
31
45
  TranslateModule,
46
+ UrlInputComponent,
47
+ ],
48
+ providers: [
49
+ provideIcons({ iconoirCloudUpload }),
50
+ provideNgIconsConfig({
51
+ size: '1.5em',
52
+ }),
32
53
  ],
33
54
  })
34
55
  export class OnlineServiceResourceInputComponent implements OnChanges {
35
56
  @Input() service: Omit<DatasetServiceDistribution, 'url'>
36
57
  @Input() protocolHint?: string
37
58
  @Input() disabled? = false
59
+ @Output() urlChange: EventEmitter<string> = new EventEmitter()
60
+ @Output() identifierSubmit: EventEmitter<{
61
+ url: string
62
+ identifier: string
63
+ }> = new EventEmitter()
38
64
 
39
65
  selectedProtocol: ServiceProtocol
66
+ url: string
40
67
 
41
68
  protocolOptions: {
42
69
  label: string
@@ -78,4 +105,22 @@ export class OnlineServiceResourceInputComponent implements OnChanges {
78
105
  (option) => option.value === this.service.accessServiceProtocol
79
106
  )?.value ?? 'other'
80
107
  }
108
+
109
+ handleUrlChange(url: string) {
110
+ this.url = url
111
+ }
112
+
113
+ submitIdentifier(identifier: string) {
114
+ if (!identifier) return
115
+ this.identifierSubmit.emit({ url: this.url, identifier })
116
+ this.service.identifierInService = null
117
+ }
118
+
119
+ getIdentifierPlaceholder(): string {
120
+ const baseKey =
121
+ 'editor.record.form.field.onlineResource.edit.identifier.placeholder'
122
+ return this.service.accessServiceProtocol === 'wps'
123
+ ? `${baseKey}.wps`
124
+ : baseKey
125
+ }
81
126
  }
@@ -5,7 +5,6 @@
5
5
  (uploadCancel)="handleUploadCancel()"
6
6
  [uploadProgress]="uploadProgress"
7
7
  (urlChange)="handleUrlChange($event)"
8
- [disabled]="disabled$ | async"
9
8
  ></gn-ui-file-input>
10
9
  <div class="h-[8px]"></div>
11
10
  <gn-ui-sortable-list
@@ -42,17 +41,9 @@
42
41
  class="w-full"
43
42
  [disabled]="true"
44
43
  [value]="onlineResource.url"
45
- [showUploadButton]="false"
46
44
  [disabled]="disabled$ | async"
45
+ [showValidateButton]="false"
47
46
  ></gn-ui-url-input>
48
47
  </div>
49
48
  </ng-template>
50
- <div
51
- *ngIf="disabled$ | async"
52
- class="p-4 text-sm border border-primary bg-primary-lightest rounded-lg"
53
- translate
54
- data-test="disabled-message"
55
- >
56
- editor.record.form.field.draft.only.disabled
57
- </div>
58
49
  </div>
@@ -30,7 +30,6 @@ import { PlatformServiceInterface } from '../../../../../../../../../libs/common
30
30
  import { map, Subscription } from 'rxjs'
31
31
  import { MatDialog } from '@angular/material/dialog'
32
32
  import { MAX_UPLOAD_SIZE_MB } from '../../../../fields.config'
33
- import { EditorFacade } from '../../../../+state/editor.facade'
34
33
 
35
34
  @Component({
36
35
  selector: 'gn-ui-form-field-online-link-resources',
@@ -69,17 +68,12 @@ export class FormFieldOnlineLinkResourcesComponent {
69
68
 
70
69
  protected MAX_UPLOAD_SIZE_MB = MAX_UPLOAD_SIZE_MB
71
70
 
72
- disabled$ = this.editorFacade.alreadySavedOnce$.pipe(
73
- map((alreadySavedOnce) => !alreadySavedOnce)
74
- )
75
-
76
71
  constructor(
77
72
  private notificationsService: NotificationsService,
78
73
  private translateService: TranslateService,
79
74
  private platformService: PlatformServiceInterface,
80
75
  private cd: ChangeDetectorRef,
81
- private dialog: MatDialog,
82
- private editorFacade: EditorFacade
76
+ private dialog: MatDialog
83
77
  ) {}
84
78
 
85
79
  handleFileChange(file: File) {
@@ -4,7 +4,6 @@
4
4
  (selectedValue)="onSelectedTypeChange($event.value)"
5
5
  extraClasses="grow text-sm"
6
6
  data-cy="online-resources-type"
7
- [disabled]="disabled$ | async"
8
7
  ></gn-ui-switch-toggle>
9
8
  <div class="h-[8px]"></div>
10
9
  <gn-ui-file-input
@@ -14,7 +13,6 @@
14
13
  (uploadCancel)="handleUploadCancel()"
15
14
  [uploadProgress]="uploadProgress"
16
15
  (urlChange)="handleDownloadUrlChange($event)"
17
- [disabled]="disabled$ | async"
18
16
  ></gn-ui-file-input>
19
17
  <div
20
18
  *ngIf="selectedType === 'service'"
@@ -23,13 +21,9 @@
23
21
  <gn-ui-online-service-resource-input
24
22
  [service]="newService"
25
23
  [disabled]="disabled$ | async"
24
+ (urlChange)="handleServiceUrlChange($event)"
25
+ (identifierSubmit)="handleIdentifierSubmit($event)"
26
26
  ></gn-ui-online-service-resource-input>
27
- <span class="w-full border-b border-gray-300"></span>
28
- <gn-ui-url-input
29
- class="w-full"
30
- (uploadClick)="handleServiceUrlChange($event)"
31
- [disabled]="disabled$ | async"
32
- ></gn-ui-url-input>
33
27
  </div>
34
28
  <div class="h-[8px]"></div>
35
29
  <gn-ui-sortable-list
@@ -65,7 +59,6 @@
65
59
  <span class="w-full border-b border-gray-300"></span>
66
60
  <gn-ui-online-service-resource-input
67
61
  [service]="onlineResource"
68
- [disabled]="disabled$ | async"
69
62
  ></gn-ui-online-service-resource-input>
70
63
  </ng-container>
71
64
  <span class="w-full border-b border-gray-300"></span>
@@ -73,16 +66,8 @@
73
66
  class="w-full"
74
67
  [disabled]="true"
75
68
  [value]="onlineResource.url"
76
- [showUploadButton]="false"
69
+ [showValidateButton]="false"
77
70
  ></gn-ui-url-input>
78
71
  </div>
79
72
  </ng-template>
80
- <div
81
- *ngIf="disabled$ | async"
82
- class="p-4 text-sm border border-primary bg-primary-lightest rounded-lg"
83
- translate
84
- data-test="disabled-message"
85
- >
86
- editor.record.form.field.draft.only.disabled
87
- </div>
88
73
  </div>
@@ -32,11 +32,10 @@ import {
32
32
  SortableListComponent,
33
33
  } from '../../../../../../../../../libs/ui/layout/src'
34
34
  import { TranslateModule, TranslateService } from '@ngx-translate/core'
35
- import { map, Subscription } from 'rxjs'
35
+ import { Subscription } from 'rxjs'
36
36
  import { MAX_UPLOAD_SIZE_MB } from '../../../../fields.config'
37
37
  import { OnlineResourceCardComponent } from '../../../online-resource-card/online-resource-card.component'
38
38
  import { OnlineServiceResourceInputComponent } from '../../../online-service-resource-input/online-service-resource-input.component'
39
- import { EditorFacade } from '../../../../+state/editor.facade'
40
39
 
41
40
  type OnlineNotLinkResource =
42
41
  | DatasetDownloadDistribution
@@ -101,17 +100,12 @@ export class FormFieldOnlineResourcesComponent {
101
100
 
102
101
  protected MAX_UPLOAD_SIZE_MB = MAX_UPLOAD_SIZE_MB
103
102
 
104
- disabled$ = this.editorFacade.alreadySavedOnce$.pipe(
105
- map((alreadySavedOnce) => !alreadySavedOnce)
106
- )
107
-
108
103
  constructor(
109
104
  private notificationsService: NotificationsService,
110
105
  private translateService: TranslateService,
111
106
  private platformService: PlatformServiceInterface,
112
107
  private cd: ChangeDetectorRef,
113
- private dialog: MatDialog,
114
- private editorFacade: EditorFacade
108
+ private dialog: MatDialog
115
109
  ) {}
116
110
 
117
111
  onSelectedTypeChange(selectedType: unknown) {
@@ -174,6 +168,16 @@ export class FormFieldOnlineResourcesComponent {
174
168
  ])
175
169
  }
176
170
 
171
+ handleIdentifierSubmit(payload: { url: string; identifier: string }) {
172
+ this.valueChange.emit([
173
+ ...this.allResources,
174
+ {
175
+ ...this.newService,
176
+ url: new URL(payload.url),
177
+ },
178
+ ])
179
+ }
180
+
177
181
  handleServiceModify(
178
182
  oldService: DatasetServiceDistribution,
179
183
  newService: DatasetServiceDistribution
@@ -9,14 +9,5 @@
9
9
  (delete)="handleDelete()"
10
10
  [uploadProgress]="uploadProgress"
11
11
  (uploadCancel)="handleUploadCancel()"
12
- [disabled]="disabled$ | async"
13
12
  ></gn-ui-image-input>
14
- <div
15
- *ngIf="disabled$ | async"
16
- class="p-4 text-sm border border-primary bg-primary-lightest rounded-lg"
17
- translate
18
- data-test="disabled-message"
19
- >
20
- editor.record.form.field.draft.only.disabled
21
- </div>
22
13
  </div>
@@ -8,13 +8,12 @@ import {
8
8
  Output,
9
9
  } from '@angular/core'
10
10
  import { GraphicOverview } from '../../../../../../../../../libs/common/domain/src/lib/model/record'
11
- import { ImageInputComponent } from '../../../../../../../../../libs/ui/inputs/src'
11
+ import { ImageInputComponent } from '../../../../../../../../../libs/ui/elements/src'
12
12
  import { PlatformServiceInterface } from '../../../../../../../../../libs/common/domain/src/lib/platform.service.interface'
13
13
  import { NotificationsService } from '../../../../../../../../../libs/feature/notifications/src'
14
14
  import { TranslateModule, TranslateService } from '@ngx-translate/core'
15
- import { map, Subscription } from 'rxjs'
15
+ import { Subscription } from 'rxjs'
16
16
  import { MAX_UPLOAD_SIZE_MB } from '../../../../fields.config'
17
- import { EditorFacade } from '../../../../+state/editor.facade'
18
17
 
19
18
  @Component({
20
19
  selector: 'gn-ui-form-field-overviews',
@@ -30,10 +29,6 @@ export class FormFieldOverviewsComponent {
30
29
  @Output() valueChange: EventEmitter<Array<GraphicOverview>> =
31
30
  new EventEmitter()
32
31
 
33
- disabled$ = this.editorFacade.alreadySavedOnce$.pipe(
34
- map((alreadySavedOnce) => !alreadySavedOnce)
35
- )
36
-
37
32
  uploadProgress = undefined
38
33
  uploadSubscription: Subscription = null
39
34
 
@@ -52,8 +47,7 @@ export class FormFieldOverviewsComponent {
52
47
  private platformService: PlatformServiceInterface,
53
48
  private notificationsService: NotificationsService,
54
49
  private translateService: TranslateService,
55
- private cd: ChangeDetectorRef,
56
- private editorFacade: EditorFacade
50
+ private cd: ChangeDetectorRef
57
51
  ) {}
58
52
 
59
53
  handleFileChange(file: File) {
@@ -1,4 +1,4 @@
1
- <div class="flex flex-col gap-8">
1
+ <div class="flex flex-col gap-3">
2
2
  <gn-ui-generic-keywords
3
3
  [placeholder]="'Search for place keywords'"
4
4
  [keywords]="shownKeywords$ | async"
@@ -7,9 +7,9 @@
7
7
  (addedKeyword)="handleKeywordAdd($event)"
8
8
  >
9
9
  </gn-ui-generic-keywords>
10
- </div>
11
- <div class="w-full h-96 mt-2">
12
- <gn-ui-form-field-map-container
13
- [spatialExtents]="spatialExtents$ | async"
14
- ></gn-ui-form-field-map-container>
10
+ <div class="w-full h-96 mt-2">
11
+ <gn-ui-form-field-map-container
12
+ [spatialExtents]="spatialExtents$ | async"
13
+ ></gn-ui-form-field-map-container>
14
+ </div>
15
15
  </div>
@@ -8,6 +8,8 @@ import {
8
8
  } from '@angular/core'
9
9
  import {
10
10
  UpdateFrequency,
11
+ UpdateFrequencyCode,
12
+ updateFrequencyCodeValues,
11
13
  UpdateFrequencyCustom,
12
14
  } from '../../../../../../../../../libs/common/domain/src/lib/model/record'
13
15
  import {
@@ -18,6 +20,10 @@ import {
18
20
  import { TranslateModule, TranslateService } from '@ngx-translate/core'
19
21
  import { firstValueFrom } from 'rxjs'
20
22
 
23
+ const initialListValues = updateFrequencyCodeValues.filter(
24
+ (code) => !['unknown', 'notPlanned', 'asNeeded', 'irregular'].includes(code)
25
+ )
26
+
21
27
  @Component({
22
28
  selector: 'gn-ui-form-field-update-frequency',
23
29
  templateUrl: './form-field-update-frequency.component.html',
@@ -33,20 +39,39 @@ export class FormFieldUpdateFrequencyComponent implements OnInit {
33
39
  protected choices: DropdownChoice[] = []
34
40
 
35
41
  get planned() {
36
- return typeof this.value !== 'string'
42
+ return this.value && this.value !== 'notPlanned' && this.value !== 'unknown'
37
43
  }
38
44
 
39
45
  constructor(private translateService: TranslateService) {}
40
46
 
41
47
  async ngOnInit() {
42
48
  this.choices = await this.getInitialChoices()
49
+ if (!this.planned) {
50
+ return
51
+ }
52
+ if (
53
+ typeof this.value === 'string' &&
54
+ !this.choices.map((choice) => choice.value).includes(this.value)
55
+ ) {
56
+ this.choices = [
57
+ {
58
+ value: this.value,
59
+ label: await firstValueFrom(
60
+ this.translateService.get(
61
+ `domain.record.updateFrequency.${this.value}`
62
+ )
63
+ ),
64
+ },
65
+ ...this.choices,
66
+ ]
67
+ }
43
68
  if (typeof this.value === 'string') {
44
69
  return
45
70
  }
46
71
  const updatedTimes = this.value.updatedTimes
47
72
  const per = this.value.per
48
73
  // the update frequency is not in the list; make it appear there
49
- if (updatedTimes && updatedTimes !== 1 && updatedTimes !== 2) {
74
+ if (updatedTimes) {
50
75
  this.choices = [
51
76
  {
52
77
  value: `${per}.${updatedTimes}`,
@@ -65,90 +90,37 @@ export class FormFieldUpdateFrequencyComponent implements OnInit {
65
90
  if (this.planned) {
66
91
  this.valueChange.emit('notPlanned')
67
92
  } else {
68
- this.valueChange.emit({ updatedTimes: 1, per: 'day' })
93
+ this.valueChange.emit(this.choices[0].value as UpdateFrequencyCode)
69
94
  }
70
95
  }
71
96
 
72
97
  get selectedFrequency(): string {
73
- if (!this.value || typeof this.value === 'string') return null
98
+ if (!this.value) return null
99
+ if (typeof this.value === 'string') return this.value
74
100
  const { updatedTimes, per } = this.value
75
101
  return `${per}.${updatedTimes}`
76
102
  }
77
103
 
78
- onSelectFrequencyValue(value: unknown) {
79
- const split = (value as string).split('.')
80
- this.valueChange.emit({
81
- updatedTimes: Number(split[1]),
82
- per: split[0] as UpdateFrequencyCustom['per'],
83
- })
104
+ onSelectFrequencyValue(value: string) {
105
+ if (!value.includes('.')) {
106
+ this.valueChange.emit(value as UpdateFrequencyCode)
107
+ } else {
108
+ const split = (value as string).split('.')
109
+ this.valueChange.emit({
110
+ updatedTimes: Number(split[1]),
111
+ per: split[0] as UpdateFrequencyCustom['per'],
112
+ })
113
+ }
84
114
  }
85
115
 
86
116
  private async getInitialChoices() {
87
- return [
88
- {
89
- value: 'day.1',
90
- label: await firstValueFrom(
91
- this.translateService.get('domain.record.updateFrequency.day', {
92
- count: 1,
93
- })
94
- ),
95
- },
96
- {
97
- value: 'day.2',
98
- label: await firstValueFrom(
99
- this.translateService.get('domain.record.updateFrequency.day', {
100
- count: 2,
101
- })
102
- ),
103
- },
104
- {
105
- value: 'week.1',
106
- label: await firstValueFrom(
107
- this.translateService.get('domain.record.updateFrequency.week', {
108
- count: 1,
109
- })
110
- ),
111
- },
112
- {
113
- value: 'week.2',
114
- label: await firstValueFrom(
115
- this.translateService.get('domain.record.updateFrequency.week', {
116
- count: 2,
117
- })
118
- ),
119
- },
120
- {
121
- value: 'month.1',
122
- label: await firstValueFrom(
123
- this.translateService.get('domain.record.updateFrequency.month', {
124
- count: 1,
125
- })
126
- ),
127
- },
128
- {
129
- value: 'month.2',
130
- label: await firstValueFrom(
131
- this.translateService.get('domain.record.updateFrequency.month', {
132
- count: 2,
133
- })
134
- ),
135
- },
136
- {
137
- value: 'year.1',
138
- label: await firstValueFrom(
139
- this.translateService.get('domain.record.updateFrequency.year', {
140
- count: 1,
141
- })
142
- ),
143
- },
144
- {
145
- value: 'year.2',
117
+ return Promise.all(
118
+ initialListValues.map(async (value) => ({
119
+ value,
146
120
  label: await firstValueFrom(
147
- this.translateService.get('domain.record.updateFrequency.year', {
148
- count: 2,
149
- })
121
+ this.translateService.get(`domain.record.updateFrequency.${value}`)
150
122
  ),
151
- },
152
- ]
123
+ }))
124
+ )
153
125
  }
154
126
  }