make treeview of all sources #13

Closed
opened 2026-03-19 18:39:14 +00:00 by despiegk · 3 comments
Owner

image

when we get logs in proc, at backend , we keep track of all sources
always (lowercase, ascii)

and show those in treeview

use dot = . as separation

and sort alphabetical

then allow mulit select of tthe tree at higher and lower level
this will then filter the logs for those chosen sources

so its very easy to zoom into logs

![image](/attachments/b6f70e02-58a4-4644-955c-24db93529906) when we get logs in proc, at backend , we keep track of all sources always (lowercase, ascii) and show those in treeview use dot = . as separation and sort alphabetical then allow mulit select of tthe tree at higher and lower level this will then filter the logs for those chosen sources so its very easy to zoom into logs
1.1 MiB
Author
Owner

Implementation Spec for Issue #13 — Log Source Tree View

Objective

Add a hierarchical tree view of all log sources to the Logs tab in the hero_proc dashboard. Sources use dot-separated notation (e.g., nginx.main, myservice.myjob). The tree allows multi-select at any level to filter log output, making it easy to zoom into relevant logs.

Requirements

  • Backend: Add a new RPC method logs.sources that returns all distinct src values from the logs table, always lowercased and ASCII
  • Backend: Query: SELECT DISTINCT LOWER(src) FROM logs WHERE src != '' ORDER BY src
  • Frontend: Build distinct sources into a tree structure using . as separator
  • Frontend: Display tree in a collapsible sidebar panel on the left side of the Logs tab
  • Frontend: Sort all nodes alphabetically at every level
  • Frontend: Multi-select via checkboxes at both parent and leaf levels (selecting parent selects all children; deselecting child shows indeterminate parent)
  • Frontend: Selected sources filter the log query
  • Frontend: Auto-refresh source list when Logs tab is activated
  • Frontend: Consistent with existing dark/light theme

Files to Modify

File Description
crates/hero_proc_lib/src/db/logs/mod.rs Add list_sources SQL function
crates/hero_proc_lib/src/db/factory.rs Add list_sources to LoggingApi
crates/hero_proc_server/src/rpc/log.rs Add handle_sources RPC handler
crates/hero_proc_server/src/rpc/mod.rs Add logs.sources route
crates/hero_proc_server/src/web.rs Add param mapping
crates/hero_proc_ui/templates/index.html Restructure Logs tab with tree sidebar
crates/hero_proc_ui/static/js/dashboard.js Tree building, rendering, multi-select, filtering
crates/hero_proc_ui/static/css/dashboard.css Tree panel styles

Implementation Steps

  1. DB layer: Add list_sources function (SQL query)
  2. Factory API: Expose via LoggingApi
  3. RPC + routing: Add logs.sources handler + route + param mapping
  4. HTML: Restructure Logs tab with tree sidebar panel
  5. CSS: Add tree panel styles
  6. JavaScript: Tree building, rendering, multi-select logic, filtering integration
  7. Tab activation: Refresh source tree on Logs tab switch

Acceptance Criteria

  • logs.sources RPC returns sorted, deduplicated, lowercased source list
  • Tree sidebar displays hierarchical sources using . separator
  • Alphabetical sort at every level
  • Parent checkbox selects/deselects all children
  • Child checkbox updates parent state (checked/unchecked/indeterminate)
  • Multi-select filters log query results
  • "All" and "None" bulk select buttons work
  • Tree nodes collapsible/expandable
  • Dark/light theme consistent
  • Existing log filters (level, error-only, limit) still work alongside
## Implementation Spec for Issue #13 — Log Source Tree View ### Objective Add a hierarchical tree view of all log sources to the Logs tab in the hero_proc dashboard. Sources use dot-separated notation (e.g., `nginx.main`, `myservice.myjob`). The tree allows multi-select at any level to filter log output, making it easy to zoom into relevant logs. ### Requirements - **Backend**: Add a new RPC method `logs.sources` that returns all distinct `src` values from the `logs` table, always lowercased and ASCII - **Backend**: Query: `SELECT DISTINCT LOWER(src) FROM logs WHERE src != '' ORDER BY src` - **Frontend**: Build distinct sources into a tree structure using `.` as separator - **Frontend**: Display tree in a collapsible sidebar panel on the left side of the Logs tab - **Frontend**: Sort all nodes alphabetically at every level - **Frontend**: Multi-select via checkboxes at both parent and leaf levels (selecting parent selects all children; deselecting child shows indeterminate parent) - **Frontend**: Selected sources filter the log query - **Frontend**: Auto-refresh source list when Logs tab is activated - **Frontend**: Consistent with existing dark/light theme ### Files to Modify | File | Description | |------|-------------| | `crates/hero_proc_lib/src/db/logs/mod.rs` | Add `list_sources` SQL function | | `crates/hero_proc_lib/src/db/factory.rs` | Add `list_sources` to LoggingApi | | `crates/hero_proc_server/src/rpc/log.rs` | Add `handle_sources` RPC handler | | `crates/hero_proc_server/src/rpc/mod.rs` | Add `logs.sources` route | | `crates/hero_proc_server/src/web.rs` | Add param mapping | | `crates/hero_proc_ui/templates/index.html` | Restructure Logs tab with tree sidebar | | `crates/hero_proc_ui/static/js/dashboard.js` | Tree building, rendering, multi-select, filtering | | `crates/hero_proc_ui/static/css/dashboard.css` | Tree panel styles | ### Implementation Steps 1. **DB layer**: Add `list_sources` function (SQL query) 2. **Factory API**: Expose via `LoggingApi` 3. **RPC + routing**: Add `logs.sources` handler + route + param mapping 4. **HTML**: Restructure Logs tab with tree sidebar panel 5. **CSS**: Add tree panel styles 6. **JavaScript**: Tree building, rendering, multi-select logic, filtering integration 7. **Tab activation**: Refresh source tree on Logs tab switch ### Acceptance Criteria - [ ] `logs.sources` RPC returns sorted, deduplicated, lowercased source list - [ ] Tree sidebar displays hierarchical sources using `.` separator - [ ] Alphabetical sort at every level - [ ] Parent checkbox selects/deselects all children - [ ] Child checkbox updates parent state (checked/unchecked/indeterminate) - [ ] Multi-select filters log query results - [ ] "All" and "None" bulk select buttons work - [ ] Tree nodes collapsible/expandable - [ ] Dark/light theme consistent - [ ] Existing log filters (level, error-only, limit) still work alongside
Author
Owner

Build & Test Results

  • Build: Passed (all crates compiled successfully)
  • Tests: All passed (0 failures)
  • Warnings: 1 pre-existing warning (unused shell_escape function in integration test fixtures)

Changes Summary

  • hero_proc_lib: Added list_sources() DB function + factory method
  • hero_proc_server: Added logs.sources RPC handler + route
  • hero_proc_ui: Added source tree sidebar with HTML, CSS, and JavaScript
## Build & Test Results - **Build**: ✅ Passed (all crates compiled successfully) - **Tests**: ✅ All passed (0 failures) - **Warnings**: 1 pre-existing warning (unused `shell_escape` function in integration test fixtures) ### Changes Summary - `hero_proc_lib`: Added `list_sources()` DB function + factory method - `hero_proc_server`: Added `logs.sources` RPC handler + route - `hero_proc_ui`: Added source tree sidebar with HTML, CSS, and JavaScript
Author
Owner

Implementation committed: fab276c

Browse: fab276c

Implementation committed: `fab276c` Browse: https://forge.ourworld.tf/lhumina_code/hero_proc/commit/fab276c
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_proc#13
No description provided.