services: use memorySwap to be consistent with the app memory UI

the memory limit sliders take the total memory (memory + swap).
This commit is contained in:
Girish Ramakrishnan
2020-01-28 13:34:08 -08:00
parent c5d14195d6
commit 4a29fa93c5
4 changed files with 6 additions and 8 deletions
-1
View File
@@ -544,7 +544,6 @@
<div class="form-group">
<label class="control-label" for="memoryLimit">Memory Limit <sup><a ng-href="{{ config.webServerOrigin }}/documentation/apps/#memory-limit" class="help" target="_blank"><i class="fa fa-question-circle"></i></a></sup> : <b>{{ resources.memoryLimit ? resources.memoryLimit / 1024 / 1024 + 'MB' : 'Default (256 MB)' }}</b></label>
<p>Cloudron allocates 50% of this value as RAM and 50% as swap.</p>
<br/>
<div style="padding: 0 10px;">
<slider id="memoryLimit" ng-model="resources.memoryLimit" step="134217728" tooltip="hide" ticks="resources.memoryTicks" ticks-snap-bounds="67108864"></slider>
</div>
+2 -3
View File
@@ -30,8 +30,7 @@
<div class="form-group">
<label class="control-label" for="memoryLimit">Memory Limit : <b>{{ serviceConfigure.memoryLimit / 1024 / 1024 + 'MB' }}</b></label>
<p>Cloudron allocates 50% of this value as RAM and 50% as swap.</p>
<br/>
<p><small>Cloudron allocates 50% of this value as RAM and 50% as swap.</small></p>
<div style="padding: 0 10px;">
<slider id="memoryLimit" ng-model="serviceConfigure.memoryLimit" step="134217728" tooltip="hide" ticks="serviceConfigure.memoryTicks" ticks-snap-bounds="67108864"></slider>
</div>
@@ -106,7 +105,7 @@
</div>
</td>
<td class="elide-table-cell text-center">
<span ng-show="service.config.memory">{{ service.config.memory / 1024 / 1024 + ' MB' }}</span>
<span ng-show="service.config.memory">{{ service.config.memorySwap / 1024 / 1024 + ' MB' }}</span>
</td>
<td class="text-right no-wrap" style="vertical-align: bottom">
<button class="btn btn-xs btn-default" ng-click="serviceConfigure.show(service)" uib-tooltip="Configure Memory Limit" ng-show="service.config.memory"><i class="fa fa-pencil-alt"></i></button>
+2 -2
View File
@@ -89,7 +89,7 @@ angular.module('Application').controller('SystemController', ['$scope', '$locati
$scope.serviceConfigure.reset();
$scope.serviceConfigure.service = service;
$scope.serviceConfigure.memoryLimit = service.config.memory;
$scope.serviceConfigure.memoryLimit = service.config.memorySwap; // memory + swap
// TODO improve those
$scope.serviceConfigure.memoryTicks = [];
@@ -109,7 +109,7 @@ angular.module('Application').controller('SystemController', ['$scope', '$locati
$scope.serviceConfigure.busy = true;
$scope.serviceConfigure.error = null;
Client.configureService($scope.serviceConfigure.service.name, memoryLimit, function (error) {
Client.configureService($scope.serviceConfigure.service.name, { memorySwap: memoryLimit, memory: memoryLimit/2 }, function (error) {
$scope.serviceConfigure.busy = false;
if (error) {
$scope.serviceConfigure.error = error.message;