From 54b4e4e1fabaa3db2e0bfadf022360ebe05fd31f Mon Sep 17 00:00:00 2001 From: waysonwei Date: Thu, 9 Sep 2021 12:51:16 +1200 Subject: [PATCH] fix issue from QA testing and added previous button --- .../wizard-aci.controller.js | 43 ++++++------ .../wizard-endpoint-aci/wizard-aci.html | 2 +- .../wizard-docker.controller.js | 68 ++++++++++--------- .../wizard-endpoint-docker/wizard-docker.html | 12 ++-- .../wizard-kubernetes.controller.js | 44 ++++++------ .../wizard-kubernetes.html | 4 +- .../wizard-endpoints.controller.js | 9 +++ .../wizard-endpoints/wizard-endpoints.css | 9 +++ .../wizard-endpoints/wizard-endpoints.html | 11 ++- .../views/wizard/wizard-view.controller.js | 6 +- 10 files changed, 121 insertions(+), 87 deletions(-) diff --git a/app/portainer/views/wizard/wizard-endpoints/wizard-endpoint-aci/wizard-aci.controller.js b/app/portainer/views/wizard/wizard-endpoints/wizard-endpoint-aci/wizard-aci.controller.js index f55fa734a..fb8c472b8 100644 --- a/app/portainer/views/wizard/wizard-endpoints/wizard-endpoint-aci/wizard-aci.controller.js +++ b/app/portainer/views/wizard/wizard-endpoints/wizard-endpoint-aci/wizard-aci.controller.js @@ -9,29 +9,30 @@ export default class WizardAciController { this.NameValidator = NameValidator; } - async addAciEndpoint() { - const { name, azureApplicationId, azureTenantId, azureAuthenticationKey } = this.formValues; - const groupId = 1; - const tagIds = []; + addAciEndpoint() { + return this.$async(async () => { + const { name, azureApplicationId, azureTenantId, azureAuthenticationKey } = this.formValues; + const groupId = 1; + const tagIds = []; - try { - this.state.actionInProgress = true; - // Check name is duplicated or not - let nameUsed = await this.NameValidator.validateEnvironmentName(name); - if (nameUsed) { - this.Notifications.error('Failure', true, 'This name is been used, please try another one'); - return; + try { + this.state.actionInProgress = true; + // Check name is duplicated or not + let nameUsed = await this.NameValidator.validateEnvironmentName(name); + if (nameUsed) { + this.Notifications.error('Failure', true, 'This name is been used, please try another one'); + return; + } + await this.EndpointService.createAzureEndpoint(name, azureApplicationId, azureTenantId, azureAuthenticationKey, groupId, tagIds); + this.Notifications.success('Environment connected', name); + this.clearForm(); + this.onUpdate(); + } catch (err) { + this.Notifications.error('Failure', err, 'Unable to connect your environment'); + this.state.actionInProgress = false; } - await this.EndpointService.createAzureEndpoint(name, azureApplicationId, azureTenantId, azureAuthenticationKey, groupId, tagIds); - this.Notifications.success('Environment connected', name); - this.clearForm(); - this.onUpdate(); - } catch (err) { - this.Notifications.error('Failure', err, 'Unable to connect your environment'); - this.state.actionInProgress = false; - } - - this.onAnalytics('aci-api'); + this.onAnalytics('aci-api'); + }); } clearForm() { diff --git a/app/portainer/views/wizard/wizard-endpoints/wizard-endpoint-aci/wizard-aci.html b/app/portainer/views/wizard/wizard-endpoints/wizard-endpoint-aci/wizard-aci.html index d355ee261..0232d4bcb 100644 --- a/app/portainer/views/wizard/wizard-endpoints/wizard-endpoint-aci/wizard-aci.html +++ b/app/portainer/views/wizard/wizard-endpoints/wizard-endpoint-aci/wizard-aci.html @@ -55,7 +55,7 @@ + diff --git a/app/portainer/views/wizard/wizard-view.controller.js b/app/portainer/views/wizard/wizard-view.controller.js index 09aa6c33e..314719cd0 100644 --- a/app/portainer/views/wizard/wizard-view.controller.js +++ b/app/portainer/views/wizard/wizard-view.controller.js @@ -1,3 +1,5 @@ +import { PortainerEndpointCreationTypes } from 'Portainer/models/endpoint/models'; + export default class WizardViewController { /* @ngInject */ constructor($async, $state, EndpointService, $analytics) { @@ -80,13 +82,13 @@ export default class WizardViewController { } } else { const addedLocalEndpoint = endpoints.value[0]; - if (addedLocalEndpoint.Type === 1) { + if (addedLocalEndpoint.Type === PortainerEndpointCreationTypes.LocalDockerEnvironment) { this.state.endpoint.added = true; this.state.endpoint.connected = 'docker'; this.state.local.icon = 'fab fa-docker'; } - if (addedLocalEndpoint.Type === 5) { + if (addedLocalEndpoint.Type === PortainerEndpointCreationTypes.LocalKubernetesEnvironment) { this.state.endpoint.added = true; this.state.endpoint.connected = 'kubernetes'; this.state.local.icon = 'fas fa-dharmachakra';