This is the frontend application for Insights Inventory. It is based on the insights-frontend-starter-app.
- Make sure you have
Node.js
andnpm
installed - Run script to patch your
/etc/hosts
- Make sure you are using Red Hat proxy
There is a comprehensive quick start guide in the Storybook Documentation to setting up an Insights environment.
- Install dependencies with
npm install
- Run development server with
npm run start:proxy:beta
- Local version of the app will be available at https://stage.foo.redhat.com:1337/beta/insights/inventory/
If you want to see changes made in inventory table in another application you will have to run both inventory and desired application. We'll take for example insights-advisor-frontend application as app that uses system detail.
Open new terminal and navigate to desired application (for instance insights-adviror-frontend) and run it (make sure to run it on different port)
npm start
Run the inventory application with proxy enabled and list of additional applications
LOCAL_API=advisor:8003~https npm run start:proxy
If you want to run advisor and for instance vulnerability just add new entry to LOCAL_API
LOCAL_API=advisor:8003~https,vulnerability:8004
There is an npm script that runs the build, JS and CSS linters and unit tests. The script can be invoked by
npm run verify
Inventory frontend has support for https://github.com/stoplightio/prism CLI. The CLI reads the OpenAPI schema, spins up a localhost server and serves dynamically generated responses for Inventory API endpoints (/hosts, /groups, etc.).
- Verify package.json
config
section for the correct URL to OpenAPI schema (contains remote URL by default). - Verify dev.webpack.config.js
customProxy
settings. There you can specify which endpoints to proxy and modify request/response headers. - Run
npm run mock-server
to start the mock server. The fist output must list the endpoints that are generated by the localhost server. - In another terminal, run
npm run start:mock
ornpm run start:mock:beta
to start the webpack server either in stage-stable or stabe-beta environment. The scripts set the MOCK variable to true and the customProxy is enabled.
We are serving inventory through federated modules, this means both inventory table and inventory detail is served to you in runtime. No need to install and rebuild when something changes in inventory.
These applications import InventoryTable
component through federated modules: