Skip to content

Conversation

@eiresendez
Copy link
Contributor

@eiresendez eiresendez commented Mar 2, 2023

Issue & Reproduction Steps

This PR adds backend and frontend changes for Autosave in Modeler.

Solution

  • Added a new draft column (boolean default false) to all *_vesions tables.
    • Added new column in ScriptExecutorVersion and VocabularyVersion to be consistent, even though there is no autosave for those items.
  • Each process, script, screen should only have one draft (see HasVersioning@saveDraft).
  • Added a global scope to HasVersioning that sets the published scope to all queries by default.
    • Also, see HasVersioning@getLatestVersion to make sure we're getting always the published version.
  • Delete the draft after the item is published, see HasVersioning@saveVersion.
  • About: Adding API controller endpoints to get and put the version, I've followed another approach.
    • GET
      • Load the draft (if exists) within the ModelerController@show method.
    • PUT
      • Use the same endpoint that saves the process but send an is_draft flag from the frontend. (See ProcessMaker/Http/Controllers/Api/ProcessController@update).
  • Added a debounce of 5 seconds when there's any change in modeler. (later we should change this value through some setting?)
  • Added discard draft feature.

How to Test

Please execute the following tests:

  • phpunit tests/Feature/Api/ProcessTest.php --filter testUpdateProcessVersions
  • phpunit tests/Feature/Api/ProcessTest.php --filter testDiscardDraft
  • Execute a manual test by linking package-version and modeler in Core.

Related Tickets & Packages

Code Review Checklist

  • I have pulled this code locally and tested it on my instance, along with any associated packages.
  • This code adheres to ProcessMaker Coding Guidelines.
  • This code includes a unit test or an E2E test that tests its functionality, or is covered by an existing test.
  • This solution fixes the bug reported in the original ticket.
  • This solution does not alter the expected output of a component in a way that would break existing Processes.
  • This solution does not implement any breaking changes that would invalidate documentation or cause existing Processes to fail.
  • This solution has been tested with enterprise packages that rely on its functionality and does not introduce bugs in those packages.
  • This code does not duplicate functionality that already exists in the framework or in ProcessMaker.
  • This ticket conforms to the PRD associated with this part of ProcessMaker.

ci:package-vocabularies:feature/FOUR-7331

@eiresendez eiresendez marked this pull request as ready for review March 2, 2023 21:27
@eiresendez eiresendez requested a review from nolanpro March 2, 2023 21:32
@eiresendez eiresendez changed the title FOUR-7331 - Autosave Process Backend FOUR-7331 - Autosave Process Mar 8, 2023
@eiresendez eiresendez mentioned this pull request Mar 22, 2023
9 tasks
@nolanpro nolanpro merged commit 47c92bb into feature/FOUR-7330 Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants