Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENH] Display version + link to github #668

Merged
merged 2 commits into from
Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: 3 additions & 0 deletions psa_car_controller/psacc/application/car_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from .psa_client import PSAClient
from psa_car_controller.common.mylogger import my_logger
from psa_car_controller.psa.otp.otp import CONFIG_NAME as OTP_CONFIG_NAME, ConfigException
from psa_car_controller import __version__

DEFAULT_NAME = "config.json"

Expand Down Expand Up @@ -75,6 +76,8 @@ def start_remote_control(self):
def load_app(self) -> bool:
# pylint: disable=too-many-branches
my_logger(handler_level=int(self.args.debug))

logger.info("App version %s", __version__)
if self.args.config:
self.config_name = self.args.config
if path.isfile(self.config_name):
Expand Down
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
Loading