From 55b936003f4abec998ae561c07dfd264533624cc Mon Sep 17 00:00:00 2001 From: twwu Date: Thu, 4 Sep 2025 16:47:21 +0800 Subject: [PATCH] refactor(context-menu): conditionally render export option based on pipeline ID --- .../version-history-panel/context-menu/use-context-menu.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web/app/components/workflow/panel/version-history-panel/context-menu/use-context-menu.ts b/web/app/components/workflow/panel/version-history-panel/context-menu/use-context-menu.ts index c56d286f83..242b77a5fa 100644 --- a/web/app/components/workflow/panel/version-history-panel/context-menu/use-context-menu.ts +++ b/web/app/components/workflow/panel/version-history-panel/context-menu/use-context-menu.ts @@ -2,12 +2,14 @@ import { useMemo } from 'react' import { useTranslation } from 'react-i18next' import { VersionHistoryContextMenuOptions } from '../../../types' import type { ContextMenuProps } from './index' +import { useStore } from '@/app/components/workflow/store' const useContextMenu = (props: ContextMenuProps) => { const { isNamedVersion, } = props const { t } = useTranslation() + const pipelineId = useStore(s => s.pipelineId) const deleteOperation = { key: VersionHistoryContextMenuOptions.delete, @@ -29,10 +31,11 @@ const useContextMenu = (props: ContextMenuProps) => { key: VersionHistoryContextMenuOptions.edit, name: t('workflow.versionHistory.nameThisVersion'), }, - { + // todo: pipeline support export specific version DSL + ...(!pipelineId ? [{ key: VersionHistoryContextMenuOptions.exportDSL, name: t('app.export'), - }, + }] : []), { key: VersionHistoryContextMenuOptions.copyId, name: t('workflow.versionHistory.copyId'),