From 330dfdfb870662d906296fb539de34d004e0b465 Mon Sep 17 00:00:00 2001 From: olavtar <94576904+olavtar@users.noreply.github.com> Date: Fri, 27 Sep 2024 18:47:21 -0700 Subject: [PATCH] fix: resolved double window and NIM modal showing for KServe. Added a link to EmptyModelServing for NIM project. (#3268) Signed-off-by: Olga Lavtar --- .../screens/global/EmptyModelServing.tsx | 7 +++- .../screens/projects/ModelServingPlatform.tsx | 38 ++++++++++--------- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/frontend/src/pages/modelServing/screens/global/EmptyModelServing.tsx b/frontend/src/pages/modelServing/screens/global/EmptyModelServing.tsx index d5a985a240..510b20d254 100644 --- a/frontend/src/pages/modelServing/screens/global/EmptyModelServing.tsx +++ b/frontend/src/pages/modelServing/screens/global/EmptyModelServing.tsx @@ -10,6 +10,7 @@ import { ProjectObjectType, typedEmptyImage } from '~/concepts/design/utils'; import { ProjectSectionID } from '~/pages/projects/screens/detail/types'; import ServeModelButton from '~/pages/modelServing/screens/global/ServeModelButton'; import { getDisplayNameFromK8sResource } from '~/concepts/k8s/utils'; +import { isProjectNIMSupported } from '~/pages/modelServing/screens/projects/nimUtils'; const EmptyModelServing: React.FC = () => { const navigate = useNavigate(); @@ -18,10 +19,12 @@ const EmptyModelServing: React.FC = () => { project, } = React.useContext(ModelServingContext); const servingPlatformStatuses = useServingPlatformStatuses(); + const isKServeNIMEnabled = project ? isProjectNIMSupported(project) : false; if ( - getProjectModelServingPlatform(project, servingPlatformStatuses).platform !== - ServingRuntimePlatform.SINGLE && + (getProjectModelServingPlatform(project, servingPlatformStatuses).platform !== + ServingRuntimePlatform.SINGLE || + isKServeNIMEnabled) && servingRuntimes.length === 0 ) { return ( diff --git a/frontend/src/pages/modelServing/screens/projects/ModelServingPlatform.tsx b/frontend/src/pages/modelServing/screens/projects/ModelServingPlatform.tsx index 848d8746d6..831c9ba6b9 100644 --- a/frontend/src/pages/modelServing/screens/projects/ModelServingPlatform.tsx +++ b/frontend/src/pages/modelServing/screens/projects/ModelServingPlatform.tsx @@ -33,10 +33,10 @@ import EmptyMultiModelServingCard from '~/pages/modelServing/screens/projects/Em import { ProjectObjectType, typedEmptyImage } from '~/concepts/design/utils'; import EmptyModelServingPlatform from '~/pages/modelServing/screens/projects/EmptyModelServingPlatform'; import EmptyNIMModelServingCard from '~/pages/modelServing/screens/projects/EmptyNIMModelServingCard'; -import { useIsNIMAvailable } from '~/pages/modelServing/screens/projects/useIsNIMAvailable'; import { isProjectNIMSupported } from '~/pages/modelServing/screens/projects/nimUtils'; -import { useDashboardNamespace } from '~/redux/selectors'; import DeployNIMServiceModal from '~/pages/modelServing/screens/projects/NIMServiceModal/DeployNIMServiceModal'; +import { useDashboardNamespace } from '~/redux/selectors'; +import { useIsNIMAvailable } from '~/pages/modelServing/screens/projects/useIsNIMAvailable'; import ManageServingRuntimeModal from './ServingRuntimeModal/ManageServingRuntimeModal'; import ModelMeshServingRuntimeTable from './ModelMeshSection/ServingRuntimeTable'; import ModelServingPlatformButtonAction from './ModelServingPlatformButtonAction'; @@ -263,23 +263,27 @@ const ModelServingPlatform: React.FC = () => { onSubmit(submit); }} /> - - getTemplateEnabledForPlatform(template, ServingRuntimePlatform.SINGLE), - )} - onClose={(submit: boolean) => { - onSubmit(submit); - }} - /> - {isNIMAvailable && ( + {!isKServeNIMEnabled ? ( + + getTemplateEnabledForPlatform(template, ServingRuntimePlatform.SINGLE), + )} + onClose={(submit: boolean) => { + onSubmit(submit); + }} + /> + ) : ( { onSubmit(submit); }}