geonetwork-ui 2.4.0-dev.00c93bef → 2.4.0-dev.3c297076
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/iso19139/iso19139.converter.mjs +5 -5
- package/esm2022/libs/api/metadata-converter/src/lib/iso19139/read-parts.mjs +30 -2
- package/esm2022/libs/api/metadata-converter/src/lib/iso19139/utils/geometry.mjs +31 -0
- package/esm2022/libs/api/metadata-converter/src/lib/iso19139/write-parts.mjs +23 -1
- package/esm2022/libs/api/metadata-converter/src/lib/xml-utils.mjs +6 -1
- package/esm2022/libs/api/repository/src/lib/gn4/gn4-repository.mjs +31 -3
- package/esm2022/libs/common/domain/src/lib/model/record/metadata.model.mjs +1 -1
- 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 +2 -6
- package/esm2022/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.mjs +131 -0
- package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.mjs +21 -0
- package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-temporal-extents/form-field-temporal-extents.component.mjs +7 -6
- package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.mjs +19 -9
- package/esm2022/libs/feature/editor/src/lib/fields.config.mjs +12 -2
- package/esm2022/libs/feature/map/src/lib/utils/map-utils.service.mjs +10 -5
- package/esm2022/libs/feature/search/src/lib/results-table/results-table-container.component.mjs +41 -7
- package/esm2022/libs/feature/search/src/lib/state/search.facade.mjs +6 -2
- package/esm2022/libs/ui/elements/src/index.mjs +2 -1
- package/esm2022/libs/ui/elements/src/lib/confirmation-dialog/confirmation-dialog.component.mjs +27 -0
- package/esm2022/libs/ui/elements/src/lib/markdown-editor/markdown-editor.component.mjs +4 -3
- package/esm2022/libs/ui/elements/src/lib/markdown-parser/markdown-parser.component.mjs +2 -2
- package/esm2022/libs/ui/elements/src/lib/metadata-info/metadata-info.component.mjs +3 -3
- package/esm2022/libs/ui/elements/src/lib/metadata-quality/metadata-quality.component.mjs +5 -11
- package/esm2022/libs/ui/elements/src/lib/metadata-quality-item/metadata-quality-item.component.mjs +3 -3
- package/esm2022/libs/ui/elements/src/lib/sortable-list/sortable-list.component.mjs +6 -3
- package/esm2022/libs/ui/elements/src/lib/ui-elements.module.mjs +5 -2
- package/esm2022/libs/ui/layout/src/lib/form-field-wrapper/form-field-wrapper.component.mjs +3 -3
- package/esm2022/libs/ui/layout/src/lib/interactive-table/interactive-table.component.mjs +3 -3
- package/esm2022/libs/ui/search/src/lib/results-table/action-menu/action-menu.component.mjs +67 -0
- package/esm2022/libs/ui/search/src/lib/results-table/results-table.component.mjs +28 -8
- package/esm2022/libs/ui/widgets/src/index.mjs +2 -1
- package/esm2022/libs/ui/widgets/src/lib/popover/popover.component.mjs +68 -0
- package/esm2022/translations/de.json +18 -17
- package/esm2022/translations/en.json +11 -10
- package/esm2022/translations/es.json +10 -9
- package/esm2022/translations/fr.json +20 -19
- package/esm2022/translations/it.json +11 -10
- package/esm2022/translations/nl.json +10 -9
- package/esm2022/translations/pt.json +10 -9
- package/fesm2022/geonetwork-ui.mjs +734 -264
- package/fesm2022/geonetwork-ui.mjs.map +1 -1
- package/libs/api/metadata-converter/src/lib/iso19139/iso19139.converter.d.ts.map +1 -1
- package/libs/api/metadata-converter/src/lib/iso19139/read-parts.d.ts +8 -1
- package/libs/api/metadata-converter/src/lib/iso19139/read-parts.d.ts.map +1 -1
- package/libs/api/metadata-converter/src/lib/iso19139/utils/geometry.d.ts +5 -0
- package/libs/api/metadata-converter/src/lib/iso19139/utils/geometry.d.ts.map +1 -0
- package/libs/api/metadata-converter/src/lib/iso19139/write-parts.d.ts +3 -1
- package/libs/api/metadata-converter/src/lib/iso19139/write-parts.d.ts.map +1 -1
- package/libs/api/metadata-converter/src/lib/xml-utils.d.ts +1 -0
- package/libs/api/metadata-converter/src/lib/xml-utils.d.ts.map +1 -1
- package/libs/api/repository/src/lib/gn4/gn4-repository.d.ts +7 -1
- package/libs/api/repository/src/lib/gn4/gn4-repository.d.ts.map +1 -1
- package/libs/common/domain/src/lib/model/record/metadata.model.d.ts +2 -1
- package/libs/common/domain/src/lib/model/record/metadata.model.d.ts.map +1 -1
- package/libs/common/domain/src/lib/repository/records-repository.interface.d.ts +17 -0
- 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.map +1 -1
- package/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.d.ts +27 -0
- package/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.d.ts.map +1 -0
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.d.ts +11 -0
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.d.ts.map +1 -0
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-temporal-extents/form-field-temporal-extents.component.d.ts +3 -1
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-temporal-extents/form-field-temporal-extents.component.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.d.ts +5 -1
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/fields.config.d.ts +1 -0
- package/libs/feature/editor/src/lib/fields.config.d.ts.map +1 -1
- package/libs/feature/map/src/lib/utils/map-utils.service.d.ts.map +1 -1
- package/libs/feature/search/src/lib/results-table/results-table-container.component.d.ts +14 -4
- package/libs/feature/search/src/lib/results-table/results-table-container.component.d.ts.map +1 -1
- package/libs/feature/search/src/lib/state/search.facade.d.ts +1 -0
- package/libs/feature/search/src/lib/state/search.facade.d.ts.map +1 -1
- package/libs/ui/elements/src/index.d.ts +1 -0
- package/libs/ui/elements/src/index.d.ts.map +1 -1
- package/libs/ui/elements/src/lib/confirmation-dialog/confirmation-dialog.component.d.ts +18 -0
- package/libs/ui/elements/src/lib/confirmation-dialog/confirmation-dialog.component.d.ts.map +1 -0
- package/libs/ui/elements/src/lib/downloads-list/downloads-list.component.d.ts +1 -1
- package/libs/ui/elements/src/lib/metadata-quality/metadata-quality.component.d.ts +0 -3
- package/libs/ui/elements/src/lib/metadata-quality/metadata-quality.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/elements/src/lib/sortable-list/sortable-list.component.d.ts +3 -2
- package/libs/ui/elements/src/lib/sortable-list/sortable-list.component.d.ts.map +1 -1
- package/libs/ui/elements/src/lib/ui-elements.module.d.ts +7 -6
- package/libs/ui/elements/src/lib/ui-elements.module.d.ts.map +1 -1
- package/libs/ui/search/src/lib/results-table/action-menu/action-menu.component.d.ts +20 -0
- package/libs/ui/search/src/lib/results-table/action-menu/action-menu.component.d.ts.map +1 -0
- package/libs/ui/search/src/lib/results-table/results-table.component.d.ts +9 -3
- package/libs/ui/search/src/lib/results-table/results-table.component.d.ts.map +1 -1
- package/libs/ui/widgets/src/index.d.ts +1 -0
- package/libs/ui/widgets/src/index.d.ts.map +1 -1
- package/libs/ui/widgets/src/lib/popover/popover.component.d.ts +19 -0
- package/libs/ui/widgets/src/lib/popover/popover.component.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/libs/api/metadata-converter/src/lib/fixtures/geo2france.records.ts +5 -1
- package/src/libs/api/metadata-converter/src/lib/fixtures/geocat-ch.records.ts +37 -12
- package/src/libs/api/metadata-converter/src/lib/fixtures/metawal.records.ts +5 -1
- package/src/libs/api/metadata-converter/src/lib/iso19139/iso19139.converter.ts +4 -2
- package/src/libs/api/metadata-converter/src/lib/iso19139/read-parts.ts +72 -2
- package/src/libs/api/metadata-converter/src/lib/iso19139/utils/geometry.ts +39 -0
- package/src/libs/api/metadata-converter/src/lib/iso19139/write-parts.ts +70 -1
- package/src/libs/api/metadata-converter/src/lib/xml-utils.ts +8 -0
- package/src/libs/api/repository/src/lib/gn4/gn4-repository.ts +42 -2
- package/src/libs/common/domain/src/lib/model/record/metadata.model.ts +2 -1
- package/src/libs/common/domain/src/lib/repository/records-repository.interface.ts +22 -0
- package/src/libs/data-access/gn4/src/openapi/api/records.api.service.ts +1 -5
- package/src/libs/data-access/gn4/src/spec.yaml +0 -8
- package/src/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.html +2 -1
- package/src/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.ts +110 -19
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.css +0 -0
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.html +5 -0
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.ts +22 -0
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-temporal-extents/form-field-temporal-extents.component.ts +8 -7
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.html +6 -0
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.ts +13 -1
- package/src/libs/feature/editor/src/lib/fields.config.ts +12 -1
- package/src/libs/feature/map/src/lib/utils/map-utils.service.ts +8 -4
- package/src/libs/feature/search/src/lib/results-table/results-table-container.component.html +3 -1
- package/src/libs/feature/search/src/lib/results-table/results-table-container.component.ts +45 -3
- package/src/libs/feature/search/src/lib/state/search.facade.ts +6 -0
- package/src/libs/ui/elements/src/index.ts +1 -0
- package/src/libs/ui/elements/src/lib/confirmation-dialog/confirmation-dialog.component.css +0 -0
- package/src/libs/ui/elements/src/lib/confirmation-dialog/confirmation-dialog.component.html +12 -0
- package/src/libs/ui/elements/src/lib/confirmation-dialog/confirmation-dialog.component.ts +37 -0
- package/src/libs/ui/elements/src/lib/markdown-editor/markdown-editor.component.html +4 -1
- package/src/libs/ui/elements/src/lib/markdown-parser/markdown-parser.component.css +2 -1
- package/src/libs/ui/elements/src/lib/metadata-info/metadata-info.component.html +12 -8
- package/src/libs/ui/elements/src/lib/metadata-quality/metadata-quality.component.html +14 -20
- package/src/libs/ui/elements/src/lib/metadata-quality/metadata-quality.component.ts +0 -10
- package/src/libs/ui/elements/src/lib/metadata-quality-item/metadata-quality-item.component.html +1 -1
- package/src/libs/ui/elements/src/lib/sortable-list/sortable-list.component.html +3 -1
- package/src/libs/ui/elements/src/lib/sortable-list/sortable-list.component.ts +6 -2
- package/src/libs/ui/elements/src/lib/ui-elements.module.ts +2 -1
- package/src/libs/ui/layout/src/lib/form-field-wrapper/form-field-wrapper.component.html +1 -1
- package/src/libs/ui/layout/src/lib/interactive-table/interactive-table.component.html +1 -0
- package/src/libs/ui/search/src/lib/results-table/action-menu/action-menu.component.css +0 -0
- package/src/libs/ui/search/src/lib/results-table/action-menu/action-menu.component.html +26 -0
- package/src/libs/ui/search/src/lib/results-table/action-menu/action-menu.component.ts +74 -0
- package/src/libs/ui/search/src/lib/results-table/results-table.component.html +15 -1
- package/src/libs/ui/search/src/lib/results-table/results-table.component.ts +26 -12
- package/src/libs/ui/widgets/src/index.ts +1 -0
- package/src/libs/ui/widgets/src/lib/popover/popover.component.css +0 -0
- package/src/libs/ui/widgets/src/lib/popover/popover.component.html +3 -0
- package/src/libs/ui/widgets/src/lib/popover/popover.component.ts +85 -0
- package/tailwind.base.css +2 -1
- package/translations/de.json +18 -17
- package/translations/en.json +11 -10
- package/translations/es.json +10 -9
- package/translations/fr.json +20 -19
- package/translations/it.json +11 -10
- package/translations/nl.json +10 -9
- package/translations/pt.json +10 -9
- package/translations/sk.json +11 -10
|
@@ -14,7 +14,9 @@ import {
|
|
|
14
14
|
UpdateFrequencyCode,
|
|
15
15
|
UpdateFrequencyCustom,
|
|
16
16
|
} from '../../../../../../libs/common/domain/src/lib/model/record'
|
|
17
|
+
import { ThesaurusModel } from '../../../../../../libs/common/domain/src/lib/model/thesaurus'
|
|
17
18
|
import format from 'date-fns/format'
|
|
19
|
+
import { Geometry } from 'geojson'
|
|
18
20
|
import {
|
|
19
21
|
ChainableFunction,
|
|
20
22
|
fallback,
|
|
@@ -44,8 +46,8 @@ import {
|
|
|
44
46
|
setTextContent,
|
|
45
47
|
} from '../xml-utils'
|
|
46
48
|
import { readKind } from './read-parts'
|
|
49
|
+
import { writeGeometry } from './utils/geometry'
|
|
47
50
|
import { namePartsToFull } from './utils/individual-name'
|
|
48
|
-
import { ThesaurusModel } from '../../../../../../libs/common/domain/src/lib/model/thesaurus'
|
|
49
51
|
|
|
50
52
|
export function writeCharacterString(
|
|
51
53
|
text: string
|
|
@@ -101,6 +103,14 @@ export function writeDate(
|
|
|
101
103
|
)
|
|
102
104
|
}
|
|
103
105
|
|
|
106
|
+
export function writeDecimal(
|
|
107
|
+
decimal: number
|
|
108
|
+
): ChainableFunction<XmlElement, XmlElement> {
|
|
109
|
+
return tap(
|
|
110
|
+
pipe(findChildOrCreate('gco:Decimal'), setTextContent(decimal.toString()))
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
|
|
104
114
|
export function getProgressCode(status: RecordStatus): string {
|
|
105
115
|
switch (status) {
|
|
106
116
|
case 'completed':
|
|
@@ -1184,3 +1194,62 @@ export function writeTemporalExtents(
|
|
|
1184
1194
|
)
|
|
1185
1195
|
)(rootEl)
|
|
1186
1196
|
}
|
|
1197
|
+
|
|
1198
|
+
export function writeSpatialExtents(record: DatasetRecord, rootEl: XmlElement) {
|
|
1199
|
+
const appendBoundingPolygon = (geometry?: Geometry) => {
|
|
1200
|
+
if (!geometry) return null
|
|
1201
|
+
return pipe(
|
|
1202
|
+
createElement('gmd:EX_BoundingPolygon'),
|
|
1203
|
+
appendChildren(
|
|
1204
|
+
pipe(
|
|
1205
|
+
createElement('gmd:polygon'),
|
|
1206
|
+
appendChildren(() => writeGeometry(geometry))
|
|
1207
|
+
)
|
|
1208
|
+
)
|
|
1209
|
+
)
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
const appendGeographicBoundingBox = (
|
|
1213
|
+
bbox?: [number, number, number, number]
|
|
1214
|
+
) => {
|
|
1215
|
+
if (!bbox) return null
|
|
1216
|
+
return pipe(
|
|
1217
|
+
createElement('gmd:EX_GeographicBoundingBox'),
|
|
1218
|
+
appendChildren(
|
|
1219
|
+
pipe(createElement('gmd:westBoundLongitude'), writeDecimal(bbox[0])),
|
|
1220
|
+
pipe(createElement('gmd:eastBoundLongitude'), writeDecimal(bbox[2])),
|
|
1221
|
+
pipe(createElement('gmd:southBoundLatitude'), writeDecimal(bbox[1])),
|
|
1222
|
+
pipe(createElement('gmd:northBoundLatitude'), writeDecimal(bbox[3]))
|
|
1223
|
+
)
|
|
1224
|
+
)
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
const appendGeographicDescription = (description?: string) => {
|
|
1228
|
+
if (!description) return null
|
|
1229
|
+
return pipe(
|
|
1230
|
+
createElement('gmd:EX_GeographicDescription'),
|
|
1231
|
+
createChild('gmd:geographicIdentifier'),
|
|
1232
|
+
createChild('gmd:MD_Identifier'),
|
|
1233
|
+
createChild('gmd:code'),
|
|
1234
|
+
writeCharacterString(description)
|
|
1235
|
+
)
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
pipe(
|
|
1239
|
+
findOrCreateIdentification(),
|
|
1240
|
+
findNestedChildOrCreate('gmd:extent', 'gmd:EX_Extent'),
|
|
1241
|
+
removeChildrenByName('gmd:geographicElement'),
|
|
1242
|
+
appendChildren(
|
|
1243
|
+
...record.spatialExtents.map((extent) =>
|
|
1244
|
+
pipe(
|
|
1245
|
+
createElement('gmd:geographicElement'),
|
|
1246
|
+
appendChildren(
|
|
1247
|
+
appendBoundingPolygon(extent.geometry),
|
|
1248
|
+
appendGeographicBoundingBox(extent.bbox),
|
|
1249
|
+
appendGeographicDescription(extent.description)
|
|
1250
|
+
)
|
|
1251
|
+
)
|
|
1252
|
+
)
|
|
1253
|
+
)
|
|
1254
|
+
)(rootEl)
|
|
1255
|
+
}
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
XmlText,
|
|
7
7
|
} from '@rgrove/parse-xml'
|
|
8
8
|
import { ChainableFunction, fallback } from './function-utils'
|
|
9
|
+
|
|
9
10
|
export { XmlDocument, XmlElement } from '@rgrove/parse-xml'
|
|
10
11
|
|
|
11
12
|
export class XmlParseError extends Error {
|
|
@@ -115,6 +116,10 @@ export function allChildrenElement(element: XmlElement): Array<XmlElement> {
|
|
|
115
116
|
] as Array<XmlElement>
|
|
116
117
|
}
|
|
117
118
|
|
|
119
|
+
export function firstChildElement(element: XmlElement): XmlElement {
|
|
120
|
+
return allChildrenElement(element)[0] ?? null
|
|
121
|
+
}
|
|
122
|
+
|
|
118
123
|
/**
|
|
119
124
|
* Will return all matching elements nested according to the given
|
|
120
125
|
* names (similar to a path), starting form the input element;
|
|
@@ -228,6 +233,7 @@ export function xmlToString(
|
|
|
228
233
|
${padding}<${el.name}${attrs}/>
|
|
229
234
|
${parentPadding}`
|
|
230
235
|
}
|
|
236
|
+
|
|
231
237
|
return `
|
|
232
238
|
${padding}<${el.name}${attrs}>${children}</${el.name}>
|
|
233
239
|
${parentPadding}`
|
|
@@ -307,11 +313,13 @@ function getTreeRoot(element: XmlElement): XmlElement {
|
|
|
307
313
|
|
|
308
314
|
// stays on the parent element
|
|
309
315
|
// if the given elements are part of a subtree, will add the root of subtree
|
|
316
|
+
// will filter out falsy elements
|
|
310
317
|
export function appendChildren(
|
|
311
318
|
...childrenFns: Array<ChainableFunction<void, XmlElement>>
|
|
312
319
|
): ChainableFunction<XmlElement, XmlElement> {
|
|
313
320
|
return (element) => {
|
|
314
321
|
if (!element) return null
|
|
322
|
+
childrenFns = childrenFns.filter((fn) => fn)
|
|
315
323
|
element.children.push(...childrenFns.map((fn) => fn()).map(getTreeRoot))
|
|
316
324
|
element.children.forEach((el) => (el.parent = element))
|
|
317
325
|
return element
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
from,
|
|
10
10
|
Observable,
|
|
11
11
|
of,
|
|
12
|
+
Subject,
|
|
12
13
|
switchMap,
|
|
13
14
|
throwError,
|
|
14
15
|
} from 'rxjs'
|
|
@@ -32,8 +33,13 @@ import {
|
|
|
32
33
|
import { CatalogRecord } from '../../../../../../libs/common/domain/src/lib/model/record'
|
|
33
34
|
import { HttpErrorResponse } from '@angular/common/http'
|
|
34
35
|
|
|
36
|
+
const TEMPORARY_ID_PREFIX = 'TEMP-ID-'
|
|
37
|
+
|
|
35
38
|
@Injectable()
|
|
36
39
|
export class Gn4Repository implements RecordsRepositoryInterface {
|
|
40
|
+
_draftsChanged = new Subject<void>()
|
|
41
|
+
draftsChanged$ = this._draftsChanged.asObservable()
|
|
42
|
+
|
|
37
43
|
constructor(
|
|
38
44
|
private gn4SearchApi: SearchApiService,
|
|
39
45
|
private gn4SearchHelper: ElasticsearchService,
|
|
@@ -230,6 +236,26 @@ export class Gn4Repository implements RecordsRepositoryInterface {
|
|
|
230
236
|
)
|
|
231
237
|
}
|
|
232
238
|
|
|
239
|
+
openRecordForDuplication(
|
|
240
|
+
uniqueIdentifier: string
|
|
241
|
+
): Observable<[CatalogRecord, string, false] | null> {
|
|
242
|
+
return this.loadRecordAsXml(uniqueIdentifier).pipe(
|
|
243
|
+
switchMap(async (recordAsXml) => {
|
|
244
|
+
const converter = findConverterForDocument(recordAsXml)
|
|
245
|
+
const record = await converter.readRecord(recordAsXml)
|
|
246
|
+
record.uniqueIdentifier = `${TEMPORARY_ID_PREFIX}${Date.now()}`
|
|
247
|
+
record.title = `${record.title} (Copy)`
|
|
248
|
+
const xml = await converter.writeRecord(record, recordAsXml)
|
|
249
|
+
window.localStorage.setItem(
|
|
250
|
+
this.getLocalStorageKeyForRecord(record.uniqueIdentifier),
|
|
251
|
+
xml
|
|
252
|
+
)
|
|
253
|
+
this._draftsChanged.next()
|
|
254
|
+
return [record, xml, false] as [CatalogRecord, string, false]
|
|
255
|
+
})
|
|
256
|
+
)
|
|
257
|
+
}
|
|
258
|
+
|
|
233
259
|
private serializeRecordToXml(
|
|
234
260
|
record: CatalogRecord,
|
|
235
261
|
referenceRecordSource?: string
|
|
@@ -275,17 +301,26 @@ export class Gn4Repository implements RecordsRepositoryInterface {
|
|
|
275
301
|
)
|
|
276
302
|
}
|
|
277
303
|
|
|
304
|
+
deleteRecord(uniqueIdentifier: string): Observable<void> {
|
|
305
|
+
return this.gn4RecordsApi.deleteRecord(uniqueIdentifier)
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
generateTemporaryId(): string {
|
|
309
|
+
return `${TEMPORARY_ID_PREFIX}${Date.now()}`
|
|
310
|
+
}
|
|
311
|
+
|
|
278
312
|
saveRecordAsDraft(
|
|
279
313
|
record: CatalogRecord,
|
|
280
314
|
referenceRecordSource?: string
|
|
281
315
|
): Observable<string> {
|
|
282
316
|
return this.serializeRecordToXml(record, referenceRecordSource).pipe(
|
|
283
|
-
tap((recordXml) =>
|
|
317
|
+
tap((recordXml) => {
|
|
284
318
|
window.localStorage.setItem(
|
|
285
319
|
this.getLocalStorageKeyForRecord(record.uniqueIdentifier),
|
|
286
320
|
recordXml
|
|
287
321
|
)
|
|
288
|
-
|
|
322
|
+
this._draftsChanged.next()
|
|
323
|
+
})
|
|
289
324
|
)
|
|
290
325
|
}
|
|
291
326
|
|
|
@@ -293,6 +328,7 @@ export class Gn4Repository implements RecordsRepositoryInterface {
|
|
|
293
328
|
window.localStorage.removeItem(
|
|
294
329
|
this.getLocalStorageKeyForRecord(uniqueIdentifier)
|
|
295
330
|
)
|
|
331
|
+
this._draftsChanged.next()
|
|
296
332
|
}
|
|
297
333
|
|
|
298
334
|
recordHasDraft(uniqueIdentifier: string): boolean {
|
|
@@ -303,6 +339,10 @@ export class Gn4Repository implements RecordsRepositoryInterface {
|
|
|
303
339
|
)
|
|
304
340
|
}
|
|
305
341
|
|
|
342
|
+
isRecordNotYetSaved(uniqueIdentifier: string): boolean {
|
|
343
|
+
return uniqueIdentifier.startsWith(TEMPORARY_ID_PREFIX)
|
|
344
|
+
}
|
|
345
|
+
|
|
306
346
|
// generated by copilot
|
|
307
347
|
getAllDrafts(): Observable<CatalogRecord[]> {
|
|
308
348
|
const items = { ...window.localStorage }
|
|
@@ -30,6 +30,18 @@ export abstract class RecordsRepositoryInterface {
|
|
|
30
30
|
uniqueIdentifier: string
|
|
31
31
|
): Observable<[CatalogRecord, string, boolean] | null>
|
|
32
32
|
|
|
33
|
+
/**
|
|
34
|
+
* This emits once:
|
|
35
|
+
* - record object with a new unique identifier and suffixed title
|
|
36
|
+
* - serialized representation of the record as text
|
|
37
|
+
* - false, as the duplicated record is always a draft
|
|
38
|
+
* @param uniqueIdentifier
|
|
39
|
+
* @returns Observable<[CatalogRecord, string, false] | null>
|
|
40
|
+
*/
|
|
41
|
+
abstract openRecordForDuplication(
|
|
42
|
+
uniqueIdentifier: string
|
|
43
|
+
): Observable<[CatalogRecord, string, false] | null>
|
|
44
|
+
|
|
33
45
|
/**
|
|
34
46
|
* @param record
|
|
35
47
|
* @param referenceRecordSource
|
|
@@ -40,6 +52,14 @@ export abstract class RecordsRepositoryInterface {
|
|
|
40
52
|
referenceRecordSource?: string
|
|
41
53
|
): Observable<string>
|
|
42
54
|
|
|
55
|
+
/**
|
|
56
|
+
* @param uniqueIdentifier
|
|
57
|
+
* @returns Observable<void> Returns when record is deleted
|
|
58
|
+
*/
|
|
59
|
+
abstract deleteRecord(uniqueIdentifier: string): Observable<void>
|
|
60
|
+
|
|
61
|
+
abstract generateTemporaryId(): string
|
|
62
|
+
|
|
43
63
|
/**
|
|
44
64
|
* @param record
|
|
45
65
|
* @param referenceRecordSource
|
|
@@ -52,7 +72,9 @@ export abstract class RecordsRepositoryInterface {
|
|
|
52
72
|
|
|
53
73
|
abstract clearRecordDraft(uniqueIdentifier: string): void
|
|
54
74
|
abstract recordHasDraft(uniqueIdentifier: string): boolean
|
|
75
|
+
abstract isRecordNotYetSaved(uniqueIdentifier: string): boolean
|
|
55
76
|
|
|
56
77
|
/** will return all pending drafts, both published and not published */
|
|
57
78
|
abstract getAllDrafts(): Observable<CatalogRecord[]>
|
|
79
|
+
abstract draftsChanged$: Observable<void>
|
|
58
80
|
}
|
|
@@ -7201,11 +7201,7 @@ export class RecordsApiService {
|
|
|
7201
7201
|
}
|
|
7202
7202
|
|
|
7203
7203
|
// to determine the Content-Type header
|
|
7204
|
-
const consumes: string[] = [
|
|
7205
|
-
'application/xml',
|
|
7206
|
-
'application/json',
|
|
7207
|
-
'application/x-www-form-urlencoded',
|
|
7208
|
-
]
|
|
7204
|
+
const consumes: string[] = ['application/xml']
|
|
7209
7205
|
const httpContentTypeSelected: string | undefined =
|
|
7210
7206
|
this.configuration.selectHeaderContentType(consumes)
|
|
7211
7207
|
if (httpContentTypeSelected !== undefined) {
|
|
@@ -1832,14 +1832,6 @@ paths:
|
|
|
1832
1832
|
schema:
|
|
1833
1833
|
type: string
|
|
1834
1834
|
description: XML fragment.
|
|
1835
|
-
application/json:
|
|
1836
|
-
schema:
|
|
1837
|
-
type: string
|
|
1838
|
-
description: XML fragment.
|
|
1839
|
-
application/x-www-form-urlencoded:
|
|
1840
|
-
schema:
|
|
1841
|
-
type: string
|
|
1842
|
-
description: XML fragment.
|
|
1843
1835
|
responses:
|
|
1844
1836
|
default:
|
|
1845
1837
|
description: default response
|
package/src/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.html
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<gn-ui-image-input
|
|
2
2
|
[maxSizeMB]="5"
|
|
3
3
|
[previewUrl]="resourceUrl"
|
|
4
|
-
[altText]="
|
|
4
|
+
[altText]="resourceAltText"
|
|
5
5
|
(fileChange)="handleFileChange($event)"
|
|
6
6
|
(urlChange)="handleUrlChange($event)"
|
|
7
|
+
(altTextChange)="handleAltTextChange($event)"
|
|
7
8
|
(delete)="handleDelete()"
|
|
8
9
|
></gn-ui-image-input>
|
package/src/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.ts
CHANGED
|
@@ -2,12 +2,18 @@ import {
|
|
|
2
2
|
ChangeDetectionStrategy,
|
|
3
3
|
ChangeDetectorRef,
|
|
4
4
|
Component,
|
|
5
|
+
EventEmitter,
|
|
5
6
|
Input,
|
|
7
|
+
OnChanges,
|
|
6
8
|
OnInit,
|
|
9
|
+
Output,
|
|
10
|
+
SimpleChanges,
|
|
7
11
|
} from '@angular/core'
|
|
8
12
|
import { CommonModule } from '@angular/common'
|
|
9
13
|
import { RecordsApiService } from '../../../../../../../libs/data-access/gn4/src'
|
|
10
14
|
import { UiInputsModule } from '../../../../../../../libs/ui/inputs/src'
|
|
15
|
+
import { FormControl } from '@angular/forms'
|
|
16
|
+
import { GraphicOverview } from '../../../../../../../libs/common/domain/src/lib/model/record'
|
|
11
17
|
|
|
12
18
|
@Component({
|
|
13
19
|
selector: 'gn-ui-overview-upload',
|
|
@@ -17,9 +23,13 @@ import { UiInputsModule } from '../../../../../../../libs/ui/inputs/src'
|
|
|
17
23
|
styleUrls: ['./overview-upload.component.css'],
|
|
18
24
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
19
25
|
})
|
|
20
|
-
export class OverviewUploadComponent implements OnInit {
|
|
26
|
+
export class OverviewUploadComponent implements OnInit, OnChanges {
|
|
21
27
|
@Input() metadataUuid: string
|
|
28
|
+
@Input() formControl!: FormControl
|
|
29
|
+
@Output() overviewChange = new EventEmitter<GraphicOverview | null>()
|
|
30
|
+
@Output() altTextChange: EventEmitter<string> = new EventEmitter()
|
|
22
31
|
|
|
32
|
+
resourceAltText: string
|
|
23
33
|
resourceFileName: string
|
|
24
34
|
resourceUrl: string
|
|
25
35
|
|
|
@@ -29,42 +39,123 @@ export class OverviewUploadComponent implements OnInit {
|
|
|
29
39
|
) {}
|
|
30
40
|
|
|
31
41
|
ngOnInit(): void {
|
|
32
|
-
this.recordsApiService
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
42
|
+
this.recordsApiService.getAllResources(this.metadataUuid).subscribe({
|
|
43
|
+
next: (resources) => {
|
|
44
|
+
if (resources && resources.length > 0) {
|
|
45
|
+
this.resourceUrl = resources[0].url
|
|
46
|
+
this.resourceFileName = resources[0].filename
|
|
47
|
+
if (!this.resourceAltText) {
|
|
48
|
+
this.resourceAltText = this.resourceFileName
|
|
49
|
+
}
|
|
50
|
+
} else {
|
|
51
|
+
this.resourceUrl = ''
|
|
52
|
+
this.resourceAltText = ''
|
|
53
|
+
this.resourceFileName = ''
|
|
54
|
+
}
|
|
55
|
+
|
|
37
56
|
this.cd.markForCheck()
|
|
38
|
-
}
|
|
57
|
+
},
|
|
58
|
+
error: this.errorHandle,
|
|
59
|
+
})
|
|
39
60
|
}
|
|
40
61
|
|
|
41
62
|
handleFileChange(file: File) {
|
|
42
63
|
this.recordsApiService
|
|
43
64
|
.putResource(this.metadataUuid, file, 'public')
|
|
44
|
-
.subscribe(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
65
|
+
.subscribe({
|
|
66
|
+
next: (resource) => {
|
|
67
|
+
this.resourceUrl = resource.url
|
|
68
|
+
this.resourceAltText = resource.filename
|
|
69
|
+
|
|
70
|
+
this.overviewChange.emit({
|
|
71
|
+
url: new URL(resource.url),
|
|
72
|
+
description: resource.filename,
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
this.cd.markForCheck()
|
|
76
|
+
},
|
|
77
|
+
error: this.errorHandle,
|
|
48
78
|
})
|
|
49
79
|
}
|
|
50
80
|
|
|
51
81
|
handleUrlChange(url: string) {
|
|
52
82
|
this.recordsApiService
|
|
53
83
|
.putResourceFromURL(this.metadataUuid, url, 'public')
|
|
54
|
-
.subscribe(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
84
|
+
.subscribe({
|
|
85
|
+
next: (resource) => {
|
|
86
|
+
this.resourceUrl = resource.url
|
|
87
|
+
this.resourceAltText = resource.filename
|
|
88
|
+
|
|
89
|
+
this.overviewChange.emit({
|
|
90
|
+
url: new URL(resource.url),
|
|
91
|
+
description: resource.filename,
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
this.cd.markForCheck()
|
|
95
|
+
},
|
|
96
|
+
error: this.errorHandle,
|
|
58
97
|
})
|
|
59
98
|
}
|
|
60
99
|
|
|
100
|
+
handleAltTextChange(newAltText: string) {
|
|
101
|
+
this.resourceAltText = newAltText
|
|
102
|
+
|
|
103
|
+
this.overviewChange.emit({
|
|
104
|
+
url: new URL(this.resourceUrl),
|
|
105
|
+
description: this.resourceAltText,
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
this.cd.markForCheck()
|
|
109
|
+
}
|
|
110
|
+
|
|
61
111
|
handleDelete() {
|
|
112
|
+
//this.formControl.markAsDirty()
|
|
62
113
|
this.recordsApiService
|
|
63
114
|
.delResource(this.metadataUuid, this.resourceFileName)
|
|
64
|
-
.subscribe(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
115
|
+
.subscribe({
|
|
116
|
+
next: () => {
|
|
117
|
+
this.resourceAltText = ''
|
|
118
|
+
this.resourceUrl = ''
|
|
119
|
+
|
|
120
|
+
this.overviewChange.emit(null)
|
|
121
|
+
|
|
122
|
+
this.cd.markForCheck()
|
|
123
|
+
},
|
|
124
|
+
error: this.errorHandle,
|
|
68
125
|
})
|
|
69
126
|
}
|
|
127
|
+
|
|
128
|
+
private errorHandle = (error: never) => {
|
|
129
|
+
console.error(error)
|
|
130
|
+
|
|
131
|
+
this.resourceUrl = ''
|
|
132
|
+
this.resourceAltText = ''
|
|
133
|
+
this.resourceFileName = ''
|
|
134
|
+
|
|
135
|
+
this.overviewChange.emit(null)
|
|
136
|
+
|
|
137
|
+
this.cd.markForCheck()
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
141
|
+
const overviewChanges = changes['formControl']
|
|
142
|
+
if (
|
|
143
|
+
overviewChanges &&
|
|
144
|
+
overviewChanges.currentValue !== overviewChanges.previousValue
|
|
145
|
+
) {
|
|
146
|
+
let overview: GraphicOverview
|
|
147
|
+
if (
|
|
148
|
+
overviewChanges.currentValue.value &&
|
|
149
|
+
overviewChanges.currentValue.value.length > 0
|
|
150
|
+
) {
|
|
151
|
+
overview = overviewChanges.currentValue.value[0] as GraphicOverview
|
|
152
|
+
} else {
|
|
153
|
+
return
|
|
154
|
+
}
|
|
155
|
+
if (overview.description) {
|
|
156
|
+
this.resourceAltText = overview.description
|
|
157
|
+
this.cd.markForCheck()
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
70
161
|
}
|
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common'
|
|
2
|
+
import { ChangeDetectionStrategy, Component, Input } from '@angular/core'
|
|
3
|
+
import { OverviewUploadComponent } from '../../../overview-upload/overview-upload.component'
|
|
4
|
+
import { FormControl } from '@angular/forms'
|
|
5
|
+
import { GraphicOverview } from '../../../../../../../../../libs/common/domain/src/lib/model/record'
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
selector: 'gn-ui-form-field-overviews',
|
|
9
|
+
templateUrl: './form-field-overviews.component.html',
|
|
10
|
+
styleUrls: ['./form-field-overviews.component.css'],
|
|
11
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
12
|
+
standalone: true,
|
|
13
|
+
imports: [CommonModule, OverviewUploadComponent],
|
|
14
|
+
})
|
|
15
|
+
export class FormFieldOverviewsComponent {
|
|
16
|
+
@Input() metadataUuid: string
|
|
17
|
+
@Input() control!: FormControl
|
|
18
|
+
|
|
19
|
+
handleOverviewChange(overView: GraphicOverview | null) {
|
|
20
|
+
this.control.setValue(overView ? [overView] : [])
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -62,9 +62,9 @@ export class FormFieldTemporalExtentsComponent implements OnInit, OnDestroy {
|
|
|
62
62
|
)
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
onElementsChange(elements:
|
|
65
|
+
onElementsChange(elements: { inputs: Record<string, unknown> }[]) {
|
|
66
66
|
this.array.clear({ emitEvent: false })
|
|
67
|
-
elements.forEach((e
|
|
67
|
+
elements.forEach((e, i) =>
|
|
68
68
|
this.array.push(e.inputs.control, {
|
|
69
69
|
emitEvent: i === elements.length - 1,
|
|
70
70
|
})
|
|
@@ -95,7 +95,7 @@ export class FormFieldTemporalExtentsComponent implements OnInit, OnDestroy {
|
|
|
95
95
|
|
|
96
96
|
private resetValueFromInput(value) {
|
|
97
97
|
this.array.clear({ emitEvent: false })
|
|
98
|
-
|
|
98
|
+
let newElements = []
|
|
99
99
|
value.forEach((v: any) => {
|
|
100
100
|
if ('start' in v && 'end' in v) {
|
|
101
101
|
const rangeControl = new FormControl({
|
|
@@ -103,8 +103,8 @@ export class FormFieldTemporalExtentsComponent implements OnInit, OnDestroy {
|
|
|
103
103
|
end: v.end,
|
|
104
104
|
})
|
|
105
105
|
this.array.push(rangeControl, { emitEvent: false })
|
|
106
|
-
|
|
107
|
-
...
|
|
106
|
+
newElements = [
|
|
107
|
+
...newElements,
|
|
108
108
|
{
|
|
109
109
|
component: FormFieldTemporalExtentsRangeComponent,
|
|
110
110
|
inputs: {
|
|
@@ -115,8 +115,8 @@ export class FormFieldTemporalExtentsComponent implements OnInit, OnDestroy {
|
|
|
115
115
|
} else {
|
|
116
116
|
const dateControl = new FormControl({ start: v.start })
|
|
117
117
|
this.array.push(dateControl, { emitEvent: false })
|
|
118
|
-
|
|
119
|
-
...
|
|
118
|
+
newElements = [
|
|
119
|
+
...newElements,
|
|
120
120
|
{
|
|
121
121
|
component: FormFieldTemporalExtentsDateComponent,
|
|
122
122
|
inputs: {
|
|
@@ -126,5 +126,6 @@ export class FormFieldTemporalExtentsComponent implements OnInit, OnDestroy {
|
|
|
126
126
|
]
|
|
127
127
|
}
|
|
128
128
|
})
|
|
129
|
+
this.elements = newElements
|
|
129
130
|
}
|
|
130
131
|
}
|
package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.html
CHANGED
|
@@ -76,6 +76,12 @@
|
|
|
76
76
|
<ng-container *ngIf="isSpatialExtentField">
|
|
77
77
|
<gn-ui-form-field-spatial-extent></gn-ui-form-field-spatial-extent>
|
|
78
78
|
</ng-container>
|
|
79
|
+
<ng-container *ngIf="isGraphicOverview">
|
|
80
|
+
<gn-ui-form-field-overviews
|
|
81
|
+
[control]="formControl"
|
|
82
|
+
[metadataUuid]="metadataUuid$ | async"
|
|
83
|
+
></gn-ui-form-field-overviews>
|
|
84
|
+
</ng-container>
|
|
79
85
|
<ng-container *ngIf="isKeywords">
|
|
80
86
|
<gn-ui-form-field-keywords
|
|
81
87
|
[control]="formControl"
|
package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.ts
CHANGED
|
@@ -28,6 +28,9 @@ import { FormFieldSpatialExtentComponent } from './form-field-spatial-extent/for
|
|
|
28
28
|
import { FormFieldUpdateFrequencyComponent } from './form-field-update-frequency/form-field-update-frequency.component'
|
|
29
29
|
import { CatalogRecordKeys } from '../../../../../../../../libs/common/domain/src/lib/model/record'
|
|
30
30
|
import { FormFieldKeywordsComponent } from './form-field-keywords/form-field-keywords.component'
|
|
31
|
+
import { FormFieldOverviewsComponent } from './form-field-overviews/form-field-overviews.component'
|
|
32
|
+
import { map, take } from 'rxjs/operators'
|
|
33
|
+
import { EditorFacade } from '../../../+state/editor.facade'
|
|
31
34
|
import { FormFieldConfig } from '../../../models'
|
|
32
35
|
|
|
33
36
|
@Component({
|
|
@@ -55,6 +58,7 @@ import { FormFieldConfig } from '../../../models'
|
|
|
55
58
|
FormFieldArrayComponent,
|
|
56
59
|
FormFieldKeywordsComponent,
|
|
57
60
|
TranslateModule,
|
|
61
|
+
FormFieldOverviewsComponent,
|
|
58
62
|
],
|
|
59
63
|
})
|
|
60
64
|
export class FormFieldComponent {
|
|
@@ -70,9 +74,14 @@ export class FormFieldComponent {
|
|
|
70
74
|
|
|
71
75
|
@ViewChild('titleInput') titleInput: ElementRef
|
|
72
76
|
|
|
77
|
+
metadataUuid$ = this.facade.record$.pipe(
|
|
78
|
+
take(1),
|
|
79
|
+
map((record) => record.uniqueIdentifier)
|
|
80
|
+
)
|
|
81
|
+
|
|
73
82
|
formControl = new FormControl()
|
|
74
83
|
|
|
75
|
-
constructor() {
|
|
84
|
+
constructor(private facade: EditorFacade) {
|
|
76
85
|
this.valueChange = this.formControl.valueChanges
|
|
77
86
|
}
|
|
78
87
|
|
|
@@ -101,6 +110,9 @@ export class FormFieldComponent {
|
|
|
101
110
|
get isSpatialExtentField() {
|
|
102
111
|
return this.model === 'spatialExtents'
|
|
103
112
|
}
|
|
113
|
+
get isGraphicOverview() {
|
|
114
|
+
return this.model === 'overviews'
|
|
115
|
+
}
|
|
104
116
|
get isSimpleField() {
|
|
105
117
|
return this.model === 'uniqueIdentifier' || this.model === 'recordUpdated'
|
|
106
118
|
}
|
|
@@ -83,6 +83,13 @@ export const RECORD_ABSTRACT_FIELD: EditorField = {
|
|
|
83
83
|
},
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
export const RECORD_GRAPHICAL_OVERVIEW_FIELD: EditorField = {
|
|
87
|
+
model: 'overviews',
|
|
88
|
+
formFieldConfig: {
|
|
89
|
+
labelKey: marker('editor.record.form.field.overviews'),
|
|
90
|
+
},
|
|
91
|
+
}
|
|
92
|
+
|
|
86
93
|
/************************************************************
|
|
87
94
|
*************** SECTIONS *****************
|
|
88
95
|
************************************************************
|
|
@@ -90,7 +97,11 @@ export const RECORD_ABSTRACT_FIELD: EditorField = {
|
|
|
90
97
|
|
|
91
98
|
export const TITLE_SECTION: EditorSection = {
|
|
92
99
|
hidden: false,
|
|
93
|
-
fields: [
|
|
100
|
+
fields: [
|
|
101
|
+
RECORD_TITLE_FIELD,
|
|
102
|
+
RECORD_ABSTRACT_FIELD,
|
|
103
|
+
RECORD_GRAPHICAL_OVERVIEW_FIELD,
|
|
104
|
+
],
|
|
94
105
|
}
|
|
95
106
|
|
|
96
107
|
export const ABOUT_SECTION: EditorSection = {
|