adding stats cards to devices page #2698
No reviewers
Labels
No labels
1week
2weeks
Failed compliance check
IP cameras
NATS
Possible security concern
Review effort 1/5
Review effort 2/5
Review effort 3/5
Review effort 4/5
Review effort 5/5
UI
aardvark
accessibility
amd64
api
arm64
auth
back-end
bgp
blog
bug
build
checkers
ci-cd
cleanup
cnpg
codex
core
dependencies
device-management
documentation
duplicate
dusk
ebpf
enhancement
eta 1d
eta 1hr
eta 3d
eta 3hr
feature
fieldsurvey
github_actions
go
good first issue
help wanted
invalid
javascript
k8s
log-collector
mapper
mtr
needs-triage
netflow
network-sweep
observability
oracle
otel
plug-in
proton
python
question
reddit
redhat
research
rperf
rperf-checker
rust
sdk
security
serviceradar-agent
serviceradar-agent-gateway
serviceradar-web
serviceradar-web-ng
siem
snmp
sysmon
topology
ubiquiti
wasm
wontfix
zen-engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
carverauto/serviceradar!2698
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refs/pull/2698/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from GitHub pull request.
Original GitHub pull request: #2352
Original author: @mfreeman451
Original URL: https://github.com/carverauto/serviceradar/pull/2352
Original created: 2026-01-18T17:35:31Z
Original updated: 2026-01-18T19:36:59Z
Original head: carverauto/serviceradar:2252-feat-stats-cards-on-devices-ui-dashboard
Original base: staging
Original merged: 2026-01-18T19:36:58Z by @mfreeman451
User description
IMPORTANT: Please sign the Developer Certificate of Origin
Thank you for your contribution to ServiceRadar. Please note, when contributing, the developer must include
a DCO sign-off statement indicating the DCO acceptance in one commit message. Here
is an example DCO Signed-off-by line in a commit message:
Describe your changes
Issue ticket number and link
Code checklist before requesting a review
PR Type
Enhancement
Description
Add SRQL GROUP BY support for device stats queries (type, vendor_name, risk_level, is_available, gateway_id)
Implement device stats cards component displaying total, available, unavailable, and distribution metrics
Load stats asynchronously via parallel SRQL queries with skeleton loading state
Make stats cards clickable to filter devices table by availability and other dimensions
Diagram Walkthrough
File Walkthrough
3 files
Add GROUP BY clause parsing to stats syntaxImplement grouped stats queries with raw SQLAdd stats cards component and async loading1 files
Add tests for devices GROUP BY queries1 files
Define stats_fields for device grouping5 files
Document feature proposal and scopeDetail implementation decisions and patternsDefine device dashboard stats requirementsDefine SRQL GROUP BY query requirementsTrack implementation tasks and checklistImported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/2352#issuecomment-3765530224
Original created: 2026-01-18T17:36:10Z
PR Compliance Guide 🔍
Below is a summary of compliance checks for this PR:
No security concerns identified
No security vulnerabilities detected by AI analysis. Human verification advised for critical code.🎫 #2252
(available/unavailable), and breakdown by vendor (and similar breakdowns such as
type/risk).
core-elxkicking off migrations) to support any needed DBchanges.
implementation appears to query
ocsf_devicesdirectly rather than querying CAGGs).queries but appears to wait for completion before rendering non-loading state).
Codebase context is not defined
Follow the guide to enable codebase context checks.
Generic: Comprehensive Audit Trails
Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.
Status: Passed
Generic: Meaningful Naming and Self-Documenting Code
Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting
Status: Passed
Generic: Secure Error Handling
Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.
Status: Passed
Generic: Secure Logging Practices
Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.
Status: Passed
Generic: Security-First Input Validation and Data Handling
Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities
Status: Passed
Generic: Robust Error Handling and Edge Case Management
Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation
Status:
Silent stats failure:
load_device_stats/2rescues all exceptions and returns zero/empty stats without logging orexposing actionable context, making failures invisible and hard to debug.
Referred Code
Compliance status legend
🟢 - Fully Compliant🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label
Imported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/2352#issuecomment-3765531338
Original created: 2026-01-18T17:37:30Z
PR Code Suggestions ✨
Explore these optional code suggestions:
Refactor SRQL parser for GROUP BY
Refactor the SRQL parser to handle the
GROUP BYclause structurally. Thisinvolves modifying
parser.rsto populate agroup_fieldinStatsSpec,centralizing parsing logic and removing redundant string parsing from
devices.rs.Examples:
rust/srql/src/parser.rs [261-293]
rust/srql/src/query/devices.rs [272-321]
Solution Walkthrough:
Before:
After:
Suggestion importance[1-10]: 9
__
Why: The suggestion correctly identifies a significant design flaw where parsing logic is duplicated, making the implementation brittle and hard to extend to other entities, thus addressing a key architectural weakness.
Fix incorrect grouped column sorting logic
Fix the grouped column sorting logic by using a substring match instead of an
exact prefix match. This allows sorting by fields like
vendor_nameeven when theSQL uses
COALESCE(vendor_name, 'Unknown').rust/srql/src/query/devices.rs [397-424]
Suggestion importance[1-10]: 8
__
Why: This is a valid bug fix that corrects the sorting logic for grouped queries, ensuring that user-specified sorting on the grouped field works as intended instead of being silently ignored.
Escape quotes in filter link generation
In the
device_breakdown_cardcomponent, escape double quotes within item nameswhen generating filter links. This prevents malformed SRQL queries if an item
name contains a double quote.
web-ng/lib/serviceradar_web_ng_web/live/device_live/index.ex [1275-1328]
Suggestion importance[1-10]: 7
__
Why: This suggestion correctly identifies and fixes a bug where special characters in data would break the generated filter links, improving the robustness of the UI.
Render risk level card
Add a
device_breakdown_cardto display theby_risk_levelstatistics, which arecurrently fetched but not rendered on the device stats dashboard.
web-ng/lib/serviceradar_web_ng_web/live/device_live/index.ex [1247-1263]
Suggestion importance[1-10]: 5
__
Why: This suggestion correctly points out that the fetched
by_risk_leveldata is not being used in the UI. Adding the card completes the feature as described in the PR's design documents.Imported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/2352#issuecomment-3765653531
Original created: 2026-01-18T19:33:11Z
CI Feedback 🧐
(Feedback updated until commit
github.com/carverauto/serviceradar@5728afb674)A test triggered by this PR failed. Here is an AI-generated analysis of the failure:
Action: build
Failed stage: Configure SRQL fixture database for tests [❌]
Failed test name: ""
Failure summary:
The action failed during environment/fixture setup because the required secret
SRQL_TEST_DATABASE_CA_CERTwas not configured.- The log explicitly reports:
SRQL_TEST_DATABASE_CA_CERT secret must be configured to verify SRQL fixture TLS.(around lines636–638).
- The job then exited with code
1, stopping the workflow before any tests could run.Relevant error logs: