@@ -12,6 +12,7 @@ import {
12
12
createTableData ,
13
13
createArtifactData ,
14
14
DeltaData ,
15
+ TableRowData ,
15
16
} from " ./utils" ;
16
17
17
18
const loading = ref (true );
@@ -21,9 +22,10 @@ const showIncr = ref(true);
21
22
const showDelta = ref (true );
22
23
23
24
type SortDirection = " asc" | " desc" ;
25
+ type ColumnName = keyof TableRowData ;
24
26
25
27
// Client-side sorting state
26
- const currentSortColumn = ref <string >(" timeSeconds" );
28
+ const currentSortColumn = ref <ColumnName >(" timeSeconds" );
27
29
const currentSortDirection = ref <SortDirection >(" desc" );
28
30
29
31
// Computed properties for UI data
@@ -57,23 +59,22 @@ const tableData = computed(() => {
57
59
aValue = a .timeSeconds ;
58
60
bValue = b .timeSeconds ;
59
61
// Use percentage change as secondary sort for equal absolute values
60
- aSecondary =
61
- a .timeDelta !== null ? Math .abs (a .timeDelta .percentage ) : 0 ;
62
- bSecondary =
63
- b .timeDelta !== null ? Math .abs (b .timeDelta .percentage ) : 0 ;
62
+ aSecondary = Math .abs (a .timeDelta ?.percentage ?? 0 );
63
+ bSecondary = Math .abs (b .timeDelta ?.percentage ?? 0 );
64
64
break ;
65
65
case " executions" : // Executions
66
66
aValue = a .executions ;
67
67
bValue = b .executions ;
68
68
// Use percentage change as secondary sort for equal absolute values
69
- aSecondary =
70
- a .executionsDelta !== null
71
- ? Math .abs (a .executionsDelta .percentage )
72
- : 0 ;
73
- bSecondary =
74
- b .executionsDelta !== null
75
- ? Math .abs (b .executionsDelta .percentage )
76
- : 0 ;
69
+ aSecondary = Math .abs (a .executionsDelta ?.percentage ?? 0 );
70
+ bSecondary = Math .abs (b .executionsDelta ?.percentage ?? 0 );
71
+ break ;
72
+ case " cacheHits" : // Hits
73
+ aValue = a .cacheHits ;
74
+ bValue = b .cacheHits ;
75
+ // Use percentage change as secondary sort for equal absolute values
76
+ aSecondary = Math .abs (a .cacheHitsDelta ?.percentage ?? 0 );
77
+ bSecondary = Math .abs (b .cacheHitsDelta ?.percentage ?? 0 );
77
78
break ;
78
79
case " incrementalLoading" : // Incremental loading (s)
79
80
aValue = a .incrementalLoading ;
@@ -107,14 +108,15 @@ const tableData = computed(() => {
107
108
bValue =
108
109
b .executionsDelta !== null ? b .executionsDelta .delta : - Infinity ;
109
110
// Use percentage as secondary sort for equal delta values
110
- aSecondary =
111
- a .executionsDelta !== null
112
- ? Math .abs (a .executionsDelta .percentage )
113
- : 0 ;
114
- bSecondary =
115
- b .executionsDelta !== null
116
- ? Math .abs (b .executionsDelta .percentage )
117
- : 0 ;
111
+ aSecondary = Math .abs (a .executionsDelta ?.percentage ?? 0 );
112
+ bSecondary = Math .abs (b .executionsDelta ?.percentage ?? 0 );
113
+ break ;
114
+ case " cacheHitsDelta" : // Cache hits delta
115
+ aValue = a .cacheHitsDelta !== null ? a .cacheHitsDelta .delta : - Infinity ;
116
+ bValue = b .cacheHitsDelta !== null ? b .cacheHitsDelta .delta : - Infinity ;
117
+ // Use percentage as secondary sort for equal delta values
118
+ aSecondary = Math .abs (a .cacheHitsDelta ?.percentage ?? 0 );
119
+ bSecondary = Math .abs (b .cacheHitsDelta ?.percentage ?? 0 );
118
120
break ;
119
121
case " incrementalLoadingDelta" : // Incremental loading delta
120
122
aValue =
@@ -126,14 +128,8 @@ const tableData = computed(() => {
126
128
? b .incrementalLoadingDelta .delta
127
129
: - Infinity ;
128
130
// Use percentage as secondary sort for equal delta values
129
- aSecondary =
130
- a .incrementalLoadingDelta !== null
131
- ? Math .abs (a .incrementalLoadingDelta .percentage )
132
- : 0 ;
133
- bSecondary =
134
- b .incrementalLoadingDelta !== null
135
- ? Math .abs (b .incrementalLoadingDelta .percentage )
136
- : 0 ;
131
+ aSecondary = Math .abs (a .incrementalLoadingDelta ?.percentage ?? 0 );
132
+ bSecondary = Math .abs (b .incrementalLoadingDelta ?.percentage ?? 0 );
137
133
break ;
138
134
default :
139
135
aValue = a .label ;
@@ -173,10 +169,10 @@ function loadSortFromUrl(urlParams: Dict<string>) {
173
169
const sort = urlParams [" sort" ] ?? " -timeSeconds" ; // Default to descending timeSeconds
174
170
// Handle sort format: either "columnName" for asc or "-columnName" for desc
175
171
if (sort .startsWith (" -" )) {
176
- currentSortColumn .value = sort .substring (1 );
172
+ currentSortColumn .value = sort .substring (1 ) as ColumnName ;
177
173
currentSortDirection .value = " desc" ;
178
174
} else {
179
- currentSortColumn .value = sort ;
175
+ currentSortColumn .value = sort as ColumnName ;
180
176
currentSortDirection .value = " asc" ;
181
177
}
182
178
}
@@ -223,7 +219,7 @@ function populateUIData(responseData: SelfProfileResponse, state: Selector) {
223
219
}
224
220
225
221
function changeSortParameters(
226
- columnName : string ,
222
+ columnName : ColumnName ,
227
223
defaultDirection : SortDirection
228
224
) {
229
225
// Toggle direction if clicking the same column, otherwise use default direction
@@ -239,7 +235,7 @@ function changeSortParameters(
239
235
storeSortToUrl ();
240
236
}
241
237
242
- function getHeaderClass(columnName : string ): string {
238
+ function getHeaderClass(columnName : keyof TableRowData ): string {
243
239
if (columnName === currentSortColumn .value ) {
244
240
if (currentSortDirection .value === " asc" ) {
245
241
return " header-sort-asc" ;
@@ -439,6 +435,20 @@ loadData();
439
435
>Executions delta</a
440
436
>
441
437
</th >
438
+ <th :class =" getHeaderClass('cacheHits')" >
439
+ <a
440
+ href =" #"
441
+ @click.prevent =" changeSortParameters('cacheHits', 'desc')"
442
+ >Hits</a
443
+ >
444
+ </th >
445
+ <th v-if =" showDelta" :class =" getHeaderClass('cacheHitsDelta')" >
446
+ <a
447
+ href =" #"
448
+ @click.prevent =" changeSortParameters('cacheHitsDelta', 'desc')"
449
+ >Hits delta</a
450
+ >
451
+ </th >
442
452
<th
443
453
v-if =" showIncr"
444
454
:class =" getHeaderClass('incrementalLoading')"
@@ -449,7 +459,7 @@ loadData();
449
459
@click.prevent ="
450
460
changeSortParameters('incrementalLoading', 'desc')
451
461
"
452
- >Incremental loading (s)</a
462
+ >Incr. loading (s)</a
453
463
>
454
464
</th >
455
465
<th
@@ -461,7 +471,7 @@ loadData();
461
471
@click.prevent ="
462
472
changeSortParameters('incrementalLoadingDelta', 'desc')
463
473
"
464
- >Incremental loading delta</a
474
+ >Incr. loading delta</a
465
475
>
466
476
</th >
467
477
</tr >
@@ -484,6 +494,10 @@ loadData();
484
494
<td v-if =" showDelta" >
485
495
<DeltaComponent :delta =" row.executionsDelta" />
486
496
</td >
497
+ <td >{{ row.cacheHits }}</td >
498
+ <td v-if =" showDelta" >
499
+ <DeltaComponent :delta =" row.cacheHitsDelta" />
500
+ </td >
487
501
<td v-if =" showIncr" >{{ row.incrementalLoading.toFixed(3) }}</td >
488
502
<td v-if =" showDelta && showIncr" >
489
503
<DeltaComponent :delta =" row.incrementalLoadingDelta" />
0 commit comments