diff --git a/README.md b/README.md index 2f0b1fb..28f7e95 100644 --- a/README.md +++ b/README.md @@ -1,93 +1,112 @@ -# discourse-workflow +# Process Manager -A workflow tool for Discourse! +`discourse-process-manager` provides a process management plugin for Discourse. -Discuss the plugin here: https://meta.discourse.org/t/discourse-workflow/347110?u=merefield +Discuss the plugin here: https://meta.discourse.org/t/discourse-process-manager/347110?u=merefield ## Introduction -A plugin which provides a secure workflow framework for Topics which are passed along a customizable set of steps until the workflow is complete. Some branching and looping is supported. +Process Manager provides a secure process-management framework for Discourse topics. Each process is made of configurable steps and options, and topics move through those steps until completion. Some branching and looping is supported. + +Using topics as work items gives each process a flexible, native Discourse foundation: each item can have a detailed description, attachments, discussion, notifications, tags, categories, permissions, and a full history out of the box. If you are new to the terminology, see: -- Workflow: https://en.wikipedia.org/wiki/Workflow +- Process terminology: https://en.wikipedia.org/wiki/Process - Business process: https://en.wikipedia.org/wiki/Business_process ## Features -- Workflow definitions made from steps mapped to Categories (or Sub-categories) -- Workflow instances represented as Topics that transition across Categories +- Process management using Discourse topics as work items +- Admin-defined processes made from steps mapped to Categories (or Sub-categories) +- Visual process editor for arranging steps, swim lanes, and transition connectors +- Admin List/Visual step editing modes, including drag/drop step placement, connector creation, connector retargeting, option selection, and delete controls - Transition actions presented as buttons per step option - Permission model aligned to native Discourse category permissions -- Workflow discovery list (`/workflow`) with quick filters -- Workflow view selector in discovery (`List`, `Kanban`, `Chart`) when applicable -- Kanban view for compatible single-workflow lists +- Process discovery list (`/processes`) with quick filters +- Process view selector in discovery (`List`, `Kanban`, `Chart`) when applicable +- Kanban view for compatible single-process lists - Drag/drop transitions in Kanban with legal/illegal drop-zone highlighting - Keyboard Kanban transitions on focused cards (`ArrowLeft` / `ArrowRight`) when legal -- Workflow-level Kanban tags toggle (`show_kanban_tags`, default `true`) -- Workflow burn down chart view (`/workflow/charts` and chart mode in `/workflow`) for single-workflow context +- Process-level Kanban tags toggle (`show_kanban_tags`, default `true`) +- Built-in process burn-down chart view (`/processes/charts` and chart mode in `/processes`) for single-process context - Chart period selector (`1` to `12` weeks), complete-week windows (Sunday to Saturday), per-step colored series - Overdue behavior with hierarchy: - - global default (`workflow_overdue_days_default`) - - workflow override + - global default (`process_manager_overdue_days_default`) + - process override - step override - `0` disables overdue behavior at that scope -- Workflow overdue indicator column in the workflow topic list +- Overdue indicator column in the process topic list - Stale state transition handling with explicit user-facing error and automatic refresh - Transition audit trail via small action posts -- Workflow visualization modal from topic and list links +- Process visualization modal from topic and list links - Data Explorer audit query support -- Data Explorer workflow stats query support for chart-oriented time series -- Optional AI-assisted step handling with prompt + option guardrails +- Data Explorer process stats query support for chart-oriented time series +- Optional direct OpenAI-assisted step handling with prompt + option guardrails ## Quickstart -1. Enable the plugin in Site Settings (`workflow_enabled`). -2. Go to `Admin -> Plugins -> Discourse Workflow`, create a Workflow, then save it. -3. Add Workflow Steps (Categories in journey order), then add Step Options (actions/transitions). -4. Create a Topic in the first step Category and transition it through actions from the topic banner. -5. Use `/workflow` to view queue state, apply quick filters, and switch between `List` / `Kanban` / `Chart` views when available. +1. Enable the plugin in Site Settings (`process_manager_enabled`). +2. Go to `Admin -> Plugins -> Process Manager`, create a process, then save it. +3. Add process steps (Categories in journey order), then add step options (actions/transitions). Use either the List editor or the Visual editor. +4. Create a topic in the first step Category and transition it through actions from the topic banner. +5. Use `/processes` to view queue state, apply quick filters, and switch between `List` / `Kanban` / `Chart` views when available. 6. In Kanban, click a card to open the topic, drag cards to legal target steps, or use keyboard arrows on focused cards. -7. Use `/workflow/charts` (or `Chart` view in `/workflow`) to see step counts over time for the currently scoped single workflow. +7. Use `/processes/charts` (or `Chart` view in `/processes`) to see step counts over time for the currently scoped single process. ## Setup ### Core plugin settings -- `workflow_enabled`: enables/disables workflow behavior. -- `workflow_overdue_days_default`: default overdue threshold in days; `0` disables overdue by default. -- `workflow_openai_api_key`: API key for AI actions. -- `workflow_ai_model`: model used for AI actions. -- `workflow_ai_prompt_system`: system prompt support for AI transitions. -- `workflow_charts_allowed_groups`: non-admin groups allowed to view workflow charts. +- `process_manager_enabled`: enables/disables Process Manager behavior. +- `process_manager_overdue_days_default`: default overdue threshold in days; `0` disables overdue by default. +- `process_manager_openai_api_key`: API key for AI actions. +- `process_manager_ai_model`: model used for AI actions. +- `process_manager_ai_prompt_system`: system prompt support for AI transitions. +- `process_manager_charts_allowed_groups`: non-admin groups allowed to view process charts. -### Workflow definition setup +### Process definition setup -The workflow plugin is not bundled with a workflow; you create your own definitions. +Process Manager is not bundled with a process; you create your own definitions. -The screens to create one are in `Admin -> Plugins -> Discourse Workflow`. +The screens to create one are in `Admin -> Plugins -> Process Manager`. -First create a new Workflow by hitting the button, save it, then populate it with Steps by editing the workflow. Each Step, once created, can be edited to add Options, taken from a list of pre-defined Options. +First create a new process by hitting the button, save it, then populate it with steps by editing the process. Each step, once created, can be edited to add options, taken from a list of pre-defined options. You can change the label of an Option in `Admin -> Customize -> Text`. A good range of Options is seeded by default, but you can customize the text as needed. -Workflow-level Kanban controls: +Process steps can be edited in two admin modes: + +- `List`: table-style editing for process steps and step options +- `Visual`: swim-lane editing for laying out the whole process graph + +The Visual editor lets admins: + +- drag steps between swim lanes and position slots +- create connectors between step handles +- retarget existing connectors +- choose the option/action used by each connector +- add a step directly into a swim lane +- delete connectors and steps, including related incoming/outgoing connectors +- keep the editor in place after changes so the admin does not lose scroll position + +Process-level Kanban controls: - `show_kanban_tags`: controls whether tags render on Kanban cards below the title. Default is enabled. ### Overdue setup hierarchy -- Global default: `workflow_overdue_days_default` -- Optional workflow-level override: `Workflow.overdue_days` -- Optional step-level override: `WorkflowStep.overdue_days` +- Global default: `process_manager_overdue_days_default` +- Optional process-level override: the process `overdue_days` field +- Optional step-level override: the step `overdue_days` field -Resolution order is `step -> workflow -> global`. A value of `0` means overdue behavior is disabled at that level. +Resolution order is `step -> process -> global`. A value of `0` means overdue behavior is disabled at that level. ### Kanban compatibility and behavior -Kanban view is shown when the current `/workflow` list is scoped to a single compatible workflow. +Kanban view is shown when the current `/processes` list is scoped to a single compatible process. Compatibility requires: @@ -102,36 +121,40 @@ For each directed edge, Kanban drag/keyboard transitions are option-agnostic and ### Chart view behavior and access model -Chart view is shown when the current workflow discovery context resolves to a single workflow. +Chart view is shown when the current process discovery context resolves to a single process. -- Route support: `/workflow/charts` and chart mode in `/workflow` via `workflow_view=chart` -- View selector behavior: `Chart` is only shown when the user can view charts and the current discovery context is a single workflow +- Route support: `/processes/charts` and chart mode in `/processes` via `process_view=chart` +- View selector behavior: `Chart` is only shown when the user can view charts and the current discovery context is a single process - Period selection: `1` to `12` weeks - Time windows: complete weeks (Sunday through Saturday) - Series: one line per step, color derived from step category color (or parent category color fallback) -- Response scope: chart payload includes selected workflow metadata (`selected_workflow_id`, `selected_workflow_name`) plus series data for that selected workflow context +- Response scope: chart payload includes selected process metadata plus series data for that selected process context +- Data source: daily process stats collected by the scheduled stats job +- Missing collection days are treated as no data rather than forced zero-count days, so the chart does not draw misleading lines into uncollected periods Access model for charts is intentionally separate from topic-level category access: - Admins can always view charts -- Users in `workflow_charts_allowed_groups` can view charts -- Chart access is aggregate and workflow-level; it is intentionally not constrained to per-topic visibility rules -- This allows operational/reporting audiences to monitor workflow throughput without granting direct access to every underlying topic +- Users in `process_manager_charts_allowed_groups` can view charts +- Chart access is aggregate and process-level; it is intentionally not constrained to per-topic visibility rules +- This allows operational/reporting audiences to monitor process throughput without granting direct access to every underlying topic -If you want stricter chart data visibility, keep `workflow_charts_allowed_groups` empty and rely on admin-only access. +If you want stricter chart data visibility, keep `process_manager_charts_allowed_groups` empty and rely on admin-only access. ### Background jobs The plugin schedules and runs the following jobs: -- `Jobs::DiscourseWorkflow::DailyStats`: records daily workflow step counts -- `Jobs::DiscourseWorkflow::AiTransitions`: runs AI-enabled transitions -- `Jobs::DiscourseWorkflow::DataExplorerQueriesCompleteness`: ensures default workflow Data Explorer queries exist -- `Jobs::DiscourseWorkflow::TopicArrivalNotifier`: sends first-post arrival notifications on workflow transitions +- Daily stats: records daily process step counts +- AI transitions: runs AI-enabled transitions +- Data Explorer query completeness: ensures default Process Manager Data Explorer queries exist +- Topic arrival notifier: sends first-post arrival notifications on process transitions ### AI actions -You can leverage AI to handle a step. You need `workflow_openai_api_key`, AI enabled on the step, and a prompt including both `{{options}}` and `{{topic}}`. You can also tune behavior with `workflow_ai_model` and `workflow_ai_prompt_system`. +You can leverage direct OpenAI integration to handle a step. This is self-contained in Process Manager and does not depend on Discourse AI. + +You need `process_manager_openai_api_key`, AI enabled on the step, and a prompt including both `{{options}}` and `{{topic}}`. You can also tune behavior with `process_manager_ai_model` and `process_manager_ai_prompt_system`. Example prompt: @@ -143,60 +166,72 @@ To leverage the Discourse platform as-is as much as possible, this plugin uses m ## Swim Lanes -Each Workflow swim-lane is a Category (or Sub-Category). +Each process swim lane is a Category (or Sub-Category). -As an instance of a workflow continues along its journey it moves between Categories in a customizable but pre-defined journey. +As a process instance continues along its journey, it moves between Categories in a customizable but pre-defined journey. -## Workflow Instances +## Process Instances -A single instance of a workflow (e.g. a ticket) is a Topic. You can add tags to a Topic to highlight priority or other metadata. You cannot amend its Category once it has begun its journey other than by taking workflow actions upon the Topic. +A single process instance (for example, a ticket) is a Topic. You can add tags to a Topic to highlight priority or other metadata. You cannot amend its Category once it has begun its journey other than by taking process actions upon the Topic. ## Actors Any Group which has Topic creation access to a Category can act upon the topics in that Category. -Those that have Reply access can comment on the Workflow item just as they can for a normal Topic. +Those that have Reply access can comment on the process item just as they can for a normal Topic. You can hide Topics within a Category from specific groups in the normal way. ## Actions via Options -These are defined for each step when setting up the Workflow. Actors can choose to take any available action as each Option is presented as a button on the Topic. +These are defined for each step when setting up the process. Actors can choose to take any available action as each Option is presented as a button on the Topic. Actions on a Topic are captured in a Small Action Post to help users understand the journey of the Topic. ## Dashboard -A Topic Discovery filter `Workflow` gives a list of workflow instances (special workflow topics), with three presentation modes when available: +A Topic Discovery filter `Processes` gives a list of process instances, with three presentation modes when available: + +- `List`: sortable process topic list with process columns and quick filters +- `Kanban`: actionable card board for compatible single-process views +- `Chart`: step count trends over time for a single process and chart-permitted users + +Quick filters include: + +- `My categories` +- `Overdue` +- `Step = X` + +The view selector is intentionally contextual: -- `List`: sortable workflow topic list with workflow columns and quick filters -- `Kanban`: actionable card board for compatible single-workflow views -- `Chart`: step count trends over time for a single workflow +- `List` is always available on the process discovery route +- `Kanban` appears only when the current list is scoped to one Kanban-compatible process +- `Chart` appears only when the current list is scoped to one process and the current user can view charts -You should keep Workflow Categories and ideally tags distinct, so you can also use those to filter for all workflow instances that are at a particular stage, or have a specific tag. +You should keep process Categories and ideally tags distinct, so you can also use those to filter for all process instances that are at a particular stage, or have a specific tag. ## Audit trail -A bundled Data Explorer query provides a basic audit report of a workflow instance journey. +A bundled Data Explorer query provides a basic audit report of a process instance journey. Because Data Explorer queries can be exposed beyond Admin, you can choose who to show them to. ## Visualisation -There is a button on each workflow Topic that allows you to bring up a visualization of where the Topic is in its workflow. +There is a button on each process Topic that allows you to bring up a visualization of where the Topic is in its process. -This is also accessible from the workflow fields on the Workflow Discovery Dashboard. +This is also accessible from the process fields on the Processes discovery view. ## Major Differences In Behavior To Stock -- you can't create a new Topic in a Category that's beyond the first step of a workflow -- you can't change the Category of a Topic that is within a workflow -- only "Creators" can act upon a Topic in a Workflow. +- you can't create a new Topic in a Category that's beyond the first step of a process +- you can't change the Category of a Topic that is within a process +- only "Creators" can act upon a Topic in a process. ## Tips -- Consider making all workflow steps for a particular workflow a Subcategory within a single Category. Whilst this isn't necessary it will allow you to simply filter for that Category using existing Discourse Category drop-down in the Discovery list to see all workflow instances for that specific workflow. -- In the new Workflow Discovery list you can click on Workflow Name, Position or Step to visualise where that instance is along its path. +- Consider making all steps for a particular process a Subcategory within a single Category. Whilst this isn't necessary it will allow you to simply filter for that Category using existing Discourse Category drop-down in the Discovery list to see all process instances for that specific process. +- In the new Processes discovery list you can click on Process, Position or Step to visualise where that instance is along its path. ## Roadmap Themes @@ -210,37 +245,39 @@ Status legend: Permissioning principle: - The plugin intentionally reuses core Discourse category permissions as the default and preferred model. -- Finer-grained step/action permission controls are lower priority so the workflow system stays simple to operate, easy for admins to reason about, and close to standard Discourse behavior. +- Finer-grained step/action permission controls are lower priority so Process Manager stays simple to operate, easy for admins to reason about, and close to standard Discourse behavior. | Area | Capability | Status | Notes | | ----------- | ------------------------------------------------------------- | ----------- | -------------------------------------------------------------------------- | -| Definition | Workflow definitions (steps/options mapped to categories) | Implemented | Core admin CRUD plus workflow-level display controls (for example `show_kanban_tags`) | +| Definition | Process definitions (steps/options mapped to categories) | Implemented | Core admin CRUD plus process-level display controls (for example `show_kanban_tags`) | +| Definition | Visual process editor | Implemented | Drag/drop steps, swim-lane placement, connector creation/retargeting, option selection, and step/connector deletion | | Runtime | Topic transitions with audit posts | Implemented | Transition actions are logged in-topic | -| Discovery | Workflow list with quick filters, list/kanban toggle, and step filtering | Implemented | `/workflow` supports SPA quick filters plus list/kanban switching | -| Discovery | Real-time workflow state-change notifier with refresh CTA | Planned | Wire MessageBus updates into `/workflow` with a core-style “press to refresh” flow | +| Discovery | Process list with quick filters and contextual view selector | Implemented | `/processes` supports SPA quick filters plus List/Kanban/Chart switching when applicable | +| Discovery | Real-time process state-change notifier with refresh CTA | Planned | Wire MessageBus updates into `/processes` with a core-style “press to refresh” flow | | Kanban | Card transitions (drag/drop and keyboard arrows) | Implemented | Legal transitions only; deterministic directed edge mapping | -| SLA | Overdue thresholds (step -> workflow -> global, `0` disables) | Implemented | Includes overdue list indicator | +| SLA | Overdue thresholds (step -> process -> global, `0` disables) | Implemented | Includes overdue list indicator | | Permissions | Native Discourse category permissions for acting/commenting | Implemented | Transition authority still aligns with category create access | | Permissions | Step/action-level transition permissions | Partial | Deliberately lower priority to preserve simple, core-aligned permissioning | | Validation | Transition preconditions (required tags/fields/checks) | Planned | Intended as optional guardrails before transitions | | SLA | Escalation/reminder notifications | Partial | Overdue visibility exists; automated escalation is next | | Ownership | Discourse Assign integration | Planned | Target is step-entry assignment and auditable ownership changes | -| Operations | Bulk workflow transitions from list views | Missing | High-volume queue operation not yet first-class | -| Performance | Admin/list/chart/transition query-path N+1 and over-fetch hardening | Implemented | Admin serializers preloaded, workflow quick filters now SQL-scoped, chart loading scoped to selected workflow, transition lookup round-trips reduced, and workflow-state staleness indexing added | -| Performance | Bulk workflow arrival notification fan-out | Planned | Use bulk insert (`insert_all`) for category watcher notifications to reduce per-user insert overhead at high watcher counts | -| Performance | Cache workflow chart payloads | Planned | Add short-lived caching keyed by workflow and period to reduce repeated chart aggregation for frequent refreshes | -| Performance | Cache workflow visualisation payloads | Planned | Cache graph payloads keyed by topic/workflow-state version to avoid rebuilding identical visualisations | -| Performance | Production query-plan validation for workflow filters | Partial | Query shape is now SQL-driven; continue with `EXPLAIN`/index tuning against large production-like datasets | -| Reporting | Built-in workflow analytics dashboards | Partial | Data Explorer support exists; admin-native reporting is next | -| Lifecycle | Import/export/version workflow definitions | Missing | Useful for staging->production promotion and rollback | +| Operations | Bulk process transitions from list views | Missing | High-volume queue operation not yet first-class | +| Performance | Admin/list/chart/transition query-path N+1 and over-fetch hardening | Implemented | Admin serializers preloaded, process quick filters now SQL-scoped, chart loading scoped to selected process, transition lookup round-trips reduced, and process-state staleness indexing added | +| Performance | Bulk process arrival notification fan-out | Planned | Use bulk insert (`insert_all`) for category watcher notifications to reduce per-user insert overhead at high watcher counts | +| Performance | Cache process chart payloads | Planned | Add short-lived caching keyed by process and period to reduce repeated chart aggregation for frequent refreshes | +| Performance | Cache process visualisation payloads | Planned | Cache graph payloads keyed by topic/process-state version to avoid rebuilding identical visualisations | +| Performance | Production query-plan validation for process filters | Partial | Query shape is now SQL-driven; continue with `EXPLAIN`/index tuning against large production-like datasets | +| Reporting | Built-in burn-down charting | Implemented | Single-process chart view with week selector, complete-week windows, and category-colored step series | +| Reporting | Broader process analytics dashboards | Partial | Burn-down charting and Data Explorer support exist; broader admin-native reporting is next | +| Lifecycle | Import/export/version process definitions | Missing | Useful for staging->production promotion and rollback | | Integration | Event hooks / webhooks / automation integration | Planned | Transition and step events are good integration points | | AI | Guardrailed AI-assisted transitions | Partial | Present but should tighten confidence/fallback/audit behavior | ### Priority Roadmap -1. Add MessageBus-driven workflow state-change notifications with a core-style refresh CTA in `/workflow`. +1. Add MessageBus-driven process state-change notifications with a core-style refresh CTA in `/processes`. 2. Add transition preconditions and clearer per-action validation feedback. 3. Add escalation automation (reminders/alerts) on top of existing overdue thresholds. -4. Add first-class reporting and assignment integration for operational workflows. +4. Add first-class reporting and assignment integration for operational processes. 5. Add definition lifecycle tooling (import/export/versioning) for safe environment promotion. 6. Keep advanced step/action permission granularity as a lower-priority enhancement to avoid unnecessary complexity versus native Discourse permissioning. diff --git a/admin/assets/javascripts/discourse/components/workflow-back-button.gjs b/admin/assets/javascripts/discourse/components/process-back-button.gjs similarity index 100% rename from admin/assets/javascripts/discourse/components/workflow-back-button.gjs rename to admin/assets/javascripts/discourse/components/process-back-button.gjs diff --git a/admin/assets/javascripts/discourse/components/workflow-deep-link-button.gjs b/admin/assets/javascripts/discourse/components/process-deep-link-button.gjs similarity index 100% rename from admin/assets/javascripts/discourse/components/workflow-deep-link-button.gjs rename to admin/assets/javascripts/discourse/components/process-deep-link-button.gjs diff --git a/admin/assets/javascripts/discourse/components/workflow-editor.gjs b/admin/assets/javascripts/discourse/components/process-editor.gjs similarity index 53% rename from admin/assets/javascripts/discourse/components/workflow-editor.gjs rename to admin/assets/javascripts/discourse/components/process-editor.gjs index ee0d679..eda8a2c 100644 --- a/admin/assets/javascripts/discourse/components/workflow-editor.gjs +++ b/admin/assets/javascripts/discourse/components/process-editor.gjs @@ -14,10 +14,10 @@ import Textarea from "discourse/components/d-textarea"; import DToggleSwitch from "discourse/components/d-toggle-switch"; import { popupAjaxError } from "discourse/lib/ajax-error"; import I18n, { i18n } from "discourse-i18n"; -import WorkflowStepListEditor from "./workflow-step-list-editor"; -import WorkflowVisualEditor from "./workflow-visual-editor"; +import ProcessStepListEditor from "./process-step-list-editor"; +import ProcessVisualEditor from "./process-visual-editor"; -export default class WorkflowEditor extends Component { +export default class ProcessEditor extends Component { @service adminPluginNavManager; @service router; @service store; @@ -49,30 +49,30 @@ export default class WorkflowEditor extends Component { @action updateModel() { - this.editingModel = this.args.workflow.workingCopy(); - this.showDelete = !this.args.workflow.isNew && !this.args.workflow.system; + this.editingModel = this.args.process.workingCopy(); + this.showDelete = !this.args.process.isNew && !this.args.process.system; } @action async save() { this.isSaving = true; - const backupModel = this.args.workflow.workingCopy(); + const backupModel = this.args.process.workingCopy(); - this.args.workflow.setProperties(this.editingModel); + this.args.process.setProperties(this.editingModel); try { - await this.args.workflow.save(); - this.#sortWorkflows(); + await this.args.process.save(); + this.#sortProcesses(); this.toasts.success({ - data: { message: i18n("admin.discourse_workflow.workflows.saved") }, + data: { message: i18n("admin.process_manager.processes.saved") }, duration: 2000, }); this.router.transitionTo( - "adminPlugins.show.discourse-workflow-workflows", - this.store.findAll("workflow") + "adminPlugins.show.processes", + this.store.findAll("process") ); } catch (e) { - this.args.workflow.setProperties(backupModel); + this.args.process.setProperties(backupModel); popupAjaxError(e); } finally { later(() => { @@ -84,12 +84,12 @@ export default class WorkflowEditor extends Component { @action delete() { return this.dialog.confirm({ - message: i18n("admin.discourse_workflow.workflows.confirm_delete"), + message: i18n("admin.process_manager.processes.confirm_delete"), didConfirm: () => { - return this.args.workflow.destroyRecord().then(() => { + return this.args.process.destroyRecord().then(() => { this.router.transitionTo( - "adminPlugins.show.discourse-workflow-workflows", - this.store.findAll("workflow") + "adminPlugins.show.processes", + this.store.findAll("process") ); }); }, @@ -109,17 +109,17 @@ export default class WorkflowEditor extends Component { ); } - async toggleField(field, sortWorkflows) { - this.args.workflow.set(field, !this.args.workflow[field]); - this.editingModel.set(field, this.args.workflow[field]); - if (!this.args.workflow.isNew) { + async toggleField(field, sortProcesses) { + this.args.process.set(field, !this.args.process[field]); + this.editingModel.set(field, this.args.process[field]); + if (!this.args.process.isNew) { try { const args = {}; - args[field] = this.args.workflow[field]; + args[field] = this.args.process[field]; - await this.args.workflow.update(args); - if (sortWorkflows) { - this.sortWorkflows(); + await this.args.process.update(args); + if (sortProcesses) { + this.#sortProcesses(); } } catch (e) { popupAjaxError(e); @@ -128,7 +128,7 @@ export default class WorkflowEditor extends Component { } get showSteps() { - return this.args.workflow.id > 0; + return this.args.process.id > 0; } validationWarningMessage(warning) { @@ -136,7 +136,7 @@ export default class WorkflowEditor extends Component { if (code === "duplicate_step_positions") { return i18n( - "admin.discourse_workflow.workflows.validation.duplicate_step_positions", + "admin.process_manager.processes.validation.duplicate_step_positions", { positions: (warning.positions || []).join(", "), } @@ -145,7 +145,7 @@ export default class WorkflowEditor extends Component { if (code === "orphan_target_steps") { return i18n( - "admin.discourse_workflow.workflows.validation.orphan_target_steps", + "admin.process_manager.processes.validation.orphan_target_steps", { count: (warning.option_ids || []).length, } @@ -154,7 +154,7 @@ export default class WorkflowEditor extends Component { if (code === "missing_option_labels") { return i18n( - "admin.discourse_workflow.workflows.validation.missing_option_labels", + "admin.process_manager.processes.validation.missing_option_labels", { slugs: (warning.slugs || []).join(", "), } @@ -164,45 +164,43 @@ export default class WorkflowEditor extends Component { return code; } - #sortWorkflows() { - const sorted = this.args.workflows.toArray().sort((a, b) => { + #sortProcesses() { + const sorted = this.args.processes.toArray().sort((a, b) => { return a.name.localeCompare(b.name); }); - this.args.workflows.clear(); - this.args.workflows.setObjects(sorted); + this.args.processes.clear(); + this.args.processes.setObjects(sorted); }