refactor(plugin-workflow): change to function (#2991)
This commit is contained in:
parent
30de7865c5
commit
00cabc5e23
@ -762,7 +762,11 @@ function WorkflowConfig() {
|
||||
const fieldSchema = useFieldSchema();
|
||||
const { name: collection } = useCollection();
|
||||
const workflowPlugin = usePlugin('workflow') as any;
|
||||
const workflowTypes = workflowPlugin.getTriggersOptions().filter((item) => item.options.actionTriggerable);
|
||||
const workflowTypes = workflowPlugin.getTriggersOptions().filter((item) => {
|
||||
return typeof item.options.useActionTriggerable === 'function'
|
||||
? item.options.useActionTriggerable()
|
||||
: item.options.useActionTriggerable;
|
||||
});
|
||||
const description = {
|
||||
submit: t('Workflow will be triggered after submitting succeeded.', { ns: 'workflow' }),
|
||||
'customize:save': t('Workflow will be triggered after saving succeeded.', { ns: 'workflow' }),
|
||||
|
@ -101,7 +101,7 @@ export default {
|
||||
};
|
||||
},
|
||||
initializers: {},
|
||||
actionTriggerable: true,
|
||||
useActionTriggerable: true,
|
||||
};
|
||||
|
||||
function getFormValues({
|
||||
|
@ -63,7 +63,7 @@ export interface Trigger {
|
||||
components?: { [key: string]: any };
|
||||
useInitializers?(config): SchemaInitializerItemOptions | null;
|
||||
initializers?: any;
|
||||
actionTriggerable?: boolean;
|
||||
useActionTriggerable?: boolean | (() => boolean);
|
||||
}
|
||||
|
||||
export const triggers = new Registry<Trigger>();
|
||||
|
Loading…
Reference in New Issue
Block a user