feat(table): EnhancedTable align style - #2118
Conversation
EnhancedTable:继承 antd TableProps 全透传,传 rowActions 即自动生成固定右侧「操作」列(inline 放出文字链接 / menu 收进三点,danger 自动分割线+危险色)。视觉基线另走全局 theme/table.less。 样板表 taskTpl(/job-tpls):操作列由 4 个内联 Link 改为 EnhancedTable 声明式 —— 立即执行放出、编辑/克隆/删除收进三点。迁移≈改标签名 + 一段 rowActions 配置。 Co-Authored-By: Claude Opus 4.8 <[email protected]>
- 移植共享 Tags 组件(components/TableTags/Tags,自适应 +N Popover)+ tags_popover_title i18n。 - taskTpl 取 0517 整表设计:标题列聚合(主标题+ID/业务组两行)、标签列 Tags(outline)、创建人两行、更新时间两行。 - 操作列改用 EnhancedTable 声明式 rowActions(立即执行放出、编辑/克隆/删除收三点)。 Co-Authored-By: Claude Opus 4.8 <[email protected]>
只抽象「几乎每张表都一样」的 date/user/tags 三种列;标题等差异大的列继续手写。助手返回标准 antd column,可在同一 columns 数组里与手写列任意混用、任意覆盖。taskTpl 的 tags/创建人/时间三列由手写 render 改为助手调用(标题保持手写)。 Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds EnhancedTable, Tags, EllipsisText, shared column helpers, styles, locale keys, and migrates many list pages from antd Table to EnhancedTable with centralized rowActions/actionColumn and standardized columns. ChangesEnhancedTable Core Framework
Theme, visuals, and small control changes
Pages migrated to EnhancedTable (representative list)
Estimated code review effort 🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related PRs
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Add RowAction.icon (lucide map); menu items render icon+text, inline stays text-only. taskTpl: edit/copy/delete icons. Co-Authored-By: Claude Opus 4.8 <[email protected]>
- taskTpl 卡片(fc-border rounded-lg p-4 flex:1) 加 overflow-y:auto,内容超高时卡片内滚动,圆角边框始终包住分页(不再溢出底边)。通用写法,铺开时统一处理。 - EnhancedTable 操作列单元格 justify-content flex-end→flex-start,与左对齐的「操作」表头对齐。 Co-Authored-By: Claude Opus 4.8 <[email protected]>
- Table -> EnhancedTable; operation column -> declarative rowActions (clone + delete in kebab menu, delete danger) - datasource_ids: @/components/Tags -> rich @/components/TableTags/Tags (width=70 -> maxWidth=120, auto-fit +N popover) - update_at -> dateColumn (two-line date/time) - keep hand-written: group_id, note, cate logo, tag-expr column, cause, time(expired/periodic), update_by, enabled switch Co-Authored-By: Claude Opus 4.8 <[email protected]>
Ported back the global table baseline that was lost when 0601 was rebuilt from main (the file the EnhancedTable comment already references): - fixed-column bleed fix: opaque bg (--fc-fill-2 / hover --fc-fill-2-5) + z-index layering on .ant-table-cell-fix-*; overrides n9e's translucent row-hover bg (rgb(var(--fc-fill-5-rgb)/0.2)) which caused scrolled content to bleed through fixed columns. Covers light + dark, no !important. - design-system sort/filter icons (lucide masks), non-gold; gold theme keeps its own sorter icons. - import wired in theme/index.less; removed the now-superseded antd caret sorter block from App.less (matches 0517). Verified on /alert-mutes: compiles, fixed cell opaque on hover+scroll (z-index 6/7/8 applied), no bleed. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…obal sorter icon restyle The 0517 sort/filter icon restyle (hover-expands sorter 0->24px) is a global rule; on un-migrated auto-width tables (e.g. /alert-rules) it makes the sortable header width jump on hover (118px->164px). That restyle isn't needed for the fixed-column bleed fix, so keep only the fixed-column block and restore App.less's default antd caret sorter. Sort/filter icon baseline deferred to a dedicated step (to be scoped to .fc-enhanced-table or applied per-table with reserved widths). Co-Authored-By: Claude Opus 4.8 <[email protected]>
The 标签 column rendered filter expressions as plain divs; switch to the
shared Tags component (outline, maxWidth 180), mapping each {key,func,value}
to a tag pill — matches jser's 0517 shield table.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Mirror jser's 0517 restructure of the alert-rules table: - 状态: bare icon -> filled-color pill (Tags fill, red/green, lucide icon), clickable -> events drawer - 名称: fold 业务组 column into name as a second (soft) line - 数据源: fold 类型(cate) logo inline + rich Tags (outline, +N) - 级别: rich Tags fill with S1/S2/S3 color map - 附加标签 / 通知对象 / 通知规则: rich Tags (outline) - 更新时间: dateColumn (two-line date/time) - 用户名: userColumn (two-line user+nickname), drop separate 昵称 column - 操作: inline links -> EnhancedTable rowActions kebab (clone / brain conditional / delete danger) - constants.ts: column-config updated (drop cate + update_by_nickname, reorder datasource_ids after severities) - add status_triggered / status_normal / notify_rule_not_found i18n (5 locales) Co-Authored-By: Claude Opus 4.8 <[email protected]>
…able Add the design-system table-style-preview sort entry (ArrowUpDown / ArrowUp / ArrowDown lucide masks) to sortable headers, but ONLY within .fc-enhanced-table (migrated tables); un-migrated tables keep App.less default antd carets. Jitter-free unlike the earlier global attempt: the icon hit-area reserves a constant 24px width and toggles only opacity (0 idle -> 1 on header hover or when sorted), so sortable column widths never shift on hover. Verified on /alert-rules 更新时间: width 100px idle == 100px sorted. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Fix three mismatches vs table-style-preview: - snug to text: style .ant-table-column-sorters (inline-flex, gap 6px) and .ant-table-column-title (no grow) so the icon sits right after the header text instead of floating to the column's right edge - icon glyph: use the preview's exact lucide paths (24-viewBox, stroke-2) for ArrowUpDown/ArrowUp/ArrowDown instead of the 0517 14-viewBox variant - hover/active background: ghost-quaternary-xs states — hover fill-5/0.4 + text-2, active fill-5/0.7 + text-1, sorted text-3 (transparent), sorted+hover fill-5/0.4 Still scoped to .fc-enhanced-table, 24px hit-area + opacity-only (no jitter). Co-Authored-By: Claude Opus 4.8 <[email protected]>
…tem) Two preview mismatches reported: - hovering a sortable column header showed no background -> add thead th:hover background rgb(var(--fc-fill-5-rgb)/0.4) (design-system thead th:hover) and the sorted-column background (.ant-table-column-sort, = preview th:has(.is-sorted)) - the sort icon's own hover box looked like a lone floating rect because the column-header highlight was missing; with the header bg present it nests correctly, matching the preview Scoped to .fc-enhanced-table; excludes fixed-column headers so the translucent hover bg can't re-introduce the fixed-column bleed. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Correct the header-bg behavior to match design-system preview + spec: - hover ANY column header (incl. non-sortable) -> fill-5/0.4. antd v4 only applies hover bg to sortable headers (@table-header-sort-active-bg) and has no token for arbitrary-header hover, so this is CSS (scoped, excludes fixed cols to avoid bleed). - sorted column gets NO extra background: rely on antd token @table-header-sort-bg = var(--fc-fill-2-5) (== header bg, invisible); removed my earlier wrong override that painted sorted columns fill-5/0.4. Research note: table colors are already antd-v4 tokens via vite.config.ts modifyVars (table-header-sort-active-bg / -sort-bg / row-hover-bg / etc.); only the no-token gaps stay in CSS. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Change antd-v4 token table-header-sort-bg from var(--fc-fill-2-5) (invisible) to rgb(var(--fc-fill-5-rgb)/0.4) so sorted column headers are visually distinguished (aligns design-system th:has(.is-sorted)). Token layer, not CSS; applies on dev-server restart (vite modifyVars read at startup). Co-Authored-By: Claude Opus 4.8 <[email protected]>
- Table -> EnhancedTable; declarative rowActions: inline 执行记录 link + kebab (clone/edit/delete danger), matching 0517 收/放. - use_case/trigger_mode -> outline Tags; disabled -> green/red fill pill. - teams/update_by/update_at -> tagsColumn/userColumn/dateColumn helpers. - surface use_case + trigger_mode filters (align 0517; uses pre-existing fields + locale keys, no new strings). Co-Authored-By: Claude Opus 4.8 <[email protected]>
…e column
- New reusable EllipsisText: single-line truncate (no wrap), full text in a
tooltip on hover, shown only when actually overflowing (lazy measure on hover
via controlled Tooltip).
- Apply to event-pipelines 备注 column with ellipsis:{showTitle:false}, which
flips antd to fixed table-layout so the cell is bounded and truncation engages.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
- antd v4 Tooltip color + overlayInnerStyle (no global CSS, scoped to this tooltip): background var(--fc-fill-2), text var(--fc-text-1), border var(--fc-border-color). Tokens auto-flip, so dark mode renders a dark surface + light text. color also drives the arrow (--antd-arrow-bg). Co-Authored-By: Claude Opus 4.8 <[email protected]>
- Table -> EnhancedTable; keep the two header filters (type + status funnels) and sorters untouched. - Operations collapse into rowActions kebab: enable/disable (settings), cloudwatch label-mapping (conditional), delete (danger, only when disabled). - Extend RowAction with optional node: render a custom menu item as-is (used for the cloudwatch LabelMapping parcel button). text now optional. - enable/disable uses Modal.confirm (rowActions has no Popconfirm slot; same UX as delete). Co-Authored-By: Claude Opus 4.8 <[email protected]>
- table-body-sort-bg -> transparent: sorted column body cells no longer get a per-column tint (only the header tints; body follows row hover/selection), matching the design-system table spec. Fixes the inconsistency where a default-sorted column looked different from the rest. - Filter funnel: swap antd's solid funnel for the design-system lucide Funnel (14px mask), 24px ghost hit-area, hidden until header-hover/open/filtered, violet-9 when filtered; scoped to .fc-enhanced-table. - Move the funnel next to the sort icon (filter-column flex-start) instead of antd's far-right space-between. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…ign 0517)
Sweep of all remaining fe list tables jser reworked in 0517, mapped to the
0601 abstractions: Table -> EnhancedTable, operations column -> declarative
rowActions (inline 收/放 + kebab menu, danger delete, conditional via _.compact,
bespoke items via node), column helpers (tags/user/date) where shapes match,
note/description columns -> EllipsisText + ellipsis:{showTitle:false}.
Done via multi-agent workflow (one agent per file, each aligned to its 0517
reference). No shared components / theme / global locale touched. tsc clean.
Files: aiConfig (agents/llmConfigs/mcpServers/skills), alertCurEvent, builtIn
(AlertRules/CollectTpls/Dashboards/Metrics), contacts (+component +help), dashboard,
embeddedProduct, event, historyEvents, log/IndexPatterns, metricsBuiltin,
notificationChannels (List/ListNG), notificationRules, recordingRules, task
(index/result), user (business/groups/users), variableConfigs, warning/subscribe.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Root cause: a disabled <Button> wrapped in <Tooltip> (the node hack used for
llm-configs/mcp-servers delete) makes antd move the button's className onto a
compat <span>, so .fc-table-action-menu-btn/.is-danger fell off -> delete
rendered with antd default styling (grey rgba, 12px pad, no danger color,
misaligned vs edit) and the tooltip never fired on the disabled button.
- EnhancedTable: add RowAction.tooltip; render tooltip items as
<Tooltip><span>{button}</span></Tooltip> with the Menu.Item left enabled, so
the hint shows even when the button is disabled and the button keeps its classes.
- llm-configs/mcp-servers: drop the node hack -> plain {icon:'delete',danger,
disabled,tooltip} item (aligned, danger-colored, working hint).
- agents/notification-channels ListNG: restore the dropped disable hints via tooltip.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
- Add size='small' to the 启用 Switch in contacts/List, help Channels, help Contacts (were default-size, bigger than every other table; pre-existing, surfaced during redesign review). - Metrics clone/edit menu items: bare <a> (no icon, misaligned) -> styled fc-table-action-menu-btn Button with lucide Copy/Pencil, matching other kebab items. FormModal's own wrapper handles the open click, so the trigger swap is safe. Co-Authored-By: Claude Opus 4.8 <[email protected]>
The 0517 redesign added an eventColumnExpanded toggle (collapse the event_name tags to the first 3 + a +N more-tag, expand to show all). The EnhancedTable sweep dropped it on this table (the agent deemed it out-of-scope). Restore it, aligning with 0517: - AlertTable: eventColumnExpanded prop; tags.slice(0,3) + alert-event-more-tag when collapsed; alert-event-tags is-expanded/is-collapsed classes. - List/index: eventColumnExpanded state + toolbar toggle (ListChevrons icons, common:btn.expand/collapse) passed to AlertTable. - style.less: alert-event-summary-toolbar/-expand-btn/-content/-title/-tags. Co-Authored-By: Claude Opus 4.8 <[email protected]>
- raise sorter z-index above .ant-table-column-sorters so hover reaches it - re-assert sorter color over antd's hover-grey rule; add hover pill like the funnel - bump default-arrow stroke-width to 2.4 and tighten sort/filter icon viewBoxes Co-Authored-By: Claude Opus 4.8 <[email protected]>
…filter funnel spacing - white-space:nowrap on .ant-table-column-title so non-ellipsis CJK headers (更新人/启用/周期) don't wrap char-by-char under sort/filter icons - shrink .ant-table-filter-column .ant-table-column-sorters to flex:0 1 auto so the funnel sits right after the sort icon instead of overflowing/clipped
- 公共 Tags 组件新增 maxCount prop:设置后只展示前 N 个 + 溢出弹层(与按宽度自适应互斥),用于和旧的「前 N 个 + N」逻辑对齐 - 告警事件 AlertTable 标签列收起态改用 Tags maxCount=3,替换原手写 slice(0,3)+纯 +N: - +N 获得悬浮弹层(展示全部标签 + 复制按钮),原手写版无任何 hover - maxCount=3 对齐原展示,且只渲染 3 个标签避免 +N 溢到右侧固定列后面 - 展开态仍内联铺开全部标签;单击标签加入筛选 Co-Authored-By: Claude Opus 4.8 <[email protected]>
Consolidate userColumn/updateByColumn to use ternary render, and dateColumn to single-line format with narrower default width. Remove redundant width override in ListNG.
- Add popoverTitle prop for custom popover header content - Improve popover content layout with horizontal flex wrap - Increase Tags maxWidth to 360 in AlertRules list - Unify tags_popover_title locale entries across all languages
- Add hideLabel prop to Tags component for icon-only display mode - Apply hideLabel to alert status column in ListNG - Sort severity data by severity before rendering
…d columns Centralize date column sorting in dateColumn via getColumnValue, so callers no longer need to pass inline sorters. Also remove unused update_by_nickname from dashboard column configs, conditionally hide business group column when businessGroup is leaf, and increase tags maxWidth to 360.
Sync fe up to main (62 commits) so it aligns with the current plus/srm-fe (which already track main). Resolves the cross-repo skew that broke integrated builds. Conflicts in src/pages/task/result.tsx and src/pages/taskTpl/index.tsx resolved by taking main's version (main refactored these into ResultContent / changed taskTpl columns). The EnhancedTable migration for these 2 pages will be re-applied on top of main as a follow-up. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Re-applies the EnhancedTable migration on top of main for the two task pages whose migration was dropped during the main merge (resolved as take-main). - ResultContent: host table -> EnhancedTable; ignore/redo/kill move to declarative rowActions menu (shown only while task is running). - taskTpl: -> EnhancedTable; create inline + edit/clone/delete in kebab; two-line title (id/group), tags/user/date helper columns; min-w-0 on the flex container. Preserves main's gid= URL params on all links. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…hancedTable 排序点击数据源等列时 rowSpan 合并错乱:row_span_map 按接口返回顺序算好一次, 本地 sorter 重排后未重算。改为受控排序(sorter:true + sortOrder + onChange), 先排序再 convertDataToRowSpan 重算合并,并迁移到 EnhancedTable 做视觉对齐。 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…drag 拖拽排序时三点操作列浮起脱离行:EnhancedTable 操作列默认 fixed:'right', 其 sticky 单元格在 react-sortable-hoc 的拖拽克隆行里相对视口定位而脱离。 本表无横向滚动,操作列设 fixed:false 即可随行移动。 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
裸 <Tag>+把数组当 children 的 <Tooltip> 挂不上 hover 事件,溢出时只剩 ~1s 延迟的浏览器原生 title。改走 @/components/TableTags/Tags,拿到即时 +N Popover;host_tags/tags 保留点击加入搜索,group_obj 保留空态。 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
集成构建 build_9000_of_106 把 srm-fe 的 Packages 并入 n9e-fe 后用 fe 的 @/components/EnhancedTable 编译,故 srm-fe 用 compactHeader 的子表在集成 构建里报 TS2322(fe 侧 EnhancedTableProps 无该 prop)。这里把同样的 compactHeader 改动补到 fe 的 types/组件/style.less。 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…fixed width - tagsColumn: remove hardcoded width 280, let caller or default control it - userColumn/updateByColumn: flatten render to inline ternary, show nickname or primary value exclusively instead of stacking both
# Conflicts: # src/pages/datasource/components/TableSource/index.tsx # src/pages/notificationRules/pages/List.tsx # src/pages/recordingRules/PageTable.tsx
背景
table改为从 main 重开,按统一架构重做。** 旧 PR(#2102 等)已关闭。
方案
TableProps全透传(rowSelection/scroll/components…);传rowActions即自动生成固定右侧「操作」列(inline 放出文字 / menu 收三点,danger 自动分割线+危险色)。迁移≈把<Table>改名为<EnhancedTable>。EnhancedTable/columns):tagsColumn/userColumn/dateColumn—— 只抽「几乎每张表都一样」的三种列,返回标准 antd column,可与手写列任意混用、任意覆盖;标题等差异大的列继续手写。+NPopover 的Tags组件。theme/table.less—— 排序/筛选图标、固定列穿透修复、gold 主题排除。已完成
tags_popover_titlei18n。进行中(draft)
theme/table.less视觉基线。🤖 Generated with Claude Code
Summary by CodeRabbit