@@ -659,15 +659,22 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat
|
||||
$scope.backups = $scope.backups.slice(0, 20); // only show 20 since we don't have pagination
|
||||
|
||||
// add contents property
|
||||
var appsById = {};
|
||||
Client.getInstalledApps().forEach(function (app) { appsById[app.id] = app; });
|
||||
var appsById = {}, appsByFqdn = {};
|
||||
Client.getInstalledApps().forEach(function (app) {
|
||||
appsById[app.id] = app;
|
||||
appsByFqdn[app.fqdn] = 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]]);
|
||||
if (!match) return;
|
||||
if (match[1].indexOf('.') !== -1) { // newer backups have fqdn in them
|
||||
if (appsByFqdn[match[1]]) backup.contents.push(appsByFqdn[match[1]]);
|
||||
} else {
|
||||
if (appsById[match[1]]) backup.contents.push(appsById[match[1]]);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user