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 1
1
< h1 mat-dialog-title i18n ="@@docimportImportFile "> Import file</ h1 >
2
2
< div mat-dialog-content >
3
- < p i18n ="@@docimportFileToImport "> File to import</ p >
3
+ < div i18n ="@@docimportFileToImport "> File to import</ div >
4
4
@if(uploading) {
5
5
< div class ="upload-spinner "> < mat-spinner > </ mat-spinner > </ div >
6
6
} @else {
7
+ <!--
7
8
<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 >
8
21
} @if(!!file) {
9
22
< div >
10
23
< ul >
Original file line number Diff line number Diff line change 15
15
width : 100% ;
16
16
justify-content : center ;
17
17
}
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';
22
22
import { MatButtonModule } from '@angular/material/button' ;
23
23
import { FormsModule } from '@angular/forms' ;
24
24
import { MatInputModule } from '@angular/material/input' ;
25
+ import { MatIconModule } from '@angular/material/icon' ;
25
26
import { DocumentService } from '../service/document.service' ;
26
27
import { tap } from 'rxjs' ;
27
28
import { takeUntilDestroyed } from '@angular/core/rxjs-interop' ;
@@ -36,6 +37,7 @@ export interface DocImportData {}
36
37
MatDialogModule ,
37
38
MatButtonModule ,
38
39
MatInputModule ,
40
+ MatIconModule ,
39
41
FormsModule ,
40
42
MatProgressSpinnerModule ,
41
43
] ,
Original file line number Diff line number Diff line change 64
64
< div > < img [src] ="result.b64Image " /> </ div >
65
65
< div > {{ result.answer }}</ div >
66
66
</ 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 >
73
81
< mat-form-field class ="example-full-width ">
74
82
< mat-label i18n ="@@imageQueryPrompt "> Image prompt</ mat-label >
75
83
< input
Original file line number Diff line number Diff line change 40
40
width : 100% ;
41
41
}
42
42
43
+ .file-upload {
44
+ margin : 10px ;
45
+ }
46
+
47
+ .file-input {
48
+ display : none ;
49
+ }
50
+
43
51
.upload-spinner {
44
52
display : flex ;
45
53
width : 100% ;
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ import {
26
26
ReactiveFormsModule ,
27
27
} from '@angular/forms' ;
28
28
import { Router } from '@angular/router' ;
29
+ import { MatIconModule } from '@angular/material/icon' ;
29
30
import { MatToolbarModule } from '@angular/material/toolbar' ;
30
31
31
32
@Component ( {
@@ -35,6 +36,7 @@ import { MatToolbarModule } from '@angular/material/toolbar';
35
36
MatProgressSpinnerModule ,
36
37
MatInputModule ,
37
38
MatButtonModule ,
39
+ MatIconModule ,
38
40
ReactiveFormsModule ,
39
41
MatToolbarModule ,
40
42
] ,
@@ -67,8 +69,8 @@ export class ImageQueryComponent {
67
69
private router : Router
68
70
) { }
69
71
70
- protected onFileInputChange ( $event : Event ) : void {
71
- this . result = null ;
72
+ protected onFileInputChange ( $event : Event ) : void {
73
+ this . result = null ;
72
74
const files = ! $event . target
73
75
? null
74
76
: ( $event . target as HTMLInputElement ) . files ;
You can’t perform that action at this time.
0 commit comments