Skip to content

Commit

Permalink
feat(mr): routes etc and empty state for registered deployments
Browse files Browse the repository at this point in the history
Signed-off-by: gitdallas <5322142+gitdallas@users.noreply.github.com>
  • Loading branch information
gitdallas committed May 13, 2024
1 parent 93c0851 commit e80751a
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 46 deletions.
9 changes: 9 additions & 0 deletions frontend/src/pages/modelRegistry/ModelRegistryRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ const ModelRegistryRoutes: React.FC = () => (
path={ModelVersionDetailsTab.DETAILS}
element={<ModelVersionsDetails tab={ModelVersionDetailsTab.DETAILS} empty={false} />}
/>
<Route
path={ModelVersionDetailsTab.REGISTERED_DEPLOYMENTS}
element={
<ModelVersionsDetails
tab={ModelVersionDetailsTab.REGISTERED_DEPLOYMENTS}
empty={false}
/>
}
/>
<Route path="*" element={<Navigate to="." />} />
</Route>
<Route path="*" element={<Navigate to="." />} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ type EmptyModelRegistryStateType = {
testid?: string;
title: string;
description: string;
primaryActionText: string;
primaryActionOnClick: () => void;
primaryActionText?: string;
primaryActionOnClick?: () => void;
secondaryActionText?: string;
secondaryActionOnClick?: () => void;
};
Expand All @@ -36,23 +36,25 @@ const EmptyModelRegistryState: React.FC<EmptyModelRegistryStateType> = ({
<EmptyStateBody>{description}</EmptyStateBody>
<EmptyStateFooter>
<EmptyStateActions>
<Button
data-testid="empty-model-registry-primary-action"
variant={ButtonVariant.primary}
onClick={primaryActionOnClick}
>
{primaryActionText}
</Button>
{primaryActionText && (
<Button
data-testid="empty-model-registry-primary-action"
variant={ButtonVariant.primary}
onClick={primaryActionOnClick}
>
{primaryActionText}
</Button>
)}
{secondaryActionText && (
<Button
data-testid="empty-model-registry-secondary-action"
variant="link"
onClick={secondaryActionOnClick}
>
{secondaryActionText}
</Button>
)}
</EmptyStateActions>
{secondaryActionText && (
<Button
data-testid="empty-model-registry-secondary-action"
variant="link"
onClick={secondaryActionOnClick}
>
{secondaryActionText}
</Button>
)}
</EmptyStateFooter>
</EmptyState>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -15,34 +17,38 @@ const ModelVersionDetailsTabs: React.FC<ModelVersionDetailTabsProps> = ({
tab,
modelVersion: mv,
refresh,
}) => (
<Tabs
activeKey={tab}
aria-label="Model versions details page tabs"
role="region"
data-testid="model-versions-details-page-tabs"
>
<Tab
eventKey={ModelVersionDetailsTab.DETAILS}
title={<TabTitleText>{ModelVersionDetailsTabTitle.DETAILS}</TabTitleText>}
aria-label="Model versions details tab"
data-testid="model-versions-details-tab"
}) => {
const navigate = useNavigate();
return (
<Tabs
activeKey={tab}
aria-label="Model versions details page tabs"
role="region"
data-testid="model-versions-details-page-tabs"
onSelect={(_event, eventKey) => navigate(`../${eventKey}`, { relative: 'path' })}
>
<PageSection isFilled variant="light" data-testid="model-versions-details-tab-content">
<ModelVersionDetailsView modelVersion={mv} refresh={refresh} />
</PageSection>
</Tab>
<Tab
eventKey={ModelVersionDetailsTab.REGISTERED_DEPLOYMENTS}
title={<TabTitleText>{ModelVersionDetailsTabTitle.REGISTERED_DEPLOYMENTS}</TabTitleText>}
aria-label="Registered deployments tab"
data-testid="registered-deployments-tab"
>
<PageSection isFilled variant="light" data-testid="registered-deployments-tab-content">
{/* TODO: Fill Model Details Page Component here */}
</PageSection>
</Tab>
</Tabs>
);
<Tab
eventKey={ModelVersionDetailsTab.DETAILS}
title={<TabTitleText>{ModelVersionDetailsTabTitle.DETAILS}</TabTitleText>}
aria-label="Model versions details tab"
data-testid="model-versions-details-tab"
>
<PageSection isFilled variant="light" data-testid="model-versions-details-tab-content">
<ModelVersionDetailsView modelVersion={mv} refresh={refresh} />
</PageSection>
</Tab>
<Tab
eventKey={ModelVersionDetailsTab.REGISTERED_DEPLOYMENTS}
title={<TabTitleText>{ModelVersionDetailsTabTitle.REGISTERED_DEPLOYMENTS}</TabTitleText>}
aria-label="Registered deployments tab"
data-testid="registered-deployments-tab"
>
<PageSection isFilled variant="light" data-testid="registered-deployments-tab-content">
<ModelVersionRegisteredDeploymentsView modelVersion={mv} />
</PageSection>
</Tab>
</Tabs>
);
};

export default ModelVersionDetailsTabs;
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import * as React from 'react';
import { ModelVersion } from '~/concepts/modelRegistry/types';
import EmptyModelRegistryState from '~/pages/modelRegistry/screens/EmptyModelRegistryState';

type ModelVersionRegisteredDeploymentsViewProps = {
modelVersion: ModelVersion;
};

const ModelVersionRegisteredDeploymentsView: React.FC<
ModelVersionRegisteredDeploymentsViewProps
> = ({ modelVersion: mv }) => {
// eslint-disable-next-line no-console
console.log({ mv });
//TODO: implement component
return (
<EmptyModelRegistryState
title="No registered deployments"
description="You can deploy this version using Actions dropdown in the header"
/>
);
};
export default ModelVersionRegisteredDeploymentsView;

0 comments on commit e80751a

Please sign in to comment.