diff --git a/js/src/views/RpcCalls/actions/localstorage.js b/js/src/views/RpcCalls/actions/localstorage.js deleted file mode 100644 index 258159105..000000000 --- a/js/src/views/RpcCalls/actions/localstorage.js +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -import { createAction } from 'redux-actions'; - -export const syncRpcStateFromLocalStorage = createAction('sync rpcStateFromLocalStorage'); diff --git a/js/src/views/RpcCalls/actions/logger.js b/js/src/views/RpcCalls/actions/logger.js deleted file mode 100644 index e8f8556e1..000000000 --- a/js/src/views/RpcCalls/actions/logger.js +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -import { createAction } from 'redux-actions'; - -import { identity } from '../util'; -import { withError } from '~/redux/util'; - -export const updateLogging = createAction( - 'update logging', identity, withError(flag => `logging updated to ${flag}`) -); diff --git a/js/src/views/RpcCalls/actions/rpc.js b/js/src/views/RpcCalls/actions/rpc.js deleted file mode 100644 index 1c6f5a169..000000000 --- a/js/src/views/RpcCalls/actions/rpc.js +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -import { createAction } from 'redux-actions'; - -import { identity } from '../util'; -import { withError } from '~/redux/util'; - -export const error = createAction('error rpc', identity, - withError(() => 'error processing rpc call. check console for details', 'error') -); -export const fireRpc = createAction('fire rpc'); -export const addRpcReponse = createAction('add rpcResponse'); -export const selectRpcMethod = createAction('select rpcMethod'); -export const resetRpcPrevCalls = createAction('reset rpcPrevCalls'); diff --git a/js/src/views/RpcCalls/components/AutoComplete/AutoComplete.js b/js/src/views/RpcCalls/components/AutoComplete/AutoComplete.js deleted file mode 100644 index 6584f34a5..000000000 --- a/js/src/views/RpcCalls/components/AutoComplete/AutoComplete.js +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -import React, { Component, PropTypes } from 'react'; -import AutoComplete from 'material-ui/AutoComplete'; - -export default class WrappedAutoComplete extends Component { - render () { - return ( - - ); - } - - static defaultProps = { - openOnFocus: true, - filter: (searchText, key) => searchText === '' || key.toLowerCase().indexOf(searchText.toLowerCase()) !== -1 - } - - static propTypes = { - dataSource: PropTypes.array.isRequired, - filter: PropTypes.func, - name: PropTypes.string.isRequired, - openOnFocus: PropTypes.bool - } - - static contextTypes = { - muiTheme: PropTypes.object.isRequired - } -} diff --git a/js/src/views/RpcCalls/components/AutoComplete/AutoComplete.spec.js b/js/src/views/RpcCalls/components/AutoComplete/AutoComplete.spec.js deleted file mode 100644 index 87bc9a1e8..000000000 --- a/js/src/views/RpcCalls/components/AutoComplete/AutoComplete.spec.js +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -import React from 'react'; -import { shallow } from 'enzyme'; - -import getMuiTheme from 'material-ui/styles/getMuiTheme'; - -import WrappedAutoComplete from './AutoComplete'; - -describe('views/Status/components/AutoComplete', () => { - describe('rendering', () => { - let rendered; - - beforeEach(() => { - const dataSource = ['abc', 'def', 'ghi']; - const component = - ; - - rendered = shallow(component, { context: { muiTheme: getMuiTheme({}) } }); - }); - - it('renders the material AutoComplete component', () => { - expect(rendered).to.be.ok; - expect(rendered).to.have.exactly(1).descendants('AutoComplete'); - }); - }); -}); diff --git a/js/src/views/RpcCalls/components/AutoComplete/index.js b/js/src/views/RpcCalls/components/AutoComplete/index.js deleted file mode 100644 index d84245ff6..000000000 --- a/js/src/views/RpcCalls/components/AutoComplete/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -export default from './AutoComplete'; diff --git a/js/src/views/RpcCalls/components/Box/Box.js b/js/src/views/RpcCalls/components/Box/Box.js deleted file mode 100644 index 1d6f525d2..000000000 --- a/js/src/views/RpcCalls/components/Box/Box.js +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -import React, { Component, PropTypes } from 'react'; - -export default class Box extends Component { - renderValue () { - if (!this.props.value) { - return; - } - - return ( -

{ this.props.value }

- ); - } - - render () { - return ( -
-

{ this.props.title }

- { this.renderValue() } - { this.props.children } -
- ); - } - - static propTypes = { - title: PropTypes.string.isRequired, - value: PropTypes.string, - children: PropTypes.element - } -} diff --git a/js/src/views/RpcCalls/components/Box/Box.spec.js b/js/src/views/RpcCalls/components/Box/Box.spec.js deleted file mode 100644 index 34154425c..000000000 --- a/js/src/views/RpcCalls/components/Box/Box.spec.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -import React from 'react'; -import { shallow } from 'enzyme'; - -import Box from './Box'; - -describe('views/Status/components/Box', () => { - describe('rendering', () => { - const title = 'test title'; - let rendered; - - beforeEach(() => { - rendered = shallow(); - }); - - it('renders the component', () => { - expect(rendered).to.be.ok; - expect(rendered).to.have.className('dapp-box'); - }); - - it('renders the title', () => { - expect(rendered.find('h2')).to.have.text(title); - }); - - it('renders no default value', () => { - expect(rendered).to.not.have.descendants('h1'); - }); - }); - - describe('contents', () => { - const value = 'test value'; - const child = 'this is the child value'; - - let rendered; - - beforeEach(() => { - rendered = shallow( - -
{ child }
-
- ); - }); - - it('renders the value', () => { - expect(rendered.find('h1')).to.have.text(value); - }); - - it('wraps the children', () => { - expect(rendered.find('pre')).to.have.text(child); - }); - }); -}); diff --git a/js/src/views/RpcCalls/components/Box/index.js b/js/src/views/RpcCalls/components/Box/index.js deleted file mode 100644 index 35e9da0cb..000000000 --- a/js/src/views/RpcCalls/components/Box/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -export default from './Box'; diff --git a/js/src/views/RpcCalls/components/Call/Call.css b/js/src/views/RpcCalls/components/Call/Call.css deleted file mode 100644 index 8dcf36e9e..000000000 --- a/js/src/views/RpcCalls/components/Call/Call.css +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright 2015-2017 Parity Technologies (UK) Ltd. -/* This file is part of Parity. -/* -/* Parity is free software: you can redistribute it and/or modify -/* it under the terms of the GNU General Public License as published by -/* the Free Software Foundation, either version 3 of the License, or -/* (at your option) any later version. -/* -/* Parity is distributed in the hope that it will be useful, -/* but WITHOUT ANY WARRANTY; without even the implied warranty of -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -/* GNU General Public License for more details. -/* -/* You should have received a copy of the GNU General Public License -/* along with Parity. If not, see . -*/ -.call { - position: relative; - border-bottom: 2px solid #CCC6C6; - margin-bottom: 18.4px; - background: #f5f4f2; -} - -.call:first-child { - border-color: #6691C2; -} - -.call pre { - margin: 0; -} - -.call pre:nth-child(3) { - padding-top: 0; - color: #bbb; -} - -.callNo { - float: right; - color: #ccc; -} diff --git a/js/src/views/RpcCalls/components/Call/Call.js b/js/src/views/RpcCalls/components/Call/Call.js deleted file mode 100644 index 52a120fec..000000000 --- a/js/src/views/RpcCalls/components/Call/Call.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -import React, { Component, PropTypes } from 'react'; - -import Response from '../Response'; -import styles from './Call.css'; - -export default class Call extends Component { - render () { - let { callNo, name, params, response } = this.props.call; - - params = this.formatParams(params); - return ( -
- #{ callNo } -
{ name }({ params })
- -
- ); - } - - setElement = el => { - this.element = el; - } - - setActiveCall = () => { - this.props.setActiveCall(this.props.call, this.element); - } - - formatParams (params) { - return params.reduce((str, p) => { - if (str !== '') { - str += ', '; - } - if (p === undefined) { - return str; - } - if (typeof p === 'object' || typeof p === 'string') { - p = JSON.stringify(p); - } - return str + p; - }, ''); - } - - static propTypes = { - call: PropTypes.object.isRequired, - setActiveCall: PropTypes.func.isRequired - } -} diff --git a/js/src/views/RpcCalls/components/Call/Call.spec.js b/js/src/views/RpcCalls/components/Call/Call.spec.js deleted file mode 100644 index af7e633e6..000000000 --- a/js/src/views/RpcCalls/components/Call/Call.spec.js +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -import React from 'react'; -import { shallow } from 'enzyme'; -import sinon from 'sinon'; - -import '../../../../environment/tests'; - -import Call from './Call'; - -describe('views/Status/components/Call', () => { - const call = { callIdx: 123, callNo: 456, name: 'eth_call', params: [{ name: '123' }], response: '' }; - const element = 'dummyElement'; - - let rendered; - let instance; - let setActiveCall = sinon.stub(); - - beforeEach(() => { - rendered = shallow( - - ); - instance = rendered.instance(); - }); - - describe('rendering', () => { - it('renders the component', () => { - expect(rendered).to.be.ok; - expect(rendered).to.have.exactly(1).descendants(`div[data-test="Call-call-${call.callNo}"]`); - }); - - it('adds onMouseEnter to setActiveElement', () => { - expect(rendered.find('div').first()).to.have.prop('onMouseEnter', instance.setActiveCall); - }); - }); - - describe('actions', () => { - it('sets the element via setElement', () => { - expect(instance.element).to.not.be.ok; - instance.setElement(element); - expect(instance.element).to.equal(element); - }); - - it('calls parent setActive call on setActiveCall', () => { - instance.setElement(element); - instance.setActiveCall(); - - expect(setActiveCall).to.be.calledWith(call, element); - }); - }); - - describe('utility', () => { - describe('.formatParams', () => { - it('correctly returns a single parameter', () => { - expect(instance.formatParams([1])).to.equal('1'); - }); - - it('correctly joins 2 parameters', () => { - expect(instance.formatParams([1, 2])).to.equal('1, 2'); - }); - - it('stringifies a string object', () => { - expect(instance.formatParams(['1'])).to.equal('"1"'); - }); - - it('stringifies an object object', () => { - expect(instance.formatParams([{ name: '1' }])).to.equal('{"name":"1"}'); - }); - - it('skips an undefined value', () => { - expect(instance.formatParams(['1', undefined, 3])).to.equal('"1", , 3'); - }); - }); - }); -}); diff --git a/js/src/views/RpcCalls/components/Call/index.js b/js/src/views/RpcCalls/components/Call/index.js deleted file mode 100644 index 0620b46de..000000000 --- a/js/src/views/RpcCalls/components/Call/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -export default from './Call'; diff --git a/js/src/views/RpcCalls/components/Calls/Calls.css b/js/src/views/RpcCalls/components/Calls/Calls.css deleted file mode 100644 index 0266579ac..000000000 --- a/js/src/views/RpcCalls/components/Calls/Calls.css +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright 2015-2017 Parity Technologies (UK) Ltd. -/* This file is part of Parity. -/* -/* Parity is free software: you can redistribute it and/or modify -/* it under the terms of the GNU General Public License as published by -/* the Free Software Foundation, either version 3 of the License, or -/* (at your option) any later version. -/* -/* Parity is distributed in the hope that it will be useful, -/* but WITHOUT ANY WARRANTY; without even the implied warranty of -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -/* GNU General Public License for more details. -/* -/* You should have received a copy of the GNU General Public License -/* along with Parity. If not, see . -*/ -.historyInfo { - margin-top: 0; - text-transform: initial; -} - -.header { - margin: 0; -} - -.removeIcon { - float: right; - color: #bbb; - cursor: pointer; - transition: opacity ease-in-out 0.2s; - transition-delay: 0.2s; - opacity: 0; -} - -div:hover > .removeIcon { - opacity: 1.0; -} - -.history { - margin-top: calc(1em + 18.4px); - padding-top: 0; - overflow: auto; - max-height: 60vh; -} diff --git a/js/src/views/RpcCalls/components/Calls/Calls.js b/js/src/views/RpcCalls/components/Calls/Calls.js deleted file mode 100644 index 3a1023bc6..000000000 --- a/js/src/views/RpcCalls/components/Calls/Calls.js +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -import React, { Component, PropTypes } from 'react'; -import { FormattedMessage } from 'react-intl'; - -import Call from '../Call'; -import CallsToolbar from '../CallsToolbar'; -import styles from './Calls.css'; - -export default class Calls extends Component { - state = { - activeCall: null, - activeChild: null - } - - render () { - return ( -
- { this.renderClear() } -

- -

-
- { this.renderNoCallsMsg() } - { this.renderCalls() } -
- -
- ); - } - - renderClear () { - if (!this.props.calls.length) { - return; - } - - return ( - - } - onClick={ this.clearHistory } - className={ styles.removeIcon } - > - - - ); - } - - renderNoCallsMsg () { - if (this.props.calls.length) { - return; - } - - return ( -
-

- -

-
- ); - } - - renderCalls () { - const { calls } = this.props; - - if (!calls.length) { - return; - } - - return calls.map((call, idx) => ( - - )); - } - - clearActiveCall = () => { - this.setState({ activeCall: null, activeChild: null }); - } - - setActiveCall = (call, el) => { - this.setState({ activeCall: call, activeChild: el }); - } - - setCallsHistory = el => { - this._callsHistory = el; - } - - clearHistory = () => { - this.props.reset(); - } - - static propTypes = { - calls: PropTypes.arrayOf(PropTypes.object).isRequired, - actions: PropTypes.shape({ - fireRpc: PropTypes.func.isRequired, - copyToClipboard: PropTypes.func.isRequired, - selectRpcMethod: PropTypes.func.isRequired - }).isRequired, - reset: PropTypes.func - } -} diff --git a/js/src/views/RpcCalls/components/Calls/Calls.spec.js b/js/src/views/RpcCalls/components/Calls/Calls.spec.js deleted file mode 100644 index 4127f65cb..000000000 --- a/js/src/views/RpcCalls/components/Calls/Calls.spec.js +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -import React from 'react'; -import { shallow } from 'enzyme'; - -import '../../../../environment/tests'; - -import Calls from './Calls'; - -describe('views/Status/components/Calls', () => { - describe('rendering (no calls)', () => { - let rendered; - - before(() => { - const calls = []; - - rendered = shallow(); - }); - - it('renders the component and container', () => { - expect(rendered).to.be.ok; - expect(rendered).to.have.className('calls-container'); - }); - - it('renders no calls', () => { - expect(rendered.find('div[data-test="Calls-empty-wrapper"]')).to.have.exactly(1).descendants('h3'); - }); - - it('renders no clear button', () => { - expect(rendered.find('a[data-test="Calls-remove"]')).to.not.exist; - }); - - it('renders an attached CallsToolbar', () => { - expect(rendered).to.have.exactly(1).descendants('CallsToolbar'); - }); - }); - - describe('rendering (calls supplied)', () => { - const calls = [ - { callNo: 0, name: 'eth_call', params: '', response: '' }, - { callNo: 1, name: 'eth_sendTransaction', params: '', response: '' } - ]; - const actions = { action1: true, action2: true }; - - let rendered; - let instance; - - before(() => { - rendered = shallow(); - instance = rendered.instance(); - }); - - it('renders the clear button', () => { - expect(rendered).to.have.exactly(1).descendants('a[data-test="Calls-remove"]'); - }); - - it('renders calls', () => { - expect(rendered.find('div[data-test="Calls-empty-wrapper"]')).to.not.exist; - expect(rendered.find('div.row div')).to.have.exactly(2).descendants('Call'); - }); - - it('passes the correct properties to Call', () => { - const call = rendered.find('Call').first(); - - expect(call).to.have.prop('setActiveCall', instance.setActiveCall); - expect(call).to.have.prop('call').deep.equal(calls[0]); - }); - - it('passes the correct properties to CallsToolbar', () => { - const child = { offsetTop: 0 }; - const container = { scrollTop: 0 }; - - instance.setCallsHistory(container); - rendered.setState({ activeCall: 'dummyActiveCall', activeChild: child }); - - const toolbar = rendered.find('CallsToolbar').first(); - - expect(toolbar).to.have.prop('call', 'dummyActiveCall'); - expect(toolbar).to.have.prop('actions').deep.equal(actions); - expect(toolbar).to.have.prop('callEl').deep.equal(child); - expect(toolbar).to.have.prop('containerEl').deep.equal(container); - }); - }); - - describe('actions', () => { - let rendered; - let instance; - - before(() => { - const calls = [ - { callNo: 0, name: 'eth_call', params: '', response: '' }, - { callNo: 1, name: 'eth_sendTransaction', params: '', response: '' } - ]; - - rendered = shallow(); - instance = rendered.instance(); - }); - - it('sets the element via setCallsHistory', () => { - instance.setCallsHistory('dummyElement'); - - expect(instance._callsHistory).to.equal('dummyElement'); - }); - - it('sets state via setActiveCall', () => { - instance.setActiveCall('dummyActiveCall', 'dummyActiveChild'); - - expect(rendered).to.have.state('activeCall', 'dummyActiveCall'); - expect(rendered).to.have.state('activeChild', 'dummyActiveChild'); - }); - - it('clears state via clearActiveCall', () => { - instance.setActiveCall('dummyActiveCall', 'dummyActiveChild'); - expect(rendered).to.have.state('activeCall', 'dummyActiveCall'); - instance.clearActiveCall(); - - expect(rendered).to.have.state('activeCall', null); - expect(rendered).to.have.state('activeChild', null); - }); - }); -}); diff --git a/js/src/views/RpcCalls/components/Calls/index.js b/js/src/views/RpcCalls/components/Calls/index.js deleted file mode 100644 index 4e625ded8..000000000 --- a/js/src/views/RpcCalls/components/Calls/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -export default from './Calls'; diff --git a/js/src/views/RpcCalls/components/CallsToolbar/CallsToolbar.css b/js/src/views/RpcCalls/components/CallsToolbar/CallsToolbar.css deleted file mode 100644 index 8c34e1921..000000000 --- a/js/src/views/RpcCalls/components/CallsToolbar/CallsToolbar.css +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright 2015-2017 Parity Technologies (UK) Ltd. -/* This file is part of Parity. -/* -/* Parity is free software: you can redistribute it and/or modify -/* it under the terms of the GNU General Public License as published by -/* the Free Software Foundation, either version 3 of the License, or -/* (at your option) any later version. -/* -/* Parity is distributed in the hope that it will be useful, -/* but WITHOUT ANY WARRANTY; without even the implied warranty of -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -/* GNU General Public License for more details. -/* -/* You should have received a copy of the GNU General Public License -/* along with Parity. If not, see . -*/ -.callActionsWrap { - position: absolute; - animation: fadein .5s; - right: 0; - height: 28px; -} - -.callActionsButton { - padding: 0 !important; - height: 24px !important; -} - -.callActionsWrap:hover .callActionsButton { - display: none !important; -} - -.callActions { - display: none; - height: 100%; - margin-top: 1px; - margin-right: 10px; -} - -.callActionsWrap:hover .callActions { - display: block; -} - -.callAction { - float: right; - transition: opacity ease-in-out .2s; - transition-delay: .2s; - opacity: 0; - padding: 3px !important; - height: 22px !important; - width: 22px !important; -} - -.callActions:hover .callAction { - opacity: 1; -} - -.callActionIcon { - height: 100% !important; - width: 100% !important; -} - -@keyframes fadein { - from { opacity: 0; } - to { opacity: 1; } -} diff --git a/js/src/views/RpcCalls/components/CallsToolbar/CallsToolbar.js b/js/src/views/RpcCalls/components/CallsToolbar/CallsToolbar.js deleted file mode 100644 index 618a5de26..000000000 --- a/js/src/views/RpcCalls/components/CallsToolbar/CallsToolbar.js +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -import React, { Component, PropTypes } from 'react'; -import CopyToClipboard from 'react-copy-to-clipboard'; -import { FormattedMessage } from 'react-intl'; -import { sortBy, find, extend } from 'lodash'; - -import IconButton from 'material-ui/IconButton'; -import MoreHorizIcon from 'material-ui/svg-icons/navigation/more-horiz'; -import CallIcon from 'material-ui/svg-icons/communication/call'; -import AssignmentIcon from 'material-ui/svg-icons/action/assignment'; -import InputIcon from 'material-ui/svg-icons/action/input'; - -import { SCROLLBAR_WIDTH } from '../../constants'; -import styles from './CallsToolbar.css'; -import rpcData from '../../data/rpc.json'; -const rpcMethods = sortBy(rpcData.methods, 'name'); - -export default class CallsToolbar extends Component { - render () { - const { call, callEl, containerEl } = this.props; - - if (!call) { - return null; - } - - const wrapStyle = { top: callEl.offsetTop - SCROLLBAR_WIDTH - containerEl.scrollTop }; - - if (this.hasScrollbar(containerEl)) { - wrapStyle.right = 13; - } - - return ( -
- - - -
- - } - tooltipPosition='top-left' - { ...this._test('button-setCall') } - > - - - - } - tooltipPosition='top-left' - { ...this._test('button-makeCall') } - > - - - - - } - tooltipPosition='top-left' - { ...this._test('copyCallToClipboard') } - > - - - -
-
- ); - } - - setCall = () => { - const { call } = this.props; - let method = find(rpcMethods, { name: call.name }); - - this.props.actions.selectRpcMethod(extend({}, method, { paramsValues: call.params })); - } - - makeCall = () => { - const { call } = this.props; - let method = find(rpcMethods, { name: call.name }); - - this.setCall(); - this.props.actions.fireRpc({ - method: method.name, - outputFormatter: method.outputFormatter, - inputFormatters: method.inputFormatters, - params: call.params - }); - } - - copyToClipboard = () => { - this.props.actions.copyToClipboard( - - ); - } - - hasScrollbar (el) { - return el.clientHeight < el.scrollHeight; - } -} - -CallsToolbar.propTypes = { - call: PropTypes.object.isRequired, - callEl: PropTypes.node.isRequired, - containerEl: PropTypes.node.isRequired, - actions: PropTypes.shape({ - fireRpc: PropTypes.func.isRequired, - copyToClipboard: PropTypes.func.isRequired, - selectRpcMethod: PropTypes.func.isRequired - }).isRequired -}; diff --git a/js/src/views/RpcCalls/components/CallsToolbar/CallsToolbar.spec.js b/js/src/views/RpcCalls/components/CallsToolbar/CallsToolbar.spec.js deleted file mode 100644 index e326f730e..000000000 --- a/js/src/views/RpcCalls/components/CallsToolbar/CallsToolbar.spec.js +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -import React from 'react'; -import sinon from 'sinon'; -import { shallow } from 'enzyme'; - -import '../../../../environment/tests'; - -import CallsToolbar from './CallsToolbar'; - -describe('views/Status/components/CallsToolbar', () => { - const callEl = { offsetTop: 0 }; - const containerEl = { scrollTop: 0, clientHeight: 0, scrollHeight: 999 }; - - describe('rendering (no call)', () => { - let rendered; - - before(() => { - const call = null; - - rendered = shallow(); - }); - - it('does not render the component', () => { - expect(rendered).to.not.have.descendants('[data-test="CallsToolbar-button-more"]'); - }); - }); - - describe('rendering', () => { - const call = { callNo: 456, name: 'eth_call', params: '', response: '' }; - let rendered; - let btncontainer; - - before(() => { - rendered = shallow(); - btncontainer = rendered.find('[data-test="CallsToolbar-button-container"]'); - }); - - it('renders the More button', () => { - expect(rendered).to.have.descendants('[data-test="CallsToolbar-button-more"]'); - }); - - it('renders the Set button', () => { - expect(btncontainer).to.have.descendants('[data-test="CallsToolbar-button-setCall"]'); - }); - - it('renders the Fire button', () => { - expect(btncontainer).to.have.descendants('[data-test="CallsToolbar-button-makeCall"]'); - }); - - it('renders the Copy button', () => { - expect(btncontainer).to.have.descendants('[data-test="CallsToolbar-copyCallToClipboard"]'); - }); - }); - - describe('actions', () => { - const call = { callNo: 456, name: 'eth_call', params: '', response: '' }; - const actions = { fireRpc: sinon.stub(), copyToClipboard: sinon.stub(), selectRpcMethod: sinon.stub() }; - - let rendered; - let instance; - - before(() => { - rendered = shallow(); - instance = rendered.instance(); - }); - - it('calls copyToClipboard with action copyToClipboard', () => { - instance.copyToClipboard(); - expect(actions.copyToClipboard).to.be.calledOnce; - }); - - it('calls setCall with action selectRpcMethod', () => { - instance.setCall(); - expect(actions.selectRpcMethod).to.be.calledOnce; - }); - - it('calls makeCall with action fireRpc', () => { - instance.makeCall(); - expect(actions.fireRpc).to.be.calledOnce; - }); - }); - - describe('utility', () => { - const call = { callNo: 456, name: 'eth_call', params: '', response: '' }; - let rendered; - let instance; - - before(() => { - rendered = shallow(); - instance = rendered.instance(); - }); - - describe('.hasScrollbar', () => { - it('correctly returns true when scrollbar', () => { - expect(instance.hasScrollbar({ clientHeight: 123, scrollHeight: 456 })).to.be.true; - }); - - it('correctly returns false when no scrollbar', () => { - expect(instance.hasScrollbar({ clientHeight: 456, scrollHeight: 123 })).to.be.false; - }); - }); - }); -}); diff --git a/js/src/views/RpcCalls/components/CallsToolbar/index.js b/js/src/views/RpcCalls/components/CallsToolbar/index.js deleted file mode 100644 index 1baac0636..000000000 --- a/js/src/views/RpcCalls/components/CallsToolbar/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -export default from './CallsToolbar'; diff --git a/js/src/views/RpcCalls/components/EditableValue/EditableValue.css b/js/src/views/RpcCalls/components/EditableValue/EditableValue.css deleted file mode 100644 index bfa3dc674..000000000 --- a/js/src/views/RpcCalls/components/EditableValue/EditableValue.css +++ /dev/null @@ -1,74 +0,0 @@ -/* Copyright 2015-2017 Parity Technologies (UK) Ltd. -/* This file is part of Parity. -/* -/* Parity is free software: you can redistribute it and/or modify -/* it under the terms of the GNU General Public License as published by -/* the Free Software Foundation, either version 3 of the License, or -/* (at your option) any later version. -/* -/* Parity is distributed in the hope that it will be useful, -/* but WITHOUT ANY WARRANTY; without even the implied warranty of -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -/* GNU General Public License for more details. -/* -/* You should have received a copy of the GNU General Public License -/* along with Parity. If not, see . -*/ -.input { - margin-top: 0; - width: 100%; - padding-left: 10px; - padding-right: 50px; -} - -.icon, .iconSuccess, .firstIcon { - display: block; - cursor: pointer; - flex: 1; - margin: 3px 3px; - color: #bbb; -} - -.success, .iconSuccess { - color: #8bc34a; -} - -.icon i, .iconSuccess i, .firstIcon i { - vertical-align: middle; -} - -.icons, .iconsVisible, .firstIcon { - z-index: 10; - position: absolute; - right: 0; - top: 0; - bottom: 0; - display: flex; - opacity: 0; - transition: opacity ease-in-out .2s; - transition-delay: 0.2s; -} - -.iconsVisible { - opacity: 1.0; -} - -.container:hover .icons, .container:hover .firstIcon { - opacity: 1.0; -} - -.firstIcon { - position: absolute; - left: -10px; - right: auto; - top: 0; - bottom: 0; - margin: 3px 0; - display: block; -} - -.autocomplete input { - margin-top: 0; - padding-left: 10px !important; - padding-right: 50px !important; -} diff --git a/js/src/views/RpcCalls/components/EditableValue/EditableValue.js b/js/src/views/RpcCalls/components/EditableValue/EditableValue.js deleted file mode 100644 index 98ad223ca..000000000 --- a/js/src/views/RpcCalls/components/EditableValue/EditableValue.js +++ /dev/null @@ -1,204 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -import React, { Component, PropTypes } from 'react'; -import { FormattedMessage } from 'react-intl'; -import AutoComplete from 'material-ui/AutoComplete'; - -import styles from './EditableValue.css'; -import valueStyles from '../Value/Value.css'; - -export default class EditableValue extends Component { - state = { - value: this.props.value, - inEditMode: false - } - - componentWillReceiveProps (newProps) { - if (newProps.value === this.state.value || this.state.inEditMode) { - return; - } - this.setState({ - value: newProps.value - }); - } - - onChange = value => { - this.setState({ - value: value - }); - } - - onOpenEdit = evt => { - this.setState({ - inEditMode: true - }); - - if (!this._input) { - return; - } - this._input.focus(); - } - - onCancel = evt => { - this.setState({ - inEditMode: false, - value: this.props.value - }); - } - - onSubmit = () => { - this.setState({ - inEditMode: false - }); - this.props.onSubmit(this.state.value, false); - } - - onResetToDefault = () => { - this.props.onSubmit(this.props.defaultValue, true); - } - - render () { - return ( -
- { this.renderResetButton() } -
- { this.props.children } - { this.renderButtons() } -
- { this.renderInput() } -
- ); - } - - renderInput () { - const { inEditMode, value } = this.state; - - const setInput = el => { this._input = el; }; - const onChange = evt => this.onChange(evt.target.value); - - if (!inEditMode || !this.props.autocomplete) { - return ( - - ); - } - - return ( - - ); - } - - renderResetButton () { - if (this.state.inEditMode) { - return; - } - - if (!this.props.defaultValue || this.state.value === this.props.defaultValue) { - return; - } - - return ( - - } - { ...this._testInherit('reset') } - > - - - ); - } - - renderButtons () { - if (this.state.inEditMode) { - return [ - - - , - - - - ]; - } - - return ( - - } - { ...this._testInherit('edit') } - > - - - ); - } - - static propTypes = { - onSubmit: PropTypes.func.isRequired, - value: PropTypes.string, - defaultValue: PropTypes.string, - children: PropTypes.element, - autocomplete: PropTypes.bool, - dataSource: PropTypes.arrayOf(PropTypes.string) - } -} diff --git a/js/src/views/RpcCalls/components/EditableValue/index.js b/js/src/views/RpcCalls/components/EditableValue/index.js deleted file mode 100644 index 480a8772b..000000000 --- a/js/src/views/RpcCalls/components/EditableValue/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -export default from './EditableValue'; diff --git a/js/src/views/RpcCalls/components/JsonEditor/JsonEditor.css b/js/src/views/RpcCalls/components/JsonEditor/JsonEditor.css deleted file mode 100644 index 87b7e10d9..000000000 --- a/js/src/views/RpcCalls/components/JsonEditor/JsonEditor.css +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright 2015-2017 Parity Technologies (UK) Ltd. -/* This file is part of Parity. -/* -/* Parity is free software: you can redistribute it and/or modify -/* it under the terms of the GNU General Public License as published by -/* the Free Software Foundation, either version 3 of the License, or -/* (at your option) any later version. -/* -/* Parity is distributed in the hope that it will be useful, -/* but WITHOUT ANY WARRANTY; without even the implied warranty of -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -/* GNU General Public License for more details. -/* -/* You should have received a copy of the GNU General Public License -/* along with Parity. If not, see . -*/ -.editor { - width: 100%; - height: 200px; -} - -.error { - border: 1px solid red !important; -} - -.errorMsg { - color: red; -} diff --git a/js/src/views/RpcCalls/components/JsonEditor/JsonEditor.js b/js/src/views/RpcCalls/components/JsonEditor/JsonEditor.js deleted file mode 100644 index 75bc59e87..000000000 --- a/js/src/views/RpcCalls/components/JsonEditor/JsonEditor.js +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -import React, { Component, PropTypes } from 'react'; -import { isEqual } from 'lodash'; -import formatJson from 'format-json'; - -import styles from './JsonEditor.css'; - -export default class JsonEditor extends Component { - constructor (...args) { - super(...args); - let { value } = this.props; - - value = formatJson.plain(value); - this.state = { value }; - } - - componentDidMount () { - const mockedEvt = { target: { value: this.state.value } }; - - this.onChange(mockedEvt); - } - - componentWillReceiveProps (nextProps) { - let { value } = nextProps; - - if (!isEqual(value, this.props.value)) { - value = formatJson.plain(value); - this.setState({ value }); - } - } - - render () { - let errorClass = this.state.error ? styles.error : ''; - - return ( -
-