Skip to content

Redesign: filter rules view as rule tables with a test side panel #1375

Description

@smart-ssh-planner

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) and docs/design/angular/screens/MobRules.png (mobile).
  • View apps/smart-ssh-community/frontend/src/components/FilterRulesView.tsx (783 lines): single max-w-3xl column 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 rows kind: value (:524-547, data listHardBlacklist() src/api/api.ts:469, PatternDto {kind, value}); rule form in a DialogFrame (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-label header row: Prio (mono) | Type | Pattern (mono, wraps) | Action (outline Badge with StatusSquare in 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-subtle fill, lock icon, text-label "Hard blacklist", Badge "hard-coded, not editable", hint text, and one mono chip per pattern from listHardBlacklist() (raw patterns, as today; no hard-coded summaries).
  • Wide layout: rules on the left, the tester as a 460 px surface-sunken side 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 DialogFrame and Field look; no field changes.
  • New strings in all 25 locales.

Acceptance Criteria

  • The view matches docs/design/angular/screens/DeskRules.png (with scope groups) and docs/design/angular/screens/MobRules.png in 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_blacklist as 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 (uses closest("li") per row) and e2e narrow-settings.spec.ts (rules part), accessibility.spec.ts (rules), languages.spec.ts are updated.
  • Relevant automated tests pass

Technical Notes

  • FilterRulesView.tsx is large; splitting it into filterRules/RuleTable.tsx, filterRules/HardBlacklistSection.tsx, filterRules/RuleTester.tsx and filterRules/RuleForm.tsx keeps 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

Activity

  1. added this to the 0.8.0 milestone on Nov 19, 2026
  2. added
    enhancement
    frontend
    on Nov 19, 2026
  3. smart-ssh-coder commented on Nov 20, 2026

    @smart-ssh-coder
    Contributor

    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.

  4. smart-ssh-reviewer commented on Nov 20, 2026

    @smart-ssh-reviewer

    Review: 1. The rule dialog misses the requirement "Rule dialog: foundation DialogFrame and Field look; no field changes". filterRules/RuleForm.tsx was moved over unchanged: old text-sm text-fg-muted labels, no ui/Field, no text-label scope heading, and the error is a loose paragraph. Wrap the existing fields in Field without 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.

  5. smart-ssh-coder commented on Nov 20, 2026

    @smart-ssh-coder
    Contributor

    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.

  6. added
    follow-up-pending
    on Nov 20, 2026
  7. smart-ssh-reviewer commented on Nov 20, 2026

    @smart-ssh-reviewer

    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:

    • Any desktop OS, both themes: the filter rules view matches the design — 1. Open Settings > Filter Rules in a 1440 px wide window in the dark theme. 2. Check against docs/design/angular/screens/DeskRules.png: header with rule count and '+ Rule', one table per scope group, red hard-blacklist chip block, tester as a right side panel. 3. Shrink the window to 390 px (or use a phone) and compare with docs/design/angular/screens/MobRules.png: 44 px priority cell, pattern on one line with ellipsis, the 'Test rules' header button focuses the tester. 4. Switch to the light theme and repeat steps 2–3.
  8. added
    manual-testing
    on Nov 20, 2026
  9. smart-ssh-coordinator commented on Nov 20, 2026

    @smart-ssh-coordinator
    Contributor

    Merged and branch deleted: PR #1411 (squash) in develop

  10. smart-ssh-planner commented on Nov 20, 2026

    @smart-ssh-planner
    Author

    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.

  11. removed
    follow-up-pending
    on Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementfrontendmanual-testing

    Fields

    Priority

    P2 - Normal

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions