From 50ee718f90ae7c608e82e0818650ff19743b497e Mon Sep 17 00:00:00 2001 From: Bruce Schultz Date: Mon, 29 Jul 2024 15:46:00 +0200 Subject: [PATCH] fix(datastore): have datastore table timeout properly when no data returned --- components/data-stores/DataStoreListTabs.vue | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/components/data-stores/DataStoreListTabs.vue b/components/data-stores/DataStoreListTabs.vue index 18bf784..f8c4baf 100644 --- a/components/data-stores/DataStoreListTabs.vue +++ b/components/data-stores/DataStoreListTabs.vue @@ -20,21 +20,21 @@ const dataStores = ref(); const consumers = ref(); const projectNameMap = ref(); const analysisNameMap = ref(); -const loading = ref(true); const dataRowUnixCols = ["created_at", "updated_at"]; const expandRowEntries = []; onBeforeMount(() => { nextTick(async () => { - await loadDetailedDataStoreTable(); - loading.value = false; + const tableLoadSuccessful = await loadDetailedDataStoreTable(); - projectNameMap.value = await fetchDataFromHub("/projects"); - analysisNameMap.value = await fetchDataFromHub("/analyses"); + if (tableLoadSuccessful) { + projectNameMap.value = await fetchDataFromHub("/projects"); + analysisNameMap.value = await fetchDataFromHub("/analyses"); - const consumerResp = (await $hubApi("/kong/analysis")) as ListConsumers; - consumers.value = consumerResp.data; + const consumerResp = (await $hubApi("/kong/analysis")) as ListConsumers; + consumers.value = consumerResp.data; + } }); }); @@ -61,8 +61,10 @@ async function loadDetailedDataStoreTable() { } }); dataStores.value = formattedDataStores; + return true; } else if (error.value?.statusCode === 500) { showConnectionErrorToast(); + dataStores.value = []; } }