geonetwork-ui 2.10.0-dev.5f1c6f718 → 2.10.0-dev.69145ed6a
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/fesm2022/geonetwork-ui.mjs +40 -2
- package/fesm2022/geonetwork-ui.mjs.map +1 -1
- package/index.d.ts +15 -11
- package/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-single-link-resource/form-field-online-single-link-resource.component.css +0 -0
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-single-link-resource/form-field-online-single-link-resource.component.html +5 -0
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-single-link-resource/form-field-online-single-link-resource.component.ts +89 -0
- package/src/libs/util/app-config/src/lib/app-config.ts +36 -0
- package/src/libs/util/app-config/src/lib/model.ts +4 -0
- package/src/libs/util/app-config/src/lib/parse-utils.ts +23 -1
- package/translations/de.json +1 -0
- package/translations/en.json +1 -0
- package/translations/es.json +1 -0
- package/translations/fr.json +1 -0
- package/translations/it.json +1 -0
- package/translations/nl.json +1 -0
- package/translations/pt.json +1 -0
- package/translations/sk.json +1 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChangeDetectionStrategy,
|
|
3
|
+
Component,
|
|
4
|
+
EventEmitter,
|
|
5
|
+
Input,
|
|
6
|
+
Output,
|
|
7
|
+
inject,
|
|
8
|
+
} from '@angular/core'
|
|
9
|
+
import { marker } from '@biesbjerg/ngx-translate-extract-marker'
|
|
10
|
+
import {
|
|
11
|
+
OnlineLinkResource,
|
|
12
|
+
OnlineResource,
|
|
13
|
+
} from '../../../../../../../../../libs/common/domain/src/lib/model/record'
|
|
14
|
+
import { NotificationsService } from '../../../../../../../../../libs/feature/notifications/src'
|
|
15
|
+
import { UrlInputComponent } from '../../../../../../../../../libs/ui/inputs/src'
|
|
16
|
+
import { TranslateService } from '@ngx-translate/core'
|
|
17
|
+
|
|
18
|
+
marker('editor.record.form.field.onlineLinkageResource.defaultName')
|
|
19
|
+
|
|
20
|
+
@Component({
|
|
21
|
+
selector: 'gn-ui-form-field-online-single-link-resource',
|
|
22
|
+
templateUrl: './form-field-online-single-link-resource.component.html',
|
|
23
|
+
styleUrls: ['./form-field-online-single-link-resource.component.css'],
|
|
24
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
25
|
+
standalone: true,
|
|
26
|
+
imports: [UrlInputComponent],
|
|
27
|
+
})
|
|
28
|
+
export class FormFieldOnlineSingleLinkResourceComponent {
|
|
29
|
+
private notificationsService = inject(NotificationsService)
|
|
30
|
+
private translateService = inject(TranslateService)
|
|
31
|
+
|
|
32
|
+
@Input() set value(onlineResources: Array<OnlineResource>) {
|
|
33
|
+
this.allResources = onlineResources ?? []
|
|
34
|
+
const firstResource = this.allResources[0]
|
|
35
|
+
this.displayUrl = firstResource?.url?.toString() ?? ''
|
|
36
|
+
}
|
|
37
|
+
@Output() valueChange: EventEmitter<Array<OnlineResource>> =
|
|
38
|
+
new EventEmitter()
|
|
39
|
+
|
|
40
|
+
private allResources: OnlineResource[] = []
|
|
41
|
+
displayUrl = ''
|
|
42
|
+
|
|
43
|
+
handleUrlChange(url: string | null) {
|
|
44
|
+
if (!url) return
|
|
45
|
+
|
|
46
|
+
try {
|
|
47
|
+
const parsedUrl = new URL(url)
|
|
48
|
+
|
|
49
|
+
if (this.allResources.length === 0) {
|
|
50
|
+
const defaultName = this.translateService.instant(
|
|
51
|
+
'editor.record.form.field.onlineLinkageResource.defaultName'
|
|
52
|
+
)
|
|
53
|
+
const newResource: OnlineLinkResource = {
|
|
54
|
+
type: 'link',
|
|
55
|
+
url: parsedUrl,
|
|
56
|
+
name: defaultName,
|
|
57
|
+
}
|
|
58
|
+
this.valueChange.emit([newResource])
|
|
59
|
+
} else {
|
|
60
|
+
const updatedFirst: OnlineResource = {
|
|
61
|
+
...this.allResources[0],
|
|
62
|
+
url: parsedUrl,
|
|
63
|
+
}
|
|
64
|
+
this.valueChange.emit([updatedFirst, ...this.allResources.slice(1)])
|
|
65
|
+
}
|
|
66
|
+
} catch (error) {
|
|
67
|
+
this.handleError(error as Error)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private handleError(error: Error) {
|
|
72
|
+
this.notificationsService.showNotification(
|
|
73
|
+
{
|
|
74
|
+
type: 'error',
|
|
75
|
+
title: this.translateService.instant(
|
|
76
|
+
'editor.record.onlineResourceError.title'
|
|
77
|
+
),
|
|
78
|
+
text: `${this.translateService.instant(
|
|
79
|
+
'editor.record.onlineResourceError.body'
|
|
80
|
+
)} ${error.message}`,
|
|
81
|
+
closeMessage: this.translateService.instant(
|
|
82
|
+
'editor.record.onlineResourceError.closeMessage'
|
|
83
|
+
),
|
|
84
|
+
},
|
|
85
|
+
undefined,
|
|
86
|
+
error
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as TOML from '@ltd/j-toml'
|
|
2
2
|
import {
|
|
3
3
|
checkMetadataLanguage,
|
|
4
|
+
checkNewRecordDefaultLanguage,
|
|
4
5
|
parseConfigSection,
|
|
5
6
|
parseMultiConfigSection,
|
|
6
7
|
parseTranslationsConfigSection,
|
|
@@ -8,6 +9,7 @@ import {
|
|
|
8
9
|
import {
|
|
9
10
|
CustomTranslations,
|
|
10
11
|
CustomTranslationsAllLanguages,
|
|
12
|
+
EditorConfig,
|
|
11
13
|
GlobalConfig,
|
|
12
14
|
LayerConfig,
|
|
13
15
|
MapConfig,
|
|
@@ -51,6 +53,12 @@ export function getOptionalSearchConfig(): SearchConfig | null {
|
|
|
51
53
|
return searchConfig
|
|
52
54
|
}
|
|
53
55
|
|
|
56
|
+
let editorConfig: EditorConfig = null
|
|
57
|
+
|
|
58
|
+
export function getOptionalEditorConfig(): EditorConfig | null {
|
|
59
|
+
return editorConfig
|
|
60
|
+
}
|
|
61
|
+
|
|
54
62
|
let metadataQualityConfig: MetadataQualityConfig = null
|
|
55
63
|
export function getMetadataQualityConfig(): MetadataQualityConfig {
|
|
56
64
|
return (
|
|
@@ -285,6 +293,33 @@ export function loadAppConfig(configUrl = 'assets/configuration/default.toml') {
|
|
|
285
293
|
SORTABLE: parsedMetadataQualitySection.sortable,
|
|
286
294
|
} as MetadataQualityConfig)
|
|
287
295
|
|
|
296
|
+
let parsedEditingSection = parseConfigSection(
|
|
297
|
+
parsed,
|
|
298
|
+
'editing',
|
|
299
|
+
[],
|
|
300
|
+
['new_record_default_language'],
|
|
301
|
+
warnings,
|
|
302
|
+
errors
|
|
303
|
+
)
|
|
304
|
+
if (
|
|
305
|
+
parsedEditingSection !== null &&
|
|
306
|
+
parsedEditingSection.new_record_default_language !== undefined
|
|
307
|
+
) {
|
|
308
|
+
parsedEditingSection = checkNewRecordDefaultLanguage(
|
|
309
|
+
parsedEditingSection,
|
|
310
|
+
warnings
|
|
311
|
+
)
|
|
312
|
+
}
|
|
313
|
+
editorConfig =
|
|
314
|
+
parsedEditingSection === null
|
|
315
|
+
? null
|
|
316
|
+
: ({
|
|
317
|
+
NEW_RECORD_DEFAULT_LANGUAGE:
|
|
318
|
+
parsedEditingSection.new_record_default_language as
|
|
319
|
+
| string
|
|
320
|
+
| undefined,
|
|
321
|
+
} as EditorConfig)
|
|
322
|
+
|
|
288
323
|
customTranslations = parseTranslationsConfigSection(
|
|
289
324
|
parsed,
|
|
290
325
|
'translations'
|
|
@@ -309,6 +344,7 @@ export function isConfigLoaded() {
|
|
|
309
344
|
export function _reset() {
|
|
310
345
|
globalConfig = null
|
|
311
346
|
themeConfig = null
|
|
347
|
+
editorConfig = null
|
|
312
348
|
customTranslations = null
|
|
313
349
|
}
|
|
314
350
|
|
|
@@ -69,6 +69,10 @@ export interface MetadataQualityConfig {
|
|
|
69
69
|
ENABLED: boolean
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
export interface EditorConfig {
|
|
73
|
+
NEW_RECORD_DEFAULT_LANGUAGE?: string
|
|
74
|
+
}
|
|
75
|
+
|
|
72
76
|
export type CustomTranslations = { [translationKey: string]: string }
|
|
73
77
|
export type CustomTranslationsAllLanguages = {
|
|
74
78
|
[lang: string]: CustomTranslations
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toLang2 } from '../../../../../libs/util/i18n/src'
|
|
1
|
+
import { LANG_2_TO_3_MAPPER, toLang2 } from '../../../../../libs/util/i18n/src'
|
|
2
2
|
|
|
3
3
|
const flatten = (
|
|
4
4
|
base: string,
|
|
@@ -137,3 +137,25 @@ export function checkMetadataLanguage(
|
|
|
137
137
|
}
|
|
138
138
|
return parsedConfigSection
|
|
139
139
|
}
|
|
140
|
+
|
|
141
|
+
export function checkNewRecordDefaultLanguage(
|
|
142
|
+
parsedConfigSection: any,
|
|
143
|
+
outWarnings: string[]
|
|
144
|
+
) {
|
|
145
|
+
const lang2 = toLang2(
|
|
146
|
+
parsedConfigSection.new_record_default_language.toLowerCase()
|
|
147
|
+
)
|
|
148
|
+
if (!(lang2 in LANG_2_TO_3_MAPPER)) {
|
|
149
|
+
outWarnings.push(
|
|
150
|
+
`In the [editing] section: new_record_default_language = "${parsedConfigSection.new_record_default_language}" is not a recognized ISO 639 language code`
|
|
151
|
+
)
|
|
152
|
+
return {
|
|
153
|
+
...parsedConfigSection,
|
|
154
|
+
new_record_default_language: undefined,
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return {
|
|
158
|
+
...parsedConfigSection,
|
|
159
|
+
new_record_default_language: lang2,
|
|
160
|
+
}
|
|
161
|
+
}
|
package/translations/de.json
CHANGED
|
@@ -159,6 +159,7 @@
|
|
|
159
159
|
"editor.record.form.field.legalConstraints": "Rechtliche Einschränkung",
|
|
160
160
|
"editor.record.form.field.license": "Lizenz",
|
|
161
161
|
"editor.record.form.field.onlineLinkResources": "Beigefügte Ressourcen",
|
|
162
|
+
"editor.record.form.field.onlineLinkageResource.defaultName": "Link",
|
|
162
163
|
"editor.record.form.field.onlineResource.cancel": "Abbrechen",
|
|
163
164
|
"editor.record.form.field.onlineResource.confirm": "Bestätigen",
|
|
164
165
|
"editor.record.form.field.onlineResource.dialogTitle": "Vorschau des Datensatzes bearbeiten",
|
package/translations/en.json
CHANGED
|
@@ -159,6 +159,7 @@
|
|
|
159
159
|
"editor.record.form.field.legalConstraints": "Legal constraint",
|
|
160
160
|
"editor.record.form.field.license": "License",
|
|
161
161
|
"editor.record.form.field.onlineLinkResources": "Attached resources",
|
|
162
|
+
"editor.record.form.field.onlineLinkageResource.defaultName": "Link",
|
|
162
163
|
"editor.record.form.field.onlineResource.cancel": "Cancel",
|
|
163
164
|
"editor.record.form.field.onlineResource.confirm": "Confirm",
|
|
164
165
|
"editor.record.form.field.onlineResource.dialogTitle": "Modify the dataset preview",
|
package/translations/es.json
CHANGED
|
@@ -159,6 +159,7 @@
|
|
|
159
159
|
"editor.record.form.field.legalConstraints": "",
|
|
160
160
|
"editor.record.form.field.license": "",
|
|
161
161
|
"editor.record.form.field.onlineLinkResources": "",
|
|
162
|
+
"editor.record.form.field.onlineLinkageResource.defaultName": "",
|
|
162
163
|
"editor.record.form.field.onlineResource.cancel": "",
|
|
163
164
|
"editor.record.form.field.onlineResource.confirm": "",
|
|
164
165
|
"editor.record.form.field.onlineResource.dialogTitle": "",
|
package/translations/fr.json
CHANGED
|
@@ -159,6 +159,7 @@
|
|
|
159
159
|
"editor.record.form.field.legalConstraints": "Contrainte légale",
|
|
160
160
|
"editor.record.form.field.license": "Licence",
|
|
161
161
|
"editor.record.form.field.onlineLinkResources": "Ressources attachées",
|
|
162
|
+
"editor.record.form.field.onlineLinkageResource.defaultName": "Lien",
|
|
162
163
|
"editor.record.form.field.onlineResource.cancel": "Annuler",
|
|
163
164
|
"editor.record.form.field.onlineResource.confirm": "Valider",
|
|
164
165
|
"editor.record.form.field.onlineResource.dialogTitle": "Modifier l'aperçu du jeu de données",
|
package/translations/it.json
CHANGED
|
@@ -159,6 +159,7 @@
|
|
|
159
159
|
"editor.record.form.field.legalConstraints": "Vincolo legale",
|
|
160
160
|
"editor.record.form.field.license": "Licenza",
|
|
161
161
|
"editor.record.form.field.onlineLinkResources": "Risorse allegate",
|
|
162
|
+
"editor.record.form.field.onlineLinkageResource.defaultName": "Link",
|
|
162
163
|
"editor.record.form.field.onlineResource.cancel": "Annulla",
|
|
163
164
|
"editor.record.form.field.onlineResource.confirm": "Convalida",
|
|
164
165
|
"editor.record.form.field.onlineResource.dialogTitle": "Modifica anteprima dataset",
|
package/translations/nl.json
CHANGED
|
@@ -159,6 +159,7 @@
|
|
|
159
159
|
"editor.record.form.field.legalConstraints": "",
|
|
160
160
|
"editor.record.form.field.license": "",
|
|
161
161
|
"editor.record.form.field.onlineLinkResources": "",
|
|
162
|
+
"editor.record.form.field.onlineLinkageResource.defaultName": "",
|
|
162
163
|
"editor.record.form.field.onlineResource.cancel": "",
|
|
163
164
|
"editor.record.form.field.onlineResource.confirm": "",
|
|
164
165
|
"editor.record.form.field.onlineResource.dialogTitle": "",
|
package/translations/pt.json
CHANGED
|
@@ -159,6 +159,7 @@
|
|
|
159
159
|
"editor.record.form.field.legalConstraints": "",
|
|
160
160
|
"editor.record.form.field.license": "",
|
|
161
161
|
"editor.record.form.field.onlineLinkResources": "",
|
|
162
|
+
"editor.record.form.field.onlineLinkageResource.defaultName": "",
|
|
162
163
|
"editor.record.form.field.onlineResource.cancel": "",
|
|
163
164
|
"editor.record.form.field.onlineResource.confirm": "",
|
|
164
165
|
"editor.record.form.field.onlineResource.dialogTitle": "",
|
package/translations/sk.json
CHANGED
|
@@ -159,6 +159,7 @@
|
|
|
159
159
|
"editor.record.form.field.legalConstraints": "",
|
|
160
160
|
"editor.record.form.field.license": "Licencia",
|
|
161
161
|
"editor.record.form.field.onlineLinkResources": "",
|
|
162
|
+
"editor.record.form.field.onlineLinkageResource.defaultName": "",
|
|
162
163
|
"editor.record.form.field.onlineResource.cancel": "",
|
|
163
164
|
"editor.record.form.field.onlineResource.confirm": "",
|
|
164
165
|
"editor.record.form.field.onlineResource.dialogTitle": "",
|