diff options
author | Tibor Frank <tifrank@cisco.com> | 2024-02-20 11:04:48 +0000 |
---|---|---|
committer | Tibor Frank <tifrank@cisco.com> | 2024-02-28 14:15:28 +0000 |
commit | 7d3054dede4f630e9b20ac0e69f029bea93bdf5f (patch) | |
tree | 1dfa9c41fd326a822a0aeefab8982a5fda61f051 /csit.infra.dash/app/cdash/coverage | |
parent | 0e11b36be7f77578ecab1fc6a4fb6ac16e615b8f (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/coverage')
-rw-r--r-- | csit.infra.dash/app/cdash/coverage/__init__.py | 2 | ||||
-rw-r--r-- | csit.infra.dash/app/cdash/coverage/coverage.py | 2 | ||||
-rw-r--r-- | csit.infra.dash/app/cdash/coverage/layout.py | 45 | ||||
-rw-r--r-- | csit.infra.dash/app/cdash/coverage/tables.py | 26 |
4 files changed, 24 insertions, 51 deletions
diff --git a/csit.infra.dash/app/cdash/coverage/__init__.py b/csit.infra.dash/app/cdash/coverage/__init__.py index f0d52c25b6..c6a5f639fe 100644 --- a/csit.infra.dash/app/cdash/coverage/__init__.py +++ b/csit.infra.dash/app/cdash/coverage/__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/coverage/coverage.py b/csit.infra.dash/app/cdash/coverage/coverage.py index 4dfd7a80de..3388d48ad8 100644 --- a/csit.infra.dash/app/cdash/coverage/coverage.py +++ b/csit.infra.dash/app/cdash/coverage/coverage.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/coverage/layout.py b/csit.infra.dash/app/cdash/coverage/layout.py index a2d51d46a3..8ebda5e127 100644 --- a/csit.infra.dash/app/cdash/coverage/layout.py +++ b/csit.infra.dash/app/cdash/coverage/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: @@ -29,7 +29,7 @@ from ast import literal_eval from ..utils.constants import Constants as C from ..utils.control_panel import ControlPanel from ..utils.trigger import Trigger -from ..utils.utils import label, gen_new_url, generate_options +from ..utils.utils import label, gen_new_url, generate_options, navbar_report from ..utils.url_processing import url_decode from .tables import coverage_tables, select_coverage_data @@ -161,9 +161,7 @@ class Layout: dbc.Row( id="row-navbar", class_name="g-0", - children=[ - self._add_navbar() - ] + children=[navbar_report((False, False, True, False)), ] ), dbc.Row( id="row-main", @@ -203,43 +201,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", - external_link=True, - href="/comparisons" - )), - dbc.NavItem(dbc.NavLink( - "Coverage Data", - active=True, - 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. diff --git a/csit.infra.dash/app/cdash/coverage/tables.py b/csit.infra.dash/app/cdash/coverage/tables.py index 372a8206bf..84adb091a1 100644 --- a/csit.infra.dash/app/cdash/coverage/tables.py +++ b/csit.infra.dash/app/cdash/coverage/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: @@ -57,7 +57,7 @@ def select_coverage_data( topo, arch, nic, drv = phy drv_str = "" if drv == "dpdk" else drv.replace("_", "-") else: - return l_data + return l_data, None df = pd.DataFrame(data.loc[( (data["passed"] == True) & @@ -78,8 +78,10 @@ def select_coverage_data( df[df.test_id.str.contains(f"-{driver}-")].index, inplace=True ) - - ttype = df["test_type"].to_list()[0] + try: + ttype = df["test_type"].to_list()[0] + except IndexError: + return l_data, None # Prepare the coverage data def _latency(hdrh_string: str, percentile: float) -> int: @@ -177,16 +179,20 @@ def select_coverage_data( def coverage_tables( data: pd.DataFrame, selected: dict, - show_latency: bool=True - ) -> list: + show_latency: bool=True, + start_collapsed: bool=True + ) -> dbc.Accordion: """Generate an accordion with coverage tables. :param data: Coverage data. :param selected: Dictionary with user selection. :param show_latency: If True, latency is displayed in the tables. + :param start_collapsed: If True, the accordion with tables is collapsed when + displayed. :type data: pandas.DataFrame :type selected: dict :type show_latency: bool + :type start_collapsed: bool :returns: Accordion with suite names (titles) and tables. :rtype: dash_bootstrap_components.Accordion """ @@ -295,9 +301,15 @@ def coverage_tables( ) ) ) + if not accordion_items: + accordion_items.append(dbc.AccordionItem( + title="No data.", + children="No data." + )) + start_collapsed = True return dbc.Accordion( children=accordion_items, class_name="gy-1 p-0", - start_collapsed=True, + start_collapsed=start_collapsed, always_open=True ) |