geonetwork-ui 2.10.0-dev.89f0dfe6f → 2.10.0-dev.8afb6cd00
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 +411 -257
- package/fesm2022/geonetwork-ui.mjs.map +1 -1
- package/index.d.ts +68 -12
- package/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/libs/api/repository/src/lib/gn4/gn4-repository.ts +54 -32
- package/src/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.ts +46 -0
- package/src/libs/common/domain/src/lib/model/record/metadata.model.ts +0 -5
- package/src/libs/common/domain/src/lib/model/user/group.model.ts +8 -0
- package/src/libs/common/domain/src/lib/model/user/index.ts +1 -0
- package/src/libs/common/domain/src/lib/platform.service.interface.ts +2 -0
- package/src/libs/common/fixtures/src/lib/records.fixtures.ts +0 -2
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-topics/form-field-topics.component.ts +2 -2
- package/src/libs/feature/editor/src/lib/fields.config.ts +60 -47
- package/src/libs/feature/editor/src/lib/services/editor.service.ts +1 -1
- package/src/libs/feature/map/src/lib/utils/map-utils.service.ts +33 -0
- package/src/libs/feature/record/src/lib/map-view/map-view.component.ts +9 -1
- package/src/libs/ui/elements/src/lib/contact-details/contact-details.component.html +1 -1
- package/src/libs/ui/elements/src/lib/contact-pill/contact-pill.component.html +7 -3
- package/src/libs/ui/elements/src/lib/metadata-info/metadata-info.component.html +1 -1
- package/src/libs/ui/inputs/src/lib/button/button.component.ts +4 -0
- package/src/libs/ui/map/src/lib/components/spatial-extent/spatial-extent.component.ts +4 -54
- package/src/libs/ui/map/src/lib/map-utils.ts +48 -0
- package/src/libs/util/app-config/src/lib/app-config.ts +14 -1
- package/src/libs/util/app-config/src/lib/model.ts +3 -0
- package/src/libs/util/app-config/src/lib/parse-utils.ts +27 -0
- package/src/libs/util/shared/src/lib/links/link-utils.ts +1 -1
- package/src/libs/util/shared/src/lib/utils/geojson.ts +58 -1
- package/tailwind.base.css +6 -0
- package/translations/de.json +19 -19
- package/translations/en.json +19 -19
- package/translations/es.json +19 -19
- package/translations/fr.json +19 -19
- package/translations/it.json +19 -19
- package/translations/nl.json +19 -19
- package/translations/pt.json +19 -19
- package/translations/sk.json +19 -19
|
@@ -12,11 +12,13 @@ import {
|
|
|
12
12
|
} from '../../../../../../../libs/common/domain/src/lib/model/record'
|
|
13
13
|
import { KeywordType } from '../../../../../../../libs/common/domain/src/lib/model/thesaurus'
|
|
14
14
|
import { UserModel } from '../../../../../../../libs/common/domain/src/lib/model/user/user.model'
|
|
15
|
+
import { GroupModel } from '../../../../../../../libs/common/domain/src/lib/model/user/group.model'
|
|
15
16
|
import {
|
|
16
17
|
PlatformServiceInterface,
|
|
17
18
|
UploadEvent,
|
|
18
19
|
} from '../../../../../../../libs/common/domain/src/lib/platform.service.interface'
|
|
19
20
|
import {
|
|
21
|
+
GroupsApiService,
|
|
20
22
|
MeApiService,
|
|
21
23
|
RecordsApiService,
|
|
22
24
|
RegistriesApiService,
|
|
@@ -57,6 +59,7 @@ export const DISABLE_AUTH = new InjectionToken<boolean>('gnDisableAuth', {
|
|
|
57
59
|
export class Gn4PlatformService implements PlatformServiceInterface {
|
|
58
60
|
private meApi = inject(MeApiService)
|
|
59
61
|
private usersApi = inject(UsersApiService)
|
|
62
|
+
private groupsApi = inject(GroupsApiService)
|
|
60
63
|
private mapper = inject(Gn4PlatformMapper)
|
|
61
64
|
private toolsApiService = inject(ToolsApiService)
|
|
62
65
|
private registriesApiService = inject(RegistriesApiService)
|
|
@@ -155,6 +158,49 @@ export class Gn4PlatformService implements PlatformServiceInterface {
|
|
|
155
158
|
return this.users$
|
|
156
159
|
}
|
|
157
160
|
|
|
161
|
+
getUserPermissionsByGroup(): Observable<GroupModel[]> {
|
|
162
|
+
if (this.disableAuth) return of([])
|
|
163
|
+
return combineLatest([this.meApi.getMe(), this.groupsApi.getGroups()]).pipe(
|
|
164
|
+
map(([meResponse, groups]) => {
|
|
165
|
+
if (!meResponse) return []
|
|
166
|
+
if (meResponse.admin) {
|
|
167
|
+
return groups.map((group) => ({
|
|
168
|
+
groupId: group.id,
|
|
169
|
+
groupName: group.name,
|
|
170
|
+
isMember: true,
|
|
171
|
+
canEdit: true,
|
|
172
|
+
canApprove: true,
|
|
173
|
+
canAdministrate: true,
|
|
174
|
+
}))
|
|
175
|
+
}
|
|
176
|
+
const reviewerIds = meResponse.groupsWithReviewer ?? []
|
|
177
|
+
const editorIds = meResponse.groupsWithEditor ?? []
|
|
178
|
+
const memberIds = meResponse.groupsWithRegisteredUser ?? []
|
|
179
|
+
const adminIds = meResponse.groupsWithUserAdmin ?? []
|
|
180
|
+
const groupsById = new Map(groups.map((g) => [g.id, g]))
|
|
181
|
+
return [
|
|
182
|
+
...new Set([
|
|
183
|
+
...reviewerIds,
|
|
184
|
+
...editorIds,
|
|
185
|
+
...groups.map((g) => g.id),
|
|
186
|
+
]),
|
|
187
|
+
]
|
|
188
|
+
.filter((id) => groupsById.has(id))
|
|
189
|
+
.map((id) => {
|
|
190
|
+
const group = groupsById.get(id)
|
|
191
|
+
return {
|
|
192
|
+
groupId: group.id,
|
|
193
|
+
groupName: group.name,
|
|
194
|
+
isMember: memberIds.includes(id),
|
|
195
|
+
canEdit: editorIds.includes(id),
|
|
196
|
+
canApprove: reviewerIds.includes(id),
|
|
197
|
+
canAdministrate: adminIds.includes(id),
|
|
198
|
+
}
|
|
199
|
+
})
|
|
200
|
+
})
|
|
201
|
+
)
|
|
202
|
+
}
|
|
203
|
+
|
|
158
204
|
translateKey(key: string): Observable<string> {
|
|
159
205
|
// if the key is a URI, use the registries API to look for the translation
|
|
160
206
|
if (key.match(/^https?:\/\//)) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Observable } from 'rxjs'
|
|
2
2
|
import type { UserModel } from './model/user/user.model'
|
|
3
|
+
import type { GroupModel } from './model/user/group.model'
|
|
3
4
|
import type { Organization } from './model/record/organization.model'
|
|
4
5
|
import { CatalogRecord, Keyword, UserFeedback } from './model/record'
|
|
5
6
|
import { KeywordType } from './model/thesaurus'
|
|
@@ -28,6 +29,7 @@ export abstract class PlatformServiceInterface {
|
|
|
28
29
|
abstract getMe(): Observable<UserModel>
|
|
29
30
|
abstract isAnonymous(): Observable<boolean>
|
|
30
31
|
abstract getUsers(): Observable<UserModel[]>
|
|
32
|
+
abstract getUserPermissionsByGroup(): Observable<GroupModel[]>
|
|
31
33
|
abstract getUsersByOrganization(
|
|
32
34
|
organisation: Organization
|
|
33
35
|
): Observable<UserModel[]>
|
|
@@ -359,7 +359,6 @@ export const simpleDatasetRecordFixture = (): DatasetRecord => ({
|
|
|
359
359
|
securityConstraints: [],
|
|
360
360
|
otherConstraints: [],
|
|
361
361
|
lineage: 'This record was edited manually to test the conversion processes',
|
|
362
|
-
sourceRecords: [],
|
|
363
362
|
spatialRepresentation: 'grid',
|
|
364
363
|
overviews: [],
|
|
365
364
|
spatialExtents: [],
|
|
@@ -1000,7 +999,6 @@ export const multilingualDatasetFixture: () => DatasetRecord = () => ({
|
|
|
1000
999
|
},
|
|
1001
1000
|
},
|
|
1002
1001
|
],
|
|
1003
|
-
sourceRecords: [],
|
|
1004
1002
|
onlineResources: [],
|
|
1005
1003
|
licenses: [],
|
|
1006
1004
|
legalConstraints: [],
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
DropdownMultiselectComponent,
|
|
6
6
|
} from '../../../../../../../../../libs/ui/inputs/src'
|
|
7
7
|
import { TranslatePipe, TranslateService } from '@ngx-translate/core'
|
|
8
|
-
import {
|
|
8
|
+
import { ISO_TOPICS } from '../../../../fields.config'
|
|
9
9
|
|
|
10
10
|
@Component({
|
|
11
11
|
selector: 'gn-ui-form-field-topics',
|
|
@@ -22,7 +22,7 @@ export class FormFieldTopicsComponent {
|
|
|
22
22
|
this.topics = topics
|
|
23
23
|
}
|
|
24
24
|
@Output() valueChange: EventEmitter<string[]> = new EventEmitter()
|
|
25
|
-
availableTopics =
|
|
25
|
+
availableTopics = ISO_TOPICS.map((topic) => {
|
|
26
26
|
return {
|
|
27
27
|
label: this.translateService.instant(topic.label),
|
|
28
28
|
value: topic.value,
|
|
@@ -4,10 +4,12 @@ import {
|
|
|
4
4
|
EditorField,
|
|
5
5
|
EditorSection,
|
|
6
6
|
} from './models/editor-config.model'
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
import { Keyword } from '../../../../../libs/common/domain/src/lib/model/record'
|
|
8
|
+
|
|
9
|
+
export interface ISOTopic {
|
|
10
|
+
value: string
|
|
11
|
+
label: string
|
|
12
|
+
}
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* This file contains the configuration of the fields that will be displayed in the editor.
|
|
@@ -359,75 +361,86 @@ export const SPATIAL_SCOPES: Keyword[] = [
|
|
|
359
361
|
]
|
|
360
362
|
|
|
361
363
|
/************************************************************
|
|
362
|
-
***************
|
|
364
|
+
*************** ISO TOPICS **************
|
|
363
365
|
************************************************************
|
|
364
366
|
*/
|
|
365
367
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
+
// label keys mirror the ISO MD_TopicCategoryCode value for consistency
|
|
369
|
+
// TODO: correctly handle code lists; for instance, this code list is specific to ISO 19139
|
|
370
|
+
export const ISO_TOPICS: ISOTopic[] = [
|
|
371
|
+
{ value: 'biota', label: marker('editor.record.form.topics.iso.biota') },
|
|
368
372
|
{
|
|
369
373
|
value: 'boundaries',
|
|
370
|
-
label: 'editor.record.form.topics.
|
|
374
|
+
label: marker('editor.record.form.topics.iso.boundaries'),
|
|
371
375
|
},
|
|
372
376
|
{
|
|
373
377
|
value: 'climatologyMeteorologyAtmosphere',
|
|
374
|
-
label:
|
|
378
|
+
label: marker(
|
|
379
|
+
'editor.record.form.topics.iso.climatologyMeteorologyAtmosphere'
|
|
380
|
+
),
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
value: 'economy',
|
|
384
|
+
label: marker('editor.record.form.topics.iso.economy'),
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
value: 'elevation',
|
|
388
|
+
label: marker('editor.record.form.topics.iso.elevation'),
|
|
375
389
|
},
|
|
376
|
-
{ value: 'economy', label: 'editor.record.form.topics.inspire.economy' },
|
|
377
|
-
{ value: 'elevation', label: 'editor.record.form.topics.inspire.elevation' },
|
|
378
390
|
{
|
|
379
391
|
value: 'environment',
|
|
380
|
-
label: 'editor.record.form.topics.
|
|
392
|
+
label: marker('editor.record.form.topics.iso.environment'),
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
value: 'farming',
|
|
396
|
+
label: marker('editor.record.form.topics.iso.farming'),
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
value: 'geoscientificInformation',
|
|
400
|
+
label: marker('editor.record.form.topics.iso.geoscientificInformation'),
|
|
381
401
|
},
|
|
382
|
-
{ value: 'farming', label: 'editor.record.form.topics.inspire.farming' },
|
|
383
402
|
{
|
|
384
|
-
value: '
|
|
385
|
-
label: 'editor.record.form.topics.
|
|
403
|
+
value: 'health',
|
|
404
|
+
label: marker('editor.record.form.topics.iso.health'),
|
|
386
405
|
},
|
|
387
|
-
{ value: 'health', label: 'editor.record.form.topics.inspire.health' },
|
|
388
406
|
{
|
|
389
407
|
value: 'imageryBaseMapsEarthCover',
|
|
390
|
-
label: 'editor.record.form.topics.
|
|
408
|
+
label: marker('editor.record.form.topics.iso.imageryBaseMapsEarthCover'),
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
value: 'inlandWaters',
|
|
412
|
+
label: marker('editor.record.form.topics.iso.inlandWaters'),
|
|
391
413
|
},
|
|
392
|
-
{ value: 'inlandWaters', label: 'editor.record.form.topics.inspire.waters' },
|
|
393
414
|
{
|
|
394
415
|
value: 'intelligenceMilitary',
|
|
395
|
-
label: 'editor.record.form.topics.
|
|
416
|
+
label: marker('editor.record.form.topics.iso.intelligenceMilitary'),
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
value: 'location',
|
|
420
|
+
label: marker('editor.record.form.topics.iso.location'),
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
value: 'oceans',
|
|
424
|
+
label: marker('editor.record.form.topics.iso.oceans'),
|
|
396
425
|
},
|
|
397
|
-
{ value: 'Location', label: 'editor.record.form.topics.inspire.location' },
|
|
398
|
-
{ value: 'Oceans', label: 'editor.record.form.topics.inspire.oceans' },
|
|
399
426
|
{
|
|
400
427
|
value: 'planningCadastre',
|
|
401
|
-
label: 'editor.record.form.topics.
|
|
428
|
+
label: marker('editor.record.form.topics.iso.planningCadastre'),
|
|
402
429
|
},
|
|
403
|
-
{ value: 'Society', label: 'editor.record.form.topics.inspire.society' },
|
|
404
|
-
{ value: 'Structure', label: 'editor.record.form.topics.inspire.structure' },
|
|
405
430
|
{
|
|
406
|
-
value: '
|
|
407
|
-
label: 'editor.record.form.topics.
|
|
431
|
+
value: 'society',
|
|
432
|
+
label: marker('editor.record.form.topics.iso.society'),
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
value: 'structure',
|
|
436
|
+
label: marker('editor.record.form.topics.iso.structure'),
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
value: 'transportation',
|
|
440
|
+
label: marker('editor.record.form.topics.iso.transportation'),
|
|
408
441
|
},
|
|
409
442
|
{
|
|
410
443
|
value: 'utilitiesCommunication',
|
|
411
|
-
label: 'editor.record.form.topics.
|
|
444
|
+
label: marker('editor.record.form.topics.iso.utilitiesCommunication'),
|
|
412
445
|
},
|
|
413
446
|
]
|
|
414
|
-
|
|
415
|
-
marker('editor.record.form.topics.inspire.biota')
|
|
416
|
-
marker('editor.record.form.topics.inspire.boundaries')
|
|
417
|
-
marker('editor.record.form.topics.inspire.climatology')
|
|
418
|
-
marker('editor.record.form.topics.inspire.economy')
|
|
419
|
-
marker('editor.record.form.topics.inspire.elevation')
|
|
420
|
-
marker('editor.record.form.topics.inspire.environnement')
|
|
421
|
-
marker('editor.record.form.topics.inspire.farming')
|
|
422
|
-
marker('editor.record.form.topics.inspire.geoscientific')
|
|
423
|
-
marker('editor.record.form.topics.inspire.health')
|
|
424
|
-
marker('editor.record.form.topics.inspire.imagery')
|
|
425
|
-
marker('editor.record.form.topics.inspire.intelligence')
|
|
426
|
-
marker('editor.record.form.topics.inspire.location')
|
|
427
|
-
marker('editor.record.form.topics.inspire.oceans')
|
|
428
|
-
marker('editor.record.form.topics.inspire.planning')
|
|
429
|
-
marker('editor.record.form.topics.inspire.society')
|
|
430
|
-
marker('editor.record.form.topics.inspire.structure')
|
|
431
|
-
marker('editor.record.form.topics.inspire.transportation')
|
|
432
|
-
marker('editor.record.form.topics.inspire.utilities')
|
|
433
|
-
marker('editor.record.form.topics.inspire.waters')
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Injectable, inject } from '@angular/core'
|
|
2
|
-
import {
|
|
2
|
+
import { Observable, switchMap } from 'rxjs'
|
|
3
3
|
import { map, tap } from 'rxjs/operators'
|
|
4
4
|
import { CatalogRecord } from '../../../../../../libs/common/domain/src/lib/model/record'
|
|
5
5
|
import { EditorConfig } from '../models/'
|
|
@@ -2,6 +2,23 @@ import { Injectable } from '@angular/core'
|
|
|
2
2
|
import { extend } from 'ol/extent.js'
|
|
3
3
|
import { CatalogRecord } from '../../../../../../libs/common/domain/src/lib/model/record'
|
|
4
4
|
import { BoundingBox, getGeometryBoundingBox } from '../../../../../../libs/util/shared/src'
|
|
5
|
+
import { MapContextLayer } from '@geospatial-sdk/core'
|
|
6
|
+
import {
|
|
7
|
+
createSpatialExtentLayer,
|
|
8
|
+
SpatialExtentLayerStyle,
|
|
9
|
+
} from '../../../../../../libs/ui/map/src'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Style of the extent overlay drawn on top of the previewed data: a dashed
|
|
13
|
+
* black outline over a very light fill, so the extent stays readable without
|
|
14
|
+
* hiding the data underneath.
|
|
15
|
+
*/
|
|
16
|
+
const RECORD_EXTENT_OVERLAY_STYLE: SpatialExtentLayerStyle = {
|
|
17
|
+
'stroke-color': 'rgba(0, 0, 0, 0.6)',
|
|
18
|
+
'stroke-width': 2,
|
|
19
|
+
'stroke-line-dash': [8, 6],
|
|
20
|
+
'fill-color': 'rgba(0, 0, 0, 0.03)',
|
|
21
|
+
}
|
|
5
22
|
|
|
6
23
|
@Injectable({
|
|
7
24
|
providedIn: 'root',
|
|
@@ -26,4 +43,20 @@ export class MapUtilsService {
|
|
|
26
43
|
[Infinity, Infinity, -Infinity, -Infinity]
|
|
27
44
|
)
|
|
28
45
|
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Builds a non-interactive overlay layer drawing the spatial extent(s)
|
|
49
|
+
* declared in the record's metadata (bounding boxes and/or geometries).
|
|
50
|
+
* Returns null when the record has no usable spatial extent.
|
|
51
|
+
*
|
|
52
|
+
* This is purely for display and is independent from the map's initial view,
|
|
53
|
+
* which is derived separately (see {@link getRecordExtent}).
|
|
54
|
+
*/
|
|
55
|
+
getRecordExtentLayer(record: Partial<CatalogRecord>): MapContextLayer | null {
|
|
56
|
+
return createSpatialExtentLayer(record.spatialExtents ?? [], {
|
|
57
|
+
label: 'Spatial extent',
|
|
58
|
+
clickable: false,
|
|
59
|
+
style: RECORD_EXTENT_OVERLAY_STYLE,
|
|
60
|
+
})
|
|
61
|
+
}
|
|
29
62
|
}
|
|
@@ -431,11 +431,19 @@ export class MapViewComponent implements AfterViewInit {
|
|
|
431
431
|
}),
|
|
432
432
|
withLatestFrom(this.mdViewFacade.metadata$),
|
|
433
433
|
map(([context, metadata]) => {
|
|
434
|
-
|
|
434
|
+
// overlay the record's declared spatial extent on top of the data layers
|
|
435
|
+
const extentLayer = this.mapUtils.getRecordExtentLayer(metadata)
|
|
436
|
+
const layers = extentLayer
|
|
437
|
+
? [...context.layers, extentLayer]
|
|
438
|
+
: context.layers
|
|
439
|
+
// the view (initial zoom) is derived from the data layer or, as a
|
|
440
|
+
// fallback, from the record extent — independently from the overlay above
|
|
441
|
+
if (context.view) return { ...context, layers }
|
|
435
442
|
const extent = this.mapUtils.getRecordExtent(metadata)
|
|
436
443
|
const view = extent ? { extent } : null
|
|
437
444
|
return {
|
|
438
445
|
...context,
|
|
446
|
+
layers,
|
|
439
447
|
view,
|
|
440
448
|
}
|
|
441
449
|
}),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<gn-ui-button
|
|
2
|
-
[type]="overlayOpen ? '
|
|
2
|
+
[type]="overlayOpen ? 'gray-light' : 'primary-light'"
|
|
3
3
|
extraClass="group w-full min-h-12 gap-3 justify-between py-2 pl-5 pr-4 rounded"
|
|
4
4
|
data-test="contact-pill"
|
|
5
5
|
(buttonClick)="toggleOverlay()"
|
|
@@ -7,12 +7,16 @@
|
|
|
7
7
|
#overlayOrigin="cdkOverlayOrigin"
|
|
8
8
|
>
|
|
9
9
|
<span
|
|
10
|
-
class="font-title font-medium text-base leading-tight truncate
|
|
10
|
+
class="font-title font-medium text-base leading-tight truncate"
|
|
11
|
+
[class]="!overlayOpen ? 'text-primary-black group-hover:text-white' : ''"
|
|
11
12
|
[title]="displayName"
|
|
12
13
|
>{{ displayName }}</span
|
|
13
14
|
>
|
|
14
15
|
<div
|
|
15
|
-
class="gn-ui-card-icon items-center justify-center w-10 h-8
|
|
16
|
+
class="gn-ui-card-icon items-center justify-center w-10 h-8"
|
|
17
|
+
[class]="
|
|
18
|
+
!overlayOpen ? 'group-hover:border-white group-hover:text-white' : ''
|
|
19
|
+
"
|
|
16
20
|
>
|
|
17
21
|
@if (overlayOpen) {
|
|
18
22
|
<ng-icon class="!w-6 !h-6 !text-[24px]" name="matClose"></ng-icon>
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
>
|
|
114
114
|
<div class="flex flex-col gap-1 pt-3 pb-4">
|
|
115
115
|
@for (group of contactGroups; track group.role) {
|
|
116
|
-
<div class="flex flex-col gap-1 rounded
|
|
116
|
+
<div class="flex flex-col gap-1 rounded py-4 px-2">
|
|
117
117
|
<p class="text-xs font-normal text-black">
|
|
118
118
|
{{ group.roleLabel | translate }}
|
|
119
119
|
</p>
|
|
@@ -25,6 +25,7 @@ export class ButtonComponent {
|
|
|
25
25
|
| 'outline'
|
|
26
26
|
| 'light'
|
|
27
27
|
| 'gray'
|
|
28
|
+
| 'gray-light'
|
|
28
29
|
| 'black'
|
|
29
30
|
| 'primary-light'
|
|
30
31
|
) {
|
|
@@ -45,6 +46,9 @@ export class ButtonComponent {
|
|
|
45
46
|
case 'gray':
|
|
46
47
|
this.btnClass = 'gn-ui-btn-gray'
|
|
47
48
|
break
|
|
49
|
+
case 'gray-light':
|
|
50
|
+
this.btnClass = 'gn-ui-btn-gray-light'
|
|
51
|
+
break
|
|
48
52
|
case 'black':
|
|
49
53
|
this.btnClass = 'gn-ui-btn-black'
|
|
50
54
|
break
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
import { ChangeDetectorRef, Component, inject, Input } from '@angular/core'
|
|
2
2
|
import { CommonModule } from '@angular/common'
|
|
3
|
-
import {
|
|
4
|
-
import { GeoJSONFeatureCollection } from 'ol/format/GeoJSON.js'
|
|
5
|
-
import GeoJSON from 'ol/format/GeoJSON.js'
|
|
6
|
-
import { Polygon } from 'ol/geom.js'
|
|
7
|
-
import {
|
|
8
|
-
createViewFromLayer,
|
|
9
|
-
MapContext,
|
|
10
|
-
MapContextLayer,
|
|
11
|
-
} from '@geospatial-sdk/core'
|
|
3
|
+
import { createViewFromLayer, MapContext } from '@geospatial-sdk/core'
|
|
12
4
|
import { MapContainerComponent } from '../map-container/map-container.component'
|
|
13
5
|
import { BehaviorSubject, from, Observable, of } from 'rxjs'
|
|
14
6
|
import { map, switchMap, tap } from 'rxjs/operators'
|
|
15
7
|
import { DatasetSpatialExtent } from '../../../../../../../libs/common/domain/src/lib/model/record'
|
|
8
|
+
import { createSpatialExtentLayer } from '../../map-utils'
|
|
16
9
|
|
|
17
10
|
@Component({
|
|
18
11
|
selector: 'gn-ui-spatial-extent',
|
|
@@ -30,39 +23,10 @@ export class SpatialExtentComponent {
|
|
|
30
23
|
spatialExtents$ = new BehaviorSubject<DatasetSpatialExtent[]>([])
|
|
31
24
|
mapContext$: Observable<MapContext> = this.spatialExtents$.pipe(
|
|
32
25
|
switchMap((extents) => {
|
|
33
|
-
|
|
26
|
+
const layer = createSpatialExtentLayer(extents)
|
|
27
|
+
if (!layer) {
|
|
34
28
|
return of(null)
|
|
35
29
|
}
|
|
36
|
-
const featureCollection: GeoJSONFeatureCollection = {
|
|
37
|
-
type: 'FeatureCollection',
|
|
38
|
-
features: [],
|
|
39
|
-
}
|
|
40
|
-
extents.forEach((extent) => {
|
|
41
|
-
if (extent.geometry) {
|
|
42
|
-
featureCollection.features.push({
|
|
43
|
-
type: 'Feature',
|
|
44
|
-
properties: {},
|
|
45
|
-
geometry: extent.geometry,
|
|
46
|
-
})
|
|
47
|
-
} else if (extent.bbox?.length >= 0) {
|
|
48
|
-
featureCollection.features.push({
|
|
49
|
-
type: 'Feature',
|
|
50
|
-
properties: {},
|
|
51
|
-
geometry: this.bboxCoordsToGeometry(extent.bbox),
|
|
52
|
-
})
|
|
53
|
-
}
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
const layer: MapContextLayer = {
|
|
57
|
-
type: 'geojson',
|
|
58
|
-
data: featureCollection,
|
|
59
|
-
label: 'Spatial extents',
|
|
60
|
-
style: {
|
|
61
|
-
'stroke-color': 'black',
|
|
62
|
-
'stroke-width': 2,
|
|
63
|
-
'fill-color': 'rgba(153, 153, 153, 0.3)',
|
|
64
|
-
},
|
|
65
|
-
}
|
|
66
30
|
return from(createViewFromLayer(layer)).pipe(
|
|
67
31
|
map((view) => ({ view, layers: [layer] }) as MapContext),
|
|
68
32
|
tap(() => this._cdr.markForCheck())
|
|
@@ -71,18 +35,4 @@ export class SpatialExtentComponent {
|
|
|
71
35
|
)
|
|
72
36
|
|
|
73
37
|
error = ''
|
|
74
|
-
|
|
75
|
-
bboxCoordsToGeometry(bbox: [number, number, number, number]): Geometry {
|
|
76
|
-
const geometry = new Polygon([
|
|
77
|
-
[
|
|
78
|
-
[bbox[0], bbox[1]],
|
|
79
|
-
[bbox[0], bbox[3]],
|
|
80
|
-
[bbox[2], bbox[3]],
|
|
81
|
-
[bbox[2], bbox[1]],
|
|
82
|
-
[bbox[0], bbox[1]],
|
|
83
|
-
],
|
|
84
|
-
])
|
|
85
|
-
|
|
86
|
-
return new GeoJSON().writeGeometryObject(geometry)
|
|
87
|
-
}
|
|
88
38
|
}
|
|
@@ -12,6 +12,54 @@ import {
|
|
|
12
12
|
MouseWheelZoom,
|
|
13
13
|
} from 'ol/interaction.js'
|
|
14
14
|
import MapBrowserEvent from 'ol/MapBrowserEvent.js'
|
|
15
|
+
import type { DatasetSpatialExtent } from '../../../../../libs/common/domain/src/lib/model/record'
|
|
16
|
+
import type {
|
|
17
|
+
MapContextLayer,
|
|
18
|
+
MapContextLayerGeojson,
|
|
19
|
+
} from '@geospatial-sdk/core'
|
|
20
|
+
import { spatialExtentsToFeatureCollection } from '../../../../../libs/util/shared/src'
|
|
21
|
+
|
|
22
|
+
export type SpatialExtentLayerStyle = NonNullable<
|
|
23
|
+
MapContextLayerGeojson['style']
|
|
24
|
+
>
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Default style for a spatial-extent layer: a solid black outline over a
|
|
28
|
+
* translucent grey fill.
|
|
29
|
+
*/
|
|
30
|
+
export const DEFAULT_SPATIAL_EXTENT_STYLE: SpatialExtentLayerStyle = {
|
|
31
|
+
'stroke-color': 'black',
|
|
32
|
+
'stroke-width': 2,
|
|
33
|
+
'fill-color': 'rgba(153, 153, 153, 0.3)',
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Builds a GeoJSON map layer drawing the given spatial extents: each extent is
|
|
38
|
+
* rendered from its own geometry or, when only a bounding box is available,
|
|
39
|
+
* from a polygon derived from that box.
|
|
40
|
+
*
|
|
41
|
+
* @returns the layer, or `null` when none of the extents can be represented.
|
|
42
|
+
*/
|
|
43
|
+
export function createSpatialExtentLayer(
|
|
44
|
+
extents: DatasetSpatialExtent[],
|
|
45
|
+
overrides?: {
|
|
46
|
+
label?: string
|
|
47
|
+
clickable?: boolean
|
|
48
|
+
style?: SpatialExtentLayerStyle
|
|
49
|
+
}
|
|
50
|
+
): MapContextLayer | null {
|
|
51
|
+
const data = spatialExtentsToFeatureCollection(extents)
|
|
52
|
+
if (data.features.length === 0) {
|
|
53
|
+
return null
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
type: 'geojson',
|
|
57
|
+
data,
|
|
58
|
+
label: 'Spatial extents',
|
|
59
|
+
style: DEFAULT_SPATIAL_EXTENT_STYLE,
|
|
60
|
+
...overrides,
|
|
61
|
+
}
|
|
62
|
+
}
|
|
15
63
|
|
|
16
64
|
export function prioritizePageScroll(interactions: Collection<Interaction>) {
|
|
17
65
|
interactions.clear()
|
|
@@ -2,6 +2,7 @@ import * as TOML from '@ltd/j-toml'
|
|
|
2
2
|
import {
|
|
3
3
|
checkMetadataLanguage,
|
|
4
4
|
checkNewRecordDefaultLanguage,
|
|
5
|
+
checkNewRecordStandard,
|
|
5
6
|
parseConfigSection,
|
|
6
7
|
parseMultiConfigSection,
|
|
7
8
|
parseTranslationsConfigSection,
|
|
@@ -297,7 +298,7 @@ export function loadAppConfig(configUrl = 'assets/configuration/default.toml') {
|
|
|
297
298
|
parsed,
|
|
298
299
|
'editing',
|
|
299
300
|
[],
|
|
300
|
-
['new_record_default_language'],
|
|
301
|
+
['new_record_default_language', 'new_record_standard'],
|
|
301
302
|
warnings,
|
|
302
303
|
errors
|
|
303
304
|
)
|
|
@@ -310,6 +311,15 @@ export function loadAppConfig(configUrl = 'assets/configuration/default.toml') {
|
|
|
310
311
|
warnings
|
|
311
312
|
)
|
|
312
313
|
}
|
|
314
|
+
if (
|
|
315
|
+
parsedEditingSection !== null &&
|
|
316
|
+
parsedEditingSection.new_record_standard !== undefined
|
|
317
|
+
) {
|
|
318
|
+
parsedEditingSection = checkNewRecordStandard(
|
|
319
|
+
parsedEditingSection,
|
|
320
|
+
warnings
|
|
321
|
+
)
|
|
322
|
+
}
|
|
313
323
|
editorConfig =
|
|
314
324
|
parsedEditingSection === null
|
|
315
325
|
? null
|
|
@@ -318,6 +328,9 @@ export function loadAppConfig(configUrl = 'assets/configuration/default.toml') {
|
|
|
318
328
|
parsedEditingSection.new_record_default_language as
|
|
319
329
|
| string
|
|
320
330
|
| undefined,
|
|
331
|
+
NEW_RECORD_STANDARD: parsedEditingSection.new_record_standard as
|
|
332
|
+
| EditorConfig['NEW_RECORD_STANDARD']
|
|
333
|
+
| undefined,
|
|
321
334
|
} as EditorConfig)
|
|
322
335
|
|
|
323
336
|
customTranslations = parseTranslationsConfigSection(
|
|
@@ -69,8 +69,11 @@ export interface MetadataQualityConfig {
|
|
|
69
69
|
ENABLED: boolean
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
export type NewRecordStandard = 'iso19139' | 'iso19115-3'
|
|
73
|
+
|
|
72
74
|
export interface EditorConfig {
|
|
73
75
|
NEW_RECORD_DEFAULT_LANGUAGE?: string
|
|
76
|
+
NEW_RECORD_STANDARD?: NewRecordStandard
|
|
74
77
|
}
|
|
75
78
|
|
|
76
79
|
export type CustomTranslations = { [translationKey: string]: string }
|
|
@@ -159,3 +159,30 @@ export function checkNewRecordDefaultLanguage(
|
|
|
159
159
|
new_record_default_language: lang2,
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
+
|
|
163
|
+
export function checkNewRecordStandard(
|
|
164
|
+
parsedConfigSection: any,
|
|
165
|
+
outWarnings: string[]
|
|
166
|
+
) {
|
|
167
|
+
const standard = parsedConfigSection.new_record_standard
|
|
168
|
+
const normalizedStandard =
|
|
169
|
+
typeof standard === 'string' ? standard.trim().toLowerCase() : null
|
|
170
|
+
|
|
171
|
+
if (
|
|
172
|
+
normalizedStandard === 'iso19139' ||
|
|
173
|
+
normalizedStandard === 'iso19115-3'
|
|
174
|
+
) {
|
|
175
|
+
return {
|
|
176
|
+
...parsedConfigSection,
|
|
177
|
+
new_record_standard: normalizedStandard,
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
outWarnings.push(
|
|
182
|
+
`In the [editing] section: new_record_standard = "${standard}" is not a supported metadata standard`
|
|
183
|
+
)
|
|
184
|
+
return {
|
|
185
|
+
...parsedConfigSection,
|
|
186
|
+
new_record_standard: undefined,
|
|
187
|
+
}
|
|
188
|
+
}
|
|
@@ -266,7 +266,7 @@ export function checkFileFormat(
|
|
|
266
266
|
new RegExp(`[./]${format}`, 'i').test(link.name.toLowerCase())) ||
|
|
267
267
|
('url' in link &&
|
|
268
268
|
new RegExp(`[./]${format}`, 'i').test(link.url.toString())) ||
|
|
269
|
-
('name' in link &&
|
|
269
|
+
('name' in link && new RegExp(`\\b${format}\\b`, 'i').test(link.name))
|
|
270
270
|
)
|
|
271
271
|
}
|
|
272
272
|
|