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
d5d15f7f
Commit
d5d15f7f
authored
Sep 05, 2017
by
serapath
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
REFACTOR terminal
parent
db7d96a9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
14 deletions
+15
-14
terminal.js
src/app/panels/terminal.js
+13
-12
compiling.js
test-browser/tests/compiling.js
+2
-2
No files found.
src/app/panels/terminal.js
View file @
d5d15f7f
...
...
@@ -162,7 +162,7 @@ class Terminal {
self
.
registerCommand
(
'script'
,
function
execute
(
args
,
scopedCommands
,
append
)
{
var
script
=
String
(
args
[
0
])
scopedCommands
.
log
(
`>
${
script
}
`
)
self
.
_shell
(
script
,
function
(
error
,
output
)
{
self
.
_shell
(
script
,
scopedCommands
,
function
(
error
,
output
)
{
if
(
error
)
scopedCommands
.
error
(
error
)
else
scopedCommands
.
log
(
output
)
})
...
...
@@ -564,10 +564,11 @@ class Terminal {
self
.
commands
[
name
].
help
=
help
return
self
.
commands
[
name
]
}
_shell
(
script
,
done
)
{
// default shell
_shell
(
script
,
scopedCommands
,
done
)
{
// default shell
var
self
=
this
var
context
=
domTerminalFeatures
(
self
,
scopedCommands
)
try
{
var
context
=
vm
.
createContext
(
Object
.
assign
(
self
.
_jsSandboxContext
,
domTerminalFeatures
(
self
)
))
var
context
=
vm
.
createContext
(
Object
.
assign
(
self
.
_jsSandboxContext
,
context
))
var
result
=
vm
.
runInContext
(
script
,
context
)
self
.
_jsSandboxContext
=
Object
.
assign
({},
context
)
done
(
null
,
result
)
...
...
@@ -577,15 +578,15 @@ class Terminal {
}
}
function
domTerminalFeatures
(
self
)
{
return
{
web3
:
executionContext
.
getProvider
()
!==
'vm'
?
new
Web3
(
executionContext
.
web3
().
currentProvider
)
:
null
,
console
:
{
log
:
function
()
{
self
.
commands
.
log
.
apply
(
null
,
arguments
)
},
info
:
function
()
{
self
.
commands
.
info
.
apply
(
null
,
arguments
)
},
error
:
function
()
{
self
.
commands
.
error
.
apply
(
null
,
arguments
)
}
}
}
function
domTerminalFeatures
(
self
,
scopedCommands
)
{
var
ctx
=
scopedCommands
ctx
.
web3
=
executionContext
.
getProvider
()
!==
'vm'
?
new
Web3
(
executionContext
.
web3
().
currentProvider
)
:
null
,
ctx
.
console
=
console
=
{
log
:
function
()
{
scopedCommands
.
log
.
apply
(
scopedCommands
,
arguments
)
},
info
:
function
()
{
scopedCommands
.
info
.
apply
(
scopedCommands
,
arguments
)
},
error
:
function
()
{
scopedCommands
.
error
.
apply
(
scopedCommands
,
arguments
)
}
}
return
context
}
function
findDeep
(
object
,
fn
,
found
=
{
break
:
false
,
value
:
undefined
})
{
...
...
test-browser/tests/compiling.js
View file @
d5d15f7f
...
...
@@ -32,8 +32,8 @@ function runTests (browser) {
.
click
(
'#runTabView div[class^="create"]'
)
.
waitForElementPresent
(
'.instance button[title="f - transact (not payable)"]'
)
.
click
(
'.instance button[title="f - transact (not payable)"]'
)
.
waitForElementPresent
(
'#editor-container div[class^="terminal"]
.knownTransaction
span[id="tx0xa178c603400a184ce5fedbcfab392d9b77822f6ffa7facdec693aded214523bc"]'
)
.
assert
.
containsText
(
'#editor-container div[class^="terminal"]
.knownTransaction
span[id="tx0xa178c603400a184ce5fedbcfab392d9b77822f6ffa7facdec693aded214523bc"]'
,
'(vm): from:0xca3...a733c, to:0x692...77b3a, browser/Untitled.sol:TestContract.f(), value:0 wei, data:0x261...21ff0, 0 logs, hash:0xa17...523bc,DetailsDebug'
)
.
waitForElementPresent
(
'#editor-container div[class^="terminal"] span[id="tx0xa178c603400a184ce5fedbcfab392d9b77822f6ffa7facdec693aded214523bc"]'
)
.
assert
.
containsText
(
'#editor-container div[class^="terminal"] span[id="tx0xa178c603400a184ce5fedbcfab392d9b77822f6ffa7facdec693aded214523bc"]'
,
'(vm): from:0xca3...a733c, to:0x692...77b3a, browser/Untitled.sol:TestContract.f(), value:0 wei, data:0x261...21ff0, 0 logs, hash:0xa17...523bc,DetailsDebug'
)
.
end
()
/*
@TODO: need to check now the return value of the function
...
...
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