openwisp-controller icon indicating copy to clipboard operation
openwisp-controller copied to clipboard

[bug] Map tab doesn't work in reaodnly mode

Open nemesifier opened this issue 4 years ago • 1 comments

I think this depends on https://github.com/openwisp/django-loci/issues/95.

nemesifier avatar Oct 08 '21 17:10 nemesifier

can i fix this issue?

Yashveer-Soni avatar Mar 09 '24 16:03 Yashveer-Soni

Now that https://github.com/openwisp/django-loci/issues/95 is resolved we can focus on making sure the changes work here.

Unfortunately it seems we need to make some adjustments in openwisp-controller, here's what I have found.

Device change page, map tab still doesn't work in readonly mode

Image

JS error I see:

loci.js:463 Uncaught TypeError: Cannot read properties of undefined (reading 'eachLayer')
    at getMarkerFeatureGroup (loci.js:463:9)
    at getFeatureGroup (loci.js:477:12)
    at geometryListeners (loci.js:591:24)
    at loci.js:613:7
    at dispatch (jquery.js:5145:27)
    at elemData.handle (jquery.js:4949:28)
getMarkerFeatureGroup @ loci.js:463
getFeatureGroup @ loci.js:477
geometryListeners @ loci.js:591
(anonymous) @ loci.js:613
dispatch @ jquery.js:5145
elemData.handle @ jquery.js:4949

Location change page, floorplan is not shown

This was working in django-loci but it's not working here.

Image

Browser tests

We also need to import the selenium tests for the device admin of django-loci in openwisp-controller. I think adding 1 or 2 basic browser tests for the readonly map mode which fail on the current master of openwisp-controller would protect us from future regressions on this functionality.

nemesifier avatar Apr 10 '25 22:04 nemesifier

@DragnEmperor after the latest changes the readonly mode is working fine but the unsaved changes Javascript logic is triggered inadvertently. Try opening any device which has map data in readonly mode, then try leaving the device change page, this is what I see:

Image

nemesifier avatar Apr 25 '25 00:04 nemesifier

@nemesifier I have created a PR for this : https://github.com/openwisp/openwisp-controller/pull/1014

DragnEmperor avatar Apr 26 '25 18:04 DragnEmperor