You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
portainer/app/kubernetes/components/resource-reservation/resourceReservationControll...

29 lines
885 B

import angular from 'angular';
class KubernetesResourceReservationController {
usageValues() {
if (this.cpuLimit) {
this.cpuReservationPercent = Math.round((this.cpuReservation / this.cpuLimit) * 100);
}
if (this.memoryLimit) {
this.memoryReservationPercent = Math.round((this.memoryReservation / this.memoryLimit) * 100);
}
if (this.displayUsage && this.cpuLimit && this.memoryLimit) {
this.cpuUsagePercent = Math.round((this.cpuUsage / this.cpuLimit) * 100);
this.memoryUsagePercent = Math.round((this.memoryUsage / this.memoryLimit) * 100);
}
}
$onInit() {
this.usageValues();
}
$onChanges() {
this.usageValues();
}
}
export default KubernetesResourceReservationController;
angular.module('portainer.kubernetes').controller('KubernetesResourceReservationController', KubernetesResourceReservationController);