diff --git a/dashboard/src/views/app.html b/dashboard/src/views/app.html index 018e22283..c9737458d 100644 --- a/dashboard/src/views/app.html +++ b/dashboard/src/views/app.html @@ -995,12 +995,11 @@
-
- -
+ + + +
- -
@@ -1009,9 +1008,7 @@ {{ 'app.resources.memory.error' | tr }}
- +

@@ -1022,21 +1019,22 @@

{{ 'app.resources.cpu.description' | tr }}

-
- -
+ + + + + + + +
- -
- +
diff --git a/dashboard/src/views/app.js b/dashboard/src/views/app.js index ebb06e6fc..51400b604 100644 --- a/dashboard/src/views/app.js +++ b/dashboard/src/views/app.js @@ -543,17 +543,15 @@ angular.module('Application').controller('AppController', ['$scope', '$location' memoryLimit: 0, memoryTicks: [], - busyCpuShares: false, currentCpuShares: 0, cpuShares: 0, show: function () { var app = $scope.app; + $scope.resources.busy = true; $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; Client.getAppLimits(app.id, function (error, limits) { if (error) return console.error(error); @@ -569,14 +567,23 @@ angular.module('Application').controller('AppController', ['$scope', '$location' $scope.resources.memoryTicks.unshift(app.manifest.memoryLimit); } }); + + // for firefox widget update + $timeout(function() { + $scope.resources.currentCpuShares = $scope.resources.cpuShares = app.cpuShares; + $scope.resources.memoryLimit = $scope.resources.currentMemoryLimit; + $scope.resources.busy = false; + }, 500); }, submitMemoryLimit: function () { $scope.resources.busy = true; $scope.resources.error = {}; - var memoryLimit = $scope.resources.memoryLimit === $scope.resources.memoryTicks[0] ? 0 : $scope.resources.memoryLimit; - Client.configureApp($scope.app.id, 'memory_limit', { memoryLimit: memoryLimit }, function (error) { + const tmp = parseInt($scope.resources.memoryLimit); + const memoryLimit = tmp === $scope.resources.memoryTicks[0] ? 0 : tmp; + + Client.configureApp($scope.app.id, 'memory_limit', { memoryLimit }, function (error) { if (error && error.statusCode === 400) { $scope.resources.busy = false; $scope.resources.error.memoryLimit = true; @@ -595,10 +602,10 @@ angular.module('Application').controller('AppController', ['$scope', '$location' }, submitCpuShares: function () { - $scope.resources.busyCpuShares = true; + $scope.resources.busy = true; $scope.resources.error = {}; - Client.configureApp($scope.app.id, 'cpu_shares', { cpuShares: $scope.resources.cpuShares }, function (error) { + Client.configureApp($scope.app.id, 'cpu_shares', { cpuShares: parseInt($scope.resources.cpuShares) }, function (error) { if (error) return Client.error(error); $scope.resources.currentCpuShares = $scope.resources.cpuShares; @@ -606,7 +613,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location' refreshApp($scope.app.id, function (error) { if (error) return Client.error(error); - $timeout(function () { $scope.resources.busyCpuShares = false; }, 1000); + $timeout(function () { $scope.resources.busy = false; }, 1000); }); }); },