Skip to content

refactor(tables): share parent column grid in expandable child rows#1284

Merged
hibig merged 1 commit into
mainfrom
dev
Jul 16, 2026
Merged

refactor(tables): share parent column grid in expandable child rows#1284
hibig merged 1 commit into
mainfrom
dev

Conversation

@hibig

@hibig hibig commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator
  • llmodels/model-routes/cluster child rows use ExpandedRowGrid + Cell (auto-flow spans, no parent-key/grid-line math)
  • define --seal-table-row-min-height token in global.less
  • routes created_at column: span -> fixed width 180

- llmodels/model-routes/cluster child rows use ExpandedRowGrid + Cell
  (auto-flow spans, no parent-key/grid-line math)
- define --seal-table-row-min-height token in global.less
- routes created_at column: span -> fixed width 180
Copilot AI review requested due to automatic review settings July 16, 2026 05:06

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the child row layouts in cluster management, model instances, and model routes to use the new ExpandedRowGrid component, allowing them to dynamically align with their parent table columns instead of relying on hardcoded inline paddings and spans. Feedback focuses on improving TypeScript type safety (such as typing the dataIndex parameter as optional and replacing any with RouteTarget), simplifying fallback status code checks, and cleaning up now-unused variables and calculations related to createTimeSpan in the routes columns hook.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +48 to +60
const spanFor = (dataIndex: string): number => {
switch (dataIndex) {
case 'instance_type':
return Math.max(middleSpan - 3, 1);
case 'image_name':
return 2;
case 'replicas':
return 1;
default:
// name / created_at / operations align 1:1 with their parent column.
return 1;
}
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The dataIndex parameter in spanFor is typed as string, but table columns can have an optional dataIndex (which is typed as string | undefined). To prevent potential TypeScript compilation errors when passing col.dataIndex, update the parameter type to string | undefined (or make it optional).

Suggested change
const spanFor = (dataIndex: string): number => {
switch (dataIndex) {
case 'instance_type':
return Math.max(middleSpan - 3, 1);
case 'image_name':
return 2;
case 'replicas':
return 1;
default:
// name / created_at / operations align 1:1 with their parent column.
return 1;
}
};
const spanFor = (dataIndex?: string): number => {
switch (dataIndex) {
case 'instance_type':
return Math.max(middleSpan - 3, 1);
case 'image_name':
return 2;
case 'replicas':
return 1;
default:
// name / created_at / operations align 1:1 with their parent column.
return 1;
}
};

Comment on lines +39 to 44
interface TargetItemProps extends SharedGrid {
onSelect: (val: any, record: any) => void;
data: any;
sourceModels: any[];
modelList?: Global.BaseOption<number>[];
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Since RouteTarget is imported in this file, we can type the data property in TargetItemProps as RouteTarget instead of any to improve type safety and maintainability.

Suggested change
interface TargetItemProps extends SharedGrid {
onSelect: (val: any, record: any) => void;
data: any;
sourceModels: any[];
modelList?: Global.BaseOption<number>[];
}
interface TargetItemProps extends SharedGrid {
onSelect: (val: any, record: any) => void;
data: RouteTarget;
sourceModels: any[];
modelList?: Global.BaseOption<number>[];
}

Comment on lines +110 to +121
const weightNode =
data.fallback_status_codes && data.fallback_status_codes?.length > 0 ? (
<>
{data.weight > 0 && <span style={{ marginInline: 8 }}>/</span>}
<span>{intl.formatMessage({ id: 'routes.table.label.fallback' })}</span>
</>
) : (
<AutoTooltip ghost>
{intl.formatMessage({ id: 'routes.form.target.weight' })}:{' '}
{data.weight || 0}
</AutoTooltip>
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The check data.fallback_status_codes && data.fallback_status_codes?.length > 0 can be simplified to just data.fallback_status_codes?.length using optional chaining, which is cleaner and more idiomatic.

Suggested change
const weightNode =
data.fallback_status_codes && data.fallback_status_codes?.length > 0 ? (
<>
{data.weight > 0 && <span style={{ marginInline: 8 }}>/</span>}
<span>{intl.formatMessage({ id: 'routes.table.label.fallback' })}</span>
</>
) : (
<AutoTooltip ghost>
{intl.formatMessage({ id: 'routes.form.target.weight' })}:{' '}
{data.weight || 0}
</AutoTooltip>
);
const weightNode =
data.fallback_status_codes?.length ? (
<>
{data.weight > 0 && <span style={{ marginInline: 8 }}>/</span>}
<span>{intl.formatMessage({ id: 'routes.table.label.fallback' })}</span>
</>
) : (
<AutoTooltip ghost>
{intl.formatMessage({ id: 'routes.form.target.weight' })}:{' '}
{data.weight || 0}
</AutoTooltip>
);

dataIndex: 'created_at',
sorter: tableSorter(6),
span: createTimeSpan,
width: 180,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Since the created_at column was refactored to use a fixed width: 180 instead of span: createTimeSpan, the variable createTimeSpan and its dependent calculations (overflow, CREATE_TIME_PREFERRED_SPAN, CREATE_TIME_MIN_SPAN) are now dead code. Please clean them up from the file to keep the codebase clean and maintainable.

@hibig
hibig merged commit 67e2d91 into main Jul 16, 2026
5 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors expandable child-row rendering in several SealTable-based pages to share the parent table’s column grid (via ExpandedRowGrid + ChildGridOptions), reducing per-page padding/grid-math and improving alignment consistency across parent/child rows.

Changes:

  • Pass parent grid metadata (gridTemplate, prefixWidth, columns) from SealTable renderChildren options down into child-row components.
  • Replace legacy RowChildren + Row/Col layouts with ExpandedRowGrid in model routes, clusters/pools, and llmodels instances child rows.
  • Standardize sizing tokens and columns (add --seal-table-row-min-height global token; set model-routes created_at column to a fixed width).

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/pages/model-routes/index.tsx Forwards SealTable grid options into the route-target child rows.
src/pages/model-routes/hooks/use-routes-columns.tsx Changes created_at sizing (span → fixed width) in the routes table columns hook.
src/pages/model-routes/components/route-targets.tsx Rebuilds route-target expanded rows using ExpandedRowGrid aligned to parent columns.
src/pages/llmodels/components/table-list.tsx Forwards parent grid options into llmodels instance child rows.
src/pages/llmodels/components/instance/instances.tsx Threads shared grid props down from child list to each child row.
src/pages/llmodels/components/instance/instance-item.tsx Replaces Row/Col child layout with ExpandedRowGrid using parent grid alignment.
src/pages/cluster-management/hooks/use-pools-columns.tsx Removes per-column padding styles now that layout is grid-aligned.
src/pages/cluster-management/components/pool-rows.tsx Rebuilds pool expanded rows with ExpandedRowGrid and span mapping to parent tracks.
src/pages/cluster-management/clusters.tsx Forwards SealTable grid options into the worker-pool child rows.
src/global.less Adds a global --seal-table-row-min-height token for consistent row sizing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 232 to 236
title: intl.formatMessage({ id: 'common.table.createTime' }),
dataIndex: 'created_at',
sorter: tableSorter(6),
span: createTimeSpan,
width: 180,
render: (value: string) => (
import { DeleteOutlined } from '@ant-design/icons';
import {
AutoTooltip,
ChildGridOptions,
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.

2 participants