Skip to content

Commit

Permalink
[Backport 4.2.x] Metadata editor / Fix javascript error in the add th…
Browse files Browse the repository at this point in the history
…umbnail option when the metadata has 1 WMS layer (geonetwork#7684)

* 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

* Metadata editor / Improve layer configuration init. (#96)

* Metadata editor / Improve layer configuration init.

Related to geonetwork#7646.

* Metadata editor / Improve layer configuration init.

* Metadata editor / Remove log.

---------

Co-authored-by: Jose García <[email protected]>
Co-authored-by: François Prunayre <[email protected]>
  • Loading branch information
3 people authored Feb 1, 2024
1 parent 5a9880e commit 46281e9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,6 @@
// });
// }
// Add each WMS layer to the map
scope.layers = scope.gnCurrentEdit.layerConfig;
angular.forEach(scope.gnCurrentEdit.layerConfig, function (layer) {
scope.map.addLayer(
new ol.layer.Tile({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -531,23 +531,15 @@ <h5>
<div
id="gn-addonlinesrc-thumbnail-panel"
class="panel panel-default"
data-ng-show="params.linkType.sources.thumbnailMaker"
data-ng-show="params.linkType.sources.thumbnailMaker && gnCurrentEdit.layerConfig.length > 0"
>
<div class="panel-heading" data-translate="">createAThumbnail</div>
<div class="panel-body">
<div
id="gn-addonlinesrc-thumbnail-map"
class="form-group gn-thumbnail-maker-panel"
>
<div
id="gn-addonlinesrc-thumbnail-warning"
class="alert alert-warning"
data-ng-show="layers == undefined"
data-translate=""
>
noLayersForThumbnail
</div>
<div data-ng-hide="layers == undefined">
<div>
<textarea
id="gn-addonlinesrc-thumbnail-json"
class="form-control hidden"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,13 @@
.val();
};

// The list of layers in a record is defined in XSL template get-online-source-config
// and is depending on each schema. If emtpy an empty array is set.
var getLayerConfiguration = function () {
var configuration = angular.fromJson(getInputValue("layerConfig")) || [];
return Array.isArray(configuration) ? configuration : [configuration.resource];
};

var extent = [],
value = getInputValue("extent");
try {
Expand Down Expand Up @@ -424,7 +431,7 @@
extent: extent,
dataFormats: dataFormats,
isMinor: getInputValue("minor") === "true",
layerConfig: angular.fromJson(getInputValue("layerConfig")),
layerConfig: getLayerConfiguration(),
saving: false
});

Expand Down
1 change: 0 additions & 1 deletion web-ui/src/main/resources/catalog/locales/en-editor.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@
"generateThumbnail": "Generate thumbnail",
"generateThumbnail-help": "Thumbnail will be created and saved in the filestore. Use the filestore to add the thumbnail in the metadata record.",
"createAThumbnail": "Generate thumbnail using the view service",
"noLayersForThumbnail": "No layer defined in record to generate thumbnail from",
"noTemplatesAvailable": "Warning! There is no templates available in the catalog. You should add or <a href='admin.console#/metadata'>import</a> some.",
"none": "None",
"notFoundInThesaurus": "<strong>Warning! Keywords {{invalid}} not found in thesaurus.</strong> Others {{found}} were found in the thesaurus. 2 reasons: <ul><li>keywords in this record are in a language that is not in the current user interface language</li><li>keywords does not exists in the thesaurus</li></ul><strong>Those keywords will not be modified by this editing session</strong> unless you remove this thesaurus section.",
Expand Down

0 comments on commit 46281e9

Please sign in to comment.