Skip to content

ENG-2790 Set Default Tabs for Integrations Dialog #1207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const AthenaDialog: React.FC<Props> = ({
const [fileName, setFileName] = useState<string>(null);

const setFile = (fileData: FileData | null) => {
setFileName(fileData?.name ?? null);
setFileName(fileData?.name ?? '');
onUpdateField('config_file_content', fileData?.data);
};

Expand Down Expand Up @@ -67,7 +67,7 @@ export const AthenaDialog: React.FC<Props> = ({
onChange={(event) =>
onUpdateField('config_file_profile', event.target.value)
}
value={value?.config_file_profile ?? null}
value={value?.config_file_profile ?? ''}
/>
);

Expand All @@ -83,7 +83,7 @@ export const AthenaDialog: React.FC<Props> = ({
description="The access key ID of your AWS account."
placeholder={Placeholders.access_key_id}
onChange={(event) => onUpdateField('access_key_id', event.target.value)}
value={value?.access_key_id ?? null}
value={value?.access_key_id ?? ''}
/>

<IntegrationTextInputField
Expand All @@ -95,7 +95,7 @@ export const AthenaDialog: React.FC<Props> = ({
onChange={(event) =>
onUpdateField('secret_access_key', event.target.value)
}
value={value?.secret_access_key ?? null}
value={value?.secret_access_key ?? ''}
/>

<IntegrationTextInputField
Expand All @@ -105,7 +105,7 @@ export const AthenaDialog: React.FC<Props> = ({
description="The region the Athena database belongs to."
placeholder={Placeholders.region}
onChange={(event) => onUpdateField('region', event.target.value)}
value={value?.region ?? null}
value={value?.region ?? ''}
/>
</Box>
);
Expand All @@ -129,7 +129,7 @@ export const AthenaDialog: React.FC<Props> = ({
onChange={(event) =>
onUpdateField('config_file_path', event.target.value)
}
value={value?.config_file_path ?? null}
value={value?.config_file_path ?? ''}
/>

{configProfileInput}
Expand Down Expand Up @@ -177,7 +177,7 @@ export const AthenaDialog: React.FC<Props> = ({
description="The name of the Athena database."
placeholder={Placeholders.database}
onChange={(event) => onUpdateField('database', event.target.value)}
value={value?.database ?? null}
value={value?.database ?? ''}
disabled={editMode}
warning={editMode ? undefined : readOnlyFieldWarning}
disableReason={editMode ? readOnlyFieldDisableReason : undefined}
Expand All @@ -194,15 +194,15 @@ export const AthenaDialog: React.FC<Props> = ({
onChange={(event) =>
onUpdateField('output_location', event.target.value)
}
value={value?.output_location ?? null}
value={value?.output_location ?? ''}
disabled={editMode}
warning={editMode ? undefined : readOnlyFieldWarning}
disableReason={editMode ? readOnlyFieldDisableReason : undefined}
/>

<Box sx={{ borderBottom: 1, borderColor: 'divider', mb: 2 }}>
<Tabs
value={value?.type}
value={value?.type ?? 'access_key'}
onChange={(_, value) => onUpdateField('type', value)}
>
<Tab value={AWSCredentialType.AccessKey} label="Enter Access Keys" />
Expand Down
26 changes: 13 additions & 13 deletions src/ui/common/src/components/integrations/dialogs/awsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const AWSDialog: React.FC<Props> = ({ onUpdateField, value }) => {
onChange={(event) =>
onUpdateField('config_file_profile', event.target.value)
}
value={value?.config_file_profile ?? null}
value={value?.config_file_profile ?? ''}
/>
);

Expand All @@ -75,7 +75,7 @@ export const AWSDialog: React.FC<Props> = ({ onUpdateField, value }) => {
description="The access key ID of your AWS account."
placeholder={Placeholders.access_key_id}
onChange={(event) => onUpdateField('access_key_id', event.target.value)}
value={value?.access_key_id ?? null}
value={value?.access_key_id ?? ''}
/>

<IntegrationTextInputField
Expand All @@ -87,7 +87,7 @@ export const AWSDialog: React.FC<Props> = ({ onUpdateField, value }) => {
onChange={(event) =>
onUpdateField('secret_access_key', event.target.value)
}
value={value?.secret_access_key ?? null}
value={value?.secret_access_key ?? ''}
/>

<IntegrationTextInputField
Expand All @@ -97,7 +97,7 @@ export const AWSDialog: React.FC<Props> = ({ onUpdateField, value }) => {
description="The region of your AWS account."
placeholder={Placeholders.region}
onChange={(event) => onUpdateField('region', event.target.value)}
value={value?.region ?? null}
value={value?.region ?? ''}
/>
</Box>
);
Expand All @@ -121,7 +121,7 @@ export const AWSDialog: React.FC<Props> = ({ onUpdateField, value }) => {
onChange={(event) =>
onUpdateField('config_file_path', event.target.value)
}
value={value?.config_file_path ?? null}
value={value?.config_file_path ?? ''}
/>

{configProfileInput}
Expand All @@ -143,7 +143,7 @@ export const AWSDialog: React.FC<Props> = ({ onUpdateField, value }) => {
k8sConfigs['keepalive'] = event.target.value;
onUpdateField('k8s_serialized', JSON.stringify(k8sConfigs));
}}
value={k8sConfigs['keepalive'] ?? null}
value={k8sConfigs['keepalive'] ?? ''}
/>
<IntegrationTextInputField
spellCheck={false}
Expand All @@ -155,7 +155,7 @@ export const AWSDialog: React.FC<Props> = ({ onUpdateField, value }) => {
k8sConfigs['cpu_node_type'] = event.target.value;
onUpdateField('k8s_serialized', JSON.stringify(k8sConfigs));
}}
value={k8sConfigs['cpu_node_type'] ?? null}
value={k8sConfigs['cpu_node_type'] ?? ''}
/>

<IntegrationTextInputField
Expand All @@ -168,7 +168,7 @@ export const AWSDialog: React.FC<Props> = ({ onUpdateField, value }) => {
k8sConfigs['gpu_node_type'] = event.target.value;
onUpdateField('k8s_serialized', JSON.stringify(k8sConfigs));
}}
value={k8sConfigs['gpu_node_type'] ?? null}
value={k8sConfigs['gpu_node_type'] ?? ''}
/>
<IntegrationTextInputField
spellCheck={false}
Expand All @@ -180,7 +180,7 @@ export const AWSDialog: React.FC<Props> = ({ onUpdateField, value }) => {
k8sConfigs['min_cpu_node'] = event.target.value;
onUpdateField('k8s_serialized', JSON.stringify(k8sConfigs));
}}
value={k8sConfigs['min_cpu_node'] ?? null}
value={k8sConfigs['min_cpu_node'] ?? ''}
/>
<IntegrationTextInputField
spellCheck={false}
Expand All @@ -192,7 +192,7 @@ export const AWSDialog: React.FC<Props> = ({ onUpdateField, value }) => {
k8sConfigs['max_cpu_node'] = event.target.value;
onUpdateField('k8s_serialized', JSON.stringify(k8sConfigs));
}}
value={k8sConfigs['max_cpu_node'] ?? null}
value={k8sConfigs['max_cpu_node'] ?? ''}
/>
<IntegrationTextInputField
spellCheck={false}
Expand All @@ -204,7 +204,7 @@ export const AWSDialog: React.FC<Props> = ({ onUpdateField, value }) => {
k8sConfigs['min_gpu_node'] = event.target.value;
onUpdateField('k8s_serialized', JSON.stringify(k8sConfigs));
}}
value={k8sConfigs['min_gpu_node'] ?? null}
value={k8sConfigs['min_gpu_node'] ?? ''}
/>
<IntegrationTextInputField
spellCheck={false}
Expand All @@ -216,7 +216,7 @@ export const AWSDialog: React.FC<Props> = ({ onUpdateField, value }) => {
k8sConfigs['max_gpu_node'] = event.target.value;
onUpdateField('k8s_serialized', JSON.stringify(k8sConfigs));
}}
value={k8sConfigs['max_gpu_node'] ?? null}
value={k8sConfigs['max_gpu_node'] ?? ''}
/>
</Box>
);
Expand All @@ -225,7 +225,7 @@ export const AWSDialog: React.FC<Props> = ({ onUpdateField, value }) => {
<Box sx={{ mt: 2 }}>
<Box sx={{ borderBottom: 1, borderColor: 'divider', mb: 2 }}>
<Tabs
value={value?.type}
value={value?.type ?? 'access_key'}
onChange={(_, value) => onUpdateField('type', value)}
>
<Tab value={AWSCredentialType.AccessKey} label="Enter Access Keys" />
Expand Down
16 changes: 8 additions & 8 deletions src/ui/common/src/components/integrations/dialogs/s3Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const S3Dialog: React.FC<Props> = ({
onChange={(event) =>
onUpdateField('config_file_profile', event.target.value)
}
value={value?.config_file_profile ?? null}
value={value?.config_file_profile ?? ''}
/>
);

Expand All @@ -91,7 +91,7 @@ export const S3Dialog: React.FC<Props> = ({
description="The access key ID of your AWS account."
placeholder={Placeholders.access_key_id}
onChange={(event) => onUpdateField('access_key_id', event.target.value)}
value={value?.access_key_id ?? null}
value={value?.access_key_id ?? ''}
/>

<IntegrationTextInputField
Expand All @@ -103,7 +103,7 @@ export const S3Dialog: React.FC<Props> = ({
onChange={(event) =>
onUpdateField('secret_access_key', event.target.value)
}
value={value?.secret_access_key ?? null}
value={value?.secret_access_key ?? ''}
/>
</Box>
);
Expand All @@ -127,7 +127,7 @@ export const S3Dialog: React.FC<Props> = ({
onChange={(event) =>
onUpdateField('config_file_path', event.target.value)
}
value={value?.config_file_path ?? null}
value={value?.config_file_path ?? ''}
/>

{configProfileInput}
Expand Down Expand Up @@ -175,7 +175,7 @@ export const S3Dialog: React.FC<Props> = ({
description="The name of the S3 bucket."
placeholder={Placeholders.bucket}
onChange={(event) => onUpdateField('bucket', event.target.value)}
value={value?.bucket ?? null}
value={value?.bucket ?? ''}
disabled={editMode}
warning={editMode ? undefined : readOnlyFieldWarning}
disableReason={editMode ? readOnlyFieldDisableReason : undefined}
Expand All @@ -188,7 +188,7 @@ export const S3Dialog: React.FC<Props> = ({
description="The region the S3 bucket belongs to."
placeholder={Placeholders.region}
onChange={(event) => onUpdateField('region', event.target.value)}
value={value?.region ?? null}
value={value?.region ?? ''}
disabled={editMode}
warning={editMode ? undefined : readOnlyFieldWarning}
disableReason={editMode ? readOnlyFieldDisableReason : undefined}
Expand All @@ -201,15 +201,15 @@ export const S3Dialog: React.FC<Props> = ({
description="Only applicable when also setting this integration to be the artifact store. This is an optional path to an existing directory in the bucket, to be used as the root of the artifact store. Defaults to the root of the bucket."
placeholder={Placeholders.root_dir}
onChange={(event) => onUpdateField('root_dir', event.target.value)}
value={value?.root_dir ?? null}
value={value?.root_dir ?? ''}
disabled={editMode}
warning={editMode ? undefined : readOnlyFieldWarning}
disableReason={editMode ? readOnlyFieldDisableReason : undefined}
/>

<Box sx={{ borderBottom: 1, borderColor: 'divider', mb: 2 }}>
<Tabs
value={value?.type}
value={value?.type ?? 'access_key'}
onChange={(_, value) => onUpdateField('type', value)}
>
<Tab value={AWSCredentialType.AccessKey} label="Enter Access Keys" />
Expand Down