mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-09-26 01:12:43 -05:00
Settings navigation warning dialog
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
selector: 'app-confirm-dialog',
|
||||
@@ -8,8 +9,6 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
})
|
||||
export class ConfirmDialogComponent implements OnInit {
|
||||
|
||||
constructor(public activeModal: NgbActiveModal) { }
|
||||
|
||||
@Output()
|
||||
public confirmClicked = new EventEmitter()
|
||||
|
||||
@@ -30,10 +29,16 @@ export class ConfirmDialogComponent implements OnInit {
|
||||
|
||||
@Input()
|
||||
buttonsEnabled = true
|
||||
|
||||
|
||||
confirmButtonEnabled = true
|
||||
seconds = 0
|
||||
|
||||
subject: Subject<boolean>
|
||||
|
||||
constructor(public activeModal: NgbActiveModal) {
|
||||
this.confirmClicked.asObservable()
|
||||
}
|
||||
|
||||
delayConfirm(seconds: number) {
|
||||
this.confirmButtonEnabled = false
|
||||
this.seconds = seconds
|
||||
@@ -49,7 +54,15 @@ export class ConfirmDialogComponent implements OnInit {
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
cancelClicked() {
|
||||
cancel() {
|
||||
this.subject?.next(false)
|
||||
this.subject?.complete()
|
||||
this.activeModal.close()
|
||||
}
|
||||
|
||||
confirm() {
|
||||
this.subject?.next(true)
|
||||
this.subject?.complete()
|
||||
this.confirmClicked.emit()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user