Skip to content

Convert workflow builder to module - #17

Merged
matteius merged 3 commits into
opensensor:mainfrom
ViolanteCodes:convert_workflow_builder_to_module
Aug 5, 2026
Merged

Convert workflow builder to module#17
matteius merged 3 commits into
opensensor:mainfrom
ViolanteCodes:convert_workflow_builder_to_module

Conversation

@ViolanteCodes

Copy link
Copy Markdown
Contributor

Converts workflow builder to module, fixes escaping all at once (so copilot doesn't tag each module as it goes in), and adds first battery of tests for workflow builder

getNodeDescription() and buildFormProperties() had unescaped values that would likely get picked up by copilot

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR converts the workflow-builder.js static asset from a classic-script global to an ES module export, updates the Django admin template to import it as a module, and adds regression tests to ensure key workflow-builder UI strings are properly HTML-escaped to prevent XSS.

Changes:

  • Export WorkflowBuilder as an ES module and remove the window.WorkflowBuilder global assignment.
  • Update workflow_builder.html to import { WorkflowBuilder } from the static asset via a <script type="module">.
  • Add Vitest + JSDOM tests covering module import wiring and escaping regressions in getNodeDescription() and buildFormProperties().

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
tests_js/workflow-builder/moduleAndEscaping.test.js Adds module-wiring and XSS-escaping regression tests for key builder-rendered HTML.
django_forms_workflows/templates/admin/django_forms_workflows/workflow_builder.html Switches admin initialization to a module script that imports WorkflowBuilder instead of relying on a global.
django_forms_workflows/static/django_forms_workflows/js/workflow-builder.js Exports WorkflowBuilder as an ES module and escapes additional interpolated fields in rendered HTML.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@matteius
matteius merged commit bd5c134 into opensensor:main Aug 5, 2026
5 checks passed
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.

3 participants