mirror of
https://github.com/flobz/psa_car_controller.git
synced 2026-08-22 09:26:16 +00:00
update config layout
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
import pkg_resources
|
||||
from pathlib import Path
|
||||
@@ -12,7 +13,6 @@ class TestRequirements:
|
||||
|
||||
def test_requirements(self):
|
||||
"""Test that each required package is available."""
|
||||
# Ref: https://stackoverflow.com/a/45474387/
|
||||
requirements = pkg_resources.parse_requirements(self.requirement_path.open())
|
||||
missing_requirement = False
|
||||
for requirement in requirements:
|
||||
@@ -20,6 +20,7 @@ class TestRequirements:
|
||||
try:
|
||||
pkg_resources.require(requirement)
|
||||
except pkg_resources.VersionConflict:
|
||||
logger.debug(traceback.format_exc())
|
||||
logger.error("You need to install or update some dependencies: pip3 install -U %s", requirement)
|
||||
missing_requirement=True
|
||||
if missing_requirement:
|
||||
|
||||
@@ -108,10 +108,11 @@ def log_layout():
|
||||
html.Div(id="empty-div")])
|
||||
|
||||
|
||||
config_layout = dbc.Tabs([
|
||||
dbc.Tab([log_layout()], label="Log"),
|
||||
dbc.Tab([login_config_layout], label="User config"),
|
||||
dbc.Tab([config_otp_layout], label="OTP config")])
|
||||
def config_layout(activeTabs="log"):
|
||||
return dbc.Tabs(active_tab=activeTabs, children=[
|
||||
dbc.Tab([log_layout()], label="Log", tab_id="log"),
|
||||
dbc.Tab([login_config_layout], label="User config", tab_id="login"),
|
||||
dbc.Tab([config_otp_layout], label="OTP config", tab_id="otp")])
|
||||
|
||||
|
||||
@dash_app.callback(
|
||||
|
||||
+4
-4
@@ -19,7 +19,7 @@ from web import figures
|
||||
|
||||
from web.app import app, dash_app
|
||||
from web.db import Database
|
||||
from web.view.config_views import login_config_layout, config_otp_layout, log_layout, config_layout
|
||||
from web.view.config_views import log_layout, config_layout
|
||||
from web.utils import diff_dashtable, dash_date_to_datetime
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
@@ -52,15 +52,15 @@ def display_page(pathname, search):
|
||||
query_params = parse_qs(urlparse(search).query)
|
||||
no_header = query_params.get("header", None) == ["false"]
|
||||
if pathname == "/config":
|
||||
page = config_layout
|
||||
page = config_layout()
|
||||
elif pathname == "/config_login":
|
||||
page = login_config_layout
|
||||
page = config_layout("login")
|
||||
elif pathname == "/log":
|
||||
page = log_layout()
|
||||
elif not CONFIG.is_good:
|
||||
page = dcc.Location(pathname=dash_app.requests_pathname_external_prefix + "config_login", id="config_redirect")
|
||||
elif pathname == "/config_otp":
|
||||
page = config_otp_layout
|
||||
page = config_layout("otp")
|
||||
elif pathname == "/control":
|
||||
page = get_control_tabs(CONFIG)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user