Merge branch 'main' into next

This commit is contained in:
nocobase[bot] 2025-04-20 09:34:02 +00:00
commit d0b172db59
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 { collectionManager } = app.dataSourceManager.getDataSource(dataSourceName);
const collection = collectionManager.getCollection(collectionName);
const render = (props) => (
const render = (p) => (
<RemoteSelect
objectValue
dataSource={dataSourceName}
fieldNames={{
label: collection.titleField,
label: collection.titleField || 'id',
value: 'id',
}}
service={{
resource: collectionName,
}}
manual={false}
{...props}
{...p}
/>
);
return (
@ -42,6 +42,7 @@ export function TriggerCollectionRecordSelect(props) {
onChange={props.onChange}
nullable={false}
changeOnSelect
{...props}
render={render}
/>
);

View File

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