Fixing a recorder

pull/1/head
ninabreznik 7 years ago committed by yann300
parent 64383e17a0
commit 875a498867
  1. 15
      src/app/tabs/run-tab.js
  2. 3
      src/universal-dapp-styles.js

@ -24,13 +24,14 @@ function runTab (appAPI = {}, appEvents = {}, opts = {}) {
--------------------------- */ --------------------------- */
var self = this var self = this
var event = new EventManager() var event = new EventManager()
appEvents.eventManager = event
self._view = {} self._view = {}
self.data = { self.data = {
count: 0, count: 0,
text: `All transactions (deployed contracts and function executions) text: `All transactions (deployed contracts and function executions)
in this environment can be saved and replayed in in this environment can be saved and replayed in
another environment. i.e. Transactions created in another environment. i.e. Transactions created in
Javascript VM can be replayed in the Ropsten network.` Javascript VM can be replayed in the Injected Web3.`
} }
self._view.recorderCount = yo`<span>0</span>` self._view.recorderCount = yo`<span>0</span>`
@ -51,7 +52,7 @@ function runTab (appAPI = {}, appEvents = {}, opts = {}) {
</div>` </div>`
var container = yo`<div class="${css.runTabView}" id="runTabView" ></div>` var container = yo`<div class="${css.runTabView}" id="runTabView" ></div>`
var recorderInterface = makeRecorder(event, appAPI, appEvents, opts, self) var recorderInterface = makeRecorder(appAPI, appEvents, opts, self)
self._view.collapsedView = yo` self._view.collapsedView = yo`
<div class=${css.recorderCollapsedView}> <div class=${css.recorderCollapsedView}>
@ -186,12 +187,12 @@ function updateAccountBalances (container, appAPI) {
/* ------------------------------------------------ /* ------------------------------------------------
RECORDER RECORDER
------------------------------------------------ */ ------------------------------------------------ */
function makeRecorder (events, appAPI, appEvents, opts, self) { function makeRecorder (appAPI, appEvents, opts, self) {
var recorder = new Recorder(opts.compiler, { var recorder = new Recorder(opts.compiler, {
events: { events: {
udapp: appEvents.udapp, udapp: appEvents.udapp,
executioncontext: executionContext.event, executioncontext: executionContext.event,
runtab: events runtab: appEvents.eventManager
}, },
api: appAPI api: appAPI
}) })
@ -241,8 +242,8 @@ function makeRecorder (events, appAPI, appEvents, opts, self) {
var obj = JSON.parse(json) var obj = JSON.parse(json)
var txArray = obj.transactions || [] var txArray = obj.transactions || []
var accounts = obj.accounts || [] var accounts = obj.accounts || []
var options = obj.options var options = obj.options || {}
var abis = obj.abis var abis = obj.abis || {}
var linkReferences = obj.linkReferences || {} var linkReferences = obj.linkReferences || {}
} catch (e) { } catch (e) {
return modalDialogCustom.alert('Invalid Scenario File, please try again') return modalDialogCustom.alert('Invalid Scenario File, please try again')
@ -250,7 +251,7 @@ function makeRecorder (events, appAPI, appEvents, opts, self) {
if (txArray.length) { if (txArray.length) {
var noInstancesText = self._view.noInstancesText var noInstancesText = self._view.noInstancesText
if (noInstancesText.parentNode) { noInstancesText.parentNode.removeChild(noInstancesText) } if (noInstancesText.parentNode) { noInstancesText.parentNode.removeChild(noInstancesText) }
recorder.run(txArray, accounts, options, abis, linkReferences, (abi, address, contractName) => { recorder.run(txArray, accounts, options, abis, linkReferences, opts.udapp, (abi, address, contractName) => {
self._view.instanceContainer.appendChild(opts.udappUI.renderInstanceFromABI(abi, address, contractName)) self._view.instanceContainer.appendChild(opts.udappUI.renderInstanceFromABI(abi, address, contractName))
}) })
} }

@ -22,7 +22,7 @@ var css = csjs`
margin-bottom: 10px; margin-bottom: 10px;
} }
.noInstancesText { .noInstancesText {
} }
.titleLine { .titleLine {
display: flex; display: flex;
@ -84,6 +84,7 @@ var css = csjs`
cursor: pointer; cursor: pointer;
margin-left: 5px; margin-left: 5px;
} }
.udapp {}
.udappClose { .udappClose {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;

Loading…
Cancel
Save