From abc8c8cfd69651f37e3bdb4c232138c291b470c4 Mon Sep 17 00:00:00 2001 From: ivaosthu Date: Fri, 9 Dec 2016 17:50:48 +0100 Subject: [PATCH] Remove client-strategies --- frontend/src/component/app.jsx | 5 ++- .../client-strategy/strategy-component.js | 36 ------------------- .../client-strategy/strategy-container.js | 9 ----- frontend/src/data/client-strategy-api.js | 13 ------- frontend/src/index.jsx | 2 -- frontend/src/page/client-strategies/index.js | 11 ------ frontend/src/store/client-strategy-actions.js | 20 ----------- frontend/src/store/client-strategy-store.js | 17 --------- frontend/src/store/index.js | 2 -- 9 files changed, 2 insertions(+), 113 deletions(-) delete mode 100644 frontend/src/component/client-strategy/strategy-component.js delete mode 100644 frontend/src/component/client-strategy/strategy-container.js delete mode 100644 frontend/src/data/client-strategy-api.js delete mode 100644 frontend/src/page/client-strategies/index.js delete mode 100644 frontend/src/store/client-strategy-actions.js delete mode 100644 frontend/src/store/client-strategy-store.js diff --git a/frontend/src/component/app.jsx b/frontend/src/component/app.jsx index e4ca00382e..1a5240210e 100644 --- a/frontend/src/component/app.jsx +++ b/frontend/src/component/app.jsx @@ -118,10 +118,9 @@ export default class App extends Component { {createListItem('/strategies', 'Strategies')} {createListItem('/history', 'Event history')} {createListItem('/archive', 'Archived toggles')} -
{createListItem('/applications', 'Applications')} {/*createListItem('/metrics', 'Client metrics')*/} - {createListItem('/client-strategies', 'Client strategies')} + {/*createListItem('/client-strategies', 'Client strategies')*/} {/*createListItem('/client-instances', 'Client instances')*/} @@ -146,7 +145,7 @@ export default class App extends Component { {createListItem('/applications', 'Applications')} {/*createListItem('/metrics', 'Client metrics')*/} - {createListItem('/client-strategies', 'Client strategies')} + {/*createListItem('/client-strategies', 'Client strategies')*/} {/*createListItem('/client-instances', 'Client instances')*/} diff --git a/frontend/src/component/client-strategy/strategy-component.js b/frontend/src/component/client-strategy/strategy-component.js deleted file mode 100644 index 814763a171..0000000000 --- a/frontend/src/component/client-strategy/strategy-component.js +++ /dev/null @@ -1,36 +0,0 @@ -import React, { Component } from 'react'; -import { DataTable, TableHeader } from 'react-mdl'; -import { Link } from 'react-router'; - -class ClientStrategies extends Component { - - componentDidMount () { - this.props.fetchClientStrategies(); - } - - render () { - const source = this.props.clientStrategies - // temp hack for ignoring dumb data - .filter(item => item.strategies) - .map(item => ( - { - appName: {item.appName}, - strategies: item.strategies && item.strategies.map(name => ({name})), - }) - ); - - return ( - - Application name - Strategies - - ); - } -} - - -export default ClientStrategies; diff --git a/frontend/src/component/client-strategy/strategy-container.js b/frontend/src/component/client-strategy/strategy-container.js deleted file mode 100644 index e227c65a8a..0000000000 --- a/frontend/src/component/client-strategy/strategy-container.js +++ /dev/null @@ -1,9 +0,0 @@ -import { connect } from 'react-redux'; -import ClientStrategies from './strategy-component'; -import { fetchClientStrategies } from '../../store/client-strategy-actions'; - -const mapStateToProps = (state) => ({ clientStrategies: state.clientStrategies.toJS() }); - -const StrategiesContainer = connect(mapStateToProps, { fetchClientStrategies })(ClientStrategies); - -export default StrategiesContainer; diff --git a/frontend/src/data/client-strategy-api.js b/frontend/src/data/client-strategy-api.js deleted file mode 100644 index 1681d74be1..0000000000 --- a/frontend/src/data/client-strategy-api.js +++ /dev/null @@ -1,13 +0,0 @@ -import { throwIfNotSuccess, headers } from './helper'; - -const URI = '/api/client/strategies'; - -function fetchAll () { - return fetch(URI, { headers }) - .then(throwIfNotSuccess) - .then(response => response.json()); -} - -module.exports = { - fetchAll, -}; diff --git a/frontend/src/index.jsx b/frontend/src/index.jsx index b690870c5d..ab90ca0270 100644 --- a/frontend/src/index.jsx +++ b/frontend/src/index.jsx @@ -20,7 +20,6 @@ import HistoryTogglePage from './page/history/toggle'; import Archive from './page/archive'; import Applications from './page/applications'; import ApplicationView from './page/applications/view'; -import ClientStrategies from './page/client-strategies'; const unleashStore = createStore( store, @@ -60,7 +59,6 @@ ReactDOM.render( - , document.getElementById('app')); diff --git a/frontend/src/page/client-strategies/index.js b/frontend/src/page/client-strategies/index.js deleted file mode 100644 index 1c5e66849c..0000000000 --- a/frontend/src/page/client-strategies/index.js +++ /dev/null @@ -1,11 +0,0 @@ -import React from 'react'; -import ClientStrategy from '../../component/client-strategy/strategy-container'; - -const render = () => ( -
-
Client Strategies
- -
-); - -export default render; diff --git a/frontend/src/store/client-strategy-actions.js b/frontend/src/store/client-strategy-actions.js deleted file mode 100644 index b7a07a0dad..0000000000 --- a/frontend/src/store/client-strategy-actions.js +++ /dev/null @@ -1,20 +0,0 @@ -import api from '../data/client-strategy-api'; - -export const RECEIVE_CLIENT_STRATEGIES = 'RECEIVE_CLIENT_STRATEGIES'; -export const ERROR_RECEIVE_CLIENT_STRATEGIES = 'ERROR_RECEIVE_CLIENT_STRATEGIES'; - -const receiveMetrics = (json) => ({ - type: RECEIVE_CLIENT_STRATEGIES, - value: json, -}); - -const errorReceiveMetrics = (statusCode) => ({ - type: RECEIVE_CLIENT_STRATEGIES, - statusCode, -}); - -export function fetchClientStrategies () { - return dispatch => api.fetchAll() - .then(json => dispatch(receiveMetrics(json))) - .catch(error => dispatch(errorReceiveMetrics(error))); -} diff --git a/frontend/src/store/client-strategy-store.js b/frontend/src/store/client-strategy-store.js deleted file mode 100644 index 1de24b1be0..0000000000 --- a/frontend/src/store/client-strategy-store.js +++ /dev/null @@ -1,17 +0,0 @@ -import { fromJS } from 'immutable'; -import { RECEIVE_CLIENT_STRATEGIES } from './client-strategy-actions'; - -function getInitState () { - return fromJS([]); -} - -const store = (state = getInitState(), action) => { - switch (action.type) { - case RECEIVE_CLIENT_STRATEGIES: - return fromJS(action.value); - default: - return state; - } -}; - -export default store; diff --git a/frontend/src/store/index.js b/frontend/src/store/index.js index 985faf5bce..7cf269583c 100644 --- a/frontend/src/store/index.js +++ b/frontend/src/store/index.js @@ -7,7 +7,6 @@ import history from './history-store'; // eslint-disable-line import archive from './archive-store'; import error from './error-store'; import metrics from './metrics-store'; -import clientStrategies from './client-strategy-store'; import clientInstances from './client-instance-store'; import settings from './settings'; import user from './user'; @@ -22,7 +21,6 @@ const unleashStore = combineReducers({ archive, error, metrics, - clientStrategies, clientInstances, settings, user,