mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 02:18:08 +08:00
feat(workflow): add clear button to workflow test run panel
Features: - Add refresh button to clear test run history (data, inputs, node highlights) - Persist workflowRunningData when closing panel (from previous commit) Code quality improvements: - Refactor to declarative pattern: effectiveTab derived from state, not set in effects - Replace && with ternary operators for conditional rendering (Vercel best practices) - Fix created_by type: change from string to object to match backend API - Remove `as any` type assertion, use proper type-safe access - Title now declaratively shows status based on workflowRunningData presence Files changed: - use-workflow-interactions.ts: add handleClearWorkflowRunHistory hook - workflow-preview.tsx: declarative tab state, clear button, type-safe props - types.ts: fix created_by type definition - test files: update mock data to match corrected types
This commit is contained in:
@ -51,8 +51,19 @@ export const useWorkflowInteractions = () => {
|
||||
}
|
||||
}, [workflowStore, handleNodeCancelRunningStatus, handleEdgeCancelRunningStatus])
|
||||
|
||||
const handleClearWorkflowRunHistory = useCallback(() => {
|
||||
workflowStore.setState({
|
||||
workflowRunningData: undefined,
|
||||
inputs: {},
|
||||
files: [],
|
||||
})
|
||||
handleNodeCancelRunningStatus()
|
||||
handleEdgeCancelRunningStatus()
|
||||
}, [workflowStore, handleNodeCancelRunningStatus, handleEdgeCancelRunningStatus])
|
||||
|
||||
return {
|
||||
handleCancelDebugAndPreviewPanel,
|
||||
handleClearWorkflowRunHistory,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user