Skip to content

[change] Load netjsongraph.js from openwisp-utils #272#298

Draft
kunalverma2512 wants to merge 2 commits into
openwisp:masterfrom
kunalverma2512:feature/272-load-netjsongraph-utils
Draft

[change] Load netjsongraph.js from openwisp-utils #272#298
kunalverma2512 wants to merge 2 commits into
openwisp:masterfrom
kunalverma2512:feature/272-load-netjsongraph-utils

Conversation

@kunalverma2512

@kunalverma2512 kunalverma2512 commented May 20, 2026

Copy link
Copy Markdown

Removed redundant netjsongraph static files from the repository to prevent duplication. Updated admin.py and base.html to load the unbundled netjsongraph and echarts libraries directly from openwisp-utils.

Checklist

  • I have read the OpenWISP Contributing Guidelines.
  • I have manually tested the changes proposed in this pull request (ran all local QA formatting checks).
  • I have written new test cases for new code and/or updated existing tests for changes to existing code.
  • I have updated the documentation.

Reference to Existing Issue

Closes #272

Description of Changes

This PR achieves the goal of avoiding duplicated static files across the OpenWISP ecosystem.

  1. Deleted the duplicated netjsongraph CSS and JS files from the local static/ directory.
  2. Updated BaseAdmin in admin.py to point to the shared lib/ files provided by openwisp-utils, and explicitly included the new ECharts dependencies.
  3. Updated base.html to load the scripts from openwisp-utils as well.

Important Note regarding CI: This PR heavily depends on openwisp/openwisp-utils#517. Because the CI environment will pull the current master branch of openwisp-utils (which lacks the unbundled ECharts files), the Selenium tests here will inevitably throw 404 errors until that initial PR is merged.

Screenshot

7C683B8B-AE70-4B66-95D7-A0AF439CEE12

Removed redundant netjsongraph static files from the repository to prevent duplication. Updated admin.py and base.html to load the unbundled netjsongraph and echarts libraries directly from openwisp-utils.

Fixes openwisp#272
@coderabbitai

coderabbitai Bot commented May 20, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR migrates netjsongraph static assets from locally duplicated paths to centralized lib/netjsongraph/ paths. The admin configuration and base template are updated to reference the new asset locations, which aligns with loading netjsongraph from openwisp-utils to reduce duplication with openwisp-monitoring. Local CSS stylesheets are removed as they are now provided by the central library.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title correctly uses the [change] prefix, includes the issue number #272, and accurately describes the main objective of loading netjsongraph from openwisp-utils.
Linked Issues check ✅ Passed The PR successfully addresses issue #272 objectives by removing duplicated netjsongraph static files and updating admin.py and base.html to load from openwisp-utils.
Out of Scope Changes check ✅ Passed All changes directly align with the stated objective of eliminating duplicate static files and consolidating netjsongraph loading from openwisp-utils; no unrelated changes detected.
Bug Fixes ✅ Passed This PR is refactoring (consolidating duplicate static files), not fixing a bug. The check applies only to bug fixes, so it does not apply here.
Description check ✅ Passed The PR description is well-structured with a clear summary, completed checklist items, reference to issue #272, and detailed explanation of changes with an important CI dependency note.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kunalverma2512

Copy link
Copy Markdown
Author

Hi @nemesifier, the CI checks have failed as expected.

As noted in the PR description, the Selenium tests are throwing javascript error: graph is not defined because the CI environment is pulling openwisp-utils master, which currently 404s on the new unbundled ECharts static files.

However, while checking the logs, I also noticed a completely unrelated dependency resolution error that is crashing the test matrix:
django-filter 25.2 requires Django>=5.2, but you have django 4.2.30 which is incompatible.

It looks like the upstream django-filter package just released a new version that drops Django 4.2 support. Just wanted to flag this for you! Let me know if you would like me to pin django-filter<25.2 in this PR's requirements, or if you prefer to handle that separately.

@nemesifier nemesifier left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please force the CI workflow to install your fork (from openwisp/openwisp-utils#675), eg:

# add this to the github actions CI YAML setup step, as last command
pip install --force-reinstall --no-deps https://github.com/kunalverma2512/openwisp-utils/tarball/feature/517-add-netjsongraph-static

Then, update the PR description with a GIF showing the browser network tab open, where the file netjsongraph.echarts.min.js is visibly being loaded (as expected) and the network topology graph UI (which is handled by netjsongraph.js) loads properly.

Once everything is done correctly the CI will pass. Manual testing on your end is needed to accomplish this.

Added the maintainer-requested pip install command to ci.yml to fetch the unbundled netjsongraph assets from the openwisp-utils fork during automated testing.

Fixes openwisp#272
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 98.873%. remained the same — kunalverma2512:feature/272-load-netjsongraph-utils into openwisp:master

@kunalverma2512

kunalverma2512 commented May 24, 2026

Copy link
Copy Markdown
Author

Hi @nemesifier, I have completed the requested updates by modifying the CI workflow to install my openwisp-utils fork, and all tests are now passing successfully with green checks. Additionally, I have manually tested the UI with the required screenshot demonstrating the topology graph rendering correctly. Please let me know if everything looks good to go!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[change] Load netjsongraph.js from openwisp-utils

3 participants