ui for cpu shares

This commit is contained in:
Girish Ramakrishnan
2020-01-28 22:05:06 -08:00
parent 4a29fa93c5
commit 2a4d9c0ba6
2 changed files with 48 additions and 0 deletions

View File

@@ -354,12 +354,17 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
$scope.resources = {
busy: false,
busyCpuShares: false,
busyDataDir: false,
error: {},
currentMemoryLimit: 0,
memoryLimit: 0,
memoryTicks: [],
currentCpuShares: 0,
cpuShares: 0,
dataDir: null,
show: function () {
@@ -368,6 +373,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
$scope.resources.error = {};
$scope.resources.currentMemoryLimit = app.memoryLimit || app.manifest.memoryLimit || (256 * 1024 * 1024);
$scope.resources.memoryLimit = $scope.resources.currentMemoryLimit;
$scope.resources.currentCpuShares = $scope.resources.cpuShares = app.cpuShares;
$scope.resources.dataDir = app.dataDir;
Client.memory(function (error, memory) {
@@ -404,6 +410,23 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
});
},
submitCpuShares: function () {
$scope.resources.busyCpuShares = true;
$scope.resources.error = {};
Client.configureApp($scope.app.id, 'cpu_shares', { cpuShares: $scope.resources.cpuShares }, function (error) {
if (error) return Client.error(error);
$scope.resources.currentCpuShares = $scope.resources.cpuShares;
refreshApp($scope.app.id, function (error) {
if (error) return Client.error(error);
$timeout(function () { $scope.resources.busyCpuShares = false; }, 1000);
});
});
},
submitDataDir: function () {
$scope.resources.busyDataDir = true;
$scope.resources.error = {};