fix(plugin-workflow): fix update workflow action (#464)

This commit is contained in:
Junyi 2022-06-04 15:44:39 +08:00 committed by GitHub
parent d72480ac58
commit bfc686c182
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,24 +9,25 @@ import { SchemaComponent, useActionContext, useAPIClient, useCompile, useRecord,
import collection from './collection';
import { nodeCardClass, nodeMetaClass } from "../style";
import schedule from "./schedule";
import { useFlowContext } from "../WorkflowCanvas";
function useUpdateConfigAction() {
const { t } = useTranslation();
const form = useForm();
const api = useAPIClient();
const record = useRecord();
const { workflow } = useFlowContext();
const ctx = useActionContext();
const { refresh } = useResourceActionContext();
return {
async run() {
if (record.executed) {
if (workflow.executed) {
message.error(t('Trigger in executed workflow cannot be modified'));
return;
}
await form.submit();
await api.resource('workflows', record.id).update({
filterByTk: record.id,
await api.resource('workflows').update({
filterByTk: workflow.id,
values: form.values
});
ctx.setVisible(false);