mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-02 03:02:19 +08:00
Merge branch 'next' into develop
This commit is contained in:
commit
50ab97fdc7
@ -233,16 +233,16 @@ export default class extends Trigger {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
validateConfig(values) {
|
validateContext(values) {
|
||||||
if (!values.data) {
|
if (!values.data) {
|
||||||
return {
|
return {
|
||||||
data: 'Data property is required',
|
data: 'Data is required',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!values.userId) {
|
if (!values.userId) {
|
||||||
return {
|
return {
|
||||||
userId: 'UserId property is required',
|
userId: 'UserId is required',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,9 +96,9 @@ function useExecuteConfirmAction() {
|
|||||||
const ctx = useActionContext();
|
const ctx = useActionContext();
|
||||||
const navigate = useNavigateNoUpdate();
|
const navigate = useNavigateNoUpdate();
|
||||||
const { message: messageApi } = App.useApp();
|
const { message: messageApi } = App.useApp();
|
||||||
const { autoRevision, ...values } = form.values;
|
|
||||||
return {
|
return {
|
||||||
async run() {
|
async run() {
|
||||||
|
const { autoRevision, ...values } = form.values;
|
||||||
// Not executed, could choose to create new version (by default)
|
// Not executed, could choose to create new version (by default)
|
||||||
// Executed, stay in current version, and refresh
|
// Executed, stay in current version, and refresh
|
||||||
await form.submit();
|
await form.submit();
|
||||||
|
@ -83,7 +83,14 @@ export const ScheduleModes = {
|
|||||||
nullable: false,
|
nullable: false,
|
||||||
changeOnSelect: true,
|
changeOnSelect: true,
|
||||||
render(props) {
|
render(props) {
|
||||||
return <DatePicker showTime placeholder={lang('Current time')} {...props} value={dayjs(props.value)} />;
|
return (
|
||||||
|
<DatePicker
|
||||||
|
showTime
|
||||||
|
placeholder={lang('Current time')}
|
||||||
|
{...props}
|
||||||
|
value={dayjs(props.value || new Date())}
|
||||||
|
/>
|
||||||
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -236,10 +236,10 @@ export default class CollectionTrigger extends Trigger {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
validateConfig(values) {
|
validateContext(values) {
|
||||||
if (!values.data) {
|
if (!values.data) {
|
||||||
return {
|
return {
|
||||||
data: 'Data property is required',
|
data: 'Data is required',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,4 +437,13 @@ export default class DateFieldScheduleTrigger {
|
|||||||
|
|
||||||
return this.workflow.trigger(workflow, { ...values, data, date: values?.date ?? new Date() }, options);
|
return this.workflow.trigger(workflow, { ...values, data, date: values?.date ?? new Date() }, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
validateContext(values) {
|
||||||
|
if (!values?.data) {
|
||||||
|
return {
|
||||||
|
data: 'Data is required',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,25 +67,19 @@ export default class ScheduleTrigger extends Trigger {
|
|||||||
// return !existed.length;
|
// return !existed.length;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
validateConfig(values) {
|
validateContext(values) {
|
||||||
if (!values.mode) {
|
if (!values?.mode) {
|
||||||
return {
|
return {
|
||||||
mode: 'Mode property is required',
|
mode: 'Mode is required',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
const trigger = this.getTrigger(values.mode);
|
||||||
|
if (!trigger) {
|
||||||
|
return {
|
||||||
|
mode: 'Mode in invalid',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!values.startsOn) {
|
return trigger.validateContext?.(values);
|
||||||
return {
|
|
||||||
startsOn: 'StartsOn property is required',
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (values.mode === SCHEDULE_MODE.DATE_FIELD && !values.collection) {
|
|
||||||
return {
|
|
||||||
collection: 'Collection property is required',
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ export abstract class Trigger {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
duplicateConfig?(workflow: WorkflowModel, options: Transactionable): object | Promise<object>;
|
duplicateConfig?(workflow: WorkflowModel, options: Transactionable): object | Promise<object>;
|
||||||
validateConfig?(values: any): null | void | { [key: string]: string };
|
validateContext?(values: any): null | void | { [key: string]: string };
|
||||||
sync?: boolean;
|
sync?: boolean;
|
||||||
execute?(
|
execute?(
|
||||||
workflow: WorkflowModel,
|
workflow: WorkflowModel,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user