--- /dev/null
+UI_STATE_BODY = {
+ "vis": {
+ "colors": None
+ }
+}
+
+
+def generate(dash_config, viz_config):
+
+ colors = {}
+
+ try:
+ series = dash_config['y-axis']['series']
+ for _, value in series.items():
+ try:
+ colors[value['label']] = value['color']
+ except KeyError:
+ continue
+ except KeyError:
+ pass
+
+ try:
+ series = viz_config['series']
+ for _, value in series.items():
+ try:
+ colors[value['label']] = value['color']
+ except KeyError:
+ continue
+ except KeyError:
+ pass
+
+ try:
+ seriesParams = dash_config['y-axis']['seriesParams']
+ for _, value in seriesParams.items():
+ try:
+ colors[value['label']] = value['color']
+ except KeyError:
+ continue
+ except KeyError:
+ pass
+
+ try:
+ seriesParams = viz_config['seriesParams']
+ for _, value in seriesParams.items():
+ try:
+ colors[value['label']] = value['color']
+ except KeyError:
+ continue
+ except KeyError:
+ pass
+
+ UI_STATE_BODY['vis']['colors'] = colors
+
+ return UI_STATE_BODY
import json
import os
import sys
-
+import glob
# 3rd party lib
from elasticsearch import Elasticsearch, RequestsHttpConnection, exceptions
# User defined libs
import generate_visState as vis_gen
+import generate_uiStateJSON as uiStateJSON_gen
import generate_dashVis as dash_gen
import data_generate as data_gen
intermediate_format, visState = vis_gen.generate(
i, viz_config[i['viz-template']])
+ uiStateJSON = uiStateJSON_gen.generate(
+ i, viz_config[i['viz-template']])
+
# p(intermediate_format)
# p(visState)
VIZ_BODY['visualization']['title'] = intermediate_format['title']
VIZ_BODY['visualization']['visState'] = JSONToString(visState)
+ VIZ_BODY['visualization']['uiStateJSON'] = JSONToString(uiStateJSON)
VIZ_BODY['visualization']['description'] = intermediate_format['desc']
p(VIZ_BODY)
1:
field: performance.plots.rate.Config DS
label: Config DS
+ color: red
2:
field: performance.plots.rate.OVS Switch
label: OVS Switch
+ color: yellow
3:
field: performance.plots.rate.Operational DS
label: Operational DS
+ color: blue
co_ords:
h: 3
label: Pass tests
schema: metric
value_axis: 1
+ color: green
fail:
data_type: histogram
mode: stacked
label: Fail tests
schema: metric
value_axis: 1
+ color: red
build:
field: performance.test-run
label: Build Number