From 750fce7e52758533c76a73f6ceea7a68cece4f82 Mon Sep 17 00:00:00 2001 From: Crazywoola <100913391+crazywoola@users.noreply.github.com> Date: Wed, 12 Aug 2026 15:31:59 +0800 Subject: [PATCH] fix(web): restore app deletion autofill and knowledge scope label (#40583) --- .../apps/__tests__/app-card.spec.tsx | 19 +++++++++++++ .../apps/app-card/action-bar/index.tsx | 27 ++++++++++++------- .../goto-anything/__tests__/index.spec.tsx | 17 ++++++++++++ web/app/components/goto-anything/index.tsx | 2 +- 4 files changed, 55 insertions(+), 10 deletions(-) diff --git a/web/app/components/apps/__tests__/app-card.spec.tsx b/web/app/components/apps/__tests__/app-card.spec.tsx index f6ad9d6e135..c243efa1ea8 100644 --- a/web/app/components/apps/__tests__/app-card.spec.tsx +++ b/web/app/components/apps/__tests__/app-card.spec.tsx @@ -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() + + 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() diff --git a/web/app/components/apps/app-card/action-bar/index.tsx b/web/app/components/apps/app-card/action-bar/index.tsx index 396f668f4d1..e96a19e5ea7 100644 --- a/web/app/components/apps/app-card/action-bar/index.tsx +++ b/web/app/components/apps/app-card/action-bar/index.tsx @@ -516,15 +516,24 @@ export const AppCardActionBar = memo( }} /> - $.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" - /> +
+ $.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" + /> + +
diff --git a/web/app/components/goto-anything/__tests__/index.spec.tsx b/web/app/components/goto-anything/__tests__/index.spec.tsx index 55258a96cb5..573795cabbd 100644 --- a/web/app/components/goto-anything/__tests__/index.spec.tsx +++ b/web/app/components/goto-anything/__tests__/index.spec.tsx @@ -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() + 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) => diff --git a/web/app/components/goto-anything/index.tsx b/web/app/components/goto-anything/index.tsx index d8284805fea..9d233a81f11 100644 --- a/web/app/components/goto-anything/index.tsx +++ b/web/app/components/goto-anything/index.tsx @@ -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