Add interface logic for reverting page to previous version
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing

This commit is contained in:
2020-11-06 12:43:13 -06:00
parent cd37ea1df1
commit 4c0fbc7594
6 changed files with 90 additions and 4 deletions

View File

@@ -1,6 +1,14 @@
<div class="container">
<div class="header">
<div class="title">Page Versions</div>
<button
*ngIf="selectedVersion && !selectedVersion.currentVersion"
title="Revert to this version"
class="revert"
(click)="revertToVersion()"
>
Revert
</button>
<button title="Close" class="close" (click)="dismiss()">
<i class="fa fa-times"></i>
</button>

View File

@@ -19,6 +19,11 @@
background: #ff6666;
color: white;
}
.revert {
color: red;
background: #eaeaea;
}
}
.contents {

View File

@@ -29,8 +29,30 @@ export class VersionModalComponent implements OnInit {
this.onVersionClick(this.pageVersions[0]);
}
dismiss() {
this.modals.dismiss();
dismiss(reload = false) {
this.modals.dismiss(reload);
}
async revertToVersion() {
const alert = await this.alerts.create({
header: 'Revert page?',
message: `This will revert the current version of the page to version ${this.selectedVersion.versionNum}. Continue?`,
buttons: [
{
text: 'Keep It',
role: 'cancel',
},
{
text: 'Revert It',
handler: async () => {
await this.editorService.revertPageToVersion(this.pageId, this.selectedVersion.versionNum);
this.dismiss(true);
},
},
],
});
await alert.present();
}
async onVersionClick(version: PageVersionRecord) {