mirror of https://github.com/embarklabs/embark.git
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 = {
|
||||
export const commandSuggestions = {
|
||||
post: (command) => action(COMMAND_SUGGESTIONS[REQUEST], {command}),
|
||||
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})
|
||||
};
|
||||
|
|
|
@ -114,7 +114,7 @@ class Console extends Component {
|
|||
filterBy={['value', 'description']}
|
||||
maxHeight="200px"
|
||||
placeholder="Type a command (e.g help)"
|
||||
options={this.props.command_suggestions}
|
||||
options={this.props.commandSuggestions}
|
||||
renderMenuItemChildren={(option) => (
|
||||
<div>
|
||||
{option.value}
|
||||
|
@ -137,7 +137,7 @@ Console.propTypes = {
|
|||
postCommandSuggestions: PropTypes.func,
|
||||
isEmbark: PropTypes.func,
|
||||
processes: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
command_suggestions: PropTypes.arrayOf(PropTypes.object),
|
||||
commandSuggestions: PropTypes.arrayOf(PropTypes.object),
|
||||
processLogs: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
updateTab: PropTypes.func
|
||||
};
|
||||
|
|
|
@ -5,7 +5,7 @@ import {connect} from 'react-redux';
|
|||
import {
|
||||
contracts as contractsAction,
|
||||
commands as commandsAction,
|
||||
command_suggestions as commandSuggestionsAction,
|
||||
commandSuggestions as commandSuggestionsAction,
|
||||
listenToProcessLogs,
|
||||
processLogs as processLogsAction,
|
||||
stopProcessLogs
|
||||
|
@ -63,13 +63,13 @@ class HomeContainer extends Component {
|
|||
</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}
|
||||
postCommand={postCommand}
|
||||
postCommandSuggestions={postCommandSuggestions}
|
||||
processes={processes}
|
||||
processLogs={processLogs}
|
||||
command_suggestions={command_suggestions}
|
||||
commandSuggestions={commandSuggestions}
|
||||
isEmbark={() => this.isEmbark}
|
||||
updateTab={processName => this.updateTab(processName)} />
|
||||
)} />
|
||||
|
@ -92,7 +92,7 @@ function mapStateToProps(state) {
|
|||
contracts: getContracts(state),
|
||||
error: state.errorMessage,
|
||||
processLogs: getProcessLogs(state),
|
||||
command_suggestions: getCommandSuggestions(state),
|
||||
commandSuggestions: getCommandSuggestions(state),
|
||||
loading: state.loading
|
||||
};
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ const entitiesDefaultState = {
|
|||
transactions: [],
|
||||
processes: [],
|
||||
processLogs: [],
|
||||
command_suggestions: [],
|
||||
commandSuggestions: [],
|
||||
contracts: [],
|
||||
contractProfiles: [],
|
||||
contractFunctions: [],
|
||||
|
@ -43,7 +43,7 @@ const sorter = {
|
|||
if (b.name === EMBARK_PROCESS_NAME) return 1;
|
||||
return 0;
|
||||
},
|
||||
command_suggestions: function(a, b) {
|
||||
commandSuggestions: function(a, b) {
|
||||
if (a.value.indexOf('.').length > 0) {
|
||||
let a_levels = a.value.split('.').length
|
||||
let b_levels = b.value.split('.').length
|
||||
|
@ -93,11 +93,11 @@ const filtrer = {
|
|||
contracts: function(contract, index, self) {
|
||||
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) => (
|
||||
command.value === c.value
|
||||
));
|
||||
},
|
||||
},
|
||||
accounts: function(account, index, self) {
|
||||
return index === self.findIndex((t) => t.address === account.address);
|
||||
},
|
||||
|
|
|
@ -53,7 +53,7 @@ export function getProcessLogs(state) {
|
|||
}
|
||||
|
||||
export function getCommandSuggestions(state) {
|
||||
return state.entities.command_suggestions;
|
||||
return state.entities.commandSuggestions;
|
||||
}
|
||||
|
||||
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 fetchProcesses = doRequest.bind(null, actions.processes, api.fetchProcesses);
|
||||
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 fetchContractLogs = doRequest.bind(null, actions.contractLogs, api.fetchContractLogs);
|
||||
export const fetchContracts = doRequest.bind(null, actions.contracts, api.fetchContracts);
|
||||
|
|
|
@ -25,6 +25,7 @@ class Suggestions {
|
|||
|
||||
getSuggestions(cmd) {
|
||||
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.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.eth.getAccounts()', command_type: "web3 object", description: "get list of accounts"})
|
||||
|
||||
let suggestions = []
|
||||
for (let contractName in this.contracts) {
|
||||
let contract = this.contracts[contractName]
|
||||
suggestions.push({value: contract.className, command_type: "web3 object", description: "contract deployed at " + contract.deployedAddress});
|
||||
|
|
Loading…
Reference in New Issue