mirror of
https://github.com/portainer/portainer.git
synced 2025-07-19 13:29:41 +02:00
* backported resource usage functionality from EE * utilising view bound endpoint object instead of depracated EndpointProvider * refactor flatmap * addressed merge conflict issues
28 lines
885 B
JavaScript
28 lines
885 B
JavaScript
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);
|