-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Move the workflow draft version overriding to the backend #9328
Merged
Devessier
merged 13 commits into
main
from
move-workflow-draft-version-override-to-backend
Jan 6, 2025
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
4ec67d0
feat: wip
Devessier 615512a
chore: remove test
Devessier 9299f08
refactor: extract the code for step duplication into a separate function
Devessier 53c1f2f
fix: allow the save method to be called on workflow versions when set…
Devessier 541f0ee
feat: create draft version if it doesn't exist yet and take the workf…
Devessier 4319ee8
feat: call the override workflow draft version mutation on the frontend
Devessier 4ebe413
fix: ensure we can only duplicate a version from the same workflow
Devessier 604de97
refactor: prefer throwing a custom error
Devessier fdfbdb4
refactor: remove a useless default empty value
Devessier f23424a
refactor: add missing break statement
Devessier 183f7f0
refactor: rename variables
Devessier 3e63951
refactor: rename the mutation
Devessier 5ba02b6
lint: fix space errors
Devessier File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
21 changes: 8 additions & 13 deletions
21
...s/twenty-front/src/modules/workflow/components/OverrideWorkflowDraftConfirmationModal.tsx
This file contains 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
This file contains 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
9 changes: 9 additions & 0 deletions
9
packages/twenty-front/src/modules/workflow/graphql/mutations/overrideWorkflowDraftVersion.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { gql } from '@apollo/client'; | ||
|
||
export const OVERRIDE_WORKFLOW_DRAFT_VERSION = gql` | ||
mutation CreateDraftFromWorkflowVersion( | ||
$input: CreateDraftFromWorkflowVersionInput! | ||
) { | ||
createDraftFromWorkflowVersion(input: $input) | ||
} | ||
`; |
23 changes: 23 additions & 0 deletions
23
packages/twenty-front/src/modules/workflow/hooks/useCreateDraftFromWorkflowVersion.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { useApolloClient } from '@apollo/client'; | ||
import { | ||
CreateDraftFromWorkflowVersionInput, | ||
useCreateDraftFromWorkflowVersionMutation, | ||
} from '~/generated/graphql'; | ||
|
||
export const useCreateDraftFromWorkflowVersion = () => { | ||
const apolloClient = useApolloClient(); | ||
|
||
const [mutate] = useCreateDraftFromWorkflowVersionMutation({ | ||
client: apolloClient, | ||
}); | ||
|
||
const createDraftFromWorkflowVersion = async ( | ||
input: CreateDraftFromWorkflowVersionInput, | ||
) => { | ||
await mutate({ variables: { input } }); | ||
}; | ||
|
||
return { | ||
createDraftFromWorkflowVersion, | ||
}; | ||
}; |
This file contains 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
16 changes: 16 additions & 0 deletions
16
...-server/src/engine/core-modules/workflow/dtos/create-draft-from-workflow-version-input.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Field, InputType } from '@nestjs/graphql'; | ||
|
||
@InputType() | ||
export class CreateDraftFromWorkflowVersionInput { | ||
@Field(() => String, { | ||
description: 'Workflow ID', | ||
nullable: false, | ||
}) | ||
workflowId: string; | ||
|
||
@Field(() => String, { | ||
description: 'Workflow version ID', | ||
nullable: false, | ||
}) | ||
workflowVersionIdToCopy: string; | ||
} |
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: The type
string & NonNullable<unknown>
is redundant since string is already non-nullable. Consider using juststring
or creating a specific type/enum for versions.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure this change helps a lot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can use constants instead of hard-coded strings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can't because version can be '1', '2', etc...