Skip to content

Feature/m8 f 24#40

Draft
abilpraju-aot wants to merge 4 commits intoAOT-Technologies:mainfrom
abilpraju-aot:feature/M8F-24
Draft

Feature/m8 f 24#40
abilpraju-aot wants to merge 4 commits intoAOT-Technologies:mainfrom
abilpraju-aot:feature/M8F-24

Conversation

@abilpraju-aot
Copy link
Collaborator

@abilpraju-aot abilpraju-aot commented Feb 11, 2026

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)

  1. Template Service Enhancements

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).

  1. API Changes

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.

  1. Test Updates

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)

  1. Template Service

updateTemplateFile() now returns Promise instead of Promise.

deleteTemplateFile() now returns Promise instead of Promise.

  1. TemplateFileFormPage (JSON / MD Editor)

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

  1. Code Cleanup

Removed debug console.log from:

useProcessGroups.tsx

useExtendedGrouping.tsx

Behavior Changes

  1. Editing Published Templates

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.

  1. Draft Version Reuse

If a draft version already exists (e.g., V2):

Subsequent edits update that same draft.

No unnecessary versions (V3, V4, etc.) are created.

  1. Consistent UX Across File Types

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

  • Feature
  • Bug fix
  • Documentation
  • Other

Changes

  • Backend
  • Frontend
  • Documentation

Testing

Related Issues

Closes #

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.

1 participant