From 80b7c29166c0da0959000de8a532b9166013f689 Mon Sep 17 00:00:00 2001 From: Xi Wang Date: Wed, 27 Mar 2019 16:09:42 +0800 Subject: [PATCH] fix: Create runtime credential throw missing name (#1026) --- src/stores/testing_env/create.js | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/src/stores/testing_env/create.js b/src/stores/testing_env/create.js index 7fd536e3..5702e019 100644 --- a/src/stores/testing_env/create.js +++ b/src/stores/testing_env/create.js @@ -95,9 +95,8 @@ export default class CreateEnvStore extends Store { ? this.helmCredential : this.getCredentialContent(), provider: this.platform, - // using random string for credential name when type is helm - name: isHelm(this.platform) && !this.credentialName ? `rtc-${Date.now()}` : this.credentialName, - description: '' + name: this.credentialName || `rtc-${isHelm(this.platform) ? 'helm' : 'vm'}-${Date.now()}`, + description: this.credentialDesc }; } @@ -145,17 +144,13 @@ export default class CreateEnvStore extends Store { } if (activeStep < STEPS) { - if (this.selectCredentialId) { - // todo - } else { + if (!this.selectCredentialId) { // newly create if (!this.validatePassed) { return this.error('Please validate runtime credential'); } - if (isHelm(this.platform)) { - // todo - } else { + if (!isHelm(this.platform)) { if (!this.isCredential && !this.credentialName) { return this.error('Auth info name is empty'); } @@ -177,10 +172,9 @@ export default class CreateEnvStore extends Store { } // modify exist credential return await this.credentialStore.modify( - _.extend( - _.omit(this.getCredentialParams(), ['runtime_url', 'provider']), - { runtime_credential_id } - ) + _.extend(_.omit(this.getCredentialParams(), ['runtime_url', 'provider']), { + runtime_credential_id + }) ); }; @@ -328,9 +322,7 @@ export default class CreateEnvStore extends Store { return this.setValidateMsg('invalid url'); } if (!(this.accessKey && this.secretKey)) { - return this.setValidateMsg( - 'access key and secret key should not be empty' - ); + return this.setValidateMsg('access key and secret key should not be empty'); } _.extend(params, { runtime_url: this.runtimeUrl, @@ -359,6 +351,7 @@ export default class CreateEnvStore extends Store { this.secretKey = ''; this.helmCredential = ''; this.credentialName = ''; + this.credentialDesc = ''; this.selectCredentialId = ''; this.runtime = {}; this.runtimeInfo = {