-
Notifications
You must be signed in to change notification settings - Fork 99
/
Copy pathcontroller.js
54 lines (49 loc) · 1.33 KB
/
controller.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { BOUNDARIES } from './constant';
export default class VolumeEditReserveSpaceCtrl {
/* @ngInject */
constructor($translate, EditReserveSpaceService) {
this.$translate = $translate;
this.EditReserveSpaceService = EditReserveSpaceService;
}
$onInit() {
this.isLoading = true;
this.errorMessage = null;
this.model = {
percent: BOUNDARIES.MIN_SPACE_PERCENT,
};
this.boundaries = BOUNDARIES;
this.EditReserveSpaceService.getSnapshotReserveSpace(
this.storage.id,
this.volume,
).then((data) => {
this.model.percent = data.percent;
this.isLoading = false;
});
}
cancel() {
this.goBack();
}
modifySnapshotReserveSpace() {
this.EditReserveSpaceService.modifySnapshotReserveSpace(
this.storage.id,
this.volume,
this.model.percent,
)
.then(() => {
this.goBack(
this.$translate.instant('netapp_volumes_edit_reserve_space_success', {
volumeName: this.volume.name || this.volume.id,
}),
);
})
.catch((error) => {
this.errorMessage = this.$translate.instant(
'netapp_volumes_edit_reserve_space_error',
{
message: error?.data?.message || error.message,
requestId: error.headers('X-Ovh-Queryid'),
},
);
});
}
}