mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix: remove unused client-instance concept
This commit is contained in:
		
							parent
							
								
									ba79da7a99
								
							
						
					
					
						commit
						bd5b60936f
					
				| @ -1,39 +0,0 @@ | ||||
| // Jest Snapshot v1, https://goo.gl/fbAQLP | ||||
| 
 | ||||
| exports[`renders correctly with no clientInstances 1`] = ` | ||||
| <react-mdl-DataTable | ||||
|   rows={Array []} | ||||
|   selectable={false} | ||||
|   style={ | ||||
|     Object { | ||||
|       "width": "100%", | ||||
|     } | ||||
|   } | ||||
| > | ||||
|   <react-mdl-TableHeader | ||||
|     name="instanceId" | ||||
|   > | ||||
|     Instance ID | ||||
|   </react-mdl-TableHeader> | ||||
|   <react-mdl-TableHeader | ||||
|     name="appName" | ||||
|   > | ||||
|     Application name | ||||
|   </react-mdl-TableHeader> | ||||
|   <react-mdl-TableHeader | ||||
|     name="clientIp" | ||||
|   > | ||||
|     IP | ||||
|   </react-mdl-TableHeader> | ||||
|   <react-mdl-TableHeader | ||||
|     name="createdAt" | ||||
|   > | ||||
|     Created | ||||
|   </react-mdl-TableHeader> | ||||
|   <react-mdl-TableHeader | ||||
|     name="lastSeen" | ||||
|   > | ||||
|     Last Seen | ||||
|   </react-mdl-TableHeader> | ||||
| </react-mdl-DataTable> | ||||
| `; | ||||
| @ -1,12 +0,0 @@ | ||||
| import React from 'react'; | ||||
| 
 | ||||
| import ClientStrategies from '../client-instance-component'; | ||||
| import renderer from 'react-test-renderer'; | ||||
| 
 | ||||
| jest.mock('react-mdl'); | ||||
| 
 | ||||
| test('renders correctly with no clientInstances', () => { | ||||
|     const tree = renderer.create(<ClientStrategies fetchClientInstances={jest.fn()} clientInstances={[]} />).toJSON(); | ||||
| 
 | ||||
|     expect(tree).toMatchSnapshot(); | ||||
| }); | ||||
| @ -1,30 +0,0 @@ | ||||
| import React, { Component } from 'react'; | ||||
| import PropTypes from 'prop-types'; | ||||
| import { DataTable, TableHeader } from 'react-mdl'; | ||||
| 
 | ||||
| class ClientStrategies extends Component { | ||||
|     static propTypes = { | ||||
|         fetchClientInstances: PropTypes.func.isRequired, | ||||
|         clientInstances: PropTypes.array.isRequired, | ||||
|     }; | ||||
| 
 | ||||
|     componentDidMount() { | ||||
|         this.props.fetchClientInstances(); | ||||
|     } | ||||
| 
 | ||||
|     render() { | ||||
|         const source = this.props.clientInstances; | ||||
| 
 | ||||
|         return ( | ||||
|             <DataTable style={{ width: '100%' }} rows={source} selectable={false}> | ||||
|                 <TableHeader name="instanceId">Instance ID</TableHeader> | ||||
|                 <TableHeader name="appName">Application name</TableHeader> | ||||
|                 <TableHeader name="clientIp">IP</TableHeader> | ||||
|                 <TableHeader name="createdAt">Created</TableHeader> | ||||
|                 <TableHeader name="lastSeen">Last Seen</TableHeader> | ||||
|             </DataTable> | ||||
|         ); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| export default ClientStrategies; | ||||
| @ -1,9 +0,0 @@ | ||||
| import { connect } from 'react-redux'; | ||||
| import ClientInstances from './client-instance-component'; | ||||
| import { fetchClientInstances } from '../../store/client-instance-actions'; | ||||
| 
 | ||||
| const mapStateToProps = state => ({ clientInstances: state.clientInstances.toJS() }); | ||||
| 
 | ||||
| const StrategiesContainer = connect(mapStateToProps, { fetchClientInstances })(ClientInstances); | ||||
| 
 | ||||
| export default StrategiesContainer; | ||||
| @ -1,13 +0,0 @@ | ||||
| import { throwIfNotSuccess, headers } from './helper'; | ||||
| 
 | ||||
| const URI = 'api/admin/metrics/instances'; | ||||
| 
 | ||||
| function fetchAll() { | ||||
|     return fetch(URI, { headers, credentials: 'include' }) | ||||
|         .then(throwIfNotSuccess) | ||||
|         .then(response => response.json()); | ||||
| } | ||||
| 
 | ||||
| export default { | ||||
|     fetchAll, | ||||
| }; | ||||
| @ -1,22 +0,0 @@ | ||||
| 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 => ({ | ||||
|     type: RECEIVE_CLIENT_INSTANCES, | ||||
|     value: json, | ||||
| }); | ||||
| 
 | ||||
| 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))); | ||||
| } | ||||
| @ -1,21 +0,0 @@ | ||||
| import { fromJS } from 'immutable'; | ||||
| import { RECEIVE_CLIENT_INSTANCES } from './client-instance-actions'; | ||||
| import { USER_LOGOUT, USER_LOGIN } from './user/actions'; | ||||
| 
 | ||||
| function getInitState() { | ||||
|     return fromJS([]); | ||||
| } | ||||
| 
 | ||||
| const store = (state = getInitState(), action) => { | ||||
|     switch (action.type) { | ||||
|         case RECEIVE_CLIENT_INSTANCES: | ||||
|             return fromJS(action.value); | ||||
|         case USER_LOGOUT: | ||||
|         case USER_LOGIN: | ||||
|             return getInitState(); | ||||
|         default: | ||||
|             return state; | ||||
|     } | ||||
| }; | ||||
| 
 | ||||
| export default store; | ||||
| @ -6,7 +6,6 @@ import strategies from './strategy'; | ||||
| import history from './history-store'; // eslint-disable-line
 | ||||
| import archive from './archive'; | ||||
| import error from './error-store'; | ||||
| import clientInstances from './client-instance-store'; | ||||
| import settings from './settings'; | ||||
| import user from './user'; | ||||
| import applications from './application'; | ||||
| @ -22,7 +21,6 @@ const unleashStore = combineReducers({ | ||||
|     history, | ||||
|     archive, | ||||
|     error, | ||||
|     clientInstances, | ||||
|     settings, | ||||
|     user, | ||||
|     applications, | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user