Skip to content

Commit

Permalink
Merge pull request #2387 from threefoldtech/development_fix_ip_pagina…
Browse files Browse the repository at this point in the history
…tion

Fix: IP table pagination
  • Loading branch information
AhmedHanafy725 authored Mar 11, 2024
2 parents eb76754 + c742f9e commit d965ce4
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 d965ce4

Please sign in to comment.