A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Enhancement: offer link to restored document (#8321)
shamoonf6cc2f9fc330
diff --git a/src-ui/messages.xlf b/src-ui/messages.xlfindex b75991ed1..8bd52760e 100644--- a/src-ui/messages.xlf+++ b/src-ui/messages.xlf@@ -253,6 +253,10 @@<context context-type="sourcefile">src/app/app.component.ts</context><context context-type="linenumber">87</context></context-group>+ <context-group purpose="location">+ <context context-type="sourcefile">src/app/components/admin/trash/trash.component.ts</context>+ <context context-type="linenumber">118</context>+ </context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/dashboard/widgets/saved-view-widget/saved-view-widget.component.html</context><context context-type="linenumber">37</context>@@ -1480,11 +1484,11 @@</context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/admin/trash/trash.component.ts</context>- <context context-type="linenumber">57</context>+ <context context-type="linenumber">59</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/admin/trash/trash.component.ts</context>- <context context-type="linenumber">86</context>+ <context context-type="linenumber">88</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/admin/users-groups/users-groups.component.html</context>@@ -2216,11 +2220,11 @@<source>Confirm delete</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/admin/trash/trash.component.ts</context>- <context context-type="linenumber">53</context>+ <context context-type="linenumber">55</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/admin/trash/trash.component.ts</context>- <context context-type="linenumber">80</context>+ <context context-type="linenumber">82</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>@@ -2235,18 +2239,18 @@<source>This operation will permanently delete this document.</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/admin/trash/trash.component.ts</context>- <context context-type="linenumber">54</context>+ <context context-type="linenumber">56</context></context-group></trans-unit><trans-unit id="5641451190833696892" datatype="html"><source>This operation cannot be undone.</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/admin/trash/trash.component.ts</context>- <context context-type="linenumber">55</context>+ <context context-type="linenumber">57</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/admin/trash/trash.component.ts</context>- <context context-type="linenumber">84</context>+ <context context-type="linenumber">86</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/admin/users-groups/users-groups.component.ts</context>@@ -2281,14 +2285,14 @@<source>Document deleted</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/admin/trash/trash.component.ts</context>- <context context-type="linenumber">64</context>+ <context context-type="linenumber">66</context></context-group></trans-unit><trans-unit id="7295637485862454066" datatype="html"><source>Error deleting document</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/admin/trash/trash.component.ts</context>- <context context-type="linenumber">69</context>+ <context context-type="linenumber">71</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>@@ -2299,56 +2303,56 @@<source>This operation will permanently delete the selected documents.</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/admin/trash/trash.component.ts</context>- <context context-type="linenumber">82</context>+ <context context-type="linenumber">84</context></context-group></trans-unit><trans-unit id="6804051092296228130" datatype="html"><source>This operation will permanently delete all documents in the trash.</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/admin/trash/trash.component.ts</context>- <context context-type="linenumber">83</context>+ <context context-type="linenumber">85</context></context-group></trans-unit><trans-unit id="6996183233986182894" datatype="html"><source>Document(s) deleted</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/admin/trash/trash.component.ts</context>- <context context-type="linenumber">94</context>+ <context context-type="linenumber">96</context></context-group></trans-unit><trans-unit id="6962724852893361467" datatype="html"><source>Error deleting document(s)</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/admin/trash/trash.component.ts</context>- <context context-type="linenumber">101</context>+ <context context-type="linenumber">103</context></context-group></trans-unit><trans-unit id="7534569062269274401" datatype="html"><source>Document restored</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/admin/trash/trash.component.ts</context>- <context context-type="linenumber">113</context>+ <context context-type="linenumber">116</context></context-group></trans-unit><trans-unit id="9136016619414048201" datatype="html"><source>Error restoring document</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/admin/trash/trash.component.ts</context>- <context context-type="linenumber">117</context>+ <context context-type="linenumber">126</context></context-group></trans-unit><trans-unit id="960063472770266304" datatype="html"><source>Document(s) restored</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/admin/trash/trash.component.ts</context>- <context context-type="linenumber">127</context>+ <context context-type="linenumber">136</context></context-group></trans-unit><trans-unit id="8405416976953346141" datatype="html"><source>Error restoring document(s)</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/admin/trash/trash.component.ts</context>- <context context-type="linenumber">133</context>+ <context context-type="linenumber">142</context></context-group></trans-unit><trans-unit id="8119815638230251386" datatype="html">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.tsindex 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-dialimport { 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: TrashServicelet modalService: NgbModallet toastService: ToastService+ let router: RouterbeforeEach(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.componentInstancefixture.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 = documentsInTrashexpect(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.tsindex 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-dialimport { 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) => {