diff --git a/src/views/app.js b/src/views/app.js
index deb55ba6e..e2be95452 100644
--- a/src/views/app.js
+++ b/src/views/app.js
@@ -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 = {};