updates for rules screen to can use PendingChangesGuard
This commit is contained in:
parent
daf90cba6f
commit
387f9a166c
@ -22,7 +22,7 @@
|
||||
<div class="editor-container">
|
||||
<ngx-monaco-editor (init)="onCodeEditorInit($event)" [(ngModel)]="codeEditorText" [options]="editorOptions"></ngx-monaco-editor>
|
||||
</div>
|
||||
<div *ngIf="hasChanges && permissionsService.isAdmin()" class="changes-box">
|
||||
<div *ngIf="changed && permissionsService.isAdmin() && !isLeaving" class="changes-box">
|
||||
<iqser-icon-button
|
||||
(action)="save()"
|
||||
[label]="'rules-screen.save-changes' | translate"
|
||||
|
||||
@ -28,6 +28,8 @@ export class RulesScreenComponent implements OnInit {
|
||||
initialLines: string[] = [];
|
||||
currentLines: string[] = [];
|
||||
|
||||
isLeaving = false;
|
||||
|
||||
@ViewChild('fileInput')
|
||||
private _fileInput: ElementRef;
|
||||
|
||||
@ -44,7 +46,12 @@ export class RulesScreenComponent implements OnInit {
|
||||
private readonly _loadingService: LoadingService,
|
||||
) {}
|
||||
|
||||
get hasChanges(): boolean {
|
||||
set isLeavingPage(isLeaving: boolean) {
|
||||
this.isLeaving = isLeaving;
|
||||
this._changeDetectorRef.detectChanges();
|
||||
}
|
||||
|
||||
get changed(): boolean {
|
||||
return this.currentLines.toString() !== this.initialLines.toString();
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user