Skip to content

Commit

Permalink
fix: enhance drill-down dialog with 'Load All Rows' functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
UmakanthKaspa committed Jan 2, 2025
1 parent 9c92446 commit f06795f
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions frontend/src2/charts/components/DrillDown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,22 @@ function onSort(newSortOrder: Record<string, 'asc' | 'desc'>) {
drillDownQuery.value.execute()
}
}
function loadAllRows() {
if (drillDownQuery.value) {
drillDownQuery.value.addLimit(drillDownQuery.value.result.totalRowCount)
drillDownQuery.value
.execute()
.then(() => {
return drillDownQuery.value?.fetchResultCount()
})
.catch((error) => {
console.error('Failed to load all rows:', error)
})
}
}
</script>

<template>
Expand All @@ -77,10 +93,21 @@ function onSort(newSortOrder: Record<string, 'asc' | 'desc'>) {
:show-filter-row="true" :sort-order="sortOrder" @sort="onSort"
:on-export="drillDownQuery ? drillDownQuery.downloadResults : undefined">
<template #footer-left>
<p class="tnum p-1 text-sm text-gray-600">
Showing {{ drillDownQuery.result.rows.length }} of
{{ drillDownQuery.result.totalRowCount }} rows
</p>
<div class="flex items-center justify-between p-1 gap-4">
<p class="tnum text-sm text-gray-600">
Showing {{ drillDownQuery.result.rows.length }} of
{{ drillDownQuery.result.totalRowCount }} rows
</p>
<Button
v-if="drillDownQuery.result.rows.length < drillDownQuery.result.totalRowCount"
:variant="'ghost'"
theme="gray"
size="sm"
label="Load All Rows"
@click="loadAllRows"
>
</Button>
</div>
</template>
</DataTable>
</div>
Expand Down

0 comments on commit f06795f

Please sign in to comment.