Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dataset viewer pagination #800

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions frontend/src/components/datasets/ParquetViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
min-width="180" />
</el-table>
<CsgPagination
perPage="4"
:perPage="perPage"
:currentPage="currentPage"
@currentChange="reloadRows"
:total="totalRows"
Expand All @@ -121,6 +121,7 @@
const previewData = ref({ columns: [], rows: [], total: 0 })
const currentPage = ref(1)
const totalRows = computed(() => { return previewData.value.total });
const perPage = ref(4)
const nameFilterInput = ref('')
// 默认subset和split的值
const splits = ref(props.datasetInfo[0].splits)
Expand All @@ -129,7 +130,7 @@
const numSplits = ref(splits.value[0]?.num_examples || 0)

const tableData = computed(() => {
const rows = previewData.value?.rows.slice(0, 4) || []
const rows = previewData.value?.rows.slice(0, perPage.value) || []
const columns = previewData.value?.columns || []
return rows.map(row => {
const obj = {}
Expand Down Expand Up @@ -170,7 +171,7 @@
}
let url = `datasets/${props.namespacePath}/dataviewer/rows`
url = url + `?page=${childCurrent ? childCurrent : currentPage.value}`
url = url + `&per=4`
url = url + `&per=${perPage.value}`
url = url + `&search=${nameFilterInput.value}`

url = url + `&namespace=${props.namespacePath.split('/')[0]}`
Expand Down
Loading