Browse Source

cli

all-modes
Petr Balashov 8 years ago
parent
commit
c3ae10d9df
  1. 1
      react/src/actions/actionCreators.js
  2. 3
      react/src/actions/storeType.js
  3. 86
      react/src/components/dashboard/settings.js
  4. 8
      react/src/reducers/settings.js
  5. 7
      react/src/util/cacheFormat.js

1
react/src/actions/actionCreators.js

@ -65,6 +65,7 @@ export * from './actions/dexCoins';
export * from './actions/fullTxHistory'; export * from './actions/fullTxHistory';
export * from './actions/basiliskTxHistory'; export * from './actions/basiliskTxHistory';
export * from './actions/iguanaHelpers'; export * from './actions/iguanaHelpers';
export * from './actions/cli';
export let Config; export let Config;

3
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 SERVICE_ERROR = 'SERVICE_ERROR';
export const DASHBOARD_ACTIVE_ADDRESS = 'DASHBOARD_ACTIVE_ADDRESS'; export const DASHBOARD_ACTIVE_ADDRESS = 'DASHBOARD_ACTIVE_ADDRESS';
export const LOAD_APP_INFO = 'LOAD_APP_INFO'; export const LOAD_APP_INFO = 'LOAD_APP_INFO';
export const LOG_GUI_HTTP = 'LOG_GUI_HTTP'; export const LOG_GUI_HTTP = 'LOG_GUI_HTTP';
export const CLI = 'CLI';

86
react/src/components/dashboard/settings.js

