Commit 98136096 authored by StyleZhang's avatar StyleZhang

publish

parent aa6254a3
......@@ -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)
}
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