[bug] Map tab doesn't work in reaodnly mode
I think this depends on https://github.com/openwisp/django-loci/issues/95.
can i fix this issue?
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
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.
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.
@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:
@nemesifier I have created a PR for this : https://github.com/openwisp/openwisp-controller/pull/1014