diff --git a/packages/plugins/@nocobase/plugin-workflow-aggregate/src/client/AggregateInstruction.tsx b/packages/plugins/@nocobase/plugin-workflow-aggregate/src/client/AggregateInstruction.tsx index 9d90a14ff..6ab62c34f 100644 --- a/packages/plugins/@nocobase/plugin-workflow-aggregate/src/client/AggregateInstruction.tsx +++ b/packages/plugins/@nocobase/plugin-workflow-aggregate/src/client/AggregateInstruction.tsx @@ -238,6 +238,11 @@ export default class extends Instruction { required: true, 'x-decorator': 'FormItem', 'x-component': 'DataSourceCollectionCascader', + 'x-component-props': { + dataSourceFilter(datasource) { + return datasource.key === 'main' || datasource.options.isDBInstance; + }, + }, title: `{{t("Data of collection", { ns: "${NAMESPACE}" })}}`, 'x-reactions': [ { diff --git a/packages/plugins/@nocobase/plugin-workflow-aggregate/src/server/AggregateInstruction.ts b/packages/plugins/@nocobase/plugin-workflow-aggregate/src/server/AggregateInstruction.ts index 30cbe9324..792ac52e2 100644 --- a/packages/plugins/@nocobase/plugin-workflow-aggregate/src/server/AggregateInstruction.ts +++ b/packages/plugins/@nocobase/plugin-workflow-aggregate/src/server/AggregateInstruction.ts @@ -25,6 +25,10 @@ export default class extends Instruction { const options = processor.getParsedValue(params, node.id); const [dataSourceName, collectionName] = parseCollectionName(collection); const { collectionManager } = this.workflow.app.dataSourceManager.dataSources.get(dataSourceName); + // @ts-ignore + if (!collectionManager.db) { + throw new Error('aggregate instruction can only work with data source of type database'); + } const repo = associated ? collectionManager.getRepository( `${association?.associatedCollection}.${association.name}`,