mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-26 02:36:37 +00:00
pretty-print object attributes in dev-state panel. (#195)
This commit is contained in:
parent
5a60694587
commit
05760f9c21
@ -188,10 +188,15 @@ Polymer({
|
|||||||
var i;
|
var i;
|
||||||
var keys;
|
var keys;
|
||||||
var key;
|
var key;
|
||||||
|
var value;
|
||||||
|
|
||||||
for (i = 0, keys = Object.keys(entity.attributes); i < keys.length; i++) {
|
for (i = 0, keys = Object.keys(entity.attributes); i < keys.length; i++) {
|
||||||
key = keys[i];
|
key = keys[i];
|
||||||
output += key + ': ' + entity.attributes[key] + '\n';
|
value = entity.attributes[key];
|
||||||
|
if (!Array.isArray(value) && (value instanceof Object)) {
|
||||||
|
value = JSON.stringify(value, null, ' ');
|
||||||
|
}
|
||||||
|
output += key + ': ' + value + '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user