diff --git a/common/types/index.ts b/common/types/index.ts
index 5ed212c8..17208cc3 100644
--- a/common/types/index.ts
+++ b/common/types/index.ts
@@ -87,4 +87,10 @@ export interface TreeItem {
type: TreeItemType;
isExpanded: boolean;
values?: TreeItem[];
+ isLoading?: boolean
+}
+
+export interface isLoading {
+ flag: boolean;
+ status: string;
}
diff --git a/common/utils/async_query_helpers.ts b/common/utils/async_query_helpers.ts
index 689727b3..3731859e 100644
--- a/common/utils/async_query_helpers.ts
+++ b/common/utils/async_query_helpers.ts
@@ -47,12 +47,13 @@ export const pollQueryStatus = (id: string, http: CoreStart['http'], callback) =
status === 'scheduled' ||
status === 'waiting'
) {
+ callback({status: status})
setTimeout(() => pollQueryStatus(id, http, callback), POLL_INTERVAL_MS);
} else if (status === 'failed') {
- callback([]);
+ callback({ status: 'FAILED', results: [] });
} else if (status === 'success') {
const results = _.get(res.data.resp, 'datarows');
- callback(results);
+ callback({ status: 'SUCCESS', results: results });
}
})
.catch((err) => {
diff --git a/public/components/Main/__snapshots__/main.test.tsx.snap b/public/components/Main/__snapshots__/main.test.tsx.snap
index f34fea4e..3b7c236c 100644
--- a/public/components/Main/__snapshots__/main.test.tsx.snap
+++ b/public/components/Main/__snapshots__/main.test.tsx.snap
@@ -193,7 +193,7 @@ exports[` spec click clear button 1`] = `
>
@@ -746,7 +750,7 @@ exports[` spec click run button, and response causes an error 1`] = `
>
@@ -1299,7 +1307,7 @@ exports[` spec click run button, and response is not ok 1`] = `
>
@@ -1852,7 +1864,7 @@ exports[` spec click run button, and response is ok 1`] = `
>
);
@@ -295,8 +359,15 @@ export const TableView = ({ http, selectedItems, updateSQLQueries, refreshTree }
return (
- {_.truncate(node.name, { length: 50 })}
- {' '}
+
+
+
+ {_.truncate(node.name, { length: 50 })}{' '}
+ {node.isLoading && }
+
+
+
+
);
}
@@ -331,7 +402,7 @@ export const TableView = ({ http, selectedItems, updateSQLQueries, refreshTree }
id: `${database.name}_${table.name}`,
icon:
table.type === TREE_ITEM_LOAD_MATERIALIZED_BADGE_NAME ? (
- MV
+ null
) : table.type === TREE_ITEM_BADGE_NAME ? null : (
),
@@ -339,9 +410,12 @@ export const TableView = ({ http, selectedItems, updateSQLQueries, refreshTree }
if (table.type !== TREE_ITEM_LOAD_MATERIALIZED_BADGE_NAME && table.values?.length === 0) {
handleTableClick(table.name);
}
- if (table.values?.length === 0) {
- table.values = [{ name: 'No Indicies', type: TREE_ITEM_BADGE_NAME, isExpanded: false }];
+ else {
+ if(table.values?.length === 0) {
+ table.values = [{ name: 'No Indicies', type: TREE_ITEM_BADGE_NAME, isExpanded: false }];
+ }
}
+
},
isSelectable: true,
isExpanded: table.isExpanded,
@@ -366,18 +440,25 @@ export const TableView = ({ http, selectedItems, updateSQLQueries, refreshTree }
return (
<>
- {isLoading ? (
+ {isLoadingBanner.flag ? (
+
Loading data
-
- Loading can take more than 30s. Queries can be made after the data has loaded. Any
- queries run before the data is loaded will be queued
-
+
+
+ Loading may take over 30 seconds
+
+
+
+
+ Status: {isLoadingBanner.status}
+
+
@@ -390,13 +471,16 @@ export const TableView = ({ http, selectedItems, updateSQLQueries, refreshTree }
)}
) : (
-
- Error loading data}
- />
-
+
+
+ Error loading data}
+ />
+
+
)}
{indexFlyout}
diff --git a/test/mocks/mockData.ts b/test/mocks/mockData.ts
index fee838f0..9a01e0fa 100644
--- a/test/mocks/mockData.ts
+++ b/test/mocks/mockData.ts
@@ -2364,5 +2364,11 @@ export const mockOpenSearchIndicies = {
},
};
+export const mockDatabaseQuery = {
+ data: {
+ ok: true,
+ resp: "{ \"schema\": [ { \"name\": \"namespace\", \"type\": \"string\" } ], \"datarows\": [ [ \"default\" ] ], \"total\": 1, \"size\": 1}"
+ },
+};