Skip to content

feat(panorama): resizable side panel, compact item lists with per-item fold and filter, relative ages on timestamps - #92

Merged
LiminCode merged 1 commit into
mainfrom
detail-pane
Nov 20, 2026
Merged

LiminCode merged 1 commit into
mainfrom
detail-pane

Conversation

@LiminCode

Copy link
Copy Markdown
Owner

Summary

Four things the user asked for after reading a 32-connector list in the panorama's side panel: the panel can now be resized (a drag handle between the map and the panel, double-click resets), every tile's item list is compact by default with a per-item ▸ to expand its details plus "expand all / collapse all", lists longer than five items get a filter box, and timestamps such as "上次探测" are followed by a relative age ("· 3 小时前"). Everything is generic over "a tile with items" (ADR 0014: the page still knows no feature); the connector tiles are just the longest lists. The width and the expand-all preference live in the browser's localStorage only. Design memo: .scratch/config-panorama/detail-pane-design.md (local).

What changed and why

  • pet/panorama/page/shell.html, app.css: #gutter between .stage and <aside>; the grid's third column is var(--aside-w, 380px); the handle lights up on hover/drag and is hidden in the single-column layout (≤ 1280 px). List rows are .item → .row + dl.more[hidden]; .ltools (count, filter, expand button), .fold chevron, .ago.
  • pet/panorama/page/interact.js: detail() renders the compact list (fold button per item with more, aria-expanded, hidden on the details), the tools row, and when() which appends the relative age to fact and detail values. Expanded keys (tile id + item name), per-tile filter text and the expand-all flag live in module scope so a redraw keeps them; filtering only toggles hidden (no redraw, focus stays). The handle: pointer drag sets --aside-w (clamped), release persists it, double-click resets to 380, fit() rescales the map.
  • pet/panorama/page/util.js: pure ago(value, strings, now), rowMatches(row, query), clampAside(px).
  • pet/panorama/render.py: nine new page strings in PAGE_KEYS; pet/locale/zh.json, en.json.
  • Docs: docs/config-panorama.md ("连接器详情" gains "详情栏的列表怎么摆"), CHANGELOG.md.
  • Tests: tests/test_panorama_page.py (+4: compact list / fold / count / filter box only when long / placeholder for items without details; relative age on a fact; the three helpers; shell and CSS carry the handle), and the storage-tile test now expects the details folded.

Performance

  • Rendering a detail is the same single innerHTML as before plus one regex per fact/detail value (ago); 19 items with details: unmeasurable against the existing draw. Filtering touches only the .item elements' hidden.
  • Drag: one setProperty + fit() per pointermove (the same fit() the window resize already runs). No timers, no requests; two localStorage keys.
  • Assets: interact.js +2.6 KB, app.css +0.9 KB, util.js +1.0 KB (all also in the offline snapshot bundle).

Real-machine run

Standalone PanoramaService from this branch over the real config (real probes), page opened in the built-in browser at 1500 × 900:

  • Grid columns 1052.8px 8px 380px, handle present with its tooltip.
  • WSL connectors tile (conn_w_rest, 19 items): 19 .item, 19 details hidden, 19 fold buttons, "19 条", filter box present, button "全部展开"; "上次探测" showed "2026-11-20 00:16:47 · 刚刚" (the round had just run). Clicking the first ▸ → "▾" and its details visible, their timestamp values also carry the age. Typing "atlassian" in the filter → 1 visible item (Atlassian), 18 hidden.
  • Dragging the handle 200 px left → panel 606 px, localStorage["panorama-aside"] = "606", map rescaled; double-click → 380 and stored.
  • No console errors. The pet is restarted from main after the merge.

Tests

Red first: the four new tests failed on main (no .item / data-toggle / .lcount, no ago export, no handle in the shell); the storage-tile test flipped its expectation. tests/test_panorama*.py, test_i18n.py, test_architecture.py: all passed (see the family run); ruff check pet tests and git diff --check clean. Full suite not run: page-only change, no config, lifecycle or threading change.

Docs

  • CHANGELOG.md: one line (user-visible change)
  • Topic doc under docs/ updated (config-panorama.md)
  • ADR: not needed

🤖 Generated with Claude Code

- shell.html / app.css:两列之间加把手 #gutter,右栏宽度走 --aside-w(300–720,默认 380);窄屏单栏时把手藏起
- interact.js:拖把手改宽度、松手存 localStorage、双击复原,地图跟着 fit();列表每条一个 .item(行 + 折着的 dl.more),
  ▸ / ▾ 逐条展开,展开状态按「磁贴 + 条目」记在模块里(重画不丢);工具条:条数、筛选框(> 5 条)、全部展开 / 收起(存 localStorage);
  筛选只改 hidden、不重画;事实和 more 里长得像时间的值后面补「· N 分钟 / 小时 / 天前」
- util.js:ago / rowMatches / clampAside 三个纯函数;render.PAGE_KEYS + 字表;docs/config-panorama;CHANGELOG

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@LiminCode
LiminCode merged commit 88a0cae into main Nov 20, 2026
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant