File tree Expand file tree Collapse file tree 6 files changed +46
-9
lines changed
frontend/src/angular/src/app Expand file tree Collapse file tree 6 files changed +46
-9
lines changed Original file line number Diff line number Diff line change 11< h1 mat-dialog-title i18n ="@@docimportImportFile "> Import file</ h1 >
22< div mat-dialog-content >
3- < p i18n ="@@docimportFileToImport "> File to import</ p >
3+ < div i18n ="@@docimportFileToImport "> File to import</ div >
44 @if(uploading) {
55 < div class ="upload-spinner "> < mat-spinner > </ mat-spinner > </ div >
66 } @else {
7+ <!--
78 <input type="file" (change)="onFileInputChange($event)" />
9+ -->
10+ < input type ="file " class ="file-input "
11+ (change) ="onFileInputChange($event) " #fileUpload >
12+ < div class ="file-upload ">
13+
14+ {{file?.name || "No file uploaded yet."}}
15+
16+ < button mat-mini-fab color ="primary " class ="upload-btn "
17+ (click) ="fileUpload.click() ">
18+ < mat-icon > attach_file</ mat-icon >
19+ </ button >
20+ </ div >
821 } @if(!!file) {
922 < div >
1023 < ul >
Original file line number Diff line number Diff line change 1515 width : 100% ;
1616 justify-content : center ;
1717}
18+
19+ .file-input {
20+ display : none ;
21+ }
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import { MatFormFieldModule } from '@angular/material/form-field';
2222import { MatButtonModule } from '@angular/material/button' ;
2323import { FormsModule } from '@angular/forms' ;
2424import { MatInputModule } from '@angular/material/input' ;
25+ import { MatIconModule } from '@angular/material/icon' ;
2526import { DocumentService } from '../service/document.service' ;
2627import { tap } from 'rxjs' ;
2728import { takeUntilDestroyed } from '@angular/core/rxjs-interop' ;
@@ -36,6 +37,7 @@ export interface DocImportData {}
3637 MatDialogModule ,
3738 MatButtonModule ,
3839 MatInputModule ,
40+ MatIconModule ,
3941 FormsModule ,
4042 MatProgressSpinnerModule ,
4143 ] ,
Original file line number Diff line number Diff line change 6464 < div > < img [src] ="result.b64Image " /> </ div >
6565 < div > {{ result.answer }}</ div >
6666 </ div >
67- } @else {
68- < input
69- type ="file "
70- class ="vertical-margin "
71- (change) ="onFileInputChange($event) "
72- />
67+ } @else {
68+ < div >
69+ < input type ="file " class ="file-input "
70+ (change) ="onFileInputChange($event) " #fileUpload >
71+ < div class ="file-upload ">
72+
73+ {{this.imageForm.controls['file'].value?.name || "No file uploaded yet."}}
74+
75+ < button mat-mini-fab color ="primary " class ="upload-btn "
76+ (click) ="fileUpload.click() ">
77+ < mat-icon > attach_file</ mat-icon >
78+ </ button >
79+ </ div >
80+ </ div >
7381 < mat-form-field class ="example-full-width ">
7482 < mat-label i18n ="@@imageQueryPrompt "> Image prompt</ mat-label >
7583 < input
Original file line number Diff line number Diff line change 4040 width : 100% ;
4141}
4242
43+ .file-upload {
44+ margin : 10px ;
45+ }
46+
47+ .file-input {
48+ display : none ;
49+ }
50+
4351.upload-spinner {
4452 display : flex ;
4553 width : 100% ;
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ import {
2626 ReactiveFormsModule ,
2727} from '@angular/forms' ;
2828import { Router } from '@angular/router' ;
29+ import { MatIconModule } from '@angular/material/icon' ;
2930import { MatToolbarModule } from '@angular/material/toolbar' ;
3031
3132@Component ( {
@@ -35,6 +36,7 @@ import { MatToolbarModule } from '@angular/material/toolbar';
3536 MatProgressSpinnerModule ,
3637 MatInputModule ,
3738 MatButtonModule ,
39+ MatIconModule ,
3840 ReactiveFormsModule ,
3941 MatToolbarModule ,
4042 ] ,
@@ -67,8 +69,8 @@ export class ImageQueryComponent {
6769 private router : Router
6870 ) { }
6971
70- protected onFileInputChange ( $event : Event ) : void {
71- this . result = null ;
72+ protected onFileInputChange ( $event : Event ) : void {
73+ this . result = null ;
7274 const files = ! $event . target
7375 ? null
7476 : ( $event . target as HTMLInputElement ) . files ;
You can’t perform that action at this time.
0 commit comments