michael-s-molina commented on code in PR #19598:
URL: https://github.com/apache/superset/pull/19598#discussion_r849796995


##########
superset-frontend/src/components/DatabaseSelector/index.tsx:
##########
@@ -88,6 +95,8 @@ type SchemaValue = { label: string; value: string };
 
 interface DatabaseSelectorProps {
   db?: DatabaseObject;
+  dbSelectClosedState?: Dispatch<SetStateAction<boolean>>;

Review Comment:
   Maybe instead of `dbSelectClosedState` and `setDbSearch`, you could have a 
property called `onEmptyResults` that accepts a nullable `searchedText`. Then 
you can determine the text for `emptyState`. Like this:
   
   ```
   interface DatabaseSelectorProps {
      ...
      emptyState?: ReactNode;
      onEmptyResults?: (searchedText?: string) => void;
   }
   ```
   
   This also inverts the flow of function calls. The component does not know 
anything about the listeners or state actions.
   
   I still think the best solution would be just to have the `emptyState` 
property with a generic message like "No databases found" that can be used when 
the user is opening the select or searching.



##########
superset-frontend/src/SqlLab/components/SqlEditor/index.jsx:
##########
@@ -756,7 +757,15 @@ class SqlEditor extends React.PureComponent {
             />
           </div>
         </CSSTransition>
-        {this.queryPane()}
+        {this.props.sqlLab.dbConnect ? (
+          this.queryPane()
+        ) : (
+          <EmptyStateBig
+            image="vector.svg"
+            title="Select a database to write a query"
+            description="Choose one of the available database on the left"

Review Comment:
   ```suggestion
               title={t('Select a database to write a query')}
               description={t('Choose one of the available database on the 
left')}
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to