Add restore and backup logic to app view

This commit is contained in:
Johannes Zellner
2019-09-13 17:07:45 +02:00
parent a1fe79c876
commit 8f8aa31304
4 changed files with 115 additions and 202 deletions

View File

@@ -1,62 +1,4 @@
<!-- Modal restore app -->
<div class="modal fade" id="appRestoreModal" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">
Backups - {{ appRestore.app.fqdn }}
<button type="button" class="btn btn-sm btn-primary pull-right" ng-click="appRestore.createBackup()" ng-hide="appRestore.busyFetching" ng-disabled="appRestore.app.installationState === 'pending_backup'"><i class="fa fa-circle-notch fa-spin" ng-show="appRestore.app.installationState === 'pending_backup'"></i> Create Backup</button>
</h4>
</div>
<div class="modal-body" style="padding: 0 15px">
<p class="text-center" ng-show="appRestore.busyFetching"><i class="fa fa-circle-notch fa-spin"></i> Fetching backups</p>
<p ng-hide="appRestore.backups.length || appRestore.creatingBackup">This app has no backups yet.</p>
<div ng-show="appRestore.creatingBackup">
<div class="progress progress-striped active animateMe" style="margin-bottom: 10px;">
<div class="progress-bar progress-bar-success" role="progressbar" style="width: {{appRestore.app.progress}}%"></div>
</div>
<div><center>{{ appRestore.app.message }}</center></div>
<br>
</div>
<!-- backup id copy helper -->
<input type="text" class="offscreen" aria-hidden="true" id="appRestoreBackupIdHelper" value="">
<table class="table table-hover" style="margin: 0;" ng-show="appRestore.backups.length">
<thead>
<tr>
<th width="25px">&nbsp;</th>
<th>Created</th>
<th>Version</th>
<th class="text-right" width="180px">Actions</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="backup in appRestore.backups">
<td><div ng-click="appRestore.copyBackupId(backup)" class="hand" uib-tooltip="{{ appRestore.copyBackupIdDone ? 'Copied to clipboard' : 'Click to copy backup id' }}" tooltip-placement="right"><i class="fa fa-copy"></i></div></td>
<td>{{ backup.creationTime | prettyDate }}</td>
<td>v{{ backup.version }}</td>
<td class="text-right no-wrap" style="vertical-align: bottom">
<button class="btn btn-xs btn-default" ng-hide="backup.ackRestore" ng-click="appClone.show(appRestore.app, backup)" uib-tooltip="Clone from this Backup"><i class="far fa-clone"></i></button>
<button class="btn btn-xs btn-danger" ng-hide="backup.ackRestore" ng-click="backup.ackRestore = true" uib-tooltip="Restore to this Backup"><i class="fas fa-history"></i></button>
<button class="btn btn-xs btn-danger" ng-show="backup.ackRestore" ng-click="appRestore.restore(backup)">Yes restore now</button>
<button class="btn btn-xs btn-default" ng-show="backup.ackRestore" ng-click="backup.ackRestore = false">Back</button>
</td>
</tr>
</tbody>
</table>
<br/>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Modal clone app -->
<div class="modal fade" id="appCloneModal" tabindex="-1" role="dialog">
<div class="modal-dialog">