-# 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:
from ..utils.constants import Constants as C
from ..utils.control_panel import ControlPanel
from ..utils.utils import show_tooltip, gen_new_url, get_ttypes, get_cadences, \
- get_test_beds, get_job, generate_options, set_job_params
+ get_test_beds, get_job, generate_options, set_job_params, navbar_trending
from ..utils.url_processing import url_decode
from .graphs import graph_statistics, select_data
dbc.Row(
id="row-navbar",
class_name="g-0",
- children=[
- self._add_navbar()
- ]
+ children=[navbar_trending((False, False, True, False))]
),
dbc.Spinner(
dbc.Offcanvas(
]
)
- 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.TREND_TITLE,
- external_link=True,
- href="/trending"
- )),
- dbc.NavItem(dbc.NavLink(
- C.NEWS_TITLE,
- external_link=True,
- href="/news"
- )),
- dbc.NavItem(dbc.NavLink(
- C.STATS_TITLE,
- active=True,
- external_link=True,
- href="/stats"
- )),
- 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.
children=[
dbc.InputGroup(
[
- dbc.InputGroupText(
- children=show_tooltip(
- self._tooltips,
- "help-dut",
- "DUT"
- )
- ),
+ dbc.InputGroupText(show_tooltip(
+ self._tooltips,
+ "help-dut",
+ "DUT"
+ )),
dbc.RadioItems(
id="ri-duts",
inline=True,
children=[
dbc.InputGroup(
[
- dbc.InputGroupText(
- children=show_tooltip(
- self._tooltips,
- "help-ttype",
- "Test Type"
- )
- ),
+ dbc.InputGroupText(show_tooltip(
+ self._tooltips,
+ "help-ttype",
+ "Test Type"
+ )),
dbc.RadioItems(
id="ri-ttypes",
inline=True,
children=[
dbc.InputGroup(
[
- dbc.InputGroupText(
- children=show_tooltip(
- self._tooltips,
- "help-cadence",
- "Cadence"
- )
- ),
+ dbc.InputGroupText(show_tooltip(
+ self._tooltips,
+ "help-cadence",
+ "Cadence"
+ )),
dbc.RadioItems(
id="ri-cadences",
inline=True,
children=[
dbc.InputGroup(
[
- dbc.InputGroupText(
- children=show_tooltip(
- self._tooltips,
- "help-tbed",
- "Test Bed"
- )
- ),
+ dbc.InputGroupText(show_tooltip(
+ self._tooltips,
+ "help-tbed",
+ "Test Bed"
+ )),
dbc.Select(
id="dd-tbeds",
placeholder="Select a test bed...",
Input("dd-tbeds", "value"),
Input("url", "href")
)
- def _update_ctrl_panel(cp_data: dict, dut: str, ttype: str, cadence:str,
- tbed: str, href: str) -> tuple:
+ def _update_ctrl_panel(cp_data: dict, dut: str, ttype: str,
+ cadence: str, tbed: str, href: str) -> tuple:
"""Update the application when the event is detected.
:param cp_data: Current status of the control panel stored in
ctrl_panel.set(
{
"al-job-children": html.A(
- self._default["job"],
- href=f"{C.URL_JENKINS}{self._default['job']}",
+ job,
+ href=f"{C.URL_JENKINS}{job}",
target="_blank"
)
}