Skip to content

Commit

Permalink
[ENH] Display version + link to github
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikado8231 committed Nov 16, 2023
1 parent 8b0c625 commit 78f566c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,7 @@ config.json
test.json
charge_config.json
cars.json
certs/
*.log.*

.vscode/
3 changes: 2 additions & 1 deletion psa_car_controller/web/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
15 changes: 13 additions & 2 deletions psa_car_controller/web/view/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
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"
Expand All @@ -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'),
Expand Down

0 comments on commit 78f566c

Please sign in to comment.