[ENH] Display version + link to github

This commit is contained in:
Mikado8231
2023-11-25 13:08:53 +01:00
committed by Florian BEZANNIER
parent e63dfd3ef5
commit b158373eec
3 changed files with 19 additions and 3 deletions
+4
View File
@@ -148,3 +148,7 @@ config.json
test.json
charge_config.json
cars.json
certs/
*.log.*
.vscode/
+2 -1
View File
@@ -76,7 +76,8 @@ def config_flask(title, base_path, debug: bool, host, port, reloader=False, # p
else:
application = DispatcherMiddleware(Flask('dummy_app'), {base_path: app})
requests_pathname_prefix = base_path + "/"
dash_app = DashCustom(external_stylesheets=[dbc.themes.BOOTSTRAP], external_scripts=locale_url, title=title,
dash_app = DashCustom(external_stylesheets=[dbc.themes.BOOTSTRAP, dbc.icons.BOOTSTRAP],
external_scripts=locale_url, title=title,
server=app, requests_pathname_prefix=requests_pathname_prefix,
suppress_callback_exceptions=True, serve_locally=False)
dash_app.enable_dev_tools(debug)
+13 -2
View File
@@ -30,6 +30,7 @@ from psa_car_controller.web.view.config_views import log_layout, config_layout
from psa_car_controller.web.tools.figurefilter import FigureFilter
from psa_car_controller.web.view.control import get_control_tabs
from psa_car_controller import __version__
logger = CustomLogger.getLogger(__name__)
EMPTY_DIV = "empty-div"
@@ -46,11 +47,21 @@ def get_default_car() -> Car:
def add_header(el):
version = "v" + __version__
github_url= "https://github.com/flobz/psa_car_controller/releases/tag/"+version
dbc_version = dbc.Button(html.I(version, className="m-1"),
size='sm',
color="secondary",
className="me-1 bi bi-github",
external_link =True, href=github_url)
return dbc.Row([dbc.Col(dcc.Link(html.H1('My car info'), href=dash_app.requests_pathname_external_prefix,
style={"TextDecoration": "none"})),
dbc.Col(dcc.Link(html.Img(src="assets/images/settings.svg", width="30veh"),
dbc.Col(html.Div([dbc_version,
dcc.Link(html.Img(src="assets/images/settings.svg", width="30veh"),
href=dash_app.requests_pathname_external_prefix + "config",
className="float-end"))]), el
className="float-end")],
className="d-grid gap-2 d-md-flex justify-content-md-end",))],
className='align-items-center'), el
@dash_app.callback(Output('page-content', 'children'),