fix(plugin-workflow): fix schedule in subflow (#6721)

This commit is contained in:
Junyi 2025-04-20 17:33:36 +08:00 committed by GitHub
parent 386e76661d
commit b04c26144e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 12 deletions

View File

@ -21,19 +21,19 @@ export function TriggerCollectionRecordSelect(props) {
const [dataSourceName, collectionName] = parseCollectionName(workflow.config.collection); const [dataSourceName, collectionName] = parseCollectionName(workflow.config.collection);
const { collectionManager } = app.dataSourceManager.getDataSource(dataSourceName); const { collectionManager } = app.dataSourceManager.getDataSource(dataSourceName);
const collection = collectionManager.getCollection(collectionName); const collection = collectionManager.getCollection(collectionName);
const render = (props) => ( const render = (p) => (
<RemoteSelect <RemoteSelect
objectValue objectValue
dataSource={dataSourceName} dataSource={dataSourceName}
fieldNames={{ fieldNames={{
label: collection.titleField, label: collection.titleField || 'id',
value: 'id', value: 'id',
}} }}
service={{ service={{
resource: collectionName, resource: collectionName,
}} }}
manual={false} manual={false}
{...props} {...p}
/> />
); );
return ( return (
@ -42,6 +42,7 @@ export function TriggerCollectionRecordSelect(props) {
onChange={props.onChange} onChange={props.onChange}
nullable={false} nullable={false}
changeOnSelect changeOnSelect
{...props}
render={render} render={render}
/> />
); );

View File

@ -9,6 +9,7 @@
import Trigger from '..'; import Trigger from '..';
import type Plugin from '../../Plugin'; import type Plugin from '../../Plugin';
import { WorkflowModel } from '../../types';
import DateFieldScheduleTrigger from './DateFieldScheduleTrigger'; import DateFieldScheduleTrigger from './DateFieldScheduleTrigger';
import StaticScheduleTrigger from './StaticScheduleTrigger'; import StaticScheduleTrigger from './StaticScheduleTrigger';
import { SCHEDULE_MODE } from './utils'; import { SCHEDULE_MODE } from './utils';
@ -67,19 +68,15 @@ export default class ScheduleTrigger extends Trigger {
// return !existed.length; // return !existed.length;
// } // }
validateContext(values) { validateContext(values, workflow: WorkflowModel) {
if (!values?.mode) { const { mode } = workflow.config;
return { const trigger = this.getTrigger(mode);
mode: 'Mode is required',
};
}
const trigger = this.getTrigger(values.mode);
if (!trigger) { if (!trigger) {
return { return {
mode: 'Mode in invalid', mode: 'Mode in invalid',
}; };
} }
return trigger.validateContext?.(values); return trigger.validateContext?.(values, workflow);
} }
} }

View File

@ -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>;
validateContext?(values: any): null | void | { [key: string]: string }; validateContext?(values: any, workflow: WorkflowModel): null | void | { [key: string]: string };
sync?: boolean; sync?: boolean;
execute?( execute?(
workflow: WorkflowModel, workflow: WorkflowModel,