mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-28 18:24:38 -05:00
Feature: documents trash aka soft delete (#6944)
This commit is contained in:
@@ -86,14 +86,4 @@ describe('ConfirmDialogComponent', () => {
|
||||
expect(closeModalSpy).toHaveBeenCalled()
|
||||
expect(confirmSubjectResult).toBeFalsy()
|
||||
})
|
||||
|
||||
it('should support delay confirm', fakeAsync(() => {
|
||||
component.confirmButtonEnabled = false
|
||||
component.delayConfirm(1)
|
||||
expect(component.confirmButtonEnabled).toBeFalsy()
|
||||
tick(1500)
|
||||
fixture.detectChanges()
|
||||
expect(component.confirmButtonEnabled).toBeTruthy()
|
||||
discardPeriodicTasks()
|
||||
}))
|
||||
})
|
||||
|
@@ -54,26 +54,6 @@ export class ConfirmDialogComponent {
|
||||
confirmSubject: Subject<boolean>
|
||||
alternativeSubject: Subject<boolean>
|
||||
|
||||
delayConfirm(seconds: number) {
|
||||
const refreshInterval = 0.15 // s
|
||||
|
||||
this.secondsTotal = seconds
|
||||
this.seconds = seconds
|
||||
|
||||
interval(refreshInterval * 1000)
|
||||
.pipe(
|
||||
take(this.secondsTotal / refreshInterval + 2) // need 2 more for animation to complete after 0
|
||||
)
|
||||
.subscribe((count) => {
|
||||
this.seconds = Math.max(
|
||||
0,
|
||||
this.secondsTotal - refreshInterval * (count + 1)
|
||||
)
|
||||
this.confirmButtonEnabled =
|
||||
this.secondsTotal - refreshInterval * count < 0
|
||||
})
|
||||
}
|
||||
|
||||
cancel() {
|
||||
this.confirmSubject?.next(false)
|
||||
this.confirmSubject?.complete()
|
||||
|
Reference in New Issue
Block a user