-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroutes.py
33 lines (29 loc) · 1.06 KB
/
routes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import dash_bootstrap_components as dbc
from dash import html
from dash_extensions.enrich import Output, Input, State
from app import app
from utils.constants import home_page_location, dms_page_location, analyse_page_location
from pages.home import home
from pages.dms import dms
from dms.dms import SingletonClass
from pages.analyse import analyse
@app.callback(
Output("page-content", "children"),
Output('uploaded-files-checklist', 'value'),
[Input("url", "pathname")])
def render_page_content(pathname):
selected = SingletonClass().selected
if pathname == home_page_location:
return home.layout, selected
elif pathname == dms_page_location:
return dms.layout, selected
elif pathname == analyse_page_location:
return analyse.layout, selected
# If the user tries to reach a different page, return a 404 message
return dbc.Jumbotron(
[
html.H1("404: Not found", className="text-danger"),
html.Hr(),
html.P(f"The pathname {pathname} was not recognised..."),
]
)