services: send the default memory limit

This commit is contained in:
Girish Ramakrishnan
2024-04-10 12:17:14 +02:00
parent 6612f48d0a
commit efd0be5e2c
3 changed files with 17 additions and 15 deletions
+1 -1
View File
@@ -12,7 +12,7 @@
<div class="form-group">
<label class="control-label" style="display: block;" for="memoryLimit">
{{ 'services.memoryLimit' | tr }}: <b>{{ serviceConfigure.memoryLimit | prettyBinarySize:'Default (256 MiB)' }}</b>
{{ 'services.memoryLimit' | tr }}: <b>{{ serviceConfigure.memoryLimit | prettyBinarySize:'' }}</b>
<button type="button" class="btn btn-xs btn-default pull-right" ng-click="serviceConfigure.resetToDefaults()">{{ 'services.configure.resetToDefaults' | tr }}</button>
</label>
<div style="padding: 0 10px;">
+4 -3
View File
@@ -20,12 +20,13 @@ angular.module('Application').controller('ServicesController', ['$scope', '$loca
if (error) return console.log('Error getting status of ' + serviceName + ':' + error.message);
var service = $scope.services.find(function (s) { return s.name === serviceName; });
if (!service) $scope.services[serviceName] = service;
if (!service) callback(new Error('no such service' + serviceName)); // cannot happen
service.status = result.status;
service.config = result.config;
service.memoryUsed = result.memoryUsed;
service.memoryPercent = result.memoryPercent;
service.defaultMemoryLimit = result.defaultMemoryLimit;
callback(null, service);
});
@@ -83,7 +84,7 @@ angular.module('Application').controller('ServicesController', ['$scope', '$loca
$scope.serviceConfigure.memoryTicks = [];
// we max system memory and current service memory for the case where the user configured the service on another server with more resources
var nearest256m = Math.ceil(Math.max($scope.memory.memory, service.config.memoryLimit) / (256*1024*1024)) * 256 * 1024 * 1024;
var startTick = 256 * 1024 * 1024;
var startTick = service.defaultMemoryLimit;
for (var i = startTick; i <= nearest256m; i *= 2) {
$scope.serviceConfigure.memoryTicks.push(i);
@@ -125,7 +126,7 @@ angular.module('Application').controller('ServicesController', ['$scope', '$loca
},
resetToDefaults: function () {
$scope.serviceConfigure.memoryLimit = 256 * 1024 * 1024; // 256MB default
$scope.serviceConfigure.memoryLimit = $scope.serviceConfigure.service.defaultMemoryLimit;
},
reset: function () {