1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

Remove client-strategies

This commit is contained in:
ivaosthu 2016-12-09 17:50:48 +01:00
parent 9bcb7bd0ad
commit abc8c8cfd6
9 changed files with 2 additions and 113 deletions

View File

@ -118,10 +118,9 @@ export default class App extends Component {
{createListItem('/strategies', 'Strategies')}
{createListItem('/history', 'Event history')}
{createListItem('/archive', 'Archived toggles')}
<hr />
{createListItem('/applications', 'Applications')}
{/*createListItem('/metrics', 'Client metrics')*/}
{createListItem('/client-strategies', 'Client strategies')}
{/*createListItem('/client-strategies', 'Client strategies')*/}
{/*createListItem('/client-instances', 'Client instances')*/}
</Navigation>
</Drawer>
@ -146,7 +145,7 @@ export default class App extends Component {
<FooterLinkList>
{createListItem('/applications', 'Applications')}
{/*createListItem('/metrics', 'Client metrics')*/}
{createListItem('/client-strategies', 'Client strategies')}
{/*createListItem('/client-strategies', 'Client strategies')*/}
{/*createListItem('/client-instances', 'Client instances')*/}
</FooterLinkList>
</FooterDropDownSection>

View File

@ -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: <Link to={`/applications/${item.appName}`}>{item.appName}</Link>,
strategies: item.strategies && item.strategies.map(name => (<Link key={name} style={{ marginRight: '5px' }} to={`/strategies/${name}`}>{name}</Link>)),
})
);
return (
<DataTable
style={{ width: '100%' }}
rows={source}
selectable={false}
>
<TableHeader name="appName">Application name</TableHeader>
<TableHeader name="strategies">Strategies</TableHeader>
</DataTable>
);
}
}
export default ClientStrategies;

View File

@ -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;

View File

@ -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,
};

View File

@ -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(
<Route pageTitle=":name" path="/applications/:name" component={ApplicationView} />
</Route>
<Route pageTitle="Client strategies" path="/client-strategies" component={ClientStrategies} />
</Route>
</Router>
</Provider>, document.getElementById('app'));

View File

@ -1,11 +0,0 @@
import React from 'react';
import ClientStrategy from '../../component/client-strategy/strategy-container';
const render = () => (
<div>
<h5>Client Strategies</h5>
<ClientStrategy />
</div>
);
export default render;

View File

@ -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)));
}

View File

@ -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;

View File

@ -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,