Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Create runtime credential throw missing name #1026

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 9 additions & 16 deletions src/stores/testing_env/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
}

Expand Down Expand Up @@ -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');
}
Expand All @@ -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
})
);
};

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -359,6 +351,7 @@ export default class CreateEnvStore extends Store {
this.secretKey = '';
this.helmCredential = '';
this.credentialName = '';
this.credentialDesc = '';
this.selectCredentialId = '';
this.runtime = {};
this.runtimeInfo = {
Expand Down