from datetime import datetime, timedelta
from copy import deepcopy
+from ..utils.constants import Constants as C
+from ..utils.utils import show_tooltip, gen_new_url
+from ..utils.url_processing import url_decode
from ..data.data import Data
-from ..data.url_processing import url_decode, url_encode
from .graphs import graph_statistics, select_data
"""
"""
- 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, spec_file: str,
+ 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:
"""
# Inputs
self._app = app
self._html_layout_file = html_layout_file
- self._spec_file = spec_file
self._graph_layout_file = graph_layout_file
self._data_spec_file = data_spec_file
self._tooltip_file = tooltip_file
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(),
lst_job[1], lst_job[3], lst_job[4]))
}
- def _show_tooltip(self, id: str, title: str,
- clipboard_id: str=None) -> list:
- """
- """
- return [
- dcc.Clipboard(target_id=clipboard_id, title="Copy URL") \
- if clipboard_id else str(),
- f"{title} ",
- dbc.Badge(
- id=id,
- children="?",
- pill=True,
- color="white",
- text_color="info",
- class_name="border ms-1",
- ),
- dbc.Tooltip(
- children=self._tooltips.get(id, str()),
- target=id,
- placement="auto"
- )
- ]
-
def add_content(self):
"""
"""
dcc.Loading(children=[
dbc.Button(
id="btn-download-data",
- children=self._show_tooltip(
+ children=show_tooltip(self._tooltips,
"help-download", "Download Data"),
class_name="me-1",
color="info"
class_name="me-1",
children=[
dbc.InputGroupText(
- style=self.URL_STYLE,
- children=self._show_tooltip(
- "help-url", "URL", "input-url")
+ style=C.URL_STYLE,
+ children=show_tooltip(
+ self._tooltips,
+ "help-url", "URL",
+ "input-url"
+ )
),
dbc.Input(
id="input-url",
readonly=True,
type="url",
- style=self.URL_STYLE,
+ style=C.URL_STYLE,
value=""
)
]
children=[
dbc.Label(
class_name="p-0",
- children=self._show_tooltip(
+ children=show_tooltip(self._tooltips,
"help-dut", "Device under Test")
),
dbc.Row(
children=[
dbc.Label(
class_name="p-0",
- children=self._show_tooltip(
+ children=show_tooltip(self._tooltips,
"help-ttype", "Test Type"),
),
dbc.RadioItems(
children=[
dbc.Label(
class_name="p-0",
- children=self._show_tooltip(
+ children=show_tooltip(self._tooltips,
"help-cadence", "Cadence"),
),
dbc.RadioItems(
children=[
dbc.Label(
class_name="p-0",
- children=self._show_tooltip(
+ children=show_tooltip(self._tooltips,
"help-tbed", "Test Bed"),
),
dbc.Select(
children=[
dbc.Label(
class_name="gy-1",
- children=self._show_tooltip(
+ children=show_tooltip(self._tooltips,
"help-time-period", "Time Period"),
),
dcc.DatePickerRange(
fig_passed, fig_duration = graph_statistics(self.data, job,
self.layout, start, end)
- if parsed_url:
- new_url = url_encode({
- "scheme": parsed_url["scheme"],
- "netloc": parsed_url["netloc"],
- "path": parsed_url["path"],
- "params": {
- "job": job,
- "start": start,
- "end": end
- }
- })
- else:
- new_url = str()
-
ret_val = [
ctrl_panel.panel,
fig_passed,
fig_duration,
- new_url
+ gen_new_url(
+ parsed_url,
+ {
+ "job": job,
+ "start": start,
+ "end": end
+ }
+ )
]
ret_val.extend(ctrl_panel.values())
return ret_val