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 <[email protected]>
  • Loading branch information
gitdallas committed May 9, 2024
1 parent ee7e684 commit cee9af0
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 24 deletions.
4 changes: 4 additions & 0 deletions frontend/src/pages/modelRegistry/ModelRegistryRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ 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} />}

Check failure on line 41 in frontend/src/pages/modelRegistry/ModelRegistryRoutes.tsx

View workflow job for this annotation

GitHub Actions / Tests (18.x)

Replace `<ModelVersionsDetails·tab={ModelVersionDetailsTab.REGISTERED_DEPLOYMENTS}·empty={false}·/>` with `⏎················<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 @@ -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;
};
Expand All @@ -29,28 +29,30 @@ const EmptyModelRegistryState: React.FC<EmptyModelRegistryStateType> = ({
primaryActionOnClick,
secondaryActionOnClick,
}) => (
<EmptyState variant={EmptyStateVariant.sm} data-testid="empty-model-registry">
<EmptyState variant={EmptyStateVariant.lg} data-testid="empty-model-registry">
<EmptyStateHeader titleText={title} icon={<EmptyStateIcon icon={PlusCircleIcon} />} />
<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 @@ -13,12 +15,14 @@ type ModelVersionDetailTabsProps = {
const ModelVersionDetailsTabs: React.FC<ModelVersionDetailTabsProps> = ({
tab,
modelVersion: mv,
}) => (
<Tabs
}) => {
const navigate = useNavigate();
return (<Tabs

Check failure on line 20 in frontend/src/pages/modelRegistry/screens/ModelVersionDetails/ModelVersionDetailsTabs.tsx

View workflow job for this annotation

GitHub Actions / Tests (18.x)

Insert `⏎····`
activeKey={tab}

Check failure on line 21 in frontend/src/pages/modelRegistry/screens/ModelVersionDetails/ModelVersionDetailsTabs.tsx

View workflow job for this annotation

GitHub Actions / Tests (18.x)

Insert `··`
aria-label="Model versions details page tabs"

Check failure on line 22 in frontend/src/pages/modelRegistry/screens/ModelVersionDetails/ModelVersionDetailsTabs.tsx

View workflow job for this annotation

GitHub Actions / Tests (18.x)

Replace `····` with `······`
role="region"

Check failure on line 23 in frontend/src/pages/modelRegistry/screens/ModelVersionDetails/ModelVersionDetailsTabs.tsx

View workflow job for this annotation

GitHub Actions / Tests (18.x)

Insert `··`
data-testid="model-versions-details-page-tabs"

Check failure on line 24 in frontend/src/pages/modelRegistry/screens/ModelVersionDetails/ModelVersionDetailsTabs.tsx

View workflow job for this annotation

GitHub Actions / Tests (18.x)

Replace `····` with `······`
onSelect={(_event, eventKey) => navigate(`../${eventKey}`, { relative: 'path' })}

Check failure on line 25 in frontend/src/pages/modelRegistry/screens/ModelVersionDetails/ModelVersionDetailsTabs.tsx

View workflow job for this annotation

GitHub Actions / Tests (18.x)

Insert `··`
>

Check failure on line 26 in frontend/src/pages/modelRegistry/screens/ModelVersionDetails/ModelVersionDetailsTabs.tsx

View workflow job for this annotation

GitHub Actions / Tests (18.x)

Replace `··` with `····`
<Tab

Check failure on line 27 in frontend/src/pages/modelRegistry/screens/ModelVersionDetails/ModelVersionDetailsTabs.tsx

View workflow job for this annotation

GitHub Actions / Tests (18.x)

Insert `··`
eventKey={ModelVersionDetailsTab.DETAILS}

Check failure on line 28 in frontend/src/pages/modelRegistry/screens/ModelVersionDetails/ModelVersionDetailsTabs.tsx

View workflow job for this annotation

GitHub Actions / Tests (18.x)

Insert `··`
Expand All @@ -37,10 +41,10 @@ const ModelVersionDetailsTabs: React.FC<ModelVersionDetailTabsProps> = ({
data-testid="registered-deployments-tab"
>
<PageSection isFilled variant="light" data-testid="registered-deployments-tab-content">
{/* TODO: Fill Model Details Page Component here */}
<ModelVersionRegisteredDeploymentsView modelVersion={mv} />
</PageSection>
</Tab>
</Tabs>
);
</Tabs>);
};

export default ModelVersionDetailsTabs;
Original file line number Diff line number Diff line change
@@ -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';

Check warning on line 4 in frontend/src/pages/modelRegistry/screens/ModelVersionDetails/ModelVersionRegisteredDeploymentsView.tsx

View workflow job for this annotation

GitHub Actions / Tests (18.x)

import statements should have an absolute path

type ModelVersionRegisteredDeploymentsViewProps = {
modelVersion: ModelVersion;
};

const ModelVersionRegisteredDeploymentsView: React.FC<ModelVersionRegisteredDeploymentsViewProps> = ({ modelVersion: mv }) => {
const [modelArtifact] = useModelArtifactsByVersionId(mv.id);
console.log(modelArtifact);
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 cee9af0

Please sign in to comment.