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
de53c8a0
Commit
de53c8a0
authored
Jan 19, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
don't add full type label for sub array
parent
c6261654
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
22 deletions
+17
-22
SolidityTypeFormatter.js
src/ui/SolidityTypeFormatter.js
+12
-17
TreeView.js
src/ui/TreeView.js
+5
-5
No files found.
src/ui/SolidityTypeFormatter.js
View file @
de53c8a0
...
...
@@ -9,31 +9,34 @@ module.exports = {
function
formatData
(
key
,
data
)
{
var
style
=
fontColor
(
data
)
var
type
=
''
if
(
!
isArray
(
data
.
type
)
&&
!
isStruct
(
data
.
type
))
{
type
=
data
.
type
}
return
yo
`<label>
${
key
}
: <label style=
${
style
}
>
${
data
.
self
}
</label><label style='font-style:italic'>
${
type
}
</label></label>`
}
function
extractData
(
item
,
key
)
{
function
extractData
(
item
,
parent
,
key
)
{
var
ret
=
{}
if
(
i
sArray
(
item
.
type
)
)
{
if
(
i
tem
.
type
.
lastIndexOf
(
']'
)
===
item
.
type
.
length
-
1
)
{
ret
.
children
=
item
.
value
||
[]
ret
.
self
=
item
.
type
}
else
if
(
isStruct
(
item
.
type
))
{
ret
.
isArray
=
true
if
(
!
parent
.
isArray
)
{
ret
.
self
=
item
.
type
}
else
{
ret
.
self
=
'Array'
}
}
else
if
(
item
.
type
.
indexOf
(
'struct'
)
===
0
)
{
ret
.
children
=
item
.
value
||
[]
ret
.
self
=
'Struct'
+
'{'
+
Object
.
keys
(
ret
.
children
).
length
+
'}'
ret
.
isStruct
=
true
}
else
{
ret
.
children
=
[]
ret
.
self
=
item
.
value
ret
.
type
=
item
.
type
}
ret
.
type
=
item
.
type
return
ret
}
function
fontColor
(
data
)
{
var
color
=
'#124B46'
if
(
isArray
(
data
.
type
)
||
isStruct
(
data
.
type
)
)
{
if
(
data
.
isArray
||
data
.
isStruct
)
{
color
=
'#847979'
}
else
if
(
data
.
type
.
indexOf
(
'uint'
)
===
0
||
data
.
type
.
indexOf
(
'int'
)
===
0
||
...
...
@@ -45,11 +48,3 @@ function fontColor (data) {
}
return
'color:'
+
color
}
function
isArray
(
type
)
{
return
type
.
lastIndexOf
(
']'
)
===
type
.
length
-
1
}
function
isStruct
(
type
)
{
return
type
.
indexOf
(
'struct'
)
===
0
&&
!
isArray
(
type
)
}
src/ui/TreeView.js
View file @
de53c8a0
...
...
@@ -35,17 +35,17 @@ class TreeView {
}
}
renderObject
(
item
,
key
,
expand
)
{
var
data
=
this
.
extractData
(
item
,
key
)
renderObject
(
item
,
parent
,
key
,
expand
)
{
var
data
=
this
.
extractData
(
item
,
parent
,
key
)
var
children
=
Object
.
keys
(
data
.
children
).
map
((
innerkey
)
=>
{
return
this
.
renderObject
(
data
.
children
[
innerkey
],
innerkey
,
expand
)
return
this
.
renderObject
(
data
.
children
[
innerkey
],
data
,
innerkey
,
expand
)
})
return
this
.
formatDataInternal
(
key
,
data
,
children
,
expand
)
}
renderProperties
(
json
,
expand
)
{
var
children
=
Object
.
keys
(
json
).
map
((
innerkey
)
=>
{
return
this
.
renderObject
(
json
[
innerkey
],
innerkey
,
expand
)
return
this
.
renderObject
(
json
[
innerkey
],
json
,
innerkey
,
expand
)
})
return
yo
`<ul style=
${
this
.
cssList
}
>
${
children
}
</ul>`
}
...
...
@@ -70,7 +70,7 @@ class TreeView {
return
yo
`<label>
${
key
}
:
${
data
.
self
}
</label>`
}
extractDataDefault
(
item
,
key
)
{
extractDataDefault
(
item
,
parent
,
key
)
{
var
ret
=
{}
if
(
item
instanceof
Array
)
{
ret
.
children
=
item
...
...
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