backups: show the app info in contents

This commit is contained in:
Girish Ramakrishnan
2020-05-16 09:46:57 -07:00
parent f4775cc17c
commit 606fe87ca0
2 changed files with 24 additions and 26 deletions
+12 -19
View File
@@ -13,7 +13,6 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat
$scope.manualBackupApps = [];
$scope.backupConfig = {};
$scope.lastBackup = null;
$scope.backups = [];
// List is from http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region
@@ -225,19 +224,6 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat
};
$scope.listBackups = {
copyBackupIdDone: false,
copyBackupId: function (backup) {
var copyText = document.getElementById('backupIdHelper');
copyText.value = backup.id;
copyText.select();
document.execCommand('copy');
$scope.listBackups.copyBackupIdDone = true;
// reset after 2.5sec
$timeout(function () { $scope.listBackups.copyBackupIdDone = false; }, 2500);
},
};
$scope.s3like = function (provider) {
@@ -479,11 +465,18 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat
$scope.backups = backups;
$scope.backups = $scope.backups.slice(0, 20); // only show 20 since we don't have pagination
if ($scope.backups.length > 0) {
$scope.lastBackup = backups[0];
} else {
$scope.lastBackup = null;
}
// add contents property
var appsById = {};
Client.getInstalledApps().forEach(function (app) { appsById[app.id] = app; });
$scope.backups.forEach(function (backup) {
backup.contents = [];
backup.dependsOn.forEach(function (appBackupId) {
let match = appBackupId.match(/app_(.*?)_.*/); // *? means non-greedy
if (!match || !appsById[match[1]]) return;
backup.contents.push(appsById[match[1]]);
});
});
});
}