do not alert user if config set from the url param

pull/1/head
yann300 8 years ago
parent ca2f891047
commit c678752828
  1. 8
      src/app.js
  2. 27
      src/app/execution-context.js

@ -898,12 +898,14 @@ var run = function () {
setVersionText(version) setVersionText(version)
runCompiler() runCompiler()
if (queryParams.get().context) {
executionContext.setContext(queryParams.get().context, false)
}
if (queryParams.get().endpointurl) { if (queryParams.get().endpointurl) {
executionContext.setEndPointUrl(queryParams.get().endpointurl) executionContext.setEndPointUrl(queryParams.get().endpointurl)
} }
if (queryParams.get().context) {
executionContext.setContext(queryParams.get().context)
}
if (queryParams.get().debugtx) { if (queryParams.get().debugtx) {
startdebugging(queryParams.get().debugtx) startdebugging(queryParams.get().debugtx)
} }

@ -88,31 +88,27 @@ function ExecutionContext () {
} }
this.setEndPointUrl = function (url) { this.setEndPointUrl = function (url) {
$web3endpoint.val(url) setProviderFromEndpoint(url)
} }
this.setContext = function (context) { this.setContext = function (context, alert) {
executionContext = context executionContext = context
executionContextChange(context) executionContextChange(context, alert)
} }
var $web3endpoint = $('#web3Endpoint') function executionContextChange (context, alert) {
if (alert && context === 'web3' && !confirm('Are you sure you want to connect to a local ethereum node?')) {
if (web3.providers && web3.currentProvider instanceof web3.providers.IpcProvider) {
$web3endpoint.val('ipc')
}
function executionContextChange (context) {
if (context === 'web3' && !confirm('Are you sure you want to connect to a local ethereum node?')) {
return false return false
} else if (context === 'injected' && injectedProvider === undefined) { } else if (context === 'injected' && injectedProvider === undefined) {
return false return false
} else { } else {
if (context === 'web3') { if (context === 'web3') {
executionContext = context executionContext = context
var endpoint = prompt('Please type Web3 Provider Endpoint', 'http://localhost:8545') var endPoint = 'http://localhost:8545'
setProviderFromEndpoint(endpoint) if (alert) {
self.event.trigger('web3EndpointChanged') endPoint = prompt('Please type Web3 Provider Endpoint', endPoint)
}
setProviderFromEndpoint(endPoint)
self.event.trigger('contextChanged', ['web3']) self.event.trigger('contextChanged', ['web3'])
} else if (context === 'injected') { } else if (context === 'injected') {
executionContext = context executionContext = context
@ -135,6 +131,7 @@ function ExecutionContext () {
} else { } else {
web3.setProvider(new web3.providers.HttpProvider(endpoint)) web3.setProvider(new web3.providers.HttpProvider(endpoint))
} }
self.event.trigger('web3EndpointChanged')
} }
/* --------------------------------------------------------------------------- /* ---------------------------------------------------------------------------
@ -143,7 +140,7 @@ function ExecutionContext () {
var selectExEnv = document.querySelector('#selectExEnv') var selectExEnv = document.querySelector('#selectExEnv')
selectExEnv.addEventListener('change', function (event) { selectExEnv.addEventListener('change', function (event) {
if (!executionContextChange(selectExEnv.options[selectExEnv.selectedIndex].value)) { if (!executionContextChange(selectExEnv.options[selectExEnv.selectedIndex].value, true)) {
selectExEnv.value = executionContext selectExEnv.value = executionContext
} }
}) })

Loading…
Cancel
Save