-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add virtual clusters creation (#388)
- Loading branch information
1 parent
6820568
commit 8fb8055
Showing
34 changed files
with
726 additions
and
1,044 deletions.
There are no files selected for viewing
81 changes: 81 additions & 0 deletions
81
src/k8s/groups/ArgoCD/Application/hooks/useArgoApplicationCRUD.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,81 @@ | ||
import React from 'react'; | ||
import { CRUD_TYPES } from '../../../../../constants/crudTypes'; | ||
import { useResourceCRUDMutation } from '../../../../../hooks/useResourceCRUDMutation'; | ||
import { ApplicationKubeObject } from '../index'; | ||
import { ApplicationKubeObjectInterface } from '../types'; | ||
|
||
interface DeleteArgoApplicationProps { | ||
argoApplication: ApplicationKubeObjectInterface; | ||
} | ||
|
||
interface EditArgoApplicationProps { | ||
argoApplication: ApplicationKubeObjectInterface; | ||
} | ||
|
||
interface CreateArgoApplicationProps { | ||
argoApplication: ApplicationKubeObjectInterface; | ||
} | ||
|
||
export const useArgoApplicationCRUD = () => { | ||
const argoApplicationCreateMutation = useResourceCRUDMutation< | ||
ApplicationKubeObjectInterface, | ||
CRUD_TYPES.CREATE | ||
>('argoApplicationCreateMutation', ApplicationKubeObject, CRUD_TYPES.CREATE, { | ||
customMessages: { | ||
onMutate: 'Creating application...', | ||
onError: 'Failed to create application', | ||
onSuccess: 'Start creating application', | ||
}, | ||
}); | ||
|
||
const argoApplicationDeleteMutation = useResourceCRUDMutation< | ||
ApplicationKubeObjectInterface, | ||
CRUD_TYPES.DELETE | ||
>('argoApplicationDeleteMutation', ApplicationKubeObject, CRUD_TYPES.DELETE, { | ||
customMessages: { | ||
onMutate: 'Uninstalling application...', | ||
onError: 'Failed to uninstall application', | ||
onSuccess: 'Start uninstalling application', | ||
}, | ||
}); | ||
|
||
const argoApplicationEditMutation = useResourceCRUDMutation< | ||
ApplicationKubeObjectInterface, | ||
CRUD_TYPES.EDIT | ||
>('argoApplicationEditMutation', ApplicationKubeObject, CRUD_TYPES.EDIT, { | ||
customMessages: { | ||
onMutate: 'Updating application...', | ||
onError: 'Failed to update application', | ||
onSuccess: 'Start updating application', | ||
}, | ||
}); | ||
|
||
const createArgoApplication = React.useCallback( | ||
async ({ argoApplication }: CreateArgoApplicationProps): Promise<void> => { | ||
argoApplicationCreateMutation.mutate(argoApplication); | ||
}, | ||
[argoApplicationCreateMutation] | ||
); | ||
|
||
const deleteArgoApplication = React.useCallback( | ||
async ({ argoApplication }: DeleteArgoApplicationProps): Promise<void> => { | ||
argoApplicationDeleteMutation.mutate(argoApplication); | ||
}, | ||
[argoApplicationDeleteMutation] | ||
); | ||
|
||
const editArgoApplication = React.useCallback( | ||
async ({ argoApplication }: EditArgoApplicationProps): Promise<void> => { | ||
argoApplicationEditMutation.mutate(argoApplication); | ||
}, | ||
[argoApplicationEditMutation] | ||
); | ||
|
||
const mutations = { | ||
argoApplicationCreateMutation, | ||
argoApplicationEditMutation, | ||
argoApplicationDeleteMutation, | ||
}; | ||
|
||
return { createArgoApplication, editArgoApplication, deleteArgoApplication, mutations }; | ||
}; |
153 changes: 0 additions & 153 deletions
153
src/k8s/groups/ArgoCD/Application/hooks/useCreateArgoApplication.ts
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export const APPLICATION_LABEL_SELECTOR_PIPELINE = 'app.edp.epam.com/pipeline'; | ||
export const APPLICATION_LABEL_SELECTOR_STAGE = 'app.edp.epam.com/stage'; | ||
export const APPLICATION_LABEL_SELECTOR_APP_NAME = 'app.edp.epam.com/app-name'; | ||
export const APPLICATION_LABEL_SELECTOR_APP_TYPE = 'app.edp.epam.com/app-type'; | ||
|
11 changes: 0 additions & 11 deletions
11
src/k8s/groups/ArgoCD/Application/mocks/CDPipeline.mock.ts
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
src/k8s/groups/ArgoCD/Application/mocks/CDPipelineStage.mock.ts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.