From 68a90238bf4809a32d4b7729a7072a521502b2c7 Mon Sep 17 00:00:00 2001 From: Mattia Franchetto Date: Thu, 13 Apr 2023 12:22:42 +0200 Subject: [PATCH 1/2] Remove disable rollback when creating a cluster --- frontend/locales/en/strings.json | 3 +-- frontend/src/__tests__/CreateCluster.test.ts | 25 -------------------- frontend/src/model.tsx | 2 -- frontend/src/old-pages/Configure/Create.tsx | 17 ------------- 4 files changed, 1 insertion(+), 46 deletions(-) diff --git a/frontend/locales/en/strings.json b/frontend/locales/en/strings.json index c1caab0c..62738ae5 100644 --- a/frontend/locales/en/strings.json +++ b/frontend/locales/en/strings.json @@ -1053,8 +1053,7 @@ "title": "Cluster configuration", "description": "Check/edit the yaml file that is used to create the cluster", "pending": "{{action}} request pending...", - "forceUpdate": "Force update: Edit the cluster while the compute fleet is still running.", - "disableRollback": "Disable rollback: Retain the cluster resources in case of a cluster create failure." + "forceUpdate": "Force update: Edit the cluster while the compute fleet is still running." }, "flashBar": { "success": "Success" diff --git a/frontend/src/__tests__/CreateCluster.test.ts b/frontend/src/__tests__/CreateCluster.test.ts index 0b907d6d..54498b9e 100644 --- a/frontend/src/__tests__/CreateCluster.test.ts +++ b/frontend/src/__tests__/CreateCluster.test.ts @@ -54,7 +54,6 @@ describe('given a CreateCluster command and a cluster configuration', () => { mockRegion, mockSelectedRegion, false, - false, mockSuccessCallback, ) expect(mockSuccessCallback).toHaveBeenCalledTimes(1) @@ -70,7 +69,6 @@ describe('given a CreateCluster command and a cluster configuration', () => { clusterConfiguration, mockRegion, mockSelectedRegion, - false, mockDryRun, ) expect(mockRequest).toHaveBeenCalledTimes(1) @@ -83,28 +81,6 @@ describe('given a CreateCluster command and a cluster configuration', () => { ) }) }) - - describe('when stack rollback on failure is disabled', () => { - const mockDisableRollback = true - - it('should add set the rollbackOnFailure query parameter', async () => { - await CreateCluster( - clusterName, - clusterConfiguration, - mockRegion, - mockSelectedRegion, - mockDisableRollback, - ) - expect(mockRequest).toHaveBeenCalledTimes(1) - expect(mockRequest).toHaveBeenCalledWith( - 'post', - 'api?path=/v3/clusters&rollbackOnFailure=false®ion=some-region', - expect.any(Object), - expect.any(Object), - expect.any(Object), - ) - }) - }) }) describe('when the cluster creation fails', () => { @@ -129,7 +105,6 @@ describe('given a CreateCluster command and a cluster configuration', () => { mockRegion, mockSelectedRegion, false, - false, undefined, mockErrorCallback, ) diff --git a/frontend/src/model.tsx b/frontend/src/model.tsx index d49053d2..05f449f9 100644 --- a/frontend/src/model.tsx +++ b/frontend/src/model.tsx @@ -76,14 +76,12 @@ function CreateCluster( clusterConfig: any, region: string, selectedRegion: string, - disableRollback = false, dryrun = false, successCallback?: Callback, errorCallback?: Callback, ) { var url = 'api?path=/v3/clusters' url += dryrun ? '&dryrun=true' : '' - url += disableRollback ? '&rollbackOnFailure=false' : '' url += region ? `®ion=${region}` : '' var body = {clusterName: clusterName, clusterConfiguration: clusterConfig} request('post', url, body) diff --git a/frontend/src/old-pages/Configure/Create.tsx b/frontend/src/old-pages/Configure/Create.tsx index cd28871a..a953e173 100644 --- a/frontend/src/old-pages/Configure/Create.tsx +++ b/frontend/src/old-pages/Configure/Create.tsx @@ -58,8 +58,6 @@ function handleCreate( ) { const clusterName = getState(['app', 'wizard', 'clusterName']) const editing = getState(['app', 'wizard', 'editing']) - const disableRollback = - getState(['app', 'wizard', 'disableRollback']) || false const forceUpdate = getState(['app', 'wizard', 'forceUpdate']) const clusterConfig = getState(configPath) || '' const dryRun = false @@ -99,7 +97,6 @@ function handleCreate( clusterConfig, region, selectedRegion, - disableRollback, dryRun, successHandler, errHandler, @@ -114,7 +111,6 @@ function handleDryRun() { const clusterConfig = getState(configPath) || '' const region = getState(['app', 'wizard', 'config', 'Region']) const selectedRegion = getState(['app', 'selectedRegion']) - const disableRollback = false const dryRun = true var errHandler = (err: any) => { setState(['app', 'wizard', 'errors', 'create'], err) @@ -141,7 +137,6 @@ function handleDryRun() { clusterConfig, region, selectedRegion, - disableRollback, dryRun, successHandler, errHandler, @@ -196,8 +191,6 @@ function Create() { const {t} = useTranslation() const clusterConfig = useState(configPath) const forceUpdate = useState(['app', 'wizard', 'forceUpdate']) || false - const disableRollback = - useState(['app', 'wizard', 'disableRollback']) || false const errors = useState(['app', 'wizard', 'errors', 'create']) const pending = useState(['app', 'wizard', 'pending']) const editing = getState(['app', 'wizard', 'editing']) @@ -254,16 +247,6 @@ function Create() { {t('wizard.create.configuration.forceUpdate')} )} - {!editing && ( - - setState(['app', 'wizard', 'disableRollback'], !disableRollback) - } - > - {t('wizard.create.configuration.disableRollback')} - - )} ) From 48e7cd58eb9d4f08e201a6d5e362eb64ad082c97 Mon Sep 17 00:00:00 2001 From: Mattia Franchetto Date: Thu, 13 Apr 2023 12:24:53 +0200 Subject: [PATCH 2/2] Remove extra spacing from Create container when no errors are shown --- frontend/src/old-pages/Configure/Create.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/old-pages/Configure/Create.tsx b/frontend/src/old-pages/Configure/Create.tsx index a953e173..4a55a965 100644 --- a/frontend/src/old-pages/Configure/Create.tsx +++ b/frontend/src/old-pages/Configure/Create.tsx @@ -223,7 +223,9 @@ function Create() { } > - + {flashbarProps.items.length > 0 ? ( + + ) : null}