backups: show the app info in contents
This commit is contained in:
+12
-7
@@ -245,27 +245,32 @@
|
||||
<div class="card card-large">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<!-- backup id copy helper -->
|
||||
<input type="text" class="offscreen" aria-hidden="true" id="backupIdHelper" value="">
|
||||
|
||||
<p ng-show="!backups.length">No backups have been made yet</p>
|
||||
|
||||
<table class="table table-hover" style="margin: 0;" ng-hide="!backups.length">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="25px"> </th>
|
||||
<th>Version</th>
|
||||
<th>Contents</th>
|
||||
<th>Date</th>
|
||||
<th>Contents</th>
|
||||
<th class="text-right" width="180px">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="backup in backups">
|
||||
<td><div ng-click="listBackups.copyBackupId(backup)" class="hand" uib-tooltip="{{ listBackups.copyBackupIdDone ? 'Copied to clipboard' : 'Click to copy backup id' }}" tooltip-placement="right"><i class="fa fa-copy"></i></div></td>
|
||||
<td><div>v{{ backup.packageVersion }}</div></td>
|
||||
<td><div>{{ backup.dependsOn.length }} app(s)</div></td>
|
||||
<td><div uib-tooltip="{{ backup.creationTime | prettyLongDate }}">{{ backup.creationTime | prettyDate }}</div></td>
|
||||
<td>
|
||||
<span> {{ backup.contents.length ? backup.contents.length : 'No '}} apps </span>
|
||||
|
||||
<span ng-show="backup.contents.length">
|
||||
<span> - </span>
|
||||
<span ng-repeat="app in backup.contents | limitTo: 5">
|
||||
<a ng-href="/#/app/{{app.id}}/backups">{{app.label || app.fqdn}}</a><span ng-hide="$last">,</span>
|
||||
</span>
|
||||
<span ng-show="backup.contents.length > 5">& {{ backup.contents.length - 5 }} more </span>
|
||||
</span>
|
||||
</td>
|
||||
<td class="text-right no-wrap" style="vertical-align: bottom">
|
||||
<button class="btn btn-xs btn-default" ng-click="downloadConfig(backup)" uib-tooltip="Download Backup Configuration"><i class="fas fa-file-alt"></i></button>
|
||||
</td>
|
||||
|
||||
+12
-19
@@ -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]]);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user