Skip to content

Commit

Permalink
revisions
Browse files Browse the repository at this point in the history
  • Loading branch information
AAfghahi committed Jun 10, 2021
1 parent 7e040bf commit bb6c981
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import { Switch, Select, Button } from 'src/common/components';
import InfoTooltip from 'src/components/InfoTooltip';
import ValidatedInput from 'src/components/Form/LabeledErrorBoundInput';
import { DeleteFilled } from '@ant-design/icons';
import { SelectValue } from 'src/filters/components/Select/types';
import {
formScrollableStyles,
validatedFormStyles,
Expand Down Expand Up @@ -63,14 +62,10 @@ interface FieldPropTypes {
db?: DatabaseObject;
isEditMode?: boolean;
sslForced?: boolean;
uploadOption?: string | null;
setUploadOption: (obj: any) => void;
fileToUpload?: string;
setFileToUpload: (obj: any) => void;
}

const CredentialsInfo = ({ changeMethods }: FieldPropTypes) => {
const [uploadOption, setUploadOption] = useState<SelectValue | number>(0);
const [uploadOption, setUploadOption] = useState<number>(0);
const [fileToUpload, setFileToUpload] = useState<string | null | undefined>(
null,
);
Expand Down Expand Up @@ -105,7 +100,7 @@ const CredentialsInfo = ({ changeMethods }: FieldPropTypes) => {
{!fileToUpload && (
<Button
className="input-upload-btn"
onClick={() => document?.getElementById('selectedFile').click()}
onClick={() => document?.getElementById('selectedFile')?.click()}
>
Choose File
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ import { DatabaseForm, DatabaseObject } from '../types';
export const DOCUMENTATION_LINK =
'https://superset.apache.org/docs/databases/installing-database-drivers';

const irregularDocumentationLinks = {
postgresql: 'https://superset.apache.org/docs/databases/postgres',
mssql: 'https://superset.apache.org/docs/databases/sql-server',
};

const documentationLink = (engine: string | undefined) => {
if (!engine) return null;
if (!irregularDocumentationLinks[engine]) {
return `https://superset.apache.org/docs/databases/${engine}`;
}
return irregularDocumentationLinks[engine];
};
const ModalHeader = ({
isLoading,
isEditMode,
Expand Down Expand Up @@ -69,6 +81,20 @@ const ModalHeader = ({
const hasConnectedDbHeader = (
<StyledFormHeader>
<p className="helper"> Step 3 of 3 </p>
<h4>
Your database was successfully connected! Here are some optional
settings for your database
</h4>
<p className="helper">
Need help? Learn more about{' '}
<a
href={documentationLink(db?.engine)}
target="_blank"
rel="noopener noreferrer"
>
connecting to {dbModel.name}
</a>
</p>
</StyledFormHeader>
);
const hasDbHeader = (
Expand Down
1 change: 1 addition & 0 deletions superset-frontend/src/views/CRUD/data/database/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export type DatabaseObject = {
username?: string;
password?: string;
encryption?: boolean;
query?: string;
};
configuration_method: CONFIGURATION_METHOD;
engine?: string;
Expand Down

0 comments on commit bb6c981

Please sign in to comment.