mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	cleanup
This commit is contained in:
		
							parent
							
								
									4530f37a14
								
							
						
					
					
						commit
						dc2e68dc29
					
				| @ -114,9 +114,6 @@ export default class App extends Component { | ||||
|                             {createListItem('/history', 'Event history', 'history')} | ||||
|                             {createListItem('/archive', 'Archived toggles', 'archive')} | ||||
|                             {createListItem('/applications', 'Applications', 'apps')} | ||||
|                             {/* createListItem('/metrics', 'Client metrics')*/} | ||||
|                             {/* createListItem('/client-strategies', 'Client strategies')*/} | ||||
|                             {/* createListItem('/client-instances', 'Client instances')*/} | ||||
|                         </Navigation> | ||||
|                     </Drawer> | ||||
|                     <Content> | ||||
| @ -139,9 +136,6 @@ export default class App extends Component { | ||||
|                                 <FooterDropDownSection title="Metrics"> | ||||
|                                     <FooterLinkList> | ||||
|                                         {createListItem('/applications', 'Applications')} | ||||
|                                         {/* createListItem('/metrics', 'Client metrics')*/} | ||||
|                                         {/* createListItem('/client-strategies', 'Client strategies')*/} | ||||
|                                         {/* createListItem('/client-instances', 'Client instances')*/} | ||||
|                                     </FooterLinkList> | ||||
|                                 </FooterDropDownSection> | ||||
|                                 <FooterDropDownSection title="Clients"> | ||||
|  | ||||
| @ -1,35 +0,0 @@ | ||||
| import React, { Component } from 'react'; | ||||
| import { DataTable, TableHeader } from 'react-mdl'; | ||||
| 
 | ||||
| class Metrics extends Component { | ||||
| 
 | ||||
|     componentDidMount () { | ||||
|         this.props.fetchMetrics(); | ||||
|     } | ||||
| 
 | ||||
|     render () { | ||||
|         const { globalCount, clientList } = this.props; | ||||
| 
 | ||||
|         return ( | ||||
|             <div> | ||||
|                 <h4>{`Total of ${globalCount} toggles`}</h4> | ||||
|                 <DataTable | ||||
|                     style={{ width: '100%' }} | ||||
|                     rows={clientList} | ||||
|                     selectable={false} | ||||
|                 > | ||||
|                     <TableHeader name="name">Instance</TableHeader> | ||||
|                     <TableHeader name="appName">Application name</TableHeader> | ||||
|                     <TableHeader numeric name="ping" cellFormatter={ | ||||
|                         (v) => (v.toString()) | ||||
|                     }>Last seen</TableHeader> | ||||
|                     <TableHeader numeric name="count">Counted</TableHeader> | ||||
| 
 | ||||
|                 </DataTable> | ||||
|             </div> | ||||
|         ); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| export default Metrics; | ||||
| @ -1,39 +0,0 @@ | ||||
| import { connect } from 'react-redux'; | ||||
| import Metrics from './metrics-component'; | ||||
| import { fetchMetrics } from '../../store/metrics-actions'; | ||||
| 
 | ||||
| const mapStateToProps = (state) => { | ||||
|     const globalCount = state.metrics.get('globalCount'); | ||||
|     const apps = state.metrics.get('apps').toArray(); | ||||
|     const clients = state.metrics.get('clients').toJS(); | ||||
| 
 | ||||
|     const clientList = Object | ||||
|         .keys(clients) | ||||
|         .map((k) => { | ||||
|             const client = clients[k]; | ||||
|             return { | ||||
|                 name: k, | ||||
|                 appName: client.appName, | ||||
|                 count: client.count, | ||||
|                 ping: new Date(client.ping), | ||||
|             }; | ||||
|         }) | ||||
|         .sort((a, b) => (a.ping > b.ping ? -1 : 1)); | ||||
| 
 | ||||
| 
 | ||||
|     /* | ||||
|         Possible stuff to ask/answer: | ||||
|         * toggles in use but not in unleash-server | ||||
|             * nr of toggles using fallbackValue | ||||
|         * strategies implemented but not used | ||||
|     */ | ||||
|     return { | ||||
|         globalCount, | ||||
|         apps, | ||||
|         clientList, | ||||
|     }; | ||||
| }; | ||||
| 
 | ||||
| const MetricsContainer = connect(mapStateToProps, { fetchMetrics })(Metrics); | ||||
| 
 | ||||
| export default MetricsContainer; | ||||
| @ -1,13 +0,0 @@ | ||||
| import { throwIfNotSuccess } from './helper'; | ||||
| 
 | ||||
| const URI = '/api/metrics'; | ||||
| 
 | ||||
| function fetchAll () { | ||||
|     return fetch(URI) | ||||
|         .then(throwIfNotSuccess) | ||||
|         .then(response => response.json()); | ||||
| } | ||||
| 
 | ||||
| module.exports = { | ||||
|     fetchAll, | ||||
| }; | ||||
| @ -6,7 +6,6 @@ import input from './input-store'; | ||||
| import history from './history-store'; // eslint-disable-line
 | ||||
| import archive from './archive-store'; | ||||
| import error from './error-store'; | ||||
| import metrics from './metrics-store'; | ||||
| import clientInstances from './client-instance-store'; | ||||
| import settings from './settings'; | ||||
| import user from './user'; | ||||
| @ -20,7 +19,6 @@ const unleashStore = combineReducers({ | ||||
|     history, | ||||
|     archive, | ||||
|     error, | ||||
|     metrics, | ||||
|     clientInstances, | ||||
|     settings, | ||||
|     user, | ||||
|  | ||||
| @ -1,20 +0,0 @@ | ||||
| import api from '../data/metrics-api'; | ||||
| 
 | ||||
| export const RECEIVE_METRICS        = 'RECEIVE_METRICS'; | ||||
| export const ERROR_RECEIVE_METRICS  = 'ERROR_RECEIVE_METRICS'; | ||||
| 
 | ||||
| const receiveMetrics = (json) => ({ | ||||
|     type: RECEIVE_METRICS, | ||||
|     value: json, | ||||
| }); | ||||
| 
 | ||||
| const errorReceiveMetrics = (statusCode) => ({ | ||||
|     type: ERROR_RECEIVE_METRICS, | ||||
|     statusCode, | ||||
| }); | ||||
| 
 | ||||
| export function fetchMetrics () { | ||||
|     return dispatch => api.fetchAll() | ||||
|         .then(json => dispatch(receiveMetrics(json))) | ||||
|         .catch(error => dispatch(errorReceiveMetrics(error))); | ||||
| } | ||||
| @ -1,21 +0,0 @@ | ||||
| import { fromJS } from 'immutable'; | ||||
| import { RECEIVE_METRICS } from './metrics-actions'; | ||||
| 
 | ||||
| function getInitState () { | ||||
|     return fromJS({ | ||||
|         totalCount: 0, | ||||
|         apps: [], | ||||
|         clients: {}, | ||||
|     }); | ||||
| } | ||||
| 
 | ||||
| const historyStore = (state = getInitState(), action) => { | ||||
|     switch (action.type) { | ||||
|         case RECEIVE_METRICS: | ||||
|             return fromJS(action.value); | ||||
|         default: | ||||
|             return state; | ||||
|     } | ||||
| }; | ||||
| 
 | ||||
| export default historyStore; | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user