@ -177,6 +177,13 @@ var css = csjs`
. networkItem {
. networkItem {
margin - right : 5 px ;
margin - right : 5 px ;
}
}
. clearinstance {
font - size : 20 px ;
cursor : pointer ;
margin - right : 10 px ;
}
. transactionActions {
float : right ;
`
`
module . exports = runTab
module . exports = runTab
@ -184,13 +191,26 @@ module.exports = runTab
var instanceContainer = yo ` <div class=" ${ css . instanceContainer } "></div> `
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 pendingTxsText = yo ` <span></span > `
function runTab ( container , appAPI , appEvents , opts ) {
function runTab ( container , appAPI , appEvents , opts ) {
var events = new EventManager ( )
var events = new EventManager ( )
var clearInstanceElement = yo ` <i class="fa fa-minus-square-o ${ css . clearinstance } " title="Clear Instances List" aria-hidden="true"></i> `
clearInstanceElement . addEventListener ( 'click' , ( ) => {
events . trigger ( 'clearInstance' , [ ] )
} )
var recorderInterface = makeRecorder ( events , appAPI , appEvents )
var pendingTxsContainer = yo `
var pendingTxsContainer = yo `
< div class = "${css.pendingTxsContainer}" >
< div class = "${css.pendingTxsContainer}" >
< div class = "${css.pendingTxsText}" >
$ { pendingTxsText }
$ { pendingTxsText }
< span class = "${css.transactionActions}" >
$ { clearInstanceElement }
$ { recorderInterface . recordButton }
$ { recorderInterface . runButton }
< / s p a n >
< / d i v >
< / d i v > `
< / d i v > `
var el = yo `
var el = yo `
@ -216,7 +236,7 @@ function runTab (container, appAPI, appEvents, opts) {
// set the final context. Cause it is possible that this is not the one we've originaly selected
// set the final context. Cause it is possible that this is not the one we've originaly selected
selectExEnv . value = executionContext . getProvider ( )
selectExEnv . value = executionContext . getProvider ( )
fillAccountsList ( appAPI , el )
fillAccountsList ( appAPI , el )
clearInstance ( )
events . trigger ( 'clearInstance' , [ ] )
} )
} )
} )
} )
selectExEnv . value = executionContext . getProvider ( )
selectExEnv . value = executionContext . getProvider ( )
@ -226,12 +246,11 @@ function runTab (container, appAPI, appEvents, opts) {
updatePendingTxs ( container , appAPI )
updatePendingTxs ( container , appAPI )
} , 500 )
} , 500 )
var clearInstance = function ( ) {
events . register ( 'clearInstance' , ( ) => {
instanceContainer . innerHTML = '' // clear the instances list
instanceContainer . innerHTML = '' // clear the instances list
noInstancesText . style . display = 'block'
noInstancesText . style . display = 'block'
instanceContainer . appendChild ( noInstancesText )
instanceContainer . appendChild ( noInstancesText )
events . trigger ( 'clearInstance' , [ ] )
} )
}
}
}
function fillAccountsList ( appAPI , container ) {
function fillAccountsList ( appAPI , container ) {
@ -275,29 +294,21 @@ function makeRecorder (events, appAPI, appEvents) {
} )
} )
var css2 = csjs `
var css2 = csjs `
. container {
. container {
margin : 10 px ;
display : flex ;
justify - content : space - evenly ;
width : 100 % ;
}
}
. recorder {
. recorder {
$ { styles . button }
font - size : 20 px ;
width : 135 px ;
cursor : pointer ;
}
}
. runTxs {
. runTxs {
$ { styles . button }
margin - left : 10 px ;
margin - left : 10 px ;
width : 135 px ;
font - size : 20 px ;
cursor : pointer ;
}
}
`
`
var recordButton = yo ` <button class=" ${ css . transaction } savetransaction">save transactions</button> `
var runButton = yo ` <button class=" ${ css . transaction } runtransaction">run transactions</button> `
var recordButton = yo ` <i class="fa fa-floppy-o savetransaction ${ css2 . recorder } " title="Save Transactions" aria-hidden="true"></i> `
var el = yo `
var runButton = yo ` <i class="fa fa-play runtransaction ${ css2 . runTxs } " title="Run Transactions" aria-hidden="true"></i> `
< div class = $ { css2 . container } >
$ { recordButton }
$ { runButton }
< / d i v >
`
recordButton . onclick = ( ) => {
recordButton . onclick = ( ) => {
var txJSON = JSON . stringify ( recorder . getAll ( ) , null , 2 )
var txJSON = JSON . stringify ( recorder . getAll ( ) , null , 2 )
var path = appAPI . currentPath ( )
var path = appAPI . currentPath ( )
@ -335,10 +346,10 @@ function makeRecorder (events, appAPI, appEvents) {
} )
} )
}
}
} else {
} else {
modalDialogCustom . alert ( 'Scenario File require JSON type ' )
modalDialogCustom . alert ( 'A Scenario File is required. The file must be of type JSON. Use the "Save Transactions" Button to generate a new Scenario File. ' )
}
}
}
}
return el
return { r ecordButton , runButton }
}
}
/ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
section CONTRACT DROPDOWN and BUTTONS
section CONTRACT DROPDOWN and BUTTONS
@ -371,6 +382,7 @@ function contractDropdown (events, appAPI, appEvents, instanceContainer) {
return null
return null
}
}
appAPI . getSelectedContract = getSelectedContract
appAPI . getSelectedContract = getSelectedContract
var el = yo `
var el = yo `
< div class = "${css.container}" >
< div class = "${css.container}" >
< div class = "${css.subcontainer}" >
< div class = "${css.subcontainer}" >
@ -385,7 +397,6 @@ function contractDropdown (events, appAPI, appEvents, instanceContainer) {
$ { atAddressButtonInput }
$ { atAddressButtonInput }
< div class = "${css.atAddress}" onclick = $ { function ( ) { loadFromAddress ( appAPI ) } } > At Address < / d i v >
< div class = "${css.atAddress}" onclick = $ { function ( ) { loadFromAddress ( appAPI ) } } > At Address < / d i v >
< / d i v >
< / d i v >
< div class = $ { css . buttons } > $ { makeRecorder ( events , appAPI , appEvents ) } < / d i v >
< / d i v >
< / d i v >
< / d i v >
< / d i v >
`
`