tachybase_todo/packages/plugins/@nocobase/plugin-workflow/src/client/utils.ts
Junyi d691e4c7e6
feat(plugin-workflow): support multiple data source in workflow (#3739)
* feat(plugin-workflow): support multiple data source in workflow

* fix(plugin-workflow): fix test cases

* test(plugin-workflow-sql): debug test case

* fix(plugin-workflow): fix collection trigger creation without config

* test(plugin-workflow-sql): debug test case

* fix: workflow e2e test

* chore(ci): disable console intercept in vitest

* chore(ci): disable console intercept in vitest

* chore(ci): disable console intercept in vitest

* chore(ci): disable console intercept in vitest

* test(plugin-workflow-sql): debug test case

* test: approval e2e

* fix: remove pro-plugins from packages

* refactor(plugin-workflow): support pass collection from props to CollectionBlockInitializer

* test(plugin-workflow): add test case

* fix(plugin-workflow): disable modification of executed workflow

* fix: e2ePageObjectModel

* fix: load data source when data source load failed (#3793)

* chore: console.log

* fix(subTable): fix sorting rule setting (#3795)

* fix: through collection support search (#3800)

* fix(client): visible -> useVisible

* fix(client): fix action designer error occured in custom form (#3801)

* fix(client): fix action designer error occured in custom form

* fix(client): fix from the source

* chore(module): remove submodule

* fix(plugin-workflow): fix client cycling import

* fix(plugin-workflow): fix collection event name

* fix(plugin-workflow): fix undefined ref

---------

Co-authored-by: hongboji <j414562100@qq.com>
Co-authored-by: ChengLei Shao <chareice@live.com>
Co-authored-by: Zeke Zhang <958414905@qq.com>
Co-authored-by: katherinehhh <shunai.tang@hand-china.com>
Co-authored-by: chenos <chenlinxh@gmail.com>
2024-03-25 14:46:22 +08:00

54 lines
1.2 KiB
TypeScript

export function linkNodes(nodes): void {
const nodesMap = new Map();
nodes.forEach((item) => nodesMap.set(item.id, item));
for (const node of nodesMap.values()) {
if (node.upstreamId) {
node.upstream = nodesMap.get(node.upstreamId);
}
if (node.downstreamId) {
node.downstream = nodesMap.get(node.downstreamId);
}
}
}
export function isValidFilter(condition) {
const group = condition.$and || condition.$or;
if (!group) {
return false;
}
return group.some((item) => {
if (item.$and || item.$or) {
return isValidFilter(item);
}
const [name] = Object.keys(item);
if (!name || !item[name]) {
return false;
}
const [op] = Object.keys(item[name]);
if (!op || typeof item[name][op] === 'undefined') {
return false;
}
return true;
});
}
export function traverseSchema(schema, fn) {
fn(schema);
if (schema.properties) {
Object.keys(schema.properties).forEach((key) => {
traverseSchema(schema.properties[key], fn);
});
}
}
export function getWorkflowDetailPath(id: string | number) {
return `/admin/workflow/workflows/${id}`;
}
export function getWorkflowExecutionsPath(id: string | number) {
return `/admin/workflow/executions/${id}`;
}