Skip to content

Commit

Permalink
Documentation, url validation, proptype required additions and lint f…
Browse files Browse the repository at this point in the history
…ixes on network tab and form.
  • Loading branch information
danjm committed May 9, 2019
1 parent ed81fed commit 29c5762
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion ui/app/helpers/utils/transactions.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export function getStatusKey (transaction) {
}

/**
* An external block explorer url at which a transaction can be viewed.
* Returns an external block explorer URL at which a transaction can be viewed.
* @param {number} networkId
* @param {string} hash
* @param {Object} rpcPrefs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ import TextField from '../../../../components/ui/text-field'

export default class NetworksTab extends PureComponent {
static contextTypes = {
t: PropTypes.func,
metricsEvent: PropTypes.func,
t: PropTypes.func.isRequired,
metricsEvent: PropTypes.func.isRequired,
}

static propTypes = {
editRpc: PropTypes.func,
editRpc: PropTypes.func.isRequired,
rpcUrl: PropTypes.string,
chainId: PropTypes.string,
ticker: PropTypes.string,
viewOnly: PropTypes.bool,
networkName: PropTypes.string,
onClear: PropTypes.func,
setRpcTarget: PropTypes.func,
onClear: PropTypes.func.isRequired,
setRpcTarget: PropTypes.func.isRequired,
networksTabIsInAddMode: PropTypes.bool,
blockExplorerUrl: PropTypes.string,
rpcPrefs: PropTypes.object,
Expand Down Expand Up @@ -145,7 +145,7 @@ export default class NetworksTab extends PureComponent {
this.setErrorTo(stateKey, '')
} else {
const appendedRpc = `http://${url}`
const validWhenAppended = validUrl.isWebUri(appendedRpc) && !url.match(/^https*:\/\/$/)
const validWhenAppended = validUrl.isWebUri(appendedRpc) && !url.match(/^https?:\/\/$/)

this.setErrorTo(stateKey, this.context.t(validWhenAppended ? 'uriErrorMsg' : 'invalidRPC'))
}
Expand Down
18 changes: 9 additions & 9 deletions ui/app/pages/settings/networks-tab/networks-tab.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ import NetworkDropdownIcon from '../../../components/app/dropdowns/components/ne

export default class NetworksTab extends PureComponent {
static contextTypes = {
t: PropTypes.func,
metricsEvent: PropTypes.func,
t: PropTypes.func.isRequired,
metricsEvent: PropTypes.func.isRequired,
}

static propTypes = {
editRpc: PropTypes.func,
history: PropTypes.object,
location: PropTypes.object,
editRpc: PropTypes.func.isRequired,
history: PropTypes.object.isRequired,
location: PropTypes.object.isRequired,
networkIsSelected: PropTypes.bool,
networksTabIsInAddMode: PropTypes.bool,
networksToRender: PropTypes.array,
networksToRender: PropTypes.array.isRequired,
selectedNetwork: PropTypes.object,
setNetworksTabAddMode: PropTypes.func,
setRpcTarget: PropTypes.func,
setSelectedSettingsRpcUrl: PropTypes.func,
setNetworksTabAddMode: PropTypes.func.isRequired,
setRpcTarget: PropTypes.func.isRequired,
setSelectedSettingsRpcUrl: PropTypes.func.isRequired,
providerUrl: PropTypes.string,
providerType: PropTypes.string,
networkDefaultedToProvider: PropTypes.bool,
Expand Down
4 changes: 2 additions & 2 deletions ui/app/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1983,13 +1983,13 @@ function updateAndSetCustomRpc (newRpc, chainId, ticker = 'ETH', nickname, rpcPr
function editRpc (oldRpc, newRpc, chainId, ticker = 'ETH', nickname, rpcPrefs) {
return (dispatch) => {
log.debug(`background.delRpcTarget: ${oldRpc}`)
background.delCustomRpc(oldRpc, (err, result) => {
background.delCustomRpc(oldRpc, (err) => {
if (err) {
log.error(err)
return dispatch(self.displayWarning('Had a problem removing network!'))
}
dispatch(actions.setSelectedToken())
background.updateAndSetCustomRpc(newRpc, chainId, ticker, nickname || newRpc, rpcPrefs, (err, result) => {
background.updateAndSetCustomRpc(newRpc, chainId, ticker, nickname || newRpc, rpcPrefs, (err) => {
if (err) {
log.error(err)
return dispatch(actions.displayWarning('Had a problem changing networks!'))
Expand Down

0 comments on commit 29c5762

Please sign in to comment.