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

fix(productViewMissing): ent-3913 apply platform appNavClick #695

Merged
merged 2 commits into from
Jun 7, 2021
Merged
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
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"plugin:jsdoc/recommended"
],
"globals": {
"mockHook": "readonly",
"mountHookComponent": "readonly",
"mockWindowLocation": "readonly"
},
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"!src/index.js",
"!src/setupTests.js",
"!src/components/app.js",
"!src/components/**/index.js",
"!src/common/index.js",
"!src/redux/index.js",
"!src/redux/store.js",
Expand Down
1 change: 0 additions & 1 deletion public/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@
"tourDescription": "We'll walk you through each step, and include insight into how Red Hat collects and uses subscription data."
},
"curiosity-view": {
"redirectError": "Redirect failed",
"title": "{{appName}}",
"subtitle": "Monitor your usage based on your subscription terms. <0>Learn more about {{appName}} reporting</0>",
"description": "Monitor your usage based on your subscription terms.",
Expand Down
2 changes: 1 addition & 1 deletion src/components/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { NotificationsPortal } from '@redhat-cloud-services/frontend-components-
import { connectRouter, reduxActions } from '../redux';
import { helpers } from '../common/helpers';
import { I18n } from './i18n/i18n';
import { Router } from './router/router';
import { Router } from './router';
import Authentication from './authentication/authentication';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,123 @@ exports[`Authentication Component should return a message on 401 error: 401 erro
`;

exports[`Authentication Component should return a redirect on 418 error: 418 error 1`] = `
<withRouter(Redirect)
isRedirect={true}
<Redirect
baseName="/"
isForced={false}
route="/optin"
routes={
Array [
Object {
"activateOnError": false,
"component": "productView/productViewRhel",
"disabled": false,
"exact": true,
"id": "rhel",
"path": "/rhel",
"redirect": null,
},
Object {
"activateOnError": false,
"component": "productView/productViewRhel",
"disabled": false,
"exact": true,
"id": "rhel-arm",
"path": "/rhel-arm",
"redirect": null,
},
Object {
"activateOnError": false,
"component": "productView/productViewRhel",
"disabled": false,
"exact": true,
"id": "rhel-ibmpower",
"path": "/rhel-ibmpower",
"redirect": null,
},
Object {
"activateOnError": false,
"component": "productView/productViewRhel",
"disabled": false,
"exact": true,
"id": "rhel-ibmz",
"path": "/rhel-ibmz",
"redirect": null,
},
Object {
"activateOnError": false,
"component": "productView/productViewRhel",
"disabled": false,
"exact": true,
"id": "rhel-x86",
"path": "/rhel-x86",
"redirect": null,
},
Object {
"activateOnError": false,
"component": "productView/productViewOpenShiftContainer",
"disabled": false,
"exact": true,
"id": "openshift-container",
"path": "/openshift-container",
"redirect": null,
},
Object {
"activateOnError": false,
"component": "productView/productViewOpenShiftDedicated",
"disabled": false,
"exact": true,
"id": "openshift-dedicated",
"path": "/openshift-dedicated",
"redirect": null,
},
Object {
"activateOnError": false,
"component": "productView/productViewSatellite",
"disabled": false,
"exact": true,
"id": "satellite",
"path": "/satellite",
"redirect": null,
},
Object {
"activateOnError": false,
"component": "productView/productViewSatellite",
"disabled": false,
"exact": true,
"id": "satellite-capsule",
"path": "/satellite-capsule",
"redirect": null,
},
Object {
"activateOnError": false,
"component": "productView/productViewSatellite",
"disabled": false,
"exact": true,
"id": "satellite-server",
"path": "/satellite-server",
"redirect": null,
},
Object {
"activateOnError": true,
"component": "optinView/optinView",
"disabled": false,
"exact": true,
"id": "optin",
"path": "/optin",
"redirect": null,
},
Object {
"activateOnError": false,
"component": "productView/productViewMissing",
"disabled": false,
"exact": true,
"id": "missing",
"path": "/",
"redirect": "/",
},
]
}
url={null}
/>
`;

Expand All @@ -313,8 +427,122 @@ exports[`Authentication Component should return a redirect on a specific 403 err
`;

exports[`Authentication Component should return a redirect on a specific 403 error and error code: 403 redirect error 1`] = `
<withRouter(Redirect)
isRedirect={true}
<Redirect
baseName="/"
isForced={false}
route="/optin"
routes={
Array [
Object {
"activateOnError": false,
"component": "productView/productViewRhel",
"disabled": false,
"exact": true,
"id": "rhel",
"path": "/rhel",
"redirect": null,
},
Object {
"activateOnError": false,
"component": "productView/productViewRhel",
"disabled": false,
"exact": true,
"id": "rhel-arm",
"path": "/rhel-arm",
"redirect": null,
},
Object {
"activateOnError": false,
"component": "productView/productViewRhel",
"disabled": false,
"exact": true,
"id": "rhel-ibmpower",
"path": "/rhel-ibmpower",
"redirect": null,
},
Object {
"activateOnError": false,
"component": "productView/productViewRhel",
"disabled": false,
"exact": true,
"id": "rhel-ibmz",
"path": "/rhel-ibmz",
"redirect": null,
},
Object {
"activateOnError": false,
"component": "productView/productViewRhel",
"disabled": false,
"exact": true,
"id": "rhel-x86",
"path": "/rhel-x86",
"redirect": null,
},
Object {
"activateOnError": false,
"component": "productView/productViewOpenShiftContainer",
"disabled": false,
"exact": true,
"id": "openshift-container",
"path": "/openshift-container",
"redirect": null,
},
Object {
"activateOnError": false,
"component": "productView/productViewOpenShiftDedicated",
"disabled": false,
"exact": true,
"id": "openshift-dedicated",
"path": "/openshift-dedicated",
"redirect": null,
},
Object {
"activateOnError": false,
"component": "productView/productViewSatellite",
"disabled": false,
"exact": true,
"id": "satellite",
"path": "/satellite",
"redirect": null,
},
Object {
"activateOnError": false,
"component": "productView/productViewSatellite",
"disabled": false,
"exact": true,
"id": "satellite-capsule",
"path": "/satellite-capsule",
"redirect": null,
},
Object {
"activateOnError": false,
"component": "productView/productViewSatellite",
"disabled": false,
"exact": true,
"id": "satellite-server",
"path": "/satellite-server",
"redirect": null,
},
Object {
"activateOnError": true,
"component": "optinView/optinView",
"disabled": false,
"exact": true,
"id": "optin",
"path": "/optin",
"redirect": null,
},
Object {
"activateOnError": false,
"component": "productView/productViewMissing",
"disabled": false,
"exact": true,
"id": "missing",
"path": "/",
"redirect": "/",
},
]
}
url={null}
/>
`;
4 changes: 2 additions & 2 deletions src/components/authentication/authentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { NotAuthorized } from '@redhat-cloud-services/frontend-components/NotAut
import { connectRouter, reduxActions, reduxSelectors } from '../../redux';
import { rhsmApiTypes } from '../../types';
import { helpers } from '../../common';
import { Redirect, routerHelpers } from '../router/router';
import { routerHelpers, Redirect } from '../router';
import MessageView from '../messageView/messageView';
import { translate } from '../i18n/i18n';

Expand Down Expand Up @@ -85,7 +85,7 @@ class Authentication extends Component {
(session.errorCodes && session.errorCodes.includes(rhsmApiTypes.RHSM_API_RESPONSE_ERROR_DATA_CODE_TYPES.OPTIN)) ||
session.status === 418
) {
return <Redirect isRedirect route={routerHelpers.getErrorRoute.path} />;
return <Redirect route={routerHelpers.getErrorRoute.path} />;
}

return (
Expand Down
9 changes: 0 additions & 9 deletions src/components/i18n/__tests__/__snapshots__/i18n.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -382,15 +382,6 @@ Array [
},
],
},
Object {
"file": "./src/components/router/redirect.js",
"keys": Array [
Object {
"key": "curiosity-view.redirectError",
"match": "t('curiosity-view.redirectError')",
},
],
},
Object {
"file": "./src/components/table/table.js",
"keys": Array [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ProductViewMissing Component should redirect when there are limited product cards: redirect action 1`] = `
Array [
Array [
Object {
"meta": Object {
"appName": undefined,
"id": "rhel",
"secondaryNav": undefined,
},
"payload": Promise {},
"type": "PLATFORM_SET_NAV",
},
],
]
`;

exports[`ProductViewMissing Component should render a non-connected component: non-connected 1`] = `
<PageLayout
className="curiosity-missing-view"
Expand Down Expand Up @@ -147,42 +163,6 @@ exports[`ProductViewMissing Component should render a predictable set of product
<Gallery
hasGutter={true}
>
<Card
isHoverable={true}
key="missingViewCard-rhel"
onClick={[Function]}
>
<CardTitle>
<Title
headingLevel="h2"
size="lg"
>
t(curiosity-view.title, {"appName":"Subscriptions","context":"RHEL"})
</Title>
</CardTitle>
<CardBody
className="curiosity-missing-view__card-description"
>
t(curiosity-view.description, {"appName":"Subscriptions","context":"RHEL"})
</CardBody>
<CardFooter>
<Button
icon={
<ArrowRightIcon
color="currentColor"
noVerticalAlign={false}
size="sm"
/>
}
iconPosition="right"
isInline={true}
onClick={[Function]}
variant="link"
>
Open
</Button>
</CardFooter>
</Card>
<Card
isHoverable={true}
key="missingViewCard-openshift-container"
Expand Down
Loading