dashboard: replace old slider with native widget
This commit is contained in:
@@ -8,6 +8,7 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat
|
||||
|
||||
$scope.SECRET_PLACEHOLDER = SECRET_PLACEHOLDER;
|
||||
$scope.MIN_MEMORY_LIMIT = 1024 * 1024 * 1024; // 1 GB
|
||||
$scope.MAX_MEMORY_LIMIT = $scope.MIN_MEMORY_LIMIT; // set later
|
||||
|
||||
$scope.config = Client.getConfig();
|
||||
$scope.user = Client.getUserInfo();
|
||||
@@ -540,20 +541,14 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat
|
||||
$scope.configureBackup.useHardlinks = !$scope.backupConfig.noHardlinks;
|
||||
$scope.configureBackup.chown = $scope.backupConfig.chown;
|
||||
|
||||
var limits = $scope.backupConfig.limits || {};
|
||||
$scope.configureBackup.memoryLimit = Math.max(limits.memoryLimit, $scope.MIN_MEMORY_LIMIT);
|
||||
const limits = $scope.backupConfig.limits || {};
|
||||
|
||||
$scope.configureBackup.memoryLimit = Math.max(limits.memoryLimit, $scope.MIN_MEMORY_LIMIT);
|
||||
$scope.configureBackup.uploadPartSize = limits.uploadPartSize || ($scope.configureBackup.provider === 'scaleway-objectstorage' ? 100 * 1024 * 1024 : 10 * 1024 * 1024);
|
||||
$scope.configureBackup.downloadConcurrency = limits.downloadConcurrency || ($scope.backupConfig.provider === 's3' ? 30 : 10);
|
||||
$scope.configureBackup.syncConcurrency = limits.syncConcurrency || ($scope.backupConfig.provider === 's3' ? 20 : 10);
|
||||
$scope.configureBackup.copyConcurrency = limits.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 = [ $scope.MIN_MEMORY_LIMIT ];
|
||||
for (var i = 1024; i <= totalMemory/1024/1024; i *= 2) {
|
||||
$scope.configureBackup.memoryTicks.push(i * 1024 * 1024);
|
||||
}
|
||||
|
||||
$scope.configureBackup.uploadPartSizeTicks = [ 5 * 1024 * 1024 ];
|
||||
for (var j = 32; j <= 1 * 1024; j *= 2) { // 5 GB is max for s3. but let's keep things practical for now. we upload 3 parts in parallel
|
||||
$scope.configureBackup.uploadPartSizeTicks.push(j * 1024 * 1024);
|
||||
@@ -607,7 +602,7 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat
|
||||
schedulePattern: $scope.backupConfig.schedulePattern,
|
||||
retentionPolicy: $scope.backupConfig.retentionPolicy,
|
||||
limits: {
|
||||
memoryLimit: $scope.configureBackup.memoryLimit,
|
||||
memoryLimit: parseInt($scope.configureBackup.memoryLimit),
|
||||
},
|
||||
};
|
||||
if ($scope.configureBackup.password) {
|
||||
@@ -850,6 +845,8 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat
|
||||
if (error) console.error(error);
|
||||
|
||||
$scope.memory = memory;
|
||||
const limit = Math.max((memory.memory + memory.swap) * 1.5, 2 * 1024 * 1024);
|
||||
$scope.MAX_MEMORY_LIMIT = parseInt(limit/1024/1024/1024) * 1024 * 1024 * 1024; // round to value matching 250mb steps
|
||||
|
||||
fetchBackups();
|
||||
getBackupConfig();
|
||||
@@ -887,7 +884,7 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat
|
||||
// setup all the dialog focus handling
|
||||
['configureBackupModal', 'editBackupModal'].forEach(function (id) {
|
||||
$('#' + id).on('shown.bs.modal', function () {
|
||||
$(this).find("[autofocus]:first").focus();
|
||||
$(this).find('[autofocus]:first').focus();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user