Commit 09b98717 authored by Samuël Weber's avatar Samuël Weber
Browse files

match component via search instead of full pathname

parent 2f3cfbfd
......@@ -118,32 +118,32 @@ layout = dbc.Container(
[
dbc.ListGroupItemHeading("Raw data"),
dbc.NavLink('Timeserie',
href="/results/rd_ts", id='item-rd_ts', n_clicks=0),
href="/results?component=rd_ts", id='item-rd_ts', n_clicks=0),
dbc.NavLink('Montlhy',
href="/results/rd_monthly", id='item-rd_monthly', n_clicks=0),
href="/results?component=rd_monthly", id='item-rd_monthly', n_clicks=0),
dbc.NavLink('Seasonal',
href="/results/rd_seasonal", id='item-rd_seasonal', n_clicks=0),
href="/results?component=rd_seasonal", id='item-rd_seasonal', n_clicks=0),
dbc.ListGroupItemHeading("PMF factor chemistry"),
dbc.NavLink('Profiles comparison',
href='/results/pmf_profiles', id='item-pmf_profiles', n_clicks=0),
href='/results?component=pmf_profiles', id='item-pmf_profiles', n_clicks=0),
dbc.NavLink('DeltaTool',
href="/results/pmf_deltatool", id='item-pmf_deltatool', n_clicks=0),
href="/results?component=pmf_deltatool", id='item-pmf_deltatool', n_clicks=0),
dbc.NavLink('Uncertainties',
href="/results/pmf_unc", id='item-pmf_unc', n_clicks=0),
href="/results?component=pmf_unc", id='item-pmf_unc', n_clicks=0),
dbc.NavLink('Species repartition',
href="/results/pmf_speciesrepartition", id='item-pmf_speciesrepartition', n_clicks=0),
href="/results?component=pmf_speciesrepartition", id='item-pmf_speciesrepartition', n_clicks=0),
dbc.ListGroupItemHeading("OP model"),
dbc.NavLink('Obs. vs. model',
href="/results/op_obsvsmodel", id='item-op_obsvsmodel', n_clicks=0),
href="/results?component=op_obsvsmodel", id='item-op_obsvsmodel', n_clicks=0),
dbc.NavLink('Intrinsic OP',
href="/results/op_beta", id='item-op_beta', n_clicks=0),
href="/results?component=op_beta", id='item-op_beta', n_clicks=0),
dbc.NavLink('OP contribution (all)',
href="/results/op_contrib", id='item-op_contrib', n_clicks=0),
href="/results?component=op_contrib", id='item-op_contrib', n_clicks=0),
dbc.NavLink('OP contribution (timeseries)',
href="/results/op_contrib_ts", id='item-op_contrib_ts', n_clicks=0),
href="/results?component=op_contrib_ts", id='item-op_contrib_ts', n_clicks=0),
dbc.ListGroupItemHeading("I need help!"),
dbc.NavLink("Don't worry, click here.",
href="/results/help", id="item-help", n_clicks=0)
href="/results?component=help", id="item-help", n_clicks=0)
],
vertical=True,
pills=True
......@@ -172,13 +172,13 @@ layout = dbc.Container(
# corresponding nav link to true, allowing users to tell see page they are on
@app.callback(
[Output(f"item-{i}", "active") for i in PAGES],
[Input("master-url", "pathname")],
[Input("master-url", "search")],
)
def toggle_active_links(pathname):
if pathname == "/results":
def toggle_active_links(search):
if search == "":
# Treat page 1 as the homepage / index
return [False]*(len(PAGES)-1) + [True]
return [pathname == f"/results/{i}" for i in PAGES]
return [search == f"?component={i}" for i in PAGES]
@app.callback(
Output("items-collapse", "is_open"),
......@@ -306,14 +306,14 @@ def update_op_contribution_ts_station_dropdown(value):
Output('OP-dropdown', 'disabled'),
],
[
Input("master-url", "pathname")
Input("master-url", "search")
]
)
def get_graph_component(url):
def get_graph_component(search):
"""TODO: Docstring for get_graph_component.
"""
clicked = url.split("/")[-1]
clicked = search.split("=")[-1]
if clicked not in BUTTONS:
raise PreventUpdate
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment