Proposal: chip-bar filter UI for /devices — working prototype in production #968
Replies: 2 comments
-
|
This is excellent work, and the fact that it's already running default-on against a ~190-device fleet is the best possible argument for it. Yes — I want this upstream. Answers to your three questions, plus one correction to a framing in your write-up. Q1 — yes, want it. Take it in two bites, not one. The reason is tenant isolation, not size. Everything except the saved-filter sharing layer builds directly on infrastructure already in
So the chip bar + quick-add + 3 virtual fields + software multi-select are a UI layer plus a few additive Defer the saved-filter sharing system to its own PR (your PR 3). Q2 — keep One correction so we're aligned on scale. Your write-up says the filter flows through the Q3 — design changes: only the split above. Keep the EXISTS fields, but add the partial indexes they imply in the same migration so they stay cheap as fleets grow. Verified the column names against CREATE INDEX IF NOT EXISTS idx_device_patches_pending
ON device_patches (device_id) WHERE status = 'pending';
CREATE INDEX IF NOT EXISTS idx_alerts_active_critical
ON alerts (device_id) WHERE status = 'active' AND severity = 'critical';
CREATE INDEX IF NOT EXISTS idx_patch_job_results_reboot_pending
ON patch_job_results (device_id) WHERE reboot_required = true AND rebooted_at IS NULL;Otherwise the design is sound. Go ahead and open PR 1 (api) against |
Beta Was this translation helpful? Give feedback.
-
|
Shipped. The chip-bar filter UI landed across two PRs: #1012 (the device-filter engine + |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Over the last couple of days I built and shipped (to my own self-hosted instance) a chip-bar filter UI for the Devices page. Posting it here because it works very well on real fleet data and I'd like to know whether you're interested in a PR.
What's in it
patches.pending— EXISTS indevice_patcheswithstatus='pending'alerts.critical— EXISTS inalertswithstatus='active' AND severity='critical'system.rebootRequired— EXISTS inpatch_job_resultswithreboot_required=true AND rebooted_at IS NULLsoftwareInventoryEXISTS subquery and a fleet-wide picker (GET /devices/software/distinct returns the distinct list scoped to the caller's accessible orgs)count + sample hostnameswhile you build, before applying (POST /devices/filter-preview returns{count, sampleHostnames, matchingIds[]})Compatibility with the All-orgs toggle
The new filter-preview fetch passes
skipOrgIdInjection: orgScope === 'all'to the api auth helper, so the chip-bar filter respects the existing Current-org / All-orgs scope toggle fromDevicesPage.tsx. Filter results flow through the samescopedDevicesmemo so client-side scope filtering stays consistent.Scope
saved_filter_folders,saved_filter_stars, plus columns onsaved_filters(scope, folder_id, last_used_at, use_count, icon, color). Idempotent, no destructive ALTERs.filterEngine.tsgains a small handler block for the 3 virtual EXISTS fields + software multi-select; existing field handling unchangedTest coverage
tscclean, webastro checkclean (0 errors, 0 warnings)Status
Deployed to my self-hosted instance — running on a fork branch off
vps-deploy-2026-05-21, with the filter feature initially gated by?filtersV2=1for safe rollout and now flipped default-on (opt-out via?filtersV2=0). ~190 device fleet, working as expected including the AllOrgs / Current-org toggle integration.Screenshots:
Chip bar with the software multi-select picker open:
Chip bar with three active conditions (
Has Software,Organization,Status) composed together; quick-add toggles below:Advanced view with several options selected:
Open questions
main. Most likely path is to split it into 2-3 small PRs (api routes + service, schema migration, web UI) for review clarity.filtersV2flag — keep it as an opt-in for some release window, or just replace the existing DeviceFilterBar?Happy to walk through the design on a call or open the PR(s) for review. Code is in the worktree
feat/vps-filter-porton my fork; can rebase onto main on request.Beta Was this translation helpful? Give feedback.
All reactions