fix(k8s/storage): missing endpoint id in storage patch request (#4174)

pull/4177/head
Maxime Bajeux 2020-08-08 00:43:34 +02:00 committed by GitHub
parent 26ee78e1e7
commit e7a33347c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -37,10 +37,11 @@ class KubernetesStorageService {
/**
* PATCH
*/
async patchAsync(oldStorageClass, newStorageClass) {
async patchAsync(endpointId, oldStorageClass, newStorageClass) {
try {
const params = new KubernetesCommonParams();
params.id = newStorageClass.Name;
params.endpointId = endpointId;
const payload = KubernetesStorageClassConverter.patchPayload(oldStorageClass, newStorageClass);
await this.KubernetesStorage().patch(params, payload).$promise;
} catch (err) {
@ -48,8 +49,8 @@ class KubernetesStorageService {
}
}
patch(oldStorageClass, newStorageClass) {
return this.$async(this.patchAsync, oldStorageClass, newStorageClass);
patch(endpointId, oldStorageClass, newStorageClass) {
return this.$async(this.patchAsync, endpointId, oldStorageClass, newStorageClass);
}
}

View File

@ -57,7 +57,7 @@ class KubernetesConfigureController {
const storagePromises = _.map(classes, (storageClass) => {
const oldStorageClass = _.find(this.oldStorageClasses, { Name: storageClass.Name });
if (oldStorageClass) {
return this.KubernetesStorageService.patch(oldStorageClass, storageClass);
return this.KubernetesStorageService.patch(this.state.endpointId, oldStorageClass, storageClass);
}
});
@ -89,6 +89,7 @@ class KubernetesConfigureController {
actionInProgress: false,
displayConfigureClassPanel: {},
viewReady: false,
endpointId: this.$stateParams.id,
};
this.formValues = {
@ -97,8 +98,7 @@ class KubernetesConfigureController {
};
try {
const endpointId = this.$stateParams.id;
[this.StorageClasses, this.endpoint] = await Promise.all([this.KubernetesStorageService.get(endpointId), this.EndpointService.endpoint(endpointId)]);
[this.StorageClasses, this.endpoint] = await Promise.all([this.KubernetesStorageService.get(this.state.endpointId), this.EndpointService.endpoint(this.state.endpointId)]);
_.forEach(this.StorageClasses, (item) => {
item.availableAccessModes = new KubernetesStorageClassAccessPolicies();
const storage = _.find(this.endpoint.Kubernetes.Configuration.StorageClasses, (sc) => sc.Name === item.Name);