rename command_suggestions to commandSuggestions
This commit is contained in:
parent
0379f6bc35
commit
70b62bdc16
|
@ -107,10 +107,10 @@ export const commands = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const COMMAND_SUGGESTIONS = createRequestTypes('COMMAND_SUGGESTIONS');
|
export const COMMAND_SUGGESTIONS = createRequestTypes('COMMAND_SUGGESTIONS');
|
||||||
export const command_suggestions = {
|
export const commandSuggestions = {
|
||||||
post: (command) => action(COMMAND_SUGGESTIONS[REQUEST], {command}),
|
post: (command) => action(COMMAND_SUGGESTIONS[REQUEST], {command}),
|
||||||
success: (command, payload) => {
|
success: (command, payload) => {
|
||||||
return action(COMMAND_SUGGESTIONS[SUCCESS], {command_suggestions: command.result })
|
return action(COMMAND_SUGGESTIONS[SUCCESS], {commandSuggestions: command.result })
|
||||||
},
|
},
|
||||||
failure: (error) => action(COMMAND_SUGGESTIONS[FAILURE], {error})
|
failure: (error) => action(COMMAND_SUGGESTIONS[FAILURE], {error})
|
||||||
};
|
};
|
||||||
|
|
|
@ -114,7 +114,7 @@ class Console extends Component {
|
||||||
filterBy={['value', 'description']}
|
filterBy={['value', 'description']}
|
||||||
maxHeight="200px"
|
maxHeight="200px"
|
||||||
placeholder="Type a command (e.g help)"
|
placeholder="Type a command (e.g help)"
|
||||||
options={this.props.command_suggestions}
|
options={this.props.commandSuggestions}
|
||||||
renderMenuItemChildren={(option) => (
|
renderMenuItemChildren={(option) => (
|
||||||
<div>
|
<div>
|
||||||
{option.value}
|
{option.value}
|
||||||
|
@ -137,7 +137,7 @@ Console.propTypes = {
|
||||||
postCommandSuggestions: PropTypes.func,
|
postCommandSuggestions: PropTypes.func,
|
||||||
isEmbark: PropTypes.func,
|
isEmbark: PropTypes.func,
|
||||||
processes: PropTypes.arrayOf(PropTypes.object).isRequired,
|
processes: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
command_suggestions: PropTypes.arrayOf(PropTypes.object),
|
commandSuggestions: PropTypes.arrayOf(PropTypes.object),
|
||||||
processLogs: PropTypes.arrayOf(PropTypes.object).isRequired,
|
processLogs: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
updateTab: PropTypes.func
|
updateTab: PropTypes.func
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,7 +5,7 @@ import {connect} from 'react-redux';
|
||||||
import {
|
import {
|
||||||
contracts as contractsAction,
|
contracts as contractsAction,
|
||||||
commands as commandsAction,
|
commands as commandsAction,
|
||||||
command_suggestions as commandSuggestionsAction,
|
commandSuggestions as commandSuggestionsAction,
|
||||||
listenToProcessLogs,
|
listenToProcessLogs,
|
||||||
processLogs as processLogsAction,
|
processLogs as processLogsAction,
|
||||||
stopProcessLogs
|
stopProcessLogs
|
||||||
|
@ -63,13 +63,13 @@ class HomeContainer extends Component {
|
||||||
</div>
|
</div>
|
||||||
)} />
|
)} />
|
||||||
|
|
||||||
<DataWrapper shouldRender={this.props.processes.length > 0 } {...this.props} render={({processes, postCommand, postCommandSuggestions, processLogs, command_suggestions}) => (
|
<DataWrapper shouldRender={this.props.processes.length > 0 } {...this.props} render={({processes, postCommand, postCommandSuggestions, processLogs, commandSuggestions}) => (
|
||||||
<Console activeProcess={this.state.activeProcess}
|
<Console activeProcess={this.state.activeProcess}
|
||||||
postCommand={postCommand}
|
postCommand={postCommand}
|
||||||
postCommandSuggestions={postCommandSuggestions}
|
postCommandSuggestions={postCommandSuggestions}
|
||||||
processes={processes}
|
processes={processes}
|
||||||
processLogs={processLogs}
|
processLogs={processLogs}
|
||||||
command_suggestions={command_suggestions}
|
commandSuggestions={commandSuggestions}
|
||||||
isEmbark={() => this.isEmbark}
|
isEmbark={() => this.isEmbark}
|
||||||
updateTab={processName => this.updateTab(processName)} />
|
updateTab={processName => this.updateTab(processName)} />
|
||||||
)} />
|
)} />
|
||||||
|
@ -92,7 +92,7 @@ function mapStateToProps(state) {
|
||||||
contracts: getContracts(state),
|
contracts: getContracts(state),
|
||||||
error: state.errorMessage,
|
error: state.errorMessage,
|
||||||
processLogs: getProcessLogs(state),
|
processLogs: getProcessLogs(state),
|
||||||
command_suggestions: getCommandSuggestions(state),
|
commandSuggestions: getCommandSuggestions(state),
|
||||||
loading: state.loading
|
loading: state.loading
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ const entitiesDefaultState = {
|
||||||
transactions: [],
|
transactions: [],
|
||||||
processes: [],
|
processes: [],
|
||||||
processLogs: [],
|
processLogs: [],
|
||||||
command_suggestions: [],
|
commandSuggestions: [],
|
||||||
contracts: [],
|
contracts: [],
|
||||||
contractProfiles: [],
|
contractProfiles: [],
|
||||||
contractFunctions: [],
|
contractFunctions: [],
|
||||||
|
@ -43,7 +43,7 @@ const sorter = {
|
||||||
if (b.name === EMBARK_PROCESS_NAME) return 1;
|
if (b.name === EMBARK_PROCESS_NAME) return 1;
|
||||||
return 0;
|
return 0;
|
||||||
},
|
},
|
||||||
command_suggestions: function(a, b) {
|
commandSuggestions: function(a, b) {
|
||||||
if (a.value.indexOf('.').length > 0) {
|
if (a.value.indexOf('.').length > 0) {
|
||||||
let a_levels = a.value.split('.').length
|
let a_levels = a.value.split('.').length
|
||||||
let b_levels = b.value.split('.').length
|
let b_levels = b.value.split('.').length
|
||||||
|
@ -93,11 +93,11 @@ const filtrer = {
|
||||||
contracts: function(contract, index, self) {
|
contracts: function(contract, index, self) {
|
||||||
return index === self.findIndex((t) => t.className === contract.className);
|
return index === self.findIndex((t) => t.className === contract.className);
|
||||||
},
|
},
|
||||||
command_suggestions: function(command, index, self) {
|
commandSuggestions: function(command, index, self) {
|
||||||
return index === self.findIndex((c) => (
|
return index === self.findIndex((c) => (
|
||||||
command.value === c.value
|
command.value === c.value
|
||||||
));
|
));
|
||||||
},
|
},
|
||||||
accounts: function(account, index, self) {
|
accounts: function(account, index, self) {
|
||||||
return index === self.findIndex((t) => t.address === account.address);
|
return index === self.findIndex((t) => t.address === account.address);
|
||||||
},
|
},
|
||||||
|
|
|
@ -53,7 +53,7 @@ export function getProcessLogs(state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCommandSuggestions(state) {
|
export function getCommandSuggestions(state) {
|
||||||
return state.entities.command_suggestions;
|
return state.entities.commandSuggestions;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getContractLogsByContract(state, contractName) {
|
export function getContractLogsByContract(state, contractName) {
|
||||||
|
|
|
@ -25,7 +25,7 @@ export const fetchBlocks = doRequest.bind(null, actions.blocks, api.fetchBlocks)
|
||||||
export const fetchTransactions = doRequest.bind(null, actions.transactions, api.fetchTransactions);
|
export const fetchTransactions = doRequest.bind(null, actions.transactions, api.fetchTransactions);
|
||||||
export const fetchProcesses = doRequest.bind(null, actions.processes, api.fetchProcesses);
|
export const fetchProcesses = doRequest.bind(null, actions.processes, api.fetchProcesses);
|
||||||
export const postCommand = doRequest.bind(null, actions.commands, api.postCommand);
|
export const postCommand = doRequest.bind(null, actions.commands, api.postCommand);
|
||||||
export const postCommandSuggestions = doRequest.bind(null, actions.command_suggestions, api.postCommandSuggestions);
|
export const postCommandSuggestions = doRequest.bind(null, actions.commandSuggestions, api.postCommandSuggestions);
|
||||||
export const fetchProcessLogs = doRequest.bind(null, actions.processLogs, api.fetchProcessLogs);
|
export const fetchProcessLogs = doRequest.bind(null, actions.processLogs, api.fetchProcessLogs);
|
||||||
export const fetchContractLogs = doRequest.bind(null, actions.contractLogs, api.fetchContractLogs);
|
export const fetchContractLogs = doRequest.bind(null, actions.contractLogs, api.fetchContractLogs);
|
||||||
export const fetchContracts = doRequest.bind(null, actions.contracts, api.fetchContracts);
|
export const fetchContracts = doRequest.bind(null, actions.contracts, api.fetchContracts);
|
||||||
|
@ -240,7 +240,7 @@ export function *listenToProcessLogs(action) {
|
||||||
processLog: take(channel),
|
processLog: take(channel),
|
||||||
cancel: take(actions.STOP_NEW_PROCESS_LOGS)
|
cancel: take(actions.STOP_NEW_PROCESS_LOGS)
|
||||||
});
|
});
|
||||||
|
|
||||||
if (cancel && action.processName === cancel.processName) {
|
if (cancel && action.processName === cancel.processName) {
|
||||||
channel.close();
|
channel.close();
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -25,6 +25,7 @@ class Suggestions {
|
||||||
|
|
||||||
getSuggestions(cmd) {
|
getSuggestions(cmd) {
|
||||||
cmd = cmd.toLowerCase()
|
cmd = cmd.toLowerCase()
|
||||||
|
let suggestions = []
|
||||||
|
|
||||||
suggestions.push({value: 'web3.eth', command_type: "web3 object", description: "module for interacting with the Ethereum network"})
|
suggestions.push({value: 'web3.eth', command_type: "web3 object", description: "module for interacting with the Ethereum network"})
|
||||||
suggestions.push({value: 'web3.net', command_type: "web3 object", description: "module for interacting with network properties"})
|
suggestions.push({value: 'web3.net', command_type: "web3 object", description: "module for interacting with network properties"})
|
||||||
|
@ -32,7 +33,6 @@ class Suggestions {
|
||||||
suggestions.push({value: 'web3.bzz', command_type: "web3 object", description: "module for interacting with the swarm network"})
|
suggestions.push({value: 'web3.bzz', command_type: "web3 object", description: "module for interacting with the swarm network"})
|
||||||
suggestions.push({value: 'web3.eth.getAccounts()', command_type: "web3 object", description: "get list of accounts"})
|
suggestions.push({value: 'web3.eth.getAccounts()', command_type: "web3 object", description: "get list of accounts"})
|
||||||
|
|
||||||
let suggestions = []
|
|
||||||
for (let contractName in this.contracts) {
|
for (let contractName in this.contracts) {
|
||||||
let contract = this.contracts[contractName]
|
let contract = this.contracts[contractName]
|
||||||
suggestions.push({value: contract.className, command_type: "web3 object", description: "contract deployed at " + contract.deployedAddress});
|
suggestions.push({value: contract.className, command_type: "web3 object", description: "contract deployed at " + contract.deployedAddress});
|
||||||
|
|
Loading…
Reference in New Issue