From 10a45c2e2e614cf091f26a7fa31aefc530fb5ef8 Mon Sep 17 00:00:00 2001 From: Kenneth Skovhede Date: Thu, 23 Jun 2016 09:52:17 +0200 Subject: [PATCH] Added option to allow backends to perform extra operations after the normal "test" operation has been performed. Operations on the "test" function are not done with normal validation, and can thus have extended checks. --- .../ngax/scripts/directives/backupEditUri.js | 13 +++++++++++-- .../ngax/scripts/services/EditUriBackendConfig.js | 3 +++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Duplicati/Server/webroot/ngax/scripts/directives/backupEditUri.js b/Duplicati/Server/webroot/ngax/scripts/directives/backupEditUri.js index 4f21b0a26..ff8b8689f 100644 --- a/Duplicati/Server/webroot/ngax/scripts/directives/backupEditUri.js +++ b/Duplicati/Server/webroot/ngax/scripts/directives/backupEditUri.js @@ -41,7 +41,14 @@ backupApp.directive('backupEditUri', function() { AppService.post('/remoteoperation/test', uri).then(function() { scope.Testing = false; dlg.dismiss(); - DialogService.dialog('Success', 'Connection worked!'); + + if (EditUriBackendConfig.testers[scope.Backend.Key] != null) + EditUriBackendConfig.testers[scope.Backend.Key](scope, function() { + DialogService.dialog('Success', 'Connection worked!'); + }); + else + DialogService.dialog('Success', 'Connection worked!'); + }, handleError); }); @@ -108,8 +115,10 @@ backupApp.directive('backupEditUri', function() { if (!hasTriedCreate && message == 'missing-folder') { var folder = scope.Folder; - if ((folder | "") == "") + if ((folder || "") == "") folder = scope.Path; + if ((folder || "") == "") + folder = ''; DialogService.dialog('Create folder?', 'The folder ' + folder + ' does not exist\nCreate it now?', ['No', 'Yes'], function(ix) { if (ix == 1) diff --git a/Duplicati/Server/webroot/ngax/scripts/services/EditUriBackendConfig.js b/Duplicati/Server/webroot/ngax/scripts/services/EditUriBackendConfig.js index 52683e99a..0c31c12b4 100644 --- a/Duplicati/Server/webroot/ngax/scripts/services/EditUriBackendConfig.js +++ b/Duplicati/Server/webroot/ngax/scripts/services/EditUriBackendConfig.js @@ -17,6 +17,9 @@ backupApp.service('EditUriBackendConfig', function(AppService, AppUtils, SystemI // Validaters check the input and show the user an error or warning this.validaters = { }; + // Testers perform additional checks when pressing the Test button + this.testers = { }; + this.defaultbackend = 'file'; this.defaulttemplate = 'templates/backends/generic.html'; this.defaultbuilder = function(scope) {