Skip to content

Commit

Permalink
fix(HMS-4621): remove beta/preview URL prefixes
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
pvoborni authored and frasertweedale committed Sep 5, 2024
1 parent 7cb770e commit 12230e7
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 42 deletions.
18 changes: 6 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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).

Expand All @@ -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
16 changes: 0 additions & 16 deletions build/package/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 0 additions & 3 deletions build/package/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
2 changes: 1 addition & 1 deletion scripts/mk/crc-frontend.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions src/Components/NoPermissions/NoPermissions.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(<NoPermissions />);
expect(container).toHaveTextContent('Access permissions needed');
Expand Down
5 changes: 1 addition & 4 deletions src/Components/NoPermissions/NoPermissions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<PageSection className="noPermissions">
Expand Down

0 comments on commit 12230e7

Please sign in to comment.