Skip to content

Commit

Permalink
Merge pull request #2656 from threefoldtech/development_fix_listing
Browse files Browse the repository at this point in the history
fix listing multiple vms in same deployment
  • Loading branch information
amiraabouhadid authored May 8, 2024
2 parents 0b089cc + ef431ba commit 43d8949
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
17 changes: 11 additions & 6 deletions packages/playground/src/components/vm_deployment_table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,17 @@ async function loadDeployments() {
failedDeployments.value = vms.failedDeployments;

count.value = vms.count;
items.value = vms.items.map(([leader, ...workers]) => {
if (workers.length) {
leader.workers = workers;
}
return leader;
});
items.value = vms.items
.map((vm: any) => {
if (props.projectName.toLowerCase() === ProjectName.Caprover.toLowerCase()) {
const [leader, ...workers] = vm;
leader.workers = workers;
return leader;
}

return vm;
})
.flat();

loading.value = false;
}
Expand Down
8 changes: 5 additions & 3 deletions packages/playground/src/utils/load_deployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,11 @@ export async function loadVms(grid: GridClient, options: LoadVMsOptions = {}) {
);

const data = vms.map((vm, index) => {
vm[0].billing = formatConsumption(consumptions[index] as number);
if (wireguards[index] && wireguards[index].length > 0) {
vm[0].wireguard = wireguards[index][0];
for (let i = 0; i < vm.length; i++) {
vm[i].billing = formatConsumption(consumptions[index] as number);
if (wireguards[index] && wireguards[index].length > 0) {
vm[i].wireguard = wireguards[index][0];
}
}

return vm;
Expand Down

0 comments on commit 43d8949

Please sign in to comment.