Skip to content

[feature] Improvements to the dashboard map #705

@pandafy

Description

@pandafy

This issue is a follow-up to PR #688. Several improvements and refactoring opportunities have been identified:

  • The closeButtonHandler and addNavigationHandlers can be generalized, so event handlers aren't re-added on every render. Check out $(parent).on("click", targetID, function(){})
  • The floorplan overlay should close when the ESC key is pressed.
  • Implement a utility method to unbind all event listeners and destroy Netjsongraph.js objects when closing the floorplan overlay.
  • Fix the showing and hiding logic for the floorplan spinner.
  • Refactor the code for managing popups use JS to get the currentPopup instead of using global variable:
    lect currentPopup = null;
    funtion loadPopUpContent(node, netjsongraphInstance) {
      const map = netjsongraphInstance.leaflet;
      if (currentPopup) {
        currentPopup.remove();
      }
  • Refactoring: There is reusable code inside the openFloorPlan function. Make this function leaner. Also, global variables (e.g., allResults) should be scoped inside openFloorPlan.
  • Refactoring: Selenium tests sleep for 0.5 seconds
    self.wait_for_invisibility(
        By.CSS_SELECTOR, ".map-detail .ow-loading-spinner"
    )
    Investigate removing the sleep by using timeout in self.wait_for_* methods.
  • Do not add search.svg to openwisp-controller; Django admin already provides a search icon via static files. Investigate how to we can provide the static() URL to the CSS. Maybe, move this CSS to the template.
  • Add comments to the fetchDevices function in device-map.js.
  • Add a spinner for infinite scroll in the device list inside device-map.js.
  • Find better solution for handling the height of the popup, perhaps we can center the pop up to the map after the content in is reloaded due to having clicked on any filter or search?
  • We can avoid showing the search input if there is less than 4 devices in the location
  • We can avoid showing filters if there's less than 4 devices in the location

Related to #662
Related to #688

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions