From ed512d74af281a23cb6b261e2d434864f87fd723 Mon Sep 17 00:00:00 2001 From: Angular2guy Date: Wed, 22 Nov 2023 17:16:40 +0100 Subject: [PATCH] feat: open docs in table --- .../src/angular/src/app/doc-list/doc-list.component.html | 2 +- .../src/angular/src/app/doc-list/doc-list.component.scss | 4 ++++ .../src/angular/src/app/doc-list/doc-list.component.ts | 8 ++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/frontend/src/angular/src/app/doc-list/doc-list.component.html b/frontend/src/angular/src/app/doc-list/doc-list.component.html index 567f7a6..8991b24 100644 --- a/frontend/src/angular/src/app/doc-list/doc-list.component.html +++ b/frontend/src/angular/src/app/doc-list/doc-list.component.html @@ -33,5 +33,5 @@ {{element.documentType}} - + \ No newline at end of file diff --git a/frontend/src/angular/src/app/doc-list/doc-list.component.scss b/frontend/src/angular/src/app/doc-list/doc-list.component.scss index c0da93a..9012b51 100644 --- a/frontend/src/angular/src/app/doc-list/doc-list.component.scss +++ b/frontend/src/angular/src/app/doc-list/doc-list.component.scss @@ -35,6 +35,10 @@ width: 100%; } +.table-row { + cursor: pointer; +} + @media (max-width: 900px), (max-height: 480px) { .custom-toolbar { height: fit-content; diff --git a/frontend/src/angular/src/app/doc-list/doc-list.component.ts b/frontend/src/angular/src/app/doc-list/doc-list.component.ts index 60a98fa..7ecd898 100644 --- a/frontend/src/angular/src/app/doc-list/doc-list.component.ts +++ b/frontend/src/angular/src/app/doc-list/doc-list.component.ts @@ -34,6 +34,7 @@ export class DocListComponent implements OnInit { protected displayedColumns: string[] = ['documentId', 'documentName', 'documentType']; protected documents: DocumentFile[] = []; private destroyRef = inject(DestroyRef); + private tabRef: Window | null = null; constructor(private dialog: MatDialog, private documentService: DocumentService, private router: Router) { } @@ -49,6 +50,13 @@ export class DocListComponent implements OnInit { this.router.navigate(['/docsearch']); } + protected showDocument(documentId: number): void { + if(!!this.tabRef) { + this.tabRef.close(); + } + this.tabRef = window.open(`/rest/document/content/${documentId}`, '_blank'); + } + protected import(): void { const dialogRef = this.dialog.open(DocImportComponent, {data: {} as DocImportData}); dialogRef.afterClosed().subscribe(result => this.updateDocuments());