Skip to content

Commit

Permalink
Edge Model Registry - Sidebar and EmptyState
Browse files Browse the repository at this point in the history
  • Loading branch information
Sara4994 committed Nov 22, 2023
1 parent e8fd4e1 commit 179ed07
Show file tree
Hide file tree
Showing 14 changed files with 102 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/dashboard-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ spec:
disableModelServing: false
disableProjectSharing: false
disableCustomServingRuntimes: false
disableEdge: false
modelMetricsNamespace: ''
```
Expand Down Expand Up @@ -136,6 +137,7 @@ spec:
disableModelServing: true
disableProjectSharing: true
disableCustomServingRuntimes: false
disableEdge: true
modelMetricsNamespace: ''
notebookController:
enabled: true
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/__mocks__/mockDashboardConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type MockDashboardConfigType = {
disablePipelines?: boolean;
disableModelServing?: boolean;
disableCustomServingRuntimes?: boolean;
disableEdge?: boolean;
};

export const mockDashboardConfig = ({
Expand All @@ -28,6 +29,7 @@ export const mockDashboardConfig = ({
disableModelServing = false,
disableCustomServingRuntimes = false,
disablePipelines = false,
disableEdge = false,
}: MockDashboardConfigType): DashboardConfigKind => ({
apiVersion: 'opendatahub.io/v1alpha',
kind: 'OdhDashboardConfig',
Expand Down Expand Up @@ -55,6 +57,7 @@ export const mockDashboardConfig = ({
disablePipelines,
modelMetricsNamespace: 'test-project',
disableProjectSharing: false,
disableEdge,
},
notebookController: {
enabled: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { test } from '@playwright/test';
import { navigateToStory } from '~/__tests__/integration/utils';

test('Empty State No models in Registry', async ({ page }) => {
await page.goto(navigateToStory('pages-edge-edgemodels', 'empty-state-no-models-in-registry'));

// wait for page to load
await page.waitForSelector('text=No models added');
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';
import { StoryFn, StoryObj } from '@storybook/react';
import EdgeModels from '~/pages/edge/EdgeModels';

export default {
component: EdgeModels,
};

const Template: StoryFn<typeof EdgeModels> = (args) => <EdgeModels {...args} />;

export const EmptyStateNoModelsInRegistry: StoryObj = {
render: Template,
};
4 changes: 2 additions & 2 deletions frontend/src/app/AppRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const ModelServingRoutes = React.lazy(() => import('../pages/modelServing/ModelS
const NotebookController = React.lazy(
() => import('../pages/notebookController/NotebookController'),
);

const EdgeModelsRoutes = React.lazy(() => import('../pages/edge/EdgeModelsRoutes'));
const GlobalPipelinesRoutes = React.lazy(() => import('../pages/pipelines/GlobalPipelinesRoutes'));
const GlobalPipelineRunsRoutes = React.lazy(
() => import('../pages/pipelines/GlobalPipelineRunsRoutes'),
Expand Down Expand Up @@ -80,7 +80,7 @@ const AppRoutes: React.FC = () => {
<Route path="/groupSettings" element={<GroupSettingsPage />} />
</>
)}

<Route path="/edge/*" element={<EdgeModelsRoutes />} />
<Route path="*" element={<NotFound />} />
</Routes>
</React.Suspense>
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/concepts/areas/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,7 @@ export const SupportedAreasStateMap: SupportedAreasState = {
requiredComponents: [StackComponent.WORKBENCHES],
reliantAreas: [SupportedArea.DS_PROJECTS_VIEW],
},
[SupportedArea.EDGE]: {
featureFlags: ['disableEdge'],
},
};
3 changes: 3 additions & 0 deletions frontend/src/concepts/areas/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ export enum SupportedArea {
CUSTOM_RUNTIMES = 'custom-serving-runtimes',
K_SERVE = 'kserve',
MODEL_MESH = 'model-mesh',

/* Edge */
EDGE = 'edge',
}

/** Components deployed by the Operator. Part of the DSC Status. */
Expand Down
1 change: 1 addition & 0 deletions frontend/src/k8sTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,7 @@ export type DashboardCommonConfig = {
disableCustomServingRuntimes: boolean;
modelMetricsNamespace: string;
disablePipelines: boolean;
disableEdge: boolean;
};

export type OperatorStatus = {
Expand Down
15 changes: 15 additions & 0 deletions frontend/src/pages/edge/EdgeModels.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import * as React from 'react';
import ApplicationsPage from '~/pages/ApplicationsPage';
import EmptyEdgeModels from './EmptyEdgeModels';

const EdgeModels: React.FC = () => (
<ApplicationsPage
title="Models"
description={''}
loaded={true}
empty={true}
emptyStatePage={<EmptyEdgeModels />}
/>
);

export default EdgeModels;
11 changes: 11 additions & 0 deletions frontend/src/pages/edge/EdgeModelsRoutes.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import * as React from 'react';
import { Routes, Route } from 'react-router-dom';
import EdgeModels from './EdgeModels';

const EdgeModelsRoutes: React.FC = () => (
<Routes>
<Route path="/models" element={<EdgeModels />} />
</Routes>
);

export default EdgeModelsRoutes;
27 changes: 27 additions & 0 deletions frontend/src/pages/edge/EmptyEdgeModels.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import * as React from 'react';
import {
EmptyState,
EmptyStateBody,
EmptyStateIcon,
PageSection,
Title,
} from '@patternfly/react-core';
import { PlusCircleIcon } from '@patternfly/react-icons';

const EmptyEdgeModels: React.FC = () => (
<PageSection isFilled>
<EmptyState>
<EmptyStateIcon icon={PlusCircleIcon} />
<Title headingLevel="h1" size="lg" style={{ marginBottom: '10px' }}>
No models added
</Title>
<EmptyStateBody style={{ margin: 'auto', width: '50%' }}>
To get started, add a model. Adding a model will also initiate a pipeline that will build
the model and its dependencies into a container image and save that image in a container
image registry.
</EmptyStateBody>
</EmptyState>
</PageSection>
);

export default EmptyEdgeModels;
10 changes: 10 additions & 0 deletions frontend/src/utilities/NavData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ const useDSPipelinesNav = (): NavDataItem[] => {
];
};

const useEdgeMVPNav = (): NavDataItem[] =>
useAreaCheck(SupportedArea.EDGE, [
{
id: 'edgemvp',
group: { id: 'edge', title: 'Edge MVP' },
children: [{ id: 'edge-model-registry', label: 'Models', href: '/edge/models' }],
},
]);

const useModelServingNav = (): NavDataItem[] =>
useAreaCheck(SupportedArea.MODEL_SERVING, [
{ id: 'modelServing', label: 'Model Serving', href: '/modelServing' },
Expand Down Expand Up @@ -162,6 +171,7 @@ export const useBuildNavData = (): NavDataItem[] => [
...useDSProjectsNav(),
...useDSPipelinesNav(),
...useModelServingNav(),
...useEdgeMVPNav(),
...useResourcesNav(),
...useSettingsNav(),
];
2 changes: 2 additions & 0 deletions manifests/crd/odhdashboardconfigs.opendatahub.io.crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ spec:
type: string
disablePipelines:
type: boolean
disableEdge:
type: boolean
groupsConfig:
type: object
required:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ spec:
disableModelServing: true
disableProjectSharing: true
disableCustomServingRuntimes: true
disableEdge: true
modelMetricsNamespace: ''
notebookController:
enabled: true
Expand Down

0 comments on commit 179ed07

Please sign in to comment.