Fix memory slider

This commit is contained in:
Girish Ramakrishnan
2020-09-10 00:07:12 -07:00
parent 576281990b
commit 92b9fc02fa
+17 -9
View File
@@ -7,6 +7,7 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat
$scope.config = Client.getConfig();
$scope.user = Client.getUserInfo();
$scope.memory = null; // { memory, swap }
$scope.manualBackupApps = [];
@@ -477,13 +478,14 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat
$scope.configureBackup.syncConcurrency = $scope.backupConfig.syncConcurrency || ($scope.backupConfig.provider === 's3' ? 20 : 10);
$scope.configureBackup.copyConcurrency = $scope.backupConfig.copyConcurrency || ($scope.backupConfig.provider === 's3' ? 500 : 10);
var totalMemory = Math.max(($scope.memory.memory + $scope.memory.swap) * 1.5, 2 * 1024 * 1024);
$scope.configureBackup.memoryTicks = [ 400 * 1024 * 1024 ];
for (var i = 512; i <= 4 * 1024; i *= 2) {
for (var i = 512; i <= totalMemory/1024/1024; i *= 2) {
$scope.configureBackup.memoryTicks.push(i * 1024 * 1024);
}
$scope.configureBackup.uploadPartSizeTicks = [ 10 * 1024 * 1024 ];
for (var j = 32; j <= 128; j *= 2) { // 5 GB is max for s3. but let's keep things practical for now
$scope.configureBackup.uploadPartSizeTicks = [ 5 * 1024 * 1024 ];
for (var j = 32; j <= 4 * 1024; j *= 2) { // 5 GB is max for s3. but let's keep things practical for now
$scope.configureBackup.uploadPartSizeTicks.push(j * 1024 * 1024);
}
@@ -676,14 +678,20 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat
}
Client.onReady(function () {
fetchBackups();
getBackupConfig();
checkBackupConfig();
Client.memory(function (error, memory) {
if (error) console.error(error);
$scope.manualBackupApps = Client.getInstalledApps().filter(function (app) { return !app.enableBackup; });
$scope.memory = memory;
// show backup status
$scope.createBackup.checkStatus();
fetchBackups();
getBackupConfig();
checkBackupConfig();
$scope.manualBackupApps = Client.getInstalledApps().filter(function (app) { return !app.enableBackup; });
// show backup status
$scope.createBackup.checkStatus();
});
});
function readFileLocally(obj, file, fileName) {