Skip to content

Commit

Permalink
fix error handling for user w/o indices access
Browse files Browse the repository at this point in the history
Signed-off-by: Shenoy Pratik <sgguruda@amazon.com>
  • Loading branch information
ps48 committed Oct 31, 2023
1 parent 5a956ba commit c4b8297
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions public/components/SQLPage/table_view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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([]);
Expand Down Expand Up @@ -536,7 +536,7 @@ export const TableView = ({ http, selectedItems, updateSQLQueries, refreshTree }
{node.type === TREE_ITEM_TABLE_NAME_DEFAULT_NAME && !node.isLoading && (
<EuiIcon
type="editorCodeBlock"
onClick={(e) => handleQuery(e,parentName,node.name)}
onClick={(e) => handleQuery(e, parentName, node.name)}
></EuiIcon>
)}
</EuiText>
Expand Down

0 comments on commit c4b8297

Please sign in to comment.