Current File : //proc/self/root/usr/local/jetapps/var/www/jetbackup5/docroot/app/controllers_enduser/restore/db.js |
define([
'app',
], function(app) {
app.controller("restore_db_enduser",
["$rootScope", "$scope", "$routeParams", "$location", "$timeout", "$interval", "api", "meta", "lang", "consts", "permissions", "alert", "popup",
function($rootScope, $scope, $routeParams, $location, $timeout, $interval, api, meta, lang, consts, permissions, alert, popup) {
$scope.backups = [];
$scope.selected = {};
$scope.files = {};
meta = meta.new("enduser_db_backups");
$scope.meta = meta;
$scope.metaData = meta.getData();
meta.setSortReverse(false);
if(!meta.getSortBy()) meta.setSortBy("created");
if(!meta.getSortDirection()) meta.setSortDirection("desc");
meta.setPageSizes([10,25,50,100]);
meta.setPageSize(10);
meta.setSortFields(["username", "owner"]);
meta.setTotalItems($scope.backups.length);
$scope.fetch = function () {
$scope.backups = [];
$scope.selected = {};
var apiParams = {
type: consts.BACKUP_TYPE_ACCOUNT,
contains: consts.BACKUP_TYPE_ACCOUNT_DATABASES,
account_id: $scope.loggedAccount._id,
skip: meta.getSkip(),
limit: meta.getPageSize(),
filter: meta.getFilter(),
sort: {},
find: {}
};
apiParams.sort[meta.getSortBy()] = meta.getSortDirectionInt();
api.listBackupForType({
data: apiParams,
success: function (data) {
meta.setTotalItems(data.total);
meta.calculate(data.backups);
for(var i = 0; i < data.backups.length; i++) {
var names = [];
for(var j = 0; j < data.backups[i].schedules.length; j++) names.push(consts.SCHEDULE_TYPES[data.backups[i].schedules[j]]);
data.backups[i].schedules_names = names.join(",");
$scope.backups.push(data.backups[i]);
}
}
});
};
$timeout($scope.fetch);
}
]
);
});