@ -10,7 +10,8 @@ import {
addPeerNode, addPeerNode,
getAppConfig, getAppConfig,
saveAppConfig, saveAppConfig,
getAppInfo getAppInfo,
shepherdCli
} from '../../actions/actionCreators'; } from '../../actions/actionCreators';
import Store from '../../store'; import Store from '../../store';
import AddCoinOptionsCrypto from '../addcoin/addcoinOptionsCrypto'; import AddCoinOptionsCrypto from '../addcoin/addcoinOptionsCrypto';
@ -35,6 +36,9 @@ class Settings extends React.Component {
activeTabHeight: '0', activeTabHeight: '0',
appSettings: {}, appSettings: {},
tabElId: null, tabElId: null,
cliCmdString: null,
cliCoin: null,
cliResponse: null,
}; };
this.exportWifKeys = this.exportWifKeys.bind(this); this.exportWifKeys = this.exportWifKeys.bind(this);
this.updateInput = this.updateInput.bind(this); this.updateInput = this.updateInput.bind(this);
@ -64,6 +68,12 @@ class Settings extends React.Component {
tabElId: this.state.tabElId, tabElId: this.state.tabElId,
})); }));
} }
console.log('settings props', props);
}
execCliCmd() {
Store.dispatch(shepherdCli('passthru', null, 'getinfo'));
} }
openTab(elemId, tab) { openTab(elemId, tab) {
@ -340,6 +350,16 @@ class Settings extends React.Component {
); );
} }
renderCliResponse() {
if (this.state.cliResponse) {
return (
1234
);
} else {
return null;
}
}
render() { render() {
return ( return (
<div className="margin-left-0"> <div className="margin-left-0">
@ -676,7 +696,9 @@ class Settings extends React.Component {
onClick={ this.readDebugLog }>{ translate('INDEX.LOAD_DEBUG_LOG') }</button> onClick={ this.readDebugLog }>{ translate('INDEX.LOAD_DEBUG_LOG') }</button>
</div> </div>
<div className="col-sm-12 col-xs-12 text-align-left"> <div className="col-sm-12 col-xs-12 text-align-left">
<div className="padding-top-40 padding-bottom-20 horizontal-padding-0">{ this.renderDebugLogData() }</div> <div className="padding-top-40 padding-bottom-20 horizontal-padding-0">
{ this.renderDebugLogData() }
</div>
</div> </div>
</form> </form>
</div> </div>
@ -716,6 +738,66 @@ class Settings extends React.Component {
</div> </div>
</div> </div>
{ this.renderAppInfoTab() } { this.renderAppInfoTab() }
<div
className="panel"
id="Cli"
onClick={ () => this.openTab('Cli', 9) }>
<div className="panel-heading">
<a className={ this.state.activeTab === 9 ? 'panel-title' : 'panel-title collapsed' }>
<i className="icon fa-code"></i> CLI
</a>
</div>
<div
className={ this.state.activeTab === 9 ? 'panel-collapse collapse in' : 'panel-collapse collapse' }
style={{ height: this.state.activeTab === 9 ? this.state.activeTabHeight + 'px' : '0' }}>
<div className="panel-body">
<p>Select a coin and type in CLI compatible command</p>
<div className="col-sm-12"></div>
<form
className="execute-cli-cmd-form"
method="post"
action="javascript:"
autoComplete="off">
<div className="form-group form-material floating">
<select
className="form-control form-material"
name="cliCoin"
id="settingsCliOptions"
onChange={ this.updateInput }>
<option value="komodo">Komodo</option>
</select>
<label
className="floating-label"
htmlFor="settingsDelectDebugLogOptions">Coin</label>
</div>
<div className="form-group form-material floating">
<textarea
type="text"
className="form-control"
name="cliCmd"
id="cliCmd"
value={ this.state.cliCmdString }
onChange={ this.updateInput }></textarea>
<label
className="floating-label"
htmlFor="readDebugLogLines">Type in CLI compatible cmd</label>
</div>
<div className="col-sm-12 col-xs-12 text-align-center">
<button
type="button"
className="btn btn-primary waves-effect waves-light"
onClick={ () => this.execCliCmd() }>Execute</button>
</div>
<div className="col-sm-12 col-xs-12 text-align-left">
<div className="padding-top-40 padding-bottom-20 horizontal-padding-0">
{ this.renderCliResponse() }
</div>
</div>
</form>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>

8
react/src/reducers/settings.js

@ -3,7 +3,8 @@ import {
GET_PEERS_LIST, GET_PEERS_LIST,
GET_DEBUG_LOG, GET_DEBUG_LOG,
LOAD_APP_CONFIG, LOAD_APP_CONFIG,
LOAD_APP_INFO LOAD_APP_INFO,
CLI
} from '../actions/storeType'; } from '../actions/storeType';
export function Settings(state = { export function Settings(state = {
@ -12,6 +13,7 @@ export function Settings(state = {
debugLog: null, debugLog: null,
appSettings: null, appSettings: null,
appInfo: null, appInfo: null,
cli: null,
}, action) { }, action) {
switch (action.type) { switch (action.type) {
case GET_WIF_KEY: case GET_WIF_KEY:
@ -36,6 +38,10 @@ export function Settings(state = {
return Object.assign({}, state, { return Object.assign({}, state, {
appInfo: action.info, appInfo: action.info,
}); });
case CLI:
return Object.assign({}, state, {
cli: action.data,
});
default: default:
return state; return state;
} }

7
react/src/util/cacheFormat.js

@ -5,23 +5,20 @@ export function edexGetTxIDList(getTxData) {
getTxidList.push(getTxData[i].txid); getTxidList.push(getTxData[i].txid);
} }
console.log(getTxidList);
return getTxidList; return getTxidList;
} }
export function edexRemoveTXID(_obj, address, txidArray) { export function edexRemoveTXID(_obj, address, txidArray) {
let txidToStr = ':' + txidArray.join(':') + ':'; let txidToStr = ':' + txidArray.join(':') + ':';
console.log(txidToStr);
if (_obj, _obj.basilisk) { if (_obj, _obj.basilisk) {
if (Object.keys(_obj.basilisk).length === 0) { if (Object.keys(_obj.basilisk).length === 0) {
console.log('no coin nodes to parse'); console.log('no coin nodes to parse');
} else { } else {
for (let key in _obj.basilisk) { for (let key in _obj.basilisk) {
for (let coinAddr in _obj.basilisk[key]) { 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 && if (_obj.basilisk[key][coinAddr].refresh &&
_obj.basilisk[key][coinAddr].refresh.data && _obj.basilisk[key][coinAddr].refresh.data &&
_obj.basilisk[key][coinAddr].refresh.data.length > 0) { _obj.basilisk[key][coinAddr].refresh.data.length > 0) {

Loading…
Cancel
Save