Skip to content

Commit

Permalink
Show error state on global serving page when the platform in not inst…
Browse files Browse the repository at this point in the history
…alled
  • Loading branch information
DaoDaoNoCode committed Nov 13, 2023
1 parent 42914d0 commit 28be8d2
Showing 1 changed file with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ModelServingContext } from '~/pages/modelServing/ModelServingContext';
import useServingPlatformStatuses from '~/pages/modelServing/useServingPlatformStatuses';
import { byName, ProjectsContext } from '~/concepts/projects/ProjectsContext';
import InvalidProject from '~/concepts/projects/InvalidProject';
import { getProjectModelServingPlatform } from '~/pages/modelServing/screens/projects/utils';
import EmptyModelServing from './EmptyModelServing';
import InferenceServiceListView from './InferenceServiceListView';
import ModelServingProjectSelection from './ModelServingProjectSelection';
Expand All @@ -20,19 +21,25 @@ const ModelServingGlobal: React.FC = () => {
servingRuntimes: { data: servingRuntimes },
inferenceServices: { data: inferenceServices },
} = React.useContext(ModelServingContext);
const { dataScienceProjects: projects } = React.useContext(ProjectsContext);

const { namespace } = useParams<{ namespace: string }>();
const currentProject = projects.find(byName(namespace));
const servingPlatformStatuses = useServingPlatformStatuses();
const {
kServe: { installed: kServeInstalled },
modelMesh: { installed: modelMeshInstalled },
} = useServingPlatformStatuses();
} = servingPlatformStatuses;

const { error: notInstalledError } = getProjectModelServingPlatform(
currentProject,
servingPlatformStatuses,
);

const loadError =
!kServeInstalled && !modelMeshInstalled
? new Error('No model serving platform installed')
: undefined;

const { dataScienceProjects: projects } = React.useContext(ProjectsContext);
const { namespace } = useParams<{ namespace: string }>();
: notInstalledError;

let renderStateProps: ApplicationPageRenderState = {
empty: false,
Expand All @@ -51,7 +58,7 @@ const ModelServingGlobal: React.FC = () => {
emptyStatePage: <EmptyModelServing />,
};
}
if (namespace && !projects.find(byName(namespace))) {
if (namespace && !currentProject) {
renderStateProps = {
empty: true,
emptyStatePage: (
Expand Down

0 comments on commit 28be8d2

Please sign in to comment.