A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Tweakhancement: allow some bulk operations with all (#13193)
shamoond113826cf85e
diff --git a/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.html b/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.htmlindex 3f004cb7e..2ea56d4c4 100644--- a/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.html+++ b/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.html@@ -103,13 +103,13 @@class="btn btn-sm btn-outline-primary"id="dropdownSend"ngbDropdownToggle- [disabled]="disabled || !list.hasSelection || list.allSelected"+ [disabled]="disabled || !canSendSelection"><i-bs name="send"></i-bs><div class="d-none d-sm-inline ms-1"><ng-container i18n>Send</ng-container></div></button><div ngbDropdownMenu aria-labelledby="dropdownSend" class="shadow">- <button ngbDropdownItem (click)="createShareLinkBundle()" [disabled]="list.allSelected">+ <button ngbDropdownItem (click)="createShareLinkBundle()" [disabled]="!canSendSelection"><i-bs name="link" class="me-1"></i-bs><ng-container i18n>Create a share link bundle</ng-container></button><button ngbDropdownItem (click)="manageShareLinkBundles()">@@ -117,7 +117,7 @@</button><div class="dropdown-divider"></div>@if (emailEnabled) {- <button ngbDropdownItem (click)="emailSelected()" [disabled]="list.allSelected">+ <button ngbDropdownItem (click)="emailSelected()" [disabled]="!canSendSelection"><i-bs name="envelope" class="me-1"></i-bs><ng-container i18n>Email</ng-container></button>}diff --git a/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.spec.ts b/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.spec.tsindex 041eed976..40d21f39b 100644--- a/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.spec.ts+++ b/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.spec.ts@@ -208,6 +208,50 @@ describe('BulkEditorComponent', () => {expect(component.tagSelectionModel.selectionSize()).toEqual(1)})+ it('should allow sending an all-filtered selection that fits on the current page', () => {+ jest+ .spyOn(documentListViewService, 'hasSelection', 'get')+ .mockReturnValue(true)+ jest+ .spyOn(documentListViewService, 'allSelected', 'get')+ .mockReturnValue(true)+ jest+ .spyOn(documentListViewService, 'selectedCount', 'get')+ .mockReturnValue(5)+ jest+ .spyOn(documentListViewService, 'selected', 'get')+ .mockReturnValue(new Set([1, 2, 3, 4, 5]))++ fixture.detectChanges()++ expect(component.canSendSelection).toBe(true)+ expect(+ fixture.debugElement.query(By.css('#dropdownSend')).nativeElement.disabled+ ).toBe(false)+ })++ it('should prevent sending an all-filtered selection spanning multiple pages', () => {+ jest+ .spyOn(documentListViewService, 'hasSelection', 'get')+ .mockReturnValue(true)+ jest+ .spyOn(documentListViewService, 'allSelected', 'get')+ .mockReturnValue(true)+ jest+ .spyOn(documentListViewService, 'selectedCount', 'get')+ .mockReturnValue(6)+ jest+ .spyOn(documentListViewService, 'selected', 'get')+ .mockReturnValue(new Set([1, 2, 3, 4, 5]))++ fixture.detectChanges()++ expect(component.canSendSelection).toBe(false)+ expect(+ fixture.debugElement.query(By.css('#dropdownSend')).nativeElement.disabled+ ).toBe(true)+ })+it('should apply selection data to correspondents menu', () => {jest.spyOn(permissionsService, 'currentUserCan').mockReturnValue(true)fixture.detectChanges()@@ -1597,6 +1641,7 @@ describe('BulkEditorComponent', () => {expect(modal.componentInstance.customFields.length).toEqual(2)expect(modal.componentInstance.fieldsToAddIds).toEqual([1, 2])expect(modal.componentInstance.selection).toEqual({ documents: [3, 4] })+ expect(modal.componentInstance.selectionCount).toEqual(2)expect(modal.componentInstance.documents).toEqual([3, 4])modal.componentInstance.failed.emit()diff --git a/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.ts b/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.tsindex 60f478670..67b2e04ae 100644--- a/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.ts+++ b/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.ts@@ -1041,6 +1041,14 @@ export class BulkEditorComponentreturn this.settings.get(SETTINGS_KEYS.EMAIL_ENABLED)}+ public get canSendSelection(): boolean {+ return (+ this.list.hasSelection &&+ (!this.list.allSelected ||+ this.list.selectedCount === this.list.selected.size)+ )+ }+createShareLinkBundle() {const modal = this.modalService.open(ShareLinkBundleDialogComponent, {backdrop: 'static',