Skip to content

Commit c44a66c

Browse files
Add service associated resource. Fix add link from service distribution section. (geonetwork#8958)
* Add service associated resource. Fix add link from service distribution section. The online resource added to the dataset contained the text 'undefined' instead of the service online resource name * Editor / Add service / When selecting layers, button was inactive The link added to the dataset should contains the list of layers selected. Exception was swallowed ``` TypeError: Cannot read properties of undefined (reading 'addLayerNamesMode') at setLayersParams (OnlineSrcService.js:141:35) at setParams (OnlineSrcService.js:112:16) at Object.linkToService (OnlineSrcService.js:551:25) at scope.linkTo (OnlineSrcDirective.js:2083:40) at fn (eval at compile (angular.js?v=293b1dbf3aae48af97080e26810e1eee152c7821:16548:15), <anonymous>:4:256) at callback (UtilityDirective.js:1831:24) at HTMLButtonElement.<anonymous> (UtilityDirective.js:1838:17) at HTMLButtonElement.dispatch (jquery-3.7.1.js?v=293b1dbf3aae48af97080e26810e1eee152c7821:5149:35) at elemData.handle (jquery-3.7.1.js?v=293b1dbf3aae48af97080e26810e1eee152c7821:4953:35) ``` Related to geonetwork@3072280 * Update check to add service metadata layers as online resource --------- Co-authored-by: François Prunayre <fx.prunayre@gmail.com>
1 parent 860b0ed commit c44a66c

2 files changed

Lines changed: 13 additions & 8 deletions

File tree

web-ui/src/main/resources/catalog/components/edit/onlinesrc/OnlineSrcDirective.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2030,6 +2030,7 @@
20302030
scope.srcParams.remote = false;
20312031
if (links.length > 0) {
20322032
scope.onlineSrcLink = links[0].url;
2033+
scope.srcParams.name = links[0].name || "";
20332034
scope.srcParams.protocol = links[0].protocol || "OGC:WMS";
20342035
scope.loadCurrentLink(scope.onlineSrcLink);
20352036
scope.srcParams.url = scope.onlineSrcLink;

web-ui/src/main/resources/catalog/components/edit/onlinesrc/OnlineSrcService.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,19 @@
170170

171171
var addLayersInUrl = params.addLayersInUrl;
172172

173-
if (addLayersInUrl != "" && params.protocol.indexOf("OGC:WMS") >= 0) {
174-
params.url = gnUrlUtils.remove(params.url, [addLayersInUrl], true);
175-
params.url = gnUrlUtils.append(
176-
params.url,
177-
addLayersInUrl + "=" + names.join(",")
178-
);
179-
}
173+
if (addLayersInUrl != undefined && addLayersInUrl != "") {
174+
// Add layers in the resource URL
175+
176+
if (params.protocol.indexOf("OGC:WMS") >= 0) {
177+
params.url = gnUrlUtils.remove(params.url, [addLayersInUrl], true);
178+
params.url = gnUrlUtils.append(
179+
params.url,
180+
addLayersInUrl + "=" + names.join(",")
181+
);
182+
}
183+
} else {
184+
// Add layers in resource name
180185

181-
if (params.wmsResources.addLayerNamesMode == "resourcename") {
182186
angular.extend(params, {
183187
name: names.join(",")
184188
});

0 commit comments

Comments
 (0)