aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/dash/app
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2022-09-14 15:14:25 +0200
committerTibor Frank <tifrank@cisco.com>2022-09-14 15:14:25 +0200
commit69fd124979890cac21bd0dbc7ef442563f175372 (patch)
tree8db6abea93c7daff4c3766413cc31c889a73d017 /resources/tools/dash/app
parent8ce2df561b011243f9138332058945e957d48d63 (diff)
UTI: Remove datepicker, unify font sizes
Change-Id: I074425dbfe46c6411b2e04cd9c36d20f60a3f4de Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'resources/tools/dash/app')
-rw-r--r--resources/tools/dash/app/pal/news/layout.py1
-rw-r--r--resources/tools/dash/app/pal/report/layout.py7
-rw-r--r--resources/tools/dash/app/pal/stats/graphs.py24
-rw-r--r--resources/tools/dash/app/pal/stats/layout.py86
-rw-r--r--resources/tools/dash/app/pal/stats/layout.yaml38
-rw-r--r--resources/tools/dash/app/pal/trending/graphs.py17
-rw-r--r--resources/tools/dash/app/pal/trending/layout.py67
-rw-r--r--resources/tools/dash/app/pal/trending/layout.yaml54
8 files changed, 37 insertions, 257 deletions
diff --git a/resources/tools/dash/app/pal/news/layout.py b/resources/tools/dash/app/pal/news/layout.py
index 504f7cb801..cd1618d719 100644
--- a/resources/tools/dash/app/pal/news/layout.py
+++ b/resources/tools/dash/app/pal/news/layout.py
@@ -279,6 +279,7 @@ class Layout:
if self.html_layout:
return html.Div(
id="div-main",
+ className="small",
children=[
dcc.Location(id="url", refresh=False),
dbc.Row(
diff --git a/resources/tools/dash/app/pal/report/layout.py b/resources/tools/dash/app/pal/report/layout.py
index 34ec6c16e1..a556871084 100644
--- a/resources/tools/dash/app/pal/report/layout.py
+++ b/resources/tools/dash/app/pal/report/layout.py
@@ -232,6 +232,7 @@ class Layout:
if self.html_layout and self.spec_tbs:
return html.Div(
id="div-main",
+ className="small",
children=[
dbc.Row(
id="row-navbar",
@@ -638,8 +639,7 @@ class Layout:
class_name="me-1",
color="info"
)
- ],
- size="md",
+ ]
)
]
),
@@ -682,8 +682,7 @@ class Layout:
color="info",
disabled=False
),
- ],
- size="md",
+ ]
)
]
),
diff --git a/resources/tools/dash/app/pal/stats/graphs.py b/resources/tools/dash/app/pal/stats/graphs.py
index 42f23da5aa..f533d72aa8 100644
--- a/resources/tools/dash/app/pal/stats/graphs.py
+++ b/resources/tools/dash/app/pal/stats/graphs.py
@@ -17,37 +17,27 @@
import plotly.graph_objects as go
import pandas as pd
-from datetime import datetime, timedelta
-def select_data(data: pd.DataFrame, itm:str, start: datetime,
- end: datetime) -> pd.DataFrame:
+def select_data(data: pd.DataFrame, itm:str) -> pd.DataFrame:
"""Select the data for graphs from the provided data frame.
:param data: Data frame with data for graphs.
:param itm: Item (in this case job name) which data will be selected from
the input data frame.
- :param start: The date (and time) when the selected data starts.
- :param end: The date (and time) when the selected data ends.
:type data: pandas.DataFrame
:type itm: str
- :type start: datetime.datetime
- :type end: datetime.datetime
:returns: A data frame with selected data.
:rtype: pandas.DataFrame
"""
- df = data.loc[
- (data["job"] == itm) &
- (data["start_time"] >= start) & (data["start_time"] <= end)
- ].sort_values(by="start_time", ignore_index=True)
+ df = data.loc[(data["job"] == itm)].sort_values(
+ by="start_time", ignore_index=True)
df = df.dropna(subset=["duration", ])
return df
-def graph_statistics(df: pd.DataFrame, job:str, layout: dict,
- start: datetime=datetime.utcnow()-timedelta(days=180),
- end: datetime=datetime.utcnow()) -> tuple:
+def graph_statistics(df: pd.DataFrame, job:str, layout: dict) -> tuple:
"""Generate graphs:
1. Passed / failed tests,
2. Job durations
@@ -56,19 +46,15 @@ def graph_statistics(df: pd.DataFrame, job:str, layout: dict,
:param df: Data frame with input data.
:param job: The name of job which data will be presented in the graphs.
:param layout: Layout of plot.ly graph.
- :param start: The date (and time) when the selected data starts.
- :param end: The date (and time) when the selected data ends.
:type df: pandas.DataFrame
:type job: str
:type layout: dict
- :type start: datetime.datetime
- :type end: datetime.datetime
:returns: Tuple with two generated graphs (pased/failed tests and job
duration).
:rtype: tuple(plotly.graph_objects.Figure, plotly.graph_objects.Figure)
"""
- data = select_data(df, job, start, end)
+ data = select_data(df, job)
if data.empty:
return None, None
diff --git a/resources/tools/dash/app/pal/stats/layout.py b/resources/tools/dash/app/pal/stats/layout.py
index 273ee23362..fa1da90a00 100644
--- a/resources/tools/dash/app/pal/stats/layout.py
+++ b/resources/tools/dash/app/pal/stats/layout.py
@@ -25,12 +25,12 @@ from dash import callback_context, no_update
from dash import Input, Output, State
from dash.exceptions import PreventUpdate
from yaml import load, FullLoader, YAMLError
-from datetime import datetime, timedelta
+from datetime import datetime
from copy import deepcopy
from ..utils.constants import Constants as C
-from ..utils.utils import show_tooltip, gen_new_url, get_date, get_ttypes, \
- get_cadences, get_test_beds, get_job, generate_options, set_job_params
+from ..utils.utils import show_tooltip, gen_new_url, get_ttypes, get_cadences, \
+ get_test_beds, get_job, generate_options, set_job_params
from ..utils.url_processing import url_decode
from ..data.data import Data
from .graphs import graph_statistics, select_data
@@ -244,6 +244,7 @@ class Layout:
if self.html_layout:
return html.Div(
id="div-main",
+ className="small",
children=[
dcc.Store(id="control-panel"),
dcc.Location(id="url", refresh=False),
@@ -499,30 +500,6 @@ class Layout:
children=self.default["job"]
)
]
- ),
- dbc.Row(
- class_name="g-0 p-2",
- children=[
- dbc.Label(
- class_name="gy-1",
- children=show_tooltip(self._tooltips,
- "help-time-period", "Time Period"),
- ),
- dcc.DatePickerRange(
- id="dpr-period",
- className="d-flex justify-content-center",
- min_date_allowed=\
- datetime.utcnow() - timedelta(
- days=self.time_period),
- max_date_allowed=datetime.utcnow(),
- initial_visible_month=datetime.utcnow(),
- start_date=\
- datetime.utcnow() - timedelta(
- days=self.time_period),
- end_date=datetime.utcnow(),
- display_format="D MMM YY"
- )
- ]
)
]
),
@@ -552,10 +529,7 @@ class Layout:
"ri-ttypes-value": default["ttype"],
"ri-cadences-value": default["cadence"],
"dd-tbeds-value": default["tbed"],
- "al-job-children": default["job"],
- "dpr-start-date": datetime.utcnow() - \
- timedelta(days=C.TIME_PERIOD),
- "dpr-end-date": datetime.utcnow()
+ "al-job-children": default["job"]
}
self._panel = deepcopy(self._defaults)
if panel:
@@ -625,19 +599,15 @@ class Layout:
Output("ri-cadences", "value"),
Output("dd-tbeds", "value"),
Output("al-job", "children"),
- Output("dpr-period", "start_date"),
- Output("dpr-period", "end_date"),
State("control-panel", "data"), # Store
Input("ri-duts", "value"),
Input("ri-ttypes", "value"),
Input("ri-cadences", "value"),
Input("dd-tbeds", "value"),
- Input("dpr-period", "start_date"),
- Input("dpr-period", "end_date"),
Input("url", "href")
)
def _update_ctrl_panel(cp_data: dict, dut: str, ttype: str, cadence:str,
- tbed: str, start: str, end: str, href: str) -> tuple:
+ tbed: str, href: str) -> tuple:
"""Update the application when the event is detected.
:param cp_data: Current status of the control panel stored in
@@ -646,16 +616,12 @@ class Layout:
:param ttype: Input - Test type.
:param cadence: Input - The cadence of the job.
:param tbed: Input - The test bed.
- :param start: Date and time where the data processing starts.
- :param end: Date and time where the data processing ends.
:param href: Input - The URL provided by the browser.
:type cp_data: dict
:type dut: str
:type ttype: str
:type cadence: str
:type tbed: str
- :type start: str
- :type end: str
:type href: str
:returns: New values for web page elements.
:rtype: tuple
@@ -663,9 +629,6 @@ class Layout:
ctrl_panel = self.ControlPanel(cp_data, self.default)
- start = get_date(start)
- end = get_date(end)
-
# Parse the url:
parsed_url = url_decode(href)
if parsed_url:
@@ -721,16 +684,10 @@ class Layout:
ctrl_panel.set({
"dd-tbeds-value": tbed
})
- elif trigger_id == "dpr-period":
- pass
elif trigger_id == "url":
if url_params:
new_job = url_params.get("job", list())[0]
- new_start = url_params.get("start", list())[0]
- new_end = url_params.get("end", list())[0]
- if new_job and new_start and new_end:
- start = get_date(new_start)
- end = get_date(new_end)
+ if new_job:
job_params = set_job_params(self.job_info, new_job)
ctrl_panel = self.ControlPanel(None, job_params)
else:
@@ -744,26 +701,15 @@ class Layout:
ctrl_panel.get("dd-tbeds-value")
)
- ctrl_panel.set({
- "al-job-children": job,
- "dpr-start-date": start,
- "dpr-end-date": end
- })
- fig_passed, fig_duration = graph_statistics(self.data, job,
- self.layout, start, end)
+ ctrl_panel.set({"al-job-children": job})
+ fig_passed, fig_duration = \
+ graph_statistics(self.data, job, self.layout)
ret_val = [
ctrl_panel.panel,
fig_passed,
fig_duration,
- gen_new_url(
- parsed_url,
- {
- "job": job,
- "start": start,
- "end": end
- }
- )
+ gen_new_url(parsed_url, {"job": job})
]
ret_val.extend(ctrl_panel.values())
return ret_val
@@ -771,22 +717,16 @@ class Layout:
@app.callback(
Output("download-data", "data"),
State("control-panel", "data"), # Store
- State("dpr-period", "start_date"),
- State("dpr-period", "end_date"),
Input("btn-download-data", "n_clicks"),
prevent_initial_call=True
)
- def _download_data(cp_data: dict, start: str, end: str, n_clicks: int):
+ def _download_data(cp_data: dict, n_clicks: int):
"""Download the data
:param cp_data: Current status of the control panel stored in
browser.
- :param start: Date and time where the data processing starts.
- :param end: Date and time where the data processing ends.
:param n_clicks: Number of clicks on the button "Download".
:type cp_data: dict
- :type start: str
- :type end: str
:type n_clicks: int
:returns: dict of data frame content (base64 encoded) and meta data
used by the Download component.
@@ -805,7 +745,7 @@ class Layout:
ctrl_panel.get("dd-tbeds-value")
)
- data = select_data(self.data, job, get_date(start), get_date(end))
+ data = select_data(self.data, job)
data = data.drop(columns=["job", ])
return dcc.send_data_frame(
diff --git a/resources/tools/dash/app/pal/stats/layout.yaml b/resources/tools/dash/app/pal/stats/layout.yaml
index 0a102e4d0a..488654640f 100644
--- a/resources/tools/dash/app/pal/stats/layout.yaml
+++ b/resources/tools/dash/app/pal/stats/layout.yaml
@@ -27,25 +27,6 @@ plot-stats-passed:
tickcolor: "rgb(238, 238, 238)"
tickmode: "auto"
tickformat: "%m%d"
- rangeselector:
- buttons:
- - count: 14
- label: "2w"
- step: "day"
- stepmode: "backward"
- - count: 1
- label: "1m"
- step: "month"
- stepmode: "backward"
- - count: 2
- label: "2m"
- step: "month"
- stepmode: "backward"
- - count: 3
- label: "3m"
- step: "month"
- stepmode: "backward"
- - step: "all"
margin:
r: 20
b: 5
@@ -87,25 +68,6 @@ plot-stats-duration:
tickcolor: "rgb(238, 238, 238)"
tickmode: "auto"
tickformat: "%m%d"
- rangeselector:
- buttons:
- - count: 14
- label: "2w"
- step: "day"
- stepmode: "backward"
- - count: 1
- label: "1m"
- step: "month"
- stepmode: "backward"
- - count: 2
- label: "2m"
- step: "month"
- stepmode: "backward"
- - count: 3
- label: "3m"
- step: "month"
- stepmode: "backward"
- - step: "all"
margin:
r: 20
b: 5
diff --git a/resources/tools/dash/app/pal/trending/graphs.py b/resources/tools/dash/app/pal/trending/graphs.py
index 06bea25466..1eff4aa889 100644
--- a/resources/tools/dash/app/pal/trending/graphs.py
+++ b/resources/tools/dash/app/pal/trending/graphs.py
@@ -99,22 +99,18 @@ def select_trending_data(data: pd.DataFrame, itm:dict) -> pd.DataFrame:
def _generate_trending_traces(ttype: str, name: str, df: pd.DataFrame,
- start: datetime, end: datetime, color: str, norm_factor: float) -> list:
+ color: str, norm_factor: float) -> list:
"""Generate the trending traces for the trending graph.
:param ttype: Test type (MRR, NDR, PDR).
:param name: The test name to be displayed as the graph title.
:param df: Data frame with test data.
- :param start: The date (and time) when the selected data starts.
- :param end: The date (and time) when the selected data ends.
:param color: The color of the trace (samples and trend line).
:param norm_factor: The factor used for normalization of the results to CPU
frequency set to Constants.NORM_FREQUENCY.
:type ttype: str
:type name: str
:type df: pandas.DataFrame
- :type start: datetime.datetime
- :type end: datetime.datetime
:type color: str
:type norm_factor: float
:returns: Traces (samples, trending line, anomalies)
@@ -124,7 +120,6 @@ def _generate_trending_traces(ttype: str, name: str, df: pd.DataFrame,
df = df.dropna(subset=[C.VALUE[ttype], ])
if df.empty:
return list()
- df = df.loc[((df["start_time"] >= start) & (df["start_time"] <= end))]
if df.empty:
return list()
@@ -274,22 +269,18 @@ def _generate_trending_traces(ttype: str, name: str, df: pd.DataFrame,
def graph_trending(data: pd.DataFrame, sel:dict, layout: dict,
- start: datetime, end: datetime, normalize: bool) -> tuple:
+ normalize: bool) -> tuple:
"""Generate the trending graph(s) - MRR, NDR, PDR and for PDR also Latences
(result_latency_forward_pdr_50_avg).
:param data: Data frame with test results.
:param sel: Selected tests.
:param layout: Layout of plot.ly graph.
- :param start: The date (and time) when the selected data starts.
- :param end: The date (and time) when the selected data ends.
:param normalize: If True, the data is normalized to CPU frquency
Constants.NORM_FREQUENCY.
:type data: pandas.DataFrame
:type sel: dict
:type layout: dict
- :type start: datetime.datetime
- :type end: datetype.datetype
:type normalize: bool
:returns: Trending graph(s)
:rtype: tuple(plotly.graph_objects.Figure, plotly.graph_objects.Figure)
@@ -316,7 +307,7 @@ def graph_trending(data: pd.DataFrame, sel:dict, layout: dict,
else:
norm_factor = 1.0
traces = _generate_trending_traces(
- itm["testtype"], name, df, start, end, get_color(idx), norm_factor
+ itm["testtype"], name, df, get_color(idx), norm_factor
)
if traces:
if not fig_tput:
@@ -325,7 +316,7 @@ def graph_trending(data: pd.DataFrame, sel:dict, layout: dict,
if itm["testtype"] == "pdr":
traces = _generate_trending_traces(
- "pdr-lat", name, df, start, end, get_color(idx), norm_factor
+ "pdr-lat", name, df, get_color(idx), norm_factor
)
if traces:
if not fig_lat:
diff --git a/resources/tools/dash/app/pal/trending/layout.py b/resources/tools/dash/app/pal/trending/layout.py
index 9e78b7c15e..eac02ced6f 100644
--- a/resources/tools/dash/app/pal/trending/layout.py
+++ b/resources/tools/dash/app/pal/trending/layout.py
@@ -25,14 +25,14 @@ from dash import callback_context, no_update, ALL
from dash import Input, Output, State
from dash.exceptions import PreventUpdate
from yaml import load, FullLoader, YAMLError
-from datetime import datetime, timedelta
+from datetime import datetime
from copy import deepcopy
from json import loads, JSONDecodeError
from ast import literal_eval
from ..utils.constants import Constants as C
from ..utils.utils import show_tooltip, label, sync_checklists, list_tests, \
- get_date, gen_new_url, generate_options
+ gen_new_url, generate_options
from ..utils.url_processing import url_decode
from ..data.data import Data
from .graphs import graph_trending, graph_hdrh_latency, \
@@ -239,6 +239,7 @@ class Layout:
if self.html_layout and self.spec_tbs:
return html.Div(
id="div-main",
+ className="small",
children=[
dbc.Row(
id="row-navbar",
@@ -594,32 +595,7 @@ class Layout:
class_name="me-1",
color="info"
)
- ],
- size="md",
- )
- ]
- ),
- dbc.Row(
- class_name="gy-1",
- children=[
- dbc.Label(
- class_name="gy-1",
- children=show_tooltip(self._tooltips,
- "help-time-period", "Time Period"),
- ),
- dcc.DatePickerRange(
- id="dpr-period",
- className="d-flex justify-content-center",
- min_date_allowed=\
- datetime.utcnow() - timedelta(
- days=self.time_period),
- max_date_allowed=datetime.utcnow(),
- initial_visible_month=datetime.utcnow(),
- start_date=\
- datetime.utcnow() - timedelta(
- days=self.time_period),
- end_date=datetime.utcnow(),
- display_format="D MMM YY"
+ ]
)
]
),
@@ -662,8 +638,7 @@ class Layout:
color="info",
disabled=False
),
- ],
- size="md",
+ ]
)
]
),
@@ -711,10 +686,7 @@ class Layout:
"cl-ctrl-testtype-all-options": C.CL_ALL_DISABLED,
"btn-ctrl-add-disabled": True,
"cl-normalize-value": list(),
- "cl-selected-options": list(),
- "dpr-start-date": datetime.utcnow() - \
- timedelta(days=C.TIME_PERIOD),
- "dpr-end-date": datetime.utcnow()
+ "cl-selected-options": list()
}
self._panel = deepcopy(self._defaults)
@@ -878,8 +850,6 @@ class Layout:
Output("btn-ctrl-add", "disabled"),
Output("cl-ctrl-normalize", "value"),
Output("cl-selected", "options"), # User selection
- Output("dpr-period", "start_date"),
- Output("dpr-period", "end_date"),
State("control-panel", "data"), # Store
State("selected-tests", "data"), # Store
State("cl-selected", "value"), # User selection
@@ -895,8 +865,6 @@ class Layout:
Input("cl-ctrl-testtype-all", "value"),
Input("cl-ctrl-normalize", "value"),
Input("btn-ctrl-add", "n_clicks"),
- Input("dpr-period", "start_date"),
- Input("dpr-period", "end_date"),
Input("btn-sel-remove", "n_clicks"),
Input("btn-sel-remove-all", "n_clicks"),
Input("url", "href")
@@ -905,7 +873,7 @@ class Layout:
dd_dut: str, dd_phy: str, dd_area: str, dd_test: str, cl_core: list,
cl_core_all: list, cl_framesize: list, cl_framesize_all: list,
cl_testtype: list, cl_testtype_all: list, cl_normalize: list,
- btn_add: int, d_start: str, d_end: str, btn_remove: int,
+ btn_add: int, btn_remove: int,
btn_remove_all: int, href: str) -> tuple:
"""Update the application when the event is detected.
@@ -927,8 +895,6 @@ class Layout:
:param cl_testtype_all: Input - All test types.
:param cl_normalize: Input - Normalize the results.
:param btn_add: Input - Button "Add Selected" tests.
- :param d_start: Date and time where the data processing starts.
- :param d_end: Date and time where the data processing ends.
:param btn_remove: Input - Button "Remove selected" tests.
:param btn_remove_all: Input - Button "Remove All" tests.
:param href: Input - The URL provided by the browser.
@@ -947,8 +913,6 @@ class Layout:
:type cl_testtype_all: list
:type cl_normalize: list
:type btn_add: int
- :type d_start: str
- :type d_end: str
:type btn_remove: int
:type btn_remove_all: int
:type href: str
@@ -959,9 +923,6 @@ class Layout:
ctrl_panel = self.ControlPanel(cp_data)
norm = cl_normalize
- d_start = get_date(d_start)
- d_end = get_date(d_end)
-
# Parse the url:
parsed_url = url_decode(href)
if parsed_url:
@@ -1218,8 +1179,6 @@ class Layout:
if url_params:
try:
store_sel = literal_eval(url_params["store_sel"][0])
- d_start = get_date(url_params["start"][0])
- d_end = get_date(url_params["end"][0])
norm = literal_eval(url_params["norm"][0])
except (KeyError, IndexError):
pass
@@ -1269,27 +1228,23 @@ class Layout:
"cl-ctrl-testtype-all-options": C.CL_ALL_ENABLED
})
- if trigger_id in ("btn-ctrl-add", "url", "dpr-period",
- "btn-sel-remove", "cl-ctrl-normalize"):
+ if trigger_id in ("btn-ctrl-add", "url", "btn-sel-remove",
+ "cl-ctrl-normalize"):
if store_sel:
row_fig_tput, row_fig_lat, row_btn_dwnld = \
_generate_plotting_area(
graph_trending(self.data, store_sel, self.layout,
- d_start, d_end, bool(norm)),
+ bool(norm)),
gen_new_url(
parsed_url,
{
"store_sel": store_sel,
- "start": d_start,
- "end": d_end,
"norm": norm
}
)
)
ctrl_panel.set({
- "cl-selected-options": list_tests(store_sel),
- "dpr-start-date": d_start,
- "dpr-end-date": d_end
+ "cl-selected-options": list_tests(store_sel)
})
else:
row_fig_tput = C.PLACEHOLDER
diff --git a/resources/tools/dash/app/pal/trending/layout.yaml b/resources/tools/dash/app/pal/trending/layout.yaml
index 9c35d93667..1beb5226b1 100644
--- a/resources/tools/dash/app/pal/trending/layout.yaml
+++ b/resources/tools/dash/app/pal/trending/layout.yaml
@@ -28,33 +28,6 @@ plot-trending-tput:
tickcolor: "rgb(238, 238, 238)"
tickmode: "auto"
tickformat: "%m%d"
- rangeselector:
- buttons:
- - count: 14
- label: "2w"
- step: "day"
- stepmode: "backward"
- - count: 1
- label: "1m"
- step: "month"
- stepmode: "backward"
- - count: 2
- label: "2m"
- step: "month"
- stepmode: "backward"
- - count: 3
- label: "3m"
- step: "month"
- stepmode: "backward"
- - count: 4
- label: "4m"
- step: "month"
- stepmode: "backward"
- - count: 5
- label: "5m"
- step: "month"
- stepmode: "backward"
- - step: "all"
margin:
r: 20
b: 0
@@ -101,33 +74,6 @@ plot-trending-lat:
tickcolor: "rgb(238, 238, 238)"
tickmode: "auto"
tickformat: "%m%d"
- rangeselector:
- buttons:
- - count: 14
- label: "2w"
- step: "day"
- stepmode: "backward"
- - count: 1
- label: "1m"
- step: "month"
- stepmode: "backward"
- - count: 2
- label: "2m"
- step: "month"
- stepmode: "backward"
- - count: 3
- label: "3m"
- step: "month"
- stepmode: "backward"
- - count: 4
- label: "4m"
- step: "month"
- stepmode: "backward"
- - count: 5
- label: "5m"
- step: "month"
- stepmode: "backward"
- - step: "all"
margin:
r: 20
b: 0