Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
e57301e5
Commit
e57301e5
authored
Dec 05, 2017
by
serapath
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FIX indicator
parent
1b88139f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
26 deletions
+17
-26
run-tab.js
src/app/tabs/run-tab.js
+2
-6
execution-context.js
src/execution-context.js
+15
-1
detect-network.js
src/lib/detect-network.js
+0
-19
No files found.
src/app/tabs/run-tab.js
View file @
e57301e5
'use strict'
'use strict'
var
$
=
require
(
'jquery'
)
var
$
=
require
(
'jquery'
)
var
yo
=
require
(
'yo-yo'
)
var
yo
=
require
(
'yo-yo'
)
var
detectNetwork
=
require
(
'../../lib/detect-network'
)
var
helper
=
require
(
'../../lib/helper.js'
)
var
helper
=
require
(
'../../lib/helper.js'
)
var
txExecution
=
require
(
'../execution/txExecution'
)
var
txExecution
=
require
(
'../execution/txExecution'
)
var
txFormat
=
require
(
'../execution/txFormat'
)
var
txFormat
=
require
(
'../execution/txFormat'
)
...
@@ -383,12 +382,9 @@ function settings (appAPI, appEvents) {
...
@@ -383,12 +382,9 @@ function settings (appAPI, appEvents) {
// SETTINGS HTML
// SETTINGS HTML
var
net
=
yo
`<span class=
${
css
.
network
}
></span>`
var
net
=
yo
`<span class=
${
css
.
network
}
></span>`
const
updateNetwork
=
()
=>
{
const
updateNetwork
=
()
=>
{
detectNetwork
((
err
,
{
id
,
name
}
=
{})
=>
{
executionContext
.
detectNetwork
((
err
,
{
id
,
name
}
=
{})
=>
{
if
(
err
)
console
.
error
(
err
)
if
(
err
)
console
.
error
(
err
)
console
.
log
(
`update network[
${
id
}
] name:
${
name
}
`
)
net
.
innerHTML
=
`<i class="
${
css
.
networkItem
}
fa fa-plug" aria-hidden="true"></i>
${
name
}
(
${
id
||
'-'
}
)`
net
.
innerHTML
=
`
<i class="
${
css
.
networkItem
}
fa fa-plug" aria-hidden="true"></i>
${
name
}
(
${
id
||
'-'
}
)
`
})
})
}
}
updateNetwork
()
updateNetwork
()
...
...
src/execution-context.js
View file @
e57301e5
...
@@ -91,7 +91,21 @@ function ExecutionContext () {
...
@@ -91,7 +91,21 @@ function ExecutionContext () {
}
}
this
.
web3
=
function
()
{
this
.
web3
=
function
()
{
return
this
.
isVM
()
?
web3VM
:
web3
return
this
.
isVM
()
?
web3VM
.
web3
:
web3
}
this
.
detectNetwork
=
function
(
callback
)
{
this
.
web3
().
version
.
getNetwork
((
err
,
id
)
=>
{
var
name
=
null
if
(
err
)
name
=
'Unknown'
else
if
(
id
===
'1'
)
name
=
'Main'
else
if
(
id
===
'2'
)
name
=
'Morden (deprecated)'
else
if
(
id
===
'3'
)
name
=
'Ropsten'
else
if
(
id
===
'4'
)
name
=
'Rinkeby'
else
if
(
id
===
'42'
)
name
=
'Kovan'
else
name
=
'Unknown'
callback
(
err
,
{
id
,
name
})
})
}
}
this
.
internalWeb3
=
function
()
{
this
.
internalWeb3
=
function
()
{
...
...
src/lib/detect-network.js
deleted
100644 → 0
View file @
1b88139f
var
executionContext
=
require
(
'../execution-context'
)
window
.
executionContext
=
executionContext
module
.
exports
=
detectNetwork
function
detectNetwork
(
callback
)
{
var
web3provider
=
executionContext
.
web3
()
var
get
=
web3provider
.
version
?
web3provider
.
version
.
getNetwork
:
web3provider
.
web3
.
version
.
getNetwork
get
((
err
,
id
)
=>
{
var
name
=
null
if
(
err
)
name
=
'Unknown'
else
if
(
id
===
'1'
)
name
=
'Main'
else
if
(
id
===
'2'
)
name
=
'Morden (deprecated)'
else
if
(
id
===
'3'
)
name
=
'Ropsten'
else
if
(
id
===
'4'
)
name
=
'Rinkeby'
else
if
(
id
===
'42'
)
name
=
'Kovan'
else
name
=
'Unknown'
callback
(
err
,
{
id
,
name
})
})
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment