mirror of
https://github.com/portainer/portainer.git
synced 2025-07-23 15:29:42 +02:00
refactor(app): backport technical changes (#4679)
* refactor(app): backport technical changes * refactor(app): remove EE only features * feat(app): small review changes to match EE codebase layout on some files Co-authored-by: xAt0mZ <baron_l@epitech.eu>
This commit is contained in:
parent
158bdae10e
commit
ccf6babc02
40 changed files with 951 additions and 976 deletions
|
@ -64,18 +64,17 @@ class KubernetesVolumeController {
|
|||
|
||||
onChangeSize() {
|
||||
if (this.state.volumeSize) {
|
||||
const size = filesizeParser(this.state.volumeSize + this.state.volumeSizeUnit);
|
||||
const size = filesizeParser(this.state.volumeSize + this.state.volumeSizeUnit, { base: 10 });
|
||||
if (this.state.oldVolumeSize > size) {
|
||||
this.state.volumeSizeError = true;
|
||||
this.state.errors.volumeSize = true;
|
||||
} else {
|
||||
this.volume.PersistentVolumeClaim.Storage = size;
|
||||
this.state.volumeSizeError = false;
|
||||
this.state.errors.volumeSize = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sizeIsValid() {
|
||||
return !this.state.volumeSizeError && this.state.oldVolumeSize !== this.volume.PersistentVolumeClaim.Storage;
|
||||
return !this.state.errors.volumeSize && this.state.volumeSize && this.state.oldVolumeSize !== filesizeParser(this.state.volumeSize + this.state.volumeSizeUnit, { base: 10 });
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,7 +83,7 @@ class KubernetesVolumeController {
|
|||
|
||||
async updateVolumeAsync(redeploy) {
|
||||
try {
|
||||
this.volume.PersistentVolumeClaim.Storage = this.state.volumeSize + this.state.volumeSizeUnit.charAt(0) + 'i';
|
||||
this.volume.PersistentVolumeClaim.Storage = this.state.volumeSize + this.state.volumeSizeUnit.charAt(0);
|
||||
await this.KubernetesPersistentVolumeClaimService.patch(this.oldVolume.PersistentVolumeClaim, this.volume.PersistentVolumeClaim);
|
||||
this.Notifications.success('Volume successfully updated');
|
||||
|
||||
|
@ -126,9 +125,9 @@ class KubernetesVolumeController {
|
|||
volume.Applications = KubernetesVolumeHelper.getUsingApplications(volume, applications);
|
||||
this.volume = volume;
|
||||
this.oldVolume = angular.copy(volume);
|
||||
this.state.volumeSize = parseInt(volume.PersistentVolumeClaim.Storage.slice(0, -2));
|
||||
this.state.volumeSize = parseInt(volume.PersistentVolumeClaim.Storage.slice(0, -2), 10);
|
||||
this.state.volumeSizeUnit = volume.PersistentVolumeClaim.Storage.slice(-2);
|
||||
this.state.oldVolumeSize = filesizeParser(volume.PersistentVolumeClaim.Storage);
|
||||
this.state.oldVolumeSize = filesizeParser(volume.PersistentVolumeClaim.Storage, { base: 10 });
|
||||
} catch (err) {
|
||||
this.Notifications.error('Failure', err, 'Unable to retrieve volume');
|
||||
}
|
||||
|
@ -179,9 +178,11 @@ class KubernetesVolumeController {
|
|||
increaseSize: false,
|
||||
volumeSize: 0,
|
||||
volumeSizeUnit: 'GB',
|
||||
volumeSizeError: false,
|
||||
volumeSharedAccessPolicy: '',
|
||||
volumeSharedAccessPolicyTooltip: '',
|
||||
errors: {
|
||||
volumeSize: false,
|
||||
},
|
||||
};
|
||||
|
||||
this.state.activeTab = this.LocalStorage.getActiveTab('volume');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue