diff options
author | SerenaFeng <feng.xiaowei@zte.com.cn> | 2016-10-08 16:45:49 +0800 |
---|---|---|
committer | SerenaFeng <feng.xiaowei@zte.com.cn> | 2016-10-10 10:40:00 +0800 |
commit | 60cd25286de20e218533c6da6e3dbe29f8644798 (patch) | |
tree | 40aa95987fbd68bf810f75e47f7ba352763efe99 /dashboard/dashboard/elastic2kibana/utility.py | |
parent | bfdcb5a3562ef74eb64e574eff8ae4dbeb5787a0 (diff) |
separate visualization building from dashboard building
JIRA: RELENG-155
Change-Id: I19355898d5dc5ef73fcfe4ebaf4604c4bf1e8f10
Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'dashboard/dashboard/elastic2kibana/utility.py')
-rw-r--r-- | dashboard/dashboard/elastic2kibana/utility.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/dashboard/dashboard/elastic2kibana/utility.py b/dashboard/dashboard/elastic2kibana/utility.py new file mode 100644 index 0000000..dccd28a --- /dev/null +++ b/dashboard/dashboard/elastic2kibana/utility.py @@ -0,0 +1,15 @@ +import json + +from jinja2 import Environment, PackageLoader + +env = Environment(loader=PackageLoader('elastic2kibana', 'templates')) +env.filters['jsonify'] = json.dumps + + +def dumps(a_dict, items): + for key in items: + a_dict[key] = json.dumps(a_dict[key]) + + +def dumps_2depth(a_dict, key1, key2): + a_dict[key1][key2] = json.dumps(a_dict[key1][key2]) |