diff --git a/react/src/components/dashboard/settings/settings.daemonStdoutPanel.js b/react/src/components/dashboard/settings/settings.daemonStdoutPanel.js new file mode 100644 index 0000000..3521a4c --- /dev/null +++ b/react/src/components/dashboard/settings/settings.daemonStdoutPanel.js @@ -0,0 +1,111 @@ +import React from 'react'; +import { translate } from '../../../translate/translate'; +import { connect } from 'react-redux'; +import { coindGetStdout } from '../../../actions/actionCreators'; +import Store from '../../../store'; + +class DaemonStdoutPanel extends React.Component { + constructor() { + super(); + this.state = { + coindStdOut: 'Loading...', + coin: null, + textareaHeight: '100px', + }; + this.getCoindGetStdout = this.getCoindGetStdout.bind(this); + this.updateInput = this.updateInput.bind(this); + } + + componentWillMount() { + this.getCoindGetStdout(); + } + + getCoindGetStdout() { + const _coin = this.state.coin || this.props.ActiveCoin.coin; + + coindGetStdout(_coin) + .then((res) => { + this.setState({ + coindStdOut: res.msg === 'success' ? res.result : `Error reading ${_coin} stdout`, + }); + + setTimeout(() => { + document.querySelector('#settingsCoindStdoutTextarea').style.height = '1px'; + document.querySelector('#settingsCoindStdoutTextarea').style.height = `${(15 + document.querySelector('#settingsCoindStdoutTextarea').scrollHeight)}px`; + }, 100); + }); + } + + updateInput(e) { + this.setState({ + [e.target.name]: e.target.value, + }); + + this.getCoindGetStdout(); + } + + renderCoinListSelectorOptions(coin) { + let _items = []; + let _nativeCoins = this.props.Main.coins.native; + + for (let i = 0; i < _nativeCoins.length; i++) { + _items.push( + + ); + } + + return _items; + } + + render() { + return ( +
+
+
+
+
+ +
+
+ +
+
+
+
+
+ +
+
+
+
+ ); + }; +} + +const mapStateToProps = (state) => { + return { + ActiveCoin: { + coin: state.ActiveCoin.coin, + mode: state.ActiveCoin.mode, + }, + Main: state.Main, + }; +}; + +export default connect(mapStateToProps)(DaemonStdoutPanel); \ No newline at end of file diff --git a/react/src/components/dashboard/settings/settings.panelBody.js b/react/src/components/dashboard/settings/settings.panelBody.js index ed5f102..f6eb396 100644 --- a/react/src/components/dashboard/settings/settings.panelBody.js +++ b/react/src/components/dashboard/settings/settings.panelBody.js @@ -13,6 +13,7 @@ class PanelSection extends React.Component { componentDidMount() { const { active } = this.props; + let _pass = false; if (active) { this.setState({ @@ -22,14 +23,15 @@ class PanelSection extends React.Component { this.accordionResizeInterval = setInterval(() => { if (this.props.active) { - this.setState({ - sectionHeight: `${this.accordionContent.scrollHeight}px`, + this.setState({ // auto resize hack + sectionHeight: _pass ? 'auto' : `${this.accordionContent.scrollHeight}px`, }); + _pass = !_pass; } }, 500); } - componentWillUnmount() { + componentWillUnmount() { // revise(?) clearInterval(this.accordionResizeInterval); } diff --git a/react/src/components/dashboard/settings/settings.render.js b/react/src/components/dashboard/settings/settings.render.js index e6f8a06..373bdae 100644 --- a/react/src/components/dashboard/settings/settings.render.js +++ b/react/src/components/dashboard/settings/settings.render.js @@ -14,6 +14,8 @@ import ExportKeysPanel from './settings.exportKeysPanel'; // import ImportKeysPanel from './settings.importKeysPanel'; import SupportPanel from './settings.supportPanel'; import SPVServersPanel from './settings.spvServersPanel'; +import DaemonStdoutPanel from './settings.daemonStdoutPanel'; + // import WalletInfoPanel from './settings.walletInfoPanel'; // import WalletBackupPanel from './settings.walletBackupPanel'; @@ -73,9 +75,18 @@ export const SettingsRender = function() { openByDefault={this.props.disableWalletSpecificUI}> + { this.props.Main.coins && + this.props.Main.coins.native && + Object.keys(this.props.Main.coins.native).length > 0 && + + + + } + icon="icon fa-wrench">