@@ -20,9 +20,11 @@ const selector: Ref<Selector | null> = ref(null);
20
20
const showIncr = ref (true );
21
21
const showDelta = ref (true );
22
22
23
+ type SortDirection = " asc" | " desc" ;
24
+
23
25
// Client-side sorting state
24
26
const currentSortColumn = ref <string >(" timeSeconds" );
25
- const currentSortDirection = ref <" asc " | " desc " >(" desc" );
27
+ const currentSortDirection = ref <SortDirection >(" desc" );
26
28
27
29
// Computed properties for UI data
28
30
const titleData = computed (() => createTitleData (selector .value ));
@@ -223,14 +225,14 @@ function populateUIData(responseData: SelfProfileResponse, state: Selector) {
223
225
}
224
226
}
225
227
226
- function sortTable(columnName : string , defaultDirection : number ) {
228
+ function sortTable(columnName : string , defaultDirection : SortDirection ) {
227
229
// Toggle direction if clicking the same column, otherwise use default direction
228
230
if (currentSortColumn .value === columnName ) {
229
231
currentSortDirection .value =
230
232
currentSortDirection .value === " asc" ? " desc" : " asc" ;
231
233
} else {
232
234
currentSortColumn .value = columnName ;
233
- currentSortDirection .value = defaultDirection === 1 ? " asc " : " desc " ;
235
+ currentSortDirection .value = defaultDirection ;
234
236
}
235
237
236
238
// Update URL with new sort state
@@ -401,6 +403,7 @@ loadData();
401
403
data-default-sort-dir =" 1"
402
404
>
403
405
<a href =" #" @click.prevent =" sortTable('label', 1)"
406
+ <a href =" #" @click.prevent =" sortTable('label', 'asc')"
404
407
>Query/Function</a
405
408
>
406
409
</th >
@@ -409,7 +412,7 @@ loadData();
409
412
data-sort-column =" timePercent"
410
413
data-default-sort-dir =" -1"
411
414
>
412
- <a href =" #" @click.prevent =" sortTable('timePercent', -1 )"
415
+ <a href =" #" @click.prevent =" sortTable('timePercent', 'desc' )"
413
416
>Time (%)</a
414
417
>
415
418
</th >
@@ -418,7 +421,7 @@ loadData();
418
421
data-sort-column =" timeSeconds"
419
422
data-default-sort-dir =" -1"
420
423
>
421
- <a href =" #" @click.prevent =" sortTable('timeSeconds', -1 )"
424
+ <a href =" #" @click.prevent =" sortTable('timeSeconds', 'desc' )"
422
425
>Time (s)</a
423
426
>
424
427
</th >
@@ -428,7 +431,7 @@ loadData();
428
431
data-sort-column =" timeDelta"
429
432
data-default-sort-dir =" -1"
430
433
>
431
- <a href =" #" @click.prevent =" sortTable('timeDelta', -1 )"
434
+ <a href =" #" @click.prevent =" sortTable('timeDelta', 'desc' )"
432
435
>Time delta</a
433
436
>
434
437
</th >
@@ -437,7 +440,7 @@ loadData();
437
440
data-sort-column =" executions"
438
441
data-default-sort-dir =" -1"
439
442
>
440
- <a href =" #" @click.prevent =" sortTable('executions', -1 )"
443
+ <a href =" #" @click.prevent =" sortTable('executions', 'desc' )"
441
444
>Executions</a
442
445
>
443
446
</th >
@@ -447,7 +450,7 @@ loadData();
447
450
data-sort-column =" executionsDelta"
448
451
data-default-sort-dir =" -1"
449
452
>
450
- <a href =" #" @click.prevent =" sortTable('executionsDelta', -1 )"
453
+ <a href =" #" @click.prevent =" sortTable('executionsDelta', 'desc' )"
451
454
>Executions delta</a
452
455
>
453
456
</th >
@@ -458,7 +461,9 @@ loadData();
458
461
data-default-sort-dir =" -1"
459
462
title =" Incremental loading time"
460
463
>
461
- <a href =" #" @click.prevent =" sortTable('incrementalLoading', -1)"
464
+ <a
465
+ href =" #"
466
+ @click.prevent =" sortTable('incrementalLoading', 'desc')"
462
467
>Incremental loading (s)</a
463
468
>
464
469
</th >
@@ -470,7 +475,7 @@ loadData();
470
475
>
471
476
<a
472
477
href =" #"
473
- @click.prevent =" sortTable('incrementalLoadingDelta', -1 )"
478
+ @click.prevent =" sortTable('incrementalLoadingDelta', 'desc' )"
474
479
>Incremental loading delta</a
475
480
>
476
481
</th >
0 commit comments