Skip to content

Commit

Permalink
fix gpu form hide checkbox (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
baktun14 authored Nov 10, 2023
1 parent 81903a4 commit a43ea53
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
19 changes: 11 additions & 8 deletions deploy-web/src/components/sdl/GpuFormControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { validationConfig } from "../shared/akash/units";
type Props = {
serviceIndex: number;
hasGpu: boolean;
hideHasGpu?: boolean;
children?: ReactNode;
control: Control<SdlBuilderFormValues | RentGpusFormValues, any>;
providerAttributesSchema: ProviderAttributesSchema;
Expand All @@ -31,7 +32,7 @@ const useStyles = makeStyles()(theme => ({
}
}));

export const GpuFormControl: React.FunctionComponent<Props> = ({ providerAttributesSchema, control, serviceIndex, hasGpu, currentService }) => {
export const GpuFormControl: React.FunctionComponent<Props> = ({ providerAttributesSchema, control, serviceIndex, hasGpu, currentService, hideHasGpu }) => {
const { classes } = useStyles();
const theme = useTheme();

Expand Down Expand Up @@ -94,13 +95,15 @@ export const GpuFormControl: React.FunctionComponent<Props> = ({ providerAttribu
</CustomTooltip>
</Typography>

<Controller
control={control}
name={`services.${serviceIndex}.profile.hasGpu`}
render={({ field }) => (
<Checkbox checked={field.value} onChange={field.onChange} color="secondary" size="small" sx={{ marginLeft: ".5rem" }} />
)}
/>
{!hideHasGpu && (
<Controller
control={control}
name={`services.${serviceIndex}.profile.hasGpu`}
render={({ field }) => (
<Checkbox checked={field.value} onChange={field.onChange} color="secondary" size="small" sx={{ marginLeft: ".5rem" }} />
)}
/>
)}
</Box>

{hasGpu && (
Expand Down
2 changes: 2 additions & 0 deletions deploy-web/src/components/sdl/RentGpusForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export const RentGpusForm: React.FunctionComponent<Props> = ({}) => {
if (!result) return;

setValue("services", result as Service[]);
trigger();
};

const onPrerequisiteContinue = () => {
Expand Down Expand Up @@ -251,6 +252,7 @@ export const RentGpusForm: React.FunctionComponent<Props> = ({}) => {
serviceIndex={0}
hasGpu
currentService={currentService}
hideHasGpu
/>
</Box>

Expand Down

0 comments on commit a43ea53

Please sign in to comment.