diff --git a/client/src/components/Header/HeaderView.js b/client/src/components/Header/HeaderView.js index 863acd302..150e00b39 100644 --- a/client/src/components/Header/HeaderView.js +++ b/client/src/components/Header/HeaderView.js @@ -49,7 +49,6 @@ import { getChangeChannelType, getDashStatsType, getPeerListType, - getPeerStatusType, getTransactionByOrgType, getTransactionPerHourType, getTransactionPerMinType, @@ -66,7 +65,6 @@ const { dashStats, changeChannel, blockActivity, - peerStatus } = chartOperations; const { @@ -460,7 +458,6 @@ export class HeaderView extends Component { getChannels, getDashStats, getPeerList, - getPeerStatus, getTransactionByOrg, getTransactionList, getTransactionListSearch, @@ -480,7 +477,6 @@ export class HeaderView extends Component { getDashStats(currentChannel), getBlockActivity(currentChannel), getPeerList(currentChannel), - getPeerStatus(currentChannel), getTransactionByOrg(currentChannel), getTransactionListSearch(currentChannel,transactionListSearchQuery,transactionListSearchPageParam), getTransactionPerHour(currentChannel), @@ -682,7 +678,6 @@ HeaderView.propTypes = { getChannels: getChannelsType.isRequired, getDashStats: getDashStatsType.isRequired, getPeerList: getPeerListType.isRequired, - getPeerStatus: getPeerStatusType.isRequired, getTransactionByOrg: getTransactionByOrgType.isRequired, getTransactionPerHour: getTransactionPerHourType.isRequired, getTransactionPerMin: getTransactionPerMinType.isRequired, @@ -712,7 +707,6 @@ const mapDispatchToProps = { getChannels: channels, getDashStats: dashStats, getPeerList: peerList, - getPeerStatus: peerStatus, getBlockActivity: blockActivity, getTransactionByOrg: transactionByOrg, getTransactionList: transactionList, diff --git a/client/src/components/Header/HeaderView.spec.js b/client/src/components/Header/HeaderView.spec.js index b35c698de..658af38b7 100644 --- a/client/src/components/Header/HeaderView.spec.js +++ b/client/src/components/Header/HeaderView.spec.js @@ -53,7 +53,6 @@ const setup = prop => { getDashStats: jest.fn(), getNotification: jest.fn(), getPeerList: jest.fn(), - getPeerStatus: jest.fn(), getBlockActivity: jest.fn(), getTransactionByOrg: jest.fn(), getTransactionList: jest.fn(), diff --git a/client/src/components/Main.js b/client/src/components/Main.js index f404b30f6..0b9e72ea6 100644 --- a/client/src/components/Main.js +++ b/client/src/components/Main.js @@ -24,7 +24,6 @@ import { peerListType, txnListType, blockSearchType, - peerStatusType, blockRangeSearchType, blockListSearchType, chaincodeMetaDataType, @@ -41,7 +40,6 @@ const { blockActivitySelector, channelListSelector, dashStatsSelector, - peerStatusSelector, transactionByOrgSelector } = chartSelectors; @@ -89,7 +87,6 @@ export const Main = props => { peerList, txnList, blockSearch, - peerStatus, chaincodeMetaData, getChaincodeMetaData, transaction, @@ -142,7 +139,7 @@ export const Main = props => { const dashboardViewProps = { blockListSearch, dashStats, - peerStatus, + peerList, txnList, blockSearch, transactionByOrg, @@ -258,7 +255,6 @@ Main.propTypes = { peerList: peerListType.isRequired, txnList: txnListType.isRequired, blockSearch: blockSearchType.isRequired, - peerStatus: peerStatusType.isRequired, chaincodeMetaData: chaincodeMetaDataType.isRequired, transaction: transactionType.isRequired, transactionByOrg: transactionByOrgType.isRequired, @@ -275,7 +271,6 @@ const connectedComponent = connect( peerList: peerListSelector(state), txnList: txnListSelector(state), blockSearch: blockSearchSelector(state), - peerStatus: peerStatusSelector(state), chaincodeMetaData: chaincodeMetaDataSelector(state), transaction: transactionSelector(state), transactionByOrg: transactionByOrgSelector(state), diff --git a/client/src/components/View/DashboardView.js b/client/src/components/View/DashboardView.js index f82159fe7..d9f64f270 100644 --- a/client/src/components/View/DashboardView.js +++ b/client/src/components/View/DashboardView.js @@ -15,7 +15,7 @@ import OrgPieChart from '../Charts/OrgPieChart'; import { blockListSearchType, dashStatsType, - peerStatusType, + peerListType, txnListType, blockSearchType, transactionByOrgType @@ -124,14 +124,14 @@ export class DashboardView extends Component { const { blockListSearch, dashStats, - peerStatus, + peerList, transactionByOrg, blockActivity } = this.props; if ( blockListSearch === undefined || dashStats === undefined || - peerStatus === undefined || + peerList === undefined || blockActivity === undefined || transactionByOrg === undefined ) { @@ -170,7 +170,7 @@ export class DashboardView extends Component { }; render() { - const { dashStats, peerStatus, txnList, blockSearch, blockActivity, transactionByOrg } = this.props; + const { dashStats, peerList, txnList, blockSearch, blockActivity, transactionByOrg } = this.props; const { hasDbError, notifications } = this.state; var searchError = '' if(typeof txnList==='string'){searchError='Txn not found'; } @@ -265,7 +265,7 @@ export class DashboardView extends Component { - + ({ payload: { notification }, }); -const getPeerStatus = peerStatus => ({ - type: types.PEER_STATUS, - payload: peerStatus, -}); const getBlockActivity = blocks => ({ type: types.BLOCK_ACTIVITY, payload: blocks, @@ -73,7 +69,6 @@ export default { getChannelList, getDashStats, getNotification, - getPeerStatus, getTransactionByOrg, getTransactionPerHour, getTransactionPerMin, diff --git a/client/src/state/redux/charts/operations.js b/client/src/state/redux/charts/operations.js index def514665..0beb7c5bd 100644 --- a/client/src/state/redux/charts/operations.js +++ b/client/src/state/redux/charts/operations.js @@ -151,25 +151,6 @@ const notification = notificationObj => dispatch => { dispatch(actions.getNotification(notify)); }; -/* istanbul ignore next */ -const peerStatus = channelName => dispatch => - get(`/api/peersStatus/${channelName}`) - .then(resp => { - if (resp.status === 500) { - dispatch( - actions.getErroMessage( - '500 Internal Server Error: The server has encountered an internal error and unable to complete your request' - ) - ); - } else if (resp.status === 400) { - dispatch(actions.getErroMessage(resp.error)); - } else { - dispatch(actions.getPeerStatus(resp)); - } - }) - .catch(error => { - console.error(error); - }); /* istanbul ignore next */ const transactionByOrg = channelName => dispatch => @@ -242,6 +223,5 @@ export default { channel, channelList, changeChannel, - peerStatus, blockActivity }; diff --git a/client/src/state/redux/charts/reducers.js b/client/src/state/redux/charts/reducers.js index 6cc413451..b38f1d01c 100644 --- a/client/src/state/redux/charts/reducers.js +++ b/client/src/state/redux/charts/reducers.js @@ -87,17 +87,6 @@ const notificationReducer = (state = initialState, action = {}) => { } }; -const peerStatusReducer = (state = initialState, action = {}) => { - if (action.type === types.PEER_STATUS) { - return { - list: action.payload.peers, - loaded: true, - errors: action.errors, - }; - } else { - return state; - } -}; const transactionByOrgReducer = (state = initialState, action = {}) => { if (action.type === types.TRANSACTION_CHART_ORG) { @@ -142,7 +131,6 @@ const reducer = combineReducers({ channelList: channelListReducer, dashStats: dashStatsReducer, notification: notificationReducer, - peerStatus: peerStatusReducer, transactionByOrg: transactionByOrgReducer, transactionPerHour: transactionPerHourReducer, transactionPerMin: transactionPerMinReducer, diff --git a/client/src/state/redux/charts/selectors.js b/client/src/state/redux/charts/selectors.js index 1885a3fc1..35a1be6a9 100644 --- a/client/src/state/redux/charts/selectors.js +++ b/client/src/state/redux/charts/selectors.js @@ -8,7 +8,6 @@ export const channelListSelector = state => state.charts.channelList.list; export const currentChannelSelector = state => state.charts.channel.currentChannel; export const dashStatsSelector = state => state.charts.dashStats; export const notificationSelector = state => state.charts.notification; -export const peerStatusSelector = state => state.charts.peerStatus.list; export const transactionByOrgSelector = state => state.charts.transactionByOrg.rows; export const transactionPerHourSelector = state => state.charts.transactionPerHour.rows; export const transactionPerMinSelector = state => state.charts.transactionPerMin.rows; diff --git a/client/src/state/redux/charts/tests.spec.js b/client/src/state/redux/charts/tests.spec.js index bbf765097..6b180aba3 100644 --- a/client/src/state/redux/charts/tests.spec.js +++ b/client/src/state/redux/charts/tests.spec.js @@ -218,37 +218,6 @@ describe('Charts', () => { expect(actions[0].type).toBe(types.NOTIFICATION_LOAD); }); - test('peerStatus', () => { - nock(/\w*(\W)/g) - .get(`/api/peersStatus/${channel}`) - .reply(200, { - rows: [{ test: 'rows' }] - }); - - const expectedActions = [{ type: types.PEER_STATUS }]; - const store = mockStore(initialState, expectedActions); - - return store.dispatch(operations.peerStatus(channel)).then(() => { - const actions = store.getActions(); - expect(actions[0].type).toBe(types.PEER_STATUS); - }); - }); - - test('peerStatus catch error', () => { - jest.spyOn(console, 'error'); - nock(/\w*(\W)/g) - .get(`/api/peersStatus/${channel}`) - .replyWithError({ code: 'ECONNREFUSED' }); - - const expectedActions = [{ type: types.peerStatus }]; - const store = mockStore(initialState, expectedActions); - - return store.dispatch(operations.peerStatus(channel)).then(() => { - const actions = store.getActions(); - expect(actions).toEqual([]); - }); - }); - test('transactionByOrg', () => { nock(/\w*(\W)/g) .get(`/api/txByOrg/${channel}`) @@ -433,13 +402,6 @@ describe('Charts', () => { expect(newState.notification).toBe('test'); }); - test('peerStatusReducer', () => { - const payload = { peers: 'test' }; - const action = actions.getPeerStatus(payload); - - const newState = reducers(initialState, action); - expect(newState.peerStatus.list).toBe('test'); - }); test('transactionByOrgReducer', () => { const payload = { rows: 'test' }; @@ -520,11 +482,6 @@ describe('Charts', () => { expect(notification).toBe('test'); }); - test('peerStatusSelector', () => { - const state = { charts: { peerStatus: { list: 'test' } } }; - const peerStatus = selectors.peerStatusSelector(state); - expect(peerStatus).toBe('test'); - }); test('transactionByOrgSelector', () => { const state = { charts: { transactionByOrg: { rows: 'test' } } }; diff --git a/client/src/state/redux/charts/types.js b/client/src/state/redux/charts/types.js index 9afcedfa8..7b19c61c9 100644 --- a/client/src/state/redux/charts/types.js +++ b/client/src/state/redux/charts/types.js @@ -23,7 +23,6 @@ const CHANNEL = `${namespaces}/CHANNEL`; const CHANGE_CHANNEL = `${namespaces}/CHANGE_CHANNEL`; const CHANNEL_LIST = `${namespaces}/CHANNEL_LIST`; -const PEER_STATUS = `${namespaces}/PEER_STATUS`; const ERROR_MESSAGE = 'ERROR_MESSAGE'; @@ -37,7 +36,6 @@ export default { CHANNEL_LIST, DASHBOARD_STATS, NOTIFICATION_LOAD, - PEER_STATUS, TRANSACTION_CHART_HOUR, TRANSACTION_CHART_MIN, TRANSACTION_CHART_ORG,