You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Extract inline assets; add import/parsing features
Move inline CSS and JavaScript into external files and implement host/subnet import and parsing features. Added public/assets/css/styles.css (site styling) and public/assets/js/app.js (large refactor with parsing, import, export, session persistence, graph controls, path criteria, subnet inference, CSV/JSON handling, and device merge logic). Updated public/index.html to reference external assets and adjusted markup; updated ARCHITECTURE.md to reflect the new file structure, runtime state variables, and implemented enhancements. Also added scripts/openwrt_export_subnet_mappings.sh to assist with UCI subnet mapping exports.
Copy file name to clipboardExpand all lines: ARCHITECTURE.md
+26-11Lines changed: 26 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,10 +18,10 @@ This is a visual analysis tool, not a full OpenWrt firewall simulator. The decis
18
18
| Layer | Technology |
19
19
| --- | --- |
20
20
| Markup | HTML5 |
21
-
| Styling |Inline CSS with custom properties and a dark theme |
22
-
| Behaviour |Vanilla JavaScript |
21
+
| Styling |`public/assets/css/styles.css` with custom properties and a dark theme |
22
+
| Behaviour |`public/assets/js/app.js` using vanilla JavaScript |
23
23
| Graph rendering | Cytoscape.js v3.30.4 from CDN |
24
-
| Distribution | Static `public/index.html`|
24
+
| Distribution | Static files under `public/`|
25
25
26
26
## File Structure
27
27
@@ -32,12 +32,17 @@ openwrt-firewall-visualiser/
32
32
├── scripts/
33
33
│ └── openwrt_export_hosts.sh
34
34
└── public/
35
-
└── index.html # Complete single-file application
35
+
├── index.html # Application markup and external asset references
36
+
└── assets/
37
+
├── css/
38
+
│ └── styles.css
39
+
└── js/
40
+
└── app.js
36
41
```
37
42
38
43
## Runtime State
39
44
40
-
The app keeps a small amount of global state inside `public/index.html`:
45
+
The app keeps a small amount of global state inside `public/assets/js/app.js`:
41
46
42
47
| Variable | Purpose |
43
48
| --- | --- |
@@ -46,6 +51,8 @@ The app keeps a small amount of global state inside `public/index.html`:
46
51
|`cy`| Current Cytoscape graph instance |
47
52
|`currentLayout`| Selected graph layout name |
48
53
|`selectedTestPath`| Source and destination device indexes used by the path tester |
54
+
|`selectedPathCriteria`| Optional protocol and destination-port criteria for path tests |
55
+
|`subnetMappingsText`| CIDR-to-zone mappings used for host-zone inference |
49
56
|`storageAvailable`| Guard for browsers where `localStorage` is blocked or unavailable |
50
57
51
58
## Data Model
@@ -83,6 +90,8 @@ interface Device {
83
90
name:string;
84
91
ip:string;
85
92
zone:string;
93
+
mac?:string;
94
+
source?:string;
86
95
}
87
96
88
97
interfaceDecision {
@@ -420,7 +429,7 @@ Relevant functions and elements:
420
429
421
430
## Implemented Future Enhancements
422
431
423
-
The following phases continue the roadmap sequence after Phase A-C and are now implemented in`public/index.html`.
432
+
The following phases continue the roadmap sequence after Phase A-C and are now implemented across`public/index.html`, `public/assets/css/styles.css`, and `public/assets/js/app.js`.
424
433
425
434
### Phase D: Local Storage Lifecycle Management
426
435
@@ -475,7 +484,7 @@ Objective: allow users to populate devices from existing network inventories ins
475
484
476
485
Requirements:
477
486
478
-
- Add a dedicated "Bulk Import Hosts" section.
487
+
- Add a clearly labelled "Import" section with a "Bulk Import Hosts" subsection.
479
488
- Support device inventory exports.
480
489
- Support host lists.
481
490
- Support DHCP exports.
@@ -508,6 +517,8 @@ Supported Linux neighbour table format:
508
517
509
518
Implemented details:
510
519
520
+
- Import controls are grouped separately from manual Devices and Subnet Mappings controls.
521
+
-`renderImportChecklist()` shows first-time users which setup/import steps are currently populated.
511
522
-`importBulkHosts()` imports the textarea content.
512
523
-`parseBulkHosts()` parses host data line-by-line.
513
524
-`parseHostLine()` handles host-list, neighbour/ARP, and DHCP lease formats.
@@ -557,6 +568,7 @@ zone = iot
557
568
Implemented details:
558
569
559
570
- The `subnetMappings` textarea stores subnet-to-zone mappings.
571
+
- The Subnet Mappings help box explains when the mappings are used, the manual `CIDR zone` format, and the exact UCI output expected by the UCI import field.
560
572
-`parseSubnetMappings()` parses CIDR mappings.
561
573
-`inferZoneForIp()` assigns zones during import when a host line has no explicit zone.
562
574
- Unresolved imported hosts are counted in the import result panel.
@@ -639,6 +651,7 @@ Implemented improvements:
639
651
- Show before/after impact for changed forwardings and rules.
640
652
- Export Session uses a distinct positive-action button.
641
653
- Import Session / Devices is a dedicated file-import control.
654
+
- Import status is persisted with saved sessions so the checklist reflects restored state.
642
655
643
656
### Phase L: Usability
644
657
@@ -647,6 +660,8 @@ Status: implemented.
647
660
Implementation improvements:
648
661
649
662
- Loading the example now prompts before replacing the current state.
663
+
- Devices, Subnet Mappings, and Import are separate left-panel sections.
664
+
- Subnet Mappings has its own help button, with less ambiguous guidance about when subnet mappings are used.
650
665
- Graph Visualiser has an expand/collapse button.
651
666
- Export Graph PNG moved into the Graph Visualiser toolbar.
652
667
- Device Relationship Map shows the first 15 relationships by default and adds a show-all/show-fewer control when needed.
0 commit comments