fix(plugin-workflow): fix update workflow action (#464)
This commit is contained in:
parent
d72480ac58
commit
bfc686c182
@ -9,24 +9,25 @@ import { SchemaComponent, useActionContext, useAPIClient, useCompile, useRecord,
|
|||||||
import collection from './collection';
|
import collection from './collection';
|
||||||
import { nodeCardClass, nodeMetaClass } from "../style";
|
import { nodeCardClass, nodeMetaClass } from "../style";
|
||||||
import schedule from "./schedule";
|
import schedule from "./schedule";
|
||||||
|
import { useFlowContext } from "../WorkflowCanvas";
|
||||||
|
|
||||||
|
|
||||||
function useUpdateConfigAction() {
|
function useUpdateConfigAction() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const form = useForm();
|
const form = useForm();
|
||||||
const api = useAPIClient();
|
const api = useAPIClient();
|
||||||
const record = useRecord();
|
const { workflow } = useFlowContext();
|
||||||
const ctx = useActionContext();
|
const ctx = useActionContext();
|
||||||
const { refresh } = useResourceActionContext();
|
const { refresh } = useResourceActionContext();
|
||||||
return {
|
return {
|
||||||
async run() {
|
async run() {
|
||||||
if (record.executed) {
|
if (workflow.executed) {
|
||||||
message.error(t('Trigger in executed workflow cannot be modified'));
|
message.error(t('Trigger in executed workflow cannot be modified'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await form.submit();
|
await form.submit();
|
||||||
await api.resource('workflows', record.id).update({
|
await api.resource('workflows').update({
|
||||||
filterByTk: record.id,
|
filterByTk: workflow.id,
|
||||||
values: form.values
|
values: form.values
|
||||||
});
|
});
|
||||||
ctx.setVisible(false);
|
ctx.setVisible(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user