refactor: from hera-core to @tachybase/plugin-workflow (#1156)
Co-authored-by: sealday <sealday@gmail.com> Reviewed-on: daoyoucloud/tachybase#1156
This commit is contained in:
parent
848b99df0b
commit
bc4c975a4d
@ -1,142 +0,0 @@
|
||||
import { useCollectionDataSource, useCollectionManager_deprecated, useCompile } from '@tachybase/client';
|
||||
import {
|
||||
CheckboxGroupWithTooltip,
|
||||
CollectionBlockInitializer,
|
||||
FieldsSelect,
|
||||
getCollectionFieldOptions,
|
||||
RadioWithTooltip,
|
||||
Trigger,
|
||||
} from '@tachybase/plugin-workflow/client';
|
||||
|
||||
import { lang, tval } from '../../locale';
|
||||
|
||||
const enum ACTION_TYPES {
|
||||
CREATE = 'create',
|
||||
UPDATE = 'update',
|
||||
UPSERT = 'updateOrCreate',
|
||||
DESTROY = 'destroy',
|
||||
}
|
||||
|
||||
function useItems(item, options) {
|
||||
const compile = useCompile();
|
||||
const { getCollectionFields } = useCollectionManager_deprecated();
|
||||
return [
|
||||
{ label: lang('ID'), value: 'filterByTk' },
|
||||
...(item.action !== ACTION_TYPES.DESTROY
|
||||
? [
|
||||
{
|
||||
label: lang('Values submitted'),
|
||||
value: 'values',
|
||||
children: getCollectionFieldOptions({
|
||||
...options,
|
||||
appends: null,
|
||||
depth: 3,
|
||||
collection: item.collection,
|
||||
compile,
|
||||
getCollectionFields,
|
||||
}),
|
||||
},
|
||||
]
|
||||
: []),
|
||||
];
|
||||
}
|
||||
export class ApiTrigger extends Trigger {
|
||||
title = lang('API event');
|
||||
description = lang('api trigger');
|
||||
fieldset = {
|
||||
collection: {
|
||||
type: 'string',
|
||||
title: tval('Collection'),
|
||||
required: true,
|
||||
'x-decorator': 'FormItem',
|
||||
'x-component': 'DataSourceCollectionCascader',
|
||||
'x-reactions': [{ target: 'changed', effects: ['onFieldValueChange'], fulfill: { state: { value: [] } } }],
|
||||
},
|
||||
global: {
|
||||
type: 'boolean',
|
||||
title: tval('Trigger mode'),
|
||||
'x-decorator': 'FormItem',
|
||||
'x-component': 'RadioWithTooltip',
|
||||
'x-component-props': {
|
||||
direction: 'vertical',
|
||||
options: [
|
||||
{
|
||||
label: tval('Local mode, triggered before executing the actions bound to this workflow'),
|
||||
value: false,
|
||||
},
|
||||
{
|
||||
label: tval('Global mode, triggered before executing the following actions'),
|
||||
value: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
default: false,
|
||||
},
|
||||
actions: {
|
||||
type: 'number',
|
||||
title: tval('Select actions'),
|
||||
'x-decorator': 'FormItem',
|
||||
'x-component': 'CheckboxGroupWithTooltip',
|
||||
'x-component-props': {
|
||||
direction: 'vertical',
|
||||
options: [
|
||||
{ label: tval('Create record action'), value: ACTION_TYPES.CREATE },
|
||||
{ label: tval('Update record action'), value: ACTION_TYPES.UPDATE },
|
||||
{ label: tval('Delete record action'), value: ACTION_TYPES.DESTROY },
|
||||
],
|
||||
},
|
||||
required: true,
|
||||
'x-reactions': [
|
||||
{ dependencies: ['collection', 'global'], fulfill: { state: { visible: '{{!!$deps[0] && !!$deps[1]}}' } } },
|
||||
],
|
||||
},
|
||||
};
|
||||
scope = { useCollectionDataSource };
|
||||
components = {
|
||||
FieldsSelect: FieldsSelect,
|
||||
RadioWithTooltip: RadioWithTooltip,
|
||||
CheckboxGroupWithTooltip: CheckboxGroupWithTooltip,
|
||||
};
|
||||
isActionTriggerable = (a, u) => {
|
||||
const { global: m } = a;
|
||||
return !m && !u.direct;
|
||||
};
|
||||
|
||||
useVariables(config, options) {
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
const compile = useCompile();
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
const { getCollectionFields } = useCollectionManager_deprecated();
|
||||
const result = getCollectionFieldOptions({
|
||||
appends: ['user'],
|
||||
...options,
|
||||
fields: [
|
||||
{
|
||||
collectionName: 'users',
|
||||
name: 'user',
|
||||
type: 'hasOne',
|
||||
target: 'users',
|
||||
uiSchema: { title: tval('User acted') },
|
||||
},
|
||||
],
|
||||
compile,
|
||||
getCollectionFields,
|
||||
});
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
const parametersSchema = [{ label: lang('Parameters'), value: 'params', children: useItems(config, options) }];
|
||||
return [...result, { label: lang('Role of user acted'), value: 'roleName' }, ...parametersSchema];
|
||||
}
|
||||
useInitializers(item) {
|
||||
return item.collection
|
||||
? {
|
||||
name: 'triggerData',
|
||||
type: 'item',
|
||||
key: 'triggerData',
|
||||
title: tval('Trigger data'),
|
||||
Component: CollectionBlockInitializer,
|
||||
collection: item.collection,
|
||||
dataPath: '$context.params.values',
|
||||
}
|
||||
: null;
|
||||
}
|
||||
}
|
@ -1,105 +0,0 @@
|
||||
import {
|
||||
ActionDesigner,
|
||||
SchemaSettings,
|
||||
SchemaSettingsItemType,
|
||||
useDesignable,
|
||||
useRequest,
|
||||
useSchemaToolbar,
|
||||
} from '@tachybase/client';
|
||||
import { useFieldSchema } from '@tachybase/schema';
|
||||
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
const schemaSettingsItems: SchemaSettingsItemType[] = [
|
||||
{
|
||||
name: 'editButton',
|
||||
Component: ActionDesigner.ButtonEditor,
|
||||
useComponentProps() {
|
||||
const { buttonEditorProps } = useSchemaToolbar();
|
||||
return buttonEditorProps;
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Date',
|
||||
type: 'select',
|
||||
useComponentProps() {
|
||||
const { dn } = useDesignable();
|
||||
const { t } = useTranslation();
|
||||
const fieldSchema = useFieldSchema();
|
||||
return {
|
||||
title: t('Data will be updated'),
|
||||
options: [
|
||||
{ label: t('Selected'), value: 'selected' },
|
||||
{ label: t('All'), value: 'all' },
|
||||
],
|
||||
value: fieldSchema['x-action-settings']?.['updateMode'],
|
||||
onChange: (value) => {
|
||||
fieldSchema['x-action-settings']['updateMode'] = value;
|
||||
dn.emit('patch', {
|
||||
schema: {
|
||||
'x-uid': fieldSchema['x-uid'],
|
||||
'x-action-settings': fieldSchema['x-action-settings'],
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Bind workflow',
|
||||
type: 'select',
|
||||
useComponentProps() {
|
||||
const { dn } = useDesignable();
|
||||
const { t } = useTranslation();
|
||||
const fieldSchema = useFieldSchema();
|
||||
const { data } = useRequest<any>({
|
||||
resource: 'workflows',
|
||||
action: 'list',
|
||||
params: {
|
||||
filter: {
|
||||
type: 'api',
|
||||
},
|
||||
},
|
||||
});
|
||||
// FIXME 不会实时生效
|
||||
const options =
|
||||
data?.data?.map((workflow) => ({
|
||||
label: workflow.title,
|
||||
value: workflow.id,
|
||||
})) ?? [];
|
||||
return {
|
||||
title: t('Bind workflow'),
|
||||
value: fieldSchema['x-action-settings'].bindWorkflow,
|
||||
options: options.concat({
|
||||
label: t('disabled'),
|
||||
value: false,
|
||||
}),
|
||||
onChange(value) {
|
||||
fieldSchema['x-action-settings'].bindWorkflow = value;
|
||||
dn.emit('patch', {
|
||||
schema: {
|
||||
'x-uid': fieldSchema['x-uid'],
|
||||
'x-action-settings': fieldSchema['x-action-settings'],
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'remove',
|
||||
sort: 100,
|
||||
Component: ActionDesigner.RemoveButton as any,
|
||||
useComponentProps() {
|
||||
const { removeButtonProps } = useSchemaToolbar();
|
||||
return removeButtonProps;
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const bulkWorkflowActionSettings = new SchemaSettings({
|
||||
name: 'actionSettings:bulkWorkflow',
|
||||
items: schemaSettingsItems,
|
||||
});
|
||||
|
||||
export { bulkWorkflowActionSettings };
|
@ -1,31 +0,0 @@
|
||||
import React from 'react';
|
||||
import { BlockInitializer, useSchemaInitializerItem } from '@tachybase/client';
|
||||
|
||||
import { tval } from '../../locale';
|
||||
|
||||
export const BulkWorkflowActionInitializer = () => {
|
||||
const itemConfig = useSchemaInitializerItem();
|
||||
const schema = {
|
||||
type: 'void',
|
||||
title: tval('Bulk workflow'),
|
||||
'x-component': 'Action',
|
||||
'x-use-component-props': 'useCustomizeBulkWorkflowActionProps',
|
||||
'x-align': 'right',
|
||||
'x-acl-action': 'update',
|
||||
'x-decorator': 'ACLActionProvider',
|
||||
'x-acl-action-props': {
|
||||
skipScopeCheck: true,
|
||||
},
|
||||
'x-action': 'customize:bulkWorkflow',
|
||||
'x-toolbar': 'ActionSchemaToolbar',
|
||||
'x-settings': 'actionSettings:bulkWorkflow',
|
||||
'x-action-settings': {
|
||||
bindWorkflow: false,
|
||||
updateMode: 'selected',
|
||||
},
|
||||
'x-component-props': {
|
||||
icon: 'CarryOutOutlined',
|
||||
},
|
||||
};
|
||||
return <BlockInitializer {...itemConfig} schema={schema} item={itemConfig} />;
|
||||
};
|
@ -1,37 +0,0 @@
|
||||
import { Plugin, useCollection } from '@tachybase/client';
|
||||
import PluginWorkflow from '@tachybase/plugin-workflow/client';
|
||||
|
||||
import { tval } from '../../locale';
|
||||
import { ApiTrigger } from './ApiTrigger';
|
||||
import { bulkWorkflowActionSettings } from './BulkUpdateAction.Settings';
|
||||
import { BulkWorkflowActionInitializer } from './BulkUpdateActionInitializer';
|
||||
import { useCustomizeBulkWorkflowActionProps } from './utils';
|
||||
|
||||
export class PluginWorkflowBulk extends Plugin {
|
||||
async load() {
|
||||
this.app.addComponents({ BulkWorkflowActionInitializer });
|
||||
this.app.addScopes({ useCustomizeBulkWorkflowActionProps });
|
||||
this.app.schemaSettingsManager.add(bulkWorkflowActionSettings);
|
||||
|
||||
const initializerData = {
|
||||
title: tval('Bulk workflow'),
|
||||
Component: 'BulkWorkflowActionInitializer',
|
||||
name: 'bulkWorkflow',
|
||||
useVisible() {
|
||||
const collection = useCollection();
|
||||
return (
|
||||
(collection.template !== 'view' || collection?.writableView) &&
|
||||
collection.template !== 'file' &&
|
||||
collection.template !== 'sql'
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
['table', 'details'].forEach((block) => {
|
||||
this.app.schemaInitializerManager.addItem(block + ':configureActions', 'customize.bulkWorkflow', initializerData);
|
||||
});
|
||||
|
||||
const plugin = this.app.pm.get(PluginWorkflow) as PluginWorkflow;
|
||||
plugin.registerTrigger('api', ApiTrigger);
|
||||
}
|
||||
}
|
@ -1,104 +0,0 @@
|
||||
import { useContext } from 'react';
|
||||
import {
|
||||
isVariable,
|
||||
transformVariableValue,
|
||||
useBlockRequestContext,
|
||||
useCollection_deprecated,
|
||||
useCompile,
|
||||
useLocalVariables,
|
||||
useRecord,
|
||||
useRequest,
|
||||
useTableBlockContext,
|
||||
useVariables,
|
||||
} from '@tachybase/client';
|
||||
import { SchemaExpressionScopeContext, useField, useFieldSchema } from '@tachybase/schema';
|
||||
|
||||
import { App } from 'antd';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
import { useTranslation } from '../../locale';
|
||||
|
||||
export const useCustomizeBulkWorkflowActionProps = () => {
|
||||
const { field, resource, __parent, service } = useBlockRequestContext();
|
||||
const expressionScope = useContext(SchemaExpressionScopeContext);
|
||||
const actionSchema = useFieldSchema();
|
||||
const tableBlockContext = useTableBlockContext();
|
||||
const { rowKey } = tableBlockContext;
|
||||
const selectedRecordKeys =
|
||||
tableBlockContext.field?.data?.selectedRowKeys ?? expressionScope?.selectedRecordKeys ?? {};
|
||||
const navigate = useNavigate();
|
||||
const compile = useCompile();
|
||||
const { t } = useTranslation();
|
||||
const actionField: any = useField();
|
||||
const { modal } = App.useApp();
|
||||
const variables = useVariables();
|
||||
const record = useRecord();
|
||||
const { name, getField } = useCollection_deprecated();
|
||||
const localVariables = useLocalVariables();
|
||||
const { run } = useRequest(
|
||||
{
|
||||
resource: 'workflows',
|
||||
action: 'trigger',
|
||||
},
|
||||
{
|
||||
manual: true,
|
||||
},
|
||||
);
|
||||
|
||||
return {
|
||||
async onClick() {
|
||||
const {
|
||||
bindWorkflow = false,
|
||||
assignedValues: originalAssignedValues = {},
|
||||
updateMode,
|
||||
} = actionSchema?.['x-action-settings'] ?? {};
|
||||
actionField.data = field.data || {};
|
||||
actionField.data.loading = true;
|
||||
|
||||
if (!bindWorkflow) {
|
||||
return modal.info({
|
||||
title: t('Not bind workflow!'),
|
||||
});
|
||||
}
|
||||
|
||||
const assignedValues = {};
|
||||
const waitList = Object.keys(originalAssignedValues).map(async (key) => {
|
||||
const value = originalAssignedValues[key];
|
||||
const collectionField = getField(key);
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (!collectionField) {
|
||||
throw new Error(`useCustomizeBulkUpdateActionProps: field "${key}" not found in collection "${name}"`);
|
||||
}
|
||||
}
|
||||
|
||||
if (isVariable(value)) {
|
||||
const result = await variables?.parseVariable(value, localVariables);
|
||||
if (result) {
|
||||
assignedValues[key] = transformVariableValue(result, { targetCollectionField: collectionField });
|
||||
}
|
||||
} else if (value != null && value !== '') {
|
||||
assignedValues[key] = value;
|
||||
}
|
||||
});
|
||||
await Promise.all(waitList);
|
||||
|
||||
modal.confirm({
|
||||
title: t('Bulk update', { ns: 'client' }),
|
||||
content:
|
||||
updateMode === 'selected'
|
||||
? t('Update selected data?', { ns: 'client' })
|
||||
: t('Update all data?', { ns: 'client' }),
|
||||
async onOk() {
|
||||
run({
|
||||
filterByTk: bindWorkflow,
|
||||
});
|
||||
actionField.data.loading = false;
|
||||
},
|
||||
async onCancel() {
|
||||
actionField.data.loading = false;
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
};
|
@ -25,8 +25,6 @@ import { PluginHeraVersion } from './features/hera-version';
|
||||
import { PluginOutbound } from './features/outbound';
|
||||
import { PluginPageStyle } from './features/page-style';
|
||||
import { PluginPDF } from './features/pdf';
|
||||
import { PluginWorkflowBulk } from './features/workflow-bulk';
|
||||
import { PluginWorkflowInterceptor } from './features/workflow-interceptor';
|
||||
import { useGetCustomAssociatedComponents } from './hooks/useGetCustomAssociatedComponents';
|
||||
import { useGetCustomComponents } from './hooks/useGetCustomComponents';
|
||||
import {
|
||||
@ -82,8 +80,6 @@ export class PluginCoreClient extends Plugin {
|
||||
await this.app.pm.add(PluginHeraVersion);
|
||||
await this.app.pm.add(PluginContextMenu);
|
||||
await this.app.pm.add(PluginAssistant);
|
||||
await this.app.pm.add(PluginWorkflowBulk);
|
||||
await this.app.pm.add(PluginWorkflowInterceptor);
|
||||
await this.app.pm.add(PluginPDF);
|
||||
await this.app.pm.add(PluginExtendedFilterForm);
|
||||
await this.app.pm.add(PluginOutbound);
|
||||
|
@ -1,7 +0,0 @@
|
||||
import { Trigger } from '@tachybase/plugin-workflow';
|
||||
|
||||
export class ApiTrigger extends Trigger {
|
||||
static TYPE = 'api';
|
||||
on() {}
|
||||
off() {}
|
||||
}
|
@ -5,7 +5,6 @@ import Application, { InstallOptions, NoticeLevel, Plugin, type PluginOptions }
|
||||
import { Container } from '@tachybase/utils';
|
||||
|
||||
import { DepartmentsPlugin } from './features/departments';
|
||||
import { PluginInterception } from './features/interception';
|
||||
import CalcField from './fields/calc';
|
||||
import TstzrangeField from './fields/tstzrange';
|
||||
import { ConnectionManager } from './services/connection-manager';
|
||||
@ -15,11 +14,9 @@ import { WebControllerService as WebService } from './services/web-service';
|
||||
|
||||
export class PluginCoreServer extends Plugin {
|
||||
pluginDepartments: DepartmentsPlugin;
|
||||
pluginInterception: PluginInterception;
|
||||
constructor(app: Application, options?: PluginOptions) {
|
||||
super(app, options);
|
||||
this.pluginDepartments = new DepartmentsPlugin(app, options);
|
||||
this.pluginInterception = new PluginInterception(app, options);
|
||||
}
|
||||
async afterAdd() {
|
||||
this.db.registerFieldTypes({
|
||||
@ -32,7 +29,6 @@ export class PluginCoreServer extends Plugin {
|
||||
}
|
||||
async load() {
|
||||
await this.pluginDepartments.load();
|
||||
await this.pluginInterception.load();
|
||||
try {
|
||||
await Container.get(ConnectionManager).load();
|
||||
const fontManger = Container.get(FontManager);
|
||||
|
@ -1,9 +1,9 @@
|
||||
import React, { useCallback, useMemo } from 'react';
|
||||
import { Button, Dropdown, MenuProps } from 'antd';
|
||||
import { PlusOutlined } from '@ant-design/icons';
|
||||
|
||||
import { css, useAPIClient, useCompile, usePlugin } from '@tachybase/client';
|
||||
|
||||
import { PlusOutlined } from '@ant-design/icons';
|
||||
import { Button, Dropdown, MenuProps } from 'antd';
|
||||
|
||||
import WorkflowPlugin from '.';
|
||||
import { useFlowContext } from './FlowContext';
|
||||
import { NAMESPACE } from './locale';
|
||||
|
@ -1,8 +1,8 @@
|
||||
import React from 'react';
|
||||
import { CloseOutlined } from '@ant-design/icons';
|
||||
|
||||
import { css, cx } from '@tachybase/client';
|
||||
|
||||
import { CloseOutlined } from '@ant-design/icons';
|
||||
|
||||
import { AddButton } from './AddButton';
|
||||
import { useGetAriaLabelOfAddButton } from './hooks/useGetAriaLabelOfAddButton';
|
||||
import { Node } from './nodes';
|
||||
|
@ -1,7 +1,4 @@
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import { Link, useNavigate } from 'react-router-dom';
|
||||
import { Breadcrumb, Button, Dropdown, message, Modal, Result, Space, Spin, Tag, Tooltip } from 'antd';
|
||||
|
||||
import {
|
||||
ActionContextProvider,
|
||||
cx,
|
||||
@ -15,16 +12,19 @@ import {
|
||||
} from '@tachybase/client';
|
||||
import { str2moment } from '@tachybase/utils/client';
|
||||
|
||||
import { DownOutlined, ExclamationCircleFilled, StopOutlined } from '@ant-design/icons';
|
||||
import { Breadcrumb, Button, Dropdown, message, Modal, Result, Space, Spin, Tag, Tooltip } from 'antd';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Link, useNavigate } from 'react-router-dom';
|
||||
|
||||
import WorkflowPlugin from '.';
|
||||
import { CanvasContent } from './CanvasContent';
|
||||
import { StatusButton } from './components/StatusButton';
|
||||
import { ExecutionStatusOptionsMap, JobStatusOptions } from './constants';
|
||||
import { FlowContext, useFlowContext } from './FlowContext';
|
||||
import { lang, NAMESPACE } from './locale';
|
||||
import useStyles from './style';
|
||||
import { linkNodes, getWorkflowDetailPath, getWorkflowExecutionsPath } from './utils';
|
||||
import { DownOutlined, ExclamationCircleFilled, StopOutlined } from '@ant-design/icons';
|
||||
import { StatusButton } from './components/StatusButton';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { getWorkflowDetailPath, getWorkflowExecutionsPath, linkNodes } from './utils';
|
||||
|
||||
function attachJobs(nodes, jobs: any[] = []): void {
|
||||
const nodesMap = new Map();
|
||||
|
@ -1,5 +1,4 @@
|
||||
import React from 'react';
|
||||
|
||||
import { SchemaComponentOptions, usePlugin } from '@tachybase/client';
|
||||
|
||||
import PluginWorkflowClient, { FlowContext } from '.';
|
||||
|
@ -1,9 +1,9 @@
|
||||
import React from 'react';
|
||||
import { useActionContext, useRecord } from '@tachybase/client';
|
||||
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
import { useActionContext, useRecord } from '@tachybase/client';
|
||||
|
||||
import { getWorkflowExecutionsPath } from './utils';
|
||||
|
||||
export const ExecutionLink = () => {
|
||||
|
@ -1,6 +1,8 @@
|
||||
import { cx, SchemaComponent } from '@tachybase/client';
|
||||
import React from 'react';
|
||||
import { cx, SchemaComponent } from '@tachybase/client';
|
||||
|
||||
import { useParams } from 'react-router-dom';
|
||||
|
||||
import { ExecutionCanvas } from './ExecutionCanvas';
|
||||
import useStyles from './style';
|
||||
|
||||
|
@ -0,0 +1,146 @@
|
||||
import React from 'react';
|
||||
import { Plugin } from '@tachybase/client';
|
||||
import { Registry } from '@tachybase/utils/client';
|
||||
|
||||
import { ExecutionPage } from './ExecutionPage';
|
||||
import { PluginActionTrigger } from './features/action-trigger';
|
||||
import { PluginAggregate } from './features/aggregate';
|
||||
import { PluginAPIRegularClient } from './features/api-regular';
|
||||
import { PluginDelay } from './features/delay';
|
||||
import { PluginDaynamicCalculation } from './features/dynamic-calculation';
|
||||
import { PluginWorkflowInterceptor } from './features/interceptor';
|
||||
import PluginWorkflowJSParseClient from './features/js-parse';
|
||||
import PluginWorkflowJsonParseClient from './features/json-parse';
|
||||
import { PluginLoop } from './features/loop';
|
||||
import { PluginManual } from './features/manual';
|
||||
import { PluginParallel } from './features/parallel';
|
||||
import { PluginRequest } from './features/request';
|
||||
import { PluginSql } from './features/sql';
|
||||
import { PluginVariables } from './features/variables';
|
||||
import { NAMESPACE } from './locale';
|
||||
import { Instruction } from './nodes';
|
||||
import CalculationInstruction from './nodes/calculation';
|
||||
import ConditionInstruction from './nodes/condition';
|
||||
import CreateInstruction from './nodes/create';
|
||||
import DestroyInstruction from './nodes/destroy';
|
||||
import EndInstruction from './nodes/end';
|
||||
import QueryInstruction from './nodes/query';
|
||||
import UpdateInstruction from './nodes/update';
|
||||
import { customizeSubmitToWorkflowActionSettings } from './settings/customizeSubmitToWorkflowActionSettings';
|
||||
import { Trigger } from './triggers';
|
||||
import CollectionTrigger from './triggers/collection';
|
||||
import ScheduleTrigger from './triggers/schedule';
|
||||
import { getWorkflowDetailPath, getWorkflowExecutionsPath } from './utils';
|
||||
import { WorkflowPage } from './WorkflowPage';
|
||||
import { WorkflowPane } from './WorkflowPane';
|
||||
|
||||
export class PluginWorkflow extends Plugin {
|
||||
triggers = new Registry<Trigger>();
|
||||
instructions = new Registry<Instruction>();
|
||||
getTriggersOptions = () => {
|
||||
return Array.from(this.triggers.getEntities()).map(([value, { title, ...options }]) => ({
|
||||
value,
|
||||
label: title,
|
||||
color: 'gold',
|
||||
options,
|
||||
}));
|
||||
};
|
||||
|
||||
isWorkflowSync(workflow) {
|
||||
return this.triggers.get(workflow.type).sync ?? workflow.sync;
|
||||
}
|
||||
|
||||
registerTrigger(type: string, trigger: Trigger | { new (): Trigger }) {
|
||||
if (typeof trigger === 'function') {
|
||||
this.triggers.register(type, new trigger());
|
||||
} else if (trigger) {
|
||||
this.triggers.register(type, trigger);
|
||||
} else {
|
||||
throw new TypeError('invalid trigger type to register');
|
||||
}
|
||||
}
|
||||
|
||||
registerInstruction(type: string, instruction: Instruction | { new (): Instruction }) {
|
||||
if (typeof instruction === 'function') {
|
||||
this.instructions.register(type, new instruction());
|
||||
} else if (instruction instanceof Instruction) {
|
||||
this.instructions.register(type, instruction);
|
||||
} else {
|
||||
throw new TypeError('invalid instruction type to register');
|
||||
}
|
||||
}
|
||||
|
||||
async afterAdd() {
|
||||
await this.pm.add(PluginSql);
|
||||
await this.pm.add(PluginRequest);
|
||||
await this.pm.add(PluginParallel);
|
||||
await this.pm.add(PluginManual);
|
||||
await this.pm.add(PluginLoop);
|
||||
await this.pm.add(PluginDaynamicCalculation);
|
||||
await this.pm.add(PluginDelay);
|
||||
await this.pm.add(PluginAggregate);
|
||||
await this.pm.add(PluginActionTrigger);
|
||||
await this.pm.add(PluginWorkflowJsonParseClient);
|
||||
await this.pm.add(PluginWorkflowJSParseClient);
|
||||
await this.pm.add(PluginAPIRegularClient);
|
||||
await this.pm.add(PluginWorkflowInterceptor);
|
||||
await this.pm.add(PluginVariables);
|
||||
}
|
||||
|
||||
async load() {
|
||||
this.addRoutes();
|
||||
this.addComponents();
|
||||
|
||||
this.app.pluginSettingsManager.add(NAMESPACE, {
|
||||
icon: 'PartitionOutlined',
|
||||
title: `{{t("Workflow", { ns: "${NAMESPACE}" })}}`,
|
||||
Component: WorkflowPane,
|
||||
aclSnippet: 'pm.workflow.workflows',
|
||||
});
|
||||
|
||||
this.app.schemaSettingsManager.add(customizeSubmitToWorkflowActionSettings);
|
||||
|
||||
this.registerTrigger('collection', CollectionTrigger);
|
||||
this.registerTrigger('schedule', ScheduleTrigger);
|
||||
|
||||
this.registerInstruction('calculation', CalculationInstruction);
|
||||
this.registerInstruction('condition', ConditionInstruction);
|
||||
this.registerInstruction('end', EndInstruction);
|
||||
|
||||
this.registerInstruction('query', QueryInstruction);
|
||||
this.registerInstruction('create', CreateInstruction);
|
||||
this.registerInstruction('update', UpdateInstruction);
|
||||
this.registerInstruction('destroy', DestroyInstruction);
|
||||
}
|
||||
|
||||
addComponents() {
|
||||
this.app.addComponents({
|
||||
WorkflowPage,
|
||||
ExecutionPage,
|
||||
});
|
||||
}
|
||||
|
||||
addRoutes() {
|
||||
this.app.router.add('admin.workflow.workflows.id', {
|
||||
path: getWorkflowDetailPath(':id'),
|
||||
element: <WorkflowPage />,
|
||||
});
|
||||
this.app.router.add('admin.workflow.executions.id', {
|
||||
path: getWorkflowExecutionsPath(':id'),
|
||||
element: <ExecutionPage />,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export * from './Branch';
|
||||
export * from './FlowContext';
|
||||
export * from './constants';
|
||||
export * from './nodes';
|
||||
export { Trigger, useTrigger } from './triggers';
|
||||
export * from './variable';
|
||||
export * from './components';
|
||||
export * from './utils';
|
||||
export * from './hooks';
|
||||
export { default as useStyles } from './style';
|
||||
export * from './variable';
|
||||
export * from './ExecutionContextProvider';
|
@ -1,9 +1,9 @@
|
||||
import React from 'react';
|
||||
import { useActionContext, useGetAriaLabelOfAction, useRecord } from '@tachybase/client';
|
||||
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
import { useActionContext, useGetAriaLabelOfAction, useRecord } from '@tachybase/client';
|
||||
|
||||
import { getWorkflowDetailPath } from './utils';
|
||||
|
||||
export const WorkflowLink = () => {
|
||||
|
@ -1,6 +1,8 @@
|
||||
import { cx, SchemaComponent } from '@tachybase/client';
|
||||
import React from 'react';
|
||||
import { cx, SchemaComponent } from '@tachybase/client';
|
||||
|
||||
import { useParams } from 'react-router-dom';
|
||||
|
||||
import useStyles from './style';
|
||||
import { WorkflowCanvas } from './WorkflowCanvas';
|
||||
|
||||
|
@ -1,17 +1,18 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import {
|
||||
ScheduleTriggerNode,
|
||||
WorkflowListRecords,
|
||||
apiCreateWorkflow,
|
||||
apiDeleteWorkflow,
|
||||
apiGetWorkflow,
|
||||
apiUpdateWorkflowTrigger,
|
||||
appendJsonCollectionName,
|
||||
generalWithNoRelationalFields,
|
||||
ScheduleTriggerNode,
|
||||
WorkflowListRecords,
|
||||
} from '@tachybase/plugin-workflow-test/e2e';
|
||||
import { expect, test } from '@tachybase/test/e2e';
|
||||
import { dayjs } from '@tachybase/utils';
|
||||
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
test.describe('Configuration page to configure the Trigger node', () => {
|
||||
test('Triggered one minute after the current time of the customized time', async ({
|
||||
page,
|
||||
|
@ -1,12 +1,13 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import {
|
||||
CreateWorkFlow,
|
||||
EditWorkFlow,
|
||||
apiCreateWorkflow,
|
||||
apiDeleteWorkflow,
|
||||
CreateWorkFlow,
|
||||
EditWorkFlow,
|
||||
} from '@tachybase/plugin-workflow-test/e2e';
|
||||
import { expect, test } from '@tachybase/test/e2e';
|
||||
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
test.describe('Filter', () => {
|
||||
test('filter workflow name', async ({ page }) => {
|
||||
//添加工作流
|
||||
|
@ -1,10 +1,5 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import {
|
||||
AggregateNode,
|
||||
ClculationNode,
|
||||
CollectionTriggerNode,
|
||||
CreateRecordNode,
|
||||
QueryRecordNode,
|
||||
apiCreateWorkflow,
|
||||
apiCreateWorkflowNode,
|
||||
apiDeleteWorkflow,
|
||||
@ -14,11 +9,17 @@ import {
|
||||
apiUpdateWorkflowNode,
|
||||
apiUpdateWorkflowTrigger,
|
||||
appendJsonCollectionName,
|
||||
ClculationNode,
|
||||
CollectionTriggerNode,
|
||||
CreateRecordNode,
|
||||
generalWithNoRelationalFields,
|
||||
QueryRecordNode,
|
||||
} from '@tachybase/plugin-workflow-test/e2e';
|
||||
import { expect, test } from '@tachybase/test/e2e';
|
||||
import { dayjs } from '@tachybase/utils';
|
||||
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
test('Collection event add data trigger, get trigger node single line text variable', async ({
|
||||
page,
|
||||
mockCollections,
|
||||
|
@ -1,10 +1,5 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import {
|
||||
AggregateNode,
|
||||
ClculationNode,
|
||||
CollectionTriggerNode,
|
||||
CreateRecordNode,
|
||||
QueryRecordNode,
|
||||
apiCreateWorkflow,
|
||||
apiCreateWorkflowNode,
|
||||
apiDeleteWorkflow,
|
||||
@ -14,11 +9,17 @@ import {
|
||||
apiUpdateWorkflowNode,
|
||||
apiUpdateWorkflowTrigger,
|
||||
appendJsonCollectionName,
|
||||
ClculationNode,
|
||||
CollectionTriggerNode,
|
||||
CreateRecordNode,
|
||||
generalWithNoRelationalFields,
|
||||
QueryRecordNode,
|
||||
} from '@tachybase/plugin-workflow-test/e2e';
|
||||
import { expect, test } from '@tachybase/test/e2e';
|
||||
import { dayjs } from '@tachybase/utils';
|
||||
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
test('Collection event add data trigger, get trigger node single line text variable', async ({
|
||||
page,
|
||||
mockCollections,
|
||||
|
@ -1,19 +1,20 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import {
|
||||
CollectionTriggerNode,
|
||||
CreateWorkFlow,
|
||||
EditWorkFlow,
|
||||
WorkflowListRecords,
|
||||
apiCreateWorkflow,
|
||||
apiDeleteWorkflow,
|
||||
apiGetWorkflow,
|
||||
apiUpdateRecord,
|
||||
apiUpdateWorkflowTrigger,
|
||||
appendJsonCollectionName,
|
||||
CollectionTriggerNode,
|
||||
CreateWorkFlow,
|
||||
EditWorkFlow,
|
||||
generalWithNoRelationalFields,
|
||||
WorkflowListRecords,
|
||||
} from '@tachybase/plugin-workflow-test/e2e';
|
||||
import { expect, test } from '@tachybase/test/e2e';
|
||||
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
test.describe('Configuration page to configure the Trigger node', () => {
|
||||
test('Add Data Trigger with No Filter', async ({ page, mockCollections, mockRecords }) => {
|
||||
//数据表后缀标识
|
||||
|
@ -1,19 +1,20 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import {
|
||||
CollectionTriggerNode,
|
||||
CreateWorkFlow,
|
||||
EditWorkFlow,
|
||||
WorkflowListRecords,
|
||||
apiCreateWorkflow,
|
||||
apiDeleteWorkflow,
|
||||
apiGetWorkflow,
|
||||
apiUpdateRecord,
|
||||
apiUpdateWorkflowTrigger,
|
||||
appendJsonCollectionName,
|
||||
CollectionTriggerNode,
|
||||
CreateWorkFlow,
|
||||
EditWorkFlow,
|
||||
generalWithNoRelationalFields,
|
||||
WorkflowListRecords,
|
||||
} from '@tachybase/plugin-workflow-test/e2e';
|
||||
import { expect, test } from '@tachybase/test/e2e';
|
||||
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
test.describe('Filter', () => {
|
||||
test('filter workflow name', async ({ page }) => {
|
||||
//添加工作流
|
||||
|
@ -1,9 +1,4 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import {
|
||||
ClculationNode,
|
||||
CollectionTriggerNode,
|
||||
ConditionBranchNode,
|
||||
QueryRecordNode,
|
||||
apiCreateWorkflow,
|
||||
apiCreateWorkflowNode,
|
||||
apiDeleteWorkflow,
|
||||
@ -12,11 +7,17 @@ import {
|
||||
apiGetWorkflowNodeExecutions,
|
||||
apiUpdateWorkflowTrigger,
|
||||
appendJsonCollectionName,
|
||||
ClculationNode,
|
||||
CollectionTriggerNode,
|
||||
ConditionBranchNode,
|
||||
generalWithNoRelationalFields,
|
||||
QueryRecordNode,
|
||||
} from '@tachybase/plugin-workflow-test/e2e';
|
||||
import { expect, test } from '@tachybase/test/e2e';
|
||||
import { dayjs } from '@tachybase/utils';
|
||||
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
test('Collection event add data trigger, determines that the trigger node single line text field variable is equal to an equal constant, passes.', async ({
|
||||
page,
|
||||
mockCollections,
|
||||
|
@ -1,9 +1,4 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import {
|
||||
ClculationNode,
|
||||
CollectionTriggerNode,
|
||||
ConditionBranchNode,
|
||||
QueryRecordNode,
|
||||
apiCreateWorkflow,
|
||||
apiCreateWorkflowNode,
|
||||
apiDeleteWorkflow,
|
||||
@ -12,11 +7,17 @@ import {
|
||||
apiGetWorkflowNodeExecutions,
|
||||
apiUpdateWorkflowTrigger,
|
||||
appendJsonCollectionName,
|
||||
ClculationNode,
|
||||
CollectionTriggerNode,
|
||||
ConditionBranchNode,
|
||||
generalWithNoRelationalFields,
|
||||
QueryRecordNode,
|
||||
} from '@tachybase/plugin-workflow-test/e2e';
|
||||
import { expect, test } from '@tachybase/test/e2e';
|
||||
import { dayjs } from '@tachybase/utils';
|
||||
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
test('Collection event Add Data Trigger, determines that the trigger node single line text field variable is equal to an equal constant, passes.', async ({
|
||||
page,
|
||||
mockCollections,
|
||||
|
@ -1,10 +1,4 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import {
|
||||
ClculationNode,
|
||||
CollectionTriggerNode,
|
||||
ConditionBranchNode,
|
||||
ConditionYesNode,
|
||||
QueryRecordNode,
|
||||
apiCreateWorkflow,
|
||||
apiCreateWorkflowNode,
|
||||
apiDeleteWorkflow,
|
||||
@ -13,11 +7,18 @@ import {
|
||||
apiGetWorkflowNodeExecutions,
|
||||
apiUpdateWorkflowTrigger,
|
||||
appendJsonCollectionName,
|
||||
ClculationNode,
|
||||
CollectionTriggerNode,
|
||||
ConditionBranchNode,
|
||||
ConditionYesNode,
|
||||
generalWithNoRelationalFields,
|
||||
QueryRecordNode,
|
||||
} from '@tachybase/plugin-workflow-test/e2e';
|
||||
import { expect, test } from '@tachybase/test/e2e';
|
||||
import { dayjs } from '@tachybase/utils';
|
||||
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
test('Collection event add data trigger, determine trigger node integer field variable is equal to an equal constant, pass.', async ({
|
||||
page,
|
||||
mockCollections,
|
||||
|
@ -1,10 +1,4 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import {
|
||||
ClculationNode,
|
||||
CollectionTriggerNode,
|
||||
ConditionBranchNode,
|
||||
ConditionYesNode,
|
||||
QueryRecordNode,
|
||||
apiCreateWorkflow,
|
||||
apiCreateWorkflowNode,
|
||||
apiDeleteWorkflow,
|
||||
@ -13,11 +7,18 @@ import {
|
||||
apiGetWorkflowNodeExecutions,
|
||||
apiUpdateWorkflowTrigger,
|
||||
appendJsonCollectionName,
|
||||
ClculationNode,
|
||||
CollectionTriggerNode,
|
||||
ConditionBranchNode,
|
||||
ConditionYesNode,
|
||||
generalWithNoRelationalFields,
|
||||
QueryRecordNode,
|
||||
} from '@tachybase/plugin-workflow-test/e2e';
|
||||
import { expect, test } from '@tachybase/test/e2e';
|
||||
import { dayjs } from '@tachybase/utils';
|
||||
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
test('Collection event add data trigger, determines that the trigger node single line text field variable is equal to an equal constant, passes.', async ({
|
||||
page,
|
||||
mockCollections,
|
||||
|
@ -1,10 +1,4 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import {
|
||||
ClculationNode,
|
||||
CollectionTriggerNode,
|
||||
ConditionBranchNode,
|
||||
ConditionYesNode,
|
||||
QueryRecordNode,
|
||||
apiCreateWorkflow,
|
||||
apiCreateWorkflowNode,
|
||||
apiDeleteWorkflow,
|
||||
@ -13,11 +7,18 @@ import {
|
||||
apiGetWorkflowNodeExecutions,
|
||||
apiUpdateWorkflowTrigger,
|
||||
appendJsonCollectionName,
|
||||
ClculationNode,
|
||||
CollectionTriggerNode,
|
||||
ConditionBranchNode,
|
||||
ConditionYesNode,
|
||||
generalWithNoRelationalFields,
|
||||
QueryRecordNode,
|
||||
} from '@tachybase/plugin-workflow-test/e2e';
|
||||
import { expect, test } from '@tachybase/test/e2e';
|
||||
import { dayjs } from '@tachybase/utils';
|
||||
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
test('Collection event Add Data Trigger, Formula engine, determines that the trigger node single line text field variable is equal to an equal constant, passes.', async ({
|
||||
page,
|
||||
mockCollections,
|
||||
|
@ -1,10 +1,4 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import {
|
||||
ClculationNode,
|
||||
CollectionTriggerNode,
|
||||
ConditionBranchNode,
|
||||
ConditionYesNode,
|
||||
QueryRecordNode,
|
||||
apiCreateWorkflow,
|
||||
apiCreateWorkflowNode,
|
||||
apiDeleteWorkflow,
|
||||
@ -13,11 +7,18 @@ import {
|
||||
apiGetWorkflowNodeExecutions,
|
||||
apiUpdateWorkflowTrigger,
|
||||
appendJsonCollectionName,
|
||||
ClculationNode,
|
||||
CollectionTriggerNode,
|
||||
ConditionBranchNode,
|
||||
ConditionYesNode,
|
||||
generalWithNoRelationalFields,
|
||||
QueryRecordNode,
|
||||
} from '@tachybase/plugin-workflow-test/e2e';
|
||||
import { expect, test } from '@tachybase/test/e2e';
|
||||
import { dayjs } from '@tachybase/utils';
|
||||
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
test('Collection event add data trigger, Math engine, determine trigger node integer field variable is equal to an equal constant, pass.', async ({
|
||||
page,
|
||||
mockCollections,
|
||||
|
@ -1,7 +1,4 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import {
|
||||
CollectionTriggerNode,
|
||||
CreateRecordNode,
|
||||
apiCreateWorkflow,
|
||||
apiDeleteWorkflow,
|
||||
apiGetRecord,
|
||||
@ -9,11 +6,15 @@ import {
|
||||
apiGetWorkflowNodeExecutions,
|
||||
apiUpdateWorkflowTrigger,
|
||||
appendJsonCollectionName,
|
||||
CollectionTriggerNode,
|
||||
CreateRecordNode,
|
||||
generalWithNoRelationalFields,
|
||||
} from '@tachybase/plugin-workflow-test/e2e';
|
||||
import { expect, test } from '@tachybase/test/e2e';
|
||||
import { dayjs } from '@tachybase/utils';
|
||||
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
test('Collection event add data trigger, single row text fields for common tables, set constant data', async ({
|
||||
page,
|
||||
mockCollections,
|
||||
|
@ -1,17 +1,18 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import {
|
||||
CollectionTriggerNode,
|
||||
DeleteRecordNode,
|
||||
apiCreateWorkflow,
|
||||
apiDeleteWorkflow,
|
||||
apiGetList,
|
||||
apiUpdateWorkflowTrigger,
|
||||
appendJsonCollectionName,
|
||||
CollectionTriggerNode,
|
||||
DeleteRecordNode,
|
||||
generalWithNoRelationalFields,
|
||||
} from '@tachybase/plugin-workflow-test/e2e';
|
||||
import { expect, test } from '@tachybase/test/e2e';
|
||||
import { dayjs } from '@tachybase/utils';
|
||||
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
test('Collection event add data trigger, filter single line text field not null, delete common table data', async ({
|
||||
page,
|
||||
mockCollections,
|
||||
|
@ -1,18 +1,19 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import {
|
||||
CollectionTriggerNode,
|
||||
QueryRecordNode,
|
||||
apiCreateWorkflow,
|
||||
apiDeleteWorkflow,
|
||||
apiGetWorkflow,
|
||||
apiGetWorkflowNodeExecutions,
|
||||
apiUpdateWorkflowTrigger,
|
||||
appendJsonCollectionName,
|
||||
CollectionTriggerNode,
|
||||
generalWithNoRelationalFields,
|
||||
QueryRecordNode,
|
||||
} from '@tachybase/plugin-workflow-test/e2e';
|
||||
import { expect, test } from '@tachybase/test/e2e';
|
||||
import { dayjs } from '@tachybase/utils';
|
||||
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
test('Collection event add data trigger, no filter no sort query common table 1 record', async ({
|
||||
page,
|
||||
mockCollections,
|
||||
|
@ -1,7 +1,4 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import {
|
||||
CollectionTriggerNode,
|
||||
UpdateRecordNode,
|
||||
apiCreateWorkflow,
|
||||
apiDeleteWorkflow,
|
||||
apiGetList,
|
||||
@ -9,11 +6,15 @@ import {
|
||||
apiGetWorkflowNodeExecutions,
|
||||
apiUpdateWorkflowTrigger,
|
||||
appendJsonCollectionName,
|
||||
CollectionTriggerNode,
|
||||
generalWithNoRelationalFields,
|
||||
UpdateRecordNode,
|
||||
} from '@tachybase/plugin-workflow-test/e2e';
|
||||
import { expect, test } from '@tachybase/test/e2e';
|
||||
import { dayjs } from '@tachybase/utils';
|
||||
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
test('Collection event add data trigger, filter single line text field not empty, common table single line text field data, set single line text field constant data', async ({
|
||||
page,
|
||||
mockCollections,
|
||||
|
@ -1,7 +1,4 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import {
|
||||
CollectionTriggerNode,
|
||||
UpdateRecordNode,
|
||||
apiCreateWorkflow,
|
||||
apiDeleteWorkflow,
|
||||
apiGetList,
|
||||
@ -9,11 +6,15 @@ import {
|
||||
apiGetWorkflowNodeExecutions,
|
||||
apiUpdateWorkflowTrigger,
|
||||
appendJsonCollectionName,
|
||||
CollectionTriggerNode,
|
||||
generalWithNoRelationalFields,
|
||||
UpdateRecordNode,
|
||||
} from '@tachybase/plugin-workflow-test/e2e';
|
||||
import { expect, test } from '@tachybase/test/e2e';
|
||||
import { dayjs } from '@tachybase/utils';
|
||||
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
test('Collection event add data trigger, filter single line text field not empty, common table single line text field data, set single line text field constant data', async ({
|
||||
page,
|
||||
mockCollections,
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { QuestionCircleOutlined } from '@ant-design/icons';
|
||||
import { css, useCompile } from '@tachybase/client';
|
||||
import { Checkbox, Space, Tooltip } from 'antd';
|
||||
import React from 'react';
|
||||
import { css, useCompile } from '@tachybase/client';
|
||||
|
||||
import { QuestionCircleOutlined } from '@ant-design/icons';
|
||||
import { Checkbox, Space, Tooltip } from 'antd';
|
||||
|
||||
export interface CheckboxGroupWithTooltipOption {
|
||||
value: any;
|
||||
|
@ -1,17 +1,16 @@
|
||||
import React from 'react';
|
||||
import { uid } from '@tachybase/schema';
|
||||
|
||||
import {
|
||||
CollectionProvider_deprecated,
|
||||
parseCollectionName,
|
||||
SchemaInitializerItem,
|
||||
SchemaInitializerItemType,
|
||||
parseCollectionName,
|
||||
useCollectionManager_deprecated,
|
||||
useRecordCollectionDataSourceItems,
|
||||
useSchemaInitializer,
|
||||
useSchemaInitializerItem,
|
||||
useSchemaTemplateManager,
|
||||
} from '@tachybase/client';
|
||||
import { uid } from '@tachybase/schema';
|
||||
|
||||
import { traverseSchema } from '../utils';
|
||||
|
||||
|
@ -1,19 +1,21 @@
|
||||
import { CloseCircleOutlined, PlusOutlined } from '@ant-design/icons';
|
||||
import { observer, useField, useForm } from '@tachybase/schema';
|
||||
import React, { useMemo } from 'react';
|
||||
import {
|
||||
CollectionField,
|
||||
CollectionProvider_deprecated,
|
||||
SchemaComponent,
|
||||
Variable,
|
||||
css,
|
||||
parseCollectionName,
|
||||
SchemaComponent,
|
||||
useCollectionManager_deprecated,
|
||||
useCompile,
|
||||
useToken,
|
||||
Variable,
|
||||
} from '@tachybase/client';
|
||||
import { observer, useField, useForm } from '@tachybase/schema';
|
||||
|
||||
import { CloseCircleOutlined, PlusOutlined } from '@ant-design/icons';
|
||||
import { Button, Dropdown, Form, Input, MenuProps } from 'antd';
|
||||
import React, { useMemo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { lang } from '../locale';
|
||||
import { useWorkflowVariableOptions } from '../variable';
|
||||
|
||||
|
@ -1,17 +1,17 @@
|
||||
import React, { useMemo, useRef } from 'react';
|
||||
import { createForm } from '@tachybase/schema';
|
||||
import { useField } from '@tachybase/schema';
|
||||
import { get } from 'lodash';
|
||||
import {
|
||||
BlockRequestContext_deprecated,
|
||||
CollectionProvider_deprecated,
|
||||
FormBlockContext,
|
||||
RecordProvider,
|
||||
parseCollectionName,
|
||||
RecordProvider,
|
||||
useAPIClient,
|
||||
useAssociationNames,
|
||||
useBlockRequestContext,
|
||||
} from '@tachybase/client';
|
||||
import { createForm, useField } from '@tachybase/schema';
|
||||
|
||||
import { get } from 'lodash';
|
||||
|
||||
import { useFlowContext } from '../FlowContext';
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { createStyles, cx } from '@tachybase/client';
|
||||
import { Tag } from 'antd';
|
||||
import React from 'react';
|
||||
import { createStyles, cx } from '@tachybase/client';
|
||||
|
||||
import { Tag } from 'antd';
|
||||
|
||||
const useStyles = createStyles(({ css, token }) => {
|
||||
return {
|
||||
|
@ -1,9 +1,8 @@
|
||||
import React, { useCallback, useMemo, useState } from 'react';
|
||||
import { cloneDeep } from 'lodash';
|
||||
import { createForm } from '@tachybase/schema';
|
||||
import { useForm } from '@tachybase/schema';
|
||||
|
||||
import { ActionContextProvider, FormProvider } from '@tachybase/client';
|
||||
import { createForm, useForm } from '@tachybase/schema';
|
||||
|
||||
import { cloneDeep } from 'lodash';
|
||||
|
||||
export function useFormProviderProps() {
|
||||
return { form: useForm() };
|
||||
|
@ -1,10 +1,10 @@
|
||||
import React, { useCallback } from 'react';
|
||||
import { Button, Modal, Select, Tag, Tooltip, message } from 'antd';
|
||||
import { ExclamationCircleFilled, StopOutlined } from '@ant-design/icons';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { Action, css, useCompile, useRecord, useResourceActionContext, useResourceContext } from '@tachybase/client';
|
||||
|
||||
import { ExclamationCircleFilled, StopOutlined } from '@ant-design/icons';
|
||||
import { Button, message, Modal, Select, Tag, Tooltip } from 'antd';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { EXECUTION_STATUS, ExecutionStatusOptions, ExecutionStatusOptionsMap } from '../constants';
|
||||
import { lang } from '../locale';
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { observer, useForm } from '@tachybase/schema';
|
||||
import { Select } from 'antd';
|
||||
import React from 'react';
|
||||
|
||||
import { parseCollectionName, useCollectionManager_deprecated, useCompile } from '@tachybase/client';
|
||||
import { observer, useForm } from '@tachybase/schema';
|
||||
|
||||
import { Select } from 'antd';
|
||||
|
||||
function defaultFilter() {
|
||||
return true;
|
||||
|
@ -1,5 +1,4 @@
|
||||
import React from 'react';
|
||||
|
||||
import { Variable } from '@tachybase/client';
|
||||
|
||||
import { useWorkflowVariableOptions } from '../variable';
|
||||
|
@ -1,7 +1,6 @@
|
||||
import React, { useState } from 'react';
|
||||
import { useFieldSchema } from '@tachybase/schema';
|
||||
|
||||
import { ActionContextProvider, SchemaComponent } from '@tachybase/client';
|
||||
import { useFieldSchema } from '@tachybase/schema';
|
||||
|
||||
export default function ({ component = 'div', children, ...props }) {
|
||||
const [visible, setVisible] = useState(false);
|
||||
|
@ -1,6 +1,4 @@
|
||||
import React from 'react';
|
||||
import { useFieldSchema } from '@tachybase/schema';
|
||||
|
||||
import {
|
||||
GeneralSchemaDesigner,
|
||||
SchemaSettingsBlockTitleItem,
|
||||
@ -8,6 +6,7 @@ import {
|
||||
SchemaSettingsRemove,
|
||||
useCompile,
|
||||
} from '@tachybase/client';
|
||||
import { useFieldSchema } from '@tachybase/schema';
|
||||
|
||||
export function SimpleDesigner() {
|
||||
const schema = useFieldSchema();
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { useFieldSchema } from '@tachybase/schema';
|
||||
import { css, SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '@tachybase/client';
|
||||
import { parse } from '@tachybase/utils/client';
|
||||
import React from 'react';
|
||||
import { css, SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '@tachybase/client';
|
||||
import { useFieldSchema } from '@tachybase/schema';
|
||||
import { parse } from '@tachybase/utils/client';
|
||||
|
||||
import { useFlowContext } from '../FlowContext';
|
||||
import { SimpleDesigner } from './SimpleDesigner';
|
||||
|
||||
|
@ -1,14 +1,16 @@
|
||||
import React from 'react';
|
||||
|
||||
import {
|
||||
CloseOutlined,
|
||||
ClockCircleOutlined,
|
||||
CheckOutlined,
|
||||
MinusOutlined,
|
||||
ClockCircleOutlined,
|
||||
CloseOutlined,
|
||||
ExclamationOutlined,
|
||||
HourglassOutlined,
|
||||
LoadingOutlined,
|
||||
MinusOutlined,
|
||||
RedoOutlined,
|
||||
} from '@ant-design/icons';
|
||||
|
||||
import { NAMESPACE } from './locale';
|
||||
|
||||
export const EXECUTION_STATUS = {
|
||||
|
@ -1,16 +1,16 @@
|
||||
import { useForm } from '@tachybase/schema';
|
||||
|
||||
import {
|
||||
SchemaInitializerItemType,
|
||||
useCollectionDataSource,
|
||||
useCollectionManager_deprecated,
|
||||
useCompile,
|
||||
} from '@tachybase/client';
|
||||
import { NAMESPACE, lang } from '../../locale';
|
||||
import { Trigger } from '../../triggers';
|
||||
import { useForm } from '@tachybase/schema';
|
||||
|
||||
import { CollectionBlockInitializer } from '../../components';
|
||||
import { getCollectionFieldOptions } from '../../variable';
|
||||
import { useWorkflowAnyExecuted } from '../../hooks';
|
||||
import { lang, NAMESPACE } from '../../locale';
|
||||
import { Trigger } from '../../triggers';
|
||||
import { getCollectionFieldOptions } from '../../variable';
|
||||
|
||||
export class ActionTrigger extends Trigger {
|
||||
title = `{{t("Action event", { ns: "${NAMESPACE}" })}}`;
|
||||
|
@ -1,19 +1,20 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import {
|
||||
FormEventTriggerNode,
|
||||
WorkflowListRecords,
|
||||
apiCreateRecordTriggerFormEvent,
|
||||
apiCreateWorkflow,
|
||||
apiDeleteWorkflow,
|
||||
apiGetDataSourceCount,
|
||||
apiGetWorkflow,
|
||||
apiUpdateWorkflowTrigger,
|
||||
appendJsonCollectionName,
|
||||
FormEventTriggerNode,
|
||||
generalWithNoRelationalFields,
|
||||
apiGetDataSourceCount,
|
||||
WorkflowListRecords,
|
||||
} from '@tachybase/plugin-workflow-test/e2e';
|
||||
import { expect, test } from '@tachybase/test/e2e';
|
||||
import { dayjs } from '@tachybase/utils';
|
||||
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
test.describe('Configuration page to configure the Trigger node', () => {
|
||||
test('Form Submit Button Binding Workflow Add Data Trigger', async ({
|
||||
page,
|
||||
|
@ -1,20 +1,21 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import {
|
||||
CreateWorkFlow,
|
||||
EditWorkFlow,
|
||||
FormEventTriggerNode,
|
||||
WorkflowListRecords,
|
||||
apiCreateRecordTriggerFormEvent,
|
||||
apiCreateWorkflow,
|
||||
apiDeleteWorkflow,
|
||||
apiGetWorkflow,
|
||||
apiUpdateWorkflowTrigger,
|
||||
appendJsonCollectionName,
|
||||
CreateWorkFlow,
|
||||
EditWorkFlow,
|
||||
FormEventTriggerNode,
|
||||
generalWithNoRelationalFields,
|
||||
WorkflowListRecords,
|
||||
} from '@tachybase/plugin-workflow-test/e2e';
|
||||
import { expect, test } from '@tachybase/test/e2e';
|
||||
import { dayjs } from '@tachybase/utils';
|
||||
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
test.describe('Filter', () => {
|
||||
test('filter workflow name', async ({ page }) => {
|
||||
//添加工作流
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Plugin, SchemaInitializerItemType } from '@tachybase/client';
|
||||
import WorkflowPlugin, { useRecordTriggerWorkflowsActionProps, useTriggerWorkflowsActionProps } from '../..';
|
||||
|
||||
import WorkflowPlugin, { useRecordTriggerWorkflowsActionProps, useTriggerWorkflowsActionProps } from '../..';
|
||||
import { ActionTrigger } from './ActionTrigger';
|
||||
|
||||
const submitToWorkflowActionInitializer: SchemaInitializerItemType = {
|
||||
|
@ -1,17 +1,19 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import {
|
||||
AggregateNode,
|
||||
CollectionTriggerNode,
|
||||
apiCreateWorkflow,
|
||||
apiDeleteWorkflow,
|
||||
apiGetWorkflow,
|
||||
apiGetWorkflowNodeExecutions,
|
||||
apiUpdateWorkflowTrigger,
|
||||
appendJsonCollectionName,
|
||||
CollectionTriggerNode,
|
||||
generalWithNoRelationalFields,
|
||||
} from '@tachybase/plugin-workflow-test/e2e';
|
||||
import { expect, test } from '@tachybase/test/e2e';
|
||||
import { dayjs } from '@tachybase/utils';
|
||||
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
test.describe('no filter', () => {
|
||||
test('Collection event add data trigger, normal table integer fields not de-emphasised COUNT', async ({
|
||||
page,
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Plugin } from '@tachybase/client';
|
||||
import WorkflowPlugin from '../..';
|
||||
|
||||
import WorkflowPlugin from '../..';
|
||||
import AggregateInstruction from './AggregateInstruction';
|
||||
|
||||
export class PluginAggregate extends Plugin {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Plugin } from '@tachybase/client';
|
||||
import WorkflowPlugin from '../..';
|
||||
|
||||
import WorkflowPlugin from '../..';
|
||||
import DelayInstruction from './DelayInstruction';
|
||||
|
||||
export class PluginDelay extends Plugin {
|
||||
|
@ -1,12 +1,20 @@
|
||||
import { onFieldInputValueChange, onFormInitialValuesChange } from '@tachybase/schema';
|
||||
import { connect, mapReadPretty, observer, useField, useForm, useFormEffects } from '@tachybase/schema';
|
||||
import { Tag } from 'antd';
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import { useCollectionManager_deprecated, useCompile, useRecord, Variable } from '@tachybase/client';
|
||||
import {
|
||||
connect,
|
||||
mapReadPretty,
|
||||
observer,
|
||||
onFieldInputValueChange,
|
||||
onFormInitialValuesChange,
|
||||
useField,
|
||||
useForm,
|
||||
useFormEffects,
|
||||
} from '@tachybase/schema';
|
||||
|
||||
import { Tag } from 'antd';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { useCollectionManager_deprecated, useCompile, useRecord, Variable } from '@tachybase/client';
|
||||
import { getCollectionFieldOptions } from '../..';
|
||||
|
||||
import { NAMESPACE } from '../../locale';
|
||||
|
||||
const InternalExpression = observer(
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Plugin } from '@tachybase/client';
|
||||
import WorkflowPlugin from '../..';
|
||||
|
||||
import WorkflowPlugin from '../..';
|
||||
import DynamicCalculation from './DynamicCalculation';
|
||||
import { DynamicExpression } from './DynamicExpression';
|
||||
import { ExpressionFieldInterface } from './expression';
|
||||
|
@ -1,14 +1,9 @@
|
||||
import { useCollectionDataSource, useCollectionManager_deprecated, useCompile } from '@tachybase/client';
|
||||
import {
|
||||
CheckboxGroupWithTooltip,
|
||||
CollectionBlockInitializer,
|
||||
FieldsSelect,
|
||||
getCollectionFieldOptions,
|
||||
RadioWithTooltip,
|
||||
Trigger,
|
||||
} from '@tachybase/plugin-workflow/client';
|
||||
|
||||
import { CheckboxGroupWithTooltip, CollectionBlockInitializer, FieldsSelect, RadioWithTooltip } from '../../components';
|
||||
import { lang, tval } from '../../locale';
|
||||
import { Trigger } from '../../triggers';
|
||||
import { getCollectionFieldOptions } from '../../variable';
|
||||
|
||||
const enum ACTION_TYPES {
|
||||
CREATE = 'create',
|
||||
@ -96,9 +91,9 @@ export class WorkflowTriggerInterceptor extends Trigger {
|
||||
};
|
||||
scope = { useCollectionDataSource };
|
||||
components = {
|
||||
FieldsSelect: FieldsSelect,
|
||||
RadioWithTooltip: RadioWithTooltip,
|
||||
CheckboxGroupWithTooltip: CheckboxGroupWithTooltip,
|
||||
FieldsSelect,
|
||||
RadioWithTooltip,
|
||||
CheckboxGroupWithTooltip,
|
||||
};
|
||||
isActionTriggerable = (a, u) => {
|
||||
const { global: m } = a;
|
@ -1,6 +1,6 @@
|
||||
import { Plugin } from '@tachybase/client';
|
||||
import PluginWorkflow from '@tachybase/plugin-workflow/client';
|
||||
|
||||
import PluginWorkflow from '../..';
|
||||
import { WorkflowTriggerInterceptor } from './WorkflowTriggerInterceptor';
|
||||
|
||||
export class PluginWorkflowInterceptor extends Plugin {
|
@ -1,6 +1,6 @@
|
||||
import { Plugin } from '@tachybase/client';
|
||||
import WorkflowPlugin from '../..';
|
||||
|
||||
import WorkflowPlugin from '../..';
|
||||
import LoopInstruction from './LoopInstruction';
|
||||
|
||||
export class PluginLoop extends Plugin {
|
||||
|
@ -1,32 +1,33 @@
|
||||
import { observer, useField, useFieldSchema, useForm } from '@tachybase/schema';
|
||||
import { Space, Spin, Tag } from 'antd';
|
||||
import { dayjs } from '@tachybase/utils/client';
|
||||
import React, { createContext, useContext, useEffect, useState } from 'react';
|
||||
|
||||
import { css, useCompile, usePlugin } from '@tachybase/client';
|
||||
|
||||
import {
|
||||
css,
|
||||
ExtendCollectionsProvider,
|
||||
SchemaComponent,
|
||||
SchemaComponentContext,
|
||||
TableBlockProvider,
|
||||
useAPIClient,
|
||||
useActionContext,
|
||||
useAPIClient,
|
||||
useCompile,
|
||||
useCurrentUserContext,
|
||||
useFormBlockContext,
|
||||
usePlugin,
|
||||
useRecord,
|
||||
useTableBlockContext,
|
||||
ExtendCollectionsProvider,
|
||||
} from '@tachybase/client';
|
||||
import { observer, useField, useFieldSchema, useForm } from '@tachybase/schema';
|
||||
import { dayjs } from '@tachybase/utils/client';
|
||||
|
||||
import { Space, Spin, Tag } from 'antd';
|
||||
|
||||
import WorkflowPlugin, {
|
||||
DetailsBlockProvider,
|
||||
FlowContext,
|
||||
linkNodes,
|
||||
useAvailableUpstreams,
|
||||
useFlowContext,
|
||||
DetailsBlockProvider,
|
||||
} from '../..';
|
||||
import { JobStatusOptions, JobStatusOptionsMap } from '../../constants';
|
||||
|
||||
import { NAMESPACE, lang } from '../../locale';
|
||||
import { lang, NAMESPACE } from '../../locale';
|
||||
import { FormBlockProvider } from './instruction/FormBlockProvider';
|
||||
import { ManualFormType, manualFormTypes } from './instruction/SchemaConfig';
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { TableOutlined } from '@ant-design/icons';
|
||||
import React, { FC } from 'react';
|
||||
|
||||
import { SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '@tachybase/client';
|
||||
|
||||
import { TableOutlined } from '@ant-design/icons';
|
||||
|
||||
export const WorkflowTodoBlockInitializer: FC<any> = () => {
|
||||
const itemConfig = useSchemaInitializerItem();
|
||||
const { insert } = useSchemaInitializer();
|
||||
|
@ -1,20 +1,21 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import {
|
||||
CollectionTriggerNode,
|
||||
ManualNode,
|
||||
apiCreateWorkflow,
|
||||
apiDeleteWorkflow,
|
||||
apiGetDataSourceCount,
|
||||
apiGetRecord,
|
||||
apiGetWorkflow,
|
||||
apiGetWorkflowNodeExecutions,
|
||||
apiUpdateWorkflowTrigger,
|
||||
appendJsonCollectionName,
|
||||
CollectionTriggerNode,
|
||||
generalWithNoRelationalFields,
|
||||
apiGetDataSourceCount,
|
||||
ManualNode,
|
||||
} from '@tachybase/plugin-workflow-test/e2e';
|
||||
import { expect, test } from '@tachybase/test/e2e';
|
||||
import { dayjs } from '@tachybase/utils';
|
||||
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
test.describe('block configuration', () => {});
|
||||
|
||||
test.describe('field configuration', () => {});
|
||||
|
@ -1,18 +1,19 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import {
|
||||
CollectionTriggerNode,
|
||||
ManualNode,
|
||||
apiCreateWorkflow,
|
||||
apiDeleteWorkflow,
|
||||
apiGetWorkflow,
|
||||
apiGetWorkflowNodeExecutions,
|
||||
apiUpdateWorkflowTrigger,
|
||||
appendJsonCollectionName,
|
||||
CollectionTriggerNode,
|
||||
generalWithNoRelationalFields,
|
||||
ManualNode,
|
||||
} from '@tachybase/plugin-workflow-test/e2e';
|
||||
import { expect, test } from '@tachybase/test/e2e';
|
||||
import { dayjs } from '@tachybase/utils';
|
||||
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
test.describe('block configuration', () => {});
|
||||
|
||||
test.describe('field configuration', () => {});
|
||||
|
@ -1,11 +1,5 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import {
|
||||
AggregateNode,
|
||||
ClculationNode,
|
||||
CollectionTriggerNode,
|
||||
CreateRecordNode,
|
||||
ManualNode,
|
||||
QueryRecordNode,
|
||||
apiCreateWorkflow,
|
||||
apiCreateWorkflowNode,
|
||||
apiDeleteWorkflow,
|
||||
@ -15,11 +9,18 @@ import {
|
||||
apiGetWorkflowNode,
|
||||
apiUpdateWorkflowTrigger,
|
||||
appendJsonCollectionName,
|
||||
ClculationNode,
|
||||
CollectionTriggerNode,
|
||||
CreateRecordNode,
|
||||
generalWithNoRelationalFields,
|
||||
ManualNode,
|
||||
QueryRecordNode,
|
||||
} from '@tachybase/plugin-workflow-test/e2e';
|
||||
import { expect, test } from '@tachybase/test/e2e';
|
||||
import { dayjs } from '@tachybase/utils';
|
||||
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
test.describe('field data', () => {
|
||||
test('Collection event to add a data trigger, get a single line of text data for the trigger node', async ({
|
||||
page,
|
||||
|
@ -1,20 +1,21 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import {
|
||||
CollectionTriggerNode,
|
||||
ManualNode,
|
||||
apiCreateWorkflow,
|
||||
apiDeleteWorkflow,
|
||||
apiFilterList,
|
||||
apiGetDataSourceCount,
|
||||
apiGetWorkflow,
|
||||
apiGetWorkflowNodeExecutions,
|
||||
apiUpdateWorkflowTrigger,
|
||||
appendJsonCollectionName,
|
||||
CollectionTriggerNode,
|
||||
generalWithNoRelationalFields,
|
||||
apiGetDataSourceCount,
|
||||
ManualNode,
|
||||
} from '@tachybase/plugin-workflow-test/e2e';
|
||||
import { expect, test } from '@tachybase/test/e2e';
|
||||
import { dayjs } from '@tachybase/utils';
|
||||
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
test.describe('block configuration', () => {});
|
||||
|
||||
test.describe('field configuration', () => {});
|
||||
|
@ -1,18 +1,19 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import {
|
||||
CollectionTriggerNode,
|
||||
ManualNode,
|
||||
apiCreateWorkflow,
|
||||
apiDeleteWorkflow,
|
||||
apiGetDataSourceCount,
|
||||
apiGetWorkflow,
|
||||
apiUpdateWorkflowTrigger,
|
||||
appendJsonCollectionName,
|
||||
CollectionTriggerNode,
|
||||
generalWithNoRelationalFields,
|
||||
apiGetDataSourceCount,
|
||||
ManualNode,
|
||||
} from '@tachybase/plugin-workflow-test/e2e';
|
||||
import { expect, test } from '@tachybase/test/e2e';
|
||||
import { dayjs } from '@tachybase/utils';
|
||||
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
test('filter task node', async ({ page, mockPage, mockCollections, mockRecords }) => {
|
||||
//数据表后缀标识
|
||||
const triggerNodeAppendText = 'a' + faker.string.alphanumeric(4);
|
||||
|
@ -1,18 +1,17 @@
|
||||
import { Plugin } from '@tachybase/client';
|
||||
|
||||
import WorkflowPlugin from '../..';
|
||||
|
||||
import Manual from './instruction';
|
||||
|
||||
import { NAMESPACE } from '../../locale';
|
||||
import { WorkflowTodo } from './WorkflowTodo';
|
||||
import { WorkflowTodoBlockInitializer } from './WorkflowTodoBlockInitializer';
|
||||
import Manual from './instruction';
|
||||
import { addCustomFormField, addCustomFormField_deprecated } from './instruction/forms/custom';
|
||||
import {
|
||||
addActionButton,
|
||||
addActionButton_deprecated,
|
||||
addBlockButton,
|
||||
addBlockButton_deprecated,
|
||||
} from './instruction/SchemaConfig';
|
||||
import { addCustomFormField, addCustomFormField_deprecated } from './instruction/forms/custom';
|
||||
import { WorkflowTodo } from './WorkflowTodo';
|
||||
import { WorkflowTodoBlockInitializer } from './WorkflowTodoBlockInitializer';
|
||||
|
||||
export class PluginManual extends Plugin {
|
||||
async load() {
|
||||
|
@ -1,5 +1,6 @@
|
||||
import React from 'react';
|
||||
import { RemoteSelect, Variable } from '@tachybase/client';
|
||||
|
||||
import { useWorkflowVariableOptions } from '../../..';
|
||||
|
||||
function isUserKeyField(field) {
|
||||
|
@ -1,5 +1,4 @@
|
||||
import React from 'react';
|
||||
|
||||
import {
|
||||
CollectionProvider_deprecated,
|
||||
SchemaInitializerItem,
|
||||
@ -11,7 +10,6 @@ import {
|
||||
} from '@tachybase/client';
|
||||
|
||||
import { JOB_STATUS, traverseSchema } from '../../..';
|
||||
|
||||
import { NAMESPACE } from '../../../locale';
|
||||
import { createManualFormBlockUISchema } from './createManualFormBlockUISchema';
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { createForm } from '@tachybase/schema';
|
||||
import { RecursionField, useField, useFieldSchema } from '@tachybase/schema';
|
||||
import React, { useMemo, useRef } from 'react';
|
||||
import {
|
||||
BlockRequestContext_deprecated,
|
||||
CollectionManagerProvider,
|
||||
@ -16,7 +15,7 @@ import {
|
||||
useDesignable,
|
||||
useRecord,
|
||||
} from '@tachybase/client';
|
||||
import React, { useMemo, useRef } from 'react';
|
||||
import { createForm, RecursionField, useField, useFieldSchema } from '@tachybase/schema';
|
||||
|
||||
export function FormBlockProvider(props) {
|
||||
const userJob = useRecord();
|
||||
|
@ -1,9 +1,10 @@
|
||||
import { QuestionCircleOutlined } from '@ant-design/icons';
|
||||
import { FormLayout } from '@tachybase/components';
|
||||
import { Form, Radio, Tooltip } from 'antd';
|
||||
import React from 'react';
|
||||
|
||||
import { css, FormItem } from '@tachybase/client';
|
||||
import { FormLayout } from '@tachybase/components';
|
||||
|
||||
import { QuestionCircleOutlined } from '@ant-design/icons';
|
||||
import { Form, Radio, Tooltip } from 'antd';
|
||||
|
||||
import { lang } from '../../../locale';
|
||||
|
||||
function parseMode(v) {
|
||||
|
@ -1,5 +1,4 @@
|
||||
import React, { useMemo, useState } from 'react';
|
||||
|
||||
import {
|
||||
GeneralSchemaDesigner,
|
||||
SchemaSettingsBlockTitleItem,
|
||||
@ -13,6 +12,7 @@ import {
|
||||
} from '@tachybase/client';
|
||||
|
||||
import _ from 'lodash';
|
||||
|
||||
import { NAMESPACE } from '../../../../locale';
|
||||
import { FormBlockInitializer } from '../FormBlockInitializer';
|
||||
import { ManualFormType } from '../SchemaConfig';
|
||||
|
@ -1,31 +1,29 @@
|
||||
import React, { useContext, useMemo, useState } from 'react';
|
||||
|
||||
import { ArrayTable } from '@tachybase/components';
|
||||
import { Field, createForm } from '@tachybase/schema';
|
||||
import { useField, useFieldSchema, useForm } from '@tachybase/schema';
|
||||
import { cloneDeep, pick, set } from 'lodash';
|
||||
|
||||
import {
|
||||
ActionContextProvider,
|
||||
CollectionProvider_deprecated,
|
||||
CompatibleSchemaInitializer,
|
||||
FormBlockContext,
|
||||
gridRowColWrap,
|
||||
RecordProvider,
|
||||
SchemaComponent,
|
||||
SchemaInitializerItem,
|
||||
SchemaInitializerItemType,
|
||||
SchemaInitializerItems,
|
||||
gridRowColWrap,
|
||||
useCollectionManager_deprecated,
|
||||
SchemaInitializerItemType,
|
||||
useCollection_deprecated,
|
||||
useCollectionManager_deprecated,
|
||||
useRecord,
|
||||
useSchemaInitializer,
|
||||
useSchemaInitializerItem,
|
||||
} from '@tachybase/client';
|
||||
import { JOB_STATUS } from '../../../..';
|
||||
import { ArrayTable } from '@tachybase/components';
|
||||
import { createForm, Field, useField, useFieldSchema, useForm } from '@tachybase/schema';
|
||||
import { merge, uid } from '@tachybase/utils/client';
|
||||
|
||||
import { NAMESPACE, lang } from '../../../../locale';
|
||||
import { cloneDeep, pick, set } from 'lodash';
|
||||
|
||||
import { JOB_STATUS } from '../../../..';
|
||||
import { lang, NAMESPACE } from '../../../../locale';
|
||||
import { ManualFormType } from '../SchemaConfig';
|
||||
import { findSchema } from '../utils';
|
||||
|
||||
|
@ -1,8 +1,4 @@
|
||||
import { useFieldSchema } from '@tachybase/schema';
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import _ from 'lodash';
|
||||
|
||||
import {
|
||||
GeneralSchemaDesigner,
|
||||
SchemaSettingsActionModalItem,
|
||||
@ -15,12 +11,16 @@ import {
|
||||
useDesignable,
|
||||
useMenuSearch,
|
||||
} from '@tachybase/client';
|
||||
import { useFieldSchema } from '@tachybase/schema';
|
||||
|
||||
import _ from 'lodash';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { FilterDynamicComponent } from '../../../../components';
|
||||
import { NAMESPACE } from '../../../../locale';
|
||||
import { FormBlockInitializer } from '../FormBlockInitializer';
|
||||
import { ManualFormType } from '../SchemaConfig';
|
||||
import { findSchema } from '../utils';
|
||||
import { FilterDynamicComponent } from '../../../../components';
|
||||
|
||||
function UpdateFormDesigner() {
|
||||
const { name, title } = useCollection_deprecated();
|
||||
|
@ -1,20 +1,21 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import {
|
||||
CollectionTriggerNode,
|
||||
apiCreateWorkflow,
|
||||
apiDeleteWorkflow,
|
||||
apiGetWorkflow,
|
||||
apiGetWorkflowNodeExecutions,
|
||||
apiUpdateWorkflowTrigger,
|
||||
appendJsonCollectionName,
|
||||
ClculationNode,
|
||||
CollectionTriggerNode,
|
||||
ConditionYesNode,
|
||||
generalWithNoRelationalFields,
|
||||
ParallelBranchNode,
|
||||
ConditionYesNode,
|
||||
ClculationNode,
|
||||
apiGetWorkflowNodeExecutions,
|
||||
} from '@tachybase/plugin-workflow-test/e2e';
|
||||
import { expect, test } from '@tachybase/test/e2e';
|
||||
import { dayjs } from '@tachybase/utils';
|
||||
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
test.describe('All succeeded', () => {
|
||||
test('All 3 branches were successful', async ({ page, mockCollections, mockRecords }) => {
|
||||
//数据表后缀标识
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Plugin } from '@tachybase/client';
|
||||
import WorkflowPlugin from '../..';
|
||||
|
||||
import WorkflowPlugin from '../..';
|
||||
import ParallelInstruction from './ParallelInstruction';
|
||||
|
||||
export class PluginParallel extends Plugin {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Plugin } from '@tachybase/client';
|
||||
import WorkflowPlugin from '../..';
|
||||
|
||||
import WorkflowPlugin from '../..';
|
||||
import RequestInstruction from './RequestInstruction';
|
||||
|
||||
export class PluginRequest extends Plugin {
|
||||
|
@ -1,24 +1,25 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import {
|
||||
apiCreateWorkflow,
|
||||
apiDeleteWorkflow,
|
||||
apiGetRecord,
|
||||
apiGetWorkflow,
|
||||
apiGetWorkflowNodeExecutions,
|
||||
apiUpdateRecord,
|
||||
apiUpdateWorkflowTrigger,
|
||||
appendJsonCollectionName,
|
||||
CollectionTriggerNode,
|
||||
CreateWorkFlow,
|
||||
EditWorkFlow,
|
||||
WorkflowListRecords,
|
||||
apiCreateWorkflow,
|
||||
apiDeleteWorkflow,
|
||||
apiGetWorkflow,
|
||||
apiUpdateRecord,
|
||||
apiGetWorkflowNodeExecutions,
|
||||
apiUpdateWorkflowTrigger,
|
||||
appendJsonCollectionName,
|
||||
generalWithNoRelationalFields,
|
||||
QueryRecordNode,
|
||||
SQLNode,
|
||||
apiGetRecord,
|
||||
WorkflowListRecords,
|
||||
} from '@tachybase/plugin-workflow-test/e2e';
|
||||
import { expect, test } from '@tachybase/test/e2e';
|
||||
import { dayjs } from '@tachybase/utils';
|
||||
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
test.describe('select data', () => {
|
||||
test('No variable SQL, select 1 record', async ({ page, mockCollections, mockRecords }) => {
|
||||
//数据表后缀标识
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Plugin } from '@tachybase/client';
|
||||
import WorkflowPlugin from '../..';
|
||||
|
||||
import WorkflowPlugin from '../..';
|
||||
import SQLInstruction from './SQLInstruction';
|
||||
|
||||
export class PluginSql extends Plugin {
|
||||
|
@ -0,0 +1,56 @@
|
||||
import React, { useCallback } from 'react';
|
||||
import { Space } from '@tachybase/client';
|
||||
|
||||
import { Radio, Select } from 'antd';
|
||||
|
||||
import { lang } from '../../locale';
|
||||
import { useAvailableUpstreams, useNodeContext } from '../../nodes';
|
||||
import { useStyles } from './useStyles';
|
||||
|
||||
export function VariableTargetSelect({ value, onChange }) {
|
||||
const isNull = value == null;
|
||||
const node = useNodeContext();
|
||||
const nodes = useAvailableUpstreams(node, (n) => n.type === 'variable' && !n.config.target);
|
||||
const { styles } = useStyles();
|
||||
const onTargetChange = useCallback(
|
||||
({ target }) => {
|
||||
if (target.value) return onChange(null);
|
||||
nodes.length && onChange(nodes[0].key);
|
||||
},
|
||||
[onChange, nodes],
|
||||
);
|
||||
const filterOption = useCallback(
|
||||
(t, v) => v.label.toLowerCase().indexOf(t.toLowerCase()) >= 0 || `#${v.data.id}`.indexOf(t) >= 0,
|
||||
[],
|
||||
);
|
||||
return (
|
||||
<fieldset>
|
||||
<Radio.Group value={isNull} onChange={onTargetChange}>
|
||||
<Space direction="vertical">
|
||||
<Radio value={true}>{lang('Declare a new variable')}</Radio>
|
||||
<Space>
|
||||
<Radio value={false} disabled={!nodes.length}>
|
||||
{lang('Assign value to an existing variable')}
|
||||
</Radio>
|
||||
{!isNull && (
|
||||
<Select
|
||||
options={nodes.map((node) => ({ label: node.title, value: node.key, data: node }))}
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
allowClear
|
||||
showSearch
|
||||
filterOption={filterOption}
|
||||
optionRender={({ label, data }) => (
|
||||
<Space>
|
||||
<span>{label}</span>
|
||||
<span className={styles.nodeIdClass}>{data.data.id}</span>
|
||||
</Space>
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
</Space>
|
||||
</Space>
|
||||
</Radio.Group>
|
||||
</fieldset>
|
||||
);
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
import { useCollectionDataSource } from '@tachybase/client';
|
||||
|
||||
import { tval } from '../../locale';
|
||||
import { Instruction } from '../../nodes';
|
||||
import { defaultFieldNames, WorkflowVariableInput } from '../../variable';
|
||||
import { VariableTargetSelect } from './VariableTargetSelect';
|
||||
|
||||
export class VariablesInstruction extends Instruction {
|
||||
title = tval('Variable');
|
||||
type = 'variable';
|
||||
group = 'control';
|
||||
description = tval('Assign value to a variable, for later use.');
|
||||
fieldset = {
|
||||
target: {
|
||||
type: 'string',
|
||||
title: tval('Mode'),
|
||||
'x-decorator': 'FormItem',
|
||||
'x-component': 'VariableTargetSelect',
|
||||
},
|
||||
value: {
|
||||
type: 'string',
|
||||
title: tval('Value'),
|
||||
'x-decorator': 'FormItem',
|
||||
'x-component': 'WorkflowVariableInput',
|
||||
'x-component-props': { useTypedConstant: true },
|
||||
default: '',
|
||||
},
|
||||
};
|
||||
scope = { useCollectionDataSource };
|
||||
components = { WorkflowVariableInput, VariableTargetSelect };
|
||||
useVariables({ key, title, config }, { types, fieldNames = defaultFieldNames }) {
|
||||
return config.target ? null : { [fieldNames.value]: key, [fieldNames.label]: title };
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
import { Plugin } from '@tachybase/client';
|
||||
|
||||
import { PluginWorkflow } from '../../Plugin';
|
||||
import { VariablesInstruction } from './VariablesInstruction';
|
||||
|
||||
export class PluginVariables extends Plugin {
|
||||
async load() {
|
||||
(this.app.pm.get('workflow') as PluginWorkflow).registerInstruction('variable', VariablesInstruction);
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
import { createStyles } from '@tachybase/client';
|
||||
|
||||
export const useStyles = createStyles(({ css, token }) => ({
|
||||
nodeIdClass: css`
|
||||
color: ${token.colorTextDescription};
|
||||
|
||||
&:before {
|
||||
content: '#';
|
||||
}
|
||||
`,
|
||||
}));
|
@ -1,17 +1,17 @@
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { App, message } from 'antd';
|
||||
import { useField, useFieldSchema, useForm } from '@tachybase/schema';
|
||||
|
||||
import {
|
||||
useAPIClient,
|
||||
useActionContext,
|
||||
useAPIClient,
|
||||
useBlockRequestContext,
|
||||
useCollectValuesToSubmit,
|
||||
useCompile,
|
||||
useRecord,
|
||||
} from '@tachybase/client';
|
||||
import { useField, useFieldSchema, useForm } from '@tachybase/schema';
|
||||
import { isURL } from '@tachybase/utils/client';
|
||||
|
||||
import { App, message } from 'antd';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
export function useTriggerWorkflowsActionProps() {
|
||||
const api = useAPIClient();
|
||||
const form = useForm();
|
||||
|
@ -1,132 +1,6 @@
|
||||
import React from 'react';
|
||||
import { Plugin } from '@tachybase/client';
|
||||
import { Registry } from '@tachybase/utils/client';
|
||||
import { PluginWorkflow } from './Plugin';
|
||||
|
||||
import { ExecutionPage } from './ExecutionPage';
|
||||
import { PluginActionTrigger } from './features/action-trigger';
|
||||
import { PluginAggregate } from './features/aggregate';
|
||||
import { PluginAPIRegularClient } from './features/api-regular';
|
||||
import { PluginDelay } from './features/delay';
|
||||
import { PluginDaynamicCalculation } from './features/dynamic-calculation';
|
||||
import PluginWorkflowJSParseClient from './features/js-parse';
|
||||
import PluginWorkflowJsonParseClient from './features/json-parse';
|
||||
import { PluginLoop } from './features/loop';
|
||||
import { PluginManual } from './features/manual';
|
||||
import { PluginParallel } from './features/parallel';
|
||||
import { PluginRequest } from './features/request';
|
||||
import { PluginSql } from './features/sql';
|
||||
import { NAMESPACE } from './locale';
|
||||
import { Instruction } from './nodes';
|
||||
import CalculationInstruction from './nodes/calculation';
|
||||
import ConditionInstruction from './nodes/condition';
|
||||
import CreateInstruction from './nodes/create';
|
||||
import DestroyInstruction from './nodes/destroy';
|
||||
import EndInstruction from './nodes/end';
|
||||
import QueryInstruction from './nodes/query';
|
||||
import UpdateInstruction from './nodes/update';
|
||||
import { customizeSubmitToWorkflowActionSettings } from './settings/customizeSubmitToWorkflowActionSettings';
|
||||
import { Trigger } from './triggers';
|
||||
import CollectionTrigger from './triggers/collection';
|
||||
import ScheduleTrigger from './triggers/schedule';
|
||||
import { getWorkflowDetailPath, getWorkflowExecutionsPath } from './utils';
|
||||
import { WorkflowPage } from './WorkflowPage';
|
||||
import { WorkflowPane } from './WorkflowPane';
|
||||
|
||||
export default class PluginWorkflowClient extends Plugin {
|
||||
triggers = new Registry<Trigger>();
|
||||
instructions = new Registry<Instruction>();
|
||||
getTriggersOptions = () => {
|
||||
return Array.from(this.triggers.getEntities()).map(([value, { title, ...options }]) => ({
|
||||
value,
|
||||
label: title,
|
||||
color: 'gold',
|
||||
options,
|
||||
}));
|
||||
};
|
||||
|
||||
isWorkflowSync(workflow) {
|
||||
return this.triggers.get(workflow.type).sync ?? workflow.sync;
|
||||
}
|
||||
|
||||
registerTrigger(type: string, trigger: Trigger | { new (): Trigger }) {
|
||||
if (typeof trigger === 'function') {
|
||||
this.triggers.register(type, new trigger());
|
||||
} else if (trigger) {
|
||||
this.triggers.register(type, trigger);
|
||||
} else {
|
||||
throw new TypeError('invalid trigger type to register');
|
||||
}
|
||||
}
|
||||
|
||||
registerInstruction(type: string, instruction: Instruction | { new (): Instruction }) {
|
||||
if (typeof instruction === 'function') {
|
||||
this.instructions.register(type, new instruction());
|
||||
} else if (instruction instanceof Instruction) {
|
||||
this.instructions.register(type, instruction);
|
||||
} else {
|
||||
throw new TypeError('invalid instruction type to register');
|
||||
}
|
||||
}
|
||||
|
||||
async afterAdd() {
|
||||
await this.pm.add(PluginSql);
|
||||
await this.pm.add(PluginRequest);
|
||||
await this.pm.add(PluginParallel);
|
||||
await this.pm.add(PluginManual);
|
||||
await this.pm.add(PluginLoop);
|
||||
await this.pm.add(PluginDaynamicCalculation);
|
||||
await this.pm.add(PluginDelay);
|
||||
await this.pm.add(PluginAggregate);
|
||||
await this.pm.add(PluginActionTrigger);
|
||||
await this.pm.add(PluginWorkflowJsonParseClient);
|
||||
await this.pm.add(PluginWorkflowJSParseClient);
|
||||
await this.pm.add(PluginAPIRegularClient);
|
||||
}
|
||||
|
||||
async load() {
|
||||
this.addRoutes();
|
||||
this.addComponents();
|
||||
|
||||
this.app.pluginSettingsManager.add(NAMESPACE, {
|
||||
icon: 'PartitionOutlined',
|
||||
title: `{{t("Workflow", { ns: "${NAMESPACE}" })}}`,
|
||||
Component: WorkflowPane,
|
||||
aclSnippet: 'pm.workflow.workflows',
|
||||
});
|
||||
|
||||
this.app.schemaSettingsManager.add(customizeSubmitToWorkflowActionSettings);
|
||||
|
||||
this.registerTrigger('collection', CollectionTrigger);
|
||||
this.registerTrigger('schedule', ScheduleTrigger);
|
||||
|
||||
this.registerInstruction('calculation', CalculationInstruction);
|
||||
this.registerInstruction('condition', ConditionInstruction);
|
||||
this.registerInstruction('end', EndInstruction);
|
||||
|
||||
this.registerInstruction('query', QueryInstruction);
|
||||
this.registerInstruction('create', CreateInstruction);
|
||||
this.registerInstruction('update', UpdateInstruction);
|
||||
this.registerInstruction('destroy', DestroyInstruction);
|
||||
}
|
||||
|
||||
addComponents() {
|
||||
this.app.addComponents({
|
||||
WorkflowPage,
|
||||
ExecutionPage,
|
||||
});
|
||||
}
|
||||
|
||||
addRoutes() {
|
||||
this.app.router.add('admin.workflow.workflows.id', {
|
||||
path: getWorkflowDetailPath(':id'),
|
||||
element: <WorkflowPage />,
|
||||
});
|
||||
this.app.router.add('admin.workflow.executions.id', {
|
||||
path: getWorkflowExecutionsPath(':id'),
|
||||
element: <ExecutionPage />,
|
||||
});
|
||||
}
|
||||
}
|
||||
export default PluginWorkflow;
|
||||
|
||||
export * from './Branch';
|
||||
export * from './FlowContext';
|
||||
|
@ -5,12 +5,12 @@ import {
|
||||
useCompile,
|
||||
} from '@tachybase/client';
|
||||
|
||||
import { Instruction } from '.';
|
||||
import { CollectionBlockInitializer } from '../components/CollectionBlockInitializer';
|
||||
import CollectionFieldset from '../components/CollectionFieldset';
|
||||
import { NAMESPACE } from '../locale';
|
||||
import { appends, collection, values } from '../schemas/collection';
|
||||
import { getCollectionFieldOptions } from '../variable';
|
||||
import { Instruction } from '.';
|
||||
|
||||
export default class extends Instruction {
|
||||
title = `{{t("Create record", { ns: "${NAMESPACE}" })}}`;
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { useCollectionDataSource } from '@tachybase/client';
|
||||
|
||||
import { Instruction } from '.';
|
||||
import { FilterDynamicComponent } from '../components/FilterDynamicComponent';
|
||||
import { lang, NAMESPACE } from '../locale';
|
||||
import { collection, filter } from '../schemas/collection';
|
||||
import { isValidFilter } from '../utils';
|
||||
import { Instruction } from '.';
|
||||
import { NAMESPACE, lang } from '../locale';
|
||||
|
||||
export default class extends Instruction {
|
||||
title = '{{t("Delete record")}}';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Instruction } from '.';
|
||||
import { NAMESPACE } from '../locale';
|
||||
import { JOB_STATUS } from '../constants';
|
||||
import { NAMESPACE } from '../locale';
|
||||
|
||||
export default class extends Instruction {
|
||||
title = `{{t("End process", { ns: "${NAMESPACE}" })}}`;
|
||||
|
@ -1,5 +1,3 @@
|
||||
import { ArrayItems } from '@tachybase/components';
|
||||
|
||||
import {
|
||||
SchemaComponentContext,
|
||||
SchemaInitializerItemType,
|
||||
@ -7,14 +5,15 @@ import {
|
||||
useCollectionManager_deprecated,
|
||||
useCompile,
|
||||
} from '@tachybase/client';
|
||||
|
||||
import { ArrayItems } from '@tachybase/components';
|
||||
import { useForm } from '@tachybase/schema';
|
||||
|
||||
import { Instruction } from '.';
|
||||
import { CollectionBlockInitializer } from '../components/CollectionBlockInitializer';
|
||||
import { FilterDynamicComponent } from '../components/FilterDynamicComponent';
|
||||
import { NAMESPACE } from '../locale';
|
||||
import { appends, collection, filter, pagination, sort } from '../schemas/collection';
|
||||
import { WorkflowVariableInput, getCollectionFieldOptions } from '../variable';
|
||||
import { Instruction } from '.';
|
||||
import { getCollectionFieldOptions, WorkflowVariableInput } from '../variable';
|
||||
|
||||
export default class extends Instruction {
|
||||
title = `{{t("Query record", { ns: "${NAMESPACE}" })}}`;
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { useForm } from '@tachybase/schema';
|
||||
import { css, parseCollectionName, useCollectionFilterOptions } from '@tachybase/client';
|
||||
import { useForm } from '@tachybase/schema';
|
||||
|
||||
import { NAMESPACE } from '../locale';
|
||||
|
||||
export const collection = {
|
||||
|
@ -1,5 +1,3 @@
|
||||
import { useFieldSchema } from '@tachybase/schema';
|
||||
import { isValid } from '@tachybase/schema';
|
||||
import {
|
||||
AfterSuccess,
|
||||
AssignedFieldValues,
|
||||
@ -8,9 +6,10 @@ import {
|
||||
SchemaSettings,
|
||||
SecondConFirm,
|
||||
SkipValidation,
|
||||
WorkflowConfig,
|
||||
useSchemaToolbar,
|
||||
WorkflowConfig,
|
||||
} from '@tachybase/client';
|
||||
import { isValid, useFieldSchema } from '@tachybase/schema';
|
||||
|
||||
export const customizeSubmitToWorkflowActionSettings = new SchemaSettings({
|
||||
name: 'actionSettings:submitToWorkflow',
|
||||
|
@ -4,13 +4,14 @@ import {
|
||||
useCollectionManager_deprecated,
|
||||
useCompile,
|
||||
} from '@tachybase/client';
|
||||
|
||||
import { Trigger } from '.';
|
||||
import { CollectionBlockInitializer } from '../components/CollectionBlockInitializer';
|
||||
import { FieldsSelect } from '../components/FieldsSelect';
|
||||
import { NAMESPACE, lang } from '../locale';
|
||||
import { useWorkflowAnyExecuted } from '../hooks';
|
||||
import { lang, NAMESPACE } from '../locale';
|
||||
import { appends, collection, filter } from '../schemas/collection';
|
||||
import { getCollectionFieldOptions } from '../variable';
|
||||
import { useWorkflowAnyExecuted } from '../hooks';
|
||||
import { Trigger } from '.';
|
||||
|
||||
const COLLECTION_TRIGGER_MODE = {
|
||||
CREATED: 1,
|
||||
|
@ -1,7 +1,9 @@
|
||||
import { css } from '@tachybase/client';
|
||||
import { DatePicker, Select } from 'antd';
|
||||
import { dayjs } from '@tachybase/utils/client';
|
||||
import React from 'react';
|
||||
import { css } from '@tachybase/client';
|
||||
import { dayjs } from '@tachybase/utils/client';
|
||||
|
||||
import { DatePicker, Select } from 'antd';
|
||||
|
||||
import { useWorkflowTranslation } from '../../locale';
|
||||
import { OnField } from './OnField';
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { css } from '@tachybase/client';
|
||||
import { InputNumber, Select } from 'antd';
|
||||
import React, { useState } from 'react';
|
||||
import { css } from '@tachybase/client';
|
||||
|
||||
import { InputNumber, Select } from 'antd';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { FieldsSelect } from '../../components/FieldsSelect';
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { onFieldValueChange } from '@tachybase/schema';
|
||||
import { useForm, useFormEffects, ISchema } from '@tachybase/schema';
|
||||
import { css, SchemaComponent } from '@tachybase/client';
|
||||
import React, { useState } from 'react';
|
||||
import { css, SchemaComponent } from '@tachybase/client';
|
||||
import { ISchema, onFieldValueChange, useForm, useFormEffects } from '@tachybase/schema';
|
||||
|
||||
import { NAMESPACE } from '../../locale';
|
||||
import { appends, collection } from '../../schemas/collection';
|
||||
import { SCHEDULE_MODE } from './constants';
|
||||
|
@ -5,12 +5,12 @@ import {
|
||||
useCompile,
|
||||
} from '@tachybase/client';
|
||||
|
||||
import { CollectionBlockInitializer } from '../../components/CollectionBlockInitializer';
|
||||
import { NAMESPACE, lang } from '../../locale';
|
||||
import { getCollectionFieldOptions } from '../../variable';
|
||||
import { Trigger } from '..';
|
||||
import { ScheduleConfig } from './ScheduleConfig';
|
||||
import { CollectionBlockInitializer } from '../../components/CollectionBlockInitializer';
|
||||
import { lang, NAMESPACE } from '../../locale';
|
||||
import { getCollectionFieldOptions } from '../../variable';
|
||||
import { SCHEDULE_MODE } from './constants';
|
||||
import { ScheduleConfig } from './ScheduleConfig';
|
||||
|
||||
export default class extends Trigger {
|
||||
sync = false;
|
||||
|
@ -1,11 +1,10 @@
|
||||
import React from 'react';
|
||||
import { parseCollectionName, useCompile, usePlugin, Variable } from '@tachybase/client';
|
||||
|
||||
import { Variable, parseCollectionName, useCompile, usePlugin } from '@tachybase/client';
|
||||
|
||||
import { useFlowContext } from './FlowContext';
|
||||
import { NAMESPACE, lang } from './locale';
|
||||
import { useAvailableUpstreams, useNodeContext, useUpstreamScopes } from './nodes';
|
||||
import WorkflowPlugin from '.';
|
||||
import { useFlowContext } from './FlowContext';
|
||||
import { lang, NAMESPACE } from './locale';
|
||||
import { useAvailableUpstreams, useNodeContext, useUpstreamScopes } from './nodes';
|
||||
|
||||
export type VariableOption = {
|
||||
key?: string;
|
||||
|
@ -13,6 +13,7 @@ import { PluginAggregate } from './features/aggregate/Plugin';
|
||||
import PluginWorkflowAPIRegularServer from './features/api-regular/plugin';
|
||||
import { PluginDelay } from './features/delay/Plugin';
|
||||
import { PluginDynamicCalculation } from './features/dynamic-calculation/Plugin';
|
||||
import { PluginInterception } from './features/interception';
|
||||
import PluginWorkflowJSParseServer from './features/js-parse/plugin';
|
||||
import PluginWorkflowJSONParseServer from './features/json-parse/plugin';
|
||||
import { PluginLoop } from './features/loop/Plugin';
|
||||
@ -20,6 +21,7 @@ import { PluginManual } from './features/manual/Plugin';
|
||||
import { PluginParallel } from './features/parallel/Plugin';
|
||||
import { PluginRequest } from './features/request/Plugin';
|
||||
import { PluginSql } from './features/sql/Plugin';
|
||||
import { PluginVariables } from './features/variables';
|
||||
import initFunctions, { CustomFunction } from './functions';
|
||||
import { Instruction, InstructionInterface } from './instructions';
|
||||
import CalculationInstruction from './instructions/CalculationInstruction';
|
||||
@ -68,6 +70,8 @@ export default class PluginWorkflowServer extends Plugin {
|
||||
pluginJSONParse: PluginWorkflowJSONParseServer;
|
||||
pluginJSParse: PluginWorkflowJSParseServer;
|
||||
pluginAPIRegular: PluginWorkflowAPIRegularServer;
|
||||
pluginInterception: PluginInterception;
|
||||
pluginVariables: PluginVariables;
|
||||
|
||||
constructor(app: Application, options?: PluginOptions) {
|
||||
super(app, options);
|
||||
@ -83,6 +87,8 @@ export default class PluginWorkflowServer extends Plugin {
|
||||
this.pluginJSONParse = new PluginWorkflowJSONParseServer(app, options);
|
||||
this.pluginJSParse = new PluginWorkflowJSParseServer(app, options);
|
||||
this.pluginAPIRegular = new PluginWorkflowAPIRegularServer(app, options);
|
||||
this.pluginInterception = new PluginInterception(app, options);
|
||||
this.pluginVariables = new PluginVariables(app, options);
|
||||
}
|
||||
|
||||
getLogger(workflowId: ID): Logger {
|
||||
@ -309,6 +315,8 @@ export default class PluginWorkflowServer extends Plugin {
|
||||
await this.pluginJSONParse.load();
|
||||
await this.pluginJSParse.load();
|
||||
await this.pluginAPIRegular.load();
|
||||
await this.pluginInterception.load();
|
||||
await this.pluginVariables.load();
|
||||
}
|
||||
|
||||
toggle(workflow: WorkflowModel, enable?: boolean) {
|
||||
|
@ -2,9 +2,10 @@ import { Model, Transaction, Transactionable } from '@tachybase/database';
|
||||
import { appendArrayColumn } from '@tachybase/evaluators';
|
||||
import { Logger } from '@tachybase/logger';
|
||||
import { parse } from '@tachybase/utils';
|
||||
import type Plugin from './Plugin';
|
||||
|
||||
import { EXECUTION_STATUS, JOB_STATUS } from './constants';
|
||||
import { Runner } from './instructions';
|
||||
import type Plugin from './Plugin';
|
||||
import type { ExecutionModel, FlowNodeModel, JobModel } from './types';
|
||||
|
||||
export interface ProcessorOptions extends Transactionable {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { MockServer } from '@tachybase/test';
|
||||
import Database from '@tachybase/database';
|
||||
import { getApp, sleep } from '@tachybase/plugin-workflow-test';
|
||||
import { MockServer } from '@tachybase/test';
|
||||
|
||||
import Plugin from '..';
|
||||
import { EXECUTION_STATUS } from '../constants';
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user