From 22053bec826554c3ecc500a68fc4dcf136ca8fe5 Mon Sep 17 00:00:00 2001 From: Kenneth Skovhede Date: Thu, 13 Oct 2016 22:44:02 +0200 Subject: [PATCH] Added speed as an option type in the advanced editor. Added overrides for `throttle-upload` and `throttle-download` in advanced editor. This fixes #1600 --- .../ngax/scripts/directives/advancedOptionsEditor.js | 11 +++++++++++ .../Server/webroot/ngax/scripts/services/AppUtils.js | 9 +++++++++ .../webroot/ngax/templates/advancedoptionseditor.html | 6 ++++++ 3 files changed, 26 insertions(+) diff --git a/Duplicati/Server/webroot/ngax/scripts/directives/advancedOptionsEditor.js b/Duplicati/Server/webroot/ngax/scripts/directives/advancedOptionsEditor.js index f8edc0d2f..33f969dff 100644 --- a/Duplicati/Server/webroot/ngax/scripts/directives/advancedOptionsEditor.js +++ b/Duplicati/Server/webroot/ngax/scripts/directives/advancedOptionsEditor.js @@ -10,12 +10,20 @@ backupApp.directive('advancedOptionsEditor', function() { $scope.NewItem = null; $scope.fileSizeMultipliers = AppUtils.fileSizeMultipliers; $scope.timerangeMultipliers = AppUtils.timerangeMultipliers; + $scope.speedMultipliers = AppUtils.speedMultipliers; AppUtils.watch($scope, function() { $scope.fileSizeMultipliers = AppUtils.fileSizeMultipliers; $scope.timerangeMultipliers = AppUtils.timerangeMultipliers; + $scope.speedMultipliers = AppUtils.speedMultipliers; }); + // Overrides to display a custom layout for a specific option + var overrides = { + 'throttle-upload': 'speed', + 'throttle-download': 'speed' + }; + var optionmap = null; function rebuildOptionMap() { @@ -59,6 +67,9 @@ backupApp.directive('advancedOptionsEditor', function() { if (item == null) return 'text'; + if (overrides[item.Name]) + return overrides[item.Name]; + if (item.Type == 'Enumeration') return 'enum'; if (item.Type == 'Flags') diff --git a/Duplicati/Server/webroot/ngax/scripts/services/AppUtils.js b/Duplicati/Server/webroot/ngax/scripts/services/AppUtils.js index ef1f2b33c..3a411e86f 100644 --- a/Duplicati/Server/webroot/ngax/scripts/services/AppUtils.js +++ b/Duplicati/Server/webroot/ngax/scripts/services/AppUtils.js @@ -66,6 +66,15 @@ backupApp.service('AppUtils', function($rootScope, $timeout, DialogService, gett {name: gettextCatalog.getString('Sun'), value: 'sun'} ]; + apputils.speedMultipliers = [ + {name: gettextCatalog.getString('byte/s'), value: ''}, + {name: gettextCatalog.getString('KByte/s'), value: 'KB'}, + {name: gettextCatalog.getString('MByte/s'), value: 'MB'}, + {name: gettextCatalog.getString('GByte/s'), value: 'GB'}, + {name: gettextCatalog.getString('TByte/s'), value: 'TB'} + ]; + + apputils.exampleOptionString = gettextCatalog.getString('Enter one option per line in command-line format, eg. {0}'); apputils.filterClasses = [{ diff --git a/Duplicati/Server/webroot/ngax/templates/advancedoptionseditor.html b/Duplicati/Server/webroot/ngax/templates/advancedoptionseditor.html index 6f20cb2f9..31f1f373e 100644 --- a/Duplicati/Server/webroot/ngax/templates/advancedoptionseditor.html +++ b/Duplicati/Server/webroot/ngax/templates/advancedoptionseditor.html @@ -16,6 +16,12 @@ +
+ + +
+