Skip to content

Commit

Permalink
working big query form with arash updates
Browse files Browse the repository at this point in the history
  • Loading branch information
hughhhh committed Jun 9, 2021
1 parent 038eae3 commit 7e040bf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ 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 Label from 'src/components/Label';
import { SelectValue } from 'src/filters/components/Select/types';
import {
formScrollableStyles,
validatedFormStyles,
Expand Down Expand Up @@ -70,19 +70,19 @@ interface FieldPropTypes {
}

const CredentialsInfo = ({ changeMethods }: FieldPropTypes) => {
const [uploadOption, setUploadOption] = useState<string>('upload');
const [uploadOption, setUploadOption] = useState<SelectValue | number>(0);
const [fileToUpload, setFileToUpload] = useState<string | null | undefined>(
null,
);
return (
<CredentialInfoForm>
<Label className="label-select">
<span className="label-select">
How do you want to enter service account credentials?
</Label>
</span>
<Select
defaultValue={CredentialInfoOptions.jsonUpload}
style={{ width: '100%' }}
onChange={setUploadOption}
onChange={option => setUploadOption(option)}
>
<Select.Option value={CredentialInfoOptions.jsonUpload}>
Upload JSON file
Expand All @@ -91,7 +91,7 @@ const CredentialsInfo = ({ changeMethods }: FieldPropTypes) => {
Copy and Paste JSON credentials
</Select.Option>
</Select>
{uploadOption === 'paste' ? (
{uploadOption === CredentialInfoOptions.copyPaste ? (
<div className="input-container" onChange={changeMethods.onChange}>
<span className="label-select">Service Account</span>
<textarea className="input-form" name="encrypted_extra" />
Expand All @@ -105,7 +105,7 @@ const CredentialsInfo = ({ changeMethods }: FieldPropTypes) => {
{!fileToUpload && (
<Button
className="input-upload-btn"
onClick={() => selectedFile?.click()}
onClick={() => document?.getElementById('selectedFile').click()}
>
Choose File
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ import {
DatabaseForm,
CONFIGURATION_METHOD,
} from 'src/views/CRUD/data/database/types';
import Label from 'src/components/Label';
import ExtraOptions from './ExtraOptions';
import SqlAlchemyForm from './SqlAlchemyForm';
import DatabaseConnectionForm from './DatabaseConnectionForm';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ export const CredentialInfoForm = styled.div`
text-transform: uppercase;
color: ${({ theme }) => theme.colors.grayscale.dark1};
font-size: 11px;
margin: 0 0 ${({ theme }) => theme.gridUnit * 2}px;
margin: 0 5px ${({ theme }) => theme.gridUnit * 2}px;
}
.label-paste {
Expand Down

0 comments on commit 7e040bf

Please sign in to comment.