portainer/app/kubernetes/components/resource-reservation/resourceReservationControll...

24 lines
595 B
JavaScript

import angular from 'angular';
class KubernetesResourceReservationController {
usageValues() {
if (this.cpuLimit) {
this.cpuUsage = Math.round((this.cpu / this.cpuLimit) * 100);
}
if (this.memoryLimit) {
this.memoryUsage = Math.round((this.memory / this.memoryLimit) * 100);
}
}
$onInit() {
this.usageValues();
}
$onChanges() {
this.usageValues();
}
}
export default KubernetesResourceReservationController;
angular.module('portainer.kubernetes').controller('KubernetesResourceReservationController', KubernetesResourceReservationController);