geonetwork-ui 2.4.1-dev.a1ec7cf5a → 2.4.1-dev.a28bdabc1
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/online-service-resource-input/online-service-resource-input.component.mjs +57 -10
- package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.mjs +4 -3
- package/esm2022/libs/util/shared/src/lib/links/link-utils.mjs +40 -1
- package/esm2022/translations/de.json +2 -0
- package/esm2022/translations/en.json +2 -0
- package/esm2022/translations/es.json +2 -0
- package/esm2022/translations/fr.json +2 -0
- package/esm2022/translations/it.json +2 -0
- package/esm2022/translations/nl.json +2 -0
- package/esm2022/translations/pt.json +2 -0
- package/fesm2022/geonetwork-ui.mjs +110 -11
- 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 -5
- package/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.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 +1 -1
- 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
- package/libs/ui/elements/src/lib/record-api-form/record-api-form.component.d.ts +1 -1
- package/libs/util/shared/src/lib/links/link-utils.d.ts +2 -1
- package/libs/util/shared/src/lib/links/link-utils.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.html +38 -7
- package/src/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.ts +62 -3
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.html +11 -9
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.ts +3 -2
- package/src/libs/util/shared/src/lib/links/link-utils.ts +51 -1
- package/translations/de.json +2 -0
- package/translations/en.json +2 -0
- package/translations/es.json +2 -0
- package/translations/fr.json +2 -0
- package/translations/it.json +2 -0
- package/translations/nl.json +2 -0
- package/translations/pt.json +2 -0
- 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
|
-
|
|
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
|
-
|
|
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,
|
|
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,
|
|
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"}
|
|
@@ -24,7 +24,7 @@ export declare class FormFieldOnlineResourcesComponent {
|
|
|
24
24
|
notLinkResources: OnlineNotLinkResource[];
|
|
25
25
|
uploadProgress: any;
|
|
26
26
|
uploadSubscription: Subscription;
|
|
27
|
-
newService:
|
|
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;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;;AAKnC,KAAK,qBAAqB,GACtB,2BAA2B,GAC3B,0BAA0B,GAC1B,eAAe,CAAA;AAEnB,qBAmBa,iCAAiC;
|
|
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;;AAKnC,KAAK,qBAAqB,GACtB,2BAA2B,GAC3B,0BAA0B,GAC1B,eAAe,CAAA;AAEnB,qBAmBa,iCAAiC;IAyC1C,OAAO,CAAC,oBAAoB;IAC5B,OAAO,CAAC,gBAAgB;IACxB,OAAO,CAAC,eAAe;IACvB,OAAO,CAAC,EAAE;IACV,OAAO,CAAC,MAAM;IA5CP,YAAY,EAAE,MAAM,CAAA;IAC7B,IAAa,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,cAAc,CAAC,EAKxD;IACS,WAAW,EAAE,YAAY,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CACtC;IAES,cAAc,EAAE,WAAW,CAAC,cAAc,CAAC,CAAA;IAExE,WAAW,EAAE,kBAAkB,EAAE,CAWhC;IACD,YAAY,EAAE,UAAU,GAAG,SAAS,CAAa;IAEjD,OAAO,CAAC,YAAY,CAAuB;IAC3C,gBAAgB,EAAE,qBAAqB,EAAE,CAAK;IAC9C,cAAc,MAAY;IAC1B,kBAAkB,EAAE,YAAY,CAAO;IACvC,UAAU,EAAI,0BAA0B,CAKvC;IAED,SAAS,CAAC,kBAAkB,SAAqB;gBAGvC,oBAAoB,EAAE,oBAAoB,EAC1C,gBAAgB,EAAE,gBAAgB,EAClC,eAAe,EAAE,wBAAwB,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;yCAhKX,iCAAiC;2CAAjC,iCAAiC;CAgM7C"}
|
|
@@ -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<
|
|
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,
|
|
1
|
+
{"version":3,"file":"link-utils.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/util/shared/src/lib/links/link-utils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,EACrB,eAAe,EAChB,MAAM,2DAA2D,CAAA;AAUlE,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgHV,CAAA;AAEV,MAAM,MAAM,UAAU,GAAG,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
|
@@ -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
|
-
(
|
|
34
|
+
(uploadClick)="handleUploadClick($event)"
|
|
35
|
+
(valueChange)="handleUrlValueChange($event)"
|
|
34
36
|
[disabled]="disabled"
|
|
35
37
|
[value]="url"
|
|
36
|
-
[showValidateButton]="
|
|
38
|
+
[showValidateButton]="activeLayerSuggestion"
|
|
37
39
|
>
|
|
38
|
-
<ng-
|
|
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
|
|
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
|
-
|
|
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:
|
|
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
|
-
|
|
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) {
|
|
@@ -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
|
-
<
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
|
|
99
|
+
url: undefined,
|
|
100
|
+
}
|
|
100
101
|
|
|
101
102
|
protected MAX_UPLOAD_SIZE_MB = MAX_UPLOAD_SIZE_MB
|
|
102
103
|
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { marker } from '@biesbjerg/ngx-translate-extract-marker'
|
|
2
|
-
import {
|
|
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
|
}
|
package/translations/de.json
CHANGED
|
@@ -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": "",
|
package/translations/en.json
CHANGED
|
@@ -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",
|
package/translations/es.json
CHANGED
|
@@ -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": "No se pueden recuperar las capas del protocolo",
|
|
241
242
|
"editor.record.form.field.onlineResource.edit.identifier.placeholder": "Nombre de la capa",
|
|
242
243
|
"editor.record.form.field.onlineResource.edit.identifier.placeholder.wps": "Nombre del proceso",
|
|
244
|
+
"editor.record.form.field.onlineResource.edit.identifier.select.label": "Selecciona una capa",
|
|
243
245
|
"editor.record.form.field.onlineResource.edit.identifier.submit": "Enlace al servicio",
|
|
244
246
|
"editor.record.form.field.onlineResource.edit.title": "",
|
|
245
247
|
"editor.record.form.field.onlineResource.fileSize": "",
|
package/translations/fr.json
CHANGED
|
@@ -238,8 +238,10 @@
|
|
|
238
238
|
"editor.record.form.field.onlineResource.dialogTitle": "Modifier l'aperçu du jeu de données",
|
|
239
239
|
"editor.record.form.field.onlineResource.edit.description": "Description",
|
|
240
240
|
"editor.record.form.field.onlineResource.edit.protocol": "Protocole",
|
|
241
|
+
"editor.record.form.field.onlineResource.edit.identifier.error": "Impossible de récupérer les couches depuis le protocole",
|
|
241
242
|
"editor.record.form.field.onlineResource.edit.identifier.placeholder": "Nom de la couche",
|
|
242
243
|
"editor.record.form.field.onlineResource.edit.identifier.placeholder.wps": "Nom du processus",
|
|
244
|
+
"editor.record.form.field.onlineResource.edit.identifier.select.label": "Sélectionner une couche",
|
|
243
245
|
"editor.record.form.field.onlineResource.edit.identifier.submit": "Lier le service",
|
|
244
246
|
"editor.record.form.field.onlineResource.edit.title": "Titre",
|
|
245
247
|
"editor.record.form.field.onlineResource.fileSize": "{sizeMB} Mo",
|
package/translations/it.json
CHANGED
|
@@ -232,8 +232,10 @@
|
|
|
232
232
|
"editor.record.form.field.keywords": "Parole chiave",
|
|
233
233
|
"editor.record.form.field.legalConstraints": "Vincolo legale",
|
|
234
234
|
"editor.record.form.field.license": "Licenza",
|
|
235
|
+
"editor.record.form.field.onlineResource.edit.identifier.error": "Impossibile recuperare i livelli dal protocollo",
|
|
235
236
|
"editor.record.form.field.onlineResource.edit.identifier.placeholder": "Nome del livello",
|
|
236
237
|
"editor.record.form.field.onlineResource.edit.identifier.placeholder.wps": "Nome del processo",
|
|
238
|
+
"editor.record.form.field.onlineResource.edit.identifier.select.label": "Seleziona un livello",
|
|
237
239
|
"editor.record.form.field.onlineResource.edit.identifier.submit": "Collegare il servizio",
|
|
238
240
|
"editor.record.form.field.title.placeholder": "Inserisci un titolo",
|
|
239
241
|
"editor.record.form.field.onlineLinkResources": "Risorse allegate",
|
package/translations/nl.json
CHANGED
|
@@ -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": "Kan lagen niet ophalen van het protocol",
|
|
241
242
|
"editor.record.form.field.onlineResource.edit.identifier.placeholder": "Laagnaam",
|
|
242
243
|
"editor.record.form.field.onlineResource.edit.identifier.placeholder.wps": "Procesnaam",
|
|
244
|
+
"editor.record.form.field.onlineResource.edit.identifier.select.label": "Selecteer een laag",
|
|
243
245
|
"editor.record.form.field.onlineResource.edit.identifier.submit": "Link naar de dienst",
|
|
244
246
|
"editor.record.form.field.onlineResource.edit.title": "",
|
|
245
247
|
"editor.record.form.field.onlineResource.fileSize": "",
|
package/translations/pt.json
CHANGED
|
@@ -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": "Não é possível recuperar camadas do protocolo",
|
|
241
242
|
"editor.record.form.field.onlineResource.edit.identifier.placeholder": "Nome da camada",
|
|
242
243
|
"editor.record.form.field.onlineResource.edit.identifier.placeholder.wps": "Nome do processo",
|
|
244
|
+
"editor.record.form.field.onlineResource.edit.identifier.select.label": "Selecione uma camada",
|
|
243
245
|
"editor.record.form.field.onlineResource.edit.identifier.submit": "Link para o serviço",
|
|
244
246
|
"editor.record.form.field.onlineResource.edit.title": "",
|
|
245
247
|
"editor.record.form.field.onlineResource.fileSize": "",
|
package/translations/sk.json
CHANGED
|
@@ -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": "Nie je možné načítať vrstvy z protokolu",
|
|
241
242
|
"editor.record.form.field.onlineResource.edit.identifier.placeholder": "Názov vrstvy",
|
|
242
243
|
"editor.record.form.field.onlineResource.edit.identifier.placeholder.wps": "Názov procesu",
|
|
244
|
+
"editor.record.form.field.onlineResource.edit.identifier.select.label": "Vyberte vrstvu",
|
|
243
245
|
"editor.record.form.field.onlineResource.edit.identifier.submit": "Odkaz na službu",
|
|
244
246
|
"editor.record.form.field.onlineResource.edit.title": "",
|
|
245
247
|
"editor.record.form.field.onlineResource.fileSize": "",
|