eschutho commented on a change in pull request #15619:
URL: https://github.com/apache/superset/pull/15619#discussion_r667160385
##########
File path:
superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
##########
@@ -548,68 +548,75 @@ const DatabaseModal:
FunctionComponent<DatabaseModalProps> = ({
});
};
- const renderAvailableSelector = () => (
- <div className="available">
- <h4 className="available-label">
- Or choose from a list of other databases we support:
- </h4>
- <div className="control-label">Supported databases</div>
- <Select
- className="available-select"
- onChange={setDatabaseModel}
- placeholder="Choose a database..."
- >
- {availableDbs?.databases
- ?.sort((a: DatabaseForm, b: DatabaseForm) =>
- a.name.localeCompare(b.name),
- )
- .map((database: DatabaseForm) => (
- <Select.Option value={database.engine} key={database.engine}>
- {database.name}
- </Select.Option>
- ))}
- </Select>
- <Alert
- showIcon
- closable={false}
- css={(theme: SupersetTheme) => antDAlertStyles(theme)}
- type="info"
- message={
- connectionAlert?.ADD_DATABASE?.message ||
- t('Want to add a new database?')
- }
- description={
- connectionAlert?.ADD_DATABASE ? (
- <>
- Any databases that allow connections via SQL Alchemy URIs can be
- added.{' '}
- <a
- href={connectionAlert?.ADD_DATABASE.contact_link}
- target="_blank"
- rel="noopener noreferrer"
- >
- {connectionAlert?.ADD_DATABASE.contact_description_link}
- </a>{' '}
- {connectionAlert?.ADD_DATABASE.description}
- </>
- ) : (
- <>
- Any databases that allow connections via SQL Alchemy URIs can be
- added. Learn about how to connect a database driver{' '}
- <a
- href={DOCUMENTATION_LINK}
- target="_blank"
- rel="noopener noreferrer"
- >
- here
- </a>
- .
- </>
- )
- }
- />
- </div>
- );
+ const renderAvailableSelector = () => {
+ let sortedAvailableDBs;
+ if (availableDbs) {
+ sortedAvailableDBs = [...(availableDbs?.databases || [])];
Review comment:
one last thing.. can you move this down to line 568 and remove a few
lines of code that way?
--
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]