Skip to content

Commit

Permalink
Merge pull request #2885 from threefoldtech/development_ipTable_items
Browse files Browse the repository at this point in the history
Fix: show all public ips on the farm
  • Loading branch information
0oM4R authored Jun 6, 2024
2 parents 2747f34 + 6aa47ea commit b72ee05
Showing 1 changed file with 1 addition and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
<template>
<div>
<ListTable
:headers="headers"
:items="copyPublicIps"
:loading="loading"
:deleting="isRemoving"
v-model="selectedItems"
>
<ListTable :headers="headers" :items="publicIps" :loading="loading" :deleting="isRemoving" v-model="selectedItems">
<template v-slot:top>
<v-alert>
<h4 class="text-center font-weight-medium">Public IPs</h4>
Expand Down Expand Up @@ -104,7 +98,6 @@ export default {
},
] as any;
const publicIps = ref<PublicIp[]>([]);
const copyPublicIps = ref<PublicIp[]>([]);
const loading = ref(false);
const loadingIps = ref(false);
const showDialogue = ref(false);
Expand All @@ -113,36 +106,18 @@ export default {
const toPublicIP = ref();
const gateway = ref();
const isRemoving = ref(false);
const size = ref(5);
const page = ref(1);
const selectedItems = ref<any[]>([]);
const items = ref<RemoveFarmIPModel[]>([]);
onMounted(async () => {
await getFarmByID(props.farmId);
});
function updateIPPageSize(pageSize: number) {
loadingIps.value = true;
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;
try {
const farm = await gridStore.grid.farms.getFarmByID({ id });
publicIps.value = farm.publicIps as unknown as PublicIp[];
copyPublicIps.value = publicIps.value.slice(0, size.value);
} catch (error) {
createCustomToast(`Failed to get public IPs! ${error}`, ToastType.danger);
}
Expand Down Expand Up @@ -187,11 +162,6 @@ export default {
showDialogue,
isRemoving,
removeFarmIps,
page,
size,
updateIPPageSize,
updateIPPage,
copyPublicIps,
selectedItems,
loadingIps,
};
Expand Down

0 comments on commit b72ee05

Please sign in to comment.