From c3ae10d9df682bcf4c929ebf35826c50599f4d41 Mon Sep 17 00:00:00 2001 From: Petr Balashov Date: Tue, 6 Jun 2017 18:31:25 +0200 Subject: [PATCH] cli --- react/src/actions/actionCreators.js | 1 + react/src/actions/storeType.js | 3 +- react/src/components/dashboard/settings.js | 86 +++++++++++++++++++++- react/src/reducers/settings.js | 8 +- react/src/util/cacheFormat.js | 7 +- 5 files changed, 96 insertions(+), 9 deletions(-) diff --git a/react/src/actions/actionCreators.js b/react/src/actions/actionCreators.js index 56f1015..635788f 100644 --- a/react/src/actions/actionCreators.js +++ b/react/src/actions/actionCreators.js @@ -65,6 +65,7 @@ export * from './actions/dexCoins'; export * from './actions/fullTxHistory'; export * from './actions/basiliskTxHistory'; export * from './actions/iguanaHelpers'; +export * from './actions/cli'; export let Config; diff --git a/react/src/actions/storeType.js b/react/src/actions/storeType.js index dff833c..1b0527e 100644 --- a/react/src/actions/storeType.js +++ b/react/src/actions/storeType.js @@ -41,4 +41,5 @@ export const SAVE_APP_CONFIG = 'SAVE_APP_CONFIG'; export const SERVICE_ERROR = 'SERVICE_ERROR'; export const DASHBOARD_ACTIVE_ADDRESS = 'DASHBOARD_ACTIVE_ADDRESS'; export const LOAD_APP_INFO = 'LOAD_APP_INFO'; -export const LOG_GUI_HTTP = 'LOG_GUI_HTTP'; \ No newline at end of file +export const LOG_GUI_HTTP = 'LOG_GUI_HTTP'; +export const CLI = 'CLI'; \ No newline at end of file diff --git a/react/src/components/dashboard/settings.js b/react/src/components/dashboard/settings.js index 323d060..4367884 100644 --- a/react/src/components/dashboard/settings.js +++ b/react/src/components/dashboard/settings.js @@ -10,7 +10,8 @@ import { addPeerNode, getAppConfig, saveAppConfig, - getAppInfo + getAppInfo, + shepherdCli } from '../../actions/actionCreators'; import Store from '../../store'; import AddCoinOptionsCrypto from '../addcoin/addcoinOptionsCrypto'; @@ -35,6 +36,9 @@ class Settings extends React.Component { activeTabHeight: '0', appSettings: {}, tabElId: null, + cliCmdString: null, + cliCoin: null, + cliResponse: null, }; this.exportWifKeys = this.exportWifKeys.bind(this); this.updateInput = this.updateInput.bind(this); @@ -64,6 +68,12 @@ class Settings extends React.Component { tabElId: this.state.tabElId, })); } + + console.log('settings props', props); + } + + execCliCmd() { + Store.dispatch(shepherdCli('passthru', null, 'getinfo')); } openTab(elemId, tab) { @@ -340,6 +350,16 @@ class Settings extends React.Component { ); } + renderCliResponse() { + if (this.state.cliResponse) { + return ( + 1234 + ); + } else { + return null; + } + } + render() { return (
@@ -676,7 +696,9 @@ class Settings extends React.Component { onClick={ this.readDebugLog }>{ translate('INDEX.LOAD_DEBUG_LOG') }
-
{ this.renderDebugLogData() }
+
+ { this.renderDebugLogData() } +
@@ -716,6 +738,66 @@ class Settings extends React.Component { { this.renderAppInfoTab() } + +
this.openTab('Cli', 9) }> +
+ + CLI + +
+
+
+

Select a coin and type in CLI compatible command

+
+
+
+ + +
+
+ + +
+
+ +
+
+
+ { this.renderCliResponse() } +
+
+
+
+
+
diff --git a/react/src/reducers/settings.js b/react/src/reducers/settings.js index 2799e3d..133cd96 100644 --- a/react/src/reducers/settings.js +++ b/react/src/reducers/settings.js @@ -3,7 +3,8 @@ import { GET_PEERS_LIST, GET_DEBUG_LOG, LOAD_APP_CONFIG, - LOAD_APP_INFO + LOAD_APP_INFO, + CLI } from '../actions/storeType'; export function Settings(state = { @@ -12,6 +13,7 @@ export function Settings(state = { debugLog: null, appSettings: null, appInfo: null, + cli: null, }, action) { switch (action.type) { case GET_WIF_KEY: @@ -36,6 +38,10 @@ export function Settings(state = { return Object.assign({}, state, { appInfo: action.info, }); + case CLI: + return Object.assign({}, state, { + cli: action.data, + }); default: return state; } diff --git a/react/src/util/cacheFormat.js b/react/src/util/cacheFormat.js index 792d405..dd02e4f 100644 --- a/react/src/util/cacheFormat.js +++ b/react/src/util/cacheFormat.js @@ -5,23 +5,20 @@ export function edexGetTxIDList(getTxData) { getTxidList.push(getTxData[i].txid); } - console.log(getTxidList); - return getTxidList; } export function edexRemoveTXID(_obj, address, txidArray) { let txidToStr = ':' + txidArray.join(':') + ':'; - console.log(txidToStr); - if (_obj, _obj.basilisk) { if (Object.keys(_obj.basilisk).length === 0) { console.log('no coin nodes to parse'); } else { for (let key in _obj.basilisk) { for (let coinAddr in _obj.basilisk[key]) { - if (_obj.basilisk[key][coinAddr] !== 'addresses' && coinAddr === address) { + if (_obj.basilisk[key][coinAddr] !== 'addresses' && + coinAddr === address) { if (_obj.basilisk[key][coinAddr].refresh && _obj.basilisk[key][coinAddr].refresh.data && _obj.basilisk[key][coinAddr].refresh.data.length > 0) {