From ed6d1c87d1328dbccdc6656644a68531783c9ddc Mon Sep 17 00:00:00 2001 From: Bertrand Benjamin Date: Sat, 27 Jul 2024 15:55:20 +0200 Subject: [PATCH] feat: init dashboard --- dashboard/app.py | 17 +++++++++++++++++ dashboard/pages/config.py | 17 +++++++++++++++++ dashboard/pages/home.py | 9 +++++++++ 3 files changed, 43 insertions(+) create mode 100644 dashboard/app.py create mode 100644 dashboard/pages/config.py create mode 100644 dashboard/pages/home.py diff --git a/dashboard/app.py b/dashboard/app.py new file mode 100644 index 0000000..7af5c57 --- /dev/null +++ b/dashboard/app.py @@ -0,0 +1,17 @@ +import dash +from dash import Dash, html, dcc + +app = Dash(__name__, use_pages=True) + +app.layout = html.Div([ + html.H1('Plesna'), + html.Div([ + html.Div( + dcc.Link(f"{page['name']} - {page['path']}", href=page["relative_path"]) + ) for page in dash.page_registry.values() + ]), + dash.page_container +]) + +if __name__ == '__main__': + app.run(debug=True) diff --git a/dashboard/pages/config.py b/dashboard/pages/config.py new file mode 100644 index 0000000..47a3bf7 --- /dev/null +++ b/dashboard/pages/config.py @@ -0,0 +1,17 @@ +import dash +from dash import html +from dotenv import dotenv_values +import os + +env = { + **dotenv_values(".env"), + **os.environ, +} + + +dash.register_page(__name__, path='/config') + +layout = html.Div([ + html.H1('This is our Config page'), + html.Ul(children = [html.Li(f"{k} = {v}") for k,v in env.items()]), +]) diff --git a/dashboard/pages/home.py b/dashboard/pages/home.py new file mode 100644 index 0000000..69f06c4 --- /dev/null +++ b/dashboard/pages/home.py @@ -0,0 +1,9 @@ +import dash +from dash import html + +dash.register_page(__name__, path='/') + +layout = html.Div([ + html.H1('This is our Home page'), + html.Div('This is our Home page content.'), +])