From 10137eb4bb3e1c9178b4bede4855f2f70c5f9e12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Garc=C3=ADa?= Date: Mon, 22 Jan 2024 11:50:45 +0100 Subject: [PATCH] Metadata editor / Fix javascript error in the add thumbnail option when the metadata has 1 WMS layer: Error: [orderBy:notarray] http://errors.angularjs.org/1.8.2/orderBy/notarray\?p0\=%7B%22resource%22%3A%7B%22ref%22%3A%22172%22%2C%22refParent%22%3A%22171%22%2C%22name%22%3A%222%22%2C%22url%22%3A%22https%3A%2F%2Fmaps-cartes.ec.gc.ca%2Farcgis%2Fservices%2FDMS%2FStressCumulatifLittorales%2FMapServer%2FWMSServer%3Frequest%3DGetCapabilities%26service%3DWMS%22%2C%22title%22%3A%22Metadata%20WMS%20layer%22%2C%22abstract%22%3A%22The%20ISO19115%20metadata%20standard%20is%20the%20preferred%20metadata%20standard%20to%20use.%20If%20unsure%20what%20templates%20to%20start%20with%2C%20use%20this%20one.%22%2C%22protocol%22%3A%22OGC%3AWMS%22%7D%7D at lib.js?v=65b94734a63ca8491dba95d7439baf1be02c2450:21:168 --- .../components/edit/onlinesrc/OnlineSrcDirective.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/web-ui/src/main/resources/catalog/components/edit/onlinesrc/OnlineSrcDirective.js b/web-ui/src/main/resources/catalog/components/edit/onlinesrc/OnlineSrcDirective.js index ec8b4098706..a2bb60fb980 100644 --- a/web-ui/src/main/resources/catalog/components/edit/onlinesrc/OnlineSrcDirective.js +++ b/web-ui/src/main/resources/catalog/components/edit/onlinesrc/OnlineSrcDirective.js @@ -678,7 +678,13 @@ // }); // } // Add each WMS layer to the map - scope.layers = scope.gnCurrentEdit.layerConfig; + if (scope.gnCurrentEdit.layerConfig == undefined) { + scope.layers = scope.gnCurrentEdit.layerConfig; + } else { + scope.layers = Array.isArray(scope.gnCurrentEdit.layerConfig) + ? scope.gnCurrentEdit.layerConfig + : [scope.gnCurrentEdit.layerConfig]; + } angular.forEach(scope.gnCurrentEdit.layerConfig, function (layer) { scope.map.addLayer( new ol.layer.Tile({