Use cloudron/memory api instead of removed config.memory
This commit is contained in:
@@ -368,16 +368,20 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
|
||||
$scope.resources.memoryLimit = $scope.resources.currentMemoryLimit;
|
||||
$scope.resources.dataDir = app.dataDir;
|
||||
|
||||
// create ticks starting from manifest memory limit. the memory limit here is currently split into ram+swap (and thus *2 below)
|
||||
// TODO: the *2 will overallocate since 4GB is max swap that cloudron itself allocates
|
||||
$scope.resources.memoryTicks = [];
|
||||
var npow2 = Math.pow(2, Math.ceil(Math.log($scope.config.memory)/Math.log(2)));
|
||||
for (var i = 256; i <= (npow2*2/1024/1024); i *= 2) {
|
||||
if (i >= (app.manifest.memoryLimit/1024/1024 || 0)) $scope.resources.memoryTicks.push(i * 1024 * 1024);
|
||||
}
|
||||
if (app.manifest.memoryLimit && $scope.resources.memoryTicks[0] !== app.manifest.memoryLimit) {
|
||||
$scope.resources.memoryTicks.unshift(app.manifest.memoryLimit);
|
||||
}
|
||||
Client.memory(function (error, memory) {
|
||||
if (error) return console.error(error);
|
||||
|
||||
// create ticks starting from manifest memory limit. the memory limit here is currently split into ram+swap (and thus *2 below)
|
||||
// TODO: the *2 will overallocate since 4GB is max swap that cloudron itself allocates
|
||||
$scope.resources.memoryTicks = [];
|
||||
var npow2 = Math.pow(2, Math.ceil(Math.log(memory.memory)/Math.log(2)));
|
||||
for (var i = 256; i <= (npow2*2/1024/1024); i *= 2) {
|
||||
if (i >= (app.manifest.memoryLimit/1024/1024 || 0)) $scope.resources.memoryTicks.push(i * 1024 * 1024);
|
||||
}
|
||||
if (app.manifest.memoryLimit && $scope.resources.memoryTicks[0] !== app.manifest.memoryLimit) {
|
||||
$scope.resources.memoryTicks.unshift(app.manifest.memoryLimit);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
submitMemoryLimit: function () {
|
||||
|
||||
Reference in New Issue
Block a user