This commit adds Redux Toolkit as a dependency. Adding Redux Toolkit is beneficial because it will allow us to use the current best-practice Redux development patterns and tools as well as reduce the number of dependencies. Redux Toolkit is backwards compatible with existing Redux code, and therefore works with all of the current actions and reducers. The store is now created using Redux Toolkit's configureStore(). Previously, a custom store creator developed by Red Hat Insights was used. However, this is actually not required for Insights apps, and creating the store using configureStore() is necessary to take advantage of Redux Toolkit. For instance, the store can now be inspected using the Redux devtools in the browser. This commit removes the redux-logger middleware. It is no longer necessary, as the Redux development tools can now be used to easily inspect and reason about the redux store and its state. The Thunk middleware dependency has also been removed, as Thunks are already included in Redux Toolkit. The redux-promise-middleware dependency has been left in place for now, but its functionality is also available in Redux Toolkit and it may be considered for removal in the future. Using Redux Toolkit will also allow us to move to the `Slice` pattern when defining actions/reducers in the future if we wish. This will make writing, reasoning about, and debugging the code related to the Redux store much easier. |
||
|---|---|---|
| .github | ||
| .travis | ||
| config | ||
| devel | ||
| distribution | ||
| schutzbot | ||
| src | ||
| .eslintrc.yml | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| .stylelintrc.json | ||
| .travis.yml | ||
| babel.config.js | ||
| codecov.yml | ||
| LICENSE | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
image-builder-frontend
Frontend Development
To develop the frontend you can use a proxy to run image-builder-frontend locally against the chrome and backend at console.redhat.com.
Working against the production environment is preferred, as any work can be released without worrying if a feature from stage has been released yet.
Nodejs and npm version
Make sure you have npm@7 and node 15+ installed. If you need multiple versions of nodejs check out nvm.
Webpack proxy
-
run
npm ci -
run
npm run prod-beta. This command uses a prod-beta env by default. Configure your environment by theenvattribute indev.webpack.config.js. -
Secondly redirect a few
prod.foo.redhat.comto localhost, if this has not been done already.
echo "127.0.0.1 prod.foo.redhat.com" >> /etc/hosts
- open browser at
https://prod.foo.redhat.com:1337/beta/insights/image-builder
Webpack proxy (staging) -- Runs with image-builder's stage deployment
-
run
npm ci -
run
npm run stage-beta. This command uses a stage-beta env by default. Configure your environment by theenvattribute indev.webpack.config.js. -
Secondly redirect a few
stage.foo.redhat.comto localhost, if this has not been done already.
echo "127.0.0.1 stage.foo.redhat.com" >> /etc/hosts
- open browser at
https://stage.foo.redhat.com:1337/beta/insights/image-builder
Insights proxy (deprecated)
-
Clone the insights proxy: https://github.com/RedHatInsights/insights-proxy
-
Setting up the proxy
Choose a runner (podman or docker), and point the SPANDX_CONFIG variable to
profile/local-frontend.jsincluded in image-builder-frontend.sudo insights-proxy/scripts/patch-etc-hosts.sh export RUNNER="podman" export SPANDX_CONFIG=$PATH_TO/image-builder-frontend/profiles/local-frontend.js sudo -E insights-proxy/scripts/run.sh -
Starting up image-builder-frontend
In the image-builder-frontend checkout directory
npm install npm start
The UI should be running on https://prod.foo.redhat.com:1337/beta/insights/image-builder/landing. Note that this requires you to have access to either production or stage (plus VPN and proxy config) of insights.
Backend Development
To develop both the frontend and the backend you can again use the proxy to run both the frontend and backend locally against the chrome at cloud.redhat.com. For instructions see devel/README.md.
Style Guidelines
This project uses eslint's recommended styling guidelines. These rules can be found here: https://eslint.org/docs/rules/
Test Guidelines
Testing is done using React Testing Library. All UI contributions must also include a new test or update an existing test in order to maintain code coverage.
Tests can be run with
npm run test
These tests will also be run in our Travis CI when a PR is opened.