Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 2.11] Fix error handling for user w/o proper permissions #197

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading