From 70b62bdc1667beb60d1df61be406428228b95f4e Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Tue, 16 Oct 2018 08:44:50 -0400 Subject: [PATCH] rename command_suggestions to commandSuggestions --- embark-ui/src/actions/index.js | 4 ++-- embark-ui/src/components/Console.js | 4 ++-- embark-ui/src/containers/HomeContainer.js | 8 ++++---- embark-ui/src/reducers/index.js | 8 ++++---- embark-ui/src/reducers/selectors.js | 2 +- embark-ui/src/sagas/index.js | 4 ++-- lib/modules/console/suggestions.js | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/embark-ui/src/actions/index.js b/embark-ui/src/actions/index.js index acce3ca22..dd511d552 100644 --- a/embark-ui/src/actions/index.js +++ b/embark-ui/src/actions/index.js @@ -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}) }; diff --git a/embark-ui/src/components/Console.js b/embark-ui/src/components/Console.js index 09f64d451..8179565a3 100644 --- a/embark-ui/src/components/Console.js +++ b/embark-ui/src/components/Console.js @@ -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) => (
{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 }; diff --git a/embark-ui/src/containers/HomeContainer.js b/embark-ui/src/containers/HomeContainer.js index 5faa5b3de..8696b6ff8 100644 --- a/embark-ui/src/containers/HomeContainer.js +++ b/embark-ui/src/containers/HomeContainer.js @@ -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 {
)} /> - 0 } {...this.props} render={({processes, postCommand, postCommandSuggestions, processLogs, command_suggestions}) => ( + 0 } {...this.props} render={({processes, postCommand, postCommandSuggestions, processLogs, commandSuggestions}) => ( 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 }; } diff --git a/embark-ui/src/reducers/index.js b/embark-ui/src/reducers/index.js index 32dc2334c..086d57322 100644 --- a/embark-ui/src/reducers/index.js +++ b/embark-ui/src/reducers/index.js @@ -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); }, diff --git a/embark-ui/src/reducers/selectors.js b/embark-ui/src/reducers/selectors.js index 2cce34464..80aeb2d18 100644 --- a/embark-ui/src/reducers/selectors.js +++ b/embark-ui/src/reducers/selectors.js @@ -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) { diff --git a/embark-ui/src/sagas/index.js b/embark-ui/src/sagas/index.js index 59a250122..a5e8cb876 100644 --- a/embark-ui/src/sagas/index.js +++ b/embark-ui/src/sagas/index.js @@ -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); @@ -240,7 +240,7 @@ export function *listenToProcessLogs(action) { processLog: take(channel), cancel: take(actions.STOP_NEW_PROCESS_LOGS) }); - + if (cancel && action.processName === cancel.processName) { channel.close(); return; diff --git a/lib/modules/console/suggestions.js b/lib/modules/console/suggestions.js index decc34c3a..610e5d143 100644 --- a/lib/modules/console/suggestions.js +++ b/lib/modules/console/suggestions.js @@ -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});