Vulnerability UI
Getting Started
There is a comprehensive quick start guide in the Storybook Documentation to setting up an Insights environment complete with:
Run developer setup
-
Use https://github.com/RedHatInsights/insights-proxy/blob/master/scripts/patch-etc-hosts.sh to patch your /etc/hosts
-
Run proxy
SPANDX_CONFIG="./config/spandx.config.js" bash $PROXY_PATH/scripts/run.sh
- npm run start
Running locally
Have insights-proxy installed under PROXY_PATH
SPANDX_CONFIG="./config/spandx.config.js" bash $PROXY_PATH/scripts/run.sh
Testing
- Travis is used to test the build for this code.
npm run test
will run linters and tests
Deploying
- any push to the
master
branch will deploy to the vulnerability-ui-build
ci-beta
branch - any push to the
ci-stable
branch will deploy to the vulnerability-ui-build
ci-stable
branch - any push to the
qa-beta
branch will deploy to the vulnerability-ui-build
qa-beta
branch - any push to the
qa-stable
branch will deploy to the vulnerability-ui-build
qa-stable
branch - any push to the
prod-beta
branch will deploy to the vulnerability-ui-build
prod-beta
branch - any push to the
prod-stable
branch will deploy to the vulnerability-ui-build
prod-stable
branch - Pull requests (based on master) will not be pushed to the
vulnerability-ui-build
master
branch
- If the PR is accepted and merged, master will be rebuilt and will deploy to the
vulnerability-ui-build
ci-beta
branch
Patternfly
- This project imports Patternfly components:
Insights Components
Insights Platform will deliver components and static assets through npm. ESI tags are used to import the chroming which takes care of the header, sidebar, and footer.
Technologies
Webpack
Webpack.config.js
This file exports an object with the configuration for webpack and webpack dev server.
{
mode: https:
devtool: https:
optimization: {
chunks: https:
runtimeChunk: https:
cacheGroups: {
common_initial: {
test:
name:
chunks:
}
}
},
entry: {
bundle1: 'src/entry1.js',
bundle2: 'src/entry2.js'
},
output: {
filename: https:
path: https:
publicPath: https:
chunkFilename: https:
},
module: {
rules: https:
},
plugins: [],
devServer: {}
}
React
Redux
Store
A store holds the whole state tree of your application.
Redux doesn't have a Dispatcher or support many stores. Instead, there is just a single store with a single root reducing function.
Create Store: createStore(reducer, preloadedState, enhancer)
Actions
Actions are payloads of information that send data from your application to your store. They are the only source of information for the store. You send them to the store using store.dispatch().
Redux actions should only have two properties, type and payload, as a best practice.
Reducers
Reducers specify how the application's state changes in response to actions sent to the store.
Ex) /src/api/System/getSystems.js
React-redux
React-router-dom
When setting up the routes, the page content is wrapped with a .page__{pageName}
class, applied to the #root
ID that is determined by the rootClass
in the Routes.js
which lets you easily reference the page in the styling.
- BrowserRouter
- A
<Router>
that uses the HTML5 history API (pushState, replaceState and the popstate event) to keep your UI in sync with the URL
- Route
- Switch
- Renders the first child
<Route>
or <Redirect>
that matches the location.
- Redirect
- navigate to a new location
- withRouter
- passes updated match, location, and history props to the wrapped component whenever it renders
9eb7991... Update Travis release scripts and alter publicPath for "production" build when branch is beta. (#50)