import React from "react"; import { useForm } from "@formily/react"; import { cx } from "@emotion/css"; import { SchemaComponent, useActionContext, useAPIClient, useRecord, useResourceActionContext } from '../../'; import model from './model'; import { nodeCardClass } from "../style"; function useUpdateConfigAction() { const form = useForm(); const api = useAPIClient(); const record = useRecord(); const ctx = useActionContext(); const { refresh } = useResourceActionContext(); return { async run() { await api.resource('workflows', record.id).update({ filterByTk: record.id, values: { config: { ...record.config, ...form.values } }, }); ctx.setVisible(false); refresh(); }, }; }; const triggerTypes = { model }; export const TriggerConfig = () => { const { data } = useResourceActionContext(); if (!data) { return null; } const { type, config } = data.data; const { title, fieldset, scope } = triggerTypes[type]; return (

{title}

); }