Git Product home page Git Product logo

insights-inventory-frontend's Introduction

Build Status semantic-release GitHub release codecov

Insights Inventory Frontend

This is the frontend application for Insights Inventory. It is based on the insights-frontend-starter-app.

First time setup

Quick start

  1. Make sure you have Node.js (current LTS) and npm installed.
  2. Run script to patch your /etc/hosts.
  3. Make sure you are using Red Hat proxy.

Running locally

  1. Clone the repository.
  2. Install dependencies with npm install.
  3. Run development server with npm run start:proxy:beta. See dev.webpack.config.js and package.json (npm scripts) for more options and parameters available.
  4. Local version of the app will be available at https://stage.foo.redhat.com:1337/preview/insights/inventory/. If you run with slightly different setup (for example, using production environment), you should still see the generated URL in your terminal, the webpack script output.

Testing your changes

We use Jest with React Testing Library to write unit tests. For larger pieces of code or components, we utilize Cypress. For testing commands shortcuts (like npm run test, npm run test:ct, etc.), take a look at the package.json file which lists available scripts.

Before opening a pull request, you can run npm run verify:local to make sure your changes pass automated tests (Jest and Cypress) and linter (both JS and CSS linters). We also execute husky hooks with every commit to make sure the changes pass basic lint checks.

Commit conventions

In order to keep our commits style consistent and the commits history easy to read, we utilize semantic-release which follows Angular Commit Message Conventions. Also, there is a commitlint check run on master, master-stable, prod-beta and prod-stable branches which ensures that all the commits meet the expected format (<type>(<scope>): <short summary>). Following this standard and specifying at least the type and summary for each commit helps to automatically generate a changelog of changes.

Running with another app

Applications on console.redhat.com are webpack federated modules, and you are able to deploy some of them locally. This helps to see if new changes work well in terms of integration.

If you want to see local changes to any of the Inventory components, and see how it behaves with other applications (like, for example, Inventory table is imported in Advisor), you will have to run both Inventory and desired application.

Example

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-advisor-frontend) and run it (make sure to run it on a different port):

npm run start:proxy -- --port=8003

Run the Inventory application with proxy enabled and list of additional applications:

LOCAL_API=advisor:8003~https npm run start:proxy

Or, if you want to run Advisor and, for instance, Vulnerability, then just add a new entry to LOCAL_API:

LOCAL_API=advisor:8003~https,vulnerability:8004

Mocking Inventory API

This is one of the advanced methods to test frontend locally without waiting for API to have desired endpoints available.

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.).

  1. Verify package.json config section for the correct URL to OpenAPI schema (contains remote URL by default).
  2. Verify dev.webpack.config.js customProxy settings. There you can specify which endpoints to proxy and modify request/response headers.
  3. Run npm run mock-server to start the mock server. The fist output must list the endpoints that are generated by the localhost server.
  4. In another terminal, run npm run start:mock or npm 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.

Inventory table and detail

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.

Applications using InventoryTable

These applications import InventoryTable component through federated modules:

Documentation Links

insights-inventory-frontend's People

Contributors

karelhala avatar dependabot-preview[bot] avatar gkarat avatar rvsia avatar dependabot[bot] avatar ryelo avatar semantic-release-bot avatar mkholjuraev avatar kruai avatar adonispuente avatar jharting avatar fewwy avatar bastilian avatar hyperkid123 avatar allenbw avatar jiridostal avatar lesamo avatar iphands avatar astonlele avatar ryandillinfelton avatar dlobatog avatar blakeholifield avatar arivepr avatar acosferreira avatar johnsonm325 avatar gabipodolnikova avatar kgaikwad avatar bsquizz avatar epwinchell avatar fabriciadinizrh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.