Skip to content

Commit

Permalink
feat: open docs in table
Browse files Browse the repository at this point in the history
  • Loading branch information
Angular2Guy committed Nov 22, 2023
1 parent 4cd5c7c commit ed512d7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@
<td mat-cell *matCellDef="let element"> {{element.documentType}} </td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
<tr mat-row class="table-row" *matRowDef="let row; columns: displayedColumns;" (click)="showDocument(row.id)"></tr>
</table>
4 changes: 4 additions & 0 deletions frontend/src/angular/src/app/doc-list/doc-list.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
width: 100%;
}

.table-row {
cursor: pointer;
}

@media (max-width: 900px), (max-height: 480px) {
.custom-toolbar {
height: fit-content;
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/angular/src/app/doc-list/doc-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) { }

Expand All @@ -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());
Expand Down

0 comments on commit ed512d7

Please sign in to comment.