aboutsummaryrefslogtreecommitdiffstats
path: root/csit.infra.dash/app/cdash/comparisons
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2024-02-20 11:04:48 +0000
committerTibor Frank <tifrank@cisco.com>2024-02-28 14:15:28 +0000
commit7d3054dede4f630e9b20ac0e69f029bea93bdf5f (patch)
tree1dfa9c41fd326a822a0aeefab8982a5fda61f051 /csit.infra.dash/app/cdash/comparisons
parent0e11b36be7f77578ecab1fc6a4fb6ac16e615b8f (diff)
C-Dash: Add search in testsoper-240304
Change-Id: Ia250c4b4e299d48bc68cf01e65fe37a281047060 Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'csit.infra.dash/app/cdash/comparisons')
-rw-r--r--csit.infra.dash/app/cdash/comparisons/__init__.py2
-rw-r--r--csit.infra.dash/app/cdash/comparisons/comparisons.py2
-rw-r--r--csit.infra.dash/app/cdash/comparisons/layout.py50
-rw-r--r--csit.infra.dash/app/cdash/comparisons/tables.py64
4 files changed, 9 insertions, 109 deletions
diff --git a/csit.infra.dash/app/cdash/comparisons/__init__.py b/csit.infra.dash/app/cdash/comparisons/__init__.py
index f0d52c25b6..c6a5f639fe 100644
--- a/csit.infra.dash/app/cdash/comparisons/__init__.py
+++ b/csit.infra.dash/app/cdash/comparisons/__init__.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2023 Cisco and/or its affiliates.
+# Copyright (c) 2024 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
diff --git a/csit.infra.dash/app/cdash/comparisons/comparisons.py b/csit.infra.dash/app/cdash/comparisons/comparisons.py
index bc42085dc8..01319ada77 100644
--- a/csit.infra.dash/app/cdash/comparisons/comparisons.py
+++ b/csit.infra.dash/app/cdash/comparisons/comparisons.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2023 Cisco and/or its affiliates.
+# Copyright (c) 2024 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
diff --git a/csit.infra.dash/app/cdash/comparisons/layout.py b/csit.infra.dash/app/cdash/comparisons/layout.py
index 0680cc3d06..45bc75aca1 100644
--- a/csit.infra.dash/app/cdash/comparisons/layout.py
+++ b/csit.infra.dash/app/cdash/comparisons/layout.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2023 Cisco and/or its affiliates.
+# Copyright (c) 2024 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@ -28,8 +28,9 @@ from ..utils.constants import Constants as C
from ..utils.control_panel import ControlPanel
from ..utils.trigger import Trigger
from ..utils.url_processing import url_decode
-from ..utils.utils import generate_options, gen_new_url
-from .tables import comparison_table, filter_table_data
+from ..utils.utils import generate_options, gen_new_url, navbar_report, \
+ filter_table_data
+from .tables import comparison_table
# Control panel partameters and their default values.
@@ -194,9 +195,7 @@ class Layout:
dbc.Row(
id="row-navbar",
class_name="g-0",
- children=[
- self._add_navbar()
- ]
+ children=[navbar_report((False, True, False, False)), ]
),
dbc.Row(
id="row-main",
@@ -238,43 +237,6 @@ class Layout:
]
)
- def _add_navbar(self):
- """Add nav element with navigation panel. It is placed on the top.
-
- :returns: Navigation bar.
- :rtype: dbc.NavbarSimple
- """
- return dbc.NavbarSimple(
- id="navbarsimple-main",
- children=[
- dbc.NavItem(dbc.NavLink(
- C.REPORT_TITLE,
- external_link=True,
- href="/report"
- )),
- dbc.NavItem(dbc.NavLink(
- "Comparisons",
- active=True,
- external_link=True,
- href="/comparisons"
- )),
- dbc.NavItem(dbc.NavLink(
- "Coverage Data",
- external_link=True,
- href="/coverage"
- )),
- dbc.NavItem(dbc.NavLink(
- "Documentation",
- id="btn-documentation",
- ))
- ],
- brand=C.BRAND,
- brand_href="/",
- brand_external_link=True,
- class_name="p-2",
- fluid=True
- )
-
def _add_ctrl_col(self) -> dbc.Col:
"""Add column with controls. It is placed on the left side.
@@ -539,7 +501,7 @@ class Layout:
) -> list:
"""Generate the plotting area with all its content.
- :param title: The title of the comparison table..
+ :param title: The title of the comparison table.
:param table: Comparison table to be displayed.
:param url: URL to be displayed in the modal window.
:type title: str
diff --git a/csit.infra.dash/app/cdash/comparisons/tables.py b/csit.infra.dash/app/cdash/comparisons/tables.py
index 8c19d3c776..ab99f1839d 100644
--- a/csit.infra.dash/app/cdash/comparisons/tables.py
+++ b/csit.infra.dash/app/cdash/comparisons/tables.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2023 Cisco and/or its affiliates.
+# Copyright (c) 2024 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@ -309,65 +309,3 @@ def comparison_table(
)
return (title, df_cmp)
-
-
-def filter_table_data(
- store_table_data: list,
- table_filter: str
- ) -> list:
- """Filter table data using user specified filter.
-
- :param store_table_data: Table data represented as a list of records.
- :param table_filter: User specified filter.
- :type store_table_data: list
- :type table_filter: str
- :returns: A new table created by filtering of table data represented as
- a list of records.
- :rtype: list
- """
-
- # Checks:
- if not any((table_filter, store_table_data, )):
- return store_table_data
-
- def _split_filter_part(filter_part: str) -> tuple:
- """Split a part of filter into column name, operator and value.
- A "part of filter" is a sting berween "&&" operator.
-
- :param filter_part: A part of filter.
- :type filter_part: str
- :returns: Column name, operator, value
- :rtype: tuple[str, str, str|float]
- """
- for operator_type in C.OPERATORS:
- for operator in operator_type:
- if operator in filter_part:
- name_p, val_p = filter_part.split(operator, 1)
- name = name_p[name_p.find("{") + 1 : name_p.rfind("}")]
- val_p = val_p.strip()
- if (val_p[0] == val_p[-1] and val_p[0] in ("'", '"', '`')):
- value = val_p[1:-1].replace("\\" + val_p[0], val_p[0])
- else:
- try:
- value = float(val_p)
- except ValueError:
- value = val_p
-
- return name, operator_type[0].strip(), value
- return (None, None, None)
-
- df = pd.DataFrame.from_records(store_table_data)
- for filter_part in table_filter.split(" && "):
- col_name, operator, filter_value = _split_filter_part(filter_part)
- if operator == "contains":
- df = df.loc[df[col_name].str.contains(filter_value, regex=True)]
- elif operator in ("eq", "ne", "lt", "le", "gt", "ge"):
- # These operators match pandas series operator method names.
- df = df.loc[getattr(df[col_name], operator)(filter_value)]
- elif operator == "datestartswith":
- # This is a simplification of the front-end filtering logic,
- # only works with complete fields in standard format.
- # Currently not used in comparison tables.
- df = df.loc[df[col_name].str.startswith(filter_value)]
-
- return df.to_dict("records")