From cee9af00be15bcae9e46a5c17d6f02736ddec4b5 Mon Sep 17 00:00:00 2001 From: gitdallas <5322142+gitdallas@users.noreply.github.com> Date: Tue, 7 May 2024 15:29:57 -0500 Subject: [PATCH] feat(mr): routes etc and empty state for registered deployments Signed-off-by: gitdallas <5322142+gitdallas@users.noreply.github.com> --- .../modelRegistry/ModelRegistryRoutes.tsx | 4 ++ .../screens/EmptyModelRegistryState.tsx | 40 ++++++++++--------- .../ModelVersionDetailsTabs.tsx | 14 ++++--- .../ModelVersionRegisteredDeploymentsView.tsx | 20 ++++++++++ 4 files changed, 54 insertions(+), 24 deletions(-) create mode 100644 frontend/src/pages/modelRegistry/screens/ModelVersionDetails/ModelVersionRegisteredDeploymentsView.tsx diff --git a/frontend/src/pages/modelRegistry/ModelRegistryRoutes.tsx b/frontend/src/pages/modelRegistry/ModelRegistryRoutes.tsx index 1efe05a190..5577932e0d 100644 --- a/frontend/src/pages/modelRegistry/ModelRegistryRoutes.tsx +++ b/frontend/src/pages/modelRegistry/ModelRegistryRoutes.tsx @@ -36,6 +36,10 @@ const ModelRegistryRoutes: React.FC = () => ( path={ModelVersionDetailsTab.DETAILS} element={} /> + } + /> } /> } /> diff --git a/frontend/src/pages/modelRegistry/screens/EmptyModelRegistryState.tsx b/frontend/src/pages/modelRegistry/screens/EmptyModelRegistryState.tsx index 3b62e2312e..2190f60bc8 100644 --- a/frontend/src/pages/modelRegistry/screens/EmptyModelRegistryState.tsx +++ b/frontend/src/pages/modelRegistry/screens/EmptyModelRegistryState.tsx @@ -15,8 +15,8 @@ import * as React from 'react'; type EmptyModelRegistryStateType = { title: string; description: string; - primaryActionText: string; - primaryActionOnClick: () => void; + primaryActionText?: string; + primaryActionOnClick?: () => void; secondaryActionText?: string; secondaryActionOnClick?: () => void; }; @@ -29,28 +29,30 @@ const EmptyModelRegistryState: React.FC = ({ primaryActionOnClick, secondaryActionOnClick, }) => ( - + } /> {description} - + {primaryActionText && ( + + )} + {secondaryActionText && ( + + )} - {secondaryActionText && ( - - )} ); diff --git a/frontend/src/pages/modelRegistry/screens/ModelVersionDetails/ModelVersionDetailsTabs.tsx b/frontend/src/pages/modelRegistry/screens/ModelVersionDetails/ModelVersionDetailsTabs.tsx index 232095917b..5667d303d0 100644 --- a/frontend/src/pages/modelRegistry/screens/ModelVersionDetails/ModelVersionDetailsTabs.tsx +++ b/frontend/src/pages/modelRegistry/screens/ModelVersionDetails/ModelVersionDetailsTabs.tsx @@ -1,9 +1,11 @@ import * as React from 'react'; +import { useNavigate } from 'react-router-dom'; import { PageSection, Tab, Tabs, TabTitleText } from '@patternfly/react-core'; import '~/pages/pipelines/global/runs/GlobalPipelineRunsTabs.scss'; import { ModelVersion } from '~/concepts/modelRegistry/types'; import { ModelVersionDetailsTabTitle, ModelVersionDetailsTab } from './const'; import ModelVersionDetailsView from './ModelVersionDetailsView'; +import ModelVersionRegisteredDeploymentsView from './ModelVersionRegisteredDeploymentsView'; type ModelVersionDetailTabsProps = { tab: ModelVersionDetailsTab; @@ -13,12 +15,14 @@ type ModelVersionDetailTabsProps = { const ModelVersionDetailsTabs: React.FC = ({ tab, modelVersion: mv, -}) => ( - { + const navigate = useNavigate(); + return ( navigate(`../${eventKey}`, { relative: 'path' })} > = ({ data-testid="registered-deployments-tab" > - {/* TODO: Fill Model Details Page Component here */} + - -); + ); +}; export default ModelVersionDetailsTabs; diff --git a/frontend/src/pages/modelRegistry/screens/ModelVersionDetails/ModelVersionRegisteredDeploymentsView.tsx b/frontend/src/pages/modelRegistry/screens/ModelVersionDetails/ModelVersionRegisteredDeploymentsView.tsx new file mode 100644 index 0000000000..19e4a1d50b --- /dev/null +++ b/frontend/src/pages/modelRegistry/screens/ModelVersionDetails/ModelVersionRegisteredDeploymentsView.tsx @@ -0,0 +1,20 @@ +import * as React from 'react'; +import { ModelVersion } from '~/concepts/modelRegistry/types'; +import useModelArtifactsByVersionId from '~/concepts/modelRegistry/apiHooks/useModelArtifactsByVersionId'; +import EmptyModelRegistryState from '../EmptyModelRegistryState'; + +type ModelVersionRegisteredDeploymentsViewProps = { + modelVersion: ModelVersion; +}; + +const ModelVersionRegisteredDeploymentsView: React.FC = ({ modelVersion: mv }) => { + const [modelArtifact] = useModelArtifactsByVersionId(mv.id); + console.log(modelArtifact); + return ( + + ); +}; +export default ModelVersionRegisteredDeploymentsView;