fix(storidge): error on volume IOPS update

storidge-standalone
baron_l 2019-03-12 18:50:44 +01:00
parent f603b335c4
commit 74934beee2
2 changed files with 14 additions and 8 deletions

View File

@ -46,14 +46,14 @@
<td>Allocated</td>
<td>{{ $ctrl.volume.Allocated }}</td>
</tr>
<tr>
<td>IOPS Max</td>
<td>{{ $ctrl.volume.IOPSMax }}</td>
</tr>
<tr>
<td>IOPS Min</td>
<td>{{ $ctrl.volume.IOPSMin }}</td>
</tr>
<tr>
<td>IOPS Max</td>
<td>{{ $ctrl.volume.IOPSMax }}</td>
</tr>
<tr>
<td>Local Drive Only</td>
<td>{{ $ctrl.volume.LocalDriveOnly }}</td>

View File

@ -18,9 +18,11 @@ function ($state, StoridgeVolumeService, Notifications) {
this.initLabels = function() {
var labels = this.volume.Labels;
this.formValues.Labels = Object.keys(labels).map(function(key) {
return { name:key, value:labels[key] };
});
if (labels) {
this.formValues.Labels = Object.keys(labels).map(function(key) {
return { name:key, value:labels[key] };
});
}
};
this.updateVolume = function() {
@ -68,9 +70,13 @@ function ($state, StoridgeVolumeService, Notifications) {
}
if (volume.IOPSMin === data.IOPSMin || !volume.IOPSMin) {
delete volume.IOPSMin;
} else {
volume.IOPSMin = volume.IOPSMin.toString();
}
if (volume.IOPSMax === data.IOPSMax || !volume.IOPSMax) {
delete volume.IOPSMax;
} else {
volume.IOPSMax = volume.IOPSMax.toString();
}
if (volume.BandwidthMin === data.BandwidthMin || !volume.BandwidthMin) {
delete volume.BandwidthMin;
@ -78,6 +84,7 @@ function ($state, StoridgeVolumeService, Notifications) {
if (volume.BandwidthMax === data.BandwidthMax || !volume.BandwidthMax) {
delete volume.BandwidthMax;
}
this.prepareLabels(volume);
return volume;
};
@ -85,7 +92,6 @@ function ($state, StoridgeVolumeService, Notifications) {
this.state.isUpdating = true;
var volume = this.prepareVolume();
this.prepareLabels(volume);
volume.Name = this.volume.Name;
StoridgeVolumeService.update(volume)
.then(function success() {