Fixed persisted version to work with ngax
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
backupApp.controller('AppController', function($scope, $cookies, $location, AppService, BrandingService, ServerStatus, SystemInfo, AppUtils, DialogService, gettextCatalog) {
|
||||
backupApp.controller('AppController', function($rootScope, $scope, $cookies, $location, AppService, BrandingService, ServerStatus, SystemInfo, AppUtils, DialogService, gettextCatalog) {
|
||||
$scope.brandingService = BrandingService.watch($scope);
|
||||
$scope.state = ServerStatus.watch($scope);
|
||||
$scope.systemInfo = SystemInfo.watch($scope);
|
||||
@@ -177,6 +177,9 @@ backupApp.controller('AppController', function($scope, $cookies, $location, AppS
|
||||
var dt = data.data['max-download-speed'];
|
||||
$scope.throttle_active = (ut != null && ut.trim().length != 0) || (dt != null && dt.trim().length != 0);
|
||||
|
||||
ServerStatus.state.orderBy = data.data['backup-list-sort-order'] || 'id';
|
||||
$rootScope.$broadcast('sortorder_changed', { orderBy: ServerStatus.state.orderBy } );
|
||||
|
||||
var has_asked = AppUtils.parseBoolString(data.data['has-asked-for-password-change']);
|
||||
var autogen_passphrase = AppUtils.parseBoolString(data.data['autogenerated-passphrase']);
|
||||
if (!has_asked && autogen_passphrase) {
|
||||
|
||||
@@ -8,7 +8,7 @@ backupApp.controller('HomeController', function ($scope, $location, ServerStatus
|
||||
return ServerStatus.state.orderBy;
|
||||
}
|
||||
|
||||
$scope.orderBy = $scope.orderByFromState();
|
||||
$scope.orderBy = null;
|
||||
|
||||
$scope.openFolderContext = function(path) {
|
||||
BackupList.getFolderContext(path).then(function(context) {
|
||||
@@ -74,10 +74,14 @@ backupApp.controller('HomeController', function ($scope, $location, ServerStatus
|
||||
|
||||
$scope.doApplyOrder = function (orderby)
|
||||
{
|
||||
console.log('doapplyorder');
|
||||
ServerStatus.state.orderBy = orderby;
|
||||
AppService.patch('/serversettings', { 'backup-list-sort-order': orderby });
|
||||
BackupList.reload();
|
||||
};
|
||||
|
||||
$scope.$on('sortorder_changed', function() {
|
||||
$scope.orderBy = $scope.orderByFromState();
|
||||
});
|
||||
|
||||
$scope.formatDuration = AppUtils.formatDuration;
|
||||
});
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
backupApp.service('BackupList', function($rootScope, $timeout, AppService, AppUtils, ServerStatus, $http) {
|
||||
var list = [];
|
||||
var lookup = {};
|
||||
var activeLoad = false;
|
||||
|
||||
this.list = list;
|
||||
this.lookup = lookup;
|
||||
@@ -35,6 +36,12 @@ backupApp.service('BackupList', function($rootScope, $timeout, AppService, AppUt
|
||||
};
|
||||
|
||||
this.reload = function() {
|
||||
// Wait until we know the sort order
|
||||
if (ServerStatus.state.orderBy == null || activeLoad)
|
||||
return;
|
||||
|
||||
// Prevent flickering
|
||||
activeLoad = true;
|
||||
AppService.get('/backups?orderby='+ (ServerStatus.state.orderBy || '')).then(function(data) {
|
||||
list.length = 0;
|
||||
|
||||
@@ -48,6 +55,8 @@ backupApp.service('BackupList', function($rootScope, $timeout, AppService, AppUt
|
||||
}
|
||||
|
||||
updateNextRunStamp();
|
||||
}).finally(function() {
|
||||
activeLoad = false;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -63,4 +72,5 @@ backupApp.service('BackupList', function($rootScope, $timeout, AppService, AppUt
|
||||
|
||||
$rootScope.$on('serverstatechanged.lastDataUpdateId', this.reload);
|
||||
$rootScope.$on('serverstatechanged.proposedSchedule', updateNextRunStamp);
|
||||
$rootScope.$on('sortorder_changed', this.reload);
|
||||
});
|
||||
|
||||
@@ -25,7 +25,7 @@ backupApp.service('ServerStatus', function ($rootScope, $timeout, AppService, Ap
|
||||
updateDownloadProgress: 0,
|
||||
proposedSchedule: [],
|
||||
schedulerQueueIds: [],
|
||||
orderBy: 'id'
|
||||
orderBy: null
|
||||
};
|
||||
|
||||
this.state = state;
|
||||
|
||||
@@ -3,16 +3,25 @@
|
||||
|
||||
<div class="tasks" ng-controller="HomeController">
|
||||
|
||||
<div class="orderbox">
|
||||
<label for="orderby" translate>Order by</label>
|
||||
<select id="orderby" name="orderby" ng-model="orderBy"
|
||||
ng-change="doApplyOrder(orderBy)"
|
||||
ng-init="orderBy = orderByFromState()">
|
||||
<option value="id" translate>Create Order</option>
|
||||
<option value="backend" translate>Destination Type</option>
|
||||
<option value="lastrun" translate>Last Run</option>
|
||||
<option value="name" translate>Name</option>
|
||||
</select>
|
||||
<div ng-if="orderBy != null" class="orderbox">
|
||||
<label for="orderby" translate>Order by</label>
|
||||
<select id="orderby" name="orderby" ng-model="orderBy"
|
||||
ng-change="doApplyOrder(orderBy)"
|
||||
ng-init="orderBy = orderByFromState()">
|
||||
<option value="id" translate>Create Order</option>
|
||||
<option value="backend" translate>Destination Type</option>
|
||||
<option value="lastrun" translate>Last Run</option>
|
||||
<option value="nextrun" translate>Next Scheduled Run</option>
|
||||
<option value="name" translate>Name</option>
|
||||
<option value="schedule" translate>Has Scheduled</option>
|
||||
|
||||
<option value="-id" translate>Create Order (descending)</option>
|
||||
<option value="-backend" translate>Destination Type (descending)</option>
|
||||
<option value="-lastrun" translate>Last Run (descending)</option>
|
||||
<option value="-nextrun" translate>Next Scheduled Run (descending)</option>
|
||||
<option value="-name" translate>Name (descending)</option>
|
||||
<option value="-schedule" translate>Has Scheduled (descending)</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="tasklist">
|
||||
<div ng-repeat="item in backups" class="task">
|
||||
|
||||
@@ -82,7 +82,7 @@ public class Backups : IEndpointV1
|
||||
,
|
||||
"nextrun" => x => x.Schedule?.Time,
|
||||
"schedule" => x => string.IsNullOrWhiteSpace(x.Schedule?.Repeat),
|
||||
"destination" => x => Library.Utility.Utility.GuessScheme(x.Backup.TargetURL),
|
||||
"backend" => x => Library.Utility.Utility.GuessScheme(x.Backup.TargetURL),
|
||||
_ => null
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user