geonetwork-ui 2.4.1-dev.89bb09dfa → 2.4.1-dev.9ee0df3df
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.
- package/esm2022/libs/api/metadata-converter/src/lib/gn4/gn4.converter.mjs +3 -4
- package/esm2022/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.mjs +2 -5
- package/esm2022/libs/api/metadata-converter/src/lib/gn4/types/metadata.model.mjs +1 -1
- package/esm2022/libs/api/repository/src/lib/gn4/gn4-repository.mjs +16 -27
- package/esm2022/libs/common/domain/src/lib/repository/records-repository.interface.mjs +1 -1
- package/esm2022/libs/data-access/gn4/src/openapi/api/records.api.service.mjs +1 -7
- package/esm2022/libs/feature/editor/src/lib/+state/editor.actions.mjs +1 -3
- package/esm2022/libs/feature/editor/src/lib/+state/editor.effects.mjs +14 -18
- package/esm2022/libs/feature/editor/src/lib/+state/editor.facade.mjs +5 -15
- package/esm2022/libs/feature/editor/src/lib/+state/editor.reducer.mjs +4 -10
- package/esm2022/libs/feature/editor/src/lib/+state/editor.selectors.mjs +5 -6
- package/esm2022/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.mjs +10 -57
- package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.mjs +23 -36
- package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.mjs +12 -7
- package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.mjs +12 -8
- package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.mjs +12 -6
- package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.mjs +3 -3
- package/esm2022/libs/feature/editor/src/lib/services/editor.service.mjs +5 -9
- package/esm2022/libs/feature/search/src/lib/results-table/results-table-container.component.mjs +4 -3
- package/esm2022/libs/ui/dataviz/src/lib/figure/figure.component.mjs +3 -3
- package/esm2022/libs/ui/inputs/src/lib/file-input/file-input.component.mjs +4 -4
- package/esm2022/libs/ui/layout/src/lib/interactive-table/interactive-table.component.mjs +4 -9
- package/esm2022/libs/ui/search/src/lib/results-table/results-table.component.mjs +10 -10
- package/esm2022/libs/util/shared/src/lib/links/link-utils.mjs +1 -40
- package/esm2022/translations/de.json +6 -29
- package/esm2022/translations/en.json +9 -13
- package/esm2022/translations/es.json +4 -27
- package/esm2022/translations/fr.json +9 -13
- package/esm2022/translations/it.json +218 -243
- package/esm2022/translations/nl.json +4 -27
- package/esm2022/translations/pt.json +4 -27
- package/fesm2022/geonetwork-ui.mjs +616 -883
- package/fesm2022/geonetwork-ui.mjs.map +1 -1
- package/libs/api/metadata-converter/src/lib/gn4/gn4.converter.d.ts.map +1 -1
- package/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.d.ts.map +1 -1
- package/libs/api/metadata-converter/src/lib/gn4/types/metadata.model.d.ts +0 -1
- package/libs/api/metadata-converter/src/lib/gn4/types/metadata.model.d.ts.map +1 -1
- package/libs/api/repository/src/lib/gn4/gn4-repository.d.ts +3 -4
- package/libs/api/repository/src/lib/gn4/gn4-repository.d.ts.map +1 -1
- package/libs/common/domain/src/lib/repository/records-repository.interface.d.ts +3 -4
- package/libs/common/domain/src/lib/repository/records-repository.interface.d.ts.map +1 -1
- package/libs/data-access/gn4/src/openapi/api/records.api.service.d.ts +0 -3
- package/libs/data-access/gn4/src/openapi/api/records.api.service.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/+state/editor.actions.d.ts +2 -10
- package/libs/feature/editor/src/lib/+state/editor.actions.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/+state/editor.effects.d.ts +2 -6
- package/libs/feature/editor/src/lib/+state/editor.effects.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/+state/editor.facade.d.ts +2 -5
- package/libs/feature/editor/src/lib/+state/editor.facade.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/+state/editor.reducer.d.ts +1 -2
- package/libs/feature/editor/src/lib/+state/editor.reducer.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/+state/editor.selectors.d.ts +1 -2
- package/libs/feature/editor/src/lib/+state/editor.selectors.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.d.ts +5 -16
- package/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.d.ts +4 -4
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.d.ts +4 -1
- 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
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.d.ts +5 -2
- 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
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.d.ts +4 -1
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/services/editor.service.d.ts +1 -1
- package/libs/feature/editor/src/lib/services/editor.service.d.ts.map +1 -1
- package/libs/feature/search/src/lib/results-table/results-table-container.component.d.ts +1 -0
- package/libs/feature/search/src/lib/results-table/results-table-container.component.d.ts.map +1 -1
- package/libs/ui/elements/src/lib/record-api-form/record-api-form.component.d.ts +1 -1
- package/libs/ui/inputs/src/lib/file-input/file-input.component.d.ts +1 -1
- package/libs/ui/inputs/src/lib/file-input/file-input.component.d.ts.map +1 -1
- package/libs/ui/layout/src/lib/interactive-table/interactive-table.component.d.ts +1 -2
- package/libs/ui/layout/src/lib/interactive-table/interactive-table.component.d.ts.map +1 -1
- package/libs/ui/search/src/lib/results-table/results-table.component.d.ts +3 -3
- package/libs/ui/search/src/lib/results-table/results-table.component.d.ts.map +1 -1
- package/libs/util/shared/src/lib/links/link-utils.d.ts +1 -2
- package/libs/util/shared/src/lib/links/link-utils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/libs/api/metadata-converter/src/lib/gn4/gn4.converter.ts +3 -4
- package/src/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.ts +1 -8
- package/src/libs/api/metadata-converter/src/lib/gn4/types/metadata.model.ts +0 -1
- package/src/libs/api/repository/src/lib/gn4/gn4-repository.ts +27 -53
- package/src/libs/common/domain/src/lib/repository/records-repository.interface.ts +4 -5
- package/src/libs/common/fixtures/src/lib/elasticsearch/full-response.fixtures.ts +2 -2
- package/src/libs/common/fixtures/src/lib/elasticsearch/search-responses.fixtures.ts +16 -16
- package/src/libs/common/fixtures/src/lib/records.fixtures.ts +0 -163
- package/src/libs/data-access/gn4/src/openapi/api/records.api.service.ts +4 -24
- package/src/libs/feature/editor/src/lib/+state/editor.actions.ts +1 -10
- package/src/libs/feature/editor/src/lib/+state/editor.effects.ts +31 -57
- package/src/libs/feature/editor/src/lib/+state/editor.facade.ts +9 -15
- package/src/libs/feature/editor/src/lib/+state/editor.reducer.ts +12 -18
- package/src/libs/feature/editor/src/lib/+state/editor.selectors.ts +8 -13
- package/src/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.html +7 -38
- package/src/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.ts +3 -62
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.html +1 -1
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.ts +19 -31
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.html +10 -1
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.ts +7 -1
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.html +20 -11
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.ts +10 -5
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.html +9 -0
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.ts +8 -2
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.html +2 -2
- package/src/libs/feature/editor/src/lib/services/editor.service.ts +16 -18
- package/src/libs/feature/search/src/lib/results-table/results-table-container.component.html +1 -0
- package/src/libs/feature/search/src/lib/results-table/results-table-container.component.ts +3 -0
- package/src/libs/ui/dataviz/src/lib/figure/figure.component.html +0 -1
- package/src/libs/ui/inputs/src/lib/file-input/file-input.component.ts +1 -1
- package/src/libs/ui/layout/src/lib/interactive-table/interactive-table.component.html +1 -12
- package/src/libs/ui/layout/src/lib/interactive-table/interactive-table.component.ts +6 -4
- package/src/libs/ui/search/src/lib/results-table/results-table.component.html +6 -23
- package/src/libs/ui/search/src/lib/results-table/results-table.component.ts +6 -6
- package/src/libs/util/shared/src/lib/links/link-utils.ts +1 -51
- package/tailwind.base.config.js +0 -2
- package/translations/de.json +6 -29
- package/translations/en.json +9 -13
- package/translations/es.json +4 -27
- package/translations/fr.json +9 -13
- package/translations/it.json +218 -243
- package/translations/nl.json +4 -27
- package/translations/pt.json +4 -27
- package/translations/sk.json +4 -27
|
@@ -8,6 +8,7 @@ import { Store } from '@ngrx/store'
|
|
|
8
8
|
import {
|
|
9
9
|
selectEditorConfig,
|
|
10
10
|
selectRecord,
|
|
11
|
+
selectRecordAlreadySavedOnce,
|
|
11
12
|
selectRecordSource,
|
|
12
13
|
} from './editor.selectors'
|
|
13
14
|
import { RecordsRepositoryInterface } from '../../../../../../libs/common/domain/src/lib/repository/records-repository.interface'
|
|
@@ -27,27 +28,31 @@ export class EditorEffects {
|
|
|
27
28
|
withLatestFrom(
|
|
28
29
|
this.store.select(selectRecord),
|
|
29
30
|
this.store.select(selectRecordSource),
|
|
30
|
-
this.store.select(selectEditorConfig)
|
|
31
|
+
this.store.select(selectEditorConfig),
|
|
32
|
+
this.store.select(selectRecordAlreadySavedOnce)
|
|
31
33
|
),
|
|
32
|
-
switchMap(([, record, recordSource, fieldsConfig]) =>
|
|
33
|
-
this.editorService
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
34
|
+
switchMap(([, record, recordSource, fieldsConfig, alreadySavedOnce]) =>
|
|
35
|
+
this.editorService
|
|
36
|
+
.saveRecord(record, recordSource, fieldsConfig, !alreadySavedOnce)
|
|
37
|
+
.pipe(
|
|
38
|
+
switchMap(([record, recordSource]) =>
|
|
39
|
+
of(
|
|
40
|
+
EditorActions.saveRecordSuccess(),
|
|
41
|
+
EditorActions.openRecord({
|
|
42
|
+
record,
|
|
43
|
+
alreadySavedOnce: true,
|
|
44
|
+
recordSource,
|
|
45
|
+
})
|
|
46
|
+
)
|
|
47
|
+
),
|
|
48
|
+
catchError((error) =>
|
|
49
|
+
of(
|
|
50
|
+
EditorActions.saveRecordFailure({
|
|
51
|
+
error,
|
|
52
|
+
})
|
|
53
|
+
)
|
|
48
54
|
)
|
|
49
55
|
)
|
|
50
|
-
)
|
|
51
56
|
)
|
|
52
57
|
)
|
|
53
58
|
)
|
|
@@ -58,14 +63,12 @@ export class EditorEffects {
|
|
|
58
63
|
ofType(EditorActions.saveRecordSuccess),
|
|
59
64
|
withLatestFrom(this.store.select(selectRecord)),
|
|
60
65
|
switchMap(([_, record]) => {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
error
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
})
|
|
68
|
-
}
|
|
66
|
+
this.gn4PlateformService.cleanRecordAttachments(record).subscribe({
|
|
67
|
+
next: (_) => undefined,
|
|
68
|
+
error: (err) => {
|
|
69
|
+
console.error(err)
|
|
70
|
+
},
|
|
71
|
+
})
|
|
69
72
|
return EMPTY
|
|
70
73
|
}),
|
|
71
74
|
catchError((error) => {
|
|
@@ -103,9 +106,10 @@ export class EditorEffects {
|
|
|
103
106
|
ofType(EditorActions.undoRecordDraft),
|
|
104
107
|
withLatestFrom(this.store.select(selectRecord)),
|
|
105
108
|
switchMap(([, record]) => this.editorService.undoRecordDraft(record)),
|
|
106
|
-
map(([record, recordSource]) =>
|
|
109
|
+
map(([record, recordSource, alreadySavedOnce]) =>
|
|
107
110
|
EditorActions.openRecord({
|
|
108
111
|
record,
|
|
112
|
+
alreadySavedOnce,
|
|
109
113
|
recordSource,
|
|
110
114
|
})
|
|
111
115
|
)
|
|
@@ -137,34 +141,4 @@ export class EditorEffects {
|
|
|
137
141
|
)
|
|
138
142
|
)
|
|
139
143
|
)
|
|
140
|
-
|
|
141
|
-
checkIsRecordPublished$ = createEffect(() =>
|
|
142
|
-
this.actions$.pipe(
|
|
143
|
-
ofType(EditorActions.openRecord),
|
|
144
|
-
map(({ record }) => record.uniqueIdentifier),
|
|
145
|
-
switchMap((uniqueIdentifier) =>
|
|
146
|
-
this.recordsRepository.getRecordPublicationStatus(uniqueIdentifier)
|
|
147
|
-
),
|
|
148
|
-
map((isPublished) =>
|
|
149
|
-
EditorActions.isPublished({
|
|
150
|
-
isPublished: isPublished,
|
|
151
|
-
})
|
|
152
|
-
)
|
|
153
|
-
)
|
|
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
144
|
}
|
|
@@ -14,6 +14,9 @@ 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
|
+
)
|
|
17
20
|
saving$ = this.store.pipe(select(EditorSelectors.selectRecordSaving))
|
|
18
21
|
saveError$ = this.store.pipe(
|
|
19
22
|
select(EditorSelectors.selectRecordSaveError),
|
|
@@ -32,15 +35,14 @@ export class EditorFacade {
|
|
|
32
35
|
hasRecordChanged$ = this.store.pipe(
|
|
33
36
|
select(EditorSelectors.selectHasRecordChanged)
|
|
34
37
|
)
|
|
35
|
-
isPublished$ = this.store.pipe(select(EditorSelectors.selectIsPublished))
|
|
36
|
-
canEditRecord$ = this.store.pipe(select(EditorSelectors.selectCanEditRecord))
|
|
37
38
|
|
|
38
|
-
openRecord(
|
|
39
|
+
openRecord(
|
|
40
|
+
record: CatalogRecord,
|
|
41
|
+
recordSource: string,
|
|
42
|
+
alreadySavedOnce: boolean
|
|
43
|
+
) {
|
|
39
44
|
this.store.dispatch(
|
|
40
|
-
EditorActions.openRecord({
|
|
41
|
-
record,
|
|
42
|
-
recordSource,
|
|
43
|
-
})
|
|
45
|
+
EditorActions.openRecord({ record, recordSource, alreadySavedOnce })
|
|
44
46
|
)
|
|
45
47
|
this.setCurrentPage(0)
|
|
46
48
|
}
|
|
@@ -68,12 +70,4 @@ export class EditorFacade {
|
|
|
68
70
|
checkHasRecordChanged(record: CatalogRecord) {
|
|
69
71
|
this.store.dispatch(EditorActions.hasRecordChangedSinceDraft({ record }))
|
|
70
72
|
}
|
|
71
|
-
|
|
72
|
-
isPublished(isPublished: boolean) {
|
|
73
|
-
this.store.dispatch(EditorActions.isPublished({ isPublished }))
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
canEditRecord(canEditRecord: boolean) {
|
|
77
|
-
this.store.dispatch(EditorActions.canEditRecord({ canEditRecord }))
|
|
78
|
-
}
|
|
79
73
|
}
|
|
@@ -18,14 +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
|
|
21
22
|
saving: boolean
|
|
22
23
|
saveError: SaveRecordError | null
|
|
23
24
|
changedSinceSave: boolean
|
|
24
25
|
editorConfig: EditorConfig
|
|
25
26
|
currentPage: number
|
|
26
27
|
hasRecordChanged: { user: string; date: Date }
|
|
27
|
-
isPublished: boolean
|
|
28
|
-
canEditRecord: boolean
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
export interface EditorPartialState {
|
|
@@ -35,24 +34,27 @@ export interface EditorPartialState {
|
|
|
35
34
|
export const initialEditorState: EditorState = {
|
|
36
35
|
record: null,
|
|
37
36
|
recordSource: null,
|
|
37
|
+
alreadySavedOnce: false,
|
|
38
38
|
saving: false,
|
|
39
39
|
saveError: null,
|
|
40
40
|
changedSinceSave: false,
|
|
41
41
|
editorConfig: DEFAULT_CONFIGURATION,
|
|
42
42
|
currentPage: 0,
|
|
43
43
|
hasRecordChanged: null,
|
|
44
|
-
isPublished: true,
|
|
45
|
-
canEditRecord: true,
|
|
46
44
|
}
|
|
47
45
|
|
|
48
46
|
const reducer = createReducer(
|
|
49
47
|
initialEditorState,
|
|
50
|
-
on(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
+
),
|
|
56
58
|
on(EditorActions.saveRecord, (state) => ({
|
|
57
59
|
...state,
|
|
58
60
|
saving: true,
|
|
@@ -108,14 +110,6 @@ const reducer = createReducer(
|
|
|
108
110
|
on(EditorActions.hasRecordChangedSinceDraftSuccess, (state, { changes }) => ({
|
|
109
111
|
...state,
|
|
110
112
|
hasRecordChanged: changes,
|
|
111
|
-
})),
|
|
112
|
-
on(EditorActions.isPublished, (state, { isPublished }) => ({
|
|
113
|
-
...state,
|
|
114
|
-
isPublished: isPublished,
|
|
115
|
-
})),
|
|
116
|
-
on(EditorActions.canEditRecord, (state, { canEditRecord }) => ({
|
|
117
|
-
...state,
|
|
118
|
-
canEditRecord: canEditRecord,
|
|
119
113
|
}))
|
|
120
114
|
)
|
|
121
115
|
|
|
@@ -30,6 +30,11 @@ 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
|
+
|
|
33
38
|
export const selectEditorConfig = createSelector(
|
|
34
39
|
selectEditorState,
|
|
35
40
|
(state: EditorState) => state.editorConfig
|
|
@@ -43,11 +48,11 @@ export const selectCurrentPage = createSelector(
|
|
|
43
48
|
export const selectRecordSections = createSelector(
|
|
44
49
|
selectEditorState,
|
|
45
50
|
(state: EditorState) => {
|
|
46
|
-
const
|
|
47
|
-
if (!
|
|
51
|
+
const currentPage = state.editorConfig.pages[state.currentPage]
|
|
52
|
+
if (!currentPage) {
|
|
48
53
|
return [] as EditorSectionWithValues[]
|
|
49
54
|
}
|
|
50
|
-
return
|
|
55
|
+
return currentPage.sections.map((section) => ({
|
|
51
56
|
...section,
|
|
52
57
|
fieldsWithValues: section.fields.map((fieldConfig) => ({
|
|
53
58
|
config: fieldConfig,
|
|
@@ -61,13 +66,3 @@ export const selectHasRecordChanged = createSelector(
|
|
|
61
66
|
selectEditorState,
|
|
62
67
|
(state: EditorState) => state.hasRecordChanged
|
|
63
68
|
)
|
|
64
|
-
|
|
65
|
-
export const selectIsPublished = createSelector(
|
|
66
|
-
selectEditorState,
|
|
67
|
-
(state: EditorState) => state.isPublished
|
|
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)="resetLayersSuggestion()"
|
|
21
20
|
>
|
|
22
21
|
<mat-radio-button
|
|
23
22
|
*ngFor="let protocolOption of protocolOptions"
|
|
@@ -31,59 +30,29 @@
|
|
|
31
30
|
<div class="flex flex-col gap-4">
|
|
32
31
|
<gn-ui-url-input
|
|
33
32
|
class="w-full"
|
|
34
|
-
(
|
|
35
|
-
(valueChange)="handleUrlValueChange($event)"
|
|
33
|
+
(valueChange)="handleUrlChange($event)"
|
|
36
34
|
[disabled]="disabled"
|
|
37
35
|
[value]="url"
|
|
38
|
-
[showValidateButton]="
|
|
36
|
+
[showValidateButton]="false"
|
|
39
37
|
>
|
|
40
|
-
<ng-
|
|
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 === undefined)
|
|
59
|
-
"
|
|
60
47
|
></gn-ui-text-input>
|
|
61
|
-
|
|
62
|
-
class="border-b border-gray-300 pb-4"
|
|
63
|
-
[showTitle]="false"
|
|
64
|
-
[title]="
|
|
65
|
-
'editor.record.form.field.onlineResource.edit.identifier.select.label'
|
|
66
|
-
| translate
|
|
67
|
-
"
|
|
68
|
-
[choices]="layers || []"
|
|
69
|
-
*ngIf="activeLayerSuggestion && layers !== undefined"
|
|
70
|
-
[selected]="service.identifierInService"
|
|
71
|
-
(selectValue)="handleSelectValue($event)"
|
|
72
|
-
>
|
|
73
|
-
</gn-ui-dropdown-selector>
|
|
48
|
+
|
|
74
49
|
<gn-ui-button
|
|
75
50
|
(buttonClick)="submitIdentifier(service.identifierInService)"
|
|
76
|
-
[disabled]="disabled || !service.identifierInService"
|
|
51
|
+
[disabled]="disabled || !service.identifierInService || !url"
|
|
77
52
|
type="primary"
|
|
78
|
-
*ngIf="
|
|
79
|
-
!modifyMode &&
|
|
80
|
-
((activeLayerSuggestion && layers) ||
|
|
81
|
-
!activeLayerSuggestion ||
|
|
82
|
-
(url && errorMessage))
|
|
83
|
-
"
|
|
84
53
|
>
|
|
85
|
-
<span class="text-white font-bold" translate
|
|
86
|
-
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
|
|
87
56
|
>
|
|
88
57
|
</gn-ui-button>
|
|
89
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'
|
|
@@ -19,8 +17,6 @@ import {
|
|
|
19
17
|
} from '../../../../../../../libs/common/domain/src/lib/model/record'
|
|
20
18
|
import {
|
|
21
19
|
ButtonComponent,
|
|
22
|
-
DropdownChoice,
|
|
23
|
-
DropdownSelectorComponent,
|
|
24
20
|
TextInputComponent,
|
|
25
21
|
UrlInputComponent,
|
|
26
22
|
} from '../../../../../../../libs/ui/inputs/src'
|
|
@@ -31,7 +27,6 @@ import {
|
|
|
31
27
|
provideNgIconsConfig,
|
|
32
28
|
} from '@ng-icons/core'
|
|
33
29
|
import { iconoirCloudUpload } from '@ng-icons/iconoir'
|
|
34
|
-
import { getLayers } from '../../../../../../../libs/util/shared/src'
|
|
35
30
|
|
|
36
31
|
@Component({
|
|
37
32
|
selector: 'gn-ui-online-service-resource-input',
|
|
@@ -40,7 +35,6 @@ import { getLayers } from '../../../../../../../libs/util/shared/src'
|
|
|
40
35
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
41
36
|
standalone: true,
|
|
42
37
|
imports: [
|
|
43
|
-
DropdownSelectorComponent,
|
|
44
38
|
ButtonComponent,
|
|
45
39
|
CommonModule,
|
|
46
40
|
FormsModule,
|
|
@@ -58,21 +52,18 @@ import { getLayers } from '../../../../../../../libs/util/shared/src'
|
|
|
58
52
|
}),
|
|
59
53
|
],
|
|
60
54
|
})
|
|
61
|
-
export class OnlineServiceResourceInputComponent implements OnChanges
|
|
62
|
-
@Input() service: DatasetServiceDistribution
|
|
55
|
+
export class OnlineServiceResourceInputComponent implements OnChanges {
|
|
56
|
+
@Input() service: Omit<DatasetServiceDistribution, 'url'>
|
|
63
57
|
@Input() protocolHint?: string
|
|
64
58
|
@Input() disabled? = false
|
|
65
|
-
@Input() modifyMode? = false
|
|
66
59
|
@Output() urlChange: EventEmitter<string> = new EventEmitter()
|
|
67
60
|
@Output() identifierSubmit: EventEmitter<{
|
|
68
61
|
url: string
|
|
69
62
|
identifier: string
|
|
70
63
|
}> = new EventEmitter()
|
|
71
64
|
|
|
72
|
-
errorMessage = false
|
|
73
65
|
selectedProtocol: ServiceProtocol
|
|
74
66
|
url: string
|
|
75
|
-
layers: DropdownChoice[] | undefined = undefined
|
|
76
67
|
|
|
77
68
|
protocolOptions: {
|
|
78
69
|
label: string
|
|
@@ -108,14 +99,6 @@ export class OnlineServiceResourceInputComponent implements OnChanges, OnInit {
|
|
|
108
99
|
},
|
|
109
100
|
]
|
|
110
101
|
|
|
111
|
-
constructor(private cdr: ChangeDetectorRef) {}
|
|
112
|
-
|
|
113
|
-
get activeLayerSuggestion() {
|
|
114
|
-
return !['wps', 'GPFDL', 'esriRest', 'other'].includes(
|
|
115
|
-
this.service.accessServiceProtocol
|
|
116
|
-
)
|
|
117
|
-
}
|
|
118
|
-
|
|
119
102
|
ngOnChanges() {
|
|
120
103
|
this.selectedProtocol =
|
|
121
104
|
this.protocolOptions.find(
|
|
@@ -123,50 +106,8 @@ export class OnlineServiceResourceInputComponent implements OnChanges, OnInit {
|
|
|
123
106
|
)?.value ?? 'other'
|
|
124
107
|
}
|
|
125
108
|
|
|
126
|
-
|
|
127
|
-
if (this.service.url) {
|
|
128
|
-
this.url = this.service.url.toString()
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
handleUrlValueChange(url: string) {
|
|
133
|
-
this.url = url
|
|
134
|
-
this.service.url = new URL(url)
|
|
135
|
-
this.resetLayersSuggestion()
|
|
136
|
-
this.urlChange.emit(this.url)
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
async handleUploadClick(url: string) {
|
|
109
|
+
handleUrlChange(url: string) {
|
|
140
110
|
this.url = url
|
|
141
|
-
|
|
142
|
-
try {
|
|
143
|
-
const layers = await getLayers(url, this.service.accessServiceProtocol)
|
|
144
|
-
this.layers = layers.map((l) => {
|
|
145
|
-
return {
|
|
146
|
-
label: l.title ? `${l.title} ${l.name ? `(${l.name})` : ''}` : l.name,
|
|
147
|
-
value: l.name || l.title,
|
|
148
|
-
}
|
|
149
|
-
})
|
|
150
|
-
|
|
151
|
-
if (this.layers.length === 0) {
|
|
152
|
-
throw new Error('No layers found')
|
|
153
|
-
}
|
|
154
|
-
} catch (e) {
|
|
155
|
-
this.errorMessage = true
|
|
156
|
-
this.layers = undefined
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
this.cdr.detectChanges()
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
handleSelectValue(val: string) {
|
|
163
|
-
this.service.identifierInService = val
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
resetLayersSuggestion() {
|
|
167
|
-
this.errorMessage = false
|
|
168
|
-
this.layers = undefined
|
|
169
|
-
this.service.identifierInService = null
|
|
170
111
|
}
|
|
171
112
|
|
|
172
113
|
submitIdentifier(identifier: string) {
|
|
@@ -26,47 +26,35 @@ type Licence = {
|
|
|
26
26
|
})
|
|
27
27
|
export class FormFieldLicenseComponent implements OnInit {
|
|
28
28
|
@Input() label: string
|
|
29
|
-
@Input()
|
|
30
|
-
@Output()
|
|
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
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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.
|
|
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
|
-
|
|
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
|
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
(uploadCancel)="handleUploadCancel()"
|
|
6
6
|
[uploadProgress]="uploadProgress"
|
|
7
7
|
(urlChange)="handleUrlChange($event)"
|
|
8
|
+
[disabled]="disabled$ | async"
|
|
8
9
|
></gn-ui-file-input>
|
|
9
10
|
<div class="h-[8px]"></div>
|
|
10
11
|
<gn-ui-sortable-list
|
|
@@ -41,9 +42,17 @@
|
|
|
41
42
|
class="w-full"
|
|
42
43
|
[disabled]="true"
|
|
43
44
|
[value]="onlineResource.url"
|
|
44
|
-
[disabled]="disabled$ | async"
|
|
45
45
|
[showValidateButton]="false"
|
|
46
|
+
[disabled]="disabled$ | async"
|
|
46
47
|
></gn-ui-url-input>
|
|
47
48
|
</div>
|
|
48
49
|
</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>
|
|
49
58
|
</div>
|
|
@@ -30,6 +30,7 @@ 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'
|
|
33
34
|
|
|
34
35
|
@Component({
|
|
35
36
|
selector: 'gn-ui-form-field-online-link-resources',
|
|
@@ -68,12 +69,17 @@ export class FormFieldOnlineLinkResourcesComponent {
|
|
|
68
69
|
|
|
69
70
|
protected MAX_UPLOAD_SIZE_MB = MAX_UPLOAD_SIZE_MB
|
|
70
71
|
|
|
72
|
+
disabled$ = this.editorFacade.alreadySavedOnce$.pipe(
|
|
73
|
+
map((alreadySavedOnce) => !alreadySavedOnce)
|
|
74
|
+
)
|
|
75
|
+
|
|
71
76
|
constructor(
|
|
72
77
|
private notificationsService: NotificationsService,
|
|
73
78
|
private translateService: TranslateService,
|
|
74
79
|
private platformService: PlatformServiceInterface,
|
|
75
80
|
private cd: ChangeDetectorRef,
|
|
76
|
-
private dialog: MatDialog
|
|
81
|
+
private dialog: MatDialog,
|
|
82
|
+
private editorFacade: EditorFacade
|
|
77
83
|
) {}
|
|
78
84
|
|
|
79
85
|
handleFileChange(file: File) {
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
(selectedValue)="onSelectedTypeChange($event.value)"
|
|
5
5
|
extraClasses="grow text-sm"
|
|
6
6
|
data-cy="online-resources-type"
|
|
7
|
+
[disabled]="disabled$ | async"
|
|
7
8
|
></gn-ui-switch-toggle>
|
|
8
9
|
<div class="h-[8px]"></div>
|
|
9
10
|
<gn-ui-file-input
|
|
@@ -13,6 +14,7 @@
|
|
|
13
14
|
(uploadCancel)="handleUploadCancel()"
|
|
14
15
|
[uploadProgress]="uploadProgress"
|
|
15
16
|
(urlChange)="handleDownloadUrlChange($event)"
|
|
17
|
+
[disabled]="disabled$ | async"
|
|
16
18
|
></gn-ui-file-input>
|
|
17
19
|
<div
|
|
18
20
|
*ngIf="selectedType === 'service'"
|
|
@@ -21,6 +23,7 @@
|
|
|
21
23
|
<gn-ui-online-service-resource-input
|
|
22
24
|
[service]="newService"
|
|
23
25
|
[disabled]="disabled$ | async"
|
|
26
|
+
(urlChange)="handleServiceUrlChange($event)"
|
|
24
27
|
(identifierSubmit)="handleIdentifierSubmit($event)"
|
|
25
28
|
></gn-ui-online-service-resource-input>
|
|
26
29
|
</div>
|
|
@@ -54,22 +57,28 @@
|
|
|
54
57
|
[(value)]="onlineResource.description"
|
|
55
58
|
></gn-ui-text-area>
|
|
56
59
|
</div>
|
|
57
|
-
<ng-container *ngIf="onlineResource.type === 'service'
|
|
60
|
+
<ng-container *ngIf="onlineResource.type === 'service'">
|
|
58
61
|
<span class="w-full border-b border-gray-300"></span>
|
|
59
62
|
<gn-ui-online-service-resource-input
|
|
60
63
|
[service]="onlineResource"
|
|
61
|
-
[
|
|
64
|
+
[disabled]="disabled$ | async"
|
|
62
65
|
></gn-ui-online-service-resource-input>
|
|
63
66
|
</ng-container>
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
></gn-ui-url-input>
|
|
72
|
-
</ng-template>
|
|
67
|
+
<span class="w-full border-b border-gray-300"></span>
|
|
68
|
+
<gn-ui-url-input
|
|
69
|
+
class="w-full"
|
|
70
|
+
[disabled]="true"
|
|
71
|
+
[value]="onlineResource.url"
|
|
72
|
+
[showValidateButton]="false"
|
|
73
|
+
></gn-ui-url-input>
|
|
73
74
|
</div>
|
|
74
75
|
</ng-template>
|
|
76
|
+
<div
|
|
77
|
+
*ngIf="disabled$ | async"
|
|
78
|
+
class="p-4 text-sm border border-primary bg-primary-lightest rounded-lg"
|
|
79
|
+
translate
|
|
80
|
+
data-test="disabled-message"
|
|
81
|
+
>
|
|
82
|
+
editor.record.form.field.draft.only.disabled
|
|
83
|
+
</div>
|
|
75
84
|
</div>
|