Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ExportController.js « controllers « scripts « ngax « webroot « Server « Duplicati - github.com/duplicati/duplicati.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 29da67ea0f42426658bc7112da81dfc2b03f5eac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
backupApp.controller('ExportController', function($scope, $routeParams, AppService, DialogService) {
    $scope.ExportType = 'file';
    $scope.Connecting = false;
    $scope.BackupID = $routeParams.backupid;
    $scope.Completed = false;


    $scope.doExport = function() {
        if ($scope.UseEncryption && $scope.ExportType == 'file' && ($scope.Passphrase || '').trim().length == 0) {
            DialogService.dialog('No passphrase entered', 'To export without a passphrase, uncheck the "Encrypt file" box');
            return;
        }

        if ($scope.ExportType == 'commandline') {
            $scope.Connecting = true;
            AppService.get('/backup/' + $scope.BackupID + '/export?cmdline=true').then(
                function(resp) {
                    $scope.Connecting = false;
                    $scope.Completed = true;
                    $scope.CommandLine = resp.data.Command;
                }, 
                function(resp) {
                    $scope.Connecting = false;
                    var message = resp.statusText;
                    if (resp.data != null && resp.data.Message != null)
                        message = resp.data.Message;

                    DialogService.dialog('Error', 'Failed to connect: ' + message);
                }
            );
        } else {
            $scope.DownloadURL = AppService.get_export_url($scope.BackupID, $scope.Passphrase);
            $scope.Completed = true;
        }

    };

});