mirror of https://github.com/langgenius/dify.git
publish
This commit is contained in:
parent
aa6254a3b4
commit
9813609645
|
|
@ -7,12 +7,23 @@ import {
|
|||
PortalToFollowElemContent,
|
||||
PortalToFollowElemTrigger,
|
||||
} from '@/app/components/base/portal-to-follow-elem'
|
||||
import { publishWorkflow } from '@/service/workflow'
|
||||
import { useStore as useAppStore } from '@/app/components/app/store'
|
||||
|
||||
const Publish = () => {
|
||||
const { t } = useTranslation()
|
||||
const runningStatus = useStore(s => s.runningStatus)
|
||||
const [open, setOpen] = useState(false)
|
||||
|
||||
const handlePublish = async () => {
|
||||
const appId = useAppStore.getState().appDetail?.id
|
||||
try {
|
||||
await publishWorkflow(`/apps/${appId}/workflows/publish`)
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<PortalToFollowElem
|
||||
open={open}
|
||||
|
|
@ -51,6 +62,7 @@ const Publish = () => {
|
|||
<Button
|
||||
type='primary'
|
||||
className='mt-3 px-3 py-0 w-full h-8 border-[0.5px] border-primary-700 rounded-lg text-[13px] font-medium'
|
||||
onClick={handlePublish}
|
||||
>
|
||||
{t('workflow.common.publish')}
|
||||
</Button>
|
||||
|
|
|
|||
|
|
@ -25,3 +25,7 @@ export const fetchWorkflowRunHistory: Fetcher<WorkflowRunHistoryResponse, string
|
|||
export const singleNodeRun = (appId: string, nodeId: string, params: object) => {
|
||||
return post(`apps/${appId}/workflows/draft/nodes/${nodeId}/run`, { body: params })
|
||||
}
|
||||
|
||||
export const publishWorkflow = (url: string) => {
|
||||
return post<CommonResponse>(url)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue