1<!-- Copyright (C) 2018 The Android Open Source Project
2
3     Licensed under the Apache License, Version 2.0 (the "License");
4     you may not use this file except in compliance with the License.
5     You may obtain a copy of the License at
6
7          http://www.apache.org/licenses/LICENSE-2.0
8
9     Unless required by applicable law or agreed to in writing, software
10     distributed under the License is distributed on an "AS IS" BASIS,
11     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12     See the License for the specific language governing permissions and
13     limitations under the License.
14-->
15<div class="statistics-table" [ngStyle]="{'opacity': (loading) ? 0.2 : 1 }">
16  <mat-table [dataSource]="statDataSource">
17    <ng-container matColumnDef="hours">
18      <mat-header-cell *matHeaderCellDef>Stats</mat-header-cell>
19      <mat-cell *matCellDef="let stat"> {{stat.hours}} </mat-cell>
20    </ng-container>
21
22    <ng-container matColumnDef="created">
23      <mat-header-cell *matHeaderCellDef>Created</mat-header-cell>
24      <mat-cell *matCellDef="let stat"> {{stat.created}} </mat-cell>
25    </ng-container>
26
27    <ng-container matColumnDef="completed">
28      <mat-header-cell *matHeaderCellDef>Completed</mat-header-cell>
29      <mat-cell *matCellDef="let stat"> {{stat.completed}} ({{stat.created > 0 ? (stat.completed/stat.created*100 | number:'1.0-2') : 0}})% </mat-cell>
30    </ng-container>
31
32    <ng-container matColumnDef="running">
33      <mat-header-cell *matHeaderCellDef>Running/Ready</mat-header-cell>
34      <mat-cell *matCellDef="let stat"> {{stat.running}} ({{stat.created > 0 ? (stat.running/stat.created*100 | number:'1.0-2') : 0}})% </mat-cell>
35    </ng-container>
36
37    <ng-container matColumnDef="bootup_err">
38      <mat-header-cell *matHeaderCellDef>Boot-up Error</mat-header-cell>
39      <mat-cell *matCellDef="let stat"> {{stat.bootup_err}} ({{stat.created > 0 ? (stat.bootup_err/stat.created*100 | number:'1.0-2') : 0}})% </mat-cell>
40    </ng-container>
41
42    <ng-container matColumnDef="infra_err">
43      <mat-header-cell *matHeaderCellDef>Infra Error</mat-header-cell>
44      <mat-cell *matCellDef="let stat"> {{stat.infra_err}} ({{stat.created > 0 ? (stat.infra_err/stat.created*100 | number:'1.0-2') : 0}})% </mat-cell>
45    </ng-container>
46
47    <ng-container matColumnDef="expired">
48      <mat-header-cell *matHeaderCellDef>Expired</mat-header-cell>
49      <mat-cell *matCellDef="let stat"> {{stat.expired}} ({{stat.created > 0 ? (stat.expired/stat.created*100 | number:'1.0-2') : 0}})% </mat-cell>
50    </ng-container>
51
52    <mat-header-row *matHeaderRowDef="statColumnTitles"></mat-header-row>
53    <mat-row *matRowDef="let row; columns: statColumnTitles;"></mat-row>
54  </mat-table>
55</div>
56<div class="entity-filter">
57  <app-filter (applyFilters)="applyFilters($event)" [disabled]="loading"></app-filter>
58</div>
59<div class="mat-elevation-z2 entity-table" [ngStyle]="{'opacity': (loading) ? 0.2 : 1 }">
60  <mat-table [dataSource]="dataSource" matSort matSortActive="timestamp" matSortDirection="desc">
61  <!-- Index Column -->
62    <ng-container matColumnDef="_index">
63      <mat-header-cell *matHeaderCellDef>No.</mat-header-cell>
64      <mat-cell *matCellDef="let i = index"> {{i+1+pageSize*pageIndex}} </mat-cell>
65    </ng-container>
66
67    <!-- Test Type Column -->
68    <ng-container matColumnDef="test_type">
69      <mat-header-cell *matHeaderCellDef>Test Type</mat-header-cell>
70      <mat-cell *matCellDef="let job"> {{getTestTypeText(job.test_type)}} </mat-cell>
71    </ng-container>
72
73    <!-- Test Name Column -->
74    <ng-container matColumnDef="test_name">
75      <mat-header-cell *matHeaderCellDef>Test Name</mat-header-cell>
76      <mat-cell *matCellDef="let job"> {{job.test_name}} </mat-cell>
77    </ng-container>
78
79    <!-- Host Name Column -->
80    <ng-container matColumnDef="hostname">
81      <mat-header-cell *matHeaderCellDef>Hostname</mat-header-cell>
82      <mat-cell *matCellDef="let job"> {{job.hostname}} </mat-cell>
83    </ng-container>
84
85    <!-- Device Column -->
86    <ng-container matColumnDef="device">
87      <mat-header-cell *matHeaderCellDef>Device</mat-header-cell>
88      <mat-cell *matCellDef="let job"> {{job.device}} </mat-cell>
89    </ng-container>
90
91    <!-- Serial Column -->
92    <ng-container matColumnDef="serial">
93      <mat-header-cell *matHeaderCellDef>Serial</mat-header-cell>
94      <mat-cell *matCellDef="let job"> {{job.serial ? job.serial.join('\n') : ""}} </mat-cell>
95    </ng-container>
96
97    <!-- Device Branch Column -->
98    <ng-container matColumnDef="manifest_branch">
99      <mat-header-cell *matHeaderCellDef>Device Branch</mat-header-cell>
100      <mat-cell *matCellDef="let job"> {{job.manifest_branch}} </mat-cell>
101    </ng-container>
102
103    <!-- Device Build Target Column -->
104    <ng-container matColumnDef="build_target">
105      <mat-header-cell *matHeaderCellDef>Device Build Target</mat-header-cell>
106      <mat-cell *matCellDef="let job"> {{job.build_target}} </mat-cell>
107    </ng-container>
108
109    <!-- Device Build ID Column -->
110    <ng-container matColumnDef="build_id">
111      <mat-header-cell *matHeaderCellDef>Device Build ID</mat-header-cell>
112      <mat-cell *matCellDef="let job"> {{job.build_id}} </mat-cell>
113    </ng-container>
114
115    <!-- GSI Branch Column -->
116    <ng-container matColumnDef="gsi_branch">
117      <mat-header-cell *matHeaderCellDef>GSI Branch</mat-header-cell>
118      <mat-cell *matCellDef="let job"> {{job.gsi_branch}} </mat-cell>
119    </ng-container>
120
121    <!-- GSI Build Target Column -->
122    <ng-container matColumnDef="gsi_build_target">
123      <mat-header-cell *matHeaderCellDef>GSI Build Target</mat-header-cell>
124      <mat-cell *matCellDef="let job"> {{job.gsi_build_target}} </mat-cell>
125    </ng-container>
126
127    <!-- Device Build ID Column -->
128    <ng-container matColumnDef="gsi_build_id">
129      <mat-header-cell *matHeaderCellDef>GSI Build ID</mat-header-cell>
130      <mat-cell *matCellDef="let job"> {{job.gsi_build_id}} </mat-cell>
131    </ng-container>
132
133    <!-- Test Branch Column -->
134    <ng-container matColumnDef="test_branch">
135      <mat-header-cell *matHeaderCellDef>Test Branch</mat-header-cell>
136      <mat-cell *matCellDef="let job"> {{job.test_branch}} </mat-cell>
137    </ng-container>
138
139    <!-- Test Build Target Column -->
140    <ng-container matColumnDef="test_build_target">
141      <mat-header-cell *matHeaderCellDef>Test Build Target</mat-header-cell>
142      <mat-cell *matCellDef="let job"> {{job.test_build_target}} </mat-cell>
143    </ng-container>
144
145    <!-- Test Build ID Column -->
146    <ng-container matColumnDef="test_build_id">
147      <mat-header-cell *matHeaderCellDef>Test Build ID</mat-header-cell>
148      <mat-cell *matCellDef="let job"> {{job.test_build_id}} </mat-cell>
149    </ng-container>
150
151    <!-- Status Column -->
152    <ng-container matColumnDef="status">
153      <mat-header-cell *matHeaderCellDef>Status</mat-header-cell>
154      <mat-cell *matCellDef="let job"> {{jobStatusEnum[job.status]}} </mat-cell>
155    </ng-container>
156
157    <!-- Timestamp Column -->
158    <ng-container matColumnDef="timestamp">
159      <mat-header-cell *matHeaderCellDef mat-sort-header disabled>Timestamp</mat-header-cell>
160      <mat-cell *matCellDef="let job"> {{getRelativeTime(job.timestamp)}} </mat-cell>
161    </ng-container>
162
163    <!-- Heartbeat stamp Column -->
164    <ng-container matColumnDef="heartbeat_stamp">
165      <mat-header-cell *matHeaderCellDef>Heartbeat</mat-header-cell>
166      <mat-cell *matCellDef="let job"> {{getRelativeTime(job.heartbeat_stamp)}} </mat-cell>
167    </ng-container>
168
169    <mat-header-row *matHeaderRowDef="columnTitles"></mat-header-row>
170    <mat-row *matRowDef="let row; columns: columnTitles;"
171             matRipple
172             class="element-row"
173             [appCdkDetailRow]="row" [appCdkDetailRowTpl]="job_detail"></mat-row>
174  </mat-table>
175  <mat-paginator [length]="count"
176                 [pageSize]="pageSize"
177                 [pageSizeOptions]="pageSizeOptions"
178                 [pageIndex]="pageIndex"
179                 (page)="pageEvent = onPageEvent($event)">
180  </mat-paginator>
181</div>
182<ng-template #job_detail let-job>
183  <div class="mat-row div-expandable" [@detailExpand] style="overflow: hidden">
184    <a href="{{job.infra_log_url}}" download><button mat-raised-button [disabled]="(!job.infra_log_url)">Download Infra Log</button></a>
185    <button mat-raised-button (click)="onShowDetailsClicked(job)">
186      Show Details
187    </button>
188  </div>
189</ng-template>
190<div class="loading-spinner" *ngIf="loading">
191  <mat-spinner color="primary"></mat-spinner>
192</div>
193