mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 06:55:50 +00:00
fix(plugin-workflow): fix incorrectly schema reaction (#4661)
* fix(plugin-workflow): fix incorrectly schema reaction * fix(plugin-workflow): add migration
This commit is contained in:
parent
a49d958086
commit
c747ea65c4
@ -69,6 +69,9 @@ export default class extends Instruction {
|
||||
},
|
||||
],
|
||||
},
|
||||
usingAssignFormSchema: {
|
||||
type: 'boolean',
|
||||
},
|
||||
assignFormSchema: {
|
||||
type: 'object',
|
||||
title: '{{t("Fields values")}}',
|
||||
@ -76,10 +79,10 @@ export default class extends Instruction {
|
||||
'x-component': 'AssignedFieldsFormSchemaConfig',
|
||||
'x-reactions': [
|
||||
{
|
||||
dependencies: ['collection'],
|
||||
dependencies: ['collection', 'usingAssignFormSchema'],
|
||||
fulfill: {
|
||||
state: {
|
||||
display: '{{($deps[0] && $self.value) ? "visible" : "hidden"}}',
|
||||
display: '{{($deps[0] && $deps[1]) ? "visible" : "hidden"}}',
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -92,7 +95,7 @@ export default class extends Instruction {
|
||||
...values,
|
||||
'x-reactions': [
|
||||
{
|
||||
dependencies: ['collection', 'assignFormSchema'],
|
||||
dependencies: ['collection', 'usingAssignFormSchema'],
|
||||
fulfill: {
|
||||
state: {
|
||||
display: '{{($deps[0] && !$deps[1]) ? "visible" : "hidden"}}',
|
||||
@ -107,6 +110,7 @@ export default class extends Instruction {
|
||||
};
|
||||
createDefaultConfig() {
|
||||
return {
|
||||
usingAssignFormSchema: true,
|
||||
assignFormSchema: {},
|
||||
};
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ export default class extends Instruction {
|
||||
...values,
|
||||
'x-reactions': [
|
||||
{
|
||||
dependencies: ['collection', 'assignFormSchema'],
|
||||
dependencies: ['collection', 'usingAssignFormSchema'],
|
||||
fulfill: {
|
||||
state: {
|
||||
display: '{{($deps[0] && !$deps[1]) ? "visible" : "hidden"}}',
|
||||
@ -106,6 +106,9 @@ export default class extends Instruction {
|
||||
},
|
||||
},
|
||||
},
|
||||
usingAssignFormSchema: {
|
||||
type: 'boolean',
|
||||
},
|
||||
assignFormSchema: {
|
||||
type: 'object',
|
||||
title: '{{t("Fields values")}}',
|
||||
@ -113,10 +116,10 @@ export default class extends Instruction {
|
||||
'x-component': 'AssignedFieldsFormSchemaConfig',
|
||||
'x-reactions': [
|
||||
{
|
||||
dependencies: ['collection'],
|
||||
dependencies: ['collection', 'usingAssignFormSchema'],
|
||||
fulfill: {
|
||||
state: {
|
||||
display: '{{($deps[0] && $self.value) ? "visible" : "hidden"}}',
|
||||
display: '{{($deps[0] && $deps[1]) ? "visible" : "hidden"}}',
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -125,7 +128,8 @@ export default class extends Instruction {
|
||||
};
|
||||
createDefaultConfig() {
|
||||
return {
|
||||
assignForm: uid(),
|
||||
usingAssignFormSchema: true,
|
||||
assignFormSchema: {},
|
||||
};
|
||||
}
|
||||
scope = {
|
||||
|
@ -264,7 +264,6 @@ function getNormalizedFields(collectionName, { compile, getCollectionFields }) {
|
||||
const [dataSourceName, collection] = parseCollectionName(collectionName);
|
||||
// NOTE: `dataSourceName` will be ignored in new version
|
||||
const fields = getCollectionFields(collection, dataSourceName);
|
||||
console.log('--------------', fields);
|
||||
const fkFields: any[] = [];
|
||||
const result: any[] = [];
|
||||
fields.forEach((field) => {
|
||||
|
@ -0,0 +1,42 @@
|
||||
/**
|
||||
* This file is part of the NocoBase (R) project.
|
||||
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
||||
* Authors: NocoBase Team.
|
||||
*
|
||||
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||
*/
|
||||
|
||||
import { Op } from '@nocobase/database';
|
||||
import { Migration } from '@nocobase/server';
|
||||
|
||||
export default class extends Migration {
|
||||
on = 'afterSync';
|
||||
async up() {
|
||||
const { db } = this.context;
|
||||
|
||||
const NodeRepo = db.getRepository('flow_nodes');
|
||||
await db.sequelize.transaction(async (transaction) => {
|
||||
const nodes = await NodeRepo.find({
|
||||
filter: {
|
||||
type: {
|
||||
[Op.or]: ['create', 'update'],
|
||||
},
|
||||
},
|
||||
});
|
||||
for (const node of nodes) {
|
||||
if (node.usingAssignFormSchema || !node.assignFormSchema) {
|
||||
continue;
|
||||
}
|
||||
node.set({
|
||||
config: { ...node.config, usingAssignFormSchema: true },
|
||||
});
|
||||
node.changed('config');
|
||||
await node.save({
|
||||
silent: true,
|
||||
transaction,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user