From c4b8297b9e5e89aa16ec846d19a1437124484969 Mon Sep 17 00:00:00 2001 From: Shenoy Pratik Date: Tue, 31 Oct 2023 09:12:34 -0700 Subject: [PATCH 1/2] fix error handling for user w/o indices access Signed-off-by: Shenoy Pratik --- public/components/SQLPage/table_view.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/components/SQLPage/table_view.tsx b/public/components/SQLPage/table_view.tsx index cbe9987c..9ff070b7 100644 --- a/public/components/SQLPage/table_view.tsx +++ b/public/components/SQLPage/table_view.tsx @@ -112,7 +112,7 @@ export const TableView = ({ http, selectedItems, updateSQLQueries, refreshTree } body: JSON.stringify(query), }) .then((res) => { - const responseObj = res.data.resp ? JSON.parse(res.data.resp) : {}; + const responseObj = JSON.parse(res.data.resp); const dataRows: any[][] = _.get(responseObj, 'datarows'); if (dataRows.length > 0) { const fields = dataRows.map((data) => { @@ -131,9 +131,9 @@ export const TableView = ({ http, selectedItems, updateSQLQueries, refreshTree } console.error(err); setIsLoading({ flag: false, - status: err, + status: 'Error in loading OpenSearch indices', }); - setToast(`ERROR ${err}`, 'danger'); + setToast(`Error in loading OpenSearch indices, please check user permissions`, 'danger'); }); } else { setTableNames([]); @@ -536,7 +536,7 @@ export const TableView = ({ http, selectedItems, updateSQLQueries, refreshTree } {node.type === TREE_ITEM_TABLE_NAME_DEFAULT_NAME && !node.isLoading && ( handleQuery(e,parentName,node.name)} + onClick={(e) => handleQuery(e, parentName, node.name)} > )} From 9bb49dd6cb23a576ab6309ea5017c2717f44f493 Mon Sep 17 00:00:00 2001 From: Shenoy Pratik Date: Tue, 31 Oct 2023 09:15:34 -0700 Subject: [PATCH 2/2] update snapshots Signed-off-by: Shenoy Pratik --- public/components/Main/__snapshots__/main.test.tsx.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/components/Main/__snapshots__/main.test.tsx.snap b/public/components/Main/__snapshots__/main.test.tsx.snap index 1735ccb1..63d0698f 100644 --- a/public/components/Main/__snapshots__/main.test.tsx.snap +++ b/public/components/Main/__snapshots__/main.test.tsx.snap @@ -2381,7 +2381,7 @@ exports[`
spec click run button, and response causes an error 1`] = ` class="euiText euiText--medium" >

- err + Error in loading OpenSearch indices