diff --git a/src-ui/messages.xlf b/src-ui/messages.xlf index 90fe30781..ed4458ec2 100644 --- a/src-ui/messages.xlf +++ b/src-ui/messages.xlf @@ -385,7 +385,7 @@ src/app/components/document-detail/document-detail.component.html - 103 + 115 @@ -534,7 +534,7 @@ src/app/components/document-detail/document-detail.component.html - 356 + 368 @@ -593,7 +593,7 @@ src/app/components/document-detail/document-detail.component.html - 349 + 361 src/app/components/document-list/bulk-editor/custom-fields-bulk-edit-dialog/custom-fields-bulk-edit-dialog.component.html @@ -739,7 +739,7 @@ src/app/components/document-detail/document-detail.component.html - 369 + 381 src/app/components/document-list/document-list.component.html @@ -1190,7 +1190,7 @@ src/app/components/document-detail/document-detail.component.html - 325 + 337 src/app/components/document-list/bulk-editor/bulk-editor.component.html @@ -2077,8 +2077,8 @@ 19 - src/app/components/common/share-links-dropdown/share-links-dropdown.component.html - 37 + src/app/components/common/share-links-dialog/share-links-dialog.component.html + 36 src/app/components/document-detail/document-detail.component.html @@ -2537,19 +2537,19 @@ src/app/components/document-detail/document-detail.component.ts - 960 + 958 src/app/components/document-detail/document-detail.component.ts - 1320 + 1318 src/app/components/document-detail/document-detail.component.ts - 1359 + 1357 src/app/components/document-detail/document-detail.component.ts - 1400 + 1398 src/app/components/document-list/bulk-editor/bulk-editor.component.ts @@ -3157,7 +3157,7 @@ src/app/components/document-detail/document-detail.component.ts - 913 + 911 src/app/components/document-list/bulk-editor/bulk-editor.component.ts @@ -3391,11 +3391,11 @@ src/app/components/document-detail/document-detail.component.html - 97 + 109 src/app/components/document-detail/document-detail.component.ts - 1377 + 1375 src/app/guards/dirty-saved-view.guard.ts @@ -4288,7 +4288,7 @@ src/app/components/document-detail/document-detail.component.html - 291 + 303 @@ -4386,14 +4386,14 @@ src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.ts 125 - - src/app/components/common/email-document-dropdown/email-document-dropdown.component.html - 4 - src/app/components/common/profile-edit-dialog/profile-edit-dialog.component.html 10 + + src/app/components/document-detail/document-detail.component.html + 95 + First name @@ -5068,57 +5068,57 @@ Email address(es) - src/app/components/common/email-document-dropdown/email-document-dropdown.component.html - 8 + src/app/components/common/email-document-dialog/email-document-dialog.component.html + 7 Subject - src/app/components/common/email-document-dropdown/email-document-dropdown.component.html - 12 + src/app/components/common/email-document-dialog/email-document-dialog.component.html + 11 Message - src/app/components/common/email-document-dropdown/email-document-dropdown.component.html - 16 + src/app/components/common/email-document-dialog/email-document-dialog.component.html + 15 Use archive version - src/app/components/common/email-document-dropdown/email-document-dropdown.component.html - 22 + src/app/components/common/email-document-dialog/email-document-dialog.component.html + 23 Send email - src/app/components/common/email-document-dropdown/email-document-dropdown.component.html - 28 + src/app/components/common/email-document-dialog/email-document-dialog.component.html + 29 Email Document - src/app/components/common/email-document-dropdown/email-document-dropdown.component.ts + src/app/components/common/email-document-dialog/email-document-dialog.component.ts 19 Email sent - src/app/components/common/email-document-dropdown/email-document-dropdown.component.ts - 74 + src/app/components/common/email-document-dialog/email-document-dialog.component.ts + 72 Error emailing document - src/app/components/common/email-document-dropdown/email-document-dropdown.component.ts - 78 + src/app/components/common/email-document-dialog/email-document-dialog.component.ts + 76 @@ -5142,8 +5142,8 @@ 58 - src/app/components/common/share-links-dropdown/share-links-dropdown.component.html - 64 + src/app/components/common/share-links-dialog/share-links-dialog.component.html + 65 src/app/components/manage/management-list/management-list.component.html @@ -5603,8 +5603,8 @@ 155 - src/app/components/common/share-links-dropdown/share-links-dropdown.component.html - 29 + src/app/components/common/share-links-dialog/share-links-dialog.component.html + 28 src/app/components/common/system-status-dialog/system-status-dialog.component.html @@ -5645,8 +5645,8 @@ 162 - src/app/components/common/share-links-dropdown/share-links-dropdown.component.html - 40 + src/app/components/common/share-links-dialog/share-links-dialog.component.html + 39 @@ -5825,103 +5825,103 @@ 320 - - Share Links - - src/app/components/common/share-links-dropdown/share-links-dropdown.component.html - 4 - - - src/app/components/common/share-links-dropdown/share-links-dropdown.component.ts - 32 - - No existing links - src/app/components/common/share-links-dropdown/share-links-dropdown.component.html - 9,11 + src/app/components/common/share-links-dialog/share-links-dialog.component.html + 8,10 Share - src/app/components/common/share-links-dropdown/share-links-dropdown.component.html - 33 + src/app/components/common/share-links-dialog/share-links-dialog.component.html + 32 Share archive version - src/app/components/common/share-links-dropdown/share-links-dropdown.component.html - 47 + src/app/components/common/share-links-dialog/share-links-dialog.component.html + 48 Expires - src/app/components/common/share-links-dropdown/share-links-dropdown.component.html - 51 + src/app/components/common/share-links-dialog/share-links-dialog.component.html + 52 1 day - src/app/components/common/share-links-dropdown/share-links-dropdown.component.ts - 25 + src/app/components/common/share-links-dialog/share-links-dialog.component.ts + 20 - src/app/components/common/share-links-dropdown/share-links-dropdown.component.ts - 111 + src/app/components/common/share-links-dialog/share-links-dialog.component.ts + 104 7 days - src/app/components/common/share-links-dropdown/share-links-dropdown.component.ts - 26 + src/app/components/common/share-links-dialog/share-links-dialog.component.ts + 21 30 days - src/app/components/common/share-links-dropdown/share-links-dropdown.component.ts - 27 + src/app/components/common/share-links-dialog/share-links-dialog.component.ts + 22 Never - src/app/components/common/share-links-dropdown/share-links-dropdown.component.ts - 28 + src/app/components/common/share-links-dialog/share-links-dialog.component.ts + 23 + + + + Share Links + + src/app/components/common/share-links-dialog/share-links-dialog.component.ts + 27 + + + src/app/components/document-detail/document-detail.component.html + 92 Error retrieving links - src/app/components/common/share-links-dropdown/share-links-dropdown.component.ts - 92 + src/app/components/common/share-links-dialog/share-links-dialog.component.ts + 85 days - src/app/components/common/share-links-dropdown/share-links-dropdown.component.ts - 111 + src/app/components/common/share-links-dialog/share-links-dialog.component.ts + 104 Error deleting link - src/app/components/common/share-links-dropdown/share-links-dropdown.component.ts - 140 + src/app/components/common/share-links-dialog/share-links-dialog.component.ts + 133 Error creating link - src/app/components/common/share-links-dropdown/share-links-dropdown.component.ts - 168 + src/app/components/common/share-links-dialog/share-links-dialog.component.ts + 161 @@ -6439,25 +6439,32 @@ 70 + + Send + + src/app/components/document-detail/document-detail.component.html + 88 + + Previous src/app/components/document-detail/document-detail.component.html - 100 + 112 Details src/app/components/document-detail/document-detail.component.html - 113 + 125 Title src/app/components/document-detail/document-detail.component.html - 116 + 128 src/app/components/document-list/document-list.component.html @@ -6480,21 +6487,21 @@ Archive serial number src/app/components/document-detail/document-detail.component.html - 117 + 129 Date created src/app/components/document-detail/document-detail.component.html - 118 + 130 Correspondent src/app/components/document-detail/document-detail.component.html - 120 + 132 src/app/components/document-list/bulk-editor/bulk-editor.component.html @@ -6521,7 +6528,7 @@ Document type src/app/components/document-detail/document-detail.component.html - 122 + 134 src/app/components/document-list/bulk-editor/bulk-editor.component.html @@ -6548,7 +6555,7 @@ Storage path src/app/components/document-detail/document-detail.component.html - 124 + 136 src/app/components/document-list/bulk-editor/bulk-editor.component.html @@ -6571,7 +6578,7 @@ Default src/app/components/document-detail/document-detail.component.html - 125 + 137 src/app/components/manage/saved-views/saved-views.component.html @@ -6582,14 +6589,14 @@ Content src/app/components/document-detail/document-detail.component.html - 221 + 233 Metadata src/app/components/document-detail/document-detail.component.html - 230 + 242 src/app/components/document-detail/metadata-collapse/metadata-collapse.component.ts @@ -6600,175 +6607,175 @@ Date modified src/app/components/document-detail/document-detail.component.html - 237 + 249 Date added src/app/components/document-detail/document-detail.component.html - 241 + 253 Media filename src/app/components/document-detail/document-detail.component.html - 245 + 257 Original filename src/app/components/document-detail/document-detail.component.html - 249 + 261 Original MD5 checksum src/app/components/document-detail/document-detail.component.html - 253 + 265 Original file size src/app/components/document-detail/document-detail.component.html - 257 + 269 Original mime type src/app/components/document-detail/document-detail.component.html - 261 + 273 Archive MD5 checksum src/app/components/document-detail/document-detail.component.html - 266 + 278 Archive file size src/app/components/document-detail/document-detail.component.html - 272 + 284 Original document metadata src/app/components/document-detail/document-detail.component.html - 281 + 293 Archived document metadata src/app/components/document-detail/document-detail.component.html - 284 + 296 Notes src/app/components/document-detail/document-detail.component.html - 303,306 + 315,318 History src/app/components/document-detail/document-detail.component.html - 314 + 326 Save & next src/app/components/document-detail/document-detail.component.html - 351 + 363 Save & close src/app/components/document-detail/document-detail.component.html - 354 + 366 Document loading... src/app/components/document-detail/document-detail.component.html - 364 + 376 Enter Password src/app/components/document-detail/document-detail.component.html - 418 + 430 An error occurred loading content: src/app/components/document-detail/document-detail.component.ts - 414,416 + 412,414 Document changes detected src/app/components/document-detail/document-detail.component.ts - 437 + 435 The version of this document in your browser session appears older than the existing version. src/app/components/document-detail/document-detail.component.ts - 438 + 436 Saving the document here may overwrite other changes that were made. To restore the existing version, discard your changes or close the document. src/app/components/document-detail/document-detail.component.ts - 439 + 437 Ok src/app/components/document-detail/document-detail.component.ts - 441 + 439 Next document src/app/components/document-detail/document-detail.component.ts - 548 + 546 Previous document src/app/components/document-detail/document-detail.component.ts - 558 + 556 Close document src/app/components/document-detail/document-detail.component.ts - 566 + 564 src/app/services/open-documents.service.ts @@ -6779,67 +6786,67 @@ Save document src/app/components/document-detail/document-detail.component.ts - 573 + 571 Save and close / next src/app/components/document-detail/document-detail.component.ts - 582 + 580 Error retrieving metadata src/app/components/document-detail/document-detail.component.ts - 634 + 632 Error retrieving suggestions. src/app/components/document-detail/document-detail.component.ts - 663 + 661 Document "" saved successfully. src/app/components/document-detail/document-detail.component.ts - 815 + 813 src/app/components/document-detail/document-detail.component.ts - 831 + 829 Error saving document "" src/app/components/document-detail/document-detail.component.ts - 837 + 835 Error saving document src/app/components/document-detail/document-detail.component.ts - 882 + 880 Do you really want to move the document "" to the trash? src/app/components/document-detail/document-detail.component.ts - 914 + 912 Documents can be restored prior to permanent deletion. src/app/components/document-detail/document-detail.component.ts - 915 + 913 src/app/components/document-list/bulk-editor/bulk-editor.component.ts @@ -6850,7 +6857,7 @@ Move to trash src/app/components/document-detail/document-detail.component.ts - 917 + 915 src/app/components/document-list/bulk-editor/bulk-editor.component.ts @@ -6861,14 +6868,14 @@ Error deleting document src/app/components/document-detail/document-detail.component.ts - 936 + 934 Reprocess confirm src/app/components/document-detail/document-detail.component.ts - 956 + 954 src/app/components/document-list/bulk-editor/bulk-editor.component.ts @@ -6879,77 +6886,77 @@ This operation will permanently recreate the archive file for this document. src/app/components/document-detail/document-detail.component.ts - 957 + 955 The archive file will be re-generated with the current settings. src/app/components/document-detail/document-detail.component.ts - 958 + 956 Reprocess operation for "" will begin in the background. Close and re-open or reload this document after the operation has completed to see new content. src/app/components/document-detail/document-detail.component.ts - 968 + 966 Error executing operation src/app/components/document-detail/document-detail.component.ts - 979 + 977 Error downloading document src/app/components/document-detail/document-detail.component.ts - 1026 + 1024 Page Fit src/app/components/document-detail/document-detail.component.ts - 1105 + 1103 Split confirm src/app/components/document-detail/document-detail.component.ts - 1318 + 1316 This operation will split the selected document(s) into new documents. src/app/components/document-detail/document-detail.component.ts - 1319 + 1317 Split operation for "" will begin in the background. src/app/components/document-detail/document-detail.component.ts - 1335 + 1333 Error executing split operation src/app/components/document-detail/document-detail.component.ts - 1344 + 1342 Rotate confirm src/app/components/document-detail/document-detail.component.ts - 1357 + 1355 src/app/components/document-list/bulk-editor/bulk-editor.component.ts @@ -6960,60 +6967,60 @@ This operation will permanently rotate the original version of the current document. src/app/components/document-detail/document-detail.component.ts - 1358 + 1356 Rotation of "" will begin in the background. Close and re-open the document after the operation has completed to see the changes. src/app/components/document-detail/document-detail.component.ts - 1374 + 1372 Error executing rotate operation src/app/components/document-detail/document-detail.component.ts - 1386 + 1384 Delete pages confirm src/app/components/document-detail/document-detail.component.ts - 1398 + 1396 This operation will permanently delete the selected pages from the original document. src/app/components/document-detail/document-detail.component.ts - 1399 + 1397 Delete pages operation for "" will begin in the background. Close and re-open or reload this document after the operation has completed to see the changes. src/app/components/document-detail/document-detail.component.ts - 1414 + 1412 Error executing delete pages operation src/app/components/document-detail/document-detail.component.ts - 1423 + 1421 An error occurred loading tiff: src/app/components/document-detail/document-detail.component.ts - 1463 + 1477 src/app/components/document-detail/document-detail.component.ts - 1467 + 1481 diff --git a/src-ui/src/app/components/common/email-document-dialog/email-document-dialog.component.html b/src-ui/src/app/components/common/email-document-dialog/email-document-dialog.component.html new file mode 100644 index 000000000..56d404fd5 --- /dev/null +++ b/src-ui/src/app/components/common/email-document-dialog/email-document-dialog.component.html @@ -0,0 +1,32 @@ + + + diff --git a/src-ui/src/app/components/common/email-document-dialog/email-document-dialog.component.scss b/src-ui/src/app/components/common/email-document-dialog/email-document-dialog.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/src-ui/src/app/components/common/email-document-dropdown/email-document-dropdown.component.spec.ts b/src-ui/src/app/components/common/email-document-dialog/email-document-dialog.component.spec.ts similarity index 61% rename from src-ui/src/app/components/common/email-document-dropdown/email-document-dropdown.component.spec.ts rename to src-ui/src/app/components/common/email-document-dialog/email-document-dialog.component.spec.ts index 0a4c528b5..b0f998a41 100644 --- a/src-ui/src/app/components/common/email-document-dropdown/email-document-dropdown.component.spec.ts +++ b/src-ui/src/app/components/common/email-document-dialog/email-document-dialog.component.spec.ts @@ -2,17 +2,19 @@ import { ComponentFixture, TestBed } from '@angular/core/testing' import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http' import { provideHttpClientTesting } from '@angular/common/http/testing' +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap' import { NgxBootstrapIconsModule, allIcons } from 'ngx-bootstrap-icons' import { of, throwError } from 'rxjs' import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive' import { PermissionsService } from 'src/app/services/permissions.service' import { DocumentService } from 'src/app/services/rest/document.service' +import { SettingsService } from 'src/app/services/settings.service' import { ToastService } from 'src/app/services/toast.service' -import { EmailDocumentDropdownComponent } from './email-document-dropdown.component' +import { EmailDocumentDialogComponent } from './email-document-dialog.component' -describe('EmailDocumentDropdownComponent', () => { - let component: EmailDocumentDropdownComponent - let fixture: ComponentFixture +describe('EmailDocumentDialogComponent', () => { + let component: EmailDocumentDialogComponent + let fixture: ComponentFixture let documentService: DocumentService let permissionsService: PermissionsService let toastService: ToastService @@ -20,23 +22,37 @@ describe('EmailDocumentDropdownComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ imports: [ - EmailDocumentDropdownComponent, + EmailDocumentDialogComponent, IfPermissionsDirective, NgxBootstrapIconsModule.pick(allIcons), ], providers: [ provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting(), + NgbActiveModal, ], }).compileComponents() - fixture = TestBed.createComponent(EmailDocumentDropdownComponent) + fixture = TestBed.createComponent(EmailDocumentDialogComponent) documentService = TestBed.inject(DocumentService) toastService = TestBed.inject(ToastService) component = fixture.componentInstance fixture.detectChanges() }) + it('should get email enabled status from settings', () => { + const settingsService = TestBed.inject(SettingsService) + jest.spyOn(settingsService, 'get').mockReturnValue(true) + expect(component.emailEnabled).toBeTruthy() + }) + + it('should set hasArchiveVersion and useArchiveVersion', () => { + expect(component.hasArchiveVersion).toBeTruthy() + component.hasArchiveVersion = false + expect(component.hasArchiveVersion).toBeFalsy() + expect(component.useArchiveVersion).toBeFalsy() + }) + it('should support sending document via email, showing error if needed', () => { const toastErrorSpy = jest.spyOn(toastService, 'showError') const toastSuccessSpy = jest.spyOn(toastService, 'showInfo') @@ -53,4 +69,11 @@ describe('EmailDocumentDropdownComponent', () => { component.emailDocument() expect(toastSuccessSpy).toHaveBeenCalled() }) + + it('should close the dialog', () => { + const activeModal = TestBed.inject(NgbActiveModal) + const closeSpy = jest.spyOn(activeModal, 'close') + component.close() + expect(closeSpy).toHaveBeenCalled() + }) }) diff --git a/src-ui/src/app/components/common/email-document-dropdown/email-document-dropdown.component.ts b/src-ui/src/app/components/common/email-document-dialog/email-document-dialog.component.ts similarity index 81% rename from src-ui/src/app/components/common/email-document-dropdown/email-document-dropdown.component.ts rename to src-ui/src/app/components/common/email-document-dialog/email-document-dialog.component.ts index c9a648381..da77838a8 100644 --- a/src-ui/src/app/components/common/email-document-dropdown/email-document-dropdown.component.ts +++ b/src-ui/src/app/components/common/email-document-dialog/email-document-dialog.component.ts @@ -1,6 +1,6 @@ import { Component, Input } from '@angular/core' import { FormsModule } from '@angular/forms' -import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap' +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap' import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons' import { SETTINGS_KEYS } from 'src/app/data/ui-settings' import { DocumentService } from 'src/app/services/rest/document.service' @@ -9,21 +9,18 @@ import { ToastService } from 'src/app/services/toast.service' import { LoadingComponentWithPermissions } from '../../loading-component/loading.component' @Component({ - selector: 'pngx-email-document-dropdown', - imports: [FormsModule, NgbDropdownModule, NgxBootstrapIconsModule], - templateUrl: './email-document-dropdown.component.html', - styleUrl: './email-document-dropdown.component.scss', + selector: 'pngx-email-document-dialog', + templateUrl: './email-document-dialog.component.html', + styleUrl: './email-document-dialog.component.scss', + imports: [FormsModule, NgxBootstrapIconsModule], }) -export class EmailDocumentDropdownComponent extends LoadingComponentWithPermissions { +export class EmailDocumentDialogComponent extends LoadingComponentWithPermissions { @Input() title = $localize`Email Document` @Input() documentId: number - @Input() - disabled: boolean = false - private _hasArchiveVersion: boolean = true @Input() @@ -47,6 +44,7 @@ export class EmailDocumentDropdownComponent extends LoadingComponentWithPermissi } constructor( + private activeModal: NgbActiveModal, private documentService: DocumentService, private toastService: ToastService, private settingsService: SettingsService @@ -79,4 +77,8 @@ export class EmailDocumentDropdownComponent extends LoadingComponentWithPermissi }, }) } + + public close() { + this.activeModal.close() + } } diff --git a/src-ui/src/app/components/common/email-document-dropdown/email-document-dropdown.component.html b/src-ui/src/app/components/common/email-document-dropdown/email-document-dropdown.component.html deleted file mode 100644 index e22ade106..000000000 --- a/src-ui/src/app/components/common/email-document-dropdown/email-document-dropdown.component.html +++ /dev/null @@ -1,32 +0,0 @@ -
- - -
diff --git a/src-ui/src/app/components/common/email-document-dropdown/email-document-dropdown.component.scss b/src-ui/src/app/components/common/email-document-dropdown/email-document-dropdown.component.scss deleted file mode 100644 index f6e9b1263..000000000 --- a/src-ui/src/app/components/common/email-document-dropdown/email-document-dropdown.component.scss +++ /dev/null @@ -1,3 +0,0 @@ -.email-document-dropdown { - min-width: 350px; -} diff --git a/src-ui/src/app/components/common/share-links-dialog/share-links-dialog.component.html b/src-ui/src/app/components/common/share-links-dialog/share-links-dialog.component.html new file mode 100644 index 000000000..fe3f9b9c3 --- /dev/null +++ b/src-ui/src/app/components/common/share-links-dialog/share-links-dialog.component.html @@ -0,0 +1,68 @@ + + + diff --git a/src-ui/src/app/components/common/share-links-dialog/share-links-dialog.component.scss b/src-ui/src/app/components/common/share-links-dialog/share-links-dialog.component.scss new file mode 100644 index 000000000..df5024ecd --- /dev/null +++ b/src-ui/src/app/components/common/share-links-dialog/share-links-dialog.component.scss @@ -0,0 +1,3 @@ +.copied-badge { + right: 15em; +} diff --git a/src-ui/src/app/components/common/share-links-dropdown/share-links-dropdown.component.spec.ts b/src-ui/src/app/components/common/share-links-dialog/share-links-dialog.component.spec.ts similarity index 92% rename from src-ui/src/app/components/common/share-links-dropdown/share-links-dropdown.component.spec.ts rename to src-ui/src/app/components/common/share-links-dialog/share-links-dialog.component.spec.ts index b7b0305be..3f60b6733 100644 --- a/src-ui/src/app/components/common/share-links-dropdown/share-links-dropdown.component.spec.ts +++ b/src-ui/src/app/components/common/share-links-dialog/share-links-dialog.component.spec.ts @@ -11,17 +11,18 @@ import { tick, } from '@angular/core/testing' import { By } from '@angular/platform-browser' +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap' import { NgxBootstrapIconsModule, allIcons } from 'ngx-bootstrap-icons' import { of, throwError } from 'rxjs' import { FileVersion, ShareLink } from 'src/app/data/share-link' import { ShareLinkService } from 'src/app/services/rest/share-link.service' import { ToastService } from 'src/app/services/toast.service' import { environment } from 'src/environments/environment' -import { ShareLinksDropdownComponent } from './share-links-dropdown.component' +import { ShareLinksDialogComponent } from './share-links-dialog.component' -describe('ShareLinksDropdownComponent', () => { - let component: ShareLinksDropdownComponent - let fixture: ComponentFixture +describe('ShareLinksDialogComponent', () => { + let component: ShareLinksDialogComponent + let fixture: ComponentFixture let shareLinkService: ShareLinkService let toastService: ToastService let httpController: HttpTestingController @@ -30,16 +31,17 @@ describe('ShareLinksDropdownComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ imports: [ - ShareLinksDropdownComponent, + ShareLinksDialogComponent, NgxBootstrapIconsModule.pick(allIcons), ], providers: [ provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting(), + NgbActiveModal, ], }) - fixture = TestBed.createComponent(ShareLinksDropdownComponent) + fixture = TestBed.createComponent(ShareLinksDialogComponent) shareLinkService = TestBed.inject(ShareLinkService) toastService = TestBed.inject(ToastService) httpController = TestBed.inject(HttpTestingController) @@ -232,4 +234,11 @@ describe('ShareLinksDropdownComponent', () => { ] ).toBeTruthy() }) + + it('should support close', () => { + const activeModal = TestBed.inject(NgbActiveModal) + const closeSpy = jest.spyOn(activeModal, 'close') + component.close() + expect(closeSpy).toHaveBeenCalled() + }) }) diff --git a/src-ui/src/app/components/common/share-links-dropdown/share-links-dropdown.component.ts b/src-ui/src/app/components/common/share-links-dialog/share-links-dialog.component.ts similarity index 90% rename from src-ui/src/app/components/common/share-links-dropdown/share-links-dropdown.component.ts rename to src-ui/src/app/components/common/share-links-dialog/share-links-dialog.component.ts index 5e65eed73..19123f73e 100644 --- a/src-ui/src/app/components/common/share-links-dropdown/share-links-dropdown.component.ts +++ b/src-ui/src/app/components/common/share-links-dialog/share-links-dialog.component.ts @@ -1,7 +1,7 @@ import { Clipboard } from '@angular/cdk/clipboard' import { Component, Input, OnInit } from '@angular/core' import { FormsModule, ReactiveFormsModule } from '@angular/forms' -import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap' +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap' import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons' import { first } from 'rxjs' import { FileVersion, ShareLink } from 'src/app/data/share-link' @@ -10,17 +10,12 @@ import { ToastService } from 'src/app/services/toast.service' import { environment } from 'src/environments/environment' @Component({ - selector: 'pngx-share-links-dropdown', - templateUrl: './share-links-dropdown.component.html', - styleUrls: ['./share-links-dropdown.component.scss'], - imports: [ - FormsModule, - ReactiveFormsModule, - NgbDropdownModule, - NgxBootstrapIconsModule, - ], + selector: 'pngx-share-links-dialog', + templateUrl: './share-links-dialog.component.html', + styleUrls: ['./share-links-dialog.component.scss'], + imports: [FormsModule, ReactiveFormsModule, NgxBootstrapIconsModule], }) -export class ShareLinksDropdownComponent implements OnInit { +export class ShareLinksDialogComponent implements OnInit { EXPIRATION_OPTIONS = [ { label: $localize`1 day`, value: 1 }, { label: $localize`7 days`, value: 7 }, @@ -41,9 +36,6 @@ export class ShareLinksDropdownComponent implements OnInit { } } - @Input() - disabled: boolean = false - private _hasArchiveVersion: boolean = true @Input() @@ -67,6 +59,7 @@ export class ShareLinksDropdownComponent implements OnInit { useArchiveVersion: boolean = true constructor( + private activeModal: NgbActiveModal, private shareLinkService: ShareLinkService, private toastService: ToastService, private clipboard: Clipboard @@ -169,4 +162,8 @@ export class ShareLinksDropdownComponent implements OnInit { }, }) } + + close() { + this.activeModal.close() + } } diff --git a/src-ui/src/app/components/common/share-links-dropdown/share-links-dropdown.component.html b/src-ui/src/app/components/common/share-links-dropdown/share-links-dropdown.component.html deleted file mode 100644 index 08298abc7..000000000 --- a/src-ui/src/app/components/common/share-links-dropdown/share-links-dropdown.component.html +++ /dev/null @@ -1,70 +0,0 @@ -
- - -
diff --git a/src-ui/src/app/components/common/share-links-dropdown/share-links-dropdown.component.scss b/src-ui/src/app/components/common/share-links-dropdown/share-links-dropdown.component.scss deleted file mode 100644 index 47e19d871..000000000 --- a/src-ui/src/app/components/common/share-links-dropdown/share-links-dropdown.component.scss +++ /dev/null @@ -1,14 +0,0 @@ -.share-links-dropdown { - min-width: 350px; - - // correct position on mobile - @media (max-width: 575.98px) { - &.show { - margin-left: -175px !important; - } - } -} - -.copied-badge { - right: 7.5em; -} diff --git a/src-ui/src/app/components/document-detail/document-detail.component.html b/src-ui/src/app/components/document-detail/document-detail.component.html index 9931b491c..399419314 100644 --- a/src-ui/src/app/components/document-detail/document-detail.component.html +++ b/src-ui/src/app/components/document-detail/document-detail.component.html @@ -81,9 +81,21 @@ (added)="addField($event)"> - - +
+ +
+ + +
+
diff --git a/src-ui/src/app/components/document-detail/document-detail.component.spec.ts b/src-ui/src/app/components/document-detail/document-detail.component.spec.ts index 349e213aa..d9e74f881 100644 --- a/src-ui/src/app/components/document-detail/document-detail.component.spec.ts +++ b/src-ui/src/app/components/document-detail/document-detail.component.spec.ts @@ -1330,4 +1330,13 @@ describe('DocumentDetailComponent', () => { expect(createSpy).toHaveBeenCalledWith('a') expect(urlRevokeSpy).toHaveBeenCalled() }) + + it('should support open share links and email modals', () => { + const modalSpy = jest.spyOn(modalService, 'open') + initNormally() + component.openShareLinks() + expect(modalSpy).toHaveBeenCalled() + component.openEmailDocument() + expect(modalSpy).toHaveBeenCalled() + }) }) diff --git a/src-ui/src/app/components/document-detail/document-detail.component.ts b/src-ui/src/app/components/document-detail/document-detail.component.ts index 8a0b9a45c..ae09ed359 100644 --- a/src-ui/src/app/components/document-detail/document-detail.component.ts +++ b/src-ui/src/app/components/document-detail/document-detail.component.ts @@ -88,7 +88,7 @@ import { CorrespondentEditDialogComponent } from '../common/edit-dialog/correspo import { DocumentTypeEditDialogComponent } from '../common/edit-dialog/document-type-edit-dialog/document-type-edit-dialog.component' import { EditDialogMode } from '../common/edit-dialog/edit-dialog.component' import { StoragePathEditDialogComponent } from '../common/edit-dialog/storage-path-edit-dialog/storage-path-edit-dialog.component' -import { EmailDocumentDropdownComponent } from '../common/email-document-dropdown/email-document-dropdown.component' +import { EmailDocumentDialogComponent } from '../common/email-document-dialog/email-document-dialog.component' import { CheckComponent } from '../common/input/check/check.component' import { DateComponent } from '../common/input/date/date.component' import { DocumentLinkComponent } from '../common/input/document-link/document-link.component' @@ -100,7 +100,7 @@ import { TagsComponent } from '../common/input/tags/tags.component' import { TextComponent } from '../common/input/text/text.component' import { UrlComponent } from '../common/input/url/url.component' import { PageHeaderComponent } from '../common/page-header/page-header.component' -import { ShareLinksDropdownComponent } from '../common/share-links-dropdown/share-links-dropdown.component' +import { ShareLinksDialogComponent } from '../common/share-links-dialog/share-links-dialog.component' import { DocumentHistoryComponent } from '../document-history/document-history.component' import { DocumentNotesComponent } from '../document-notes/document-notes.component' import { ComponentWithPermissions } from '../with-permissions/with-permissions.component' @@ -146,8 +146,6 @@ export enum ZoomSetting { CustomFieldsDropdownComponent, DocumentNotesComponent, DocumentHistoryComponent, - ShareLinksDropdownComponent, - EmailDocumentDropdownComponent, CheckComponent, DateComponent, DocumentLinkComponent, @@ -1428,6 +1426,22 @@ export class DocumentDetailComponent }) } + public openShareLinks() { + const modal = this.modalService.open(ShareLinksDialogComponent) + modal.componentInstance.documentId = this.document.id + modal.componentInstance.hasArchiveVersion = + !!this.document?.archived_file_name + } + + public openEmailDocument() { + const modal = this.modalService.open(EmailDocumentDialogComponent, { + backdrop: 'static', + }) + modal.componentInstance.documentId = this.document.id + modal.componentInstance.hasArchiveVersion = + !!this.document?.archived_file_name + } + private tryRenderTiff() { this.http.get(this.previewUrl, { responseType: 'arraybuffer' }).subscribe({ next: (res) => { diff --git a/src-ui/src/main.ts b/src-ui/src/main.ts index a9d446891..dd31a6b1e 100644 --- a/src-ui/src/main.ts +++ b/src-ui/src/main.ts @@ -112,6 +112,7 @@ import { questionCircle, scissors, search, + send, slashCircle, sliders2Vertical, sortAlphaDown, @@ -316,6 +317,7 @@ const icons = { questionCircle, scissors, search, + send, slashCircle, sliders2Vertical, sortAlphaDown,