Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
13aafe33
Commit
13aafe33
authored
Jan 19, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add properties
parent
3fd6db3b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
12 deletions
+39
-12
SolidityLocals.js
src/ui/SolidityLocals.js
+2
-1
SolidityState.js
src/ui/SolidityState.js
+2
-1
SolidityTypeFormatter.js
src/ui/SolidityTypeFormatter.js
+23
-7
TreeView.js
src/ui/TreeView.js
+12
-3
No files found.
src/ui/SolidityLocals.js
View file @
13aafe33
...
@@ -13,7 +13,8 @@ class SolidityLocals {
...
@@ -13,7 +13,8 @@ class SolidityLocals {
this
.
basicPanel
=
new
DropdownPanel
(
'Solidity Locals'
,
{
this
.
basicPanel
=
new
DropdownPanel
(
'Solidity Locals'
,
{
json
:
true
,
json
:
true
,
formatData
:
solidityTypeFormatter
.
formatData
,
formatData
:
solidityTypeFormatter
.
formatData
,
extractData
:
solidityTypeFormatter
.
extractData
extractData
:
solidityTypeFormatter
.
extractData
,
extractProperties
:
solidityTypeFormatter
.
extractProperties
})
})
this
.
init
()
this
.
init
()
this
.
view
this
.
view
...
...
src/ui/SolidityState.js
View file @
13aafe33
...
@@ -12,7 +12,8 @@ function SolidityState (_parent, _traceManager, _codeManager, _solidityProxy) {
...
@@ -12,7 +12,8 @@ function SolidityState (_parent, _traceManager, _codeManager, _solidityProxy) {
this
.
basicPanel
=
new
DropdownPanel
(
'Solidity State'
,
{
this
.
basicPanel
=
new
DropdownPanel
(
'Solidity State'
,
{
json
:
true
,
json
:
true
,
formatData
:
solidityTypeFormatter
.
formatData
,
formatData
:
solidityTypeFormatter
.
formatData
,
extractData
:
solidityTypeFormatter
.
extractData
extractData
:
solidityTypeFormatter
.
extractData
,
extractProperties
:
solidityTypeFormatter
.
extractProperties
})
})
this
.
init
()
this
.
init
()
this
.
view
this
.
view
...
...
src/ui/SolidityTypeFormatter.js
View file @
13aafe33
'use strict'
'use strict'
var
yo
=
require
(
'yo-yo'
)
var
yo
=
require
(
'yo-yo'
)
var
BN
=
require
(
'ethereumjs-util'
).
BN
module
.
exports
=
{
module
.
exports
=
{
formatData
:
formatData
,
formatData
:
formatData
,
extractProperties
:
extractProperties
,
extractData
:
extractData
extractData
:
extractData
}
}
function
formatData
(
key
,
data
)
{
function
formatData
(
key
,
data
)
{
var
style
=
fontColor
(
data
)
var
style
=
fontColor
(
data
)
var
type
=
''
return
yo
`<label>
${
key
}
: <label style=
${
style
}
>
${
data
.
self
}
</label><label style='font-style:italic'>
${
data
.
isProperty
?
''
:
data
.
type
}
</label></label>`
return
yo
`<label>
${
key
}
: <label style=
${
style
}
>
${
data
.
self
}
</label><label style='font-style:italic'>
${
type
}
</label></label>`
}
function
extractProperties
(
data
,
parent
,
key
)
{
var
ret
=
{}
if
(
isArray
(
data
.
type
))
{
var
length
=
new
BN
(
data
.
length
.
replace
(
'0x'
,
''
),
16
)
ret
[
'length'
]
=
{
self
:
length
.
toString
(
10
),
type
:
'uint'
,
isProperty
:
true
}
}
return
ret
}
}
function
extractData
(
item
,
parent
,
key
)
{
function
extractData
(
item
,
parent
,
key
)
{
...
@@ -17,11 +31,8 @@ function extractData (item, parent, key) {
...
@@ -17,11 +31,8 @@ function extractData (item, parent, key) {
if
(
item
.
type
.
lastIndexOf
(
']'
)
===
item
.
type
.
length
-
1
)
{
if
(
item
.
type
.
lastIndexOf
(
']'
)
===
item
.
type
.
length
-
1
)
{
ret
.
children
=
item
.
value
||
[]
ret
.
children
=
item
.
value
||
[]
ret
.
isArray
=
true
ret
.
isArray
=
true
if
(
!
parent
.
isArray
)
{
ret
.
self
=
parent
.
isArray
?
'Array'
:
item
.
type
ret
.
self
=
item
.
type
ret
.
length
=
item
.
length
}
else
{
ret
.
self
=
'Array'
}
}
else
if
(
item
.
type
.
indexOf
(
'struct'
)
===
0
)
{
}
else
if
(
item
.
type
.
indexOf
(
'struct'
)
===
0
)
{
ret
.
children
=
item
.
value
||
[]
ret
.
children
=
item
.
value
||
[]
ret
.
self
=
'Struct'
+
'{'
+
Object
.
keys
(
ret
.
children
).
length
+
'}'
ret
.
self
=
'Struct'
+
'{'
+
Object
.
keys
(
ret
.
children
).
length
+
'}'
...
@@ -48,3 +59,8 @@ function fontColor (data) {
...
@@ -48,3 +59,8 @@ function fontColor (data) {
}
}
return
'color:'
+
color
return
'color:'
+
color
}
}
function
isArray
(
type
)
{
return
type
.
lastIndexOf
(
']'
)
===
type
.
length
-
1
}
src/ui/TreeView.js
View file @
13aafe33
...
@@ -12,6 +12,7 @@ class TreeView {
...
@@ -12,6 +12,7 @@ class TreeView {
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
.
formatData
=
opts
.
formatData
||
this
.
formatDataDefault
this
.
extractProperties
=
opts
.
extractProperties
||
this
.
extractPropertiesDefault
this
.
view
=
null
this
.
view
=
null
this
.
cssLabel
=
ui
.
formatCss
(
opts
.
css
||
{},
style
.
label
)
this
.
cssLabel
=
ui
.
formatCss
(
opts
.
css
||
{},
style
.
label
)
this
.
cssList
=
ui
.
formatCss
(
opts
.
css
||
{},
style
.
list
)
this
.
cssList
=
ui
.
formatCss
(
opts
.
css
||
{},
style
.
list
)
...
@@ -40,7 +41,8 @@ class TreeView {
...
@@ -40,7 +41,8 @@ class TreeView {
var
children
=
Object
.
keys
(
data
.
children
).
map
((
innerkey
)
=>
{
var
children
=
Object
.
keys
(
data
.
children
).
map
((
innerkey
)
=>
{
return
this
.
renderObject
(
data
.
children
[
innerkey
],
data
,
innerkey
,
expand
)
return
this
.
renderObject
(
data
.
children
[
innerkey
],
data
,
innerkey
,
expand
)
})
})
return
this
.
formatDataInternal
(
key
,
data
,
children
,
expand
)
var
properties
=
this
.
extractProperties
(
item
,
parent
,
key
)
return
this
.
formatDataInternal
(
key
,
data
,
children
,
properties
,
expand
)
}
}
renderProperties
(
json
,
expand
)
{
renderProperties
(
json
,
expand
)
{
...
@@ -50,11 +52,14 @@ class TreeView {
...
@@ -50,11 +52,14 @@ class TreeView {
return
yo
`<ul style=
${
this
.
cssList
}
>
${
children
}
</ul>`
return
yo
`<ul style=
${
this
.
cssList
}
>
${
children
}
</ul>`
}
}
formatDataInternal
(
key
,
data
,
children
,
expand
)
{
formatDataInternal
(
key
,
data
,
children
,
properties
,
expand
)
{
var
renderedProperties
=
Object
.
keys
(
properties
).
map
((
item
)
=>
{
return
this
.
formatDataInternal
(
item
,
properties
[
item
],
[],
[],
false
)
})
var
label
=
yo
`<span style=
${
this
.
cssLabel
}
><label style='position:absolute;margin-top: 2px'></label><span style='margin-left: 10px'>
${
this
.
formatData
(
key
,
data
)}
</span></span>`
var
label
=
yo
`<span style=
${
this
.
cssLabel
}
><label style='position:absolute;margin-top: 2px'></label><span style='margin-left: 10px'>
${
this
.
formatData
(
key
,
data
)}
</span></span>`
var
renderedChildren
=
''
var
renderedChildren
=
''
if
(
children
.
length
)
{
if
(
children
.
length
)
{
renderedChildren
=
yo
`<ul style=
${
this
.
cssList
}
>
${
children
}
</ul>`
renderedChildren
=
yo
`<ul style=
${
this
.
cssList
}
>
${
renderedProperties
}${
children
}
</ul>`
renderedChildren
.
style
.
display
=
expand
?
'block'
:
'none'
renderedChildren
.
style
.
display
=
expand
?
'block'
:
'none'
label
.
firstElementChild
.
className
=
expand
?
'fa fa-caret-down'
:
'fa fa-caret-right'
label
.
firstElementChild
.
className
=
expand
?
'fa fa-caret-down'
:
'fa fa-caret-right'
label
.
onclick
=
function
()
{
label
.
onclick
=
function
()
{
...
@@ -66,6 +71,10 @@ class TreeView {
...
@@ -66,6 +71,10 @@ class TreeView {
return
yo
`<li style=
${
this
.
cssList
}
>
${
label
}${
renderedChildren
}
</li>`
return
yo
`<li style=
${
this
.
cssList
}
>
${
label
}${
renderedChildren
}
</li>`
}
}
extractPropertiesDefault
(
key
,
data
)
{
return
{}
}
formatDataDefault
(
key
,
data
)
{
formatDataDefault
(
key
,
data
)
{
return
yo
`<label>
${
key
}
:
${
data
.
self
}
</label>`
return
yo
`<label>
${
key
}
:
${
data
.
self
}
</label>`
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment