From 12230e771f143f8253777157d0400161717f1715 Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Mon, 2 Sep 2024 16:32:33 +0200 Subject: [PATCH] fix(HMS-4621): remove beta/preview URL prefixes This PR aims to address ADR-044 - removal of /preview URL. Not all references to /beta or /preview were removed as e.g. emhemeral environment is still using it. Signed-off-by: Petr Vobornik --- README.md | 18 ++++++------------ build/package/Caddyfile | 16 ---------------- build/package/Dockerfile | 3 --- scripts/mk/crc-frontend.mk | 2 +- .../NoPermissions/NoPermissions.test.tsx | 6 ------ src/Components/NoPermissions/NoPermissions.tsx | 5 +---- 6 files changed, 8 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 13aee51..39a0c29 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # idm-domains-frontend -## Initial etc/hosts setup +## Initial /etc/hosts setup In order to access the https://[env].foo.redhat.com in your browser, you have to add entries to your `/etc/hosts` file. This is a **one-time** setup that has to be done only once (unless you modify hosts) on each machine. @@ -11,8 +11,6 @@ Add the below to your `/etc/hosts` file: ``` 127.0.0.1 prod.foo.redhat.com 127.0.0.1 stage.foo.redhat.com -127.0.0.1 qa.foo.redhat.com -127.0.0.1 ci.foo.redhat.com ``` ## Install react developer tools @@ -22,7 +20,7 @@ favourite browser. - [React Developer Tools](https://react.dev/learn/react-developer-tools). -## Setup and run chrome-service-backend +## Setup and run chrome-service-backend (optional) > Useful when trying your service config changes > before commit to chrome-service-backend repository. @@ -59,11 +57,7 @@ Now you can deploy into dev cluster by `make ephemeral-build-deploy`. 1. `make run` to start the server. -2. Open the [idmsvc beta app][idmsvc_beta_app] in your browser. - -3. Currently, `App.tsx` will throw a type error until your app is registered and a `navId` has been set. - -Update `config/dev.webpack.config.js` according to your application URL. [Read more][frontend_use_proxy]. +2. Open the [idmsvc app][idmsvc_app] in your browser. See: [Contributing](./docs/CONTRIBUTING.md). @@ -79,8 +73,8 @@ Update git submodule and regenerate API with `make update-api`. Generate `src/Api` from the openapi specification by running `make generate-api`. * [Development Docs](docs/INDEX.md). -* [Pattern Fly 4 - Components][patternfly_4]. +* [PatternFly - Components][patternfly]. -[idmsvc_beta_app]: https://stage.foo.redhat.com:1337/beta/settings/idmsvc -[patternfly_4]: https://v4-archive.patternfly.org/v4/components/about-modal +[idmsvc_app]: https://stage.foo.redhat.com:1337/settings/idmsvc +[patternfly]: https://www.patternfly.org/components/all-components [frontend_use_proxy]: https://github.com/RedHatInsights/frontend-components/tree/master/packages/config#useproxy diff --git a/build/package/Caddyfile b/build/package/Caddyfile index 775b105..0ca0e2d 100644 --- a/build/package/Caddyfile +++ b/build/package/Caddyfile @@ -38,26 +38,10 @@ } } - # Handle preview app route - @preview_match { - path /preview/apps/idmsvc* - } - handle @preview_match { - uri strip_prefix /preview/apps/idmsvc* - file_server * { - root /opt/app-root/src/dist/preview - browse - } - } - handle /beta/ { redir /beta/apps/chrome/index.html permanent } - handle /preview/ { - redir /preview/apps/chrome/index.html permanent - } - handle / { redir /apps/chrome/index.html permanent } diff --git a/build/package/Dockerfile b/build/package/Dockerfile index a4006a4..45a0857 100644 --- a/build/package/Dockerfile +++ b/build/package/Dockerfile @@ -40,9 +40,6 @@ COPY ./package.json /opt/app-root/src/ RUN sed -i -e 's/\/beta\/apps/\/apps/g' /opt/app-root/src/dist/stable/fed-mods.json ENV APP_NAME="idmsvc" -ENV ROUTE_PATH="/apps/${APP_NAME}" -ENV BETA_ROUTE_PATH="/beta/apps/${APP_NAME}" -ENV PREVIEW_ROUTE_PATH="/preview/apps/${APP_NAME}" CMD ["caddy", "run", "--config", "/opt/app-root/src/Caddyfile"] diff --git a/scripts/mk/crc-frontend.mk b/scripts/mk/crc-frontend.mk index 88db2be..9725dc2 100644 --- a/scripts/mk/crc-frontend.mk +++ b/scripts/mk/crc-frontend.mk @@ -35,7 +35,7 @@ test: $(NODE_BIN)/jest ## Execute unit tests $(eval NPM_RUN_START:=npm run start) ifneq (,$(findstring $(CLOUDDOT_ENV),stage prod)) -ifneq (,$(findstring $(UI_ENV),beta stable)) +ifneq (,$(findstring $(UI_ENV),stable)) $(eval NPM_RUN_START:=npm run start -- --clouddotEnv="$(CLOUDDOT_ENV)" --uiEnv="$(UI_ENV)") endif endif diff --git a/src/Components/NoPermissions/NoPermissions.test.tsx b/src/Components/NoPermissions/NoPermissions.test.tsx index 960318f..729aff2 100644 --- a/src/Components/NoPermissions/NoPermissions.test.tsx +++ b/src/Components/NoPermissions/NoPermissions.test.tsx @@ -3,12 +3,6 @@ import { render } from '@testing-library/react'; import NoPermissions from './NoPermissions'; import '@testing-library/jest-dom'; -jest.mock('@redhat-cloud-services/frontend-components/useChrome', () => { - return () => ({ - isBeta: () => true, - }); -}); - test('expect NoPermissions to render', () => { const { container } = render(); expect(container).toHaveTextContent('Access permissions needed'); diff --git a/src/Components/NoPermissions/NoPermissions.tsx b/src/Components/NoPermissions/NoPermissions.tsx index 7a683ff..30e1f35 100644 --- a/src/Components/NoPermissions/NoPermissions.tsx +++ b/src/Components/NoPermissions/NoPermissions.tsx @@ -2,15 +2,12 @@ import React from 'react'; import { NotAuthorized } from '@redhat-cloud-services/frontend-components/NotAuthorized'; import { Button, PageSection } from '@patternfly/react-core'; -import useChrome from '@redhat-cloud-services/frontend-components/useChrome'; /** * A Component to show when user doesn't have RBAC permissions for the page. */ const NoPermissions = () => { - const { isBeta } = useChrome(); - const prefix = isBeta() ? '/beta' : '/preview'; - const linkMyUserAccess = prefix + '/iam/my-user-access'; + const linkMyUserAccess = '/iam/my-user-access'; return (