From ddc2dc6048ef00c14f0cc63b69a6a29fbf0bba2b Mon Sep 17 00:00:00 2001 From: CD Cabrera Date: Mon, 29 Aug 2022 12:24:55 -0400 Subject: [PATCH] fix(build): sw-460 dev local run navigation (#965) --- src/index.js | 9 ++++++++- tests/__snapshots__/code.test.js.snap | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 760bc425c..7f0975627 100644 --- a/src/index.js +++ b/src/index.js @@ -4,10 +4,17 @@ import './styles/standalone.scss'; import '@patternfly/react-core/dist/styles/base.css'; import('./bootstrap'); +import { routerHelpers } from './components/router'; window.insights = { chrome: { - appNavClick: (...args) => console.log(`Emulated appNavClick: ${JSON.stringify(args)}`), + appNavClick: ({ id, ...rest }) => { + console.log(`Emulated appNavClick: ${JSON.stringify({ id, ...rest })}`); + document.location.href = routerHelpers.pathJoin( + document.location.pathname, + routerHelpers.getRouteConfig({ id }).path + ); + }, auth: { getUser: () => new Promise(resolve => { diff --git a/tests/__snapshots__/code.test.js.snap b/tests/__snapshots__/code.test.js.snap index cabeec79f..d0a82f847 100644 --- a/tests/__snapshots__/code.test.js.snap +++ b/tests/__snapshots__/code.test.js.snap @@ -6,7 +6,7 @@ Array [ "components/inventoryCard/inventoryCardHelpers.js:83: console.warn(\`Warning: Filter \\"\${id}\\" not found in \\"table row\\" response data.\`, cellData);", "components/inventoryCard/inventoryList.deprecated.js:62: console.warn(\`Sorting can only be performed on select fields, confirm field \${id} is allowed.\`);", "components/inventoryCardSubscriptions/inventoryCardSubscriptionsContext.js:127: console.warn(\`Sorting can only be performed on select fields, confirm field \${id} is allowed.\`);", - "index.js:10: appNavClick: (...args) => console.log(\`Emulated appNavClick: \${JSON.stringify(args)}\`),", + "index.js:12: console.log(\`Emulated appNavClick: \${JSON.stringify({ id, ...rest })}\`);", "redux/common/reduxHelpers.js:282: console.error(\`Error: Property \${prop} does not exist within the passed state.\`, state);", "redux/common/reduxHelpers.js:286: console.warn(\`Warning: Property \${prop} does not exist within the passed initialState.\`, initialState);", "services/common/helpers.js:95: console.error(",