renaming formatData / formatSelf

pull/7/head
yann300 8 years ago
parent 404815b9da
commit 0f60ad47b6
  1. 2
      src/ui/SolidityLocals.js
  2. 2
      src/ui/SolidityState.js
  3. 4
      src/ui/SolidityTypeFormatter.js
  4. 10
      src/ui/TreeView.js

@ -12,7 +12,7 @@ class SolidityLocals {
this.traceManager = _traceManager this.traceManager = _traceManager
this.basicPanel = new DropdownPanel('Solidity Locals', { this.basicPanel = new DropdownPanel('Solidity Locals', {
json: true, json: true,
formatData: solidityTypeFormatter.formatData, formatSelf: solidityTypeFormatter.formatSelf,
extractData: solidityTypeFormatter.extractData extractData: solidityTypeFormatter.extractData
}) })
this.init() this.init()

@ -11,7 +11,7 @@ function SolidityState (_parent, _traceManager, _codeManager, _solidityProxy) {
this.solidityProxy = _solidityProxy this.solidityProxy = _solidityProxy
this.basicPanel = new DropdownPanel('Solidity State', { this.basicPanel = new DropdownPanel('Solidity State', {
json: true, json: true,
formatData: solidityTypeFormatter.formatData, formatSelf: solidityTypeFormatter.formatSelf,
extractData: solidityTypeFormatter.extractData extractData: solidityTypeFormatter.extractData
}) })
this.init() this.init()

@ -3,11 +3,11 @@ var yo = require('yo-yo')
var BN = require('ethereumjs-util').BN var BN = require('ethereumjs-util').BN
module.exports = { module.exports = {
formatData: formatData, formatSelf: formatSelf,
extractData: extractData extractData: extractData
} }
function formatData (key, data) { function formatSelf (key, data) {
var style = fontColor(data) var style = fontColor(data)
var keyStyle = data.isProperty ? 'color:#847979' : '' var keyStyle = data.isProperty ? 'color:#847979' : ''
if (data.type === 'string') { if (data.type === 'string') {

@ -11,7 +11,7 @@ class TreeView {
this.beforeJsonNodeRendered = opts.beforeJsonNodeRendered || noop this.beforeJsonNodeRendered = opts.beforeJsonNodeRendered || noop
this.beforeJsonValueRendered = opts.beforeJsonValueRendered || noop this.beforeJsonValueRendered = opts.beforeJsonValueRendered || noop
this.extractData = opts.extractData || this.extractDataDefault this.extractData = opts.extractData || this.extractDataDefault
this.formatData = opts.formatData || this.formatDataDefault this.formatSelf = opts.formatSelf || this.formatSelfDefault
this.view = null this.view = null
this.cssLabel = ui.formatCss(opts.css || {}, style.label) this.cssLabel = ui.formatCss(opts.css || {}, style.label)
this.cssUl = ui.formatCss(opts.css || {}, style.cssUl) this.cssUl = ui.formatCss(opts.css || {}, style.cssUl)
@ -38,7 +38,7 @@ class TreeView {
var children = (data.children || []).map((child, index) => { var children = (data.children || []).map((child, index) => {
return this.renderObject(child.value, data, child.key, expand, keyPath + '_' + child.key) return this.renderObject(child.value, data, child.key, expand, keyPath + '_' + child.key)
}) })
return this.formatDataInternal(key, data, children, expand, keyPath) return this.formatData(key, data, children, expand, keyPath)
} }
renderProperties (json, expand) { renderProperties (json, expand) {
@ -48,8 +48,8 @@ class TreeView {
return yo`<ul style=${this.cssUl}>${children}</ul>` return yo`<ul style=${this.cssUl}>${children}</ul>`
} }
formatDataInternal (key, data, children, expand, keyPath) { formatData (key, data, children, expand, keyPath) {
var label = yo`<span style=${this.cssLabel}><label style=${ui.formatCss(style.caret)}></label><span style=${ui.formatCss(style.data)}>${this.formatData(key, data)}</span></span>` var label = yo`<span style=${this.cssLabel}><label style=${ui.formatCss(style.caret)}></label><span style=${ui.formatCss(style.data)}>${this.formatSelf(key, data)}</span></span>`
var renderedChildren = '' var renderedChildren = ''
if (children.length) { if (children.length) {
renderedChildren = yo`<ul style=${this.cssUl}>${children}</ul>` renderedChildren = yo`<ul style=${this.cssUl}>${children}</ul>`
@ -66,7 +66,7 @@ class TreeView {
return yo`<li style=${this.cssLi}>${label}${renderedChildren}</li>` return yo`<li style=${this.cssLi}>${label}${renderedChildren}</li>`
} }
formatDataDefault (key, data) { formatSelfDefault (key, data) {
return yo`<label>${key}: ${data.self}</label>` return yo`<label>${key}: ${data.self}</label>`
} }

Loading…
Cancel
Save