Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 4.2.x] Metadata editor / Fix javascript error in the add thumbnail option when the metadata has 1 WMS layer #7684

Merged
merged 2 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading