mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
fix(web): drop the Close button from the read-only preset view
A shipped preset has nothing to commit or abandon, and the back link above already leaves the screen; a lone Close button below the composition was a second way out of the same place. The action row now renders only when the draft is writable, where Cancel and Save are both real choices. The composition label named `cordis.yml`; the file a preset actually holds is `agent.cordis.yml`.
This commit is contained in:
@@ -124,21 +124,23 @@ function Editor({ draft, blocker, t, actions }: EditorProps): ReactNode {
|
|||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
{message === null ? null : <p className={css.error} role="alert">{message}</p>}
|
{message === null ? null : <p className={css.error} role="alert">{message}</p>}
|
||||||
<div className={css.editorActions}>
|
{/* Read-only has nothing to commit or abandon, and leaving is already the
|
||||||
<Button variant="outline" disabled={draft.saving} onClick={() => { actions.close() }}>
|
back link above — a lone Close button would be a second way out. */}
|
||||||
{draft.writable ? t('cancel') : t('close')}
|
{draft.writable
|
||||||
</Button>
|
? (
|
||||||
{draft.writable
|
<div className={css.editorActions}>
|
||||||
? (
|
<Button variant="outline" disabled={draft.saving} onClick={() => { actions.close() }}>
|
||||||
|
{t('cancel')}
|
||||||
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
disabled={draft.saving || blocker !== undefined}
|
disabled={draft.saving || blocker !== undefined}
|
||||||
onClick={() => { void actions.save() }}
|
onClick={() => { void actions.save() }}
|
||||||
>
|
>
|
||||||
{draft.saving ? t('saving') : t('save')}
|
{draft.saving ? t('saving') : t('save')}
|
||||||
</Button>
|
</Button>
|
||||||
)
|
</div>
|
||||||
: null}
|
)
|
||||||
</div>
|
: null}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export const en: Record<AgentPresetSettingsKey, string> = {
|
|||||||
customGroup: 'Custom',
|
customGroup: 'Custom',
|
||||||
noDescription: 'No description.',
|
noDescription: 'No description.',
|
||||||
copyOf: 'Copied from',
|
copyOf: 'Copied from',
|
||||||
composition: 'Composition (cordis.yml)',
|
composition: 'Composition (agent.cordis.yml)',
|
||||||
readOnlyNotice: 'This preset ships with the deployment and cannot be edited. Duplicate it to make your own.',
|
readOnlyNotice: 'This preset ships with the deployment and cannot be edited. Duplicate it to make your own.',
|
||||||
save: 'Save',
|
save: 'Save',
|
||||||
saving: 'Saving…',
|
saving: 'Saving…',
|
||||||
@@ -92,7 +92,7 @@ export const zh: Record<AgentPresetSettingsKey, string> = {
|
|||||||
customGroup: '自定义',
|
customGroup: '自定义',
|
||||||
noDescription: '暂无描述。',
|
noDescription: '暂无描述。',
|
||||||
copyOf: '复制自',
|
copyOf: '复制自',
|
||||||
composition: '组装(cordis.yml)',
|
composition: '组装(agent.cordis.yml)',
|
||||||
readOnlyNotice: '该预设随部署提供,不可编辑。复制一份即可改成自己的。',
|
readOnlyNotice: '该预设随部署提供,不可编辑。复制一份即可改成自己的。',
|
||||||
save: '保存',
|
save: '保存',
|
||||||
saving: '正在保存…',
|
saving: '正在保存…',
|
||||||
|
|||||||
@@ -239,7 +239,10 @@ describe('the composition editor', () => {
|
|||||||
expect(screen.getByLabelText(en.composition)).toHaveProperty('readOnly', true)
|
expect(screen.getByLabelText(en.composition)).toHaveProperty('readOnly', true)
|
||||||
expect(screen.getByText(en.readOnlyNotice)).toBeTruthy()
|
expect(screen.getByText(en.readOnlyNotice)).toBeTruthy()
|
||||||
expect(screen.queryByText(en.save)).toBeNull()
|
expect(screen.queryByText(en.save)).toBeNull()
|
||||||
expect(screen.getByText(en.close)).toBeTruthy()
|
// Nothing to commit or abandon, and the back link above already leaves —
|
||||||
|
// a lone Close button would be a second way out of the same screen.
|
||||||
|
expect(screen.queryByText(en.cancel)).toBeNull()
|
||||||
|
expect(screen.getByRole('button', { name: `← ${en.backToList}` })).toBeTruthy()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('titles the panel by what it is doing', () => {
|
it('titles the panel by what it is doing', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user