From 0332bfffad91e67f1143e70521a923a05fc0ef2b Mon Sep 17 00:00:00 2001 From: Yulia Krimerman Date: Thu, 19 Dec 2024 14:42:50 -0500 Subject: [PATCH 1/2] fixed edge case --- .../cypress/cypress/tests/mocked/home/homeAIFlows.cy.ts | 9 +++++++++ frontend/src/pages/home/aiFlows/useAIFlows.tsx | 8 +++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/frontend/src/__tests__/cypress/cypress/tests/mocked/home/homeAIFlows.cy.ts b/frontend/src/__tests__/cypress/cypress/tests/mocked/home/homeAIFlows.cy.ts index 6bb7c02239..90a46ef804 100644 --- a/frontend/src/__tests__/cypress/cypress/tests/mocked/home/homeAIFlows.cy.ts +++ b/frontend/src/__tests__/cypress/cypress/tests/mocked/home/homeAIFlows.cy.ts @@ -103,4 +103,13 @@ describe('Home page AI Flows', () => { homeAISection.getTrainFlowCard().find().click(); homeAISection.findPipelinesTrainDescriptionText().should('not.exist'); }); + + it('should hide the models card when model registry and model serving platform components are disabled regardless of feature flags', () => { + homePage.initHomeIntercepts({ + disableModelRegistry: true, + disableModelServing: true, + }); + homePage.visit(); + homeAISection.getModelsFlowCard().find().should('not.exist'); + }); }); diff --git a/frontend/src/pages/home/aiFlows/useAIFlows.tsx b/frontend/src/pages/home/aiFlows/useAIFlows.tsx index 82730d4a0d..e28aa8fbf9 100644 --- a/frontend/src/pages/home/aiFlows/useAIFlows.tsx +++ b/frontend/src/pages/home/aiFlows/useAIFlows.tsx @@ -5,6 +5,7 @@ import useIsAreaAvailable from '~/concepts/areas/useIsAreaAvailable'; import { SupportedArea } from '~/concepts/areas'; import EvenlySpacedGallery from '~/components/EvenlySpacedGallery'; import { CreateAndTrainIcon, ModelIcon, ProjectIcon } from '~/images/icons'; +import useServingPlatformStatuses from '~/pages/modelServing/useServingPlatformStatuses'; import ProjectsGallery from './ProjectsGallery'; import CreateAndTrainGallery from './CreateAndTrainGallery'; import DeployAndMonitorGallery from './DeployAndMonitorGallery'; @@ -16,9 +17,13 @@ export const useAIFlows = (): React.ReactNode => { const { status: projectsAvailable } = useIsAreaAvailable(SupportedArea.DS_PROJECTS_VIEW); const { status: modelServingAvailable } = useIsAreaAvailable(SupportedArea.MODEL_SERVING); const { status: modelRegistryAvailable } = useIsAreaAvailable(SupportedArea.MODEL_REGISTRY); + const servingPlatformStatuses = useServingPlatformStatuses(); const [selected, setSelected] = React.useState(); return React.useMemo(() => { + const hasModelServingPlatforms = + modelServingAvailable && servingPlatformStatuses.platformEnabledCount > 0; + const cards = []; if (projectsAvailable) { cards.push( @@ -56,7 +61,7 @@ export const useAIFlows = (): React.ReactNode => { />, ); } - if (modelServingAvailable || modelRegistryAvailable) { + if (hasModelServingPlatforms || modelRegistryAvailable) { cards.push( { projectsAvailable, selected, workbenchesAvailable, + servingPlatformStatuses.platformEnabledCount, ]); }; From e25268e16e0ce80765322108cd9195719e9316de Mon Sep 17 00:00:00 2001 From: Yulia Krimerman Date: Fri, 20 Dec 2024 11:22:17 -0500 Subject: [PATCH 2/2] updated the test --- .../cypress/tests/mocked/home/homeAIFlows.cy.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/frontend/src/__tests__/cypress/cypress/tests/mocked/home/homeAIFlows.cy.ts b/frontend/src/__tests__/cypress/cypress/tests/mocked/home/homeAIFlows.cy.ts index 90a46ef804..7ea0c2286b 100644 --- a/frontend/src/__tests__/cypress/cypress/tests/mocked/home/homeAIFlows.cy.ts +++ b/frontend/src/__tests__/cypress/cypress/tests/mocked/home/homeAIFlows.cy.ts @@ -1,3 +1,4 @@ +import { mockDscStatus } from '~/__mocks__/mockDscStatus'; import { homePage } from '~/__tests__/cypress/cypress/pages/home/home'; describe('Home page AI Flows', () => { @@ -104,11 +105,17 @@ describe('Home page AI Flows', () => { homeAISection.findPipelinesTrainDescriptionText().should('not.exist'); }); - it('should hide the models card when model registry and model serving platform components are disabled regardless of feature flags', () => { - homePage.initHomeIntercepts({ - disableModelRegistry: true, - disableModelServing: true, - }); + it('should hide the models card when model serving backend components are not installed', () => { + cy.interceptOdh( + 'GET /api/dsc/status', + mockDscStatus({ + installedComponents: { + kserve: false, + 'model-mesh': false, + 'model-registry-operator': false, + }, + }), + ); homePage.visit(); homeAISection.getModelsFlowCard().find().should('not.exist'); });