Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activate/Deactivate workflow and Discard Draft #7022

Merged
merged 36 commits into from
Sep 25, 2024

Conversation

Devessier
Copy link
Contributor

@Devessier Devessier commented Sep 13, 2024

Setup

This PR can be tested only if some feature flags have specific values:

  • IsWorkflowEnabled equals true
  • IsQueryRunnerTwentyORMEnabled equals false

These feature flags weren't committed to don't break other branches.

What this PR brings

  • Display buttons to activate and deactivate a workflow version and a button to discard the current draft version. I also scaffolded a "Test" button, which doesn't do anything for now.
  • Wired the activate, deactivate and discard draft buttons to the backend.
  • Made it possible to "edit" active and deactivated versions by automatically creating a new draft version when the user tries to edit the version.
  • Hide the "Discard Draft", button if the current version is not a draft or is the first version ever created.
  • On the backend, don't consider discarded drafts when checking if a new draft version can be created.
  • On the backend, disallow deleting the first created workflow version. Otherwise, we will end up with a blank canvas in the front end, and it will be impossible to recover from it.
  • On the backend, disallow running deactivation steps if the workflow version is not currently active. Previously, we were throwing, which is unnecessary as it's a valid case.

Spotted bugs that we must dive into

Duplicate workflow versions in Apollo cache

CleanShot.2024-09-20.at.12.18.49.mp4

@@ -48,6 +50,8 @@ export class WorkflowVersionValidationWorkspaceService {
where: {
workflowId: payload.data.workflowId,
status: WorkflowVersionStatus.DRAFT,
// FIXME: soft-deleted rows selection will have to be improved globally
deletedAt: IsNull(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Discarded drafts (soft deleted) were corrupting this check.

@Devessier Devessier marked this pull request as ready for review September 20, 2024 11:18
greptile-apps[bot]

This comment was marked as outdated.

@charlesBochet charlesBochet merged commit 729c990 into main Sep 25, 2024
9 of 13 checks passed
@charlesBochet charlesBochet deleted the activate-deactivate-workflow branch September 25, 2024 16:09
Copy link

Thanks @Devessier for your contribution!
This marks your 7th PR on the repo. You're top 4% of all our contributors 🎉
See contributor page - Share on LinkedIn - Share on Twitter

Contributions

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