Skip to content

Commit

Permalink
Fix:
Browse files Browse the repository at this point in the history
add updatePage funtion that do the pagination logic
  • Loading branch information
0oM4R committed Mar 11, 2024
1 parent eb76754 commit c742f9e
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions packages/playground/src/dashboard/components/public_ips_table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
{ value: 50, title: '50' },
]"
:page="page"
@update:items-per-page="page => updateIPPage(page)"
@update:items-per-page="size => updateIPPageSize(size)"
@update:page="page => updateIPPage(page)"
class="elevation-1 v-data-table-header"
density="compact"
:disable-sort="true"
Expand Down Expand Up @@ -134,12 +135,20 @@ export default {
await getFarmByID(props.farmId);
});
async function updateIPPage(page: number) {
function updateIPPageSize(pageSize: number) {
loadingIps.value = true;
size.value = page;
size.value = pageSize;
copyPublicIps.value = publicIps.value.slice(0, size.value) as unknown as PublicIp[];
loadingIps.value = false;
}
function updateIPPage(pageNumber: number) {
page.value = pageNumber;
loadingIps.value = true;
const startIndex = (pageNumber - 1) * size.value;
const endIndex = startIndex + size.value;
copyPublicIps.value = publicIps.value.slice(startIndex, endIndex) as unknown as PublicIp[];
loadingIps.value = false;
}
async function getFarmByID(id: number) {
loadingIps.value = true;
Expand Down Expand Up @@ -192,6 +201,7 @@ export default {
updateIPPage,
copyPublicIps,
loadingIps,
updateIPPageSize,
};
},
};
Expand Down

0 comments on commit c742f9e

Please sign in to comment.