From 34b0f290fa397887d57fe1b211e284e9cc386c92 Mon Sep 17 00:00:00 2001 From: AlaaElattar Date: Wed, 25 Oct 2023 12:18:23 +0300 Subject: [PATCH 01/54] add promise timeout when loading deployments --- .../playground/src/utils/load_deployment.ts | 45 +++++++++++++++---- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/packages/playground/src/utils/load_deployment.ts b/packages/playground/src/utils/load_deployment.ts index afd184e2c3..e0d9c2a61f 100644 --- a/packages/playground/src/utils/load_deployment.ts +++ b/packages/playground/src/utils/load_deployment.ts @@ -21,14 +21,29 @@ export async function loadVms(grid: GridClient, options: LoadVMsOptions = {}) { machines.map(n => getGrid(grid.clientOptions, `${projectName}/${n}`)), )) as GridClient[]; - const promises = machines.map((name, index) => { - return grids[index].machines.getObj(name).catch(e => { + const promises = machines.map(async (name, index) => { + const machinePromise = grids[index].machines.getObj(name); + const timeoutPromise = new Promise((resolve, reject) => { + setTimeout(() => { + reject(new Error("Timeout")); + }, 5000); + }); + + try { + const result = await Promise.race([machinePromise, timeoutPromise]); + + if (result instanceof Error && result.message === "Timeout") { + console.log(`%c[Error] Timeout loading deployment with name ${name}`, "color: rgb(207, 102, 121)"); + return null; + } else { + return result; + } + } catch (e) { console.log( `%c[Error] failed to load deployment with name ${name}:\n${normalizeError(e, "No errors were provided.")}`, "color: rgb(207, 102, 121)", ); - return null; - }); + } }); const items = await Promise.all(promises); const vms = items @@ -96,14 +111,28 @@ export async function loadK8s(grid: GridClient) { clusters.map(n => getGrid(grid.clientOptions, `${projectName}/${n}`)), )) as GridClient[]; - const promises = clusters.map((name, index) => { - return grids[index].k8s.getObj(name).catch(e => { + const promises = clusters.map(async (name, index) => { + const clusterPromise = grids[index].k8s.getObj(name); + const timeoutPromise = new Promise((resolve, reject) => { + setTimeout(() => { + reject(new Error("Timeout")); + }, 5000); + }); + + try { + const result = await Promise.race([clusterPromise, timeoutPromise]); + if (result instanceof Error && result.message === "Timeout") { + console.log(`%c[Error] Timeout loading deployment with name ${name}`, "color: rgb(207, 102, 121)"); + return null; + } else { + return result; + } + } catch (e) { console.log( `%c[Error] failed to load deployment with name ${name}:\n${normalizeError(e, "No errors were provided.")}`, "color: rgb(207, 102, 121)", ); - return null; - }); + } }); const items = (await Promise.all(promises)) as any[]; const k8s = items From 6494387ea739b7530ae9bd5c53976eada5b25e8d Mon Sep 17 00:00:00 2001 From: AlaaElattar Date: Wed, 25 Oct 2023 17:36:41 +0300 Subject: [PATCH 02/54] add failed deployments with node id in vm, k8s --- .../src/components/k8s_deployment_table.vue | 46 ++++++++++++++++ .../src/components/vm_deployment_table.vue | 55 +++++++++++++++++-- .../playground/src/utils/load_deployment.ts | 14 ++++- 3 files changed, 109 insertions(+), 6 deletions(-) diff --git a/packages/playground/src/components/k8s_deployment_table.vue b/packages/playground/src/components/k8s_deployment_table.vue index 4f848f3d77..9a3397b234 100644 --- a/packages/playground/src/components/k8s_deployment_table.vue +++ b/packages/playground/src/components/k8s_deployment_table.vue @@ -1,6 +1,27 @@ From cd0b70561d54f46b1dcb4991474864c1d7a929da Mon Sep 17 00:00:00 2001 From: kassem Date: Wed, 1 Nov 2023 11:54:25 +0200 Subject: [PATCH 15/54] change loading contract details error ux --- .../playground/src/weblets/tf_contracts_list.vue | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/playground/src/weblets/tf_contracts_list.vue b/packages/playground/src/weblets/tf_contracts_list.vue index 6ab3fbd7c6..6ff7180d8f 100644 --- a/packages/playground/src/weblets/tf_contracts_list.vue +++ b/packages/playground/src/weblets/tf_contracts_list.vue @@ -13,7 +13,6 @@ refresh - -