Skip to content

Commit 99b121a

Browse files
authored
1 parent 86f4fc1 commit 99b121a

File tree

1 file changed

+39
-40
lines changed

1 file changed

+39
-40
lines changed

frontend/src/pages/modelServing/screens/projects/InferenceServiceModal/ConnectionSection.tsx

Lines changed: 39 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -505,45 +505,8 @@ export const ConnectionSection: React.FC<Props> = ({
505505
)
506506
}
507507
/>
508-
{(pvcs && pvcs.length > 0) || pvcNameFromUri ? (
509-
<Radio
510-
label="Existing cluster storage"
511-
name="pvc-serving-radio"
512-
id="pvc-serving-radio"
513-
data-testid="pvc-serving-radio"
514-
isChecked={data.storage.type === InferenceServiceStorageType.PVC_STORAGE}
515-
onChange={() => {
516-
setConnection(undefined);
517-
setData('storage', {
518-
...data.storage,
519-
type: InferenceServiceStorageType.PVC_STORAGE,
520-
uri: undefined,
521-
alert: undefined,
522-
});
523-
}}
524-
body={
525-
data.storage.type === InferenceServiceStorageType.PVC_STORAGE && (
526-
<PvcSelect
527-
pvcs={pvcs}
528-
selectedPVC={selectedPVC}
529-
onSelect={(selection?: PersistentVolumeClaimKind | undefined) => {
530-
setData('storage', {
531-
...data.storage,
532-
type: InferenceServiceStorageType.PVC_STORAGE,
533-
pvcConnection: selection?.metadata.name ?? '',
534-
});
535-
}}
536-
setModelUri={(uri) => setData('storage', { ...data.storage, uri })}
537-
setIsConnectionValid={setIsConnectionValid}
538-
existingUriOption={existingUriOption}
539-
pvcNameFromUri={pvcNameFromUri}
540-
/>
541-
)
542-
}
543-
/>
544-
) : null}
545508
</>
546-
) : pvcs && pvcs.length === 0 ? ( // No connections and no pvcs
509+
) : pvcs && pvcs.length === 0 ? ( // No connections and no pvcs: auto-show the new connection field
547510
<FormGroup
548511
name="new-connection"
549512
id="new-connection"
@@ -573,13 +536,12 @@ export const ConnectionSection: React.FC<Props> = ({
573536
</Stack>
574537
</FormGroup>
575538
) : (
576-
// No connections, but there are pvcs
539+
// No connections, but there are pvcs show the new connection radio and pvc radio
577540
<Radio
578541
name="new-connection-radio"
579542
id="new-connection-radio"
580543
data-testid="new-connection-radio"
581544
label="Create connection"
582-
className="pf-v6-u-mb-lg"
583545
isChecked={data.storage.type === InferenceServiceStorageType.NEW_STORAGE}
584546
onChange={() => {
585547
setConnection(undefined);
@@ -622,6 +584,43 @@ export const ConnectionSection: React.FC<Props> = ({
622584
}
623585
/>
624586
)}
587+
{(pvcs && pvcs.length > 0) || pvcNameFromUri ? (
588+
<Radio
589+
label="Existing cluster storage"
590+
name="pvc-serving-radio"
591+
id="pvc-serving-radio"
592+
data-testid="pvc-serving-radio"
593+
isChecked={data.storage.type === InferenceServiceStorageType.PVC_STORAGE}
594+
onChange={() => {
595+
setConnection(undefined);
596+
setData('storage', {
597+
...data.storage,
598+
type: InferenceServiceStorageType.PVC_STORAGE,
599+
uri: undefined,
600+
alert: undefined,
601+
});
602+
}}
603+
body={
604+
data.storage.type === InferenceServiceStorageType.PVC_STORAGE && (
605+
<PvcSelect
606+
pvcs={pvcs}
607+
selectedPVC={selectedPVC}
608+
onSelect={(selection?: PersistentVolumeClaimKind | undefined) => {
609+
setData('storage', {
610+
...data.storage,
611+
type: InferenceServiceStorageType.PVC_STORAGE,
612+
pvcConnection: selection?.metadata.name ?? '',
613+
});
614+
}}
615+
setModelUri={(uri) => setData('storage', { ...data.storage, uri })}
616+
setIsConnectionValid={setIsConnectionValid}
617+
existingUriOption={existingUriOption}
618+
pvcNameFromUri={pvcNameFromUri}
619+
/>
620+
)
621+
}
622+
/>
623+
) : null}
625624
</>
626625
);
627626
};

0 commit comments

Comments
 (0)