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

Add more information if the layer is invalid : tooltip for users admin/non admin, disable tool ... #4397

Open
Gustry opened this issue Apr 30, 2024 · 15 comments

Comments

@Gustry
Copy link
Member

Gustry commented Apr 30, 2024

It would be nice if the legend could display either a icon next to it (with a tooltip, different for the admin) if the GetLegendGraphic contains a valid=False.

It would allow to see quickly that this legend relies on broken layer :
image

http://lizmap.local:8130/index.php/lizmap/service

repository=testsrepository
project=feature_toolbar
SERVICE=WMS
REQUEST=GetLegendGraphic
VERSION=1.3.0
FORMAT=application/json
LAYER=tramway_lines,tramway_stops,parent_layer,parent_layer_without_attribute_table,tramway_stop_with_parenthesis_and_spaces
STYLES=défaut,défaut,défaut,défaut,défaut

in the JSON output, the plugin is now providing a valid=False value :

image

The icon provided by Lizmap server is a warning icon. I tried to override as well the layer name by appending at the end of the string.

But both string AND mainly the icon is overriden by LWC, I gues because of

if (layerCfg.type == 'group' || layerCfg.groupAsLayer) {

CC @nboisteault @rldhont

@Gustry
Copy link
Member Author

Gustry commented Apr 30, 2024

image

@guenterw
Copy link

guenterw commented May 8, 2024

I find this extension very helpful, I also wanted to suggest it.
Is there a workaround for realising this right now?

@Gustry
Copy link
Member Author

Gustry commented May 13, 2024

Is there a workaround for realising this right now?

This was a real screenshot from the new version of the plugin, you can do the upgrade ;-) 2.9.1 just released.

The only drawback, if the user has set this icon for production, to show warnings on his own map :) (traffic jam...)

@guenterw
Copy link

Thanks for the hint but unfortunately it doesn't work for me yet.
In all 3 current versions. Do I have to set anything special? I am logged in as an admin.
These two raster data files do not exist on the test server. However, the layers are displayed normally in the legend.

image

From my point of view, it would be ideal if the admin would see the “!” and the normal user would not see the layer at all.

Project "Test Jagdkataster..."
https://cx21-6.webgis.biz/
https://cx21-7.webgis.biz/
https://cx21-8.webgis.biz/

@Gustry
Copy link
Member Author

Gustry commented May 15, 2024

From my point of view, it would be ideal if the admin would see the “!” and the normal user would not see the layer at all.

It's a work in progress on this.
We have some discussions.
Especially about the use of :

Indeed, for an admin, some tooltip must be added, all tools using an invalid layer must be checked : edition tool, attritube table, dataviz, form filter ... (all layers which can be configured in Lizmap plugin, or in QGIS, for Value relation, Relation reference, Atlas ...)

Can you share a screenshot of QGIS about these layers ?

Hum; I just tried a project I knew with a broken layer :
image

Indeed, the symbol is not at the correct level.

@Gustry
Copy link
Member Author

Gustry commented May 15, 2024

In my legend, I can see the flag valid=False, but I don't see it in yours @guenterw :

image

Did you restart your QGIS-Server ?

@guenterw
Copy link

I have just restarted the server, no change:
image

the aerial image "Reute 25.09.2023 20cm" is a simple raster file with the relative path "../luftbilder/2023_....tif in the original project. This file does not exist here on the test server cx21.
image

The WebGIS layer "FNP incl. 1. + 4. Änd." is actually more complicated. It is a grouping of three raster files.
image

@Gustry
Copy link
Member Author

Gustry commented May 15, 2024

The WebGIS layer "FNP incl. 1. + 4. Änd." is actually more complicated. It is a grouping of three raster files.
This is not supported. I'm not sure how the legend is built on the QGIS Server side. That could be a dev or an idea.

But for sure, by reading the logs from your server, you will have a message like :

Skipping the layer 'FNP incl. 1. + 4. Änd.' because it's not a vector layer

I have just restarted the server, no change:

As usual, you should read your QGIS Server logs. If needed, increase log level.
You will see the incoming HTTP request GetLegendGraphic (we can see it your in webbrowser like this

image

I just made a commit to have a little bit more debug if an invalid layer has been found. If you can download the latest zip.
Either the ZIP directly, or you can use our custom QGIS repository with QGIS-Plugin-Manager
https://packages.3liz.org/

Thanks for your help

@Gustry
Copy link
Member Author

Gustry commented May 15, 2024

The latest ZIP might be available in a dozen of minutes, just in case. We have some CI running to build the ZIP package.

@guenterw
Copy link

ok, Lizmap Server Plugin 2.9.2-alpha is active:
image

If I understand it correctly, the "!" in the legend cannot work with the grouped layers (FNP...).
But it should work for the aerial view (Luftbild...)?

Otherwise, I'm afraid I don't understand everything about logging. Unfortunately, I still have some projects to work on. Many thanks for the help/feedback.

@Gustry
Copy link
Member Author

Gustry commented May 15, 2024

If I understand it correctly, the "!" in the legend cannot work with the grouped layers (FNP...).

Yes, it would need some dev. I'm not sure about the current behavior.

But it should work for the aerial view (Luftbild...)?

No, this was not yet supported. It's in progress in 3liz/qgis-lizmap-server-plugin#77

Otherwise, I'm afraid I don't understand everything about logging

This is a must ;-)

That's the only way to see how your server is behaving, especially when it doesn't work as expected. QGIS Server core and plugins are verbose, about what they are doing etc.

@guenterw
Copy link

Thank you for the clarification.
It would of course be nice if it also worked for the raster data. But I should actually have my own vector and raster data under control.
Such a display for external WMS or WFS services would be more important to me. But that is probably even more complex?

With logging, I was referring more to the analysis in the browser. I am essentially familiar with logging from the QGIS server, even if I don't use it enough. But I also see myself more as a user and tester.

@guenterw
Copy link

I don't really know why, but now the “!” for raster files works. Maybe after the last update of the server plugin (2.9.2-alpha - 5098057) I had only restarted Apache and not the QGIS server.

image

This is visible to everyone, which may be a good thing.
Thank you very much.

@Gustry
Copy link
Member Author

Gustry commented May 17, 2024

Good to know. Still no luck for vector layer ? Can you just add typo in the datasource of "Jagdkataster" and/or "Politisch" ?

This is visible to everyone, which may be a good thing.

It's a work in progress. The webbrowser is now aware about this invalid layer. And it's the purpose of this ticket :

  • for normal user : make the user that something, the tool is broken and Lizmap can't work properly (edition, attribute table, related table in form...)
  • for admin : explaining the reason and some clues what to check etc

In your qgis logs, you should have the warning about the raster layer.

@Gustry Gustry changed the title Append symbol in the legend if the layer is invalid Add more information if the layer is invalid : tooltip for users admin/non admin, disable tool ... May 17, 2024
@guenterw
Copy link

sorry, I hadn't tested the other data types.
Now I've tested them all and great: the “!” works for all of them. Even with WMS/WFS services. Only not with grouped layers, but you've already said that.

Should a tooltip with explanations appear now? Or is that the next step? Maybe I'm translating it incorrectly from English.

I was also able to reproduce the warnings in the qgisserver.log. They only appear at log level 0 or 1. I had always set 2.
A side note: I had many error messages in the qgisserver.log such as “CRITICAL Server[2348]: Service CADASTRE is not registered”. I have now installed the server plugin cadastre and they are gone.

The “!” for layers with errors definitely works great in 3.7.7 and 3.8.0 A2. Especially with the WMS and WFS services, this may be an important hint.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants