From 4e0a05d17dc6b51b4ae83d1ee03bb669f9abd63b Mon Sep 17 00:00:00 2001 From: Michael Johnson Date: Wed, 5 Apr 2023 13:55:17 -0400 Subject: [PATCH] chore(RHIF-224): Update /beta to /preview To test, you can run via /beta or /preview. We previously had issues with the local app being served. To ensure that it is properly being served, run the app via beta and make a change in the code or add a console log and ensure that you're getting local changes. --- README.md | 2 +- config/dev.webpack.config.js | 2 +- profiles/local-frontend-and-api.js | 4 ++-- src/AppEntry.js | 3 +-- src/Components/Common.js | 2 +- src/entry.test.js | 13 ------------- 6 files changed, 6 insertions(+), 20 deletions(-) delete mode 100644 src/entry.test.js diff --git a/README.md b/README.md index ad4306bd..2a3623ad 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Note: You will need to set up the Insights environment if you want to develop wi 2. ```npm run start:beta``` - with CI beta env -3. visit ```https://prod.foo.redhat.com:1337/insights/malware/``` OR ```https://prod.foo.redhat.com:1337/beta/insights/malware/``` for beta env +3. visit ```https://prod.foo.redhat.com:1337/insights/malware/``` OR ```https://prod.foo.redhat.com:1337/preview/insights/malware/``` for beta env ### Testing diff --git a/config/dev.webpack.config.js b/config/dev.webpack.config.js index 9a4b5986..34549afc 100644 --- a/config/dev.webpack.config.js +++ b/config/dev.webpack.config.js @@ -7,7 +7,7 @@ const { config: webpackConfig, plugins } = config({ debug: true, deployment: process.env.BETA ? 'beta/apps' : 'apps', useProxy: true, - appUrl: process.env.BETA ? '/beta/insights/malware' : '/insights/malware', + appUrl: process.env.BETA ? ['/beta/insights/malware', '/preview/insights/malware'] : '/insights/malware', env: process.env.BETA ? 'stage-beta' : 'stage-stable', standalone: Boolean(process.env.STANDALONE) }); diff --git a/profiles/local-frontend-and-api.js b/profiles/local-frontend-and-api.js index 780084c5..efc660bd 100644 --- a/profiles/local-frontend-and-api.js +++ b/profiles/local-frontend-and-api.js @@ -4,9 +4,9 @@ const FRONTEND_PORT = 8002; const API_PORT = 3000; const routes = {}; -routes[`/beta/${SECTION}/${APP_ID}`] = { host: `https://localhost:${FRONTEND_PORT}` }; +routes[`/preview/${SECTION}/${APP_ID}`] = { host: `https://localhost:${FRONTEND_PORT}` }; routes[`/${SECTION}/${APP_ID}`] = { host: `https://localhost:${FRONTEND_PORT}` }; -routes[`/beta/apps/${APP_ID}`] = { host: `https://localhost:${FRONTEND_PORT}` }; +routes[`/preview/apps/${APP_ID}`] = { host: `https://localhost:${FRONTEND_PORT}` }; routes[`/apps/${APP_ID}`] = { host: `https://localhost:${FRONTEND_PORT}` }; routes[`/api/${APP_ID}`] = { host: `http://localhost:${API_PORT}` }; diff --git a/src/AppEntry.js b/src/AppEntry.js index a6f8d419..e86033e8 100644 --- a/src/AppEntry.js +++ b/src/AppEntry.js @@ -9,7 +9,6 @@ import PropTypes from 'prop-types'; import { Provider } from 'react-redux'; import { BrowserRouter as Router } from 'react-router-dom'; import { cache } from './store/cache'; -import { getBaseName } from '@redhat-cloud-services/frontend-components-utilities/helpers/helpers'; import { init, RegistryContext } from './store'; import { globalFilters } from './store/cache'; import logger from 'redux-logger'; @@ -68,7 +67,7 @@ const AppEntry = ({ useLogger, connectToDevTools }) => { registry }}> - + diff --git a/src/Components/Common.js b/src/Components/Common.js index ad608952..158fb083 100644 --- a/src/Components/Common.js +++ b/src/Components/Common.js @@ -16,7 +16,7 @@ const gqlProps = { error: propTypes.object }; -const isBeta = () => window.location.pathname.split('/')[1] === 'beta' ? '/beta' : ''; +const isBeta = () => window.location.pathname.split('/')[1] === 'preview' ? '/preview' : ''; // Parse the match.metadata object and return a string of its 'key: value' items each on a separate line const expandMatchMetadata = (md) => { diff --git a/src/entry.test.js b/src/entry.test.js deleted file mode 100644 index d9f21755..00000000 --- a/src/entry.test.js +++ /dev/null @@ -1,13 +0,0 @@ -import { getBaseName } from '@redhat-cloud-services/frontend-components-utilities/helpers'; - -describe('Utilities/getBaseName', () => { - it('should find the right base name on Stable ', () => { - expect(getBaseName('/insights/foo/bar/baz')).toEqual('/insights/foo'); - expect(getBaseName('/rhcs/bar/bar/baz')).toEqual('/rhcs/bar'); - }); - - it('should find the right base name on Beta ', () => { - expect(getBaseName('/beta/insights/foo/bar/baz')).toEqual('/beta/insights/foo'); - expect(getBaseName('/beta/test/fff/bar/baz')).toEqual('/beta/test/fff'); - }); -});