+ style={customStyles}
+ >
Action required
- You have to specify a username to use Unleash. This will allow us to track your changes.
+ You have to specify a username to use Unleash. This
+ will allow us to track your changes.
diff --git a/frontend/src/component/user/user-container.jsx b/frontend/src/component/user/user-container.jsx
index 8af4cb632d..ead0259620 100644
--- a/frontend/src/component/user/user-container.jsx
+++ b/frontend/src/component/user/user-container.jsx
@@ -2,13 +2,12 @@ import { connect } from 'react-redux';
import UserComponent from './user-component';
import { updateUserName, save } from '../../store/user/actions';
-
const mapDispatchToProps = {
updateUserName,
save,
};
-const mapStateToProps = (state) => ({
+const mapStateToProps = state => ({
user: state.user.toJS(),
});
diff --git a/frontend/src/data/applications-api.js b/frontend/src/data/applications-api.js
index d64cba482a..919e3df790 100644
--- a/frontend/src/data/applications-api.js
+++ b/frontend/src/data/applications-api.js
@@ -2,19 +2,19 @@ import { throwIfNotSuccess, headers } from './helper';
const URI = 'api/admin/metrics/applications';
-function fetchAll () {
+function fetchAll() {
return fetch(URI, { headers, credentials: 'include' })
.then(throwIfNotSuccess)
.then(response => response.json());
}
-function fetchApplication (appName) {
+function fetchApplication(appName) {
return fetch(`${URI}/${appName}`, { headers, credentials: 'include' })
.then(throwIfNotSuccess)
.then(response => response.json());
}
-function fetchApplicationsWithStrategyName (strategyName) {
+function fetchApplicationsWithStrategyName(strategyName) {
return fetch(`${URI}?strategyName=${strategyName}`, {
headers,
credentials: 'include',
@@ -23,7 +23,7 @@ function fetchApplicationsWithStrategyName (strategyName) {
.then(response => response.json());
}
-function storeApplicationMetaData (appName, key, value) {
+function storeApplicationMetaData(appName, key, value) {
const data = {};
data[key] = value;
return fetch(`${URI}/${appName}`, {
diff --git a/frontend/src/data/archive-api.js b/frontend/src/data/archive-api.js
index a32f8a988b..bcfdd28557 100644
--- a/frontend/src/data/archive-api.js
+++ b/frontend/src/data/archive-api.js
@@ -2,13 +2,13 @@ import { throwIfNotSuccess, headers } from './helper';
const URI = 'api/admin/archive';
-function fetchAll () {
+function fetchAll() {
return fetch(`${URI}/features`, { credentials: 'include' })
.then(throwIfNotSuccess)
.then(response => response.json());
}
-function revive (featureName) {
+function revive(featureName) {
return fetch(`${URI}/revive/${featureName}`, {
method: 'POST',
headers,
@@ -16,9 +16,7 @@ function revive (featureName) {
}).then(throwIfNotSuccess);
}
-
export default {
fetchAll,
revive,
};
-
diff --git a/frontend/src/data/client-instance-api.js b/frontend/src/data/client-instance-api.js
index 90a69e9917..9cd45fea1d 100644
--- a/frontend/src/data/client-instance-api.js
+++ b/frontend/src/data/client-instance-api.js
@@ -2,7 +2,7 @@ import { throwIfNotSuccess, headers } from './helper';
const URI = 'api/admin/metrics/instances';
-function fetchAll () {
+function fetchAll() {
return fetch(URI, { headers, credentials: 'include' })
.then(throwIfNotSuccess)
.then(response => response.json());
diff --git a/frontend/src/data/feature-api.js b/frontend/src/data/feature-api.js
index fdfe078b38..9a72815727 100644
--- a/frontend/src/data/feature-api.js
+++ b/frontend/src/data/feature-api.js
@@ -2,9 +2,12 @@ import { throwIfNotSuccess, headers } from './helper';
const URI = 'api/admin/features';
-function validateToggle (featureToggle) {
+function validateToggle(featureToggle) {
return new Promise((resolve, reject) => {
- if (!featureToggle.strategies || featureToggle.strategies.length === 0) {
+ if (
+ !featureToggle.strategies ||
+ featureToggle.strategies.length === 0
+ ) {
reject(new Error('You must add at least one activation strategy'));
} else {
resolve(featureToggle);
@@ -12,24 +15,26 @@ function validateToggle (featureToggle) {
});
}
-function fetchAll () {
+function fetchAll() {
return fetch(URI, { credentials: 'include' })
.then(throwIfNotSuccess)
.then(response => response.json());
}
-function create (featureToggle) {
+function create(featureToggle) {
return validateToggle(featureToggle)
- .then(() => fetch(URI, {
- method: 'POST',
- headers,
- credentials: 'include',
- body: JSON.stringify(featureToggle),
- }))
+ .then(() =>
+ fetch(URI, {
+ method: 'POST',
+ headers,
+ credentials: 'include',
+ body: JSON.stringify(featureToggle),
+ })
+ )
.then(throwIfNotSuccess);
}
-function validate (featureToggle) {
+function validate(featureToggle) {
return fetch(`${URI}/validate`, {
method: 'POST',
headers,
@@ -38,27 +43,28 @@ function validate (featureToggle) {
}).then(throwIfNotSuccess);
}
-function update (featureToggle) {
+function update(featureToggle) {
return validateToggle(featureToggle)
- .then(() => fetch(`${URI}/${featureToggle.name}`, {
- method: 'PUT',
- headers,
- credentials: 'include',
- body: JSON.stringify(featureToggle),
- }))
+ .then(() =>
+ fetch(`${URI}/${featureToggle.name}`, {
+ method: 'PUT',
+ headers,
+ credentials: 'include',
+ body: JSON.stringify(featureToggle),
+ })
+ )
.then(throwIfNotSuccess);
}
-function toggle (name) {
+function toggle(name) {
return fetch(`${URI}/${name}/toggle`, {
method: 'POST',
headers,
credentials: 'include',
- })
- .then(throwIfNotSuccess);
+ }).then(throwIfNotSuccess);
}
-function remove (featureToggleName) {
+function remove(featureToggleName) {
return fetch(`${URI}/${featureToggleName}`, {
method: 'DELETE',
credentials: 'include',
diff --git a/frontend/src/data/feature-metrics-api.js b/frontend/src/data/feature-metrics-api.js
index ddba9b053e..2287e1b2b0 100644
--- a/frontend/src/data/feature-metrics-api.js
+++ b/frontend/src/data/feature-metrics-api.js
@@ -2,7 +2,7 @@ const { throwIfNotSuccess } = require('./helper');
const URI = 'api/admin/metrics/feature-toggles';
-function fetchFeatureMetrics () {
+function fetchFeatureMetrics() {
return fetch(URI, { credentials: 'include' })
.then(throwIfNotSuccess)
.then(response => response.json());
@@ -10,7 +10,7 @@ function fetchFeatureMetrics () {
const seenURI = 'api/admin/metrics/seen-apps';
-function fetchSeenApps () {
+function fetchSeenApps() {
return fetch(seenURI, { credentials: 'include' })
.then(throwIfNotSuccess)
.then(response => response.json());
diff --git a/frontend/src/data/helper.js b/frontend/src/data/helper.js
index 0775a699c6..cf44aae22e 100644
--- a/frontend/src/data/helper.js
+++ b/frontend/src/data/helper.js
@@ -1,18 +1,23 @@
const defaultErrorMessage = 'Unexptected exception when talking to unleash-api';
-function extractJoiMsg (body) {
- return body.details.length > 0 ? body.details[0].message : defaultErrorMessage;
+function extractJoiMsg(body) {
+ return body.details.length > 0
+ ? body.details[0].message
+ : defaultErrorMessage;
}
-function extractLegacyMsg (body) {
+function extractLegacyMsg(body) {
return body && body.length > 0 ? body[0].msg : defaultErrorMessage;
}
-export function throwIfNotSuccess (response) {
+export function throwIfNotSuccess(response) {
if (!response.ok) {
if (response.status > 399 && response.status < 404) {
return new Promise((resolve, reject) => {
response.json().then(body => {
- const errorMsg = body && body.isJoi ? extractJoiMsg(body) : extractLegacyMsg(body);
+ const errorMsg =
+ body && body.isJoi
+ ? extractJoiMsg(body)
+ : extractLegacyMsg(body);
let error = new Error(errorMsg);
error.statusCode = response.status;
reject(error);
@@ -23,10 +28,9 @@ export function throwIfNotSuccess (response) {
}
}
return Promise.resolve(response);
-};
-
+}
export const headers = {
- 'Accept': 'application/json',
+ Accept: 'application/json',
'Content-Type': 'application/json',
};
diff --git a/frontend/src/data/history-api.js b/frontend/src/data/history-api.js
index e76a6284c6..7a72bf09de 100644
--- a/frontend/src/data/history-api.js
+++ b/frontend/src/data/history-api.js
@@ -2,13 +2,13 @@ import { throwIfNotSuccess } from './helper';
const URI = 'api/admin/events';
-function fetchAll () {
+function fetchAll() {
return fetch(URI, { credentials: 'include' })
.then(throwIfNotSuccess)
.then(response => response.json());
}
-function fetchHistoryForToggle (toggleName) {
+function fetchHistoryForToggle(toggleName) {
return fetch(`${URI}/${toggleName}`, { credentials: 'include' })
.then(throwIfNotSuccess)
.then(response => response.json());
diff --git a/frontend/src/data/strategy-api.js b/frontend/src/data/strategy-api.js
index eb6c0fae0f..16647ede0d 100644
--- a/frontend/src/data/strategy-api.js
+++ b/frontend/src/data/strategy-api.js
@@ -2,13 +2,13 @@ import { throwIfNotSuccess, headers } from './helper';
const URI = 'api/admin/strategies';
-function fetchAll () {
+function fetchAll() {
return fetch(URI, { credentials: 'include' })
.then(throwIfNotSuccess)
.then(response => response.json());
}
-function create (strategy) {
+function create(strategy) {
return fetch(URI, {
method: 'POST',
headers,
@@ -17,7 +17,7 @@ function create (strategy) {
}).then(throwIfNotSuccess);
}
-function update (strategy) {
+function update(strategy) {
return fetch(`${URI}/${strategy.name}`, {
method: 'put',
headers,
@@ -26,7 +26,7 @@ function update (strategy) {
}).then(throwIfNotSuccess);
}
-function remove (strategy) {
+function remove(strategy) {
return fetch(`${URI}/${strategy.name}`, {
method: 'DELETE',
headers,
diff --git a/frontend/src/index.jsx b/frontend/src/index.jsx
index 88aa0bf5ca..3f37ee31bc 100644
--- a/frontend/src/index.jsx
+++ b/frontend/src/index.jsx
@@ -4,7 +4,13 @@ import 'react-mdl/extra/material.js';
import React from 'react';
import ReactDOM from 'react-dom';
-import { applyRouterMiddleware, Router, Route, IndexRedirect, hashHistory } from 'react-router';
+import {
+ applyRouterMiddleware,
+ Router,
+ Route,
+ IndexRedirect,
+ hashHistory,
+} from 'react-router';
import { useScroll } from 'react-router-scroll';
import { Provider } from 'react-redux';
import thunkMiddleware from 'redux-thunk';
@@ -27,7 +33,10 @@ import ApplicationView from './page/applications/view';
let composeEnhancers;
-if (process.env.NODE_ENV !== 'production' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) {
+if (
+ process.env.NODE_ENV !== 'production' &&
+ window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
+) {
composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;
} else {
composeEnhancers = compose;
@@ -35,42 +44,88 @@ if (process.env.NODE_ENV !== 'production' && window.__REDUX_DEVTOOLS_EXTENSION_C
const unleashStore = createStore(
store,
- composeEnhancers(
- applyMiddleware(thunkMiddleware)
- )
+ composeEnhancers(applyMiddleware(thunkMiddleware))
);
// "pageTitle" and "link" attributes are for internal usage only
ReactDOM.render(
-
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
+
+
-
+
-
-
+
+
-
- , document.getElementById('app'));
+ ,
+ document.getElementById('app')
+);
diff --git a/frontend/src/page/applications/view.js b/frontend/src/page/applications/view.js
index 2ecfa22355..e8a6640f54 100644
--- a/frontend/src/page/applications/view.js
+++ b/frontend/src/page/applications/view.js
@@ -1,7 +1,9 @@
import React, { PropTypes } from 'react';
import ApplicationEditComponent from '../../component/application/application-edit-container';
-const render = ({ params }) =>
;
+const render = ({ params }) => (
+
+);
render.propTypes = {
params: PropTypes.object.isRequired,
diff --git a/frontend/src/page/features/create.js b/frontend/src/page/features/create.js
index f621b98def..cab5811e62 100644
--- a/frontend/src/page/features/create.js
+++ b/frontend/src/page/features/create.js
@@ -1,7 +1,6 @@
import React from 'react';
import AddFeatureToggleForm from '../../component/feature/form-add-container';
-
-const render = () => (
);
+const render = () =>
;
export default render;
diff --git a/frontend/src/page/features/index.js b/frontend/src/page/features/index.js
index b632addcd0..764327ced3 100644
--- a/frontend/src/page/features/index.js
+++ b/frontend/src/page/features/index.js
@@ -1,8 +1,6 @@
import React from 'react';
import FeatureListContainer from '../../component/feature/list-container';
-const render = () => (
);
+const render = () =>
;
export default render;
-
-
diff --git a/frontend/src/page/features/show.js b/frontend/src/page/features/show.js
index 3678b89567..b403541166 100644
--- a/frontend/src/page/features/show.js
+++ b/frontend/src/page/features/show.js
@@ -4,12 +4,15 @@ import ViewFeatureToggle from '../../component/feature/view-container';
export default class Features extends PureComponent {
static propTypes = {
params: PropTypes.object.isRequired,
- }
+ };
- render () {
+ render() {
const { params } = this.props;
return (
-
+
);
}
-};
+}
diff --git a/frontend/src/page/history/toggle.js b/frontend/src/page/history/toggle.js
index 95b4da6ac0..515485b373 100644
--- a/frontend/src/page/history/toggle.js
+++ b/frontend/src/page/history/toggle.js
@@ -1,7 +1,9 @@
import React, { PropTypes } from 'react';
import HistoryListToggle from '../../component/history/history-list-toggle-container';
-const render = ({ params }) =>
;
+const render = ({ params }) => (
+
+);
render.propTypes = {
params: PropTypes.object.isRequired,
diff --git a/frontend/src/page/strategies/create.js b/frontend/src/page/strategies/create.js
index bd94fcf7d1..7fc1f4727e 100644
--- a/frontend/src/page/strategies/create.js
+++ b/frontend/src/page/strategies/create.js
@@ -1,4 +1,4 @@
import React from 'react';
import AddStrategies from '../../component/strategies/add-container';
-export default () => (
);
+export default () =>
;
diff --git a/frontend/src/page/strategies/index.js b/frontend/src/page/strategies/index.js
index 8f41038bd0..6485b3c760 100644
--- a/frontend/src/page/strategies/index.js
+++ b/frontend/src/page/strategies/index.js
@@ -1,4 +1,4 @@
import React from 'react';
import Strategies from '../../component/strategies/list-container';
-export default () => (
);
+export default () =>
;
diff --git a/frontend/src/page/strategies/show.js b/frontend/src/page/strategies/show.js
index 0dc4fdbc76..0e438de7b5 100644
--- a/frontend/src/page/strategies/show.js
+++ b/frontend/src/page/strategies/show.js
@@ -1,7 +1,12 @@
import React, { PropTypes } from 'react';
import ShowStrategy from '../../component/strategies/strategy-details-container';
-const render = ({ params }) =>
;
+const render = ({ params }) => (
+
+);
render.propTypes = {
params: PropTypes.object.isRequired,
diff --git a/frontend/src/store/application/actions.js b/frontend/src/store/application/actions.js
index 3f295bd4c3..07306a3c4c 100644
--- a/frontend/src/store/application/actions.js
+++ b/frontend/src/store/application/actions.js
@@ -2,39 +2,55 @@ import api from '../../data/applications-api';
export const RECEIVE_ALL_APPLICATIONS = 'RECEIVE_ALL_APPLICATIONS';
export const ERROR_RECEIVE_ALL_APPLICATIONS = 'ERROR_RECEIVE_ALL_APPLICATIONS';
-export const ERROR_UPDATING_APPLICATION_DATA = 'ERROR_UPDATING_APPLICATION_DATA';
+export const ERROR_UPDATING_APPLICATION_DATA =
+ 'ERROR_UPDATING_APPLICATION_DATA';
export const RECEIVE_APPLICATION = 'RECEIVE_APPLICATION';
-const recieveAllApplications = (json) => ({
+const recieveAllApplications = json => ({
type: RECEIVE_ALL_APPLICATIONS,
value: json,
});
-const recieveApplication = (json) => ({
+const recieveApplication = json => ({
type: RECEIVE_APPLICATION,
value: json,
});
-const errorReceiveApplications = (statusCode, type = ERROR_RECEIVE_ALL_APPLICATIONS) => ({
+const errorReceiveApplications = (
+ statusCode,
+ type = ERROR_RECEIVE_ALL_APPLICATIONS
+) => ({
type,
statusCode,
});
-export function fetchAll () {
- return dispatch => api.fetchAll()
- .then(json => dispatch(recieveAllApplications(json)))
- .catch(error => dispatch(errorReceiveApplications(error)));
+export function fetchAll() {
+ return dispatch =>
+ api
+ .fetchAll()
+ .then(json => dispatch(recieveAllApplications(json)))
+ .catch(error => dispatch(errorReceiveApplications(error)));
}
-export function storeApplicationMetaData (appName, key, value) {
- return dispatch => api.storeApplicationMetaData(appName, key, value)
- .catch(error => dispatch(errorReceiveApplications(error, ERROR_UPDATING_APPLICATION_DATA)));
+export function storeApplicationMetaData(appName, key, value) {
+ return dispatch =>
+ api
+ .storeApplicationMetaData(appName, key, value)
+ .catch(error =>
+ dispatch(
+ errorReceiveApplications(
+ error,
+ ERROR_UPDATING_APPLICATION_DATA
+ )
+ )
+ );
}
-export function fetchApplication (appName) {
- return dispatch => api.fetchApplication(appName)
- .then(json => dispatch(recieveApplication(json)))
- .catch(error => dispatch(errorReceiveApplications(error)));
+export function fetchApplication(appName) {
+ return dispatch =>
+ api
+ .fetchApplication(appName)
+ .then(json => dispatch(recieveApplication(json)))
+ .catch(error => dispatch(errorReceiveApplications(error)));
}
-
diff --git a/frontend/src/store/application/index.js b/frontend/src/store/application/index.js
index b2daa39146..7ca0b5458f 100644
--- a/frontend/src/store/application/index.js
+++ b/frontend/src/store/application/index.js
@@ -1,14 +1,17 @@
import { fromJS, List, Map } from 'immutable';
import { RECEIVE_ALL_APPLICATIONS, RECEIVE_APPLICATION } from './actions';
-function getInitState () {
+function getInitState() {
return fromJS({ list: [], apps: {} });
}
const store = (state = getInitState(), action) => {
switch (action.type) {
case RECEIVE_APPLICATION:
- return state.setIn(['apps', action.value.appName], new Map(action.value));
+ return state.setIn(
+ ['apps', action.value.appName],
+ new Map(action.value)
+ );
case RECEIVE_ALL_APPLICATIONS:
return state.set('list', new List(action.value.applications));
default:
diff --git a/frontend/src/store/archive-actions.js b/frontend/src/store/archive-actions.js
index ff8795b822..b787c04e49 100644
--- a/frontend/src/store/archive-actions.js
+++ b/frontend/src/store/archive-actions.js
@@ -4,30 +4,33 @@ export const REVIVE_TOGGLE = 'REVIVE_TOGGLE';
export const RECEIVE_ARCHIVE = 'RECEIVE_ARCHIVE';
export const ERROR_RECEIVE_ARCHIVE = 'ERROR_RECEIVE_ARCHIVE';
-const receiveArchive = (json) => ({
+const receiveArchive = json => ({
type: RECEIVE_ARCHIVE,
value: json.features,
});
-const reviveToggle = (archiveFeatureToggle) => ({
+const reviveToggle = archiveFeatureToggle => ({
type: REVIVE_TOGGLE,
value: archiveFeatureToggle,
});
-const errorReceiveArchive = (statusCode) => ({
+const errorReceiveArchive = statusCode => ({
type: ERROR_RECEIVE_ARCHIVE,
statusCode,
});
-export function revive (featureToggle) {
- return dispatch => api.revive(featureToggle)
- .then(() => dispatch(reviveToggle(featureToggle)))
- .catch(error => dispatch(errorReceiveArchive(error)));
+export function revive(featureToggle) {
+ return dispatch =>
+ api
+ .revive(featureToggle)
+ .then(() => dispatch(reviveToggle(featureToggle)))
+ .catch(error => dispatch(errorReceiveArchive(error)));
}
-
-export function fetchArchive () {
- return dispatch => api.fetchAll()
- .then(json => dispatch(receiveArchive(json)))
- .catch(error => dispatch(errorReceiveArchive(error)));
+export function fetchArchive() {
+ return dispatch =>
+ api
+ .fetchAll()
+ .then(json => dispatch(receiveArchive(json)))
+ .catch(error => dispatch(errorReceiveArchive(error)));
}
diff --git a/frontend/src/store/archive-store.js b/frontend/src/store/archive-store.js
index 674e2733bb..e8caec466a 100644
--- a/frontend/src/store/archive-store.js
+++ b/frontend/src/store/archive-store.js
@@ -1,14 +1,16 @@
import { List, Map as $Map } from 'immutable';
import { RECEIVE_ARCHIVE, REVIVE_TOGGLE } from './archive-actions';
-function getInitState () {
+function getInitState() {
return new $Map({ list: new List() });
}
const archiveStore = (state = getInitState(), action) => {
switch (action.type) {
case REVIVE_TOGGLE:
- return state.update('list', (list) => list.filter(item => item.name !== action.value));
+ return state.update('list', list =>
+ list.filter(item => item.name !== action.value)
+ );
case RECEIVE_ARCHIVE:
return state.set('list', new List(action.value));
default:
diff --git a/frontend/src/store/client-instance-actions.js b/frontend/src/store/client-instance-actions.js
index 03de9edcf5..de39b88903 100644
--- a/frontend/src/store/client-instance-actions.js
+++ b/frontend/src/store/client-instance-actions.js
@@ -3,18 +3,20 @@ import api from '../data/client-instance-api';
export const RECEIVE_CLIENT_INSTANCES = 'RECEIVE_CLIENT_INSTANCES';
export const ERROR_RECEIVE_CLIENT_INSTANCES = 'ERROR_RECEIVE_CLIENT_INSTANCES';
-const receiveClientInstances = (json) => ({
+const receiveClientInstances = json => ({
type: RECEIVE_CLIENT_INSTANCES,
value: json,
});
-const errorReceiveClientInstances = (statusCode) => ({
+const errorReceiveClientInstances = statusCode => ({
type: RECEIVE_CLIENT_INSTANCES,
statusCode,
});
-export function fetchClientInstances () {
- return dispatch => api.fetchAll()
- .then(json => dispatch(receiveClientInstances(json)))
- .catch(error => dispatch(errorReceiveClientInstances(error)));
+export function fetchClientInstances() {
+ return dispatch =>
+ api
+ .fetchAll()
+ .then(json => dispatch(receiveClientInstances(json)))
+ .catch(error => dispatch(errorReceiveClientInstances(error)));
}
diff --git a/frontend/src/store/client-instance-store.js b/frontend/src/store/client-instance-store.js
index d075fbf841..f7deda4ae6 100644
--- a/frontend/src/store/client-instance-store.js
+++ b/frontend/src/store/client-instance-store.js
@@ -1,7 +1,7 @@
import { fromJS } from 'immutable';
import { RECEIVE_CLIENT_INSTANCES } from './client-instance-actions';
-function getInitState () {
+function getInitState() {
return fromJS([]);
}
diff --git a/frontend/src/store/error-actions.js b/frontend/src/store/error-actions.js
index 5b8a3682df..3d378e690e 100644
--- a/frontend/src/store/error-actions.js
+++ b/frontend/src/store/error-actions.js
@@ -3,6 +3,4 @@ export const MUTE_ERROR = 'MUTE_ERROR';
export const muteErrors = () => ({ type: MUTE_ERRORS });
-export const muteError = (error) => ({ type: MUTE_ERROR, error });
-
-
+export const muteError = error => ({ type: MUTE_ERROR, error });
diff --git a/frontend/src/store/error-store.js b/frontend/src/store/error-store.js
index fd9422ae00..1645795d82 100644
--- a/frontend/src/store/error-store.js
+++ b/frontend/src/store/error-store.js
@@ -11,21 +11,20 @@ import {
ERROR_UPDATING_STRATEGY,
ERROR_CREATING_STRATEGY,
ERROR_RECEIVE_STRATEGIES,
-
} from './strategy/actions';
const debug = require('debug')('unleash:error-store');
-function getInitState () {
+function getInitState() {
return new $Map({
list: new List(),
});
}
-function addErrorIfNotAlreadyInList (state, error) {
+function addErrorIfNotAlreadyInList(state, error) {
debug('Got error', error);
if (state.get('list').indexOf(error) < 0) {
- return state.update('list', (list) => list.push(error));
+ return state.update('list', list => list.push(error));
}
return state;
}
@@ -41,7 +40,9 @@ const strategies = (state = getInitState(), action) => {
case ERROR_RECEIVE_STRATEGIES:
return addErrorIfNotAlreadyInList(state, action.error.message);
case MUTE_ERROR:
- return state.update('list', (list) => list.remove(list.indexOf(action.error)));
+ return state.update('list', list =>
+ list.remove(list.indexOf(action.error))
+ );
default:
return state;
}
diff --git a/frontend/src/store/feature-actions.js b/frontend/src/store/feature-actions.js
index 09d79e08c5..86f6421e0f 100644
--- a/frontend/src/store/feature-actions.js
+++ b/frontend/src/store/feature-actions.js
@@ -15,22 +15,21 @@ export const ERROR_CREATING_FEATURE_TOGGLE = 'ERROR_CREATING_FEATURE_TOGGLE';
export const ERROR_UPDATE_FEATURE_TOGGLE = 'ERROR_UPDATE_FEATURE_TOGGLE';
export const ERROR_REMOVE_FEATURE_TOGGLE = 'ERROR_REMOVE_FEATURE_TOGGLE';
-export function toggleFeature (name) {
+export function toggleFeature(name) {
debug('Toggle feature toggle ', name);
return dispatch => {
dispatch(requestToggleFeatureToggle(name));
};
-};
+}
-export function editFeatureToggle (featureToggle) {
+export function editFeatureToggle(featureToggle) {
debug('Update feature toggle ', featureToggle);
return dispatch => {
dispatch(requestUpdateFeatureToggle(featureToggle));
};
-};
+}
-
-function receiveFeatureToggles (json) {
+function receiveFeatureToggles(json) {
debug('reviced feature toggles', json);
return {
type: RECEIVE_FEATURE_TOGGLES,
@@ -39,64 +38,73 @@ function receiveFeatureToggles (json) {
};
}
-function dispatchAndThrow (dispatch, type) {
- return (error) => {
+function dispatchAndThrow(dispatch, type) {
+ return error => {
dispatch({ type, error, receivedAt: Date.now() });
throw error;
};
}
-export function fetchFeatureToggles () {
+export function fetchFeatureToggles() {
debug('Start fetching feature toggles');
return dispatch => {
dispatch({ type: START_FETCH_FEATURE_TOGGLES });
- return api.fetchAll()
+ return api
+ .fetchAll()
.then(json => dispatch(receiveFeatureToggles(json)))
.catch(dispatchAndThrow(dispatch, ERROR_FETCH_FEATURE_TOGGLES));
};
}
-export function createFeatureToggles (featureToggle) {
+export function createFeatureToggles(featureToggle) {
return dispatch => {
dispatch({ type: START_CREATE_FEATURE_TOGGLE });
- return api.create(featureToggle)
+ return api
+ .create(featureToggle)
.then(() => dispatch({ type: ADD_FEATURE_TOGGLE, featureToggle }))
.catch(dispatchAndThrow(dispatch, ERROR_CREATING_FEATURE_TOGGLE));
};
}
-export function requestToggleFeatureToggle (name) {
+export function requestToggleFeatureToggle(name) {
return dispatch => {
dispatch({ type: START_UPDATE_FEATURE_TOGGLE });
- return api.toggle(name)
+ return api
+ .toggle(name)
.then(() => dispatch({ type: TOGGLE_FEATURE_TOGGLE, name }))
.catch(dispatchAndThrow(dispatch, ERROR_UPDATE_FEATURE_TOGGLE));
};
}
-export function requestUpdateFeatureToggle (featureToggle) {
+export function requestUpdateFeatureToggle(featureToggle) {
return dispatch => {
dispatch({ type: START_UPDATE_FEATURE_TOGGLE });
- return api.update(featureToggle)
- .then(() => dispatch({ type: UPDATE_FEATURE_TOGGLE, featureToggle }))
+ return api
+ .update(featureToggle)
+ .then(() =>
+ dispatch({ type: UPDATE_FEATURE_TOGGLE, featureToggle })
+ )
.catch(dispatchAndThrow(dispatch, ERROR_UPDATE_FEATURE_TOGGLE));
};
}
-export function removeFeatureToggle (featureToggleName) {
+export function removeFeatureToggle(featureToggleName) {
return dispatch => {
dispatch({ type: START_REMOVE_FEATURE_TOGGLE });
- return api.remove(featureToggleName)
- .then(() => dispatch({ type: REMOVE_FEATURE_TOGGLE, featureToggleName }))
+ return api
+ .remove(featureToggleName)
+ .then(() =>
+ dispatch({ type: REMOVE_FEATURE_TOGGLE, featureToggleName })
+ )
.catch(dispatchAndThrow(dispatch, ERROR_REMOVE_FEATURE_TOGGLE));
};
}
-export function validateName (featureToggleName) {
+export function validateName(featureToggleName) {
return api.validate({ name: featureToggleName });
}
diff --git a/frontend/src/store/feature-metrics-actions.js b/frontend/src/store/feature-metrics-actions.js
index c9914cd541..2c2fb409e4 100644
--- a/frontend/src/store/feature-metrics-actions.js
+++ b/frontend/src/store/feature-metrics-actions.js
@@ -8,7 +8,7 @@ export const START_FETCH_SEEN_APP = 'START_FETCH_SEEN_APP';
export const RECEIVE_SEEN_APPS = 'RECEIVE_SEEN_APPS';
export const ERROR_FETCH_SEEN_APP = 'ERROR_FETCH_SEEN_APP';
-function receiveFeatureMetrics (json) {
+function receiveFeatureMetrics(json) {
return {
type: RECEIVE_FEATURE_METRICS,
value: json,
@@ -16,7 +16,7 @@ function receiveFeatureMetrics (json) {
};
}
-function receiveSeenApps (json) {
+function receiveSeenApps(json) {
return {
type: RECEIVE_SEEN_APPS,
value: json,
@@ -24,30 +24,31 @@ function receiveSeenApps (json) {
};
}
-function dispatchAndThrow (dispatch, type) {
- return (error) => {
+function dispatchAndThrow(dispatch, type) {
+ return error => {
dispatch({ type, error, receivedAt: Date.now() });
throw error;
};
}
-export function fetchFeatureMetrics () {
+export function fetchFeatureMetrics() {
return dispatch => {
dispatch({ type: START_FETCH_SEEN_APP });
- return api.fetchFeatureMetrics()
+ return api
+ .fetchFeatureMetrics()
.then(json => dispatch(receiveFeatureMetrics(json)))
.catch(dispatchAndThrow(dispatch, ERROR_FETCH_SEEN_APP));
};
}
-export function fetchSeenApps () {
+export function fetchSeenApps() {
return dispatch => {
dispatch({ type: START_FETCH_FEATURE_METRICS });
- return api.fetchSeenApps()
+ return api
+ .fetchSeenApps()
.then(json => dispatch(receiveSeenApps(json)))
.catch(dispatchAndThrow(dispatch, ERROR_FETCH_FEATURE_TOGGLES));
};
}
-
diff --git a/frontend/src/store/feature-metrics-store.js b/frontend/src/store/feature-metrics-store.js
index f73387f3a0..2f8291bcce 100644
--- a/frontend/src/store/feature-metrics-store.js
+++ b/frontend/src/store/feature-metrics-store.js
@@ -5,13 +5,15 @@ import {
RECEIVE_SEEN_APPS,
} from './feature-metrics-actions';
-
-const metrics = (state = fromJS({ lastHour: {}, lastMinute: {}, seenApps: {} }), action) => {
+const metrics = (
+ state = fromJS({ lastHour: {}, lastMinute: {}, seenApps: {} }),
+ action
+) => {
switch (action.type) {
case RECEIVE_SEEN_APPS:
return state.set('seenApps', new $Map(action.value));
case RECEIVE_FEATURE_METRICS:
- return state.withMutations((ctx) => {
+ return state.withMutations(ctx => {
ctx.set('lastHour', new $Map(action.value.lastHour));
ctx.set('lastMinute', new $Map(action.value.lastMinute));
return ctx;
diff --git a/frontend/src/store/feature-store.js b/frontend/src/store/feature-store.js
index e3a4f4850e..cc10834429 100644
--- a/frontend/src/store/feature-store.js
+++ b/frontend/src/store/feature-store.js
@@ -1,7 +1,6 @@
import { List, Map as $Map } from 'immutable';
const debug = require('debug')('unleash:feature-store');
-
import {
ADD_FEATURE_TOGGLE,
RECEIVE_FEATURE_TOGGLES,
@@ -10,7 +9,6 @@ import {
TOGGLE_FEATURE_TOGGLE,
} from './feature-actions';
-
const features = (state = new List([]), action) => {
switch (action.type) {
case ADD_FEATURE_TOGGLE:
@@ -18,7 +16,9 @@ const features = (state = new List([]), action) => {
return state.push(new $Map(action.featureToggle));
case REMOVE_FEATURE_TOGGLE:
debug(REMOVE_FEATURE_TOGGLE, action);
- return state.filter(toggle => toggle.get('name') !== action.featureToggleName);
+ return state.filter(
+ toggle => toggle.get('name') !== action.featureToggleName
+ );
case TOGGLE_FEATURE_TOGGLE:
debug(TOGGLE_FEATURE_TOGGLE, action);
return state.map(toggle => {
diff --git a/frontend/src/store/history-actions.js b/frontend/src/store/history-actions.js
index 51f2b3daef..3367123358 100644
--- a/frontend/src/store/history-actions.js
+++ b/frontend/src/store/history-actions.js
@@ -5,30 +5,33 @@ export const ERROR_RECEIVE_HISTORY = 'ERROR_RECEIVE_HISTORY';
export const RECEIVE_HISTORY_FOR_TOGGLE = 'RECEIVE_HISTORY_FOR_TOGGLE';
-const receiveHistory = (json) => ({
+const receiveHistory = json => ({
type: RECEIVE_HISTORY,
value: json.events,
});
-const receiveHistoryforToggle = (json) => ({
+const receiveHistoryforToggle = json => ({
type: RECEIVE_HISTORY_FOR_TOGGLE,
value: json,
});
-const errorReceiveHistory = (statusCode) => ({
+const errorReceiveHistory = statusCode => ({
type: ERROR_RECEIVE_HISTORY,
statusCode,
});
-export function fetchHistory () {
- return dispatch => api.fetchAll()
- .then(json => dispatch(receiveHistory(json)))
- .catch(error => dispatch(errorReceiveHistory(error)));
+export function fetchHistory() {
+ return dispatch =>
+ api
+ .fetchAll()
+ .then(json => dispatch(receiveHistory(json)))
+ .catch(error => dispatch(errorReceiveHistory(error)));
}
-
-export function fetchHistoryForToggle (toggleName) {
- return dispatch => api.fetchHistoryForToggle(toggleName)
- .then(json => dispatch(receiveHistoryforToggle(json)))
- .catch(error => dispatch(errorReceiveHistory(error)));
+export function fetchHistoryForToggle(toggleName) {
+ return dispatch =>
+ api
+ .fetchHistoryForToggle(toggleName)
+ .then(json => dispatch(receiveHistoryforToggle(json)))
+ .catch(error => dispatch(errorReceiveHistory(error)));
}
diff --git a/frontend/src/store/history-store.js b/frontend/src/store/history-store.js
index 7ec098235a..0e6a435094 100644
--- a/frontend/src/store/history-store.js
+++ b/frontend/src/store/history-store.js
@@ -1,14 +1,17 @@
import { List, Map as $Map } from 'immutable';
import { RECEIVE_HISTORY, RECEIVE_HISTORY_FOR_TOGGLE } from './history-actions';
-function getInitState () {
+function getInitState() {
return new $Map({ list: new List(), toggles: new $Map() });
}
const historyStore = (state = getInitState(), action) => {
switch (action.type) {
case RECEIVE_HISTORY_FOR_TOGGLE:
- return state.setIn(['toggles', action.value.toggleName], new List(action.value.events));
+ return state.setIn(
+ ['toggles', action.value.toggleName],
+ new List(action.value.events)
+ );
case RECEIVE_HISTORY:
return state.set('list', new List(action.value));
default:
diff --git a/frontend/src/store/input-actions.js b/frontend/src/store/input-actions.js
index 39dbd3d707..c59354d3c5 100644
--- a/frontend/src/store/input-actions.js
+++ b/frontend/src/store/input-actions.js
@@ -9,13 +9,49 @@ export const actions = {
MOVE: 'MOVE',
};
-export const createInit = ({ id, value }) => ({ type: actions.INIT, id, value });
-export const createInc = ({ id, key }) => ({ type: actions.INCREMENT_VALUE, id, key });
-export const createSet = ({ id, key, value }) => ({ type: actions.SET_VALUE, id, key, value });
-export const createPush = ({ id, key, value }) => ({ type: actions.LIST_PUSH, id, key, value });
-export const createPop = ({ id, key, index }) => ({ type: actions.LIST_POP, id, key, index });
-export const createMove = ({ id, key, index, toIndex }) => ({ type: actions.MOVE, id, key, index, toIndex });
-export const createUp = ({ id, key, index, newValue, merge }) => ({ type: actions.LIST_UP, id, key, index, newValue, merge });
+export const createInit = ({ id, value }) => ({
+ type: actions.INIT,
+ id,
+ value,
+});
+export const createInc = ({ id, key }) => ({
+ type: actions.INCREMENT_VALUE,
+ id,
+ key,
+});
+export const createSet = ({ id, key, value }) => ({
+ type: actions.SET_VALUE,
+ id,
+ key,
+ value,
+});
+export const createPush = ({ id, key, value }) => ({
+ type: actions.LIST_PUSH,
+ id,
+ key,
+ value,
+});
+export const createPop = ({ id, key, index }) => ({
+ type: actions.LIST_POP,
+ id,
+ key,
+ index,
+});
+export const createMove = ({ id, key, index, toIndex }) => ({
+ type: actions.MOVE,
+ id,
+ key,
+ index,
+ toIndex,
+});
+export const createUp = ({ id, key, index, newValue, merge }) => ({
+ type: actions.LIST_UP,
+ id,
+ key,
+ index,
+ newValue,
+ merge,
+});
export const createClear = ({ id }) => ({ type: actions.CLEAR, id });
export default actions;
diff --git a/frontend/src/store/input-store.js b/frontend/src/store/input-store.js
index c3559bf44f..f93cabcad7 100644
--- a/frontend/src/store/input-store.js
+++ b/frontend/src/store/input-store.js
@@ -1,75 +1,75 @@
import { Map as $Map, List, fromJS } from 'immutable';
import actions from './input-actions';
-function getInitState () {
+function getInitState() {
return new $Map();
}
-function init (state, { id, value }) {
+function init(state, { id, value }) {
state = assertId(state, id);
return state.setIn(id, fromJS(value));
}
-function assertId (state, id) {
+function assertId(state, id) {
if (!state.hasIn(id)) {
return state.setIn(id, new $Map({ inputId: id }));
}
return state;
}
-function assertList (state, id, key) {
+function assertList(state, id, key) {
if (!state.getIn(id).has(key)) {
return state.setIn(id.concat([key]), new List());
}
return state;
}
-function setKeyValue (state, { id, key, value }) {
+function setKeyValue(state, { id, key, value }) {
state = assertId(state, id);
return state.setIn(id.concat([key]), value);
}
-function increment (state, { id, key }) {
+function increment(state, { id, key }) {
state = assertId(state, id);
return state.updateIn(id.concat([key]), (value = 0) => value + 1);
}
-function clear (state, { id }) {
+function clear(state, { id }) {
if (state.hasIn(id)) {
return state.removeIn(id);
}
return state;
}
-function addToList (state, { id, key, value }) {
+function addToList(state, { id, key, value }) {
state = assertId(state, id);
state = assertList(state, id, key);
- return state.updateIn(id.concat([key]), (list) => list.push(value));
+ return state.updateIn(id.concat([key]), list => list.push(value));
}
-function updateInList (state, { id, key, index, newValue, merge }) {
+function updateInList(state, { id, key, index, newValue, merge }) {
state = assertId(state, id);
state = assertList(state, id, key);
- return state.updateIn(id.concat([key]), (list) => {
+ return state.updateIn(id.concat([key]), list => {
if (merge && list.has(index)) {
newValue = list.get(index).merge(new $Map(newValue));
- } else if (typeof newValue !== 'string' ) {
+ } else if (typeof newValue !== 'string') {
newValue = fromJS(newValue);
}
return list.set(index, newValue);
});
}
-function removeFromList (state, { id, key, index }) {
+function removeFromList(state, { id, key, index }) {
state = assertId(state, id);
state = assertList(state, id, key);
- return state.updateIn(id.concat([key]), (list) => list.remove(index));
+ return state.updateIn(id.concat([key]), list => list.remove(index));
}
-function move (state, { id, key, index, toIndex }) {
+function move(state, { id, key, index, toIndex }) {
return state.updateIn(id.concat([key]), list => {
const olditem = list.get(index);
return list.delete(index).insert(toIndex, olditem);
diff --git a/frontend/src/store/settings/actions.js b/frontend/src/store/settings/actions.js
index 5aaa47345d..d1b6ffda4a 100644
--- a/frontend/src/store/settings/actions.js
+++ b/frontend/src/store/settings/actions.js
@@ -7,4 +7,5 @@ export const updateSetting = (group, field, value) => ({
value,
});
-export const updateSettingForGroup = (group) => (field, value) => updateSetting(group, field, value);
+export const updateSettingForGroup = group => (field, value) =>
+ updateSetting(group, field, value);
diff --git a/frontend/src/store/settings/index.js b/frontend/src/store/settings/index.js
index 12d883b154..719da261cb 100644
--- a/frontend/src/store/settings/index.js
+++ b/frontend/src/store/settings/index.js
@@ -5,7 +5,7 @@ import { UPDATE_SETTING } from './actions';
const localStorage = window.localStorage || {};
const SETTINGS = 'settings';
-function getInitState () {
+function getInitState() {
try {
const state = JSON.parse(localStorage.getItem(SETTINGS));
return state ? fromJS(state) : new $Map();
@@ -14,8 +14,11 @@ function getInitState () {
}
}
-function updateSetting (state, action) {
- const newState = state.updateIn([action.group, action.field], () => action.value);
+function updateSetting(state, action) {
+ const newState = state.updateIn(
+ [action.group, action.field],
+ () => action.value
+ );
localStorage.setItem(SETTINGS, JSON.stringify(newState.toJSON()));
return newState;
diff --git a/frontend/src/store/strategy/actions.js b/frontend/src/store/strategy/actions.js
index 84525dd291..6e7bc16781 100644
--- a/frontend/src/store/strategy/actions.js
+++ b/frontend/src/store/strategy/actions.js
@@ -12,77 +12,79 @@ export const ERROR_RECEIVE_STRATEGIES = 'ERROR_RECEIVE_STRATEGIES';
export const ERROR_CREATING_STRATEGY = 'ERROR_CREATING_STRATEGY';
export const ERROR_UPDATING_STRATEGY = 'ERROR_UPDATING_STRATEGY';
-const addStrategy = (strategy) => ({ type: ADD_STRATEGY, strategy });
-const createRemoveStrategy = (strategy) => ({ type: REMOVE_STRATEGY, strategy });
-const updatedStrategy = (strategy) => ({ type: UPDATE_STRATEGY, strategy });
+const addStrategy = strategy => ({ type: ADD_STRATEGY, strategy });
+const createRemoveStrategy = strategy => ({ type: REMOVE_STRATEGY, strategy });
+const updatedStrategy = strategy => ({ type: UPDATE_STRATEGY, strategy });
-const errorCreatingStrategy = (statusCode) => ({
+const errorCreatingStrategy = statusCode => ({
type: ERROR_CREATING_STRATEGY,
statusCode,
});
const startRequest = () => ({ type: REQUEST_STRATEGIES });
-
-const receiveStrategies = (json) => ({
+const receiveStrategies = json => ({
type: RECEIVE_STRATEGIES,
value: json.strategies,
});
const startCreate = () => ({ type: START_CREATE_STRATEGY });
-const errorReceiveStrategies = (statusCode) => ({
+const errorReceiveStrategies = statusCode => ({
type: ERROR_RECEIVE_STRATEGIES,
statusCode,
});
const startUpdate = () => ({ type: START_UPDATE_STRATEGY });
-function dispatchAndThrow (dispatch, type) {
- return (error) => {
+function dispatchAndThrow(dispatch, type) {
+ return error => {
dispatch({ type, error, receivedAt: Date.now() });
throw error;
};
}
-export function fetchStrategies () {
+export function fetchStrategies() {
return dispatch => {
dispatch(startRequest());
- return api.fetchAll()
+ return api
+ .fetchAll()
.then(json => dispatch(receiveStrategies(json)))
.catch(error => dispatch(errorReceiveStrategies(error)));
};
}
-export function createStrategy (strategy) {
+export function createStrategy(strategy) {
return dispatch => {
dispatch(startCreate());
- return api.create(strategy)
+ return api
+ .create(strategy)
.then(() => dispatch(addStrategy(strategy)))
.catch(error => dispatch(errorCreatingStrategy(error)));
};
}
-export function updateStrategy (strategy) {
+export function updateStrategy(strategy) {
return dispatch => {
dispatch(startUpdate());
- return api.update(strategy)
+ return api
+ .update(strategy)
.then(() => dispatch(updatedStrategy(strategy)))
.catch(dispatchAndThrow(dispatch, ERROR_UPDATING_STRATEGY));
};
}
-
-export function removeStrategy (strategy) {
- return dispatch => api.remove(strategy)
- .then(() => dispatch(createRemoveStrategy(strategy)))
- .catch(error => dispatch(errorCreatingStrategy(error)));
+export function removeStrategy(strategy) {
+ return dispatch =>
+ api
+ .remove(strategy)
+ .then(() => dispatch(createRemoveStrategy(strategy)))
+ .catch(error => dispatch(errorCreatingStrategy(error)));
}
-export function getApplicationsWithStrategy (strategyName) {
+export function getApplicationsWithStrategy(strategyName) {
return applicationApi.fetchApplicationsWithStrategyName(strategyName);
}
-
diff --git a/frontend/src/store/strategy/index.js b/frontend/src/store/strategy/index.js
index 125f3fc530..c17eb2e8dc 100644
--- a/frontend/src/store/strategy/index.js
+++ b/frontend/src/store/strategy/index.js
@@ -1,26 +1,33 @@
import { List, Map as $Map } from 'immutable';
-import { RECEIVE_STRATEGIES, REMOVE_STRATEGY, ADD_STRATEGY, UPDATE_STRATEGY } from './actions';
+import {
+ RECEIVE_STRATEGIES,
+ REMOVE_STRATEGY,
+ ADD_STRATEGY,
+ UPDATE_STRATEGY,
+} from './actions';
-function getInitState () {
+function getInitState() {
return new $Map({ list: new List() });
}
-function removeStrategy (state, action) {
+function removeStrategy(state, action) {
const indexToRemove = state.get('list').indexOf(action.strategy);
if (indexToRemove !== -1) {
- return state.update('list', (list) => list.remove(indexToRemove));
+ return state.update('list', list => list.remove(indexToRemove));
}
return state;
}
-function updateStrategy (state, action) {
- return state.update('list', (list) => list.map(strategy => {
- if (strategy.name === action.strategy.name) {
- return action.strategy;
- } else {
- return strategy;
- }
- }));
+function updateStrategy(state, action) {
+ return state.update('list', list =>
+ list.map(strategy => {
+ if (strategy.name === action.strategy.name) {
+ return action.strategy;
+ } else {
+ return strategy;
+ }
+ })
+ );
}
const strategies = (state = getInitState(), action) => {
@@ -30,7 +37,7 @@ const strategies = (state = getInitState(), action) => {
case REMOVE_STRATEGY:
return removeStrategy(state, action);
case ADD_STRATEGY:
- return state.update('list', (list) => list.push(action.strategy));
+ return state.update('list', list => list.push(action.strategy));
case UPDATE_STRATEGY:
return updateStrategy(state, action);
default:
diff --git a/frontend/src/store/user/actions.js b/frontend/src/store/user/actions.js
index 69818de1e9..502590ec32 100644
--- a/frontend/src/store/user/actions.js
+++ b/frontend/src/store/user/actions.js
@@ -2,7 +2,7 @@ export const USER_UPDATE_USERNAME = 'USER_UPDATE_USERNAME';
export const USER_SAVE = 'USER_SAVE';
export const USER_EDIT = 'USER_EDIT';
-export const updateUserName = (value) => ({
+export const updateUserName = value => ({
type: USER_UPDATE_USERNAME,
value,
});
diff --git a/frontend/src/store/user/index.js b/frontend/src/store/user/index.js
index a5d7ae2bc8..3adb7f289c 100644
--- a/frontend/src/store/user/index.js
+++ b/frontend/src/store/user/index.js
@@ -4,12 +4,13 @@ import { USER_UPDATE_USERNAME, USER_SAVE, USER_EDIT } from './actions';
const COOKIE_NAME = 'username';
// Ref: http://stackoverflow.com/questions/10730362/get-cookie-by-name
-function readCookie () {
+function readCookie() {
const nameEQ = `${COOKIE_NAME}=`;
const ca = document.cookie.split(';');
- for (let i = 0;i < ca.length;i++) {
+ for (let i = 0; i < ca.length; i++) {
let c = ca[i];
- while (c.charAt(0) == ' ') { // eslint-disable-line eqeqeq
+ // eslint-disable-next-line eqeqeq
+ while (c.charAt(0) == ' ') {
c = c.substring(1, c.length);
}
if (c.indexOf(nameEQ) === 0) {
@@ -18,22 +19,23 @@ function readCookie () {
}
}
-function writeCookie (userName) {
- document.cookie = `${COOKIE_NAME}=${encodeURIComponent(userName)}; expires=Thu, 18 Dec 2099 12:00:00 UTC`;
+function writeCookie(userName) {
+ document.cookie = `${COOKIE_NAME}=${encodeURIComponent(
+ userName
+ )}; expires=Thu, 18 Dec 2099 12:00:00 UTC`;
}
-
-function getInitState () {
+function getInitState() {
const userName = decodeURIComponent(readCookie(COOKIE_NAME));
const showDialog = !userName;
return new $Map({ userName, showDialog });
}
-function updateUserName (state, action) {
+function updateUserName(state, action) {
return state.set('userName', action.value);
}
-function save (state) {
+function save(state) {
const userName = state.get('userName');
if (userName) {
writeCookie(userName);
diff --git a/frontend/webpack.config.js b/frontend/webpack.config.js
index db8ffb84bc..dc19020889 100644
--- a/frontend/webpack.config.js
+++ b/frontend/webpack.config.js
@@ -54,14 +54,17 @@ module.exports = {
sourceMap: true,
modules: true,
importLoaders: 1,
- localIdentName: '[name]__[local]___[hash:base64:5]',
+ localIdentName:
+ '[name]__[local]___[hash:base64:5]',
},
},
{
loader: 'sass-loader',
options: {
// data: '@import "theme/_config.scss";',
- includePaths: [path.resolve(__dirname, './src')],
+ includePaths: [
+ path.resolve(__dirname, './src'),
+ ],
},
},
],
@@ -69,7 +72,10 @@ module.exports = {
},
{
test: /\.css$/,
- loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader' }),
+ loader: ExtractTextPlugin.extract({
+ fallback: 'style-loader',
+ use: 'css-loader',
+ }),
},
],
},
diff --git a/frontend/yarn.lock b/frontend/yarn.lock
index b231965333..f1e3580bb5 100644
--- a/frontend/yarn.lock
+++ b/frontend/yarn.lock
@@ -43,7 +43,7 @@ acorn@^4.0.3, acorn@^4.0.4:
version "4.0.13"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787"
-acorn@^5.0.0, acorn@^5.0.1:
+acorn@^5.0.0, acorn@^5.1.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.1.1.tgz#53fe161111f912ab999ee887a90a0bc52822fd75"
@@ -173,6 +173,13 @@ array-flatten@^2.1.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-2.1.1.tgz#426bb9da84090c1838d812c8150af20a8331e296"
+array-includes@^3.0.3:
+ version "3.0.3"
+ resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.0.3.tgz#184b48f62d92d7452bb31b323165c7f8bd02266d"
+ dependencies:
+ define-properties "^1.1.2"
+ es-abstract "^1.7.0"
+
array-union@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39"
@@ -1250,9 +1257,9 @@ chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3:
strip-ansi "^3.0.0"
supports-color "^2.0.0"
-chalk@^2.0.0, chalk@^2.0.1:
- version "2.0.1"
- resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.0.1.tgz#dbec49436d2ae15f536114e76d14656cdbc0f44d"
+chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0:
+ version "2.1.0"
+ resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.1.0.tgz#ac5becf14fa21b99c6c92ca7a7d7cfd5b17e743e"
dependencies:
ansi-styles "^3.1.0"
escape-string-regexp "^1.0.5"
@@ -1526,6 +1533,14 @@ cross-spawn@^3.0.0:
lru-cache "^4.0.1"
which "^1.2.9"
+cross-spawn@^5.1.0:
+ version "5.1.0"
+ resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449"
+ dependencies:
+ lru-cache "^4.0.1"
+ shebang-command "^1.2.0"
+ which "^1.2.9"
+
cryptiles@2.x.x:
version "2.0.5"
resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8"
@@ -1698,6 +1713,13 @@ default-require-extensions@^1.0.0:
dependencies:
strip-bom "^2.0.0"
+define-properties@^1.1.2:
+ version "1.1.2"
+ resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94"
+ dependencies:
+ foreach "^2.0.5"
+ object-keys "^1.0.8"
+
defined@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/defined/-/defined-1.0.0.tgz#c98d9bcef75674188e110969151199e39b1fa693"
@@ -1890,6 +1912,24 @@ error-stack-parser@^1.3.6:
dependencies:
stackframe "^0.3.1"
+es-abstract@^1.7.0:
+ version "1.8.0"
+ resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.8.0.tgz#3b00385e85729932beffa9163bbea1234e932914"
+ dependencies:
+ es-to-primitive "^1.1.1"
+ function-bind "^1.1.0"
+ has "^1.0.1"
+ is-callable "^1.1.3"
+ is-regex "^1.0.4"
+
+es-to-primitive@^1.1.1:
+ version "1.1.1"
+ resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.1.1.tgz#45355248a88979034b6792e19bb81f2b7975dd0d"
+ dependencies:
+ is-callable "^1.1.1"
+ is-date-object "^1.0.1"
+ is-symbol "^1.0.1"
+
es5-ext@^0.10.14, es5-ext@^0.10.9, es5-ext@~0.10.14:
version "0.10.24"
resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.24.tgz#a55877c9924bc0c8d9bd3c2cbe17495ac1709b14"
@@ -1970,6 +2010,13 @@ escope@^3.6.0:
esrecurse "^4.1.0"
estraverse "^4.1.1"
+eslint-config-finn-prettier@^3.0.0:
+ version "3.0.0"
+ resolved "https://registry.yarnpkg.com/eslint-config-finn-prettier/-/eslint-config-finn-prettier-3.0.0.tgz#01122c53dc0ae022988f1c69b50e59a00bf238c6"
+ dependencies:
+ eslint-config-prettier "^2.0.0"
+ eslint-plugin-prettier "^2.0.1"
+
eslint-config-finn-react@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/eslint-config-finn-react/-/eslint-config-finn-react-2.0.0.tgz#94d11891168eeb110aedd39285c31700e9f09bc2"
@@ -1982,6 +2029,12 @@ eslint-config-finn@^2.0.0:
dependencies:
eslint-config-schibsted "^4.0.0"
+eslint-config-prettier@^2.0.0:
+ version "2.3.0"
+ resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-2.3.0.tgz#b75b1eabea0c8b97b34403647ee25db349b9d8a0"
+ dependencies:
+ get-stdin "^5.0.1"
+
eslint-config-schibsted-react@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/eslint-config-schibsted-react/-/eslint-config-schibsted-react-4.0.1.tgz#c1fca494bcb142b32cc413885b93eff5ff541e2a"
@@ -1990,13 +2043,21 @@ eslint-config-schibsted@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/eslint-config-schibsted/-/eslint-config-schibsted-4.0.0.tgz#7c0dacdc18d56a2dac006923917ef40df29438ed"
-eslint-plugin-react@^7.1.0:
- version "7.1.0"
- resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.1.0.tgz#27770acf39f5fd49cd0af4083ce58104eb390d4c"
+eslint-plugin-prettier@^2.0.1:
+ version "2.2.0"
+ resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.2.0.tgz#f2837ad063903d73c621e7188fb3d41486434088"
+ dependencies:
+ fast-diff "^1.1.1"
+ jest-docblock "^20.0.1"
+
+eslint-plugin-react@^7.3.0:
+ version "7.3.0"
+ resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.3.0.tgz#ca9368da36f733fbdc05718ae4e91f778f38e344"
dependencies:
doctrine "^2.0.0"
has "^1.0.1"
- jsx-ast-utils "^1.4.1"
+ jsx-ast-utils "^2.0.0"
+ prop-types "^15.5.10"
eslint-scope@^3.7.1:
version "3.7.1"
@@ -2005,29 +2066,31 @@ eslint-scope@^3.7.1:
esrecurse "^4.1.0"
estraverse "^4.1.1"
-eslint@^4.1.1:
- version "4.2.0"
- resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.2.0.tgz#a2b3184111b198e02e9c7f3cca625a5e01c56b3d"
+eslint@^4.5.0:
+ version "4.5.0"
+ resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.5.0.tgz#bb75d3b8bde97fb5e13efcd539744677feb019c3"
dependencies:
ajv "^5.2.0"
babel-code-frame "^6.22.0"
- chalk "^1.1.3"
+ chalk "^2.1.0"
concat-stream "^1.6.0"
+ cross-spawn "^5.1.0"
debug "^2.6.8"
doctrine "^2.0.0"
eslint-scope "^3.7.1"
- espree "^3.4.3"
+ espree "^3.5.0"
esquery "^1.0.0"
estraverse "^4.2.0"
esutils "^2.0.2"
file-entry-cache "^2.0.0"
+ functional-red-black-tree "^1.0.1"
glob "^7.1.2"
globals "^9.17.0"
ignore "^3.3.3"
imurmurhash "^0.1.4"
inquirer "^3.0.6"
is-resolvable "^1.0.0"
- js-yaml "^3.8.4"
+ js-yaml "^3.9.1"
json-stable-stringify "^1.0.1"
levn "^0.3.0"
lodash "^4.17.4"
@@ -2039,15 +2102,17 @@ eslint@^4.1.1:
pluralize "^4.0.0"
progress "^2.0.0"
require-uncached "^1.0.3"
+ semver "^5.3.0"
+ strip-ansi "^4.0.0"
strip-json-comments "~2.0.1"
table "^4.0.1"
text-table "~0.2.0"
-espree@^3.4.3:
- version "3.4.3"
- resolved "https://registry.yarnpkg.com/espree/-/espree-3.4.3.tgz#2910b5ccd49ce893c2ffffaab4fd8b3a31b82374"
+espree@^3.5.0:
+ version "3.5.0"
+ resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.0.tgz#98358625bdd055861ea27e2867ea729faf463d8d"
dependencies:
- acorn "^5.0.1"
+ acorn "^5.1.1"
acorn-jsx "^3.0.0"
esprima@^2.6.0, esprima@^2.7.1:
@@ -2204,6 +2269,10 @@ fast-deep-equal@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz#96256a3bc975595eb36d82e9929d060d893439ff"
+fast-diff@^1.1.1:
+ version "1.1.1"
+ resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.1.1.tgz#0aea0e4e605b6a2189f0e936d4b7fbaf1b7cfd9b"
+
fast-levenshtein@~2.0.4:
version "2.0.6"
resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917"
@@ -2348,6 +2417,10 @@ for-own@^1.0.0:
dependencies:
for-in "^1.0.1"
+foreach@^2.0.5:
+ version "2.0.5"
+ resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99"
+
forever-agent@~0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91"
@@ -2396,10 +2469,14 @@ fstream@^1.0.0, fstream@^1.0.10, fstream@^1.0.2:
mkdirp ">=0.5 0"
rimraf "2"
-function-bind@^1.0.2:
+function-bind@^1.0.2, function-bind@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.0.tgz#16176714c801798e4e8f2cf7f7529467bb4a5771"
+functional-red-black-tree@^1.0.1:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327"
+
gauge@~2.7.3:
version "2.7.4"
resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7"
@@ -2427,6 +2504,10 @@ get-stdin@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe"
+get-stdin@^5.0.1:
+ version "5.0.1"
+ resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-5.0.1.tgz#122e161591e21ff4c52530305693f20e6393a398"
+
getpass@^0.1.1:
version "0.1.7"
resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa"
@@ -2834,12 +2915,20 @@ is-builtin-module@^1.0.0:
dependencies:
builtin-modules "^1.0.0"
+is-callable@^1.1.1, is-callable@^1.1.3:
+ version "1.1.3"
+ resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.3.tgz#86eb75392805ddc33af71c92a0eedf74ee7604b2"
+
is-ci@^1.0.10:
version "1.0.10"
resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.0.10.tgz#f739336b2632365061a9d48270cd56ae3369318e"
dependencies:
ci-info "^1.0.0"
+is-date-object@^1.0.1:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16"
+
is-dotfile@^1.0.0:
version "1.0.3"
resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1"
@@ -2940,6 +3029,12 @@ is-promise@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa"
+is-regex@^1.0.4:
+ version "1.0.4"
+ resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491"
+ dependencies:
+ has "^1.0.1"
+
is-resolvable@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.0.0.tgz#8df57c61ea2e3c501408d100fb013cf8d6e0cc62"
@@ -2956,6 +3051,10 @@ is-svg@^2.0.0:
dependencies:
html-comment-regex "^1.1.0"
+is-symbol@^1.0.1:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572"
+
is-typedarray@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a"
@@ -3119,7 +3218,7 @@ jest-diff@^20.0.3:
jest-matcher-utils "^20.0.3"
pretty-format "^20.0.3"
-jest-docblock@^20.0.3:
+jest-docblock@^20.0.1, jest-docblock@^20.0.3:
version "20.0.3"
resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-20.0.3.tgz#17bea984342cc33d83c50fbe1545ea0efaa44712"
@@ -3275,9 +3374,9 @@ js-tokens@^3.0.0:
version "3.0.2"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b"
-js-yaml@^3.7.0, js-yaml@^3.8.4:
- version "3.9.0"
- resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.9.0.tgz#4ffbbf25c2ac963b8299dc74da7e3740de1c18ce"
+js-yaml@^3.7.0, js-yaml@^3.9.1:
+ version "3.9.1"
+ resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.9.1.tgz#08775cebdfdd359209f0d2acd383c8f86a6904a0"
dependencies:
argparse "^1.0.7"
esprima "^4.0.0"
@@ -3372,9 +3471,11 @@ jsprim@^1.2.2:
json-schema "0.2.3"
verror "1.3.6"
-jsx-ast-utils@^1.4.1:
- version "1.4.1"
- resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz#3867213e8dd79bf1e8f2300c0cfc1efb182c0df1"
+jsx-ast-utils@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-2.0.0.tgz#ec06a3d60cf307e5e119dac7bad81e89f096f0f8"
+ dependencies:
+ array-includes "^3.0.3"
kind-of@^2.0.1:
version "2.0.1"
@@ -3890,6 +3991,10 @@ object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
+object-keys@^1.0.8:
+ version "1.0.11"
+ resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d"
+
object.omit@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa"
@@ -4376,6 +4481,10 @@ preserve@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"
+prettier@^1.6.0:
+ version "1.6.0"
+ resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.6.0.tgz#23e9c68251f440feb847f558821bead21765919a"
+
pretty-format@^20.0.3:
version "20.0.3"
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-20.0.3.tgz#020e350a560a1fe1a98dc3beb6ccffb386de8b14"
@@ -5048,6 +5157,16 @@ shallow-clone@^0.1.2:
lazy-cache "^0.2.3"
mixin-object "^2.0.1"
+shebang-command@^1.2.0:
+ version "1.2.0"
+ resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea"
+ dependencies:
+ shebang-regex "^1.0.0"
+
+shebang-regex@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"
+
shellwords@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.0.tgz#66afd47b6a12932d9071cbfd98a52e785cd0ba14"