Export DSL from history (#24939)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
GuanMu
2025-09-02 21:36:52 +08:00
committed by GitHub
parent 8fcc864fb7
commit 25a11bfafc
9 changed files with 119 additions and 13 deletions

View File

@@ -29,6 +29,10 @@ const useContextMenu = (props: ContextMenuProps) => {
key: VersionHistoryContextMenuOptions.edit,
name: t('workflow.versionHistory.nameThisVersion'),
},
{
key: VersionHistoryContextMenuOptions.exportDSL,
name: t('app.export'),
},
{
key: VersionHistoryContextMenuOptions.copyId,
name: t('workflow.versionHistory.copyId'),

View File

@@ -3,7 +3,7 @@ import React, { useCallback, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { RiArrowDownDoubleLine, RiCloseLine, RiLoader2Line } from '@remixicon/react'
import copy from 'copy-to-clipboard'
import { useNodesSyncDraft, useWorkflowRun } from '../../hooks'
import { useDSL, useNodesSyncDraft, useWorkflowRun } from '../../hooks'
import { useStore, useWorkflowStore } from '../../store'
import { VersionHistoryContextMenuOptions, WorkflowVersionFilterOptions } from '../../types'
import VersionHistoryItem from './version-history-item'
@@ -33,6 +33,7 @@ const VersionHistoryPanel = () => {
const workflowStore = useWorkflowStore()
const { handleSyncWorkflowDraft } = useNodesSyncDraft()
const { handleRestoreFromPublishedWorkflow, handleLoadBackupDraft } = useWorkflowRun()
const { handleExportDSL } = useDSL()
const appDetail = useAppStore.getState().appDetail
const setShowWorkflowVersionHistoryPanel = useStore(s => s.setShowWorkflowVersionHistoryPanel)
const currentVersion = useStore(s => s.currentVersion)
@@ -107,8 +108,11 @@ const VersionHistoryPanel = () => {
message: t('workflow.versionHistory.action.copyIdSuccess'),
})
break
case VersionHistoryContextMenuOptions.exportDSL:
handleExportDSL(false, item.id)
break
}
}, [t])
}, [t, handleExportDSL])
const handleCancel = useCallback((operation: VersionHistoryContextMenuOptions) => {
switch (operation) {