mirror of https://github.com/langgenius/dify.git
refactor(context-menu): conditionally render export option based on pipeline ID
This commit is contained in:
parent
a6b0071ca0
commit
55b936003f
|
|
@ -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'),
|
||||
|
|
|
|||
Loading…
Reference in New Issue