-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added clone definition button & controller (#2593)
- Loading branch information
1 parent
f303f89
commit 504e1b6
Showing
13 changed files
with
200 additions
and
58 deletions.
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
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
19 changes: 19 additions & 0 deletions
19
...ponents/UIDefinitionsTable/components/CloneUIDefinitionButton/CloneUIDefinitionButton.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Button } from '@/components/atoms/Button'; | ||
import { useCloneUIDefinitionMutation } from '@/pages/UIDefinitions/hooks/useCloneUIDefinitionMutation'; | ||
import { FunctionComponent } from 'react'; | ||
|
||
interface ICLoneUIDefinitionButtonProps { | ||
uiDefinitionId: string; | ||
} | ||
|
||
export const CloneUIDefinitionButton: FunctionComponent<ICLoneUIDefinitionButtonProps> = ({ | ||
uiDefinitionId, | ||
}) => { | ||
const { mutate, isLoading } = useCloneUIDefinitionMutation(); | ||
|
||
return ( | ||
<Button onClick={() => mutate({ uiDefinitionId })} disabled={isLoading}> | ||
Clone | ||
</Button> | ||
); | ||
}; |
1 change: 1 addition & 0 deletions
1
...s/UIDefinitions/components/UIDefinitionsTable/components/CloneUIDefinitionButton/index.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 @@ | ||
export * from './CloneUIDefinitionButton'; |
1 change: 1 addition & 0 deletions
1
apps/workflows-dashboard/src/pages/UIDefinitions/hooks/useCloneUIDefinitionMutation/index.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 @@ | ||
export * from './useCloneUIDefinitionMutation'; |
24 changes: 24 additions & 0 deletions
24
...c/pages/UIDefinitions/hooks/useCloneUIDefinitionMutation/useCloneUIDefinitionMutation.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { | ||
copyUIDefinition, | ||
CopyUIDefinitionDto, | ||
uiDefinitionsQueryKeys, | ||
} from '@/domains/ui-definitions'; | ||
import { queryClient } from '@/lib/react-query/query-client'; | ||
import { useMutation } from '@tanstack/react-query'; | ||
import { toast } from 'sonner'; | ||
|
||
export const useCloneUIDefinitionMutation = () => { | ||
return useMutation({ | ||
mutationFn: async (dto: CopyUIDefinitionDto) => copyUIDefinition(dto), | ||
onSuccess: () => { | ||
const { queryKey } = uiDefinitionsQueryKeys.list(); | ||
|
||
queryClient.invalidateQueries({ queryKey, exact: true }); | ||
|
||
toast.success('UI Definition cloned succesfully.'); | ||
}, | ||
onError: () => { | ||
toast.error('Failed to clone ui definition.'); | ||
}, | ||
}); | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
services/workflows-service/src/ui-definition/dtos/ui-definition-where-unique-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 { ApiProperty } from '@nestjs/swagger'; | ||
import { Type } from '@sinclair/typebox'; | ||
import { IsString } from 'class-validator'; | ||
|
||
export class UIDefinitionWhereUniqueInput { | ||
@ApiProperty({ | ||
required: true, | ||
type: String, | ||
}) | ||
@IsString() | ||
id!: string; | ||
} | ||
|
||
export const UIDefinitionWhereUniqueInputSchema = Type.String({ | ||
description: "The workflow's id", | ||
}); |
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.