Skip to content

Commit 316f88b

Browse files
committed
Cleanup sort direction
1 parent a9e86da commit 316f88b

File tree

1 file changed

+15
-10
lines changed
  • site/frontend/src/pages/detailed-query

1 file changed

+15
-10
lines changed

site/frontend/src/pages/detailed-query/page.vue

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ const selector: Ref<Selector | null> = ref(null);
2020
const showIncr = ref(true);
2121
const showDelta = ref(true);
2222
23+
type SortDirection = "asc" | "desc";
24+
2325
// Client-side sorting state
2426
const currentSortColumn = ref<string>("timeSeconds");
25-
const currentSortDirection = ref<"asc" | "desc">("desc");
27+
const currentSortDirection = ref<SortDirection>("desc");
2628
2729
// Computed properties for UI data
2830
const titleData = computed(() => createTitleData(selector.value));
@@ -223,14 +225,14 @@ function populateUIData(responseData: SelfProfileResponse, state: Selector) {
223225
}
224226
}
225227
226-
function sortTable(columnName: string, defaultDirection: number) {
228+
function sortTable(columnName: string, defaultDirection: SortDirection) {
227229
// Toggle direction if clicking the same column, otherwise use default direction
228230
if (currentSortColumn.value === columnName) {
229231
currentSortDirection.value =
230232
currentSortDirection.value === "asc" ? "desc" : "asc";
231233
} else {
232234
currentSortColumn.value = columnName;
233-
currentSortDirection.value = defaultDirection === 1 ? "asc" : "desc";
235+
currentSortDirection.value = defaultDirection;
234236
}
235237
236238
// Update URL with new sort state
@@ -401,6 +403,7 @@ loadData();
401403
data-default-sort-dir="1"
402404
>
403405
<a href="#" @click.prevent="sortTable('label', 1)"
406+
<a href="#" @click.prevent="sortTable('label', 'asc')"
404407
>Query/Function</a
405408
>
406409
</th>
@@ -409,7 +412,7 @@ loadData();
409412
data-sort-column="timePercent"
410413
data-default-sort-dir="-1"
411414
>
412-
<a href="#" @click.prevent="sortTable('timePercent', -1)"
415+
<a href="#" @click.prevent="sortTable('timePercent', 'desc')"
413416
>Time (%)</a
414417
>
415418
</th>
@@ -418,7 +421,7 @@ loadData();
418421
data-sort-column="timeSeconds"
419422
data-default-sort-dir="-1"
420423
>
421-
<a href="#" @click.prevent="sortTable('timeSeconds', -1)"
424+
<a href="#" @click.prevent="sortTable('timeSeconds', 'desc')"
422425
>Time (s)</a
423426
>
424427
</th>
@@ -428,7 +431,7 @@ loadData();
428431
data-sort-column="timeDelta"
429432
data-default-sort-dir="-1"
430433
>
431-
<a href="#" @click.prevent="sortTable('timeDelta', -1)"
434+
<a href="#" @click.prevent="sortTable('timeDelta', 'desc')"
432435
>Time delta</a
433436
>
434437
</th>
@@ -437,7 +440,7 @@ loadData();
437440
data-sort-column="executions"
438441
data-default-sort-dir="-1"
439442
>
440-
<a href="#" @click.prevent="sortTable('executions', -1)"
443+
<a href="#" @click.prevent="sortTable('executions', 'desc')"
441444
>Executions</a
442445
>
443446
</th>
@@ -447,7 +450,7 @@ loadData();
447450
data-sort-column="executionsDelta"
448451
data-default-sort-dir="-1"
449452
>
450-
<a href="#" @click.prevent="sortTable('executionsDelta', -1)"
453+
<a href="#" @click.prevent="sortTable('executionsDelta', 'desc')"
451454
>Executions delta</a
452455
>
453456
</th>
@@ -458,7 +461,9 @@ loadData();
458461
data-default-sort-dir="-1"
459462
title="Incremental loading time"
460463
>
461-
<a href="#" @click.prevent="sortTable('incrementalLoading', -1)"
464+
<a
465+
href="#"
466+
@click.prevent="sortTable('incrementalLoading', 'desc')"
462467
>Incremental loading (s)</a
463468
>
464469
</th>
@@ -470,7 +475,7 @@ loadData();
470475
>
471476
<a
472477
href="#"
473-
@click.prevent="sortTable('incrementalLoadingDelta', -1)"
478+
@click.prevent="sortTable('incrementalLoadingDelta', 'desc')"
474479
>Incremental loading delta</a
475480
>
476481
</th>

0 commit comments

Comments
 (0)