From 5919996711c3c7b2cf5ea309017f2b2962a90c9f Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 8 Nov 2023 21:09:02 +0000 Subject: [PATCH] Revert "Fix error handling for user w/o proper permissions (#195) (#197)" This reverts commit 26ed0dca5e40e4ef0eeb1fa9d284a1238392fd41. --- public/components/Main/__snapshots__/main.test.tsx.snap | 2 +- public/components/SQLPage/table_view.tsx | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/public/components/Main/__snapshots__/main.test.tsx.snap b/public/components/Main/__snapshots__/main.test.tsx.snap index 63d0698f..1735ccb1 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" >

- Error in loading OpenSearch indices + err

diff --git a/public/components/SQLPage/table_view.tsx b/public/components/SQLPage/table_view.tsx index 9ff070b7..cbe9987c 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 = JSON.parse(res.data.resp); + const responseObj = res.data.resp ? 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: 'Error in loading OpenSearch indices', + status: err, }); - setToast(`Error in loading OpenSearch indices, please check user permissions`, 'danger'); + setToast(`ERROR ${err}`, '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)} > )}