Junyi e5507d0758
refactor(plugin-workflow): change task center api and ui (#6272)
* refactor(plugin-workflow): change task center api and ui

* fix(client): add className property for Grid.Col

* refactor(plugin-workflow): adjust tasks menu style

* fix(plugin-workflow): fix menu title

* feat(plugin-workflow): automatically update tasks number

* fix(plugin-workflow): ignore ws if not exist

* fix(plugin-workflow): fix compatibility of no user approvals

* refactor(server): revert ws api back

* fix(plugin-workflow-manual): fix migration and renamed test cases

* fix(plugin-workflow): fix acl for task resource

* refactor(client): show badge number in toolbar

* fix(plugin-workflow): fix toolbar number

* fix(client): adjust badge font size

* refactor(plugin-workflow): adjust task center style and api

* fix(plugin-workflow-manual): fix constants

* refactor(plugin-workflow-manual): change legacy workflow todo block to list style

* test(plugin-workflow-manual): migrations

* refactor(plugin-workflow): add workflow title component

* fix(plugin-workflow-manual): fix e2e test cases

* fix(plugin-workflow): fix test kit
2025-03-10 19:58:33 +08:00

70 lines
2.3 KiB
TypeScript

/**
* This file is part of the NocoBase (R) project.
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
* Authors: NocoBase Team.
*
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
* For more information, please refer to: https://www.nocobase.com/agreement.
*/
import { Plugin } from '@nocobase/client';
import WorkflowPlugin from '@nocobase/plugin-workflow/client';
import Manual from './instruction';
import { NAMESPACE } from '../locale';
import { WorkflowManualProvider } from './WorkflowManualProvider';
import { manualTodo, WorkflowTodo } from './WorkflowTodo';
import {
addActionButton,
addActionButton_deprecated,
addBlockButton,
addBlockButton_deprecated,
} from './instruction/SchemaConfig';
import { addCustomFormField, addCustomFormField_deprecated } from './instruction/forms/custom';
import { MANUAL_TASK_TYPE } from '../common/constants';
export default class extends Plugin {
async afterAdd() {
// await this.app.pm.add()
}
// You can get and modify the app instance here
async load() {
this.addComponents();
this.app.addProvider(WorkflowManualProvider);
const workflow = this.app.pm.get('workflow') as WorkflowPlugin;
workflow.registerInstruction('manual', Manual);
workflow.registerTaskType(MANUAL_TASK_TYPE, manualTodo);
this.app.schemaInitializerManager.add(addBlockButton_deprecated);
this.app.schemaInitializerManager.add(addBlockButton);
this.app.schemaInitializerManager.add(addActionButton_deprecated);
this.app.schemaInitializerManager.add(addActionButton);
this.app.schemaInitializerManager.add(addCustomFormField_deprecated);
this.app.schemaInitializerManager.add(addCustomFormField);
const blockInitializers = this.app.schemaInitializerManager.get('page:addBlock');
blockInitializers.add('otherBlocks.workflowTodos', {
title: `{{t("Workflow todos", { ns: "${NAMESPACE}" })}}`,
Component: 'WorkflowTodo.Initializer',
icon: 'CheckSquareOutlined',
});
this.app.schemaInitializerManager.addItem('mobile:addBlock', 'otherBlocks.workflowTodos', {
title: `{{t("Workflow todos", { ns: "${NAMESPACE}" })}}`,
Component: 'WorkflowTodo.Initializer',
icon: 'CheckSquareOutlined',
});
}
addComponents() {
this.app.addComponents({
WorkflowTodo,
});
}
}