-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.py
More file actions
89 lines (77 loc) · 2.32 KB
/
index.py
File metadata and controls
89 lines (77 loc) · 2.32 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
"""index.py
Configure the Dash server and load the layout
This file loads the initial layout as well as handles custom url query page delivery.
"""
# import dash_core_components as dcc
from dash import dcc
# import dash_html_components as html
from dash import html
from dash.dependencies import Input, Output
from .app import app
from . import layouts as lay
from . import callbacks
from logging import getLogger, basicConfig, DEBUG, ERROR, INFO, WARNING
logger = getLogger(__name__)
def init_app():
"""
Configure initial layout
"""
# see https://dash.plot.ly/external-resources to alter header, footer and favicon
app.index_string = '''
<!DOCTYPE html>
<html>
<head>
{%metas%}
<title>EPMT Job Display</title>
{%favicon%}
{%css%}
</head>
<body>
{%app_entry%}
<footer>
{%config%}
{%scripts%}
{%renderer%}
</footer>
</body>
</html>
'''
# <img src="\\assets\\cc_logo.jpeg" width="120" height="120">
app.layout = html.Div([
dcc.Location(id='url', refresh=False),
html.Div(id='page-content')
])
# Update page
# # # # # # # # #
@app.callback(Output('page-content', 'children'),
[Input('url', 'pathname'),
Input('url', 'href')])
def display_page(pathname, pfullurl):
"""Method:
For displaying/returning all layouts as requested by url
"""
logger.info("Page requested {}".format(pfullurl))
app.fullurl = pfullurl
if pathname in ['', '/']:
return lay.recent_jobs_page
elif pathname == '/unprocessed/':
return lay.layout_unprocessed
elif pathname == '/alerts/':
return lay.layout_alerts
elif pathname == '/refs/':
return lay.layout_references
elif pathname == '/jobs':
return lay.layouts(pfullurl)
elif str(pathname).startswith('/graph'):
return lay.graph_plotly(pfullurl)
elif str(pathname).startswith('/compare'):
return lay.compare(pfullurl)
elif pathname == '/multilayout':
return lay.multi_flow(pfullurl)
else:
return lay.noPage
if __name__ == '__main__':
logger = getLogger(__name__)
basicConfig(level=DEBUG)
init_app()
app.run_server(debug=True, host='0.0.0.0')