/
table-search.component.html
85 lines (84 loc) · 2.33 KB
/
table-search.component.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<mat-toolbar color="primary" class="custom-toolbar">
<div class="toolbar-content">
<div i18n="@@tableSearchHeading">Table Search</div>
<div class="example-fill-remaining-space"></div>
<div class="import-container">
@if(importing) {
<mat-spinner color="accent" diameter="30"></mat-spinner>
}
<button
mat-flat-button
i18n-matTooltip
matTooltip="A new DB instance needs a data import first."
i18n-matTooltip="@@tableSearchDataImport"
color="primary"
(click)="importData()"
i18n="@@tableSearchImportData"
>
Import Data
</button>
</div>
<div>
<button
mat-flat-button
color="primary"
(click)="showList()"
i18n="@@list"
>
List
</button>
</div>
<div>
<button
mat-flat-button
color="primary"
(click)="logout()"
i18n="@@logout"
>
Logout
</button>
</div>
</div>
</mat-toolbar>
<div class="search-bar">
<mat-form-field class="example-full-width">
<mat-label i18n="@@search">Search</mat-label>
<textarea matInput [formControl]="searchValueControl"></textarea>
</mat-form-field>
<div class="search-button-box">
<button
mat-flat-button
color="primary"
class="search-button"
(click)="search()"
[disabled]="searchValueControl.invalid"
i18n="@@search"
>
Search
</button>
</div>
</div>
@if(searching) {
<div class="spinner-container">
<div class="spinner-box">
<mat-spinner></mat-spinner>
<div i18n="@@searchWorking">The AI is working on the answer.</div>
<div i18n="@@searchBePatient">
Please be patient. {{ msWorking / 1000 | number : "1.3" }} sec.
</div>
</div>
</div>
} @if(requestFailed) {
<h2 class="error-msg" i18n="@@searchRequestFailed">
Ai Request Failed. Please try again.
</h2>
} @if(searchResult && searchResult.resultList?.length) {
<table mat-table [dataSource]="columnData">
<ng-container *ngFor="let disCol of columnNames" matColumnDef="{{ disCol }}">
<th mat-header-cell *matHeaderCellDef>{{ disCol }}</th>
<td mat-cell *matCellDef="let element">{{ element.get(disCol) }}</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="columnNames"></tr>
<tr mat-row *matRowDef="let row; columns: columnNames"></tr>
</table>
}