mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 18:27:19 +08:00
fix(web): add toast for workflow switch
This commit is contained in:
parent
da482ec455
commit
b914e48a41
@ -20,6 +20,7 @@ const mockOpenAsyncWindow = vi.fn()
|
||||
const mockFetchInstalledAppList = vi.fn()
|
||||
const mockFetchAppDetailDirect = vi.fn()
|
||||
const mockToastError = vi.fn()
|
||||
const mockToastSuccess = vi.fn()
|
||||
const mockConvertWorkflowType = vi.fn()
|
||||
const mockRefetchEvaluationWorkflowAssociatedTargets = vi.fn()
|
||||
const mockInvalidateAppWorkflow = vi.fn()
|
||||
@ -120,6 +121,7 @@ vi.mock('@/service/use-workflow', () => ({
|
||||
vi.mock('@langgenius/dify-ui/toast', () => ({
|
||||
toast: {
|
||||
error: (...args: unknown[]) => mockToastError(...args),
|
||||
success: (...args: unknown[]) => mockToastSuccess(...args),
|
||||
},
|
||||
}))
|
||||
|
||||
@ -586,6 +588,7 @@ describe('AppPublisher', () => {
|
||||
id: 'app-1',
|
||||
workflow_kind: AppTypeEnum.EVALUATION,
|
||||
})
|
||||
expect(mockToastSuccess).toHaveBeenCalledWith('api.actionSuccess')
|
||||
})
|
||||
await waitFor(() => {
|
||||
expect(screen.queryByText('publisher-summary-publish')).not.toBeInTheDocument()
|
||||
@ -620,6 +623,7 @@ describe('AppPublisher', () => {
|
||||
id: 'app-1',
|
||||
workflow_kind: AppTypeEnum.EVALUATION,
|
||||
})
|
||||
expect(mockToastSuccess).toHaveBeenCalledWith('api.actionSuccess')
|
||||
})
|
||||
})
|
||||
|
||||
@ -695,6 +699,7 @@ describe('AppPublisher', () => {
|
||||
params: { appId: 'app-1' },
|
||||
query: { target_type: AppTypeEnum.WORKFLOW },
|
||||
})
|
||||
expect(mockToastSuccess).toHaveBeenCalledWith('api.actionSuccess')
|
||||
})
|
||||
})
|
||||
|
||||
@ -719,6 +724,7 @@ describe('AppPublisher', () => {
|
||||
params: { appId: 'app-1' },
|
||||
query: { target_type: AppTypeEnum.WORKFLOW },
|
||||
})
|
||||
expect(mockToastSuccess).toHaveBeenCalledWith('api.actionSuccess')
|
||||
})
|
||||
expect(screen.queryByText('common.switchToStandardWorkflowConfirm.title')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
@ -131,6 +131,7 @@ export const useWorkflowTypeSwitch = ({
|
||||
})
|
||||
setAppDetail(latestAppDetail)
|
||||
resetEvaluationWorkflowSwitchConfirm()
|
||||
toast.success(t('api.actionSuccess', { ns: 'common' }))
|
||||
return true
|
||||
}
|
||||
|
||||
@ -150,6 +151,7 @@ export const useWorkflowTypeSwitch = ({
|
||||
setAppDetail(latestAppDetail)
|
||||
onPublishedSwitch()
|
||||
resetEvaluationWorkflowSwitchConfirm()
|
||||
toast.success(t('api.actionSuccess', { ns: 'common' }))
|
||||
return true
|
||||
}
|
||||
catch {
|
||||
@ -164,6 +166,7 @@ export const useWorkflowTypeSwitch = ({
|
||||
publishedAt,
|
||||
resetEvaluationWorkflowSwitchConfirm,
|
||||
setAppDetail,
|
||||
t,
|
||||
workflowTypeSwitchConfig,
|
||||
])
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user