Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
Copy link
Member Author

Choose a reason for hiding this comment

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

Fixes an existing bug where the keyword query parameter was not being applied to the catalog when navigating from another page.

Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import * as React from 'react';
import { QuickStartCatalogPage as PfQuickStartCatalogPage } from '@patternfly/quickstarts';
import {
QuickStartCatalogPage as PfQuickStartCatalogPage,
QuickStartContext,
QuickStartContextValues,
} from '@patternfly/quickstarts';
import { useTranslation } from 'react-i18next';
import { getQueryArgument } from '@console/internal/components/utils/router';
import { LoadingBox } from '@console/internal/components/utils/status-box';
import { DocumentTitle } from '@console/shared/src/components/document-title/DocumentTitle';
import { PageHeading } from '@console/shared/src/components/heading/PageHeading';
Expand All @@ -9,6 +14,15 @@ import { QuickStartEmptyState } from './QuickStartEmptyState';

const QuickStartCatalogPage: React.FC = () => {
const { t } = useTranslation('console-app');
const { setFilter } = React.useContext<QuickStartContextValues>(QuickStartContext);

React.useEffect(() => {
const keyword = getQueryArgument('keyword');
if (keyword && setFilter) {
setFilter('keyword', keyword);
}
}, [setFilter]);

return (
<>
<DocumentTitle>{t('Quick Starts')}</DocumentTitle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ describe('ExploreAdminFeaturesGettingStartedCard', () => {

expect(screen.getByText('OpenShift AI')).toBeVisible();
expect(screen.getByText('Build, deploy, and manage AI-enabled applications.')).toBeVisible();
expect(screen.getByText('Trusted Software Supply Chain')).toBeVisible();
expect(
screen.getByText('Assess risk, validate integrity, secure artifacts, release safely.'),
).toBeVisible();
expect(screen.getByText("See what's new in OpenShift 4.16")).toBeVisible();
});

Expand All @@ -39,13 +43,19 @@ describe('ExploreAdminFeaturesGettingStartedCard', () => {

await waitFor(() => {
expect(screen.getByTestId('item openshift-ai')).toBeTruthy();
expect(screen.getByTestId('item trusted-software-supply-chain')).toBeTruthy();
});

expect(screen.getByTestId('item openshift-ai')).toHaveAttribute(
'href',
'/catalog?catalogType=operator&keyword=openshift+ai&selectedId=rhods-operator-redhat-operators-openshift-marketplace',
);

expect(screen.getByTestId('item trusted-software-supply-chain')).toHaveAttribute(
'href',
'/quickstart?keyword=trusted',
);

expectExternalLinkAttributes(
screen.getByTestId('item whats-new'),
'https://www.openshift.com/learn/whats-new',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ export const ExploreAdminFeaturesGettingStartedCard: React.FC = () => {
href:
'/catalog?catalogType=operator&keyword=openshift+ai&selectedId=rhods-operator-redhat-operators-openshift-marketplace',
},
{
id: 'trusted-software-supply-chain',
title: t('public~Trusted Software Supply Chain'),
description: t('public~Assess risk, validate integrity, secure artifacts, release safely.'),
href: '/quickstart?keyword=trusted',
},
...(showLightSpeedLink
? [
{
Expand Down
2 changes: 2 additions & 0 deletions frontend/public/locales/en/public.json
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,8 @@
"Add identity providers": "Add identity providers",
"OpenShift AI": "OpenShift AI",
"Build, deploy, and manage AI-enabled applications.": "Build, deploy, and manage AI-enabled applications.",
"Trusted Software Supply Chain": "Trusted Software Supply Chain",
"Assess risk, validate integrity, secure artifacts, release safely.": "Assess risk, validate integrity, secure artifacts, release safely.",
"OpenShift Lightspeed": "OpenShift Lightspeed",
"Your personal AI helper.": "Your personal AI helper.",
"French and Spanish now available": "French and Spanish now available",
Expand Down