diff --git a/.gitignore b/.gitignore index 0720f62ef..70bc1acda 100644 --- a/.gitignore +++ b/.gitignore @@ -2,10 +2,12 @@ # SPDX-License-Identifier: Apache-2.0 # + explorer_1/scripts/bower_components/ explorer_1/webcontent node_modules +app/test/coverage/ .idea/* venv diff --git a/app/platform/fabric/Platform.js b/app/platform/fabric/Platform.js index 57d8d6185..3e2a3ce71 100644 --- a/app/platform/fabric/Platform.js +++ b/app/platform/fabric/Platform.js @@ -170,6 +170,11 @@ class Platform { /* eslint-disable */ for (const [network_name, clients] of this.networks.entries()) { for (const [client_name, client] of clients.entries()) { + console.log( + 'initializeListener, client_name, client ', + client_name, + client.client_config + ); if (this.getClient(network_name, client_name).getStatus()) { const explorerListener = new ExplorerListener(this, syncconfig); explorerListener.initialize([network_name, client_name, '1']); diff --git a/client/package-lock.json b/client/package-lock.json index 3c809902d..464964e0b 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -1,6 +1,6 @@ { "name": "hyperledger-explorer-client", - "version": "1.0.0-rc", + "version": "1.0.0-rc1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/client/src/components/App/App.js b/client/src/components/App/App.js index 2b67ef384..fe91d2cf1 100644 --- a/client/src/components/App/App.js +++ b/client/src/components/App/App.js @@ -48,14 +48,17 @@ export class App extends Component { }; } + /* istanbul ignore next */ updateLoadStatus = () => { this.setState({ loading: false }); }; + /* istanbul ignore next */ refreshComponent = mode => { this.props.changeTheme(mode); }; + /* istanbul ignore next */ render() { const { auth } = this.props; const { loading } = this.state; @@ -89,6 +92,7 @@ const { changeTheme } = themeActions; const { errorMessageSelector } = chartSelectors; const { authSelector } = authSelectors; +/* istanbul ignore next */ export default compose( withStyles(styles), connect( diff --git a/client/src/components/Lists/Peers.js b/client/src/components/Lists/Peers.js index 8019e8863..920bf6542 100644 --- a/client/src/components/Lists/Peers.js +++ b/client/src/components/Lists/Peers.js @@ -7,109 +7,117 @@ import matchSorter from 'match-sorter'; import ReactTable from '../Styled/Table'; import { peerListType } from '../types'; +/* istanbul ignore next */ const Peers = ({ peerList }) => { - const columnHeaders = [ - { - Header: 'Peer Name', - accessor: 'server_hostname', - filterMethod: (filter, rows) => matchSorter( - rows, - filter.value, - { keys: ['server_hostname'] }, - { threshold: matchSorter.rankings.SIMPLEMATCH }, - ), - filterAll: true, - }, - { - Header: 'Request Url', - accessor: 'requests', - filterMethod: (filter, rows) => matchSorter( - rows, - filter.value, - { keys: ['requests'] }, - { threshold: matchSorter.rankings.SIMPLEMATCH }, - ), - filterAll: true, - }, - { - Header: 'Peer Type', - accessor: 'peer_type', - filterMethod: (filter, rows) => matchSorter( - rows, - filter.value, - { keys: ['peer_type'] }, - { threshold: matchSorter.rankings.SIMPLEMATCH }, - ), - filterAll: true, - }, - { - Header: 'MSPID', - accessor: 'mspid', - filterMethod: (filter, rows) => matchSorter( - rows, - filter.value, - { keys: ['mspid'] }, - { threshold: matchSorter.rankings.SIMPLEMATCH }, - ), - filterAll: true, - }, - { - Header: 'Ledger Height', - columns: [ - { - Header: 'High', - accessor: 'ledger_height_high', - filterMethod: (filter, rows) => matchSorter( - rows, - filter.value, - { keys: ['ledger_height_high'] }, - { threshold: matchSorter.rankings.SIMPLEMATCH }, - ), - filterAll: true, - }, - { - Header: 'Low', - accessor: 'ledger_height_low', - filterMethod: (filter, rows) => matchSorter( - rows, - filter.value, - { keys: ['ledger_height_low'] }, - { threshold: matchSorter.rankings.SIMPLEMATCH }, - ), - filterAll: true, - }, - { - Header: 'Unsigned', - id: 'ledger_height_unsigned', - accessor: d => d.ledger_height_unsigned.toString(), - filterMethod: (filter, rows) => matchSorter( - rows, - filter.value, - { keys: ['ledger_height_unsigned'] }, - { threshold: matchSorter.rankings.SIMPLEMATCH }, - ), - filterAll: true, - }, - ], - }, - ]; + const columnHeaders = [ + { + Header: 'Peer Name', + accessor: 'server_hostname', + filterMethod: (filter, rows) => + matchSorter( + rows, + filter.value, + { keys: ['server_hostname'] }, + { threshold: matchSorter.rankings.SIMPLEMATCH } + ), + filterAll: true + }, + { + Header: 'Request Url', + accessor: 'requests', + filterMethod: (filter, rows) => + matchSorter( + rows, + filter.value, + { keys: ['requests'] }, + { threshold: matchSorter.rankings.SIMPLEMATCH } + ), + filterAll: true + }, + { + Header: 'Peer Type', + accessor: 'peer_type', + filterMethod: (filter, rows) => + matchSorter( + rows, + filter.value, + { keys: ['peer_type'] }, + { threshold: matchSorter.rankings.SIMPLEMATCH } + ), + filterAll: true + }, + { + Header: 'MSPID', + accessor: 'mspid', + filterMethod: (filter, rows) => + matchSorter( + rows, + filter.value, + { keys: ['mspid'] }, + { threshold: matchSorter.rankings.SIMPLEMATCH } + ), + filterAll: true + }, + { + Header: 'Ledger Height', + columns: [ + { + Header: 'High', + accessor: 'ledger_height_high', + filterMethod: (filter, rows) => + matchSorter( + rows, + filter.value, + { keys: ['ledger_height_high'] }, + { threshold: matchSorter.rankings.SIMPLEMATCH } + ), + filterAll: true + }, + { + Header: 'Low', + accessor: 'ledger_height_low', + filterMethod: (filter, rows) => + matchSorter( + rows, + filter.value, + { keys: ['ledger_height_low'] }, + { threshold: matchSorter.rankings.SIMPLEMATCH } + ), + filterAll: true + }, + { + Header: 'Unsigned', + id: 'ledger_height_unsigned', + accessor: d => d.ledger_height_unsigned.toString(), + filterMethod: (filter, rows) => + matchSorter( + rows, + filter.value, + { keys: ['ledger_height_unsigned'] }, + { threshold: matchSorter.rankings.SIMPLEMATCH } + ), + filterAll: true + } + ] + } + ]; - return ( -
- -
- ); + return ( +
+ +
+ ); }; Peers.propTypes = { - peerList: peerListType.isRequired, + peerList: peerListType.isRequired }; export default Peers; diff --git a/client/src/components/Panels/AdminPanel.js b/client/src/components/Panels/AdminPanel.js index cc15f1301..ec03f6c2a 100644 --- a/client/src/components/Panels/AdminPanel.js +++ b/client/src/components/Panels/AdminPanel.js @@ -22,6 +22,7 @@ import ChannelForm from '../Forms/ChannelForm'; const styles = theme => { const { type } = theme.palette; const dark = type === 'dark'; + /* istanbul ignore next */ return { current: { color: dark ? 'rgb(42, 173, 230)' : undefined @@ -39,6 +40,7 @@ const styles = theme => { class AdminPanel extends Component { handleChange = () => {}; + /* istanbul ignore next */ render() { const { classes } = this.props; return ( @@ -120,6 +122,7 @@ class AdminPanel extends Component { } } +/* istanbul ignore next */ function mapStateToProps(state, ownProps) { return { channelList: state.channelList.channelList, @@ -130,6 +133,7 @@ function mapStateToProps(state, ownProps) { // return {actions: bindActionCreators({...partActions,...secActions}, dispatch)} // } +/* istanbul ignore next */ export default compose( withStyles(styles), connect(mapStateToProps /* ,mapDispatchToProps */) diff --git a/client/src/components/Panels/NotificationsPanel.js b/client/src/components/Panels/NotificationsPanel.js index a55da3e3e..475e1fcd3 100644 --- a/client/src/components/Panels/NotificationsPanel.js +++ b/client/src/components/Panels/NotificationsPanel.js @@ -13,6 +13,7 @@ import FontAwesome from 'react-fontawesome'; import { Badge } from 'reactstrap'; import Timeago from 'react-timeago'; +/* istanbul ignore next */ const styles = theme => { const { type } = theme.palette; const dark = type === 'dark'; @@ -42,6 +43,7 @@ const styles = theme => { }; export class NotificationsPanel extends Component { + /* istanbul ignore next */ avatarIcon = (type, classes) => { switch (type) { case 'block': @@ -59,6 +61,7 @@ export class NotificationsPanel extends Component { } }; + /* istanbul ignore next */ render() { const { classes, notifications } = this.props; if (notifications.length === 0) { @@ -77,6 +80,7 @@ export class NotificationsPanel extends Component { ); } + /* istanbul ignore next */ return (
diff --git a/client/src/state/redux/charts/operations.js b/client/src/state/redux/charts/operations.js index e3312c69b..8f8ec65cf 100644 --- a/client/src/state/redux/charts/operations.js +++ b/client/src/state/redux/charts/operations.js @@ -5,6 +5,7 @@ import actions from './actions'; import { get } from '../../../services/request'; +/* istanbul ignore next */ const blockPerHour = channel => dispatch => get(`/api/blocksByHour/${channel}/1`) .then(resp => { @@ -24,6 +25,7 @@ const blockPerHour = channel => dispatch => console.error(error); }); +/* istanbul ignore next */ const blockPerMin = channel => dispatch => get(`/api/blocksByMinute/${channel}/1`) .then(resp => { @@ -43,6 +45,7 @@ const blockPerMin = channel => dispatch => console.error(error); }); +/* istanbul ignore next */ const changeChannel = channel => dispatch => get(`/api/changeChannel/${channel}`) .then(resp => { @@ -62,6 +65,7 @@ const changeChannel = channel => dispatch => console.error(error); }); +/* istanbul ignore next */ const channel = () => dispatch => get('/api/curChannel') .then(resp => { @@ -81,6 +85,7 @@ const channel = () => dispatch => console.error(error); }); +/* istanbul ignore next */ const channelList = () => dispatch => get('/api/channels') .then(resp => { @@ -100,6 +105,7 @@ const channelList = () => dispatch => console.error(error); }); +/* istanbul ignore next */ const dashStats = channel => dispatch => get(`/api/status/${channel}`) .then(resp => { @@ -118,6 +124,8 @@ const dashStats = channel => dispatch => .catch(error => { console.error(error); }); + +/* istanbul ignore next */ const blockActivity = channel => dispatch => get(`/api/blockActivity/${channel}`) .then(resp => { @@ -137,11 +145,13 @@ const blockActivity = channel => dispatch => console.error(error); }); +/* istanbul ignore next */ const notification = notification => dispatch => { const notify = JSON.parse(notification); dispatch(actions.getNotification(notify)); }; +/* istanbul ignore next */ const peerStatus = channel => dispatch => get(`/api/peersStatus/${channel}`) .then(resp => { @@ -161,6 +171,7 @@ const peerStatus = channel => dispatch => console.error(error); }); +/* istanbul ignore next */ const transactionByOrg = channel => dispatch => get(`/api/txByOrg/${channel}`) .then(resp => { @@ -180,6 +191,7 @@ const transactionByOrg = channel => dispatch => console.error(error); }); +/* istanbul ignore next */ const transactionPerHour = channel => dispatch => get(`/api/txByHour/${channel}/1`) .then(resp => { @@ -199,6 +211,7 @@ const transactionPerHour = channel => dispatch => console.error(error); }); +/* istanbul ignore next */ const transactionPerMin = channel => dispatch => get(`/api/txByMinute/${channel}/1`) .then(resp => { diff --git a/client/src/state/redux/tables/operations.js b/client/src/state/redux/tables/operations.js index 160cf83d1..b18bdfcca 100644 --- a/client/src/state/redux/tables/operations.js +++ b/client/src/state/redux/tables/operations.js @@ -4,6 +4,7 @@ import actions from './actions'; import { get } from '../../../services/request'; +/* istanbul ignore next */ const blockList = channel => dispatch => get(`/api/blockAndTxList/${channel}/0`) .then(resp => { @@ -31,6 +32,7 @@ const blockListSearch = (channel, query) => dispatch => console.error(error); }); +/* istanbul ignore next */ const chaincodeList = channel => dispatch => get(`/api/chaincode/${channel}`) .then(resp => { @@ -51,6 +53,8 @@ const chaincodeList = channel => dispatch => }); // table channel + +/* istanbul ignore next */ const channels = () => dispatch => get('/api/channels/info') .then(resp => { @@ -70,6 +74,7 @@ const channels = () => dispatch => console.error(error); }); +/* istanbul ignore next */ const peerList = channel => dispatch => get(`/api/peersStatus/${channel}`) .then(resp => { @@ -89,6 +94,7 @@ const peerList = channel => dispatch => console.error(error); }); +/* istanbul ignore next */ const transaction = (channel, transactionId) => dispatch => get(`/api/transaction/${channel}/${transactionId}`) .then(resp => { @@ -117,6 +123,7 @@ const transactionListSearch = (channel, query) => dispatch => console.error(error); }); +/* istanbul ignore next */ const transactionList = channel => dispatch => get(`/api/txList/${channel}/0/0/`) .then(resp => { diff --git a/lgtm.yml b/lgtm.yml index 3e5d6d7a0..83601a78a 100644 --- a/lgtm.yml +++ b/lgtm.yml @@ -1,18 +1,10 @@ - # SPDX-License-Identifier: Apache-2.0 + path_classifiers: - docs: - - '**/*.md' - test: - - '**/test/**/*.js' - third_party: - - 'third_party/**/*.*' - externs: - - '**/*.extern.js' +queries: + exclude: "js/unused-local-variable" extraction: javascript: index: - exclude: e2e-test -queries: - exclude: js/unused-local-variable + exclude: "app/platform/fabric/e2e-test"