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
07ec8432
Commit
07ec8432
authored
Oct 08, 2017
by
serapath
Committed by
yann300
Dec 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ADD modal popup to execute transactions
parent
7974b685
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
13 deletions
+26
-13
run-tab.js
src/app/tabs/run-tab.js
+20
-10
modal-dialog-custom.js
src/app/ui/modal-dialog-custom.js
+6
-3
No files found.
src/app/tabs/run-tab.js
View file @
07ec8432
...
...
@@ -278,18 +278,28 @@ function makeRecorder (appAPI, appEvents) {
copy
(
txJSON
)
modalDialogCustom
.
alert
(
txJSON
)
}
runButton
.
onclick
=
()
=>
{
// on modal OR run tab
var
txArray
=
recorder
.
getAll
()
udapp
.
runTx
(
txArray
,
CALLBACK
)
// ???
// OR
// txArray.forEach(tx => udapp.runTx(tx, CALLBACK)) // ???
runButton
.
onclick
=
()
=>
{
var
opts
=
{
title
:
`Enter Transactions`
,
text
:
`Paste the array of transaction you want to replay here`
,
inputValue
:
''
,
multiline
:
true
}
modalDialogCustom
.
prompt
(
opts
,
function
confirm
(
json
=
'[]'
)
{
try
{
var
txArray
=
JSON
.
parse
(
json
)
}
catch
(
e
)
{
modalDialogCustom
.
alert
(
'Invalid JSON, please try again'
)
}
if
(
txArray
.
length
)
{
txArray
.
forEach
(
tx
=>
udapp
.
runTx
(
tx
,
CALLBACK
))
}
},
function
cancel
()
{
})
}
function
CALLBACK
()
{
function
CALLBACK
(...
args
)
{
console
.
log
(
args
)
/*
at each callback call, if the transaction succeed and if this is a creation transaction, we should call
runtab.addInstance( ... ) which basically do:
instanceContainer.appendChild(appAPI.udapp().renderInstance(contract, address,
selectContractNames.value))
at each callback call, if the transaction succeed and if this is a creation transaction,
we should call
runtab.addInstance( ... ) // which basically do:
instanceContainer.appendChild(appAPI.udapp().renderInstance(contract, address, selectContractNames.value))
*/
}
return
el
...
...
src/app/ui/modal-dialog-custom.js
View file @
07ec8432
...
...
@@ -11,10 +11,13 @@ module.exports = {
alert
:
function
(
text
)
{
modal
(
''
,
yo
`<div>
${
text
}
</div>`
,
null
,
{
label
:
null
})
},
prompt
:
function
(
title
,
text
,
inputValue
,
ok
,
cancel
)
{
prompt
:
function
(
{
title
,
text
,
inputValue
,
multiline
}
,
ok
,
cancel
)
{
if
(
!
inputValue
)
inputValue
=
''
modal
(
title
,
yo
`<div>
${
text
}
<div><input type='text' name='prompt_text' id='prompt_text' class="
${
css
[
'prompt_text'
]}
" value='
${
inputValue
}
' ></div></div>`
,
var
input
=
multiline
?
yo
`<textarea id="prompt_text" class=
${
css
.
prompt_text
}
rows="4" cols="50"></textarea>`
:
yo
`<input type='text' name='prompt_text' id='prompt_text' class="
${
css
[
'prompt_text'
]}
" value='
${
inputValue
}
' >`
modal
(
title
,
yo
`<div>
${
text
}
<div>
${
input
}
</div></div>`
,
{
fn
:
()
=>
{
if
(
typeof
ok
===
'function'
)
ok
(
document
.
getElementById
(
'prompt_text'
).
value
)
}
},
...
...
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