Skip to content

Commit

Permalink
Fix error handling for user w/o proper permissions (#195) (#197)
Browse files Browse the repository at this point in the history
* fix error handling for user w/o indices access



* update snapshots



---------


(cherry picked from commit 03b1824)

Signed-off-by: Shenoy Pratik <sgguruda@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent b18f5f4 commit 26ed0dc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion public/components/Main/__snapshots__/main.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2381,7 +2381,7 @@ exports[`<Main /> spec click run button, and response causes an error 1`] = `
class="euiText euiText--medium"
>
<p>
err
Error in loading OpenSearch indices
</p>
</div>
</span>
Expand Down
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 26ed0dc

Please sign in to comment.