@@ -12,6 +12,7 @@ import {
1212 createTableData ,
1313 createArtifactData ,
1414 DeltaData ,
15+ TableRowData ,
1516} from " ./utils" ;
1617
1718const loading = ref (true );
@@ -21,9 +22,10 @@ const showIncr = ref(true);
2122const showDelta = ref (true );
2223
2324type SortDirection = " asc" | " desc" ;
25+ type ColumnName = keyof TableRowData ;
2426
2527// Client-side sorting state
26- const currentSortColumn = ref <string >(" timeSeconds" );
28+ const currentSortColumn = ref <ColumnName >(" timeSeconds" );
2729const currentSortDirection = ref <SortDirection >(" desc" );
2830
2931// Computed properties for UI data
@@ -57,23 +59,22 @@ const tableData = computed(() => {
5759 aValue = a .timeSeconds ;
5860 bValue = b .timeSeconds ;
5961 // 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 );
6464 break ;
6565 case " executions" : // Executions
6666 aValue = a .executions ;
6767 bValue = b .executions ;
6868 // 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 );
7778 break ;
7879 case " incrementalLoading" : // Incremental loading (s)
7980 aValue = a .incrementalLoading ;
@@ -107,14 +108,15 @@ const tableData = computed(() => {
107108 bValue =
108109 b .executionsDelta !== null ? b .executionsDelta .delta : - Infinity ;
109110 // 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 );
118120 break ;
119121 case " incrementalLoadingDelta" : // Incremental loading delta
120122 aValue =
@@ -126,14 +128,8 @@ const tableData = computed(() => {
126128 ? b .incrementalLoadingDelta .delta
127129 : - Infinity ;
128130 // 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 );
137133 break ;
138134 default :
139135 aValue = a .label ;
@@ -173,10 +169,10 @@ function loadSortFromUrl(urlParams: Dict<string>) {
173169 const sort = urlParams [" sort" ] ?? " -timeSeconds" ; // Default to descending timeSeconds
174170 // Handle sort format: either "columnName" for asc or "-columnName" for desc
175171 if (sort .startsWith (" -" )) {
176- currentSortColumn .value = sort .substring (1 );
172+ currentSortColumn .value = sort .substring (1 ) as ColumnName ;
177173 currentSortDirection .value = " desc" ;
178174 } else {
179- currentSortColumn .value = sort ;
175+ currentSortColumn .value = sort as ColumnName ;
180176 currentSortDirection .value = " asc" ;
181177 }
182178}
@@ -223,7 +219,7 @@ function populateUIData(responseData: SelfProfileResponse, state: Selector) {
223219}
224220
225221function changeSortParameters(
226- columnName : string ,
222+ columnName : ColumnName ,
227223 defaultDirection : SortDirection
228224) {
229225 // Toggle direction if clicking the same column, otherwise use default direction
@@ -239,7 +235,7 @@ function changeSortParameters(
239235 storeSortToUrl ();
240236}
241237
242- function getHeaderClass(columnName : string ): string {
238+ function getHeaderClass(columnName : keyof TableRowData ): string {
243239 if (columnName === currentSortColumn .value ) {
244240 if (currentSortDirection .value === " asc" ) {
245241 return " header-sort-asc" ;
@@ -439,6 +435,20 @@ loadData();
439435 >Executions delta</a
440436 >
441437 </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 >
442452 <th
443453 v-if =" showIncr"
444454 :class =" getHeaderClass('incrementalLoading')"
@@ -449,7 +459,7 @@ loadData();
449459 @click.prevent ="
450460 changeSortParameters('incrementalLoading', 'desc')
451461 "
452- >Incremental loading (s)</a
462+ >Incr. loading (s)</a
453463 >
454464 </th >
455465 <th
@@ -461,7 +471,7 @@ loadData();
461471 @click.prevent ="
462472 changeSortParameters('incrementalLoadingDelta', 'desc')
463473 "
464- >Incremental loading delta</a
474+ >Incr. loading delta</a
465475 >
466476 </th >
467477 </tr >
@@ -484,6 +494,10 @@ loadData();
484494 <td v-if =" showDelta" >
485495 <DeltaComponent :delta =" row.executionsDelta" />
486496 </td >
497+ <td >{{ row.cacheHits }}</td >
498+ <td v-if =" showDelta" >
499+ <DeltaComponent :delta =" row.cacheHitsDelta" />
500+ </td >
487501 <td v-if =" showIncr" >{{ row.incrementalLoading.toFixed(3) }}</td >
488502 <td v-if =" showDelta && showIncr" >
489503 <DeltaComponent :delta =" row.incrementalLoadingDelta" />
0 commit comments