Skip to content
Draft
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions openwisp_monitoring/device/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,15 +588,16 @@ class MapPageAdmin(MultitenantAdminMixin, admin.ModelAdmin):

class Media:
js = [
"monitoring/js/lib/netjsongraph.min.js",
"lib/netjsongraph/js/echarts.min.js",
"lib/netjsongraph/js/netjsongraph.echarts.min.js",
Comment thread
coderabbitai[bot] marked this conversation as resolved.
"monitoring/js/lib/leaflet.fullscreen.min.js",
]
css = {
"all": [
"monitoring/css/device-map.css",
"leaflet/leaflet.css",
"monitoring/css/leaflet.fullscreen.css",
"monitoring/css/netjsongraph.css",
"lib/netjsongraph/css/netjsongraph.css",
"lib/netjsongraph/css/netjsongraph-theme.css",
Comment on lines +592 to +599

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check for any remaining references to old netjsongraph bundle paths

# Check for old JS path references
echo "=== Checking for old netjsongraph.min.js references ==="
rg -n "netjsongraph\.min\.js" --type py --type html --type js -g '!*.min.js'

# Check for old CSS path references  
echo -e "\n=== Checking for old monitoring/css/netjsongraph.css references ==="
rg -n "monitoring/css/netjsongraph\.css" --type py --type html

# Verify new paths exist or are documented
echo -e "\n=== Checking for new lib/netjsongraph path references ==="
fd -t f "netjsongraph.echarts.min.js"
fd -t f -p "lib/netjsongraph/css/netjsongraph.css"

Repository: openwisp/openwisp-monitoring

Length of output: 1070


🏁 Script executed:

# Check the context around apps.py lines 378-381 to understand the scope
sed -n '375,385p' openwisp_monitoring/device/apps.py

# Check if admin.py is the only file with new paths, or if there are other updated files
echo "=== Searching for lib/netjsongraph references in .py files ==="
rg -n "lib/netjsongraph" --type py

# Verify the exact state in admin.py around the modified lines
echo -e "\n=== Admin.py context around lines 591-599 ==="
sed -n '589,601p' openwisp_monitoring/device/admin.py

Repository: openwisp/openwisp-monitoring

Length of output: 1941


Critical: Asset migration is incomplete and will cause runtime failures.

The admin.py Media class has been updated to reference assets from lib/netjsongraph/ (lines 591, 598-599), but:

  1. Other files still use old paths: apps.py (lines 378, 381) and test files continue to reference monitoring/js/lib/netjsongraph.min.js and monitoring/css/netjsongraph.css
  2. New assets do not exist: The files lib/netjsongraph/js/netjsongraph.echarts.min.js and lib/netjsongraph/css/netjsongraph*.css are not present in the repository
  3. Conflicting references: Two different Media configurations in the same codebase now use incompatible asset paths

Either migrate all asset references across apps.py, test files, and admin.py consistently, or verify that openwisp-utils has been integrated and the new assets are available. This PR cannot merge in its current state.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@openwisp_monitoring/device/admin.py` around lines 591 - 599, The Media asset
paths in the device admin (Media class in openwisp_monitoring/device/admin.py)
were changed to lib/netjsongraph/... but apps.py (AppConfig in
openwisp_monitoring/device/apps.py) and tests still reference
monitoring/js/lib/netjsongraph.* and the new files
(lib/netjsongraph/js/netjsongraph.echarts.min.js and
lib/netjsongraph/css/netjsongraph*.css) do not exist; fix this by making asset
references consistent across the codebase: either (A) restore the old paths in
the Media class to monitoring/js/lib/netjsongraph.* and
monitoring/css/netjsongraph.css everywhere (admin.py, apps.py, tests) or (B) add
the missing static files under static/lib/netjsongraph/js and
static/lib/netjsongraph/css and update apps.py and all tests to reference
lib/netjsongraph/...; ensure the chosen approach updates admin.py Media, the
AppConfig asset references, and any unit tests so all three components point to
the same existing asset filenames and that staticfiles collection will include
them.

"monitoring/css/monitoring.css",
]
}
Expand Down
101 changes: 0 additions & 101 deletions openwisp_monitoring/device/static/monitoring/css/netjsongraph.css

This file was deleted.

This file was deleted.

2 changes: 2 additions & 0 deletions openwisp_monitoring/device/templates/admin/map/map_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

{% block extrahead %}
{{ block.super }}
{% leaflet_js %}
{% leaflet_css %}
{{ media }}
{% endblock extrahead %}

Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def get_install_requires():
continue
# add line to requirements
requirements.append(line)

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.

Avoid unrelated changes.

return requirements


Expand Down
Loading