2018-10-24 19:28:32 +02:00
backupApp . controller ( 'HomeController' , function ( $scope , $location , ServerStatus , BackupList , AppService , AppUtils , DialogService , gettextCatalog ) {
2015-08-21 22:04:39 +02:00
$scope . backups = BackupList . watch ( $scope );
2015-10-04 17:07:30 +02:00
2015-11-26 20:39:07 +01:00
$scope . doRun = function ( id ) {
2016-09-28 20:13:16 +02:00
AppService . post ( '/backup/' + id + '/run' ). then ( function () {
if ( ServerStatus . state . programState == 'Paused' ) {
2016-10-02 16:47:40 +02:00
DialogService . dialog ( gettextCatalog . getString ( 'Server paused' ), gettextCatalog . getString ( 'Server is currently paused, do you want to resume now?' ), [ gettextCatalog . getString ( 'No' ), gettextCatalog . getString ( 'Yes' )], function ( ix ) {
2016-09-28 20:13:16 +02:00
if ( ix == 1 )
ServerStatus . resume ();
});
}
}, function () {});
2015-10-04 17:07:30 +02:00
};
2015-11-26 20:39:07 +01:00
$scope . doRestore = function ( id ) {
2015-12-08 20:38:16 +01:00
$location . path ( '/restore/' + id );
2015-11-26 20:39:07 +01:00
};
$scope . doEdit = function ( id ) {
2015-12-08 20:38:16 +01:00
$location . path ( '/edit/' + id );
2015-11-26 20:39:07 +01:00
};
$scope . doExport = function ( id ) {
2015-12-08 20:38:16 +01:00
$location . path ( '/export/' + id );
2015-11-26 20:39:07 +01:00
};
2016-08-04 14:31:18 +02:00
$scope . doCompact = function ( id ) {
AppService . post ( '/backup/' + id + '/compact' );
};
2015-11-26 20:39:07 +01:00
$scope . doDelete = function ( id , name ) {
2016-10-13 21:45:31 +02:00
$location . path ( '/delete/' + id );
2015-11-26 20:39:07 +01:00
};
2015-12-08 20:43:47 +01:00
$scope . doLocalDb = function ( id ) {
$location . path ( '/localdb/' + id );
2015-11-26 20:39:07 +01:00
};
$scope . doRepairLocalDb = function ( id , name ) {
2015-12-08 20:38:16 +01:00
AppService . post ( '/backup/' + id + '/repair' );
2015-11-26 20:39:07 +01:00
};
$scope . doVerifyRemote = function ( id , name ) {
2015-12-08 20:38:16 +01:00
AppService . post ( '/backup/' + id + '/verify' );
2015-11-26 20:39:07 +01:00
};
$scope . doShowLog = function ( id , name ) {
2015-12-08 20:38:16 +01:00
$location . path ( '/log/' + id );
2015-11-26 20:39:07 +01:00
};
2017-04-04 16:58:29 +02:00
$scope . doCommandLine = function ( id , name ) {
$location . path ( '/commandline/' + id );
};
2015-11-26 20:39:07 +01:00
$scope . doCreateBugReport = function ( id , name ) {
2015-12-08 20:38:16 +01:00
AppService . post ( '/backup/' + id + '/createreport' );
2015-11-26 20:39:07 +01:00
};
2018-10-24 19:28:32 +02:00
$scope . formatDuration = AppUtils . formatDuration ;
2016-09-15 11:39:27 +02:00
});