Skip to content

Commit cb4ea70

Browse files
authored
Merge pull request #256 from mwang87/ready-badges-update
Adding status buttons to look better
2 parents 4c1f762 + 8cd677f commit cb4ea70

File tree

1 file changed

+26
-20
lines changed

1 file changed

+26
-20
lines changed

app.py

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -403,45 +403,45 @@
403403
html.Tr([html.Td("File Download/Conversion"),
404404
html.Td(dcc.Loading(
405405
id="loading_file_download",
406-
children="Ready",
406+
children=html.H6([dbc.Badge("Ready", color="success", className="ml-1")]),
407407
type="dot"
408408
)
409409
),
410410
html.Td("XIC Drawing"),
411411
html.Td(
412412
dcc.Loading(
413413
id="loading_xic_plot",
414-
children="Ready",
414+
children=html.H6([dbc.Badge("Ready", color="success", className="ml-1")]),
415415
type="dot"
416416
)
417417
)]),
418418
html.Tr([html.Td("Heatmap Drawing Left"),
419419
html.Td(dcc.Loading(
420420
id="loading_map_plot",
421-
children="Ready",
421+
children=html.H6([dbc.Badge("Ready", color="success", className="ml-1")]),
422422
type="dot"
423423
)
424424
),
425425
html.Td("Heatmap Drawing Right"),
426426
html.Td(
427427
dcc.Loading(
428428
id="loading_map_plot2",
429-
children="Ready",
429+
children=html.H6([dbc.Badge("Ready", color="success", className="ml-1")]),
430430
type="dot"
431431
)
432432
)]),
433433
html.Tr([html.Td("TIC Drawing Left"),
434434
html.Td(dcc.Loading(
435435
id="loading_tic_plot",
436-
children="Ready",
436+
children=html.H6([dbc.Badge("Ready", color="success", className="ml-1")]),
437437
type="dot"
438438
)
439439
),
440440
html.Td("TIC Drawing Right"),
441441
html.Td(
442442
dcc.Loading(
443443
id="loading_tic_plot2",
444-
children="Ready",
444+
children=html.H6([dbc.Badge("Ready", color="success", className="ml-1")]),
445445
type="dot"
446446
)
447447
)])
@@ -2567,7 +2567,7 @@ def draw_tic(usi, usi_select, export_format, plot_theme, tic_option, polarity_fi
25672567
all_usi = usi.split("\n")
25682568

25692569
fig = dash.no_update
2570-
status = "No Data"
2570+
status = html.H6([dbc.Badge("No Data", color="secondary", className="ml-1")])
25712571

25722572
RENDER_MODE = "auto"
25732573
# Making sure the data in the browser is actually svg
@@ -2591,20 +2591,20 @@ def draw_tic(usi, usi_select, export_format, plot_theme, tic_option, polarity_fi
25912591
merged_tic_df = pd.concat(all_usi_tic_df)
25922592
try:
25932593
fig = px.line(merged_tic_df, x="rt", y="tic", title='TIC Plot', template=plot_theme, color="USI", render_mode=RENDER_MODE)
2594-
status = "Ready"
2594+
status = html.H6([dbc.Badge("Ready", color="success", className="ml-1")])
25952595
except:
25962596
fig = dash.no_update
2597-
status = "Draw Error"
2597+
status = html.H6([dbc.Badge("Draw Error", color="warning", className="ml-1")])
25982598
elif len(all_usi) > 0:
25992599
plot_usi = utils.determine_usi_to_use(usi, usi_select)
26002600

26012601
tic_df = _perform_tic(plot_usi, tic_option=tic_option, polarity_filter=polarity_filter)
26022602
try:
26032603
fig = px.line(tic_df, x="rt", y="tic", title='TIC Plot', template=plot_theme, render_mode=RENDER_MODE)
2604-
status = "Ready"
2604+
status = html.H6([dbc.Badge("Ready", color="success", className="ml-1")])
26052605
except:
26062606
fig = dash.no_update
2607-
status = "Draw Error"
2607+
status = html.H6([dbc.Badge("Draw Error", color="warning", className="ml-1")])
26082608

26092609

26102610

@@ -2640,7 +2640,7 @@ def draw_tic2(usi, export_format, plot_theme, tic_option, polarity_filter, show_
26402640
all_usi = [x for x in all_usi if len(x) > 2]
26412641

26422642
fig = dash.no_update
2643-
status = "No Data"
2643+
status = html.H6([dbc.Badge("No Data", color="secondary", className="ml-1")])
26442644

26452645
RENDER_MODE = "auto"
26462646
# Making sure the data in the browser is actually svg
@@ -2663,11 +2663,11 @@ def draw_tic2(usi, export_format, plot_theme, tic_option, polarity_filter, show_
26632663

26642664
merged_tic_df = pd.concat(all_usi_tic_df)
26652665
fig = px.line(merged_tic_df, x="rt", y="tic", title='TIC Plot', template=plot_theme, color="USI", render_mode=RENDER_MODE)
2666-
status = "Ready"
2666+
status = html.H6([dbc.Badge("Ready", color="success", className="ml-1")])
26672667
elif len(all_usi) > 0:
26682668
tic_df = _perform_tic(usi.split("\n")[0], tic_option=tic_option, polarity_filter=polarity_filter)
26692669
fig = px.line(tic_df, x="rt", y="tic", title='TIC Plot', template=plot_theme, render_mode=RENDER_MODE)
2670-
status = "Ready"
2670+
status = html.H6([dbc.Badge("Ready", color="success", className="ml-1")])
26712671

26722672
# For Drawing and Exporting
26732673
graph_config = {
@@ -3254,20 +3254,20 @@ def render_initial_file_load(usi, usi_select, usi2):
32543254
usi_list = usi1_list + usi2_list
32553255
usi_list = usi_list[:MAX_LCMS_FILES]
32563256

3257-
status = "Ready"
3257+
status = html.H6([dbc.Badge("Ready", color="success", className="ml-1")])
32583258
if len(usi1_list) > 0:
32593259
try:
32603260
plot_usi = utils.determine_usi_to_use(usi, usi_select)
32613261
_resolve_usi(plot_usi)
32623262
except:
3263-
status = "USI1 Loading Error"
3263+
status = html.H6([dbc.Badge("USI1 Loading Error", color="warning", className="ml-1")])
32643264
return [status]
32653265

32663266
if len(usi2_list) > 0:
32673267
try:
32683268
_resolve_usi(usi2_list[0])
32693269
except:
3270-
status = "USI2 Loading Error"
3270+
status = html.H6([dbc.Badge("USI1 Loading Error", color="warning", className="ml-1")])
32713271
return [status]
32723272

32733273
return [status]
@@ -3408,7 +3408,10 @@ def draw_file(url_search, usi, usi_select,
34083408
}
34093409
}
34103410

3411-
return [map_fig, graph_config, remote_link, table_graph, "Ready"]
3411+
# Writing output status
3412+
status = html.H6([dbc.Badge("Ready", color="success", className="ml-1")])
3413+
3414+
return [map_fig, graph_config, remote_link, table_graph, status]
34123415

34133416

34143417
@app.callback([
@@ -3432,7 +3435,8 @@ def draw_file2( usi,
34323435
show_ms2_markers, show_lcms_2nd_map, polarity_filter, export_format, plot_theme):
34333436

34343437
if show_lcms_2nd_map is False:
3435-
return [dash.no_update, dash.no_update, "Not Shown"]
3438+
status = html.H6([dbc.Badge("Not Shown", color="secondary", className="ml-1")])
3439+
return [dash.no_update, dash.no_update, status]
34363440

34373441
triggered_id = [p['prop_id'] for p in dash.callback_context.triggered][0]
34383442

@@ -3466,7 +3470,9 @@ def draw_file2( usi,
34663470
}
34673471
}
34683472

3469-
return [map_fig, graph_config, "Ready"]
3473+
status = html.H6([dbc.Badge("Ready", color="success", className="ml-1")])
3474+
3475+
return [map_fig, graph_config, status]
34703476

34713477

34723478
@app.callback(Output('run-gnps-mzmine-link', 'href'),

0 commit comments

Comments
 (0)