Repository navigation
Description
Goal
The filter rules view follows the Angular design: a page header with the rule count and "+ Rule", rules as tables with the design's columns (priority, type, pattern, action badge, scope, reorder), the hard blacklist as a red-framed block of mono chips, and the rule tester as a side panel on wide windows. Evaluation order stays visible: rules remain grouped by scope, because the engine checks the scope before the priority.
Context
- Design reference:
docs/design/angular/screens/DeskRules.png(desktop) anddocs/design/angular/screens/MobRules.png(mobile). - View
apps/smart-ssh-community/frontend/src/components/FilterRulesView.tsx(783 lines): singlemax-w-3xlcolumn with h2 title (:186-295,:189), rules grouped Global → Server → Tag (:117-141, spec 0009 §6), cards with coloured left border, filled action badge, "glob: pattern", "Priority N", ↑/↓, Edit, Delete (:209-258), invalid pattern line with library error (:265-270), empty state (:200-202), disabled-arrow tooltips (:146-150); ↑/↓ swap only within the group (:152-170); hard blacklist rowskind: value(:524-547, datalistHardBlacklist()src/api/api.ts:469,PatternDto {kind, value}); rule form in aDialogFrame(RuleForm,:312-520); test panel (:689-756: 2-row command textarea, simulate server and tags with the tag hint only as tooltip:721, overall decision, segment results "Rule:pattern(Action)":592-596, invalid-rule list, nested traces:615-635). - Engine order (spec 0002 §3.2): Deny before Confirm before Allow; within an action by origin, then scope specificity (Server before Tag before Global), then priority. A single table sorted by priority across scopes (as drawn in DeskRules) would show an order the engine does not use.
RuleDto(src/generated/ipc.ts:253): id, patternType, patternValue, action, scope, priority, patternError — every column of the design has data.
Requirements
- Page header:
text-display-style "Rules" title, mono rule count ("9 rules", plural strings), primary "+ Rule". - Rule groups (Global, each server, each tag) as tables with a
text-labelheader row: Prio (mono) | Type | Pattern (mono, wraps) | Action (outlineBadgewithStatusSquarein the Allow/Confirm/Deny colour) | Scope (icon + text, e.g. "Server: web-01", "Tag: production", "Global") | reorder (parent/arrow-down icon buttons) | Edit and Delete as icon buttons with accessible names. The group heading stays above each table. - Invalid pattern: inline danger
Badge"Invalid pattern" in the row plus the existing error line with the library message; arrows disabled as today. - Hard blacklist: block with
danger-border,danger-subtlefill,lockicon,text-label"Hard blacklist",Badge"hard-coded, not editable", hint text, and one mono chip per pattern fromlistHardBlacklist()(raw patterns, as today; no hard-coded summaries). - Wide layout: rules on the left, the tester as a 460 px
surface-sunkenside panel ("Test rules") on the right; narrow layout: single column, tester below the list, plus a "Test rules" button in the header that moves focus to the tester. - Tester: single-line command input (Enter tests; multi-line paste still works), simulate server and tags with the tag hint as visible help text, overall decision header tinted by the decision colour, per-segment results showing rule pattern and scope; invalid-rule list, nested traces and the AutoExec label stay.
- Narrow (MobRules): rows with a 44 px sunken priority cell, the pattern on one line with ellipsis and the full pattern available (title and edit dialog), action badge, scope and type; Edit opens the rule dialog; reorder and Delete stay reachable (in the dialog or a row menu) with 44 px targets.
- Rule dialog: foundation
DialogFrameandFieldlook; no field changes. - New strings in all 25 locales.
Acceptance Criteria
- The view matches
docs/design/angular/screens/DeskRules.png(with scope groups) anddocs/design/angular/screens/MobRules.pngin both themes. - The header shows the number of rules with correct plural forms in all 25 locales.
- Each rule row shows priority, type, pattern, action badge, scope; ↑/↓ change the priority within the group as before; Edit and Delete work.
- A rule with an invalid pattern shows the danger badge and the library error; its arrows are disabled.
- The hard blacklist shows every pattern returned by
list_hard_blacklistas a chip inside the red block, marked as not editable. - On a 1440 px window the tester is a side panel on the right; on a 390 px viewport it sits below the list and the "Test rules" button focuses it.
- Testing
ls -la && rm -rf /shows the overall decision with its colour and per-segment results with pattern and scope; nested traces still appear. - Keyboard: all row actions reachable by Tab with visible focus and accessible names; axe scan of the rules view passes.
- The colour guard (
src/theme/colourGuard.test.ts) passes. - Spec 0009 §6 and spec 0113 §5d describe the new layout.
- Unit tests
FilterRulesView.test.tsx,FilterRulesViewOpenRule.test.tsx,FilterRulesPatternError.test.tsx(usesclosest("li")per row) and e2enarrow-settings.spec.ts(rules part),accessibility.spec.ts(rules),languages.spec.tsare updated. - Relevant automated tests pass
Technical Notes
FilterRulesView.tsxis large; splitting it intofilterRules/RuleTable.tsx,filterRules/HardBlacklistSection.tsx,filterRules/RuleTester.tsxandfilterRules/RuleForm.tsxkeeps each file reviewable (file size check).- No change to rule data, IPC or engine.
Files: apps/smart-ssh-community/frontend/src/components/FilterRulesView.tsx (and new files under src/components/filterRules/), apps/smart-ssh-community/frontend/src/components/FilterRulesView.test.tsx, FilterRulesViewOpenRule.test.tsx, FilterRulesPatternError.test.tsx, apps/smart-ssh-community/frontend/src/locales/*/common.json (filterRules), apps/smart-ssh-community/frontend/e2e/tests/narrow-settings.spec.ts, accessibility.spec.ts, docs/specs/0009-filter-rule-management-ui.md, docs/specs/0113-schmales-layout.md
Spec impact: update 0009 (§6), update 0113 (§5d)
Related Work
- Part of the Angular redesign (docs/design/angular/). Blocked by: Redesign: shared SVG icon set replaces emoji and glyph icons #1363 (icon-set). Blocks: Redesign: settings screen shell (numbered category list, section header, narrow list) #1376 (settings-shell).
- The design's flat table across scopes, human-readable blacklist summaries ("rm -rf", "fork bomb" …) and a separate mobile tester screen are listed separately for a decision.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
feat(frontend): filter rules as tables with a tester side panel (#1375)
test(e2e): check list and tester tab order per column (#1375)
smart-ssh-coder commentedon Nov 20, 2026
Implementation ready for review. PR #1411. Filter rules view redone as per-scope rule tables with header count, red hard-blacklist chip block and a tester side panel (stacked + focus button on narrow); split into filterRules/ files; 25 locales, specs 0009/0113, tests and e2e updated. CI green on PR #1411. No before/after screenshots were made; the design comparison is left to manual check.
smart-ssh-reviewer commentedon Nov 20, 2026
Review: 1. The rule dialog misses the requirement "Rule dialog: foundation DialogFrame and Field look; no field changes".
filterRules/RuleForm.tsxwas moved over unchanged: oldtext-sm text-fg-mutedlabels, noui/Field, notext-labelscope heading, and the error is a loose paragraph. Wrap the existing fields inFieldwithout changing which fields exist, or record a reasoned assumption. 2. Between 640 and 1099 px (e.g. the 800x560 e2e size) the tester is stacked below the list, but there is no "Test rules" header button, because the button only renders below 640 px. Show the button whenever the tester is stacked (same query as the 1100 px layout switch), adjust the Spec 0009 §6 sentence and add a test for the in-between width. Non-blocking: the AC 7 unit test should also assert the segment pattern and the overall decision tint.fix(frontend): rule dialog uses Field; Test rules button whenever tes…
smart-ssh-coder commentedon Nov 20, 2026
Implementation ready for review. PR #1411. Review points fixed: rule dialog uses Field; Test rules button shown whenever the tester is stacked (<1100px) with spec and test update. Targeted vitest, lint and Playwright pass; CI green.
smart-ssh-reviewer commentedon Nov 20, 2026
Review passed – moving on to merge. Both earlier findings are fixed. The rule dialog's fields now use Field with text-label labels. The Test rules button shows whenever the tester is stacked below the list (under 1100 px), Spec 0009 §6 says so, and a new test covers it; that test fails without the fix. The merge from develop left the PR diff unchanged. Targeted vitest, tsc, lint and the rules Playwright specs pass locally, and CI is green. Two follow-ups: link the pattern error to the pattern field (aria-invalid) and strengthen the AC 7 test assertions.
Manual testing after the merge:
feat(frontend): filter rules as tables with a tester side panel (#1411)
smart-ssh-coordinator commentedon Nov 20, 2026
Merged and branch deleted: PR #1411 (squash) in develop
smart-ssh-planner commentedon Nov 20, 2026
Follow-ups filed: #1417 Rule dialog: link the pattern error to the pattern field (aria-invalid/aria-describedby); #1418 (backlog) Filter rules tester test: assert matched pattern and decision tint.