Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the 4 edge case for main page #3599

Merged
merged 2 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Copy link
Contributor

@mturley mturley Dec 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to test the inverse case here - leave these feature flags on, and instead disable the backend components. That's what was failing before. You can remove the initHomeIntercepts call here and instead call:

  cy.interceptOdh(
    'GET /api/dsc/status',
    mockDscStatus({
      installedComponents: {
        kserve: false,
        'model-mesh': false,
        'model-registry-operator': false,
      },
    }),
  );

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

homePage.visit();
homeAISection.getModelsFlowCard().find().should('not.exist');
});
});
8 changes: 7 additions & 1 deletion frontend/src/pages/home/aiFlows/useAIFlows.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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<string | undefined>();

return React.useMemo(() => {
const hasModelServingPlatforms =
modelServingAvailable && servingPlatformStatuses.platformEnabledCount > 0;

const cards = [];
if (projectsAvailable) {
cards.push(
Expand Down Expand Up @@ -56,7 +61,7 @@ export const useAIFlows = (): React.ReactNode => {
/>,
);
}
if (modelServingAvailable || modelRegistryAvailable) {
if (hasModelServingPlatforms || modelRegistryAvailable) {
cards.push(
<AIFlowCard
key="models"
Expand Down Expand Up @@ -107,5 +112,6 @@ export const useAIFlows = (): React.ReactNode => {
projectsAvailable,
selected,
workbenchesAvailable,
servingPlatformStatuses.platformEnabledCount,
]);
};
Loading