|
- {{ document.title }} |
+
+ {{ document.title }}
+
+
+
+ |
{{ getDaysRemaining(document) }} days |
diff --git a/src-ui/src/app/components/admin/trash/trash.component.spec.ts b/src-ui/src/app/components/admin/trash/trash.component.spec.ts
index c9e797a1f..9ac89d9a5 100644
--- a/src-ui/src/app/components/admin/trash/trash.component.spec.ts
+++ b/src-ui/src/app/components/admin/trash/trash.component.spec.ts
@@ -16,6 +16,7 @@ import { ConfirmDialogComponent } from '../../common/confirm-dialog/confirm-dial
import { By } from '@angular/platform-browser'
import { SafeHtmlPipe } from 'src/app/pipes/safehtml.pipe'
import { ToastService } from 'src/app/services/toast.service'
+import { Router } from '@angular/router'
const documentsInTrash = [
{
@@ -38,6 +39,7 @@ describe('TrashComponent', () => {
let trashService: TrashService
let modalService: NgbModal
let toastService: ToastService
+ let router: Router
beforeEach(async () => {
await TestBed.configureTestingModule({
@@ -61,6 +63,7 @@ describe('TrashComponent', () => {
trashService = TestBed.inject(TrashService)
modalService = TestBed.inject(NgbModal)
toastService = TestBed.inject(ToastService)
+ router = TestBed.inject(Router)
component = fixture.componentInstance
fixture.detectChanges()
})
@@ -161,6 +164,22 @@ describe('TrashComponent', () => {
expect(restoreSpy).toHaveBeenCalledWith([1, 2])
})
+ it('should offer link to restored document', () => {
+ let toasts
+ const navigateSpy = jest.spyOn(router, 'navigate')
+ toastService.getToasts().subscribe((allToasts) => {
+ toasts = [...allToasts]
+ })
+ jest.spyOn(trashService, 'restoreDocuments').mockReturnValue(of('OK'))
+ component.restore(documentsInTrash[0])
+ expect(toasts.length).toEqual(1)
+ toasts[0].action()
+ expect(navigateSpy).toHaveBeenCalledWith([
+ 'documents',
+ documentsInTrash[0].id,
+ ])
+ })
+
it('should support toggle all items in view', () => {
component.documentsInTrash = documentsInTrash
expect(component.selectedDocuments.size).toEqual(0)
diff --git a/src-ui/src/app/components/admin/trash/trash.component.ts b/src-ui/src/app/components/admin/trash/trash.component.ts
index cf807e831..9364d4cce 100644
--- a/src-ui/src/app/components/admin/trash/trash.component.ts
+++ b/src-ui/src/app/components/admin/trash/trash.component.ts
@@ -7,6 +7,7 @@ import { ConfirmDialogComponent } from '../../common/confirm-dialog/confirm-dial
import { Subject, takeUntil } from 'rxjs'
import { SettingsService } from 'src/app/services/settings.service'
import { SETTINGS_KEYS } from 'src/app/data/ui-settings'
+import { Router } from '@angular/router'
@Component({
selector: 'pngx-trash',
@@ -26,7 +27,8 @@ export class TrashComponent implements OnDestroy {
private trashService: TrashService,
private toastService: ToastService,
private modalService: NgbModal,
- private settingsService: SettingsService
+ private settingsService: SettingsService,
+ private router: Router
) {
this.reload()
}
@@ -110,7 +112,14 @@ export class TrashComponent implements OnDestroy {
restore(document: Document) {
this.trashService.restoreDocuments([document.id]).subscribe({
next: () => {
- this.toastService.showInfo($localize`Document restored`)
+ this.toastService.show({
+ content: $localize`Document restored`,
+ delay: 5000,
+ actionName: $localize`Open document`,
+ action: () => {
+ this.router.navigate(['documents', document.id])
+ },
+ })
this.reload()
},
error: (err) => {
diff --git a/src-ui/src/app/components/app-frame/app-frame.component.html b/src-ui/src/app/components/app-frame/app-frame.component.html
index 51978c3e3..f69b5246a 100644
--- a/src-ui/src/app/components/app-frame/app-frame.component.html
+++ b/src-ui/src/app/components/app-frame/app-frame.component.html
@@ -1,4 +1,4 @@
- |