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
dfdde07d
Commit
dfdde07d
authored
Oct 28, 2017
by
serapath
Committed by
yann300
Dec 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ADD .addInstance after rerunTx
parent
eebccbd4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
25 deletions
+36
-25
run-tab.js
src/app/tabs/run-tab.js
+34
-23
modal-dialog-custom.js
src/app/ui/modal-dialog-custom.js
+1
-1
universal-dapp.js
src/universal-dapp.js
+1
-1
No files found.
src/app/tabs/run-tab.js
View file @
dfdde07d
...
@@ -177,19 +177,42 @@ var pendingTxsText = yo`<div class="${css.pendingTxsText}"></div>`
...
@@ -177,19 +177,42 @@ var pendingTxsText = yo`<div class="${css.pendingTxsText}"></div>`
var
pendingTxsContainer
=
yo
`<div class="
${
css
.
pendingTxsContainer
}
">
${
pendingTxsText
}
</div>`
var
pendingTxsContainer
=
yo
`<div class="
${
css
.
pendingTxsContainer
}
">
${
pendingTxsText
}
</div>`
function
runTab
(
container
,
appAPI
,
appEvents
,
opts
)
{
function
runTab
(
container
,
appAPI
,
appEvents
,
opts
)
{
var
self
=
{
_view
:
{},
addInstance
:
addInstance
}
var
udapp
=
appAPI
.
udapp
()
var
el
=
yo
`
var
el
=
yo
`
<div class="
${
css
.
runTabView
}
" id="runTabView">
<div class="
${
css
.
runTabView
}
" id="runTabView">
${
settings
(
appAPI
,
appEvents
)}
${
settings
(
self
,
appAPI
,
appEvents
)}
${
contractDropdown
(
appAPI
,
appEvents
,
instanceContainer
)}
${
contractDropdown
(
self
,
appAPI
,
appEvents
,
instanceContainer
)}
${
pendingTxsContainer
}
${
pendingTxsContainer
}
${
instanceContainer
}
${
instanceContainer
}
</div>
</div>
`
`
container
.
appendChild
(
el
)
container
.
appendChild
(
el
)
function
addInstance
(
result
)
{
// {
// "result": {
// "gasUsed": "5318",
// "vm": { "exception": 1, "selfdestruct": {} },
// "bloom": { "bitvector": { "type": "Buffer", "data": [0, /* ... */ 0, 0] } },
// "amountSpent": "5318"
// },
// "transactionHash": "0x84f68f96944a47b27af4b4ed1986637aa1bc05fd7a6f5cb1d6a53f68058276d8"
// }
console
.
log
(
result
)
var
contractNames
=
document
.
querySelector
(
`.
${
css
.
contractNames
.
classNames
[
0
]}
`
)
var
contract
=
appAPI
.
getContracts
()[
contractNames
.
children
[
contractNames
.
selectedIndex
].
innerHTML
]
var
address
=
self
.
_view
.
atAddressButtonInput
.
value
var
instance
=
udapp
.
renderInstance
(
contract
,
address
,
self
.
_view
.
selectContractNames
.
value
)
instanceContainer
.
appendChild
(
instance
)
}
// PENDING transactions
// PENDING transactions
function
updatePendingTxs
(
container
,
appAPI
)
{
function
updatePendingTxs
(
container
,
appAPI
)
{
var
pendingCount
=
Object
.
keys
(
appAPI
.
udapp
()
.
pendingTransactions
()).
length
var
pendingCount
=
Object
.
keys
(
udapp
.
pendingTransactions
()).
length
pendingTxsText
.
innerText
=
pendingCount
+
' pending transactions'
pendingTxsText
.
innerText
=
pendingCount
+
' pending transactions'
}
}
...
@@ -244,7 +267,7 @@ function updateAccountBalances (container, appAPI) {
...
@@ -244,7 +267,7 @@ function updateAccountBalances (container, appAPI) {
/* ------------------------------------------------
/* ------------------------------------------------
RECORDER
RECORDER
------------------------------------------------ */
------------------------------------------------ */
function
makeRecorder
(
appAPI
,
appEvents
)
{
function
makeRecorder
(
self
,
appAPI
,
appEvents
)
{
var
udapp
=
appAPI
.
udapp
()
var
udapp
=
appAPI
.
udapp
()
var
recorder
=
new
Recorder
({
var
recorder
=
new
Recorder
({
events
:
{
events
:
{
...
@@ -292,29 +315,15 @@ function makeRecorder (appAPI, appEvents) {
...
@@ -292,29 +315,15 @@ function makeRecorder (appAPI, appEvents) {
modalDialogCustom
.
alert
(
'Invalid JSON, please try again'
)
modalDialogCustom
.
alert
(
'Invalid JSON, please try again'
)
}
}
if
(
txArray
.
length
)
{
if
(
txArray
.
length
)
{
txArray
.
forEach
(
tx
=>
udapp
.
re
play
Tx
(
tx
.
record
,
CALLBACK
))
txArray
.
forEach
(
tx
=>
udapp
.
re
run
Tx
(
tx
.
record
,
CALLBACK
))
}
}
},
function
cancel
()
{
})
},
function
cancel
()
{
})
}
}
function
CALLBACK
(
err
,
result
)
{
function
CALLBACK
(
err
,
result
)
{
if
(
err
)
console
.
error
(
err
)
if
(
err
)
console
.
error
(
err
)
else
{
else
{
console
.
log
(
result
)
// at each callback call, if the transaction succeed and if this is a creation transaction, we should call
// {
self
.
addInstance
(
result
)
// "result": {
// "gasUsed": "5318",
// "vm": { "exception": 1, "selfdestruct": {} },
// "bloom": { "bitvector": { "type": "Buffer", "data": [0, /* ... */ 0, 0] } },
// "amountSpent": "5318"
// },
// "transactionHash": "0x84f68f96944a47b27af4b4ed1986637aa1bc05fd7a6f5cb1d6a53f68058276d8"
// }
/*
at each callback call, if the transaction succeed and if this is a creation transaction, we should call
runtab.addInstance( ... ) // which basically does:
instanceContainer.appendChild(appAPI.udapp().renderInstance(contract, address, selectContractNames.value))
*/
}
}
}
}
return
el
return
el
...
@@ -323,7 +332,7 @@ function makeRecorder (appAPI, appEvents) {
...
@@ -323,7 +332,7 @@ function makeRecorder (appAPI, appEvents) {
section CONTRACT DROPDOWN and BUTTONS
section CONTRACT DROPDOWN and BUTTONS
------------------------------------------------ */
------------------------------------------------ */
function
contractDropdown
(
appAPI
,
appEvents
,
instanceContainer
)
{
function
contractDropdown
(
self
,
appAPI
,
appEvents
,
instanceContainer
)
{
instanceContainer
.
appendChild
(
noInstancesText
)
instanceContainer
.
appendChild
(
noInstancesText
)
var
compFails
=
yo
`<i title="Contract compilation failed. Please check the compile tab for more information." class="fa fa-thumbs-down
${
css
.
errorIcon
}
" ></i>`
var
compFails
=
yo
`<i title="Contract compilation failed. Please check the compile tab for more information." class="fa fa-thumbs-down
${
css
.
errorIcon
}
" ></i>`
appEvents
.
compiler
.
register
(
'compilationFinished'
,
function
(
success
,
data
,
source
)
{
appEvents
.
compiler
.
register
(
'compilationFinished'
,
function
(
success
,
data
,
source
)
{
...
@@ -338,6 +347,8 @@ function contractDropdown (appAPI, appEvents, instanceContainer) {
...
@@ -338,6 +347,8 @@ function contractDropdown (appAPI, appEvents, instanceContainer) {
var
atAddressButtonInput
=
yo
`<input class="
${
css
.
input
}
ataddressinput" placeholder="Load contract from Address" title="atAddress" />`
var
atAddressButtonInput
=
yo
`<input class="
${
css
.
input
}
ataddressinput" placeholder="Load contract from Address" title="atAddress" />`
var
createButtonInput
=
yo
`<input class="
${
css
.
input
}
" placeholder="" title="Create" />`
var
createButtonInput
=
yo
`<input class="
${
css
.
input
}
" placeholder="" title="Create" />`
var
selectContractNames
=
yo
`<select class="
${
css
.
contractNames
}
" disabled></select>`
var
selectContractNames
=
yo
`<select class="
${
css
.
contractNames
}
" disabled></select>`
self
.
_view
.
atAddressButtonInput
=
atAddressButtonInput
self
.
_view
.
selectContractNames
=
selectContractNames
var
el
=
yo
`
var
el
=
yo
`
<div class="
${
css
.
container
}
">
<div class="
${
css
.
container
}
">
<div class="
${
css
.
subcontainer
}
">
<div class="
${
css
.
subcontainer
}
">
...
@@ -509,7 +520,7 @@ function settings (appAPI, appEvents) {
...
@@ -509,7 +520,7 @@ function settings (appAPI, appEvents) {
</select>
</select>
</div>
</div>
<div class=
${
css
.
buttons
}
>
<div class=
${
css
.
buttons
}
>
${
makeRecorder
(
appAPI
,
appEvents
)}
${
makeRecorder
(
self
,
appAPI
,
appEvents
)}
</div>
</div>
</div>
</div>
`
`
...
...
src/app/ui/modal-dialog-custom.js
View file @
dfdde07d
...
@@ -25,7 +25,7 @@ module.exports = {
...
@@ -25,7 +25,7 @@ module.exports = {
},
},
promptMulti
:
function
({
title
,
text
,
inputValue
},
ok
,
cancel
)
{
promptMulti
:
function
({
title
,
text
,
inputValue
},
ok
,
cancel
)
{
if
(
!
inputValue
)
inputValue
=
''
if
(
!
inputValue
)
inputValue
=
''
var
input
=
yo
`<textarea id="prompt_text" class=
${
css
.
prompt_text
}
rows="4" cols="50"></textarea>`
var
input
=
yo
`<textarea id="prompt_text" class=
${
css
.
prompt_text
}
rows="4" cols="50"></textarea>`
modal
(
title
,
yo
`<div>
${
text
}
<div>
${
input
}
</div></div>`
,
modal
(
title
,
yo
`<div>
${
text
}
<div>
${
input
}
</div></div>`
,
{
{
fn
:
()
=>
{
if
(
typeof
ok
===
'function'
)
ok
(
document
.
getElementById
(
'prompt_text'
).
value
)
}
fn
:
()
=>
{
if
(
typeof
ok
===
'function'
)
ok
(
document
.
getElementById
(
'prompt_text'
).
value
)
}
...
...
src/universal-dapp.js
View file @
dfdde07d
...
@@ -467,7 +467,7 @@ function execute (pipeline, env, callback) {
...
@@ -467,7 +467,7 @@ function execute (pipeline, env, callback) {
next
(
null
,
env
)
next
(
null
,
env
)
}
}
UniversalDApp
.
prototype
.
re
play
Tx
=
function
(
args
,
cb
)
{
UniversalDApp
.
prototype
.
re
run
Tx
=
function
(
args
,
cb
)
{
var
self
=
this
var
self
=
this
self
.
getAccounts
(
function
(
err
,
accounts
=
[])
{
self
.
getAccounts
(
function
(
err
,
accounts
=
[])
{
if
(
err
)
console
.
error
(
err
)
if
(
err
)
console
.
error
(
err
)
...
...
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