Commit 7b02abe0 by 胡悦

fix(state-placeholder, agent-editor): 移除冗余的重试提示文本

为状态占位符组件添加空描述隐藏规则
将AgentEditor页面两处加载失败场景的描述文本置空,避免重复展示重试提示
新增测试用例验证冗余提示文案不再被渲染
1 parent 09d189c6
...@@ -25,6 +25,10 @@ ...@@ -25,6 +25,10 @@
font-size: var(--gl-font-size-sm); font-size: var(--gl-font-size-sm);
} }
.description:empty {
display: none;
}
.actions { .actions {
display: flex; display: flex;
align-items: center; align-items: center;
......
...@@ -195,6 +195,27 @@ describe('Agent editor routes and detail drawer', () => { ...@@ -195,6 +195,27 @@ describe('Agent editor routes and detail drawer', () => {
}); });
}); });
it('does not repeat option loading failure copy in the create form', async () => {
vi.mocked(getPositionTagList).mockRejectedValueOnce(new Error('position options failed'));
vi.mocked(getEmployeeMounts).mockRejectedValueOnce(new Error('employee options failed'));
renderAgents('/agents/new');
await waitFor(() => {
expect(screen.getByRole('heading', { name: '新建Agent' })).toBeInTheDocument();
});
await waitFor(() => {
expect(screen.getByText('岗位选项加载失败')).toBeInTheDocument();
expect(screen.getByText('托管企微员工加载失败')).toBeInTheDocument();
});
expect(screen.queryByText('请重试加载岗位选项')).not.toBeInTheDocument();
expect(screen.queryByText('请重试加载托管企微员工选项')).not.toBeInTheDocument();
expect(screen.queryByText('数据请求失败,请稍后重试')).not.toBeInTheDocument();
expect(screen.getAllByRole('button', { name: '重试' })).toHaveLength(2);
});
it('opens the detail drawer from the list entry and closes without losing list context', async () => { it('opens the detail drawer from the list entry and closes without losing list context', async () => {
renderAgents('/agents?keyword=复盘&page=1&pageSize=10'); renderAgents('/agents?keyword=复盘&page=1&pageSize=10');
......
...@@ -336,7 +336,7 @@ export function AgentEditorPage({ mode }: { mode: 'create' | 'edit' }) { ...@@ -336,7 +336,7 @@ export function AgentEditorPage({ mode }: { mode: 'create' | 'edit' }) {
<StatePlaceholder <StatePlaceholder
state="error" state="error"
title="岗位选项加载失败" title="岗位选项加载失败"
description="请重试加载岗位选项" description=""
primaryAction={<Button size="small" onClick={fetchPositions}>重试</Button>} primaryAction={<Button size="small" onClick={fetchPositions}>重试</Button>}
/> />
); );
...@@ -383,7 +383,7 @@ export function AgentEditorPage({ mode }: { mode: 'create' | 'edit' }) { ...@@ -383,7 +383,7 @@ export function AgentEditorPage({ mode }: { mode: 'create' | 'edit' }) {
<StatePlaceholder <StatePlaceholder
state="error" state="error"
title="托管企微员工加载失败" title="托管企微员工加载失败"
description="请重试加载托管企微员工选项" description=""
primaryAction={<Button size="small" onClick={fetchEmployees}>重试</Button>} primaryAction={<Button size="small" onClick={fetchEmployees}>重试</Button>}
/> />
); );
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!