diff --git a/src/components/authentication/authentication.js b/src/components/authentication/authentication.js index d0884d8a2..ec32ef5bf 100644 --- a/src/components/authentication/authentication.js +++ b/src/components/authentication/authentication.js @@ -42,7 +42,7 @@ class Authentication extends Component { hideGlobalFilter(); const appNav = onNavigation(event => { - const { routeHref } = routerHelpers.getNavRouteDetail({ id: event.navId, returnDefault: true }); + const { routeHref } = routerHelpers.getNavRouteDetail({ id: event.navId }); history.push(routeHref); }); diff --git a/src/components/router/__tests__/__snapshots__/router.test.js.snap b/src/components/router/__tests__/__snapshots__/router.test.js.snap index eea3e12ab..10954e6d5 100644 --- a/src/components/router/__tests__/__snapshots__/router.test.js.snap +++ b/src/components/router/__tests__/__snapshots__/router.test.js.snap @@ -91,10 +91,8 @@ exports[`Router Component should render a basic component: basic 1`] = ` }, "disabled": false, "exact": true, - "id": "rhel-sw", - "redirect": "/rhel-sw/all", "render": true, - "to": "/rhel-sw/:variant(all|arm|ibmpower|ibmz|x86)", + "to": "/:variant(rhel|rhel-arm|rhel-ibmpower|rhel-ibmz|rhel-x86)", }, Object { "component": Object { @@ -106,7 +104,7 @@ exports[`Router Component should render a basic component: basic 1`] = ` "disabled": false, "exact": true, "render": true, - "to": "/openshift-sw", + "to": "/openshift-container", }, Object { "component": Object { @@ -117,9 +115,8 @@ exports[`Router Component should render a basic component: basic 1`] = ` }, "disabled": false, "exact": true, - "id": "openshift-sw", "render": true, - "to": "/openshift-sw/ocp", + "to": "/openshift-dedicated", }, Object { "component": Object { @@ -131,20 +128,7 @@ exports[`Router Component should render a basic component: basic 1`] = ` "disabled": false, "exact": true, "render": true, - "to": "/openshift-sw/dedicated", - }, - Object { - "component": Object { - "$$typeof": Symbol(react.lazy), - "_ctor": [Function], - "_result": null, - "_status": -1, - }, - "disabled": false, - "exact": true, - "id": "satellite-sw", - "render": true, - "to": "/satellite-sw/:variant(all|satellite-capsule|satellite-server)", + "to": "/:variant(satellite|satellite-capsule|satellite-server)", }, Object { "activateOnError": true, @@ -156,7 +140,6 @@ exports[`Router Component should render a basic component: basic 1`] = ` }, "disabled": false, "exact": true, - "id": "optin", "render": true, "to": "/optin", }, @@ -166,32 +149,26 @@ exports[`Router Component should render a basic component: basic 1`] = ` - - `; diff --git a/src/components/router/__tests__/__snapshots__/routerConfig.test.js.snap b/src/components/router/__tests__/__snapshots__/routerConfig.test.js.snap index 2a320b1e4..cb436f880 100644 --- a/src/components/router/__tests__/__snapshots__/routerConfig.test.js.snap +++ b/src/components/router/__tests__/__snapshots__/routerConfig.test.js.snap @@ -6,93 +6,82 @@ exports[`RouterConfig should return specific properties: navigation 1`] = ` Array [ Object { "default": true, - "id": "all", - "path": "/rhel-sw/all", - "pathId": "rhel-sw", + "id": "rhel", + "path": "/rhel", "pathParameter": "RHEL", "productParameter": "RHEL", "viewParameter": "viewRHEL", }, Object { - "id": "arm", - "path": "/rhel-sw/arm", - "pathId": "rhel-sw", + "id": "rhel-arm", + "path": "/rhel-arm", "pathParameter": "RHEL for ARM", "productParameter": "RHEL", "viewParameter": "viewRHEL", }, Object { - "id": "ibmpower", - "path": "/rhel-sw/ibmpower", - "pathId": "rhel-sw", + "id": "rhel-ibmpower", + "path": "/rhel-ibmpower", "pathParameter": "RHEL for IBM Power", "productParameter": "RHEL", "viewParameter": "viewRHEL", }, Object { - "id": "ibmz", - "path": "/rhel-sw/ibmz", - "pathId": "rhel-sw", + "id": "rhel-ibmz", + "path": "/rhel-ibmz", "pathParameter": "RHEL for IBM z", "productParameter": "RHEL", "viewParameter": "viewRHEL", }, Object { - "id": "x86", - "path": "/rhel-sw/x86", - "pathId": "rhel-sw", + "id": "rhel-x86", + "path": "/rhel-x86", "pathParameter": "RHEL for x86", "productParameter": "RHEL", "viewParameter": "viewRHEL", }, Object { - "id": "openshift-sw", - "path": "/openshift-sw", - "pathId": "openshift-sw", + "id": "openshift-container", + "path": "/openshift-container", "pathParameter": "OpenShift Container Platform", "productParameter": "OpenShift Container Platform", "viewParameter": "viewOpenShift Container Platform", }, Object { - "id": "ocp", - "path": "/openshift-sw/ocp", - "pathId": "openshift-sw", - "pathParameter": "OpenShift Container Platform", - "productParameter": "OpenShift Container Platform", - "viewParameter": "viewOpenShift Container Platform", - }, - Object { - "id": "dedicated", - "path": "/openshift-sw/dedicated", - "pathId": "openshift-sw", + "id": "openshift-dedicated", + "path": "/openshift-dedicated", "pathParameter": "OpenShift-dedicated-metrics", "productParameter": "OpenShift-dedicated-metrics", "viewParameter": "viewOpenShift-dedicated-metrics", }, Object { - "id": "satellite-sw", - "path": "/satellite-sw/all", - "pathId": "satellite-sw", + "id": "satellite", + "path": "/satellite", "pathParameter": "Satellite", "productParameter": "Satellite", "viewParameter": "viewSatellite", }, Object { "id": "satellite-capsule", - "path": "/satellite-sw/satellite-capsule", - "pathId": "satellite-sw", + "path": "/satellite-capsule", "pathParameter": "Satellite Capsule", "productParameter": "Satellite", "viewParameter": "viewSatellite", }, Object { "id": "satellite-server", - "path": "/satellite-sw/satellite-server", - "pathId": "satellite-sw", + "path": "/satellite-server", "pathParameter": "Satellite Server", "productParameter": "Satellite", "viewParameter": "viewSatellite", }, + Object { + "id": "optin", + "path": "/optin", + "pathParameter": null, + "productParameter": null, + "viewParameter": null, + }, ] `; @@ -102,20 +91,6 @@ exports[`RouterConfig should return specific properties: platformModalRedirect 1 exports[`RouterConfig should return specific properties: routes 1`] = ` Array [ - Object { - "component": Object { - "$$typeof": Symbol(react.lazy), - "_ctor": [Function], - "_result": null, - "_status": -1, - }, - "disabled": false, - "exact": true, - "id": "rhel-sw", - "redirect": "/rhel-sw/all", - "render": true, - "to": "/rhel-sw/:variant(all|arm|ibmpower|ibmz|x86)", - }, Object { "component": Object { "$$typeof": Symbol(react.lazy), @@ -126,7 +101,7 @@ Array [ "disabled": false, "exact": true, "render": true, - "to": "/openshift-sw", + "to": "/:variant(rhel|rhel-arm|rhel-ibmpower|rhel-ibmz|rhel-x86)", }, Object { "component": Object { @@ -137,9 +112,8 @@ Array [ }, "disabled": false, "exact": true, - "id": "openshift-sw", "render": true, - "to": "/openshift-sw/ocp", + "to": "/openshift-container", }, Object { "component": Object { @@ -151,7 +125,7 @@ Array [ "disabled": false, "exact": true, "render": true, - "to": "/openshift-sw/dedicated", + "to": "/openshift-dedicated", }, Object { "component": Object { @@ -162,9 +136,8 @@ Array [ }, "disabled": false, "exact": true, - "id": "satellite-sw", "render": true, - "to": "/satellite-sw/:variant(all|satellite-capsule|satellite-server)", + "to": "/:variant(satellite|satellite-capsule|satellite-server)", }, Object { "activateOnError": true, @@ -176,7 +149,6 @@ Array [ }, "disabled": false, "exact": true, - "id": "optin", "render": true, "to": "/optin", }, diff --git a/src/components/router/__tests__/__snapshots__/routerHelpers.test.js.snap b/src/components/router/__tests__/__snapshots__/routerHelpers.test.js.snap index 086664669..0df629412 100644 --- a/src/components/router/__tests__/__snapshots__/routerHelpers.test.js.snap +++ b/src/components/router/__tests__/__snapshots__/routerHelpers.test.js.snap @@ -2,25 +2,25 @@ exports[`RouterHelpers should handle location search and hash passthrough values: NO search and hash 1`] = ` Object { - "routeHref": "/rhel-sw/all", + "routeHref": "/rhel", } `; exports[`RouterHelpers should handle location search and hash passthrough values: hash 1`] = ` Object { - "routeHref": "/rhel-sw/all#lorem", + "routeHref": "/rhel#lorem", } `; exports[`RouterHelpers should handle location search and hash passthrough values: search 1`] = ` Object { - "routeHref": "/rhel-sw/all?dolor=sit", + "routeHref": "/rhel?dolor=sit", } `; exports[`RouterHelpers should handle location search and hash passthrough values: search and hash 1`] = ` Object { - "routeHref": "/rhel-sw/all?dolor=sit#lorem", + "routeHref": "/rhel?dolor=sit#lorem", } `; @@ -51,7 +51,6 @@ Object { }, "disabled": false, "exact": true, - "id": "optin", "render": true, "to": "/optin", } @@ -61,12 +60,11 @@ exports[`RouterHelpers should return navigation and route details that align to Object { "nav": Object { "default": true, - "id": "all", - "path": "/rhel-sw/all", - "pathId": "rhel-sw", + "id": "rhel", + "path": "/rhel", "pathParameter": "RHEL", "productParameter": "RHEL", - "routeHref": "/rhel-sw/all", + "routeHref": "/rhel", "viewParameter": "viewRHEL", }, "navRoute": Object { @@ -79,15 +77,13 @@ Object { "default": true, "disabled": false, "exact": true, - "id": "all", - "path": "/rhel-sw/all", - "pathId": "rhel-sw", + "id": "rhel", + "path": "/rhel", "pathParameter": "RHEL", "productParameter": "RHEL", - "redirect": "/rhel-sw/all", "render": true, - "routeHref": "/rhel-sw/all", - "to": "/rhel-sw/:variant(all|arm|ibmpower|ibmz|x86)", + "routeHref": "/rhel", + "to": "/:variant(rhel|rhel-arm|rhel-ibmpower|rhel-ibmz|rhel-x86)", "viewParameter": "viewRHEL", }, "route": Object { @@ -99,10 +95,8 @@ Object { }, "disabled": false, "exact": true, - "id": "rhel-sw", - "redirect": "/rhel-sw/all", "render": true, - "to": "/rhel-sw/:variant(all|arm|ibmpower|ibmz|x86)", + "to": "/:variant(rhel|rhel-arm|rhel-ibmpower|rhel-ibmz|rhel-x86)", }, } `; @@ -111,12 +105,11 @@ exports[`RouterHelpers should return navigation and route details that align to Object { "nav": Object { "default": true, - "id": "all", - "path": "/rhel-sw/all", - "pathId": "rhel-sw", + "id": "rhel", + "path": "/rhel", "pathParameter": "RHEL", "productParameter": "RHEL", - "routeHref": "/rhel-sw/all", + "routeHref": "/rhel", "viewParameter": "viewRHEL", }, "navRoute": Object { @@ -129,15 +122,13 @@ Object { "default": true, "disabled": false, "exact": true, - "id": "all", - "path": "/rhel-sw/all", - "pathId": "rhel-sw", + "id": "rhel", + "path": "/rhel", "pathParameter": "RHEL", "productParameter": "RHEL", - "redirect": "/rhel-sw/all", "render": true, - "routeHref": "/rhel-sw/all", - "to": "/rhel-sw/:variant(all|arm|ibmpower|ibmz|x86)", + "routeHref": "/rhel", + "to": "/:variant(rhel|rhel-arm|rhel-ibmpower|rhel-ibmz|rhel-x86)", "viewParameter": "viewRHEL", }, "route": Object { @@ -149,10 +140,8 @@ Object { }, "disabled": false, "exact": true, - "id": "rhel-sw", - "redirect": "/rhel-sw/all", "render": true, - "to": "/rhel-sw/:variant(all|arm|ibmpower|ibmz|x86)", + "to": "/:variant(rhel|rhel-arm|rhel-ibmpower|rhel-ibmz|rhel-x86)", }, } `; @@ -169,12 +158,11 @@ exports[`RouterHelpers should return navigation and route details that align to Object { "nav": Object { "default": true, - "id": "all", - "path": "/rhel-sw/all", - "pathId": "rhel-sw", + "id": "rhel", + "path": "/rhel", "pathParameter": "RHEL", "productParameter": "RHEL", - "routeHref": "/rhel-sw/all", + "routeHref": "/rhel", "viewParameter": "viewRHEL", }, "navRoute": Object { @@ -187,15 +175,13 @@ Object { "default": true, "disabled": false, "exact": true, - "id": "all", - "path": "/rhel-sw/all", - "pathId": "rhel-sw", + "id": "rhel", + "path": "/rhel", "pathParameter": "RHEL", "productParameter": "RHEL", - "redirect": "/rhel-sw/all", "render": true, - "routeHref": "/rhel-sw/all", - "to": "/rhel-sw/:variant(all|arm|ibmpower|ibmz|x86)", + "routeHref": "/rhel", + "to": "/:variant(rhel|rhel-arm|rhel-ibmpower|rhel-ibmz|rhel-x86)", "viewParameter": "viewRHEL", }, "route": Object {}, @@ -213,12 +199,11 @@ Object { exports[`RouterHelpers should return navigation and route details that align to location: detail: specific navigation ID 1`] = ` Object { "nav": Object { - "id": "arm", - "path": "/rhel-sw/arm", - "pathId": "rhel-sw", + "id": "rhel-arm", + "path": "/rhel-arm", "pathParameter": "RHEL for ARM", "productParameter": "RHEL", - "routeHref": "/rhel-sw/arm", + "routeHref": "/rhel-arm", "viewParameter": "viewRHEL", }, "navRoute": Object { @@ -230,15 +215,13 @@ Object { }, "disabled": false, "exact": true, - "id": "arm", - "path": "/rhel-sw/arm", - "pathId": "rhel-sw", + "id": "rhel-arm", + "path": "/rhel-arm", "pathParameter": "RHEL for ARM", "productParameter": "RHEL", - "redirect": "/rhel-sw/all", "render": true, - "routeHref": "/rhel-sw/arm", - "to": "/rhel-sw/:variant(all|arm|ibmpower|ibmz|x86)", + "routeHref": "/rhel-arm", + "to": "/:variant(rhel|rhel-arm|rhel-ibmpower|rhel-ibmz|rhel-x86)", "viewParameter": "viewRHEL", }, "route": Object {}, @@ -247,9 +230,15 @@ Object { exports[`RouterHelpers should return navigation and route details that align to location: detail: specific route ID 1`] = ` Object { - "nav": Object {}, - "navRoute": Object {}, - "route": Object { + "nav": Object { + "id": "optin", + "path": "/optin", + "pathParameter": null, + "productParameter": null, + "routeHref": "/optin", + "viewParameter": null, + }, + "navRoute": Object { "activateOnError": true, "component": Object { "$$typeof": Symbol(react.lazy), @@ -260,8 +249,14 @@ Object { "disabled": false, "exact": true, "id": "optin", + "path": "/optin", + "pathParameter": null, + "productParameter": null, "render": true, + "routeHref": "/optin", "to": "/optin", + "viewParameter": null, }, + "route": Object {}, } `; diff --git a/src/components/router/__tests__/routerConfig.test.js b/src/components/router/__tests__/routerConfig.test.js index 987ab4744..e847ba1b8 100644 --- a/src/components/router/__tests__/routerConfig.test.js +++ b/src/components/router/__tests__/routerConfig.test.js @@ -22,6 +22,6 @@ describe('RouterConfig', () => { } }); - expect(lazyLoadComponents.length).toBe(6); + expect(lazyLoadComponents.length).toBe(5); }); }); diff --git a/src/components/router/__tests__/routerHelpers.test.js b/src/components/router/__tests__/routerHelpers.test.js index c8f9898d7..45ec2b2a7 100644 --- a/src/components/router/__tests__/routerHelpers.test.js +++ b/src/components/router/__tests__/routerHelpers.test.js @@ -99,21 +99,21 @@ describe('RouterHelpers', () => { }).toMatchSnapshot('detail: specific route ID'); expect({ - nav: getNavigationDetail({ id: 'arm' }), - route: getRouteDetail({ id: 'arm' }), - navRoute: getNavRouteDetail({ id: 'arm' }) + nav: getNavigationDetail({ id: 'rhel-arm' }), + route: getRouteDetail({ id: 'rhel-arm' }), + navRoute: getNavRouteDetail({ id: 'rhel-arm' }) }).toMatchSnapshot('detail: specific navigation ID'); expect({ - nav: getNavigationDetail({ pathname: '/rhel-sw/all' }), - route: getRouteDetail({ pathname: '/rhel-sw/all' }), - navRoute: getNavRouteDetail({ pathname: '/rhel-sw/all' }) + nav: getNavigationDetail({ pathname: '/rhel' }), + route: getRouteDetail({ pathname: '/rhel' }), + navRoute: getNavRouteDetail({ pathname: '/rhel' }) }).toMatchSnapshot('detail: match specific path navigation'); expect({ - nav: getNavigationDetail({ id: 'lorem-missing', pathname: '/rhel-sw/all' }), - route: getRouteDetail({ id: 'lorem-missing', pathname: '/rhel-sw/all' }), - navRoute: getNavRouteDetail({ id: 'lorem-missing', pathname: '/rhel-sw/all' }) + nav: getNavigationDetail({ id: 'lorem-missing', pathname: '/rhel' }), + route: getRouteDetail({ id: 'lorem-missing', pathname: '/rhel' }), + navRoute: getNavRouteDetail({ id: 'lorem-missing', pathname: '/rhel' }) }).toMatchSnapshot('detail: missing ID, specific path'); expect({ @@ -138,40 +138,40 @@ describe('RouterHelpers', () => { it('should handle location search and hash passthrough values', () => { mockWindowLocationProp({ prop: 'href', - url: 'https://ci.foo.redhat.com/subscriptions/rhel-sw/all', + url: 'https://ci.foo.redhat.com/subscriptions/rhel', callback: () => { expect({ - routeHref: getNavigationDetail({ pathname: '/rhel-sw/all' }).routeHref + routeHref: getNavigationDetail({ pathname: '/rhel' }).routeHref }).toMatchSnapshot('NO search and hash'); } }); mockWindowLocationProp({ prop: 'href', - url: 'https://ci.foo.redhat.com/subscriptions/rhel-sw/all?dolor=sit', + url: 'https://ci.foo.redhat.com/subscriptions/rhel?dolor=sit', callback: () => { expect({ - routeHref: getNavigationDetail({ pathname: '/rhel-sw/all' }).routeHref + routeHref: getNavigationDetail({ pathname: '/rhel' }).routeHref }).toMatchSnapshot('search'); } }); mockWindowLocationProp({ prop: 'href', - url: 'https://ci.foo.redhat.com/subscriptions/rhel-sw/all#lorem', + url: 'https://ci.foo.redhat.com/subscriptions/rhel#lorem', callback: () => { expect({ - routeHref: getNavigationDetail({ pathname: '/rhel-sw/all' }).routeHref + routeHref: getNavigationDetail({ pathname: '/rhel' }).routeHref }).toMatchSnapshot('hash'); } }); mockWindowLocationProp({ prop: 'href', - url: 'https://ci.foo.redhat.com/subscriptions/rhel-sw/all?dolor=sit#lorem', + url: 'https://ci.foo.redhat.com/subscriptions/rhel?dolor=sit#lorem', callback: () => { expect({ - routeHref: getNavigationDetail({ pathname: '/rhel-sw/all' }).routeHref + routeHref: getNavigationDetail({ pathname: '/rhel' }).routeHref }).toMatchSnapshot('search and hash'); } }); diff --git a/src/components/router/routerConfig.js b/src/components/router/routerConfig.js index 0adbcddfe..cb92fe32b 100644 --- a/src/components/router/routerConfig.js +++ b/src/components/router/routerConfig.js @@ -31,46 +31,34 @@ const platformModalRedirect = path.join(helpers.UI_DEPLOY_PATH_PREFIX, '/?not_en */ const routes = [ { - id: 'rhel-sw', - to: '/rhel-sw/:variant(all|arm|ibmpower|ibmz|x86)', - redirect: '/rhel-sw/all', + to: '/:variant(rhel|rhel-arm|rhel-ibmpower|rhel-ibmz|rhel-x86)', component: React.lazy(() => import('../productView/productViewRhel')), exact: true, render: true, disabled: helpers.UI_DISABLED }, { - to: '/openshift-sw', + to: '/openshift-container', component: React.lazy(() => import('../productView/productViewOpenShiftContainer')), exact: true, render: true, disabled: helpers.UI_DISABLED }, { - id: 'openshift-sw', - to: '/openshift-sw/ocp', - component: React.lazy(() => import('../productView/productViewOpenShiftContainer')), - exact: true, - render: true, - disabled: helpers.UI_DISABLED - }, - { - to: '/openshift-sw/dedicated', + to: '/openshift-dedicated', component: React.lazy(() => import('../productView/productViewOpenShiftDedicated')), exact: true, render: true, disabled: helpers.UI_DISABLED }, { - id: 'satellite-sw', - to: '/satellite-sw/:variant(all|satellite-capsule|satellite-server)', + to: '/:variant(satellite|satellite-capsule|satellite-server)', component: React.lazy(() => import('../productView/productViewSatellite')), exact: true, render: true, disabled: helpers.UI_DISABLED }, { - id: 'optin', to: '/optin', component: React.lazy(() => import('../optinView/optinView')), exact: true, @@ -87,93 +75,82 @@ const routes = [ */ const navigation = [ { - id: 'all', - path: '/rhel-sw/all', - pathId: 'rhel-sw', + id: 'rhel', + path: '/rhel', pathParameter: RHSM_API_PATH_ID_TYPES.RHEL, productParameter: RHSM_API_PATH_ID_TYPES.RHEL, viewParameter: `view${RHSM_API_PATH_ID_TYPES.RHEL}`, default: true }, { - id: 'arm', - path: '/rhel-sw/arm', - pathId: 'rhel-sw', + id: 'rhel-arm', + path: '/rhel-arm', pathParameter: RHSM_API_PATH_ID_TYPES.RHEL_ARM, productParameter: RHSM_API_PATH_ID_TYPES.RHEL, viewParameter: `view${RHSM_API_PATH_ID_TYPES.RHEL}` }, { - id: 'ibmpower', - path: '/rhel-sw/ibmpower', - pathId: 'rhel-sw', + id: 'rhel-ibmpower', + path: '/rhel-ibmpower', pathParameter: RHSM_API_PATH_ID_TYPES.RHEL_IBM_POWER, productParameter: RHSM_API_PATH_ID_TYPES.RHEL, viewParameter: `view${RHSM_API_PATH_ID_TYPES.RHEL}` }, { - id: 'ibmz', - path: '/rhel-sw/ibmz', - pathId: 'rhel-sw', + id: 'rhel-ibmz', + path: '/rhel-ibmz', pathParameter: RHSM_API_PATH_ID_TYPES.RHEL_IBM_Z, productParameter: RHSM_API_PATH_ID_TYPES.RHEL, viewParameter: `view${RHSM_API_PATH_ID_TYPES.RHEL}` }, { - id: 'x86', - path: '/rhel-sw/x86', - pathId: 'rhel-sw', + id: 'rhel-x86', + path: '/rhel-x86', pathParameter: RHSM_API_PATH_ID_TYPES.RHEL_X86, productParameter: RHSM_API_PATH_ID_TYPES.RHEL, viewParameter: `view${RHSM_API_PATH_ID_TYPES.RHEL}` }, { - id: 'openshift-sw', - path: '/openshift-sw', - pathId: 'openshift-sw', + id: 'openshift-container', + path: '/openshift-container', pathParameter: RHSM_API_PATH_ID_TYPES.OPENSHIFT, productParameter: RHSM_API_PATH_ID_TYPES.OPENSHIFT, viewParameter: `view${RHSM_API_PATH_ID_TYPES.OPENSHIFT}` }, { - id: 'ocp', - path: '/openshift-sw/ocp', - pathId: 'openshift-sw', - pathParameter: RHSM_API_PATH_ID_TYPES.OPENSHIFT, - productParameter: RHSM_API_PATH_ID_TYPES.OPENSHIFT, - viewParameter: `view${RHSM_API_PATH_ID_TYPES.OPENSHIFT}` - }, - { - id: 'dedicated', - path: '/openshift-sw/dedicated', - pathId: 'openshift-sw', + id: 'openshift-dedicated', + path: '/openshift-dedicated', pathParameter: RHSM_API_PATH_ID_TYPES.OPENSHIFT_DEDICATED_METRICS, productParameter: RHSM_API_PATH_ID_TYPES.OPENSHIFT_DEDICATED_METRICS, viewParameter: `view${RHSM_API_PATH_ID_TYPES.OPENSHIFT_DEDICATED_METRICS}` }, { - id: 'satellite-sw', - path: '/satellite-sw/all', - pathId: 'satellite-sw', + id: 'satellite', + path: '/satellite', pathParameter: RHSM_API_PATH_ID_TYPES.SATELLITE, productParameter: RHSM_API_PATH_ID_TYPES.SATELLITE, viewParameter: `view${RHSM_API_PATH_ID_TYPES.SATELLITE}` }, { id: 'satellite-capsule', - path: '/satellite-sw/satellite-capsule', - pathId: 'satellite-sw', + path: '/satellite-capsule', pathParameter: RHSM_API_PATH_ID_TYPES.SATELLITE_CAPSULE, productParameter: RHSM_API_PATH_ID_TYPES.SATELLITE, viewParameter: `view${RHSM_API_PATH_ID_TYPES.SATELLITE}` }, { id: 'satellite-server', - path: '/satellite-sw/satellite-server', - pathId: 'satellite-sw', + path: '/satellite-server', pathParameter: RHSM_API_PATH_ID_TYPES.SATELLITE_SERVER, productParameter: RHSM_API_PATH_ID_TYPES.SATELLITE, viewParameter: `view${RHSM_API_PATH_ID_TYPES.SATELLITE}` + }, + { + id: 'optin', + path: '/optin', + pathParameter: null, + productParameter: null, + viewParameter: null } ]; diff --git a/src/components/router/routerHelpers.js b/src/components/router/routerHelpers.js index 514d90ca2..c04d2b239 100644 --- a/src/components/router/routerHelpers.js +++ b/src/components/router/routerHelpers.js @@ -80,7 +80,7 @@ const getRouteDetail = ({ id = null, pathname = null }) => { if (!routeItem && pathname) { routeItem = routes.find(value => pathname === value.to); - routeItem = routeItem || routes.find(item => pathname.includes(item?.to?.split(':')[0])); + routeItem = routeItem || routes.find(item => item?.to?.includes(pathname.split('/').reverse()[0])); } return { ...(routeItem || {}) };