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

UX - Display an error message if the layer is not found in the CFG file, if admin #5304

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
10 changes: 9 additions & 1 deletion assets/src/modules/config/LayerTree.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,15 @@ function buildLayerTreeGroupConfigItems(wmsCapaLayerGroup, layersCfg, level) {
const wmsName = wmsCapaLayer.Name;
const cfg = layersCfg.getLayerConfigByWmsName(wmsName);
if (cfg == null) {
console.log('The WMS layer name `'+ wmsName +'` is unknown!');
const errorMessage = `The WMS layer name "${wmsName}" is unknown. Is the Lizmap configuration file "${lizUrls.params.project}.qgs.cfg" up to date ?`;
console.warn(errorMessage);
try {
// document is not defined in JUnit
if (document.body.dataset.lizmapAdminUser === 1) {
lizMap.addMessage(errorMessage, 'warning', true).attr('id', 'lizmap-warning-message');
}
}catch(error) {}
Comment on lines +418 to +423
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
try {
// document is not defined in JUnit
if (document.body.dataset.lizmapAdminUser === 1) {
lizMap.addMessage(errorMessage, 'warning', true).attr('id', 'lizmap-warning-message');
}
}catch(error) {}

Do not use LizMap or do some UX here.


continue;
}
if (wmsCapaLayer.hasOwnProperty('Layer') && wmsCapaLayer.Layer.length != 0) {
Expand Down
Loading