feat(ui): simplify fleet cards by moving edit/delete into detail

Hide instance IDs and config/delete controls on overview cards; keep
service/system restart only, with edit still available from detail.
This commit is contained in:
chick
2026-07-22 00:20:32 +08:00
parent 3c7018a792
commit bbd94b5672
6 changed files with 21 additions and 161 deletions
+7 -4
View File
@@ -29,15 +29,16 @@ const snapshot: FleetSnapshot = {
afterEach(cleanup);
describe('FleetPage card navigation', () => {
it('makes the whole instance card open its dashboard while admin controls stay separately interactive', () => {
it('makes the whole instance card open its dashboard while ops stay separate and config stays out of the card', () => {
render(<FleetPage initialData={snapshot} />);
const card = screen.getByRole('article', { name: 'Alpha modem 实例概览' });
const entry = within(card).getByRole('link', { name: '打开 Alpha modem 实例仪表盘' });
expect(entry.getAttribute('href')).toBe('/instances/alpha/overview');
expect(entry.classList.contains('fleet-card-entry')).toBe(true);
expect(within(card).getByRole('link', { name: '编辑 Alpha modem' })).toBeTruthy();
expect(within(card).getByRole('button', { name: '删除 Alpha modem' })).toBeTruthy();
expect(within(card).queryByRole('link', { name: /编辑/ })).toBeNull();
expect(within(card).queryByRole('button', { name: /删除/ })).toBeNull();
expect(within(card).queryByText('alpha')).toBeNull();
expect(within(card).queryByRole('link', { name: /查看.*短信/ })).toBeNull();
expect(screen.getByRole('region', { name: '实例状态摘要' }).textContent).toMatch(
/\s*1.*线\s*1.*\s*0/s,
@@ -49,7 +50,9 @@ describe('FleetPage card navigation', () => {
'51',
);
expect(within(card).getByText('进入仪表盘')).toBeTruthy();
expect(within(card).getByRole('group', { name: '实例管理操作' })).toBeTruthy();
expect(within(card).getByRole('group', { name: '实例运维操作' })).toBeTruthy();
expect(within(card).getByRole('button', { name: '重启服务 Alpha modem' })).toBeTruthy();
expect(within(card).getByRole('button', { name: '系统重启 Alpha modem' })).toBeTruthy();
});
});