diff options
Diffstat (limited to 'resources/tools/dash/app/pal/news')
-rw-r--r-- | resources/tools/dash/app/pal/news/layout.py | 14 | ||||
-rw-r--r-- | resources/tools/dash/app/pal/news/news.py | 12 | ||||
-rw-r--r-- | resources/tools/dash/app/pal/news/tables.py | 8 |
3 files changed, 14 insertions, 20 deletions
diff --git a/resources/tools/dash/app/pal/news/layout.py b/resources/tools/dash/app/pal/news/layout.py index 2f66ce5c81..c9f2808a14 100644 --- a/resources/tools/dash/app/pal/news/layout.py +++ b/resources/tools/dash/app/pal/news/layout.py @@ -27,7 +27,9 @@ from yaml import load, FullLoader, YAMLError from copy import deepcopy from ..data.data import Data -from ..data.utils import classify_anomalies +from ..utils.constants import Constants as C +from ..utils.utils import classify_anomalies +from ..data.data import Data from .tables import table_news @@ -35,12 +37,6 @@ class Layout: """The layout of the dash app and the callbacks. """ - # The default job displayed when the page is loaded first time. - DEFAULT_JOB = "csit-vpp-perf-mrr-daily-master-2n-icx" - - # Time period for regressions and progressions. - TIME_PERIOD = 21 # [days] - def __init__(self, app: Flask, html_layout_file: str, data_spec_file: str, tooltip_file: str) -> None: """Initialization: @@ -73,7 +69,7 @@ class Layout: data_stats, data_mrr, data_ndrpdr = Data( data_spec_file=self._data_spec_file, debug=True - ).read_stats(days=self.TIME_PERIOD) + ).read_stats(days=C.NEWS_TIME_PERIOD) df_tst_info = pd.concat([data_mrr, data_ndrpdr], ignore_index=True) @@ -95,7 +91,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.NEWS_DEFAULT_JOB) # Pre-process the data: diff --git a/resources/tools/dash/app/pal/news/news.py b/resources/tools/dash/app/pal/news/news.py index deb00c1810..5e65b62281 100644 --- a/resources/tools/dash/app/pal/news/news.py +++ b/resources/tools/dash/app/pal/news/news.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,15 +30,15 @@ def init_news(server): dash_app = dash.Dash( server=server, - routes_pathname_prefix=u"/news/", - external_stylesheets=[dbc.themes.LUX], + routes_pathname_prefix=C.NEWS_ROUTES_PATHNAME_PREFIX, + external_stylesheets=C.EXTERNAL_STYLESHEETS ) layout = Layout( app=dash_app, - html_layout_file="pal/templates/news_layout.jinja2", - data_spec_file="pal/data/data.yaml", - tooltip_file="pal/data/tooltips.yaml", + html_layout_file=C.NEWS_HTML_LAYOUT_FILE, + data_spec_file=C.DATA_SPEC_FILE, + tooltip_file=C.TOOLTIP_FILE, ) dash_app.index_string = layout.html_layout dash_app.layout = layout.add_content() diff --git a/resources/tools/dash/app/pal/news/tables.py b/resources/tools/dash/app/pal/news/tables.py index 53b24608d5..6272814165 100644 --- a/resources/tools/dash/app/pal/news/tables.py +++ b/resources/tools/dash/app/pal/news/tables.py @@ -17,9 +17,7 @@ import pandas as pd import dash_bootstrap_components as dbc - -# Time period for regressions and progressions. -TIME_PERIOD = 21 # [days] +from ..utils.constants import Constants as C def table_news(data: pd.DataFrame, job: str) -> list: @@ -57,7 +55,7 @@ def table_news(data: pd.DataFrame, job: str) -> list: class_name="p-0", size="lg", children=( - f"Regressions during the last {TIME_PERIOD} days " + f"Regressions during the last {C.NEWS_TIME_PERIOD} days " f"({len(regressions['Test Name'])})" ) ), @@ -68,7 +66,7 @@ def table_news(data: pd.DataFrame, job: str) -> list: class_name="p-0", size="lg", children=( - f"Progressions during the last {TIME_PERIOD} days " + f"Progressions during the last {C.NEWS_TIME_PERIOD} days " f"({len(progressions['Test Name'])})" ) ), |