Skip to content

Commit

Permalink
Revert "Fix error handling for user w/o proper permissions (opensearc…
Browse files Browse the repository at this point in the history
  • Loading branch information
mengweieric committed Nov 8, 2023
1 parent 4e26e8d commit 5919996
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>
Error in loading OpenSearch indices
err
</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 = 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) => {
Expand All @@ -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([]);
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 5919996

Please sign in to comment.