fix(web): restore app deletion autofill and knowledge scope label (#40583)

This commit is contained in:
Crazywoola
2026-08-12 07:31:59 +00:00
committed by GitHub
parent 216d528f1b
commit 750fce7e52
4 changed files with 55 additions and 10 deletions
@@ -1,5 +1,6 @@
import type { AppPartial } from '@dify/contracts/api/console/apps/types.gen'
import { fireEvent, screen, waitFor } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import * as React from 'react'
import { STEP_BY_STEP_TOUR_TARGETS } from '@/app/components/step-by-step-tour/target-registry'
import { AccessMode } from '@/models/access-control'
@@ -885,6 +886,24 @@ describe('AppCard', () => {
expect(await screen.findByRole('alertdialog')).toBeInTheDocument()
})
it('should autofill the app name for delete confirmation', async () => {
const user = userEvent.setup()
render(<AppCard app={mockApp} />)
await user.click(getOperationsTrigger())
await user.click(await screen.findByRole('menuitem', { name: 'common.operation.delete' }))
const deleteInput = await screen.findByRole('textbox')
const confirmButton = screen.getByRole('button', { name: 'common.operation.confirm' })
expect(confirmButton).toBeDisabled()
await user.click(screen.getByRole('button', { name: 'common.operation.fill' }))
expect(deleteInput).toHaveValue(mockApp.name)
expect(confirmButton).toBeEnabled()
})
it('should close confirm dialog when cancel is clicked', async () => {
render(<AppCard app={mockApp} />)
@@ -516,15 +516,24 @@ export const AppCardActionBar = memo(
}}
/>
</FieldLabel>
<FieldControl
type="text"
autoComplete="off"
spellCheck={false}
placeholder={t(($) => $.deleteAppConfirmInputPlaceholder, { ns: 'app' })}
value={confirmDeleteInput}
onValueChange={setConfirmDeleteInput}
className="border-components-input-border-hover bg-components-input-bg-normal focus:border-components-input-border-active focus:bg-components-input-bg-active"
/>
<div className="relative">
<FieldControl
type="text"
autoComplete="off"
spellCheck={false}
placeholder={t(($) => $.deleteAppConfirmInputPlaceholder, { ns: 'app' })}
value={confirmDeleteInput}
onValueChange={setConfirmDeleteInput}
className="border-components-input-border-hover bg-components-input-bg-normal pr-20 focus:border-components-input-border-active focus:bg-components-input-bg-active"
/>
<button
type="button"
onClick={() => setConfirmDeleteInput(app.name)}
className="absolute top-1/2 right-2 -translate-y-1/2 rounded-full bg-black/6 px-2.5 py-1 system-xs-medium text-text-secondary hover:bg-black/10 focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden"
>
{t(($) => $['operation.fill'], { ns: 'common' })}
</button>
</div>
</Field>
</div>
<AlertDialogActions>
@@ -443,6 +443,23 @@ describe('GotoAnything', () => {
expect(input).toHaveValue('test query')
})
it('should show the localized description for the knowledge scope', async () => {
const user = userEvent.setup()
renderGotoAnything(<GotoAnything />)
triggerSearchShortcut()
const input = await screen.findByRole('combobox', {
name: 'app.gotoAnything.searchTitle',
})
await user.type(input, '@')
expect(
screen.getByRole('option', {
name: /@kb app\.gotoAnything\.actions\.searchKnowledgeBasesDesc/,
}),
).toBeInTheDocument()
})
it('should not search providers with a stale scope prefix', async () => {
const user = userEvent.setup()
matchActionMock.mockImplementation((query: string) =>
+1 -1
View File
@@ -79,7 +79,7 @@ const slashCommandDescriptionKeys = {
const actionDescriptionKeys = {
'@app': 'gotoAnything.actions.searchApplicationsDesc',
'@plugin': 'gotoAnything.actions.searchPluginsDesc',
'@knowledge': 'gotoAnything.actions.searchKnowledgeBasesDesc',
'@kb': 'gotoAnything.actions.searchKnowledgeBasesDesc',
'@node': 'gotoAnything.actions.searchWorkflowNodesDesc',
} as const