Skip to content
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

put checkbox option for docker hub #1563

Merged
merged 1 commit into from
Sep 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
@@ -1,4 +1,5 @@
import { TextInput } from 'ui-components';
import { useState } from 'react';
import { Checkbox, TextInput } from 'ui-components';

import { DFLink } from '@/components/DFLink';
import { RegistryFormProps } from '@/features/common/data-component/RegistryConnectorForm';
Expand All @@ -19,6 +20,8 @@ sample request body
*/

export const DockerConnectorForm = ({ errorMessage, fieldErrors }: RegistryFormProps) => {
const [isPublic, setIsPublic] = useState(false);

return (
<>
<div className="text-p7 dark:text-text-input-value">
Expand Down Expand Up @@ -55,24 +58,42 @@ export const DockerConnectorForm = ({ errorMessage, fieldErrors }: RegistryFormP
placeholder="Namespace"
required
/>
<TextInput
className="w-3/4 min-[200px] max-w-xs"
label="Username"
type={'text'}
name="non_secret.docker_hub_username"
color={fieldErrors?.['docker_hub_username'] ? 'error' : 'default'}
helperText={fieldErrors?.['docker_hub_username']}
placeholder="Username"
/>
<TextInput
className="w-3/4 min-[200px] max-w-xs"
label="Password"
type={'password'}
name="secret.docker_hub_password"
color={fieldErrors?.['docker_hub_password'] ? 'error' : 'default'}
helperText={fieldErrors?.['docker_hub_password']}
placeholder="••••••••"
/>

<div className="flex mt-2">
<input hidden value={String(isPublic)} name="non_secret.is_public" />
<Checkbox
label="Public Registry"
checked={isPublic}
onCheckedChange={(checked: boolean) => {
setIsPublic(checked);
}}
/>
</div>
{!isPublic && (
<div className="flex flex-col gap-y-4">
<TextInput
className="w-3/4 min-[200px] max-w-xs"
label="Username"
type={'text'}
name="non_secret.docker_hub_username"
color={fieldErrors?.['docker_hub_username'] ? 'error' : 'default'}
helperText={fieldErrors?.['docker_hub_username']}
required
placeholder="Username"
/>
<TextInput
className="w-3/4 min-[200px] max-w-xs"
label="Password"
type={'password'}
name="secret.docker_hub_password"
color={fieldErrors?.['docker_hub_password'] ? 'error' : 'default'}
helperText={fieldErrors?.['docker_hub_password']}
placeholder="••••••••"
required
/>
</div>
)}

<div className="text-p7 dark:text-text-input-value">
Supported Versions: API version v2
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { TextInput } from 'ui-components';
import { useState } from 'react';
import { Checkbox, TextInput } from 'ui-components';

import { DFLink } from '@/components/DFLink';
import { RegistryFormProps } from '@/features/common/data-component/RegistryConnectorForm';
Expand All @@ -22,6 +23,8 @@ export const DockerPriavateConnectorForm = ({
errorMessage,
fieldErrors,
}: RegistryFormProps) => {
const [isPublic, setIsPublic] = useState(false);

return (
<>
<>
Expand Down Expand Up @@ -61,26 +64,43 @@ export const DockerPriavateConnectorForm = ({
helperText={fieldErrors?.['docker_registry_url']}
required
/>
<TextInput
className="w-3/4 min-[200px] max-w-xs"
label="Username"
type={'text'}
name="non_secret.docker_username"
placeholder="Username"
color={fieldErrors?.['docker_username'] ? 'error' : 'default'}
helperText={fieldErrors?.['docker_username']}
/>
<TextInput
className="w-3/4 min-[200px] max-w-xs"
label="Password"
type={'password'}
name="secret.docker_password"
placeholder="••••••••"
color={fieldErrors?.['docker_password'] ? 'error' : 'default'}
helperText={fieldErrors?.['docker_password']}
/>

<div className="mt-2 text-p7 dark:text-text-input-value">
<div className="flex">
<input hidden value={String(isPublic)} name="non_secret.is_public" />
<Checkbox
label="Public Registry"
checked={isPublic}
onCheckedChange={(checked: boolean) => {
setIsPublic(checked);
}}
/>
</div>
{!isPublic && (
<div className="flex flex-col gap-y-4">
<TextInput
className="w-3/4 min-[200px] max-w-xs"
label="Username"
type={'text'}
name="non_secret.docker_username"
placeholder="Username"
color={fieldErrors?.['docker_username'] ? 'error' : 'default'}
helperText={fieldErrors?.['docker_username']}
required
/>
<TextInput
className="w-3/4 min-[200px] max-w-xs"
label="Password"
type={'password'}
name="secret.docker_password"
placeholder="••••••••"
color={fieldErrors?.['docker_password'] ? 'error' : 'default'}
helperText={fieldErrors?.['docker_password']}
required
/>
</div>
)}

<div className="text-p7 dark:text-text-input-value">
Supported Versions: API version v2
</div>
</div>
Expand Down