From 68d6f236eb56de4d0fd59a30cd0f05a60def45ac Mon Sep 17 00:00:00 2001 From: ninabreznik Date: Fri, 1 Sep 2017 04:46:23 +0100 Subject: [PATCH] First draft --- src/app/execution/txLogger.js | 127 ++++++++++++++++++++++++++++++++-- 1 file changed, 121 insertions(+), 6 deletions(-) diff --git a/src/app/execution/txLogger.js b/src/app/execution/txLogger.js index bc5b0d0468..ddb28cef9c 100644 --- a/src/app/execution/txLogger.js +++ b/src/app/execution/txLogger.js @@ -1,12 +1,59 @@ 'use strict' var yo = require('yo-yo') + +// -------------- styling ---------------------- +var csjs = require('csjs-inject') var remix = require('ethereum-remix') +var styleGuide = remix.ui.styleGuide +var styles = styleGuide() + var EventManager = remix.lib.EventManager var helper = require('../../lib/helper') var ethJSUtil = require('ethereumjs-util') var BN = ethJSUtil.BN var executionContext = require('../../execution-context') +var css = csjs` + .log { + display: flex; + align-items: baseline; + } + .txTable, .tr, .td { + border: 1px solid black; + border-collapse: collapse; + font-size: 10px; + color: grey; + } + .txTable { + width: 35%; + } + #txTable { + width: 200px; + margin-left: 20px; + align-self: center; + } + .tr, .td { + padding: 3px; + } + .buttons { + display: flex; + } + .debug, .details { + ${styles.button} + min-height: 18px; + max-height: 18px; + width: 45px; + min-width: 45px; + font-size: 10px; + margin-left: 5px; + } + .debug { + background-color: ${styles.colors.lightOrange}; + } + .details { + background-color: ${styles.colors.lightGrey}; + } +` /** * This just export a function that register to `newTransaction` and forward them to the logger. * Emit debugRequested @@ -64,10 +111,44 @@ function renderKnownTransaction (self, data) { function debug () { self.event.trigger('debugRequested', [data.tx.hash]) } - function detail () { - // @TODO here should open a modal containing some info (e.g input params, logs, ...) + var tx = yo` + + ${context(self, data.tx)}, ${data.resolvedData.contractName}.${data.resolvedData.fn}, ${data.logs.length} logs +
+ + +
+
+ ` + function detail (e, container) { + var el = container + var table = yo` + + + + + + + + + + + + + + + + + + + + + +
from${helper.shortenAddress(data.tx.from)}
to:${to}
value:${value(data.tx.value)} wei
data:${helper.shortenHexData(data.tx.input)}
hash:${helper.shortenHexData((data.tx.hash))}
+ ` + el.appendChild(table) } - return yo`${context(self, data.tx)}: from:${helper.shortenAddress(data.tx.from)}, to:${to}, ${data.resolvedData.contractName}.${data.resolvedData.fn}, value:${value(data.tx.value)} wei, data:${helper.shortenHexData(data.tx.input)}, ${data.logs.length} logs, hash:${helper.shortenHexData((data.tx.hash))}, ` + return tx } function renderUnknownTransaction (self, data) { @@ -76,10 +157,44 @@ function renderUnknownTransaction (self, data) { function debug () { self.event.trigger('debugRequested', [data.tx.hash]) } - function detail () { - // @TODO here should open a modal containing some info (e.g input params, logs, ...) + var tx = yo` + + ${context(self, data.tx)} +
+ + +
+
+ ` + function detail (e, container) { + var el = container + var table = yo` + + + + + + + + + + + + + + + + + + + + + +
from${helper.shortenAddress(data.tx.from)}
to:${to}
value:${value(data.tx.value)} wei
data:${helper.shortenHexData(data.tx.input)}
hash:${helper.shortenHexData((data.tx.hash))}
+ ` + el.appendChild(table) } - return yo`${context(self, data.tx)}: from:${helper.shortenAddress(data.tx.from)}, to:${to}, value:${value(data.tx.value)} wei, data:${helper.shortenHexData((data.tx.input))}, hash:${helper.shortenHexData((data.tx.hash))}, ` + return tx } function renderEmptyBlock (self, data) {