Skip to content

Commit 68bbf24

Browse files
committed
Feat: Add button disabling and spinners to indicate processing to input forms.
1 parent f8e9409 commit 68bbf24

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

laue_portal/pages/create_peakindexing.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,12 @@ def validate_field(field_name, **kwargs):
10201020
State('indexAngleTolerance', 'value'),
10211021
State('indexCone', 'value'),
10221022
State('indexHKL', 'value'),
1023+
running=[
1024+
(Output("peakindex-validate-btn", "disabled"), True, False),
1025+
(Output("peakindex-validate-btn", "children"),
1026+
[dbc.Spinner(size="sm", spinner_class_name="me-2"), "Validating..."], "Validate"),
1027+
(Output("submit_peakindexing", "disabled"), True, False),
1028+
],
10231029
prevent_initial_call=True,
10241030
)
10251031
def validate_inputs(
@@ -1097,6 +1103,12 @@ def validate_inputs(
10971103
State('depth', 'value'),
10981104
State('outputXML', 'value'),
10991105
1106+
running=[
1107+
(Output("submit_peakindexing", "disabled"), True, False),
1108+
(Output("submit_peakindexing", "children"),
1109+
[dbc.Spinner(size="sm", spinner_class_name="me-2"), "Submitting..."], "Submit"),
1110+
(Output("peakindex-validate-btn", "disabled"), True, False),
1111+
],
11001112
prevent_initial_call=True,
11011113
)
11021114
def submit_parameters(n,

laue_portal/pages/create_wire_reconstruction.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,12 @@ def validate_field(field_name, **kwargs):
674674
State('root_path', 'value'),
675675
State('IDnumber', 'value'),
676676
State('author', 'value'),
677+
running=[
678+
(Output("wirerecon-validate-btn", "disabled"), True, False),
679+
(Output("wirerecon-validate-btn", "children"),
680+
[dbc.Spinner(size="sm", spinner_class_name="me-2"), "Validating..."], "Validate"),
681+
(Output("submit_wire", "disabled"), True, False),
682+
],
677683
prevent_initial_call=True,
678684
)
679685
def validate_inputs(
@@ -734,6 +740,12 @@ def validate_inputs(
734740
# Output
735741
State('outputFolder', 'value'),
736742
743+
running=[
744+
(Output("submit_wire", "disabled"), True, False),
745+
(Output("submit_wire", "children"),
746+
[dbc.Spinner(size="sm", spinner_class_name="me-2"), "Submitting..."], "Submit"),
747+
(Output("wirerecon-validate-btn", "disabled"), True, False),
748+
],
737749
prevent_initial_call=True,
738750
)
739751
def submit_parameters(n,

0 commit comments

Comments
 (0)