fix: Database List Sorted (#15619)

* sorted the database list

* revisions

* cloned the array

* one more time with feeling

* added documentation link as well
This commit is contained in:
AAfghahi 2021-07-09 16:06:17 -04:00 committed by GitHub
parent 600473ff72
commit faf6fcd83e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 5 deletions

View File

@ -27,11 +27,12 @@ import {
} from './styles'; } from './styles';
import { DatabaseForm, DatabaseObject } from '../types'; import { DatabaseForm, DatabaseObject } from '../types';
export const DOCUMENTATION_LINK =
'https://superset.apache.org/docs/databases/installing-database-drivers';
const supersetTextDocs = getDatabaseDocumentationLinks(); const supersetTextDocs = getDatabaseDocumentationLinks();
export const DOCUMENTATION_LINK = supersetTextDocs
? supersetTextDocs.support
: 'https://superset.apache.org/docs/databases/installing-database-drivers';
const irregularDocumentationLinks = { const irregularDocumentationLinks = {
postgresql: 'https://superset.apache.org/docs/databases/postgres', postgresql: 'https://superset.apache.org/docs/databases/postgres',
mssql: 'https://superset.apache.org/docs/databases/sql-server', mssql: 'https://superset.apache.org/docs/databases/sql-server',

View File

@ -559,7 +559,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
onChange={setDatabaseModel} onChange={setDatabaseModel}
placeholder="Choose a database..." placeholder="Choose a database..."
> >
{availableDbs?.databases {[...(availableDbs?.databases || [])]
?.sort((a: DatabaseForm, b: DatabaseForm) => ?.sort((a: DatabaseForm, b: DatabaseForm) =>
a.name.localeCompare(b.name), a.name.localeCompare(b.name),
) )

View File

@ -631,7 +631,7 @@ export function useAvailableDatabases() {
const getAvailable = useCallback(() => { const getAvailable = useCallback(() => {
SupersetClient.get({ SupersetClient.get({
endpoint: `/api/v1/database/available`, endpoint: `/api/v1/database/available/`,
}).then(({ json }) => { }).then(({ json }) => {
setAvailableDbs(json); setAvailableDbs(json);
}); });