geonetwork-ui 2.4.1-dev.bf3be28aa → 2.4.1-dev.e5315d8c8

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.
Files changed (47) hide show
  1. package/esm2022/libs/feature/editor/src/lib/+state/editor.selectors.mjs +4 -4
  2. package/esm2022/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.mjs +57 -10
  3. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.mjs +36 -23
  4. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.mjs +4 -3
  5. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.mjs +3 -3
  6. package/esm2022/libs/feature/record/src/lib/data-view-share/data-view-share.component.mjs +6 -4
  7. package/esm2022/libs/util/shared/src/lib/links/link-utils.mjs +40 -1
  8. package/esm2022/translations/de.json +2 -0
  9. package/esm2022/translations/en.json +2 -0
  10. package/esm2022/translations/es.json +2 -0
  11. package/esm2022/translations/fr.json +2 -0
  12. package/esm2022/translations/it.json +2 -0
  13. package/esm2022/translations/nl.json +2 -0
  14. package/esm2022/translations/pt.json +2 -0
  15. package/fesm2022/geonetwork-ui.mjs +155 -41
  16. package/fesm2022/geonetwork-ui.mjs.map +1 -1
  17. package/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.d.ts +16 -5
  18. package/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.d.ts.map +1 -1
  19. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.d.ts +4 -4
  20. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.d.ts.map +1 -1
  21. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.d.ts +1 -1
  22. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.d.ts.map +1 -1
  23. package/libs/feature/record/src/lib/data-view-share/data-view-share.component.d.ts +2 -1
  24. package/libs/feature/record/src/lib/data-view-share/data-view-share.component.d.ts.map +1 -1
  25. package/libs/ui/elements/src/lib/record-api-form/record-api-form.component.d.ts +1 -1
  26. package/libs/util/shared/src/lib/links/link-utils.d.ts +2 -1
  27. package/libs/util/shared/src/lib/links/link-utils.d.ts.map +1 -1
  28. package/package.json +1 -1
  29. package/src/libs/feature/editor/src/lib/+state/editor.selectors.ts +3 -3
  30. package/src/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.html +38 -7
  31. package/src/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.ts +62 -3
  32. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.html +1 -1
  33. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.ts +31 -19
  34. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.html +11 -9
  35. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.ts +3 -2
  36. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.html +2 -2
  37. package/src/libs/feature/record/src/lib/data-view-share/data-view-share.component.html +1 -1
  38. package/src/libs/feature/record/src/lib/data-view-share/data-view-share.component.ts +1 -0
  39. package/src/libs/util/shared/src/lib/links/link-utils.ts +51 -1
  40. package/translations/de.json +2 -0
  41. package/translations/en.json +2 -0
  42. package/translations/es.json +2 -0
  43. package/translations/fr.json +2 -0
  44. package/translations/it.json +2 -0
  45. package/translations/nl.json +2 -0
  46. package/translations/pt.json +2 -0
  47. package/translations/sk.json +2 -0
@@ -1,26 +1,37 @@
1
- import { EventEmitter, OnChanges } from '@angular/core';
1
+ import { ChangeDetectorRef, EventEmitter, OnChanges, OnInit } from '@angular/core';
2
2
  import { DatasetServiceDistribution, ServiceProtocol } from '../../../../../../../libs/common/domain/src/lib/model/record';
3
+ import { DropdownChoice } from '../../../../../../../libs/ui/inputs/src';
3
4
  import * as i0 from "@angular/core";
4
- export declare class OnlineServiceResourceInputComponent implements OnChanges {
5
- service: Omit<DatasetServiceDistribution, 'url'>;
5
+ export declare class OnlineServiceResourceInputComponent implements OnChanges, OnInit {
6
+ private cdr;
7
+ service: DatasetServiceDistribution;
6
8
  protocolHint?: string;
7
9
  disabled?: boolean;
10
+ modifyMode?: boolean;
8
11
  urlChange: EventEmitter<string>;
9
12
  identifierSubmit: EventEmitter<{
10
13
  url: string;
11
14
  identifier: string;
12
15
  }>;
16
+ errorMessage: boolean;
13
17
  selectedProtocol: ServiceProtocol;
14
18
  url: string;
19
+ layers: DropdownChoice[] | undefined;
15
20
  protocolOptions: {
16
21
  label: string;
17
22
  value: ServiceProtocol;
18
23
  }[];
24
+ constructor(cdr: ChangeDetectorRef);
25
+ get activeLayerSuggestion(): boolean;
19
26
  ngOnChanges(): void;
20
- handleUrlChange(url: string): void;
27
+ ngOnInit(): void;
28
+ handleUrlValueChange(url: string): void;
29
+ handleUploadClick(url: string): Promise<void>;
30
+ handleSelectValue(val: string): void;
31
+ resetLayersSuggestion(): void;
21
32
  submitIdentifier(identifier: string): void;
22
33
  getIdentifierPlaceholder(): string;
23
34
  static ɵfac: i0.ɵɵFactoryDeclaration<OnlineServiceResourceInputComponent, never>;
24
- static ɵcmp: i0.ɵɵComponentDeclaration<OnlineServiceResourceInputComponent, "gn-ui-online-service-resource-input", never, { "service": { "alias": "service"; "required": false; }; "protocolHint": { "alias": "protocolHint"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "urlChange": "urlChange"; "identifierSubmit": "identifierSubmit"; }, never, never, true, never>;
35
+ static ɵcmp: i0.ɵɵComponentDeclaration<OnlineServiceResourceInputComponent, "gn-ui-online-service-resource-input", never, { "service": { "alias": "service"; "required": false; }; "protocolHint": { "alias": "protocolHint"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "modifyMode": { "alias": "modifyMode"; "required": false; }; }, { "urlChange": "urlChange"; "identifierSubmit": "identifierSubmit"; }, never, ["*"], true, never>;
25
36
  }
26
37
  //# sourceMappingURL=online-service-resource-input.component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"online-service-resource-input.component.d.ts","sourceRoot":"","sources":["../../../../../../../src/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,YAAY,EAEZ,SAAS,EAEV,MAAM,eAAe,CAAA;AAKtB,OAAO,EACL,0BAA0B,EAC1B,eAAe,EAChB,MAAM,8DAA8D,CAAA;;AAcrE,qBAwBa,mCAAoC,YAAW,SAAS;IAC1D,OAAO,EAAE,IAAI,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAA;IAChD,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,UAAQ;IAChB,SAAS,EAAE,YAAY,CAAC,MAAM,CAAC,CAAqB;IACpD,gBAAgB,EAAE,YAAY,CAAC;QACvC,GAAG,EAAE,MAAM,CAAA;QACX,UAAU,EAAE,MAAM,CAAA;KACnB,CAAC,CAAqB;IAEvB,gBAAgB,EAAE,eAAe,CAAA;IACjC,GAAG,EAAE,MAAM,CAAA;IAEX,eAAe,EAAE;QACf,KAAK,EAAE,MAAM,CAAA;QACb,KAAK,EAAE,eAAe,CAAA;KACvB,EAAE,CA6BF;IAED,WAAW;IAOX,eAAe,CAAC,GAAG,EAAE,MAAM;IAI3B,gBAAgB,CAAC,UAAU,EAAE,MAAM;IAMnC,wBAAwB,IAAI,MAAM;yCAhEvB,mCAAmC;2CAAnC,mCAAmC;CAuE/C"}
1
+ {"version":3,"file":"online-service-resource-input.component.d.ts","sourceRoot":"","sources":["../../../../../../../src/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,iBAAiB,EAEjB,YAAY,EAEZ,SAAS,EACT,MAAM,EAEP,MAAM,eAAe,CAAA;AAKtB,OAAO,EACL,0BAA0B,EAC1B,eAAe,EAChB,MAAM,8DAA8D,CAAA;AACrE,OAAO,EAEL,cAAc,EAIf,MAAM,yCAAyC,CAAA;;AAUhD,qBAyBa,mCAAoC,YAAW,SAAS,EAAE,MAAM;IAkD/D,OAAO,CAAC,GAAG;IAjDd,OAAO,EAAE,0BAA0B,CAAA;IACnC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,UAAQ;IACjB,UAAU,CAAC,UAAQ;IAClB,SAAS,EAAE,YAAY,CAAC,MAAM,CAAC,CAAqB;IACpD,gBAAgB,EAAE,YAAY,CAAC;QACvC,GAAG,EAAE,MAAM,CAAA;QACX,UAAU,EAAE,MAAM,CAAA;KACnB,CAAC,CAAqB;IAEvB,YAAY,UAAQ;IACpB,gBAAgB,EAAE,eAAe,CAAA;IACjC,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,cAAc,EAAE,GAAG,SAAS,CAAY;IAEhD,eAAe,EAAE;QACf,KAAK,EAAE,MAAM,CAAA;QACb,KAAK,EAAE,eAAe,CAAA;KACvB,EAAE,CA6BF;gBAEmB,GAAG,EAAE,iBAAiB;IAE1C,IAAI,qBAAqB,YAIxB;IAED,WAAW;IAOX,QAAQ;IAMR,oBAAoB,CAAC,GAAG,EAAE,MAAM;IAO1B,iBAAiB,CAAC,GAAG,EAAE,MAAM;IAuBnC,iBAAiB,CAAC,GAAG,EAAE,MAAM;IAI7B,qBAAqB;IAMrB,gBAAgB,CAAC,UAAU,EAAE,MAAM;IAMnC,wBAAwB,IAAI,MAAM;yCArHvB,mCAAmC;2CAAnC,mCAAmC;CA4H/C"}
@@ -7,14 +7,14 @@ type Licence = {
7
7
  };
8
8
  export declare class FormFieldLicenseComponent implements OnInit {
9
9
  label: string;
10
- recordConstraints: Constraint[];
11
- recordConstraintsChange: EventEmitter<Constraint[]>;
10
+ recordLicences: Constraint[];
11
+ recordLicencesChange: EventEmitter<Constraint[]>;
12
+ choices: Licence[];
12
13
  selectedLicence: string;
13
14
  ngOnInit(): void;
14
- get licenceOptions(): Licence[];
15
15
  handleLicenceSelection(licenceValue: string): void;
16
16
  static ɵfac: i0.ɵɵFactoryDeclaration<FormFieldLicenseComponent, never>;
17
- static ɵcmp: i0.ɵɵComponentDeclaration<FormFieldLicenseComponent, "gn-ui-form-field-license", never, { "label": { "alias": "label"; "required": false; }; "recordConstraints": { "alias": "recordConstraints"; "required": false; }; }, { "recordConstraintsChange": "recordConstraintsChange"; }, never, never, true, never>;
17
+ static ɵcmp: i0.ɵɵComponentDeclaration<FormFieldLicenseComponent, "gn-ui-form-field-license", never, { "label": { "alias": "label"; "required": false; }; "recordLicences": { "alias": "recordLicences"; "required": false; }; }, { "recordLicencesChange": "recordLicencesChange"; }, never, never, true, never>;
18
18
  }
19
19
  export {};
20
20
  //# sourceMappingURL=form-field-license.component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"form-field-license.component.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EAEZ,MAAM,EAEP,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,UAAU,EAAE,MAAM,oEAAoE,CAAA;;AAI/F,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,qBAQa,yBAA0B,YAAW,MAAM;IAC7C,KAAK,EAAE,MAAM,CAAA;IACb,iBAAiB,EAAE,UAAU,EAAE,CAAK;IACnC,uBAAuB,EAAE,YAAY,CAAC,UAAU,EAAE,CAAC,CACzC;IAEpB,eAAe,EAAE,MAAM,CAAA;IAEvB,QAAQ,IAAI,IAAI;IAchB,IAAI,cAAc,IAAI,OAAO,EAAE,CAK9B;IAED,sBAAsB,CAAC,YAAY,EAAE,MAAM;yCA7BhC,yBAAyB;2CAAzB,yBAAyB;CAiCrC"}
1
+ {"version":3,"file":"form-field-license.component.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EAEZ,MAAM,EAEP,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,UAAU,EAAE,MAAM,oEAAoE,CAAA;;AAI/F,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,qBAQa,yBAA0B,YAAW,MAAM;IAC7C,KAAK,EAAE,MAAM,CAAA;IACb,cAAc,EAAE,UAAU,EAAE,CAAK;IAChC,oBAAoB,EAAE,YAAY,CAAC,UAAU,EAAE,CAAC,CACtC;IAEpB,OAAO,EAAE,OAAO,EAAE,CAGf;IAEH,eAAe,EAAE,MAAM,CAAA;IAEvB,QAAQ,IAAI,IAAI;IAuBhB,sBAAsB,CAAC,YAAY,EAAE,MAAM;yCApChC,yBAAyB;2CAAzB,yBAAyB;CA6CrC"}
@@ -24,7 +24,7 @@ export declare class FormFieldOnlineResourcesComponent {
24
24
  notLinkResources: OnlineNotLinkResource[];
25
25
  uploadProgress: any;
26
26
  uploadSubscription: Subscription;
27
- newService: Omit<DatasetServiceDistribution, "url">;
27
+ newService: DatasetServiceDistribution;
28
28
  protected MAX_UPLOAD_SIZE_MB: number;
29
29
  constructor(notificationsService: NotificationsService, translateService: TranslateService, platformService: PlatformServiceInterface, cd: ChangeDetectorRef, dialog: MatDialog);
30
30
  onSelectedTypeChange(selectedType: unknown): void;
@@ -1 +1 @@
1
- {"version":3,"file":"form-field-online-resources.component.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,iBAAiB,EAEjB,YAAY,EAGZ,WAAW,EAEZ,MAAM,eAAe,CAAA;A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wB,EACzC,EAAE,EAAE,iBAAiB,EACrB,MAAM,EAAE,SAAS;IAG3B,oBAAoB,CAAC,YAAY,EAAE,OAAO;IAI1C,gBAAgB,CAAC,IAAI,EAAE,IAAI;IAyB3B,kBAAkB;IAOlB,uBAAuB,CAAC,GAAG,EAAE,MAAM;IAcnC,sBAAsB,CAAC,GAAG,EAAE,MAAM;IAUlC,sBAAsB,CAAC,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE;IAUnE,mBAAmB,CACjB,UAAU,EAAE,0BAA0B,EACtC,UAAU,EAAE,0BAA0B;IAOxC,qBAAqB,CAAC,KAAK,EAAE,OAAO,EAAE;IAStC,oBAAoB,CAAC,QAAQ,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM;IAInE,OAAO,CAAC,WAAW;IAoBnB,OAAO,CAAC,cAAc;yCA/JX,iCAAiC;2CAAjC,iCAAiC;CA+L7C"}
1
+ {"version":3,"file":"form-field-online-resources.component.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,iBAAiB,EAEjB,YAAY,EAGZ,WAAW,EAEZ,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAEpD,OAAO,EACL,2BAA2B,EAC3B,0BAA0B,EAC1B,cAAc,EACd,eAAe,EAChB,MAAM,oEAAoE,CAAA;AAC3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,kFAAkF,CAAA;AAC3H,OAAO,EAAE,oBAAoB,EAAE,MAAM,2DAA2D,CAAA;AAChG,OAAO,EAGL,kBAAkB,EAInB,MAAM,+CAA+C,CAAA;AAKtD,OAAO,EAAmB,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;;AAKn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IAStC,oBAAoB,CAAC,QAAQ,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM;IAInE,OAAO,CAAC,WAAW;IAoBnB,OAAO,CAAC,cAAc;yCAhKX,iCAAiC;2CAAjC,iCAAiC;CAgM7C"}
@@ -2,10 +2,11 @@ import * as i0 from "@angular/core";
2
2
  export declare class DataViewShareComponent {
3
3
  protected wcEmbedderBaseUrl: string;
4
4
  private _viewType;
5
+ extraClass: string;
5
6
  set viewType(value: string);
6
7
  get viewType(): string;
7
8
  constructor(wcEmbedderBaseUrl: string);
8
9
  static ɵfac: i0.ɵɵFactoryDeclaration<DataViewShareComponent, [{ optional: true; }]>;
9
- static ɵcmp: i0.ɵɵComponentDeclaration<DataViewShareComponent, "gn-ui-data-view-share", never, { "viewType": { "alias": "viewType"; "required": false; }; }, {}, never, never, true, never>;
10
+ static ɵcmp: i0.ɵɵComponentDeclaration<DataViewShareComponent, "gn-ui-data-view-share", never, { "extraClass": { "alias": "extraClass"; "required": false; }; "viewType": { "alias": "viewType"; "required": false; }; }, {}, never, never, true, never>;
10
11
  }
11
12
  //# sourceMappingURL=data-view-share.component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"data-view-share.component.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/feature/record/src/lib/data-view-share/data-view-share.component.ts"],"names":[],"mappings":";AAgBA,qBAca,sBAAsB;IAc/B,SAAS,CAAC,iBAAiB,EAAE,MAAM;IAbrC,OAAO,CAAC,SAAS,CAAQ;IAEzB,IACI,QAAQ,CAAC,KAAK,EAAE,MAAM,EAEzB;IAED,IAAI,QAAQ,IAAI,MAAM,CAErB;gBAIW,iBAAiB,EAAE,MAAM;yCAd1B,sBAAsB;2CAAtB,sBAAsB;CAgBlC"}
1
+ {"version":3,"file":"data-view-share.component.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/feature/record/src/lib/data-view-share/data-view-share.component.ts"],"names":[],"mappings":";AAgBA,qBAca,sBAAsB;IAe/B,SAAS,CAAC,iBAAiB,EAAE,MAAM;IAdrC,OAAO,CAAC,SAAS,CAAQ;IAChB,UAAU,EAAE,MAAM,CAAA;IAE3B,IACI,QAAQ,CAAC,KAAK,EAAE,MAAM,EAEzB;IAED,IAAI,QAAQ,IAAI,MAAM,CAErB;gBAIW,iBAAiB,EAAE,MAAM;yCAf1B,sBAAsB;2CAAtB,sBAAsB;CAiBlC"}
@@ -8,7 +8,7 @@ export declare class RecordApiFormComponent {
8
8
  offset$: BehaviorSubject<string>;
9
9
  limit$: BehaviorSubject<string>;
10
10
  format$: BehaviorSubject<string>;
11
- endpoint$: BehaviorSubject<WfsEndpoint | OgcApiEndpoint>;
11
+ endpoint$: BehaviorSubject<OgcApiEndpoint | WfsEndpoint>;
12
12
  apiBaseUrl: string;
13
13
  apiFeatureType: string;
14
14
  supportOffset: boolean;
@@ -1,4 +1,4 @@
1
- import { DatasetOnlineResource } from '../../../../../../libs/common/domain/src/lib/model/record';
1
+ import { DatasetOnlineResource, ServiceProtocol } from '../../../../../../libs/common/domain/src/lib/model/record';
2
2
  export declare const FORMATS: {
3
3
  readonly csv: {
4
4
  readonly extensions: readonly ["csv"];
@@ -107,5 +107,6 @@ export declare function mimeTypeToFormat(mimeType: string): FileFormat;
107
107
  export declare function checkFileFormat(link: DatasetOnlineResource, format: FileFormat): boolean;
108
108
  export declare function getBadgeColor(linkFormat: FileFormat): string;
109
109
  export declare function getLinkLabel(link: DatasetOnlineResource): string;
110
+ export declare function getLayers(url: string, serviceProtocol: ServiceProtocol): Promise<any[]>;
110
111
  export declare function getMimeTypeForFormat(format: FileFormat): string | null;
111
112
  //# sourceMappingURL=link-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"link-utils.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/util/shared/src/lib/links/link-utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2DAA2D,CAAA;AAIjG,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;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AG,MAAM,OAAO,OAAO,CAAA;AAE7C,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAUhE;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,qBAAqB,GAAG,MAAM,CAEnE;AAED,wBAAgB,8BAA8B,CAC5C,aAAa,EAAE,MAAM,GACpB,UAAU,GAAG,IAAI,CAgBnB;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,qBAAqB,GAAG,UAAU,CAcrE;AAED,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,qBAAqB,EAC3B,KAAK,EAAE,MAAM,GACZ,OAAO,CAQT;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAO7D;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,qBAAqB,EAC3B,MAAM,EAAE,UAAU,GACjB,OAAO,CAMT;AAED,wBAAgB,aAAa,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAQ5D;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,qBAAqB,GAAG,MAAM,CA0BhE;AAED,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,eAAe,EAAE,eAAe,kBA2B5E;AAcD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAEtE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geonetwork-ui",
3
- "version": "2.4.1-dev.bf3be28aa",
3
+ "version": "2.4.1-dev.e5315d8c8",
4
4
  "engines": {
5
5
  "node": ">=20"
6
6
  },
@@ -43,11 +43,11 @@ export const selectCurrentPage = createSelector(
43
43
  export const selectRecordSections = createSelector(
44
44
  selectEditorState,
45
45
  (state: EditorState) => {
46
- const currentPage = state.editorConfig.pages[state.currentPage]
47
- if (!currentPage) {
46
+ const currentPageConfig = state.editorConfig.pages[state.currentPage]
47
+ if (!currentPageConfig) {
48
48
  return [] as EditorSectionWithValues[]
49
49
  }
50
- return currentPage.sections.map((section) => ({
50
+ return currentPageConfig.sections.map((section) => ({
51
51
  ...section,
52
52
  fieldsWithValues: section.fields.map((fieldConfig) => ({
53
53
  config: fieldConfig,
@@ -17,6 +17,7 @@
17
17
  class="flex flex-row gap-[8px]"
18
18
  [(ngModel)]="service.accessServiceProtocol"
19
19
  [disabled]="disabled"
20
+ (change)="resetLayersSuggestion()"
20
21
  >
21
22
  <mat-radio-button
22
23
  *ngFor="let protocolOption of protocolOptions"
@@ -30,29 +31,59 @@
30
31
  <div class="flex flex-col gap-4">
31
32
  <gn-ui-url-input
32
33
  class="w-full"
33
- (valueChange)="handleUrlChange($event)"
34
+ (uploadClick)="handleUploadClick($event)"
35
+ (valueChange)="handleUrlValueChange($event)"
34
36
  [disabled]="disabled"
35
37
  [value]="url"
36
- [showValidateButton]="false"
38
+ [showValidateButton]="activeLayerSuggestion"
37
39
  >
38
- <ng-icon name="iconoirCloudUpload"></ng-icon>
40
+ <ng-content *ngIf="activeLayerSuggestion">
41
+ <ng-icon name="iconoirCloudUpload"></ng-icon>
42
+ </ng-content>
39
43
  </gn-ui-url-input>
40
44
 
45
+ <p class="text-sm text-red-500 pl-4" *ngIf="errorMessage" translate>
46
+ editor.record.form.field.onlineResource.edit.identifier.error
47
+ </p>
48
+
41
49
  <gn-ui-text-input
42
50
  class="grow border-b border-gray-300 pb-4"
43
51
  [(value)]="service.identifierInService"
44
52
  [placeholder]="getIdentifierPlaceholder() | translate"
45
53
  data-cy="identifier-in-service"
46
54
  [disabled]="disabled"
55
+ *ngIf="
56
+ !activeLayerSuggestion ||
57
+ (url && errorMessage) ||
58
+ (modifyMode && layers === undefined)
59
+ "
47
60
  ></gn-ui-text-input>
48
-
61
+ <gn-ui-dropdown-selector
62
+ class="border-b border-gray-300 pb-4"
63
+ [showTitle]="false"
64
+ [title]="
65
+ 'editor.record.form.field.onlineResource.edit.identifier.select.label'
66
+ | translate
67
+ "
68
+ [choices]="layers || []"
69
+ *ngIf="activeLayerSuggestion && layers !== undefined"
70
+ [selected]="service.identifierInService"
71
+ (selectValue)="handleSelectValue($event)"
72
+ >
73
+ </gn-ui-dropdown-selector>
49
74
  <gn-ui-button
50
75
  (buttonClick)="submitIdentifier(service.identifierInService)"
51
- [disabled]="disabled || !service.identifierInService || !url"
76
+ [disabled]="disabled || !service.identifierInService"
52
77
  type="primary"
78
+ *ngIf="
79
+ !modifyMode &&
80
+ ((activeLayerSuggestion && layers) ||
81
+ !activeLayerSuggestion ||
82
+ (url && errorMessage))
83
+ "
53
84
  >
54
- <span class="text-white font-bold" translate
55
- >editor.record.form.field.onlineResource.edit.identifier.submit</span
85
+ <span class="text-white font-bold" translate>
86
+ editor.record.form.field.onlineResource.edit.identifier.submit</span
56
87
  >
57
88
  </gn-ui-button>
58
89
  </div>
@@ -1,10 +1,12 @@
1
1
  import { CommonModule } from '@angular/common'
2
2
  import {
3
3
  ChangeDetectionStrategy,
4
+ ChangeDetectorRef,
4
5
  Component,
5
6
  EventEmitter,
6
7
  Input,
7
8
  OnChanges,
9
+ OnInit,
8
10
  Output,
9
11
  } from '@angular/core'
10
12
  import { FormsModule } from '@angular/forms'
@@ -17,6 +19,8 @@ import {
17
19
  } from '../../../../../../../libs/common/domain/src/lib/model/record'
18
20
  import {
19
21
  ButtonComponent,
22
+ DropdownChoice,
23
+ DropdownSelectorComponent,
20
24
  TextInputComponent,
21
25
  UrlInputComponent,
22
26
  } from '../../../../../../../libs/ui/inputs/src'
@@ -27,6 +31,7 @@ import {
27
31
  provideNgIconsConfig,
28
32
  } from '@ng-icons/core'
29
33
  import { iconoirCloudUpload } from '@ng-icons/iconoir'
34
+ import { getLayers } from '../../../../../../../libs/util/shared/src'
30
35
 
31
36
  @Component({
32
37
  selector: 'gn-ui-online-service-resource-input',
@@ -35,6 +40,7 @@ import { iconoirCloudUpload } from '@ng-icons/iconoir'
35
40
  changeDetection: ChangeDetectionStrategy.OnPush,
36
41
  standalone: true,
37
42
  imports: [
43
+ DropdownSelectorComponent,
38
44
  ButtonComponent,
39
45
  CommonModule,
40
46
  FormsModule,
@@ -52,18 +58,21 @@ import { iconoirCloudUpload } from '@ng-icons/iconoir'
52
58
  }),
53
59
  ],
54
60
  })
55
- export class OnlineServiceResourceInputComponent implements OnChanges {
56
- @Input() service: Omit<DatasetServiceDistribution, 'url'>
61
+ export class OnlineServiceResourceInputComponent implements OnChanges, OnInit {
62
+ @Input() service: DatasetServiceDistribution
57
63
  @Input() protocolHint?: string
58
64
  @Input() disabled? = false
65
+ @Input() modifyMode? = false
59
66
  @Output() urlChange: EventEmitter<string> = new EventEmitter()
60
67
  @Output() identifierSubmit: EventEmitter<{
61
68
  url: string
62
69
  identifier: string
63
70
  }> = new EventEmitter()
64
71
 
72
+ errorMessage = false
65
73
  selectedProtocol: ServiceProtocol
66
74
  url: string
75
+ layers: DropdownChoice[] | undefined = undefined
67
76
 
68
77
  protocolOptions: {
69
78
  label: string
@@ -99,6 +108,14 @@ export class OnlineServiceResourceInputComponent implements OnChanges {
99
108
  },
100
109
  ]
101
110
 
111
+ constructor(private cdr: ChangeDetectorRef) {}
112
+
113
+ get activeLayerSuggestion() {
114
+ return !['wps', 'GPFDL', 'esriRest', 'other'].includes(
115
+ this.service.accessServiceProtocol
116
+ )
117
+ }
118
+
102
119
  ngOnChanges() {
103
120
  this.selectedProtocol =
104
121
  this.protocolOptions.find(
@@ -106,8 +123,50 @@ export class OnlineServiceResourceInputComponent implements OnChanges {
106
123
  )?.value ?? 'other'
107
124
  }
108
125
 
109
- handleUrlChange(url: string) {
126
+ ngOnInit() {
127
+ if (this.service.url) {
128
+ this.url = this.service.url.toString()
129
+ }
130
+ }
131
+
132
+ handleUrlValueChange(url: string) {
133
+ this.url = url
134
+ this.service.url = new URL(url)
135
+ this.resetLayersSuggestion()
136
+ this.urlChange.emit(this.url)
137
+ }
138
+
139
+ async handleUploadClick(url: string) {
110
140
  this.url = url
141
+
142
+ try {
143
+ const layers = await getLayers(url, this.service.accessServiceProtocol)
144
+ this.layers = layers.map((l) => {
145
+ return {
146
+ label: l.title ? `${l.title} ${l.name ? `(${l.name})` : ''}` : l.name,
147
+ value: l.name || l.title,
148
+ }
149
+ })
150
+
151
+ if (this.layers.length === 0) {
152
+ throw new Error('No layers found')
153
+ }
154
+ } catch (e) {
155
+ this.errorMessage = true
156
+ this.layers = undefined
157
+ }
158
+
159
+ this.cdr.detectChanges()
160
+ }
161
+
162
+ handleSelectValue(val: string) {
163
+ this.service.identifierInService = val
164
+ }
165
+
166
+ resetLayersSuggestion() {
167
+ this.errorMessage = false
168
+ this.layers = undefined
169
+ this.service.identifierInService = null
111
170
  }
112
171
 
113
172
  submitIdentifier(identifier: string) {
@@ -2,7 +2,7 @@
2
2
  <gn-ui-dropdown-selector
3
3
  [title]="label"
4
4
  [showTitle]="false"
5
- [choices]="licenceOptions"
5
+ [choices]="choices"
6
6
  [selected]="selectedLicence"
7
7
  (selectValue)="handleLicenceSelection($event)"
8
8
  [extraBtnClass]="'input-as-button gn-ui-text-input'"
@@ -26,35 +26,47 @@ type Licence = {
26
26
  })
27
27
  export class FormFieldLicenseComponent implements OnInit {
28
28
  @Input() label: string
29
- @Input() recordConstraints: Constraint[] = []
30
- @Output() recordConstraintsChange: EventEmitter<Constraint[]> =
29
+ @Input() recordLicences: Constraint[] = []
30
+ @Output() recordLicencesChange: EventEmitter<Constraint[]> =
31
31
  new EventEmitter()
32
32
 
33
+ choices: Licence[] = AVAILABLE_LICENSES.map((license) => ({
34
+ label: marker(`editor.record.form.license.${license}`),
35
+ value: license,
36
+ }))
37
+
33
38
  selectedLicence: string
34
39
 
35
40
  ngOnInit(): void {
36
- // get the licence from the record constraints if it is one of the open data licence list
37
- this.selectedLicence = this.recordConstraints.find((constraint) => {
38
- return this.licenceOptions.find((licence) => {
39
- return licence.value === constraint.text
40
- })
41
- })?.text
42
- // otherwise pre-select the first licence option
43
- if (this.selectedLicence === undefined) {
44
- this.selectedLicence = this.licenceOptions[0].value // cannot select 'etalab' as default as this would toggle the OpenData Toggle
45
- this.recordConstraintsChange.emit([{ text: this.selectedLicence }])
41
+ if (this.recordLicences.length === 0) {
42
+ this.selectedLicence = 'unknown'
43
+ } else {
44
+ this.selectedLicence = this.recordLicences.find((constraint) => {
45
+ return this.choices.find((licence) => {
46
+ return licence.value === constraint.text
47
+ })
48
+ })?.text
46
49
  }
47
- }
48
50
 
49
- get licenceOptions(): Licence[] {
50
- return AVAILABLE_LICENSES.map((license) => ({
51
- label: marker(`editor.record.form.license.${license}`),
52
- value: license,
53
- }))
51
+ if (this.selectedLicence === undefined) {
52
+ this.choices = [
53
+ {
54
+ value: this.recordLicences[0].text,
55
+ label: this.recordLicences[0].text,
56
+ },
57
+ ...this.choices,
58
+ ]
59
+ this.selectedLicence = this.recordLicences[0].text
60
+ }
54
61
  }
55
62
 
56
63
  handleLicenceSelection(licenceValue: string) {
57
64
  this.selectedLicence = licenceValue
58
- this.recordConstraintsChange.emit([{ text: licenceValue }])
65
+ if (licenceValue === 'unknown') {
66
+ this.recordLicencesChange.emit([])
67
+ return
68
+ } else {
69
+ this.recordLicencesChange.emit([{ text: licenceValue }])
70
+ }
59
71
  }
60
72
  }
@@ -21,7 +21,6 @@
21
21
  <gn-ui-online-service-resource-input
22
22
  [service]="newService"
23
23
  [disabled]="disabled$ | async"
24
- (urlChange)="handleServiceUrlChange($event)"
25
24
  (identifierSubmit)="handleIdentifierSubmit($event)"
26
25
  ></gn-ui-online-service-resource-input>
27
26
  </div>
@@ -55,19 +54,22 @@
55
54
  [(value)]="onlineResource.description"
56
55
  ></gn-ui-text-area>
57
56
  </div>
58
- <ng-container *ngIf="onlineResource.type === 'service'">
57
+ <ng-container *ngIf="onlineResource.type === 'service'; else urlInput">
59
58
  <span class="w-full border-b border-gray-300"></span>
60
59
  <gn-ui-online-service-resource-input
61
60
  [service]="onlineResource"
61
+ [modifyMode]="true"
62
62
  ></gn-ui-online-service-resource-input>
63
63
  </ng-container>
64
- <span class="w-full border-b border-gray-300"></span>
65
- <gn-ui-url-input
66
- class="w-full"
67
- [disabled]="true"
68
- [value]="onlineResource.url"
69
- [showValidateButton]="false"
70
- ></gn-ui-url-input>
64
+ <ng-template #urlInput>
65
+ <span class="w-full border-b border-gray-300"></span>
66
+ <gn-ui-url-input
67
+ class="w-full"
68
+ [disabled]="true"
69
+ [value]="onlineResource.url"
70
+ [showValidateButton]="false"
71
+ ></gn-ui-url-input>
72
+ </ng-template>
71
73
  </div>
72
74
  </ng-template>
73
75
  </div>
@@ -92,11 +92,12 @@ export class FormFieldOnlineResourcesComponent {
92
92
  notLinkResources: OnlineNotLinkResource[] = []
93
93
  uploadProgress = undefined
94
94
  uploadSubscription: Subscription = null
95
- newService = {
95
+ newService = <DatasetServiceDistribution>{
96
96
  type: 'service',
97
97
  accessServiceProtocol: 'ogcFeatures',
98
98
  identifierInService: '',
99
- } as Omit<DatasetServiceDistribution, 'url'>
99
+ url: undefined,
100
+ }
100
101
 
101
102
  protected MAX_UPLOAD_SIZE_MB = MAX_UPLOAD_SIZE_MB
102
103
 
@@ -112,8 +112,8 @@
112
112
  <ng-container *ngSwitchCase="'licenses'">
113
113
  <gn-ui-form-field-license
114
114
  [label]="config.labelKey! | translate"
115
- [recordConstraints]="valueAsConstraints"
116
- (recordConstraintsChange)="valueChange.emit($event)"
115
+ [recordLicences]="valueAsConstraints"
116
+ (recordLicencesChange)="valueChange.emit($event)"
117
117
  ></gn-ui-form-field-license>
118
118
  </ng-container>
119
119
 
@@ -1,4 +1,4 @@
1
- <div class="container-lg px-5 my-1 lg:mx-auto">
1
+ <div class="px-5 my-1" [ngClass]="extraClass">
2
2
  <mat-tab-group
3
3
  [selectedIndex]="0"
4
4
  animationDuration="0ms"
@@ -30,6 +30,7 @@ import { TranslateModule } from '@ngx-translate/core'
30
30
  })
31
31
  export class DataViewShareComponent {
32
32
  private _viewType: string
33
+ @Input() extraClass: string
33
34
 
34
35
  @Input()
35
36
  set viewType(value: string) {
@@ -1,5 +1,14 @@
1
1
  import { marker } from '@biesbjerg/ngx-translate-extract-marker'
2
- import { DatasetOnlineResource } from '../../../../../../libs/common/domain/src/lib/model/record'
2
+ import {
3
+ DatasetOnlineResource,
4
+ ServiceProtocol,
5
+ } from '../../../../../../libs/common/domain/src/lib/model/record'
6
+ import {
7
+ OgcApiEndpoint,
8
+ WfsEndpoint,
9
+ WmsEndpoint,
10
+ WmtsEndpoint,
11
+ } from '@camptocamp/ogc-client'
3
12
 
4
13
  marker('downloads.wfs.featuretype.not.found')
5
14
 
@@ -242,6 +251,47 @@ export function getLinkLabel(link: DatasetOnlineResource): string {
242
251
  return format ? `${label} (${format})` : label
243
252
  }
244
253
 
254
+ export async function getLayers(url: string, serviceProtocol: ServiceProtocol) {
255
+ switch (serviceProtocol) {
256
+ case 'ogcFeatures': {
257
+ const layers = await new OgcApiEndpoint(url).allCollections
258
+ return layers
259
+ }
260
+ case 'wfs': {
261
+ const endpointWfs = new WfsEndpoint(url)
262
+ await endpointWfs.isReady()
263
+ return endpointWfs.getFeatureTypes()
264
+ }
265
+ case 'wms': {
266
+ const endpointWms = new WmsEndpoint(url)
267
+ await endpointWms.isReady()
268
+ return endpointWms
269
+ .getLayers()
270
+ .flatMap(wmsLayerFlatten)
271
+ .filter((l) => l.name)
272
+ }
273
+ case 'wmts': {
274
+ const endpointWmts = new WmtsEndpoint(url)
275
+ await endpointWmts.isReady()
276
+ return endpointWmts.getLayers()
277
+ }
278
+ default:
279
+ return undefined
280
+ }
281
+ }
282
+
283
+ function wmsLayerFlatten(layerFull) {
284
+ const layer = {
285
+ title: layerFull.title,
286
+ name: layerFull.name,
287
+ abstract: layerFull.abstract,
288
+ }
289
+
290
+ return 'children' in layerFull && Array.isArray(layerFull.children)
291
+ ? [layer, ...layerFull.children.flatMap(wmsLayerFlatten)]
292
+ : [layer]
293
+ }
294
+
245
295
  export function getMimeTypeForFormat(format: FileFormat): string | null {
246
296
  return format in FORMATS ? FORMATS[format.toLowerCase()].mimeTypes[0] : null
247
297
  }
@@ -238,8 +238,10 @@
238
238
  "editor.record.form.field.onlineResource.dialogTitle": "",
239
239
  "editor.record.form.field.onlineResource.edit.description": "",
240
240
  "editor.record.form.field.onlineResource.edit.protocol": "",
241
+ "editor.record.form.field.onlineResource.edit.identifier.error": "Schichten konnten nicht vom Protokoll abgerufen werden",
241
242
  "editor.record.form.field.onlineResource.edit.identifier.placeholder": "Ebenenname",
242
243
  "editor.record.form.field.onlineResource.edit.identifier.placeholder.wps": "Prozessname",
244
+ "editor.record.form.field.onlineResource.edit.identifier.select.label": "Wählen Sie eine Ebene",
243
245
  "editor.record.form.field.onlineResource.edit.identifier.submit": "Link zum Dienst",
244
246
  "editor.record.form.field.onlineResource.edit.title": "",
245
247
  "editor.record.form.field.onlineResource.fileSize": "",
@@ -238,8 +238,10 @@
238
238
  "editor.record.form.field.onlineResource.dialogTitle": "Modify the dataset preview",
239
239
  "editor.record.form.field.onlineResource.edit.description": "Description",
240
240
  "editor.record.form.field.onlineResource.edit.protocol": "Protocol",
241
+ "editor.record.form.field.onlineResource.edit.identifier.error": "Unable to retrieve layers from protocol",
241
242
  "editor.record.form.field.onlineResource.edit.identifier.placeholder": "Layer name",
242
243
  "editor.record.form.field.onlineResource.edit.identifier.placeholder.wps": "Process name",
244
+ "editor.record.form.field.onlineResource.edit.identifier.select.label": "Select a layer",
243
245
  "editor.record.form.field.onlineResource.edit.identifier.submit": "Link to the service",
244
246
  "editor.record.form.field.onlineResource.edit.title": "Title",
245
247
  "editor.record.form.field.onlineResource.fileSize": "{sizeMB}MB",