Draft
Conversation
…o feature/M8F-76
…m template also template version creation logic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JIRA Ticket
https://aottech.atlassian.net/browse/M8F-24
Description
This PR implements several improvements to the template management system, focusing on:
Enabling editing of published templates by automatically creating draft versions
Ensuring draft version reuse
Fixing template-to-process-model workflow issues
Improving frontend UX consistency across file types (BPMN, JSON, MD)
Changes
Backend Changes (extensions/m8flow-backend)
Added _get_or_create_draft_version() helper method to centralize draft version management.
Updated update_file_content():
When editing files on published templates, a new draft version is created instead of blocking the operation.
Updated delete_file_from_template():
Deleting files from a published template now creates a draft version automatically.
Refactored update_template_by_id() to use the new draft version helper.
Reduced log noise:
Changed verbose per-file logging from logger.info to logger.debug (lines 913, 917, 946).
template_put_file endpoint now returns the full template object
→ Enables frontend version change detection.
template_delete_file endpoint now returns the full template object.
Renamed:
test_update_file_content_published_rejected
→ test_update_file_content_published_creates_draft_version
test_delete_file_rejects_published
→ test_delete_file_from_published_creates_draft
Added:
test_update_file_content_published_reuses_existing_draft
→ Ensures edits accumulate on existing drafts instead of creating multiple versions.
Fixed test setup:
Added required created_by and modified_by fields when creating M8flowTenantModel instances.
Frontend Changes (extensions/frontend)
updateTemplateFile() now returns Promise instead of Promise.
deleteTemplateFile() now returns Promise instead of Promise.
Removed disabled prop from Save/Delete buttons for published templates.
Updated info message:
From: "Files cannot be edited"
To: "Saving changes will create a new draft version"
Added:
newVersionInfo state
Snackbar notification to inform users when a new draft version is created
Updated handleSave and handleDelete:
Detect version changes
Automatically navigate to the new draft version
Fixed navigation route:
From /files/
To /form/ for JSON/MD files
Removed debug console.log from:
useProcessGroups.tsx
useExtendedGrouping.tsx
Behavior Changes
Users can now edit JSON and MD files on published templates.
Saving changes automatically creates a new draft version (e.g., V2).
The original published version remains unchanged.
If a draft version already exists (e.g., V2):
Subsequent edits update that same draft.
No unnecessary versions (V3, V4, etc.) are created.
BPMN editor behavior remains unchanged.
JSON and MD editors now follow the same draft-creation logic as BPMN.
All file types now behave consistently when editing published templates.
Type
Changes
Testing
Related Issues
Closes #