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

API - Retrieve invalid layers between GetCapabilities en CFG file #5304

Merged
merged 1 commit into from
Feb 20, 2025

Conversation

Gustry
Copy link
Member

@Gustry Gustry commented Jan 30, 2025

I'm keen to have some feedbacks here.

For now, globally in Lizmap, if an error occurs, there is nothing displayed in the user interface. The only way is to open the developer tools, which is not a good advice, our admin end-users shouldn't open the web developer tools.

It would be nice, at the end of loading a map, a UI box is displayed if there were any "error" during loading the map ?

Just to keen to have ideas

Copy link
Collaborator

@mdouchin mdouchin left a comment

Choose a reason for hiding this comment

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

Nice catch. Minor rephrasing needed IMHO

@Gustry Gustry added the run end2end If the PR must run end2end tests or not label Jan 30, 2025
@Gustry Gustry removed the run end2end If the PR must run end2end tests or not label Jan 30, 2025
@Gustry Gustry force-pushed the admin-layer-cfg branch 3 times, most recently from e706c65 to 82133d5 Compare January 31, 2025 13:02
@Gustry Gustry added the run end2end If the PR must run end2end tests or not label Jan 31, 2025
@Gustry
Copy link
Member Author

Gustry commented Jan 31, 2025

I'm keen to have feedbacks about this document variable @nboisteault and @rldhont
https://www.geeksforgeeks.org/how-to-fix-referenceerror-document-is-not-defined-in-javascript/

I didn't look too much

@nboisteault
Copy link
Member

I'm keen to have feedbacks about this document variable @nboisteault and @rldhont https://www.geeksforgeeks.org/how-to-fix-referenceerror-document-is-not-defined-in-javascript/

I didn't look too much

Where is the issue?

@Gustry
Copy link
Member Author

Gustry commented Jan 31, 2025

Where is the issue?

document is not defined, as described in the code, just check what I have done

@Gustry Gustry marked this pull request as draft January 31, 2025 15:00
@Gustry
Copy link
Member Author

Gustry commented Feb 6, 2025

@rldhont I have no idea what I have done, just to test for now.

I need to check where to call the invalidLayersNotFoundInCfg and add the :

const errorMessage = `The WMS layer name "${wmsName}" is unknown. Is the Lizmap configuration file "${lizUrls.params.project}.qgs.cfg" up to date ?`;
console.error(errorMessage);
if (document.body.dataset.lizmapAdminUser === 1) {
   lizMap.addMessage(errorMessage, 'warning', true).attr('id', 'lizmap-warning-message');
} else {
   // Display a nicer messager saying this map has some technical issues
}

Copy link
Collaborator

@rldhont rldhont left a comment

Choose a reason for hiding this comment

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

I prefered to have this API

export function buildLayerTreeConfig(wmsCapaLayerRoot, layersCfg, invalid = []) {
        const items = buildLayerTreeGroupConfigItems(wmsCapaLayerRoot, layersCfg, 0, invalid);
       return new LayerTreeGroupConfig('root', 0, items, wmsCapaLayerRoot);
}

function buildLayerTreeGroupConfigItems(wmsCapaLayerGroup, layersCfg, level, invalid = []) {
    ...
    return items;
}
    get layerTree() {
        if (this._layerTree == null) {
            this._invalid_layers = []; 
            this._layerTree = buildLayerTreeConfig(this._theWmsCapabilities.Capability.Layer, this.layers, this._invalid_layers);
        }
        return this._layerTree;
    }

@Gustry Gustry force-pushed the admin-layer-cfg branch 4 times, most recently from f3953de to 5a264ea Compare February 18, 2025 15:32
@Gustry
Copy link
Member Author

Gustry commented Feb 18, 2025

@rldhont API changed.

But I don't know where would the best to display then the result of this new API.

Should we wait on #5424 ?

Copy link
Collaborator

@rldhont rldhont left a comment

Choose a reason for hiding this comment

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

Minor changes

@Gustry Gustry changed the title UX - Display an error message if the layer is not found in the CFG file, if admin API - Retrieve invalid layers between GetCapabilities en CFG file Feb 18, 2025
@Gustry Gustry marked this pull request as ready for review February 18, 2025 15:53
@Gustry Gustry requested a review from rldhont February 20, 2025 08:41
@Gustry Gustry merged commit c559d68 into 3liz:master Feb 20, 2025
18 of 20 checks passed
@Gustry Gustry deleted the admin-layer-cfg branch February 20, 2025 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
administration pages backport release_3_8 backport release_3_9 javascript Pull requests that update Javascript code run end2end If the PR must run end2end tests or not
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants