fleet/frontend/redux
Gabe Hernandez 3546b7d41a
adding typescript and updating linting to work with it (#356)
* updated typescript version and tsconfig in project

* updated eslint version

* change from experimental export to supported export

* removed accidentally added script

* turn off buggy jsx-a11y eslint rules

* remove unused tslint.json

* fix wrong jsx-a11y depedency

* use correct eslint-plugin-jsx-a11y version

* fix rest of linting errors

* move back js-yaml version to 3 major
2021-03-01 07:48:51 +00:00
..
middlewares New styles for 404, 500, Login, User settings, and Confirm invite pages. (#108) 2020-12-08 17:45:08 -08:00
nodes adding typescript and updating linting to work with it (#356) 2021-03-01 07:48:51 +00:00
utilities Cleaning JavaScript imports and if statements (#327) 2016-10-19 16:22:18 -04:00
README.md Replace uses of the term "Kolide" with "Fleet" (#1999) 2019-01-24 09:39:32 -08:00
reducers.js Implement osquery options page (#11) 2020-11-04 18:00:51 -08:00
store.js Feature - add search and sort to host table (#341) 2021-02-25 12:05:08 +00:00

Fleet Redux Implementation

Fleet uses Redux for application state management. React components themselves can manage state, but Redux makes it easy to share state throughout the app by being the single source of truth (such as keeping track of the entities returned by the API).

To learn more about Redux visit http://redux.js.org.

Redux State Structure

Overview

The shape of the application's Redux state is as follows:

{
  app: {
    ...
  },
  auth: {
    ...
  },
  components: {
    ...
  },
  entities: {
    ...
  },
  loadingBar: {
    ...
  },
  notifications: {
    ...
  },
  persistentFlash: {
    ...
  },
  redirectLocation: {
    ...
  },
  routing: {
    ...
  },
}

App State

App state contains information about the general app setup and information. It contains a config object with data on the user's organization and Fleet setup. Additionally, the app state in Redux controls rendering the side navigation as a mobile view, and displaying the Kolide jagged background image located on specific pages such as the login page.

Auth State

Auth state contains data on the current user.

Component State

Component state contains data specific to React components.

Entities State

The entities state holds data on specific entities such as users, queries, packs, etc. They follow a similar configuration that can be found here.

Notifications State

The notifications state contains data that informs the rendering of flash messages.

Redirect Location State

The redirect location state contains information about where to redirect a user after login, specifically when they attempt to access an authenticated route when logged out and then log in.