Skip to content

feat(plugin-workflow): migrate workflow settings page to client-v2#9645

Open
Molunerfinn wants to merge 7 commits into
developfrom
feature-workflow-v2
Open

feat(plugin-workflow): migrate workflow settings page to client-v2#9645
Molunerfinn wants to merge 7 commits into
developfrom
feature-workflow-v2

Conversation

@Molunerfinn
Copy link
Copy Markdown
Contributor

This is a ...

  • New feature
  • Improvement
  • Bug fix
  • Others

Motivation

Establish the v2 (client-v2 / FlowEngine) surface for @nocobase/plugin-workflow. The legacy src/client/ schema-driven canvas stays intact (it is the v1 surface consumed by ~30 downstream workflow plugins); this PR adds the v2 client entry, moves the existing FlowModels into it, and migrates the Workflow settings page to v2.

Description

Key changes:

  • client-v2 entry: root shims (client-v2.js / client-v2.d.ts), src/client-v2/{index,plugin,locale}, and @nocobase/client-v2 peer dep. The 4 FlowModels move from src/client/models/ to src/client-v2/models/ (base classes now from @nocobase/client-v2, tExpr from local locale.ts, no inline styles); v1 re-references them via relative path. Registered lazily via registerModelLoaders (with extends for sub-model discovery).
  • Trigger extension point: registerTrigger(type, { title, sync?, createConfigFormLoader }) on the v2 plugin (mirrors plugin-auth's registerType). Built-in collection / schedule register their create-config forms via async loaders. The registry ignores v1-style class registrations so downstream plugins that still call pm.get('workflow').registerTrigger(type, TriggerClass) are a no-op (no crash).
  • WorkflowPane settings page → v2: list + category tabs (CRUD + drag sort) + filter + create/edit drawer + duplicate + execution-history drawer, built with FlowEngine + antd, token-based styling, no Formily. PK confirmed as id.
  • Shared component: extracted a reusable SortableCategoryTabs into @nocobase/client-v2 and adopted it in both plugin-workflow and plugin-data-source-manager (removed DSM's inline duplicate).

Deferred (still served by the v1 canvas): the "Configure" / execution "View" / version-link actions navigate into the v1 workflow/execution canvas, which is not migrated.

Risks / testing:

  • v1 surface untouched; coexists at the route level. Downstream workflow plugins keep importing @nocobase/plugin-workflow/client.
  • Request-layer tests cover create / edit (with filterByTk pinned) / delete, plus a regression test for v1-style trigger registrations. tsc --noEmit passes with 0 errors across the touched graph.

Related issues

Showcase

Workflow settings page (list, category tabs, create/edit drawer, execution-history drawer) rendered under the v2 client. Screenshots shared in the team review thread.

Changelog

Language Changelog
🇺🇸 English Migrate the Workflow settings page to the v2 client and share a reusable draggable category-tabs component via @nocobase/client-v2.
🇨🇳 Chinese 将工作流设置页迁移到 v2 客户端,并将可复用的可拖拽分类页签组件抽离到 @nocobase/client-v2

Docs

Language Link
🇺🇸 English
🇨🇳 Chinese

Checklists

  • All changes have been self-tested and work as expected
  • Test cases are updated/provided or not needed
  • Doc is updated/provided or not needed
  • If documentation was changed, the corresponding files in all other languages have been updated to keep them in sync (or this change does not affect docs)
  • Component demo is updated/provided or not needed
  • Changelog is provided or not needed
  • Request a code review if it is necessary

- Add client-v2 entry (root shims, plugin, locale); move the 4 FlowModels from
  src/client/models to src/client-v2/models and re-reference from v1 via a
  relative path (lazy registerModelLoaders).
- Add a v2 trigger extension point (registerTrigger + createConfigFormLoader)
  with built-in collection/schedule create-config forms; resilient to v1-style
  class registrations.
- Migrate the WorkflowPane settings page to v2 (list, category tabs, create/edit
  drawer, duplicate, execution-history drawer) with FlowEngine + antd, token
  styling, no Formily.
- Extract a reusable SortableCategoryTabs into @nocobase/client-v2 and adopt it
  in both plugin-workflow and plugin-data-source-manager.
- Defer canvas actions (Configure / View execution / version link) to v1; add
  request-layer tests.

The legacy src/client/ canvas stays intact as the v1 surface that downstream
workflow plugins consume.
The i18n template parser closed the key on a character class that
accepted any quote type, so a key such as
{{t('... "Post-action event" ...')}} was truncated at the first inner
quote and the translation lookup fell back to the raw English key.
Capture the opening quote and backreference it so only the matching
quote type closes the key (escaped chars are kept inside as well).
- Render the trigger-type dropdown options as a gold Tag plus a
  secondary description (v1 TriggerOptionRender parity); add an optional
  `description` to the trigger registration options and supply it for
  the built-in collection and schedule triggers.
- Wrap the trigger-specific create-config form in a titled, bordered
  "Trigger configuration" group, matching v1's Fieldset.
- Register the settings tab under the `index` key so the route is
  /settings/workflow instead of /settings/workflow/workflows.
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Jun 2, 2026

CLA assistant check
All committers have signed the CLA.

Replace the title-only search on the workflow list and the status-only
dropdown on the execution-history drawer with the shared CollectionFilter
condition-group UI, matching v1's field sets via nonfilterableFieldNames
and resolving the trigger-type / status enum templates for the value
Select. Drop the execution Actions-column separator and align its button
spacing with the workflow list. Add Version ID / Parent execution ID /
Triggered manually keys across all 17 locales.
Register standalone full-screen pages under the `admin.workflow` namespace
(`/admin/workflow/workflows/:id` and `/admin/workflow/executions/:id`),
bypassing the settings layout's sidebar to match v1. The canvas content area
is a placeholder while the node-graph editor migration is deferred.

Replicate the v1 header functionality as extracted client-v2 components:
breadcrumb + sync/async tag, version dropdown, enable switch, the "..." menu
(details / refresh / execution history / copy-to-new-version / delete), and
the execution-view header (executions dropdown with prev/next windowed
loading, status tag with reason, cancel, refresh). Wire the execution-history
drawer's "View" link to the new execution page.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants