3liz / lizmap-web-client

Transfer a QGIS project on a server, Lizmap is providing the web interface to browse it
https://www.lizmap.com
Mozilla Public License 2.0
261 stars 144 forks source link

[Bug]: Cant display filtered HTML Template Dataviz : `plot_config is undefined` #3101

Open audelorAd opened 2 years ago

audelorAd commented 2 years ago

What is the bug?

I Have a Dataviz "HTML Template" type in ordered to display a table. I can't display this dataviz in the parents popup. In this popup the content should be filtered.

In the browser console I get the following message : Uncaught TypeError: plot_config is undefined dataviz.js: 202:20

Steps to reproduce the issue

  1. QGIS Project with at least two layer with relation between them.
  2. In lizmap plugin, create a dataviz on the children layer
  3. Set the dataviz to display in the parent popup
  4. In the lizmap plugin create an attribute table on the parent layer.
  5. See the result, dataviz is displayed in the main panel, but not in the parent popup

Versions

Versions :

Check Lizmap plugin

QGIS server version, only if the section above doesn't mention the QGIS Server version

3.22

Operating system

Windows 10

Browsers

Firefox

Browsers version

91.10

Relevant log output

Uncaught TypeError: plot_config is undefined
    buildHtmlPlot https://carto.audelor.com/assets/js/dataviz/dataviz.js?_r=220519235810:202
    buildPlot https://carto.audelor.com/assets/js/dataviz/dataviz.js?_r=220519235810:304
    getPlot https://carto.audelor.com/assets/js/dataviz/dataviz.js?_r=220519235810:190
    jQuery 9
    getPlot https://carto.audelor.com/assets/js/dataviz/dataviz.js?_r=220519235810:156
    getPlot https://carto.audelor.com/assets/js/dataviz/dataviz.js?_r=220519235810:539
    addChildrenDatavizFilteredByPopupFeature https://carto.audelor.com/assets/js/map.js?_r=220519235810:2990
    getLayerFeature https://carto.audelor.com/assets/js/map.js?_r=220519235810:5139
    getLayerFeature https://carto.audelor.com/assets/js/map.js?_r=220519235810:5749
    addChildrenDatavizFilteredByPopupFeature https://carto.audelor.com/assets/js/map.js?_r=220519235810:2948
    jQuery 2
    addChildrenDatavizFilteredByPopupFeature https://carto.audelor.com/assets/js/map.js?_r=220519235810:2919
    getfeatureinfo https://carto.audelor.com/assets/js/map.js?_r=220519235810:3341
    triggerEvent https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:255
    triggerGetFeatureInfo https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1692
    handleResponse https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1693
    callback https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1689
    bind https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:77
    runCallbacks https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1563
    onreadystatechange https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1559
    dispatchEvent https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1593
    fReadyStateChange https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1596
    onreadystatechange https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1579
    open https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1574
    issue https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1558
    GET https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1564
    request https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1691
    refreshGetFeatureInfo https://carto.audelor.com/assets/js/map.js?_r=220519235810:3441
    layerFilterParamChanged https://carto.audelor.com/assets/js/map.js?_r=220519235810:3474
    jQuery 8
    layerFilterParamChanged https://carto.audelor.com/assets/js/map.js?_r=220519235810:3470
    triggerEvent https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:255
    applyLayerFilter https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2370
    callFeatureDataCallBacks https://carto.audelor.com/assets/js/map.js?_r=220519235810:4991
    callFeatureDataCallBacks https://carto.audelor.com/assets/js/map.js?_r=220519235810:4989
    getFeatureData https://carto.audelor.com/assets/js/map.js?_r=220519235810:5063
    jQuery 8
    getFeatureData https://carto.audelor.com/assets/js/map.js?_r=220519235810:5042
    getFeatureData https://carto.audelor.com/assets/js/map.js?_r=220519235810:5756
    applyLayerFilter https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2107
    updateLayer https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2085
    updateMapLayerDrawing https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2544
    layerFilteredFeaturesChanged https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2842
    triggerEvent https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:255
    filterLayerFromSelectedFeatures https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2065
    layerfeaturefilterselected https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2813
    triggerEvent https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:255
    lizmappopupdisplayed https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2999
    jQuery 10
    lizmappopupdisplayed https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2977
    triggerEvent https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:255
    getfeatureinfo https://carto.audelor.com/assets/js/map.js?_r=220519235810:3344
    triggerEvent https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:255
    triggerGetFeatureInfo https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1692
dataviz.js:202:20
    buildHtmlPlot https://carto.audelor.com/assets/js/dataviz/dataviz.js?_r=220519235810:202
    buildPlot https://carto.audelor.com/assets/js/dataviz/dataviz.js?_r=220519235810:304
    getPlot https://carto.audelor.com/assets/js/dataviz/dataviz.js?_r=220519235810:190
    jQuery 9
    getPlot https://carto.audelor.com/assets/js/dataviz/dataviz.js?_r=220519235810:156
    getPlot https://carto.audelor.com/assets/js/dataviz/dataviz.js?_r=220519235810:539
    addChildrenDatavizFilteredByPopupFeature https://carto.audelor.com/assets/js/map.js?_r=220519235810:2990
    getLayerFeature https://carto.audelor.com/assets/js/map.js?_r=220519235810:5139
    getLayerFeature https://carto.audelor.com/assets/js/map.js?_r=220519235810:5749
    addChildrenDatavizFilteredByPopupFeature https://carto.audelor.com/assets/js/map.js?_r=220519235810:2948
    jQuery 2
    addChildrenDatavizFilteredByPopupFeature https://carto.audelor.com/assets/js/map.js?_r=220519235810:2919
    getfeatureinfo https://carto.audelor.com/assets/js/map.js?_r=220519235810:3341
    triggerEvent https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:255
    triggerGetFeatureInfo https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1692
    handleResponse https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1693
    callback https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1689
    bind https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:77
    runCallbacks https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1563
    onreadystatechange https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1559
    dispatchEvent https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1593
    fReadyStateChange https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1596
    onreadystatechange https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1579
    (Asynchrone : EventHandlerNonNull)
    open https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1574
    issue https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1558
    GET https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1564
    request https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1691
    refreshGetFeatureInfo https://carto.audelor.com/assets/js/map.js?_r=220519235810:3441
    layerFilterParamChanged https://carto.audelor.com/assets/js/map.js?_r=220519235810:3474
    jQuery 8
    layerFilterParamChanged https://carto.audelor.com/assets/js/map.js?_r=220519235810:3470
    triggerEvent https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:255
    applyLayerFilter https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2370
    callFeatureDataCallBacks https://carto.audelor.com/assets/js/map.js?_r=220519235810:4991
    forEach self-hosted:202
    callFeatureDataCallBacks https://carto.audelor.com/assets/js/map.js?_r=220519235810:4989
    getFeatureData https://carto.audelor.com/assets/js/map.js?_r=220519235810:5063
    jQuery 8
    getFeatureData https://carto.audelor.com/assets/js/map.js?_r=220519235810:5042
    getFeatureData https://carto.audelor.com/assets/js/map.js?_r=220519235810:5756
    applyLayerFilter https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2107
    updateLayer https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2085
    updateMapLayerDrawing https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2544
    layerFilteredFeaturesChanged https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2842
    triggerEvent https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:255
    filterLayerFromSelectedFeatures https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2065
    layerfeaturefilterselected https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2813
    triggerEvent https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:255
    lizmappopupdisplayed https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2999
    jQuery 10
    lizmappopupdisplayed https://carto.audelor.com/assets/js/attributeTable.js?_r=220519235810:2977
    triggerEvent https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:255
    getfeatureinfo https://carto.audelor.com/assets/js/map.js?_r=220519235810:3344
    triggerEvent https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:255
    triggerGetFeatureInfo https://carto.audelor.com/assets/js/OpenLayers-2.13/OpenLayers.js?_r=220519235810:1692
audelorAd commented 2 years ago

Few more test today :

See below :

audelorAd commented 2 years ago

Problem seems situated inside buildHtmlPlot function of dataviz.js file In this function the id args is not the same between dataviz panel plots ( id value here start with "datavizplot") and parent popup plots (id value here is the parent layer id).

buildHtmlPlot function seems able to deals only with dataviz panel plots like we can see below:

function buildHtmlPlot(id, data, layout) {
        if (!data) {
            return;
        }
        var a = **parseInt(id.replace('dataviz_plot_', ''))**
audelorAd commented 2 years ago

Any idea on how to fix this ?

Gustry commented 2 years ago

Note from @audelorAd on IRC :

<audelorad> This afternoon I tried to modify dataviz.js code through Chrome Developper console and the code below is working fine :
<audelorad> * Add "pid" in the line 303 => buildHtmlPlot(id, pid, conf.data, conf.layout);
<audelorad> * Use also "pid" in line 201 => var plot_config = dv.config.layers[pid];
<audelorad> * Delete line 200
Gustry commented 1 year ago

I encountered the issue also on another instance and I have access to the data.

Gustry commented 1 year ago

Apparently, this issue was only with "HTML plot" when it's filtered with a parent layer.

On one running LWC instance, I'm not sure to reproduce the issue (if the plot is still here in the config)

@audelorAd Do you still confirm the issue ? Can you share a URL (or private) ?

audelorAd commented 1 year ago

Yes I confirm issue still here on Lizmap 3.6.7 I will share you URL privately.

Gustry commented 1 year ago

Yes I confirm issue still here on Lizmap 3.6.7

Ok, I got the issue too.

github-actions[bot] commented 10 months ago

This issue is missing some feedbacks. 👻 Please have a look to the discussion, thanks. 🦎

nboisteault commented 6 months ago

Are layers data used for the dataviz all accessible? (no filter by user/group etc.)

Gustry commented 6 months ago

It can be linked to #4400