You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "michael-s-molina (via GitHub)" <gi...@apache.org> on 2024/07/16 19:11:17 UTC
Re: [PR] fix(sqllab): Show warning message when deprecated db is selected [superset]
michael-s-molina commented on code in PR #29607:
URL: https://github.com/apache/superset/pull/29607#discussion_r1679938803
##########
superset-frontend/src/SqlLab/components/SqlEditor/index.tsx:
##########
@@ -767,63 +775,78 @@ const SqlEditor: FC<Props> = ({
return (
<StyledToolbar className="sql-toolbar" id="js-sql-toolbar">
- <div className="leftItems">
- <span>
- <RunQueryActionButton
- allowAsync={database?.allow_run_async === true}
- queryEditorId={queryEditor.id}
- queryState={latestQuery?.state}
- runQuery={runQuery}
- stopQuery={stopQuery}
- overlayCreateAsMenu={showMenu ? runMenuBtn : null}
- />
- </span>
- {isFeatureEnabled(FeatureFlag.EstimateQueryCost) &&
- database?.allows_cost_estimate && (
+ {hideActions ? (
+ <Alert
+ type="warning"
+ message={t(
+ 'The selected database is currently deprecated and cannot be used',
Review Comment:
We cannot assume that the database was deprecated. It may be an intermittent error. I suggest a more generic message.
```suggestion
'The database that was used to generate this query could not be found',
```
##########
superset-frontend/src/SqlLab/components/SqlEditor/SqlEditor.test.tsx:
##########
@@ -160,13 +160,23 @@ describe('SqlEditor', () => {
});
it('does not render SqlEditor if no db selected', async () => {
- const queryEditor = initialState.sqlLab.queryEditors[1];
+ const queryEditor = initialState.sqlLab.queryEditors[2];
const { findByText } = setup({ ...mockedProps, queryEditor }, store);
expect(
await findByText('Select a database to write a query'),
).toBeInTheDocument();
});
+ it('renders db deprecated message', async () => {
+ const queryEditor = initialState.sqlLab.queryEditors[1];
+ const { findByText } = setup({ ...mockedProps, queryEditor }, store);
+ expect(
+ await findByText(
+ 'The selected database is currently deprecated and cannot be used',
Review Comment:
```suggestion
'The database that was used to generate this query could not be found',
```
##########
superset-frontend/src/SqlLab/components/SqlEditor/index.tsx:
##########
@@ -767,63 +775,78 @@ const SqlEditor: FC<Props> = ({
return (
<StyledToolbar className="sql-toolbar" id="js-sql-toolbar">
- <div className="leftItems">
- <span>
- <RunQueryActionButton
- allowAsync={database?.allow_run_async === true}
- queryEditorId={queryEditor.id}
- queryState={latestQuery?.state}
- runQuery={runQuery}
- stopQuery={stopQuery}
- overlayCreateAsMenu={showMenu ? runMenuBtn : null}
- />
- </span>
- {isFeatureEnabled(FeatureFlag.EstimateQueryCost) &&
- database?.allows_cost_estimate && (
+ {hideActions ? (
+ <Alert
+ type="warning"
+ message={t(
+ 'The selected database is currently deprecated and cannot be used',
+ )}
+ description={t(
+ 'Choose one of the available databases from the panel on the left.',
Review Comment:
```suggestion
'Choose one of the available databases on the left panel.',
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org