aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/dash/app/pal/trending
diff options
context:
space:
mode:
authorPeter Mikus <pmikus@cisco.com>2022-04-12 15:36:22 +0200
committerPeter Mikus <pmikus@cisco.com>2022-04-13 08:12:07 +0000
commit45615cddd926540756f19328cad7078cfc9a1219 (patch)
tree045f7f3f3bbcd2da7db4e9a2dccf4b155eb0867c /resources/tools/dash/app/pal/trending
parentc65595288367e8e6f53d225812d55ca4d90cdab2 (diff)
feat(uti): Refactor styling
Signed-off-by: Peter Mikus <pmikus@cisco.com> Change-Id: I7880e58b2b97b1c365da7755784d3f93e85568cc
Diffstat (limited to 'resources/tools/dash/app/pal/trending')
-rw-r--r--resources/tools/dash/app/pal/trending/html_layout.txt29
-rw-r--r--resources/tools/dash/app/pal/trending/layout.py18
-rw-r--r--resources/tools/dash/app/pal/trending/trending.py8
3 files changed, 21 insertions, 34 deletions
diff --git a/resources/tools/dash/app/pal/trending/html_layout.txt b/resources/tools/dash/app/pal/trending/html_layout.txt
deleted file mode 100644
index 3f0aa0cb8d..0000000000
--- a/resources/tools/dash/app/pal/trending/html_layout.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- {%metas%}
- <title>Continuous Performance Trending</title>
- {%favicon%}
- {%css%}
- </head>
- <body class="dash-template">
- <header>
- <div class="nav-wrapper">
- <a href="/">
- <h1>FD.io CSIT</h1>
- </a>
- <a href="">
- <h1>Continuous Performance Trending</h1>
- </a>
- <nav>
- </nav>
- </div>
- </header>
- {%app_entry%}
- <footer>
- {%config%}
- {%scripts%}
- {%renderer%}
- </footer>
- </body>
-</html>
diff --git a/resources/tools/dash/app/pal/trending/layout.py b/resources/tools/dash/app/pal/trending/layout.py
index afa459bf76..66af2f0de2 100644
--- a/resources/tools/dash/app/pal/trending/layout.py
+++ b/resources/tools/dash/app/pal/trending/layout.py
@@ -21,6 +21,7 @@ from dash import html
from dash import callback_context, no_update
from dash import Input, Output, State
from dash.exceptions import PreventUpdate
+import dash_bootstrap_components as dbc
from yaml import load, FullLoader, YAMLError
from datetime import datetime, timedelta
@@ -136,6 +137,7 @@ class Layout:
id="div-main",
children=[
dcc.Store(id="selected-tests"),
+ self._add_navbar(),
self._add_ctrl_div(),
self._add_plotting_div()
]
@@ -146,6 +148,22 @@ class Layout:
children="An Error Occured."
)
+ def _add_navbar(self):
+ """Add nav element with navigation panel. It is placed on the top.
+ """
+ return dbc.NavbarSimple(
+ children=[
+ dbc.NavItem(
+ dbc.NavLink("Continuous Performance Trending", href="#")
+ )
+ ],
+ brand="Dashboard",
+ brand_href="/",
+ color="dark",
+ dark=True,
+ fluid=True,
+ )
+
def _add_ctrl_div(self):
"""Add div with controls. It is placed on the left side.
"""
diff --git a/resources/tools/dash/app/pal/trending/trending.py b/resources/tools/dash/app/pal/trending/trending.py
index 7801e9cfeb..8abd2e1a8b 100644
--- a/resources/tools/dash/app/pal/trending/trending.py
+++ b/resources/tools/dash/app/pal/trending/trending.py
@@ -14,6 +14,7 @@
"""Instantiate the Trending Dash applocation.
"""
import dash
+import dash_bootstrap_components as dbc
from .layout import Layout
@@ -30,16 +31,13 @@ def init_trending(server):
dash_app = dash.Dash(
server=server,
routes_pathname_prefix=u"/trending/",
- external_stylesheets=[
- u"/static/dist/css/styles.css",
- u"https://fonts.googleapis.com/css?family=Lato",
- ],
+ external_stylesheets=[dbc.themes.BOOTSTRAP],
)
# Custom HTML layout
layout = Layout(
app=dash_app,
- html_layout_file="pal/trending/html_layout.txt",
+ html_layout_file="pal/templates/trending_layout.jinja2",
spec_file="pal/trending/spec_test_selection.yaml",
graph_layout_file="pal/trending/layout.yaml",
data_spec_file="pal/data/data.yaml"