use solidity type formatter

pull/7/head
yann300 8 years ago
parent d235275987
commit 2230e917b6
  1. 7
      src/ui/SolidityLocals.js
  2. 7
      src/ui/SolidityState.js
  3. 10
      src/ui/TreeView.js

@ -1,6 +1,7 @@
'use strict'
var DropdownPanel = require('./DropdownPanel')
var localDecoder = require('../solidity/localDecoder')
var solidityTypeFormatter = require('./SolidityTypeFormatter')
var yo = require('yo-yo')
class SolidityLocals {
@ -9,7 +10,11 @@ class SolidityLocals {
this.parent = _parent
this.internalTreeCall = internalTreeCall
this.traceManager = _traceManager
this.basicPanel = new DropdownPanel('Solidity Locals', {json: true})
this.basicPanel = new DropdownPanel('Solidity Locals', {
json: true,
formatData: solidityTypeFormatter.formatData,
extractData: solidityTypeFormatter.extractData
})
this.init()
}

@ -1,6 +1,7 @@
'use strict'
var DropdownPanel = require('./DropdownPanel')
var stateDecoder = require('../solidity/stateDecoder')
var solidityTypeFormatter = require('./SolidityTypeFormatter')
var yo = require('yo-yo')
function SolidityState (_parent, _traceManager, _codeManager, _solidityProxy) {
@ -8,7 +9,11 @@ function SolidityState (_parent, _traceManager, _codeManager, _solidityProxy) {
this.traceManager = _traceManager
this.codeManager = _codeManager
this.solidityProxy = _solidityProxy
this.basicPanel = new DropdownPanel('Solidity State', {json: true})
this.basicPanel = new DropdownPanel('Solidity State', {
json: true,
formatData: solidityTypeFormatter.formatData,
extractData: solidityTypeFormatter.extractData
})
this.init()
}

@ -40,7 +40,7 @@ class TreeView {
var children = Object.keys(data.children).map((innerkey) => {
return this.renderObject(data.children[innerkey], innerkey, expand)
})
return this.formatData(key, data.self, children, expand)
return this.formatDataInternal(key, data, children, expand)
}
renderProperties (json, expand) {
@ -50,8 +50,8 @@ class TreeView {
return yo`<ul style=${this.cssList}>${children}</ul>`
}
formatDataDefault (key, self, children, expand) {
var label = yo`<span style=${this.cssLabel}><label style='width: 10px'></label><label>${key}: ${self}</label></span>`
formatDataInternal (key, data, children, expand) {
var label = yo`<span style=${this.cssLabel}><label style='width: 10px'></label>${this.formatData(key, data)}</span>`
var renderedChildren = ''
if (children.length) {
renderedChildren = yo`<ul style=${this.cssList}>${children}</ul>`
@ -66,6 +66,10 @@ class TreeView {
return yo`<li style=${this.cssList}>${label}${renderedChildren}</li>`
}
formatDataDefault (key, data) {
return yo`<label>${key}: ${data.self}</label>`
}
extractDataDefault (item, key) {
var ret = {}
if (item instanceof Array) {

Loading…
Cancel
Save