mirror of https://github.com/langgenius/dify.git
feat: start support readonly
This commit is contained in:
parent
1b857eba29
commit
698eb9671f
|
|
@ -383,7 +383,7 @@ export const useNodesReadOnly = () => {
|
|||
}, [workflowStore])
|
||||
|
||||
return {
|
||||
nodesReadOnly: workflowRunningData || historyWorkflowData || isRestoring,
|
||||
nodesReadOnly: !!(workflowRunningData || historyWorkflowData || isRestoring),
|
||||
getNodesReadOnly,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ const VarItem: FC<Props> = ({
|
|||
<div className='grow w-0 truncate text-[13px] font-medium text-gray-500'>{payload.label}</div>
|
||||
</div>
|
||||
<div className='shrink-0 ml-2 flex items-center'>
|
||||
{!isHovering
|
||||
{(!isHovering || readonly)
|
||||
? (
|
||||
<>
|
||||
{payload.required && (
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import { useTranslation } from 'react-i18next'
|
|||
import VarList from './components/var-list'
|
||||
import useConfig from './use-config'
|
||||
import type { StartNodeType } from './types'
|
||||
// import { useStore } from '@/app/components/workflow/store'
|
||||
import Split from '@/app/components/workflow/nodes/_base/components/split'
|
||||
import Field from '@/app/components/workflow/nodes/_base/components/field'
|
||||
import OutputVars, { VarItem } from '@/app/components/workflow/nodes/_base/components/output-vars'
|
||||
|
|
@ -19,8 +18,8 @@ const Panel: FC<NodePanelProps<StartNodeType>> = ({
|
|||
data,
|
||||
}) => {
|
||||
const { t } = useTranslation()
|
||||
const readOnly = false // useStore(s => s.readOnly)
|
||||
const {
|
||||
readOnly,
|
||||
isChatMode,
|
||||
inputs,
|
||||
isShowAddVarModal,
|
||||
|
|
@ -41,7 +40,7 @@ const Panel: FC<NodePanelProps<StartNodeType>> = ({
|
|||
<Field
|
||||
title={t(`${i18nPrefix}.inputField`)}
|
||||
operations={
|
||||
<AddButton onClick={showAddVarModal} />
|
||||
!readOnly ? <AddButton onClick={showAddVarModal} /> : undefined
|
||||
}
|
||||
>
|
||||
<VarList
|
||||
|
|
|
|||
|
|
@ -6,9 +6,11 @@ import type { InputVar } from '@/app/components/workflow/types'
|
|||
import useNodeCrud from '@/app/components/workflow/nodes/_base/hooks/use-node-crud'
|
||||
import {
|
||||
useIsChatMode,
|
||||
useNodesReadOnly,
|
||||
} from '@/app/components/workflow/hooks'
|
||||
|
||||
const useConfig = (id: string, payload: StartNodeType) => {
|
||||
const { nodesReadOnly: readOnly } = useNodesReadOnly()
|
||||
const isChatMode = useIsChatMode()
|
||||
|
||||
const { inputs, setInputs } = useNodeCrud<StartNodeType>(id, payload)
|
||||
|
|
@ -32,6 +34,7 @@ const useConfig = (id: string, payload: StartNodeType) => {
|
|||
setInputs(newInputs)
|
||||
}, [inputs, setInputs])
|
||||
return {
|
||||
readOnly,
|
||||
isChatMode,
|
||||
inputs,
|
||||
isShowAddVarModal,
|
||||
|
|
|
|||
Loading…
Reference in New Issue