diff options
author | Tibor Frank <tifrank@cisco.com> | 2022-07-20 15:51:21 +0200 |
---|---|---|
committer | Tibor Frank <tifrank@cisco.com> | 2022-07-21 07:45:39 +0000 |
commit | ae1fe880286d7b0414664bce2b2c7c91c3f543f3 (patch) | |
tree | 5790af6de3884e0aa6918d44f23aca59cf0d86a7 /resources/tools/dash/app/pal/stats | |
parent | 739e01de7a65045dc42e6c16406a6d054da72f7b (diff) |
UTI: Move constatns to a separate file
Change-Id: If3796b71d02bcf5a92612585dfa8867e5039f037
Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'resources/tools/dash/app/pal/stats')
-rw-r--r-- | resources/tools/dash/app/pal/stats/layout.py | 17 | ||||
-rw-r--r-- | resources/tools/dash/app/pal/stats/stats.py | 14 |
2 files changed, 12 insertions, 19 deletions
diff --git a/resources/tools/dash/app/pal/stats/layout.py b/resources/tools/dash/app/pal/stats/layout.py index 5c3758ba76..03707c0394 100644 --- a/resources/tools/dash/app/pal/stats/layout.py +++ b/resources/tools/dash/app/pal/stats/layout.py @@ -28,8 +28,9 @@ from yaml import load, FullLoader, YAMLError from datetime import datetime, timedelta from copy import deepcopy +from ..utils.constants import Constants as C +from ..utils.url_processing import url_decode, url_encode from ..data.data import Data -from ..data.url_processing import url_decode, url_encode from .graphs import graph_statistics, select_data @@ -37,14 +38,6 @@ class Layout: """ """ - DEFAULT_JOB = "csit-vpp-perf-mrr-daily-master-2n-icx" - - URL_STYLE = { - "background-color": "#d2ebf5", - "border-color": "#bce1f1", - "color": "#135d7c" - } - def __init__(self, app: Flask, html_layout_file: str, graph_layout_file: str, data_spec_file: str, tooltip_file: str, time_period: int=None) -> None: @@ -95,7 +88,7 @@ class Layout: job_info["tbed"].append("-".join(lst_job[-2:])) self.df_job_info = pd.DataFrame.from_dict(job_info) - self._default = self._set_job_params(self.DEFAULT_JOB) + self._default = self._set_job_params(C.STATS_DEFAULT_JOB) tst_info = { "job": list(), @@ -431,7 +424,7 @@ class Layout: class_name="me-1", children=[ dbc.InputGroupText( - style=self.URL_STYLE, + style=C.URL_STYLE, children=self._show_tooltip( "help-url", "URL", "input-url") ), @@ -439,7 +432,7 @@ class Layout: id="input-url", readonly=True, type="url", - style=self.URL_STYLE, + style=C.URL_STYLE, value="" ) ] diff --git a/resources/tools/dash/app/pal/stats/stats.py b/resources/tools/dash/app/pal/stats/stats.py index 3da742d61e..560ec53f14 100644 --- a/resources/tools/dash/app/pal/stats/stats.py +++ b/resources/tools/dash/app/pal/stats/stats.py @@ -14,8 +14,8 @@ """Instantiate the Statistics Dash applocation. """ import dash -import dash_bootstrap_components as dbc +from ..utils.constants import Constants as C from .layout import Layout @@ -30,16 +30,16 @@ def init_stats(server, time_period=None): dash_app = dash.Dash( server=server, - routes_pathname_prefix=u"/stats/", - external_stylesheets=[dbc.themes.LUX], + routes_pathname_prefix=C.STATS_ROUTES_PATHNAME_PREFIX, + external_stylesheets=C.EXTERNAL_STYLESHEETS ) layout = Layout( app=dash_app, - html_layout_file="pal/templates/stats_layout.jinja2", - graph_layout_file="pal/stats/layout.yaml", - data_spec_file="pal/data/data.yaml", - tooltip_file="pal/data/tooltips.yaml", + html_layout_file=C.STATS_HTML_LAYOUT_FILE, + graph_layout_file=C.STATS_GRAPH_LAYOUT_FILE, + data_spec_file=C.DATA_SPEC_FILE, + tooltip_file=C.TOOLTIP_FILE, time_period=time_period ) dash_app.index_string = layout.html_layout |