mirror of
https://github.com/key-networks/ztncui.git
synced 2025-06-07 18:53:45 +02:00
Improve JSON value rendering
This commit is contained in:
parent
f4c8887454
commit
6809ca5f6a
3 changed files with 9 additions and 9 deletions
|
@ -7,6 +7,12 @@ mixin nav_item(name, displayName, href)
|
||||||
li(class=((navigate && navigate.active === name) ? 'active' : ''))
|
li(class=((navigate && navigate.active === name) ? 'active' : ''))
|
||||||
a(href=href) #{displayName}
|
a(href=href) #{displayName}
|
||||||
|
|
||||||
|
mixin json_value(value)
|
||||||
|
- if ((!!value ) && (value.constructor == Object || value.constructor == Array))
|
||||||
|
code(style='white-space: pre;')= JSON.stringify(value, null, 2)
|
||||||
|
- else
|
||||||
|
code= value
|
||||||
|
|
||||||
doctype html
|
doctype html
|
||||||
html(lang='en')
|
html(lang='en')
|
||||||
head
|
head
|
||||||
|
|
|
@ -14,10 +14,7 @@ block net_content
|
||||||
.col-sm-2
|
.col-sm-2
|
||||||
a(href=('/controller/network/' + member.nwid + '/member/' + member.address + '/' + key)) #{key}:
|
a(href=('/controller/network/' + member.nwid + '/member/' + member.address + '/' + key)) #{key}:
|
||||||
.col-sm-10
|
.col-sm-10
|
||||||
- if ((!!value ) && (value.constructor == Object || value.constructor == Array))
|
+json_value(value)
|
||||||
code #{JSON.stringify(value)}
|
|
||||||
- else
|
|
||||||
code #{value}
|
|
||||||
|
|
||||||
a.btn.btn-default(href=('/controller/network/' + member.nwid + "#members") name='networks' role='button' style='margin-top: 10px;')
|
a.btn.btn-default(href=('/controller/network/' + member.nwid + "#members") name='networks' role='button' style='margin-top: 10px;')
|
||||||
| Members
|
| Members
|
||||||
|
|
|
@ -123,13 +123,10 @@ block net_content
|
||||||
|
|
||||||
h3#detail Detail for network
|
h3#detail Detail for network
|
||||||
each value, key in network
|
each value, key in network
|
||||||
.row
|
.row(style='margin: 5px 0;')
|
||||||
.col-sm-2
|
.col-sm-2
|
||||||
a(href= network.nwid + '/' + key) #{key}:
|
a(href= network.nwid + '/' + key) #{key}:
|
||||||
.col-sm-10
|
.col-sm-10
|
||||||
- if ((!!value ) && (value.constructor == Object || value.constructor == Array))
|
+json_value(value)
|
||||||
code #{JSON.stringify(value)}
|
|
||||||
- else
|
|
||||||
code #{value}
|
|
||||||
|
|
||||||
a.btn.btn-default(href='/controller/networks' name='networks' role='button' style='margin-top: 10px;') Networks
|
a.btn.btn-default(href='/controller/networks' name='networks' role='button' style='margin-top: 10px;') Networks
|
||||||
|
|
Loading…
Add table
Reference in a new issue