aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/dash/app/pal/stats
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2022-07-21 13:40:50 +0200
committerTibor Frank <tifrank@cisco.com>2022-07-21 13:40:50 +0200
commitaa9f6d2b4d417b439e2953a9c82c31b0d561f632 (patch)
tree39e7ec4ed6199b332ae7ab5ac59510e677e1e144 /resources/tools/dash/app/pal/stats
parentae1fe880286d7b0414664bce2b2c7c91c3f543f3 (diff)
UTI: Move common functions to utils.
Change-Id: Ic390359afcea7855a964f8f9793f6d17a5b9b616 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.py68
1 files changed, 21 insertions, 47 deletions
diff --git a/resources/tools/dash/app/pal/stats/layout.py b/resources/tools/dash/app/pal/stats/layout.py
index 03707c0394..a0920a4ec0 100644
--- a/resources/tools/dash/app/pal/stats/layout.py
+++ b/resources/tools/dash/app/pal/stats/layout.py
@@ -29,7 +29,8 @@ 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 ..utils.utils import show_tooltip, gen_new_url
+from ..utils.url_processing import url_decode
from ..data.data import Data
from .graphs import graph_statistics, select_data
@@ -261,29 +262,6 @@ class Layout:
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):
"""
"""
@@ -408,7 +386,7 @@ class Layout:
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"
@@ -425,8 +403,11 @@ class Layout:
children=[
dbc.InputGroupText(
style=C.URL_STYLE,
- children=self._show_tooltip(
- "help-url", "URL", "input-url")
+ children=show_tooltip(
+ self._tooltips,
+ "help-url", "URL",
+ "input-url"
+ )
),
dbc.Input(
id="input-url",
@@ -460,7 +441,7 @@ class Layout:
children=[
dbc.Label(
class_name="p-0",
- children=self._show_tooltip(
+ children=show_tooltip(self._tooltips,
"help-dut", "Device under Test")
),
dbc.Row(
@@ -478,7 +459,7 @@ class Layout:
children=[
dbc.Label(
class_name="p-0",
- children=self._show_tooltip(
+ children=show_tooltip(self._tooltips,
"help-ttype", "Test Type"),
),
dbc.RadioItems(
@@ -494,7 +475,7 @@ class Layout:
children=[
dbc.Label(
class_name="p-0",
- children=self._show_tooltip(
+ children=show_tooltip(self._tooltips,
"help-cadence", "Cadence"),
),
dbc.RadioItems(
@@ -510,7 +491,7 @@ class Layout:
children=[
dbc.Label(
class_name="p-0",
- children=self._show_tooltip(
+ children=show_tooltip(self._tooltips,
"help-tbed", "Test Bed"),
),
dbc.Select(
@@ -536,7 +517,7 @@ class Layout:
children=[
dbc.Label(
class_name="gy-1",
- children=self._show_tooltip(
+ children=show_tooltip(self._tooltips,
"help-time-period", "Time Period"),
),
dcc.DatePickerRange(
@@ -729,25 +710,18 @@ class Layout:
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