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
20ec1cc2
Commit
20ec1cc2
authored
Nov 23, 2017
by
serapath
Committed by
yann300
Dec 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ADD replay tx from file
parent
a11b616e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
26 deletions
+33
-26
app.js
src/app.js
+3
-0
run-tab.js
src/app/tabs/run-tab.js
+30
-26
No files found.
src/app.js
View file @
20ec1cc2
...
@@ -556,6 +556,9 @@ function run () {
...
@@ -556,6 +556,9 @@ function run () {
udapp
:
()
=>
{
udapp
:
()
=>
{
return
udapp
return
udapp
},
},
switchFile
:
function
(
path
)
{
fileManager
.
switchFile
(
path
)
},
filesProviders
:
filesProviders
,
filesProviders
:
filesProviders
,
fileProviderOf
:
(
path
)
=>
{
fileProviderOf
:
(
path
)
=>
{
return
fileManager
.
fileProviderOf
(
path
)
return
fileManager
.
fileProviderOf
(
path
)
...
...
src/app/tabs/run-tab.js
View file @
20ec1cc2
...
@@ -90,19 +90,15 @@ var css = csjs`
...
@@ -90,19 +90,15 @@ var css = csjs`
flex-direction: row;
flex-direction: row;
align-items: baseline;
align-items: baseline;
}
}
.buttons {
display: flex;
cursor: pointer;
justify-content: center;
flex-direction: column;
text-align: center;
font-size: 12px;
}
.button {
.button {
display: flex;
display: flex;
align-items: center;
align-items: center;
margin-top: 2%;
margin-top: 2%;
}
}
.transaction {
${
styles
.
rightPanel
.
runTab
.
button_transaction
}
}
.atAddress {
.atAddress {
${
styles
.
rightPanel
.
runTab
.
button_atAddress
}
${
styles
.
rightPanel
.
runTab
.
button_atAddress
}
}
}
...
@@ -170,18 +166,25 @@ var css = csjs`
...
@@ -170,18 +166,25 @@ var css = csjs`
module
.
exports
=
runTab
module
.
exports
=
runTab
var
instanceContainer
=
yo
`<div class="
${
css
.
instanceContainer
}
"></div>`
var
noInstancesText
=
yo
`<div class="
${
css
.
noInstancesText
}
">0 contract Instances</div>`
var
noInstancesText
=
yo
`<div class="
${
css
.
noInstancesText
}
">0 contract Instances</div>`
var
pendingTxsText
=
yo
`<div class="
${
css
.
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
=
{
var
self
=
{
_view
:
{},
_view
:
{},
addInstance
:
addInstance
addInstance
:
addInstance
}
}
var
udapp
=
appAPI
.
udapp
()
var
udapp
=
appAPI
.
udapp
()
var
instanceContainer
=
yo
`<div class="
${
css
.
instanceContainer
}
"></div>`
var
pendingTxsText
=
yo
`<div class="
${
css
.
pendingTxsText
}
"></div>`
var
pendingTxsContainer
=
yo
`
<div class="
${
css
.
pendingTxsContainer
}
">
<div class=
${
css
.
buttons
}
>
${
makeRecorder
(
self
,
appAPI
,
appEvents
)}
</div>
${
pendingTxsText
}
</div>
`
var
el
=
yo
`
var
el
=
yo
`
<div class="
${
css
.
runTabView
}
" id="runTabView">
<div class="
${
css
.
runTabView
}
" id="runTabView">
${
settings
(
self
,
appAPI
,
appEvents
)}
${
settings
(
self
,
appAPI
,
appEvents
)}
...
@@ -278,10 +281,12 @@ function makeRecorder (self, appAPI, appEvents) {
...
@@ -278,10 +281,12 @@ function makeRecorder (self, appAPI, appEvents) {
getAccounts
(
cb
)
{
udapp
.
getAccounts
(
cb
)
}
getAccounts
(
cb
)
{
udapp
.
getAccounts
(
cb
)
}
}
}
})
})
var
css
=
csjs
`
var
css
2
=
csjs
`
.container {
.container {
margin
-top
: 10px;
margin: 10px;
display: flex;
display: flex;
justify-content: space-evenly;
width: 100%;
}
}
.recorder {
.recorder {
${
styles
.
button
}
${
styles
.
button
}
...
@@ -293,19 +298,19 @@ function makeRecorder (self, appAPI, appEvents) {
...
@@ -293,19 +298,19 @@ function makeRecorder (self, appAPI, appEvents) {
width: 135px;
width: 135px;
}
}
`
`
var
recordButton
=
yo
`<button class=
${
css
.
recorder
}
>copy ran
transactions</button>`
var
recordButton
=
yo
`<button class=
${
css
.
transaction
}
>save
transactions</button>`
var
runButton
=
yo
`<button class=
${
css
.
runTxs
}
>re-
run transactions</button>`
var
runButton
=
yo
`<button class=
${
css
.
transaction
}
>
run transactions</button>`
var
el
=
yo
`
var
el
=
yo
`
<div class=
${
css
.
container
}
>
<div class=
${
css
2
.
container
}
>
${
recordButton
}
${
recordButton
}
${
runButton
}
${
runButton
}
</div>
</div>
`
`
recordButton
.
onclick
=
()
=>
{
recordButton
.
onclick
=
()
=>
{
var
txJSON
=
JSON
.
stringify
(
recorder
.
getAll
(),
null
,
2
)
var
txJSON
=
JSON
.
stringify
(
recorder
.
getAll
(),
null
,
2
)
modalDialogCustom
.
prompt
(
null
,
'
journal file name
'
,
'scenario.json'
,
input
=>
{
modalDialogCustom
.
prompt
(
null
,
'
save ran transactions to file (e.g. `scenario.json`)
'
,
'scenario.json'
,
input
=>
{
var
newName
=
appAPI
.
filesProvider
[
'browser'
].
type
+
'/'
+
helper
.
createNonClashingName
(
input
,
appAPI
.
filesProvider
[
'browser'
]
)
var
newName
=
appAPI
.
filesProvider
s
[
'browser'
].
type
+
'/'
+
helper
.
createNonClashingName
(
input
,
appAPI
.
filesProviders
[
'browser'
],
'.json'
)
if
(
!
appAPI
.
filesProvider
[
'browser'
].
set
(
newName
,
txJSON
))
{
if
(
!
appAPI
.
filesProvider
s
[
'browser'
].
set
(
newName
,
txJSON
))
{
modalDialogCustom
.
alert
(
'Failed to create file '
+
newName
)
modalDialogCustom
.
alert
(
'Failed to create file '
+
newName
)
}
else
{
}
else
{
appAPI
.
switchFile
(
newName
)
appAPI
.
switchFile
(
newName
)
...
@@ -313,8 +318,10 @@ function makeRecorder (self, appAPI, appEvents) {
...
@@ -313,8 +318,10 @@ function makeRecorder (self, appAPI, appEvents) {
})
})
}
}
runButton
.
onclick
=
()
=>
{
runButton
.
onclick
=
()
=>
{
var
opts
=
{
title
:
`Enter Transactions`
,
text
:
`Paste the array of transaction you want to replay here`
,
inputValue
:
''
,
multiline
:
true
}
modalDialogCustom
.
prompt
(
null
,
'load from file (e.g. `scenarios/transactions1.json`)'
,
''
,
filepath
=>
{
modalDialogCustom
.
promptMulti
(
opts
,
function
confirm
(
json
=
'[]'
)
{
var
filename
=
appAPI
.
filesProviders
[
'browser'
].
type
+
'/'
+
filepath
var
json
=
appAPI
.
filesProviders
[
'browser'
].
get
(
filename
)
if
(
!
json
)
return
modalDialogCustom
.
alert
(
'Could not find file with transactions, please try again'
)
try
{
try
{
var
txArray
=
JSON
.
parse
(
json
)
var
txArray
=
JSON
.
parse
(
json
)
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -329,7 +336,7 @@ function makeRecorder (self, appAPI, appEvents) {
...
@@ -329,7 +336,7 @@ function makeRecorder (self, appAPI, appEvents) {
})
})
})
})
}
}
}
,
function
cancel
()
{
}
)
})
}
}
function
CALLBACK
(
err
,
result
)
{
function
CALLBACK
(
err
,
result
)
{
if
(
err
)
console
.
error
(
err
)
if
(
err
)
console
.
error
(
err
)
...
@@ -531,9 +538,6 @@ function settings (appAPI, appEvents) {
...
@@ -531,9 +538,6 @@ function settings (appAPI, appEvents) {
<option data-unit="ether">ether</option>
<option data-unit="ether">ether</option>
</select>
</select>
</div>
</div>
<div class=
${
css
.
buttons
}
>
${
makeRecorder
(
self
,
appAPI
,
appEvents
)}
</div>
</div>
</div>
`
`
...
...
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