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.
This commit is contained in:
Kenneth Skovhede
2016-06-23 09:52:17 +02:00
parent 87afcc7d5f
commit 10a45c2e2e
2 changed files with 14 additions and 2 deletions
@@ -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)
@@ -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) {