fix(plugin-workflow-manual): fix value block in todo block (#3400)

This commit is contained in:
Junyi 2024-01-17 00:06:40 +08:00 committed by GitHub
parent d3704f6807
commit 6f72451d27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 2 deletions

View File

@ -416,7 +416,6 @@ export function SchemaConfig({ value, onChange }) {
const nodeComponents = {};
nodes.forEach((item) => {
const instruction = workflowPlugin.instructions.get(item.type);
Object.assign(nodeInitializers, instruction.initializers);
Object.assign(nodeComponents, instruction.components);
});

View File

@ -53,7 +53,7 @@ function Result({ dataSource }) {
}
const result = parse(dataSource)({
$jobsMapByNodeKey: (execution.jobs ?? []).reduce(
(map, job) => Object.assign(map, { [job.nodeId]: job.result }),
(map, job) => Object.assign(map, { [job.nodeKey]: job.result }),
{},
),
});

View File

@ -16,6 +16,10 @@ export default {
name: 'node',
target: 'flow_nodes',
},
{
type: 'string',
name: 'nodeKey',
},
{
type: 'belongsTo',
name: 'upstream',

View File

@ -0,0 +1,35 @@
import { Migration } from '@nocobase/server';
export default class extends Migration {
appVersion = '<0.19.0-alpha.4';
on = 'afterSync';
async up() {
const { db } = this.context;
const PluginModel = db.getModel('applicationPlugins');
const JobRepo = db.getRepository('jobs');
await db.sequelize.transaction(async (transaction) => {
const jobs = await JobRepo.find({
appends: ['node.key'],
});
await jobs.reduce(
(promise, job) =>
promise.then(() => {
if (job.nodeKey) {
return;
}
return job.update(
{
nodeKey: job.node.key,
},
{
silent: true,
transaction,
},
);
}),
Promise.resolve(),
);
});
}
}