mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.3 KiB
46 lines
1.3 KiB
/*
|
|
* Squidex Headless CMS
|
|
*
|
|
* @license
|
|
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
|
|
*/
|
|
|
|
import { Component } from '@angular/core';
|
|
import { FormBuilder } from '@angular/forms';
|
|
import { AuthService, BackupsService, DialogService, RestoreForm, switchSafe } from '@app/shared';
|
|
import { timer } from 'rxjs';
|
|
|
|
@Component({
|
|
selector: 'sqx-restore-page',
|
|
styleUrls: ['./restore-page.component.scss'],
|
|
templateUrl: './restore-page.component.html',
|
|
})
|
|
export class RestorePageComponent {
|
|
public restoreForm = new RestoreForm(this.formBuilder);
|
|
|
|
public restoreJob =
|
|
timer(0, 2000).pipe(switchSafe(() => this.backupsService.getRestore()));
|
|
|
|
constructor(
|
|
public readonly authState: AuthService,
|
|
private readonly backupsService: BackupsService,
|
|
private readonly dialogs: DialogService,
|
|
private readonly formBuilder: FormBuilder,
|
|
) {
|
|
}
|
|
|
|
public restore() {
|
|
const value = this.restoreForm.submit();
|
|
|
|
if (value) {
|
|
this.restoreForm.submitCompleted();
|
|
|
|
this.backupsService.postRestore(value)
|
|
.subscribe(() => {
|
|
this.dialogs.notifyInfo('i18n:backups.restoreStarted');
|
|
}, error => {
|
|
this.dialogs.notifyError(error);
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|