forked from oss-aspen/8Knot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.py
51 lines (43 loc) · 1.39 KB
/
index.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
from dash import html, callback_context
from dash.dependencies import Input, Output
import plotly.express as px
from json import dumps
from app import app
from app import server
# import page files from project.
from pages import start, overview, cicd
app.layout = html.Div(children=[
html.H1(children="Sandiego Explorer Demo Multipage"),
html.H3(children="Report issues to [email protected], topic: Explorer Issue"),
html.Div(children=[
html.Button("Start Page", id="start-page", n_clicks=0),
html.Button("Overview Page", id="overview-page", n_clicks=0),
html.Button("CI/CD Page", id="cicd-page", n_clicks=0)
]),
html.Div(id='display-page')
])
"""
Page Callbacks
"""
@app.callback(
Output('display-page', 'children'),
Input('start-page', 'n_clicks'),
Input('overview-page', 'n_clicks'),
Input('cicd-page', 'n_clicks')
)
def return_template(_start, _overview, _cicd):
ctx = callback_context
caller = ctx.triggered[0]["prop_id"]
# default caller on first execution.
if caller == ".":
return start.layout
else:
call_name = caller.split(".")[0]
name_dict = {
"start-page": start.layout,
"overview-page": overview.layout,
"cicd-page": cicd.layout
}
return name_dict[call_name]
if __name__ == "__main__":
app.run_server(host="0.0.0.0", port=8050, debug=True)