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">
|
<div class="editor-container">
|
||||||
<ngx-monaco-editor (init)="onCodeEditorInit($event)" [(ngModel)]="codeEditorText" [options]="editorOptions"></ngx-monaco-editor>
|
<ngx-monaco-editor (init)="onCodeEditorInit($event)" [(ngModel)]="codeEditorText" [options]="editorOptions"></ngx-monaco-editor>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="hasChanges && permissionsService.isAdmin()" class="changes-box">
|
<div *ngIf="changed && permissionsService.isAdmin() && !isLeaving" class="changes-box">
|
||||||
<iqser-icon-button
|
<iqser-icon-button
|
||||||
(action)="save()"
|
(action)="save()"
|
||||||
[label]="'rules-screen.save-changes' | translate"
|
[label]="'rules-screen.save-changes' | translate"
|
||||||
|
|||||||
@ -28,6 +28,8 @@ export class RulesScreenComponent implements OnInit {
|
|||||||
initialLines: string[] = [];
|
initialLines: string[] = [];
|
||||||
currentLines: string[] = [];
|
currentLines: string[] = [];
|
||||||
|
|
||||||
|
isLeaving = false;
|
||||||
|
|
||||||
@ViewChild('fileInput')
|
@ViewChild('fileInput')
|
||||||
private _fileInput: ElementRef;
|
private _fileInput: ElementRef;
|
||||||
|
|
||||||
@ -44,7 +46,12 @@ export class RulesScreenComponent implements OnInit {
|
|||||||
private readonly _loadingService: LoadingService,
|
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();
|
return this.currentLines.toString() !== this.initialLines.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user