Commit 98136096 authored by StyleZhang's avatar StyleZhang

publish

parent aa6254a3
...@@ -7,12 +7,23 @@ import { ...@@ -7,12 +7,23 @@ import {
PortalToFollowElemContent, PortalToFollowElemContent,
PortalToFollowElemTrigger, PortalToFollowElemTrigger,
} from '@/app/components/base/portal-to-follow-elem' } 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 Publish = () => {
const { t } = useTranslation() const { t } = useTranslation()
const runningStatus = useStore(s => s.runningStatus) const runningStatus = useStore(s => s.runningStatus)
const [open, setOpen] = useState(false) const [open, setOpen] = useState(false)
const handlePublish = async () => {
const appId = useAppStore.getState().appDetail?.id
try {
await publishWorkflow(`/apps/${appId}/workflows/publish`)
}
catch (e) {
}
}
return ( return (
<PortalToFollowElem <PortalToFollowElem
open={open} open={open}
...@@ -51,6 +62,7 @@ const Publish = () => { ...@@ -51,6 +62,7 @@ const Publish = () => {
<Button <Button
type='primary' 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' 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')} {t('workflow.common.publish')}
</Button> </Button>
......
...@@ -25,3 +25,7 @@ export const fetchWorkflowRunHistory: Fetcher<WorkflowRunHistoryResponse, string ...@@ -25,3 +25,7 @@ export const fetchWorkflowRunHistory: Fetcher<WorkflowRunHistoryResponse, string
export const singleNodeRun = (appId: string, nodeId: string, params: object) => { export const singleNodeRun = (appId: string, nodeId: string, params: object) => {
return post(`apps/${appId}/workflows/draft/nodes/${nodeId}/run`, { body: params }) return post(`apps/${appId}/workflows/draft/nodes/${nodeId}/run`, { body: params })
} }
export const publishWorkflow = (url: string) => {
return post<CommonResponse>(url)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment