Skip to content

Commit

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

Signed-off-by: Shenoy Pratik <sgguruda@amazon.com>

* update snapshots

Signed-off-by: Shenoy Pratik <sgguruda@amazon.com>

---------

Signed-off-by: Shenoy Pratik <sgguruda@amazon.com>
(cherry picked from commit 03b1824)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] committed Oct 31, 2023
1 parent b18f5f4 commit 7a0fee5
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 7a0fee5

Please sign in to comment.