geonetwork-ui 2.4.0-dev.f5019723 → 2.4.0-dev.fdf8f64b
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/feature/editor/src/lib/components/import-record/import-record.component.mjs +2 -2
- package/esm2022/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.mjs +72 -0
- package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.mjs +6 -4
- package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.mjs +191 -0
- package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.mjs +8 -6
- package/esm2022/libs/feature/editor/src/lib/fields.config.mjs +10 -2
- package/esm2022/libs/ui/inputs/src/lib/file-input/file-input.component.mjs +3 -3
- package/esm2022/libs/ui/inputs/src/lib/image-input/image-input.component.mjs +2 -2
- package/esm2022/libs/ui/inputs/src/lib/switch-toggle/switch-toggle.component.mjs +5 -3
- package/esm2022/libs/ui/inputs/src/lib/url-input/url-input.component.mjs +20 -4
- package/esm2022/translations/de.json +7 -0
- package/esm2022/translations/en.json +7 -0
- package/esm2022/translations/es.json +7 -0
- package/esm2022/translations/fr.json +8 -1
- package/esm2022/translations/it.json +7 -0
- package/esm2022/translations/nl.json +7 -0
- package/esm2022/translations/pt.json +7 -0
- package/fesm2022/geonetwork-ui.mjs +644 -336
- package/fesm2022/geonetwork-ui.mjs.map +1 -1
- package/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.d.ts +16 -0
- package/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.d.ts.map +1 -0
- 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 +44 -0
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.d.ts.map +1 -0
- 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/ui/inputs/src/lib/switch-toggle/switch-toggle.component.d.ts +1 -0
- package/libs/ui/inputs/src/lib/switch-toggle/switch-toggle.component.d.ts.map +1 -1
- package/libs/ui/inputs/src/lib/url-input/url-input.component.d.ts +6 -3
- package/libs/ui/inputs/src/lib/url-input/url-input.component.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.css +0 -0
- package/src/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.html +31 -0
- package/src/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.ts +82 -0
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.html +20 -11
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.ts +3 -0
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.css +0 -0
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.html +71 -0
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.ts +241 -0
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.html +8 -0
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.ts +5 -3
- package/src/libs/feature/editor/src/lib/fields.config.ts +10 -1
- package/src/libs/ui/inputs/src/lib/file-input/file-input.component.html +8 -8
- package/src/libs/ui/inputs/src/lib/switch-toggle/switch-toggle.component.html +1 -1
- package/src/libs/ui/inputs/src/lib/switch-toggle/switch-toggle.component.ts +3 -1
- package/src/libs/ui/inputs/src/lib/url-input/url-input.component.html +5 -1
- package/src/libs/ui/inputs/src/lib/url-input/url-input.component.ts +25 -2
- package/translations/de.json +7 -0
- package/translations/en.json +7 -0
- package/translations/es.json +7 -0
- package/translations/fr.json +8 -1
- package/translations/it.json +7 -0
- package/translations/nl.json +7 -0
- package/translations/pt.json +7 -0
- package/translations/sk.json +7 -0
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common'
|
|
2
|
+
import {
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
ChangeDetectorRef,
|
|
5
|
+
Component,
|
|
6
|
+
EventEmitter,
|
|
7
|
+
Input,
|
|
8
|
+
Output,
|
|
9
|
+
TemplateRef,
|
|
10
|
+
ViewChild,
|
|
11
|
+
} from '@angular/core'
|
|
12
|
+
import { MatDialog } from '@angular/material/dialog'
|
|
13
|
+
import { marker } from '@biesbjerg/ngx-translate-extract-marker'
|
|
14
|
+
import {
|
|
15
|
+
DatasetDownloadDistribution,
|
|
16
|
+
DatasetServiceDistribution,
|
|
17
|
+
OnlineResource,
|
|
18
|
+
ServiceEndpoint,
|
|
19
|
+
} from '../../../../../../../../../libs/common/domain/src/lib/model/record'
|
|
20
|
+
import { PlatformServiceInterface } from '../../../../../../../../../libs/common/domain/src/lib/platform.service.interface'
|
|
21
|
+
import { NotificationsService } from '../../../../../../../../../libs/feature/notifications/src'
|
|
22
|
+
import {
|
|
23
|
+
FileInputComponent,
|
|
24
|
+
SwitchToggleComponent,
|
|
25
|
+
SwitchToggleOption,
|
|
26
|
+
TextAreaComponent,
|
|
27
|
+
TextInputComponent,
|
|
28
|
+
UrlInputComponent,
|
|
29
|
+
} from '../../../../../../../../../libs/ui/inputs/src'
|
|
30
|
+
import {
|
|
31
|
+
ModalDialogComponent,
|
|
32
|
+
SortableListComponent,
|
|
33
|
+
} from '../../../../../../../../../libs/ui/layout/src'
|
|
34
|
+
import { TranslateModule, TranslateService } from '@ngx-translate/core'
|
|
35
|
+
import { Subscription } from 'rxjs'
|
|
36
|
+
import { MAX_UPLOAD_SIZE_MB } from '../../../../fields.config'
|
|
37
|
+
import { OnlineResourceCardComponent } from '../../../online-resource-card/online-resource-card.component'
|
|
38
|
+
import { OnlineServiceResourceInputComponent } from '../../../online-service-resource-input/online-service-resource-input.component'
|
|
39
|
+
|
|
40
|
+
type OnlineNotLinkResource =
|
|
41
|
+
| DatasetDownloadDistribution
|
|
42
|
+
| DatasetServiceDistribution
|
|
43
|
+
| ServiceEndpoint
|
|
44
|
+
|
|
45
|
+
@Component({
|
|
46
|
+
selector: 'gn-ui-form-field-online-resources',
|
|
47
|
+
templateUrl: './form-field-online-resources.component.html',
|
|
48
|
+
styleUrls: ['./form-field-online-resources.component.css'],
|
|
49
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
50
|
+
standalone: true,
|
|
51
|
+
imports: [
|
|
52
|
+
CommonModule,
|
|
53
|
+
SwitchToggleComponent,
|
|
54
|
+
FileInputComponent,
|
|
55
|
+
OnlineServiceResourceInputComponent,
|
|
56
|
+
UrlInputComponent,
|
|
57
|
+
SortableListComponent,
|
|
58
|
+
OnlineResourceCardComponent,
|
|
59
|
+
TextInputComponent,
|
|
60
|
+
TextAreaComponent,
|
|
61
|
+
TranslateModule,
|
|
62
|
+
],
|
|
63
|
+
})
|
|
64
|
+
export class FormFieldOnlineResourcesComponent {
|
|
65
|
+
@Input() metadataUuid: string
|
|
66
|
+
@Input() set value(onlineResources: Array<OnlineResource>) {
|
|
67
|
+
this.allResources = onlineResources
|
|
68
|
+
this.notLinkResources = onlineResources.filter(
|
|
69
|
+
(res): res is OnlineNotLinkResource => res.type !== 'link'
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
@Output() valueChange: EventEmitter<Array<OnlineResource>> =
|
|
73
|
+
new EventEmitter()
|
|
74
|
+
|
|
75
|
+
@ViewChild('dialogTemplate') dialogTemplate: TemplateRef<OnlineResource>
|
|
76
|
+
|
|
77
|
+
typeOptions: SwitchToggleOption[] = [
|
|
78
|
+
{
|
|
79
|
+
label: marker('editor.record.form.field.onlineResource.toggle.dataset'),
|
|
80
|
+
value: 'download',
|
|
81
|
+
checked: true,
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
label: marker('editor.record.form.field.onlineResource.toggle.service'),
|
|
85
|
+
value: 'service',
|
|
86
|
+
checked: false,
|
|
87
|
+
},
|
|
88
|
+
]
|
|
89
|
+
selectedType: 'download' | 'service' = 'download'
|
|
90
|
+
|
|
91
|
+
private allResources: OnlineResource[] = []
|
|
92
|
+
notLinkResources: OnlineNotLinkResource[] = []
|
|
93
|
+
uploadProgress = undefined
|
|
94
|
+
uploadSubscription: Subscription = null
|
|
95
|
+
newService = {
|
|
96
|
+
type: 'service',
|
|
97
|
+
accessServiceProtocol: 'ogcFeatures',
|
|
98
|
+
identifierInService: '',
|
|
99
|
+
} as Omit<DatasetServiceDistribution, 'url'>
|
|
100
|
+
|
|
101
|
+
protected MAX_UPLOAD_SIZE_MB = MAX_UPLOAD_SIZE_MB
|
|
102
|
+
|
|
103
|
+
constructor(
|
|
104
|
+
private notificationsService: NotificationsService,
|
|
105
|
+
private translateService: TranslateService,
|
|
106
|
+
private platformService: PlatformServiceInterface,
|
|
107
|
+
private cd: ChangeDetectorRef,
|
|
108
|
+
private dialog: MatDialog
|
|
109
|
+
) {}
|
|
110
|
+
|
|
111
|
+
onSelectedTypeChange(selectedType: unknown) {
|
|
112
|
+
this.selectedType = selectedType as 'download' | 'service'
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
handleFileChange(file: File) {
|
|
116
|
+
this.uploadProgress = 0
|
|
117
|
+
this.uploadSubscription = this.platformService
|
|
118
|
+
.attachFileToRecord(this.metadataUuid, file)
|
|
119
|
+
.subscribe({
|
|
120
|
+
next: (event) => {
|
|
121
|
+
if (event.type === 'progress') {
|
|
122
|
+
this.uploadProgress = event.progress
|
|
123
|
+
this.cd.detectChanges()
|
|
124
|
+
} else if (event.type === 'success') {
|
|
125
|
+
this.uploadProgress = undefined
|
|
126
|
+
this.cd.detectChanges()
|
|
127
|
+
const newResource: DatasetDownloadDistribution = {
|
|
128
|
+
type: 'download',
|
|
129
|
+
url: new URL(event.attachment.url),
|
|
130
|
+
name: event.attachment.fileName,
|
|
131
|
+
sizeBytes: event.sizeBytes, // WARNING: this is the only time that sizeBytes is set
|
|
132
|
+
}
|
|
133
|
+
this.valueChange.emit([...this.allResources, newResource])
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
error: (error: Error) => this.handleError(error.message),
|
|
137
|
+
})
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
handleUploadCancel() {
|
|
141
|
+
if (this.uploadSubscription) {
|
|
142
|
+
this.uploadProgress = undefined
|
|
143
|
+
this.uploadSubscription.unsubscribe()
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
handleDownloadUrlChange(url: string) {
|
|
148
|
+
try {
|
|
149
|
+
const name = url.split('/').pop()
|
|
150
|
+
const newLink: DatasetDownloadDistribution = {
|
|
151
|
+
type: 'download',
|
|
152
|
+
url: new URL(url),
|
|
153
|
+
name,
|
|
154
|
+
}
|
|
155
|
+
this.valueChange.emit([...this.allResources, newLink])
|
|
156
|
+
} catch (e) {
|
|
157
|
+
this.handleError((e as Error).message)
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
handleServiceUrlChange(url: string) {
|
|
162
|
+
this.valueChange.emit([
|
|
163
|
+
...this.allResources,
|
|
164
|
+
{
|
|
165
|
+
...this.newService,
|
|
166
|
+
url: new URL(url),
|
|
167
|
+
},
|
|
168
|
+
])
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
handleServiceModify(
|
|
172
|
+
oldService: DatasetServiceDistribution,
|
|
173
|
+
newService: DatasetServiceDistribution
|
|
174
|
+
) {
|
|
175
|
+
oldService.accessServiceProtocol = newService.accessServiceProtocol
|
|
176
|
+
oldService.identifierInService = newService.identifierInService
|
|
177
|
+
oldService.url = newService.url
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
handleResourcesChange(items: unknown[]) {
|
|
181
|
+
const notLinks = items as OnlineNotLinkResource[]
|
|
182
|
+
const newResources = [
|
|
183
|
+
...this.allResources.filter((r) => r.type === 'link'),
|
|
184
|
+
...notLinks,
|
|
185
|
+
]
|
|
186
|
+
this.valueChange.emit(newResources)
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
handleResourceModify(resource: OnlineNotLinkResource, index: number) {
|
|
190
|
+
this.openEditDialog(resource, index)
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
private handleError(error: string) {
|
|
194
|
+
this.uploadProgress = undefined
|
|
195
|
+
this.notificationsService.showNotification({
|
|
196
|
+
type: 'error',
|
|
197
|
+
title: this.translateService.instant(
|
|
198
|
+
'editor.record.onlineResourceError.title'
|
|
199
|
+
),
|
|
200
|
+
text: `${this.translateService.instant(
|
|
201
|
+
'editor.record.onlineResourceError.body'
|
|
202
|
+
)} ${error}`,
|
|
203
|
+
closeMessage: this.translateService.instant(
|
|
204
|
+
'editor.record.onlineResourceError.closeMessage'
|
|
205
|
+
),
|
|
206
|
+
})
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
private openEditDialog(resource: OnlineNotLinkResource, index: number) {
|
|
210
|
+
const resourceCopy = {
|
|
211
|
+
...resource,
|
|
212
|
+
}
|
|
213
|
+
this.dialog
|
|
214
|
+
.open(ModalDialogComponent, {
|
|
215
|
+
width: '800px',
|
|
216
|
+
data: {
|
|
217
|
+
title: this.translateService.instant(
|
|
218
|
+
'editor.record.form.field.onlineResource.dialogTitle'
|
|
219
|
+
),
|
|
220
|
+
body: this.dialogTemplate,
|
|
221
|
+
bodyContext: resourceCopy,
|
|
222
|
+
confirmText: this.translateService.instant(
|
|
223
|
+
'editor.record.form.field.onlineResource.confirm'
|
|
224
|
+
),
|
|
225
|
+
cancelText: this.translateService.instant(
|
|
226
|
+
'editor.record.form.field.onlineResource.cancel'
|
|
227
|
+
),
|
|
228
|
+
},
|
|
229
|
+
})
|
|
230
|
+
.afterClosed()
|
|
231
|
+
.subscribe((confirmed: boolean) => {
|
|
232
|
+
if (!confirmed) return
|
|
233
|
+
const newNotLinks = [...this.notLinkResources]
|
|
234
|
+
newNotLinks.splice(index, 1, resourceCopy)
|
|
235
|
+
this.valueChange.emit([
|
|
236
|
+
...this.allResources.filter((r) => r.type === 'link'),
|
|
237
|
+
...newNotLinks,
|
|
238
|
+
])
|
|
239
|
+
})
|
|
240
|
+
}
|
|
241
|
+
}
|
package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.html
CHANGED
|
@@ -121,6 +121,14 @@
|
|
|
121
121
|
(valueChange)="valueChange.emit($event)"
|
|
122
122
|
></gn-ui-form-field-contacts>
|
|
123
123
|
</ng-container>
|
|
124
|
+
<ng-container *ngSwitchCase="'onlineResources'">
|
|
125
|
+
<gn-ui-form-field-online-resources
|
|
126
|
+
*ngIf="modelSpecifier === 'onlineResourceType:!link'"
|
|
127
|
+
[metadataUuid]="uniqueIdentifier"
|
|
128
|
+
[value]="valueAsOnlineResources"
|
|
129
|
+
(valueChange)="valueChange.emit($event)"
|
|
130
|
+
></gn-ui-form-field-online-resources>
|
|
131
|
+
</ng-container>
|
|
124
132
|
<ng-container *ngSwitchCase="'onlineResources'">
|
|
125
133
|
<gn-ui-form-field-online-link-resources
|
|
126
134
|
*ngIf="modelSpecifier === 'onlineResourceType:link'"
|
package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.ts
CHANGED
|
@@ -31,17 +31,18 @@ import {
|
|
|
31
31
|
import { FieldModelSpecifier, FormFieldConfig } from '../../../models'
|
|
32
32
|
import { FormFieldArrayComponent } from './form-field-array/form-field-array.component'
|
|
33
33
|
import { FormFieldContactsForResourceComponent } from './form-field-contacts-for-resource/form-field-contacts-for-resource.component'
|
|
34
|
+
import { FormFieldContactsComponent } from './form-field-contacts/form-field-contacts.component'
|
|
34
35
|
import { FormFieldFileComponent } from './form-field-file/form-field-file.component'
|
|
35
36
|
import { FormFieldKeywordsComponent } from './form-field-keywords/form-field-keywords.component'
|
|
36
37
|
import { FormFieldObjectComponent } from './form-field-object/form-field-object.component'
|
|
38
|
+
import { FormFieldOnlineLinkResourcesComponent } from './form-field-online-link-resources/form-field-online-link-resources.component'
|
|
39
|
+
import { FormFieldOnlineResourcesComponent } from './form-field-online-resources/form-field-online-resources.component'
|
|
40
|
+
import { FormFieldOpenDataComponent } from './form-field-open-data/form-field-open-data.component'
|
|
37
41
|
import { FormFieldOverviewsComponent } from './form-field-overviews/form-field-overviews.component'
|
|
38
42
|
import { FormFieldRichComponent } from './form-field-rich/form-field-rich.component'
|
|
39
43
|
import { FormFieldSimpleComponent } from './form-field-simple/form-field-simple.component'
|
|
40
44
|
import { FormFieldSpatialExtentComponent } from './form-field-spatial-extent/form-field-spatial-extent.component'
|
|
41
45
|
import { FormFieldUpdateFrequencyComponent } from './form-field-update-frequency/form-field-update-frequency.component'
|
|
42
|
-
import { FormFieldOpenDataComponent } from './form-field-open-data/form-field-open-data.component'
|
|
43
|
-
import { FormFieldOnlineLinkResourcesComponent } from './form-field-online-link-resources/form-field-online-link-resources.component'
|
|
44
|
-
import { FormFieldContactsComponent } from './form-field-contacts/form-field-contacts.component'
|
|
45
46
|
|
|
46
47
|
@Component({
|
|
47
48
|
selector: 'gn-ui-form-field',
|
|
@@ -70,6 +71,7 @@ import { FormFieldContactsComponent } from './form-field-contacts/form-field-con
|
|
|
70
71
|
FormFieldOverviewsComponent,
|
|
71
72
|
FormFieldContactsForResourceComponent,
|
|
72
73
|
FormFieldOpenDataComponent,
|
|
74
|
+
FormFieldOnlineResourcesComponent,
|
|
73
75
|
FormFieldOnlineLinkResourcesComponent,
|
|
74
76
|
FormFieldContactsComponent,
|
|
75
77
|
],
|
|
@@ -114,6 +114,14 @@ export const RECORD_SPATIAL_EXTENTS_FIELD: EditorField = {
|
|
|
114
114
|
},
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
export const RECORD_ONLINE_RESOURCES: EditorField = {
|
|
118
|
+
model: 'onlineResources',
|
|
119
|
+
modelSpecifier: 'onlineResourceType:!link',
|
|
120
|
+
formFieldConfig: {
|
|
121
|
+
labelKey: marker('editor.record.form.field.onlineResources'),
|
|
122
|
+
},
|
|
123
|
+
}
|
|
124
|
+
|
|
117
125
|
export const RECORD_ONLINE_LINK_RESOURCES: EditorField = {
|
|
118
126
|
model: 'onlineResources',
|
|
119
127
|
modelSpecifier: 'onlineResourceType:link',
|
|
@@ -161,11 +169,12 @@ export const ASSOCIATED_RESOURCES_SECTION: EditorSection = {
|
|
|
161
169
|
'editor.record.form.section.associatedResources.description'
|
|
162
170
|
),
|
|
163
171
|
hidden: false,
|
|
164
|
-
fields: [],
|
|
172
|
+
fields: [RECORD_ONLINE_RESOURCES],
|
|
165
173
|
}
|
|
166
174
|
|
|
167
175
|
export const ANNEXES_SECTION: EditorSection = {
|
|
168
176
|
labelKey: marker('editor.record.form.section.annexes.label'),
|
|
177
|
+
descriptionKey: marker('editor.record.form.section.annexes.description'),
|
|
169
178
|
hidden: false,
|
|
170
179
|
fields: [RECORD_ONLINE_LINK_RESOURCES],
|
|
171
180
|
}
|
|
@@ -12,6 +12,14 @@
|
|
|
12
12
|
(dropFiles)="handleDropFiles($event)"
|
|
13
13
|
(keydown.enter)="fileInput.click()"
|
|
14
14
|
>
|
|
15
|
+
<input
|
|
16
|
+
#fileInput
|
|
17
|
+
type="file"
|
|
18
|
+
class="hidden"
|
|
19
|
+
(change)="handleFileInput($event)"
|
|
20
|
+
[disabled]="isUploadInProgress"
|
|
21
|
+
/>
|
|
22
|
+
|
|
15
23
|
<div
|
|
16
24
|
class="w-14 h-14 rounded-md bg-gray-50 grid"
|
|
17
25
|
*ngIf="!isUploadInProgress"
|
|
@@ -72,14 +80,6 @@
|
|
|
72
80
|
>
|
|
73
81
|
<span class="border-b border-gray-300 grow"></span>
|
|
74
82
|
</p>
|
|
75
|
-
<input
|
|
76
|
-
#fileInput
|
|
77
|
-
type="file"
|
|
78
|
-
class="hidden"
|
|
79
|
-
(change)="handleFileInput($event)"
|
|
80
|
-
[disabled]="isUploadInProgress"
|
|
81
|
-
/>
|
|
82
|
-
|
|
83
83
|
<gn-ui-url-input
|
|
84
84
|
class="w-full"
|
|
85
85
|
[disabled]="isUploadInProgress"
|
|
@@ -7,9 +7,11 @@ import {
|
|
|
7
7
|
Output,
|
|
8
8
|
} from '@angular/core'
|
|
9
9
|
import { MatButtonToggleModule } from '@angular/material/button-toggle'
|
|
10
|
+
import { TranslateModule } from '@ngx-translate/core'
|
|
10
11
|
|
|
11
12
|
export type SwitchToggleOption = {
|
|
12
13
|
label: string
|
|
14
|
+
value?: unknown
|
|
13
15
|
checked: boolean
|
|
14
16
|
}
|
|
15
17
|
|
|
@@ -19,7 +21,7 @@ export type SwitchToggleOption = {
|
|
|
19
21
|
styleUrls: ['./switch-toggle.component.css'],
|
|
20
22
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
21
23
|
standalone: true,
|
|
22
|
-
imports: [MatButtonToggleModule, CommonModule],
|
|
24
|
+
imports: [MatButtonToggleModule, CommonModule, TranslateModule],
|
|
23
25
|
})
|
|
24
26
|
export class SwitchToggleComponent {
|
|
25
27
|
@Input() options: SwitchToggleOption[]
|
|
@@ -27,7 +27,11 @@
|
|
|
27
27
|
<gn-ui-button
|
|
28
28
|
extraClass="absolute inset-y-[var(--side-padding)] right-[var(--side-padding)]"
|
|
29
29
|
type="primary"
|
|
30
|
-
[disabled]="
|
|
30
|
+
[disabled]="
|
|
31
|
+
disabled ||
|
|
32
|
+
input.value === '' ||
|
|
33
|
+
(urlCanParse && !URLcanParse(input.value))
|
|
34
|
+
"
|
|
31
35
|
(buttonClick)="handleChange(input)"
|
|
32
36
|
>
|
|
33
37
|
<mat-icon class="material-symbols-outlined text-[20px] leading-[24px]">
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ChangeDetectorRef,
|
|
3
|
+
Component,
|
|
4
|
+
Input,
|
|
5
|
+
OnChanges,
|
|
6
|
+
Output,
|
|
7
|
+
SimpleChanges,
|
|
8
|
+
} from '@angular/core'
|
|
2
9
|
import { CommonModule } from '@angular/common'
|
|
3
10
|
import { ButtonComponent } from '../button/button.component'
|
|
4
11
|
import { MatIconModule } from '@angular/material/icon'
|
|
@@ -12,16 +19,23 @@ import { Subject } from 'rxjs'
|
|
|
12
19
|
standalone: true,
|
|
13
20
|
imports: [CommonModule, ButtonComponent, MatIconModule],
|
|
14
21
|
})
|
|
15
|
-
export class UrlInputComponent {
|
|
22
|
+
export class UrlInputComponent implements OnChanges {
|
|
16
23
|
@Input() value = ''
|
|
17
24
|
@Input() extraClass = ''
|
|
18
25
|
@Input() placeholder = 'https://'
|
|
19
26
|
@Input() disabled: boolean
|
|
27
|
+
@Input() urlCanParse?: boolean
|
|
20
28
|
rawChange = new Subject<string>()
|
|
21
29
|
@Output() valueChange = this.rawChange.pipe(filter((v) => !!v))
|
|
22
30
|
|
|
23
31
|
constructor(private cd: ChangeDetectorRef) {}
|
|
24
32
|
|
|
33
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
34
|
+
if (changes.value) {
|
|
35
|
+
console.log('changes.value', changes.value)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
25
39
|
handleInput() {
|
|
26
40
|
this.cd.markForCheck()
|
|
27
41
|
}
|
|
@@ -30,4 +44,13 @@ export class UrlInputComponent {
|
|
|
30
44
|
const value = element.value
|
|
31
45
|
this.rawChange.next(value)
|
|
32
46
|
}
|
|
47
|
+
|
|
48
|
+
URLcanParse(url: string): boolean {
|
|
49
|
+
try {
|
|
50
|
+
new URL(url)
|
|
51
|
+
return true
|
|
52
|
+
} catch (e) {
|
|
53
|
+
return false
|
|
54
|
+
}
|
|
55
|
+
}
|
|
33
56
|
}
|
package/translations/de.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
+
"": "",
|
|
2
3
|
"Add Layer As": "",
|
|
3
4
|
"button.login": "",
|
|
4
5
|
"catalog.figures.datasets": "{count, plural, =0{Datensätze} one{Datensatz} other{Datensätze}}",
|
|
@@ -217,9 +218,13 @@
|
|
|
217
218
|
"editor.record.form.field.onlineResource.confirm": "",
|
|
218
219
|
"editor.record.form.field.onlineResource.dialogTitle": "",
|
|
219
220
|
"editor.record.form.field.onlineResource.edit.description": "",
|
|
221
|
+
"editor.record.form.field.onlineResource.edit.protocol": "",
|
|
220
222
|
"editor.record.form.field.onlineResource.edit.title": "",
|
|
221
223
|
"editor.record.form.field.onlineResource.fileSize": "",
|
|
222
224
|
"editor.record.form.field.onlineResource.modify": "",
|
|
225
|
+
"editor.record.form.field.onlineResource.toggle.dataset": "",
|
|
226
|
+
"editor.record.form.field.onlineResource.toggle.service": "",
|
|
227
|
+
"editor.record.form.field.onlineResources": "",
|
|
223
228
|
"editor.record.form.field.overviews": "",
|
|
224
229
|
"editor.record.form.field.recordUpdated": "Datensatz zuletzt aktualisiert",
|
|
225
230
|
"editor.record.form.field.resourceUpdated": "Letztes Aktualisierungsdatum",
|
|
@@ -242,6 +247,7 @@
|
|
|
242
247
|
"editor.record.form.page.ressources": "",
|
|
243
248
|
"editor.record.form.section.about.description": "",
|
|
244
249
|
"editor.record.form.section.about.label": "",
|
|
250
|
+
"editor.record.form.section.annexes.description": "",
|
|
245
251
|
"editor.record.form.section.annexes.label": "",
|
|
246
252
|
"editor.record.form.section.associatedResources.description": "",
|
|
247
253
|
"editor.record.form.section.associatedResources.label": "",
|
|
@@ -265,6 +271,7 @@
|
|
|
265
271
|
"editor.record.loadError.body": "Der Datensatz konnte nicht geladen werden:",
|
|
266
272
|
"editor.record.loadError.closeMessage": "Verstanden",
|
|
267
273
|
"editor.record.loadError.title": "Fehler beim Laden des Datensatzes",
|
|
274
|
+
"editor.record.onlineResource.protocol.other": "",
|
|
268
275
|
"editor.record.onlineResourceError.body": "",
|
|
269
276
|
"editor.record.onlineResourceError.closeMessage": "",
|
|
270
277
|
"editor.record.onlineResourceError.title": "",
|
package/translations/en.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
+
"": "",
|
|
2
3
|
"Add Layer As": "",
|
|
3
4
|
"button.login": "Log in",
|
|
4
5
|
"catalog.figures.datasets": "{count, plural, =0{datasets} one{dataset} other{datasets}}",
|
|
@@ -217,9 +218,13 @@
|
|
|
217
218
|
"editor.record.form.field.onlineResource.confirm": "Confirm",
|
|
218
219
|
"editor.record.form.field.onlineResource.dialogTitle": "Modify the resource preview",
|
|
219
220
|
"editor.record.form.field.onlineResource.edit.description": "Description",
|
|
221
|
+
"editor.record.form.field.onlineResource.edit.protocol": "Protocol",
|
|
220
222
|
"editor.record.form.field.onlineResource.edit.title": "Title",
|
|
221
223
|
"editor.record.form.field.onlineResource.fileSize": "{sizeMB}MB",
|
|
222
224
|
"editor.record.form.field.onlineResource.modify": "Modify",
|
|
225
|
+
"editor.record.form.field.onlineResource.toggle.dataset": "Link to a dataset",
|
|
226
|
+
"editor.record.form.field.onlineResource.toggle.service": "Link to a service",
|
|
227
|
+
"editor.record.form.field.onlineResources": "Distribution",
|
|
223
228
|
"editor.record.form.field.overviews": "Overviews",
|
|
224
229
|
"editor.record.form.field.recordUpdated": "Record Updated",
|
|
225
230
|
"editor.record.form.field.resourceUpdated": "Resource Updated",
|
|
@@ -242,6 +247,7 @@
|
|
|
242
247
|
"editor.record.form.page.ressources": "Resources",
|
|
243
248
|
"editor.record.form.section.about.description": "This section describes the resource.",
|
|
244
249
|
"editor.record.form.section.about.label": "About the resource",
|
|
250
|
+
"editor.record.form.section.annexes.description": "",
|
|
245
251
|
"editor.record.form.section.annexes.label": "Annexes",
|
|
246
252
|
"editor.record.form.section.associatedResources.description": "Drop files here to associate them with the resource.",
|
|
247
253
|
"editor.record.form.section.associatedResources.label": "Associated resources",
|
|
@@ -265,6 +271,7 @@
|
|
|
265
271
|
"editor.record.loadError.body": "The record could not be loaded:",
|
|
266
272
|
"editor.record.loadError.closeMessage": "Understood",
|
|
267
273
|
"editor.record.loadError.title": "Error loading record",
|
|
274
|
+
"editor.record.onlineResource.protocol.other": "Other",
|
|
268
275
|
"editor.record.onlineResourceError.body": "An error occurred while adding the resource:",
|
|
269
276
|
"editor.record.onlineResourceError.closeMessage": "Understood",
|
|
270
277
|
"editor.record.onlineResourceError.title": "Error adding resource",
|
package/translations/es.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
+
"": "",
|
|
2
3
|
"Add Layer As": "",
|
|
3
4
|
"button.login": "",
|
|
4
5
|
"catalog.figures.datasets": "conjuntos de datos",
|
|
@@ -217,9 +218,13 @@
|
|
|
217
218
|
"editor.record.form.field.onlineResource.confirm": "",
|
|
218
219
|
"editor.record.form.field.onlineResource.dialogTitle": "",
|
|
219
220
|
"editor.record.form.field.onlineResource.edit.description": "",
|
|
221
|
+
"editor.record.form.field.onlineResource.edit.protocol": "",
|
|
220
222
|
"editor.record.form.field.onlineResource.edit.title": "",
|
|
221
223
|
"editor.record.form.field.onlineResource.fileSize": "",
|
|
222
224
|
"editor.record.form.field.onlineResource.modify": "",
|
|
225
|
+
"editor.record.form.field.onlineResource.toggle.dataset": "",
|
|
226
|
+
"editor.record.form.field.onlineResource.toggle.service": "",
|
|
227
|
+
"editor.record.form.field.onlineResources": "",
|
|
223
228
|
"editor.record.form.field.overviews": "",
|
|
224
229
|
"editor.record.form.field.recordUpdated": "",
|
|
225
230
|
"editor.record.form.field.resourceUpdated": "",
|
|
@@ -242,6 +247,7 @@
|
|
|
242
247
|
"editor.record.form.page.ressources": "",
|
|
243
248
|
"editor.record.form.section.about.description": "",
|
|
244
249
|
"editor.record.form.section.about.label": "",
|
|
250
|
+
"editor.record.form.section.annexes.description": "",
|
|
245
251
|
"editor.record.form.section.annexes.label": "",
|
|
246
252
|
"editor.record.form.section.associatedResources.description": "",
|
|
247
253
|
"editor.record.form.section.associatedResources.label": "",
|
|
@@ -265,6 +271,7 @@
|
|
|
265
271
|
"editor.record.loadError.body": "",
|
|
266
272
|
"editor.record.loadError.closeMessage": "",
|
|
267
273
|
"editor.record.loadError.title": "",
|
|
274
|
+
"editor.record.onlineResource.protocol.other": "",
|
|
268
275
|
"editor.record.onlineResourceError.body": "",
|
|
269
276
|
"editor.record.onlineResourceError.closeMessage": "",
|
|
270
277
|
"editor.record.onlineResourceError.title": "",
|
package/translations/fr.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
+
"": "",
|
|
2
3
|
"Add Layer As": "",
|
|
3
4
|
"button.login": "Se connecter",
|
|
4
5
|
"catalog.figures.datasets": "{count, plural, =0{données} one{donnée} other{données}}",
|
|
@@ -217,9 +218,13 @@
|
|
|
217
218
|
"editor.record.form.field.onlineResource.confirm": "Valider",
|
|
218
219
|
"editor.record.form.field.onlineResource.dialogTitle": "Modifier l'aperçu de la ressource",
|
|
219
220
|
"editor.record.form.field.onlineResource.edit.description": "Description",
|
|
221
|
+
"editor.record.form.field.onlineResource.edit.protocol": "Protocole",
|
|
220
222
|
"editor.record.form.field.onlineResource.edit.title": "Titre",
|
|
221
223
|
"editor.record.form.field.onlineResource.fileSize": "{sizeMB} Mo",
|
|
222
224
|
"editor.record.form.field.onlineResource.modify": "Modifier",
|
|
225
|
+
"editor.record.form.field.onlineResource.toggle.dataset": "Lier un jeu de données",
|
|
226
|
+
"editor.record.form.field.onlineResource.toggle.service": "Lier un service",
|
|
227
|
+
"editor.record.form.field.onlineResources": "Distribution",
|
|
223
228
|
"editor.record.form.field.overviews": "Aperçus",
|
|
224
229
|
"editor.record.form.field.recordUpdated": "Date de dernière révision",
|
|
225
230
|
"editor.record.form.field.resourceUpdated": "Date de dernière révision",
|
|
@@ -242,8 +247,9 @@
|
|
|
242
247
|
"editor.record.form.page.ressources": "Ressources",
|
|
243
248
|
"editor.record.form.section.about.description": "Ces informations concernent la donnée.",
|
|
244
249
|
"editor.record.form.section.about.label": "À propos de la ressource",
|
|
250
|
+
"editor.record.form.section.annexes.description": "Les annexes sont optionnels. Ce sont des pièces jointes de la fiche de métadonnées qui peuvent aider à mieux comprendre la donnée (notice, etc.)",
|
|
245
251
|
"editor.record.form.section.annexes.label": "Annexes",
|
|
246
|
-
"editor.record.form.section.associatedResources.description": "
|
|
252
|
+
"editor.record.form.section.associatedResources.description": "Liez des jeux de données ou des services associés à cette fiche de métadonnée.",
|
|
247
253
|
"editor.record.form.section.associatedResources.label": "Ressources associées",
|
|
248
254
|
"editor.record.form.section.classification.description": "La classification a un impact sur la recherche du jeu de données.",
|
|
249
255
|
"editor.record.form.section.classification.label": "Classification",
|
|
@@ -265,6 +271,7 @@
|
|
|
265
271
|
"editor.record.loadError.body": "La fiche n'a pas pu être chargée :",
|
|
266
272
|
"editor.record.loadError.closeMessage": "Compris",
|
|
267
273
|
"editor.record.loadError.title": "Erreur lors du chargement",
|
|
274
|
+
"editor.record.onlineResource.protocol.other": "Autre",
|
|
268
275
|
"editor.record.onlineResourceError.body": "Une erreur est survenue lors de l'ajout de la ressource :",
|
|
269
276
|
"editor.record.onlineResourceError.closeMessage": "Compris",
|
|
270
277
|
"editor.record.onlineResourceError.title": "Erreur lors de l'ajout d'une ressource",
|
package/translations/it.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
+
"": "",
|
|
2
3
|
"Add Layer As": "",
|
|
3
4
|
"button.login": "",
|
|
4
5
|
"catalog.figures.datasets": "{count, plural, =0{datasets} one{dataset} other{datasets}}",
|
|
@@ -217,9 +218,13 @@
|
|
|
217
218
|
"editor.record.form.field.onlineResource.confirm": "",
|
|
218
219
|
"editor.record.form.field.onlineResource.dialogTitle": "",
|
|
219
220
|
"editor.record.form.field.onlineResource.edit.description": "",
|
|
221
|
+
"editor.record.form.field.onlineResource.edit.protocol": "",
|
|
220
222
|
"editor.record.form.field.onlineResource.edit.title": "",
|
|
221
223
|
"editor.record.form.field.onlineResource.fileSize": "",
|
|
222
224
|
"editor.record.form.field.onlineResource.modify": "",
|
|
225
|
+
"editor.record.form.field.onlineResource.toggle.dataset": "",
|
|
226
|
+
"editor.record.form.field.onlineResource.toggle.service": "",
|
|
227
|
+
"editor.record.form.field.onlineResources": "",
|
|
223
228
|
"editor.record.form.field.overviews": "",
|
|
224
229
|
"editor.record.form.field.recordUpdated": "",
|
|
225
230
|
"editor.record.form.field.resourceUpdated": "",
|
|
@@ -242,6 +247,7 @@
|
|
|
242
247
|
"editor.record.form.page.ressources": "",
|
|
243
248
|
"editor.record.form.section.about.description": "",
|
|
244
249
|
"editor.record.form.section.about.label": "",
|
|
250
|
+
"editor.record.form.section.annexes.description": "",
|
|
245
251
|
"editor.record.form.section.annexes.label": "",
|
|
246
252
|
"editor.record.form.section.associatedResources.description": "",
|
|
247
253
|
"editor.record.form.section.associatedResources.label": "",
|
|
@@ -265,6 +271,7 @@
|
|
|
265
271
|
"editor.record.loadError.body": "",
|
|
266
272
|
"editor.record.loadError.closeMessage": "",
|
|
267
273
|
"editor.record.loadError.title": "",
|
|
274
|
+
"editor.record.onlineResource.protocol.other": "",
|
|
268
275
|
"editor.record.onlineResourceError.body": "",
|
|
269
276
|
"editor.record.onlineResourceError.closeMessage": "",
|
|
270
277
|
"editor.record.onlineResourceError.title": "",
|
package/translations/nl.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
+
"": "",
|
|
2
3
|
"Add Layer As": "",
|
|
3
4
|
"button.login": "",
|
|
4
5
|
"catalog.figures.datasets": "datasets",
|
|
@@ -217,9 +218,13 @@
|
|
|
217
218
|
"editor.record.form.field.onlineResource.confirm": "",
|
|
218
219
|
"editor.record.form.field.onlineResource.dialogTitle": "",
|
|
219
220
|
"editor.record.form.field.onlineResource.edit.description": "",
|
|
221
|
+
"editor.record.form.field.onlineResource.edit.protocol": "",
|
|
220
222
|
"editor.record.form.field.onlineResource.edit.title": "",
|
|
221
223
|
"editor.record.form.field.onlineResource.fileSize": "",
|
|
222
224
|
"editor.record.form.field.onlineResource.modify": "",
|
|
225
|
+
"editor.record.form.field.onlineResource.toggle.dataset": "",
|
|
226
|
+
"editor.record.form.field.onlineResource.toggle.service": "",
|
|
227
|
+
"editor.record.form.field.onlineResources": "",
|
|
223
228
|
"editor.record.form.field.overviews": "",
|
|
224
229
|
"editor.record.form.field.recordUpdated": "",
|
|
225
230
|
"editor.record.form.field.resourceUpdated": "",
|
|
@@ -242,6 +247,7 @@
|
|
|
242
247
|
"editor.record.form.page.ressources": "",
|
|
243
248
|
"editor.record.form.section.about.description": "",
|
|
244
249
|
"editor.record.form.section.about.label": "",
|
|
250
|
+
"editor.record.form.section.annexes.description": "",
|
|
245
251
|
"editor.record.form.section.annexes.label": "",
|
|
246
252
|
"editor.record.form.section.associatedResources.description": "",
|
|
247
253
|
"editor.record.form.section.associatedResources.label": "",
|
|
@@ -265,6 +271,7 @@
|
|
|
265
271
|
"editor.record.loadError.body": "",
|
|
266
272
|
"editor.record.loadError.closeMessage": "",
|
|
267
273
|
"editor.record.loadError.title": "",
|
|
274
|
+
"editor.record.onlineResource.protocol.other": "",
|
|
268
275
|
"editor.record.onlineResourceError.body": "",
|
|
269
276
|
"editor.record.onlineResourceError.closeMessage": "",
|
|
270
277
|
"editor.record.onlineResourceError.title": "",
|