Skip to content

Commit

Permalink
Simplify csrConfiguration
Browse files Browse the repository at this point in the history
  • Loading branch information
proy30 committed Jan 8, 2025
1 parent a01b272 commit f71b1f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
20 changes: 2 additions & 18 deletions src/python/impactx/dashboard/Input/csrConfiguration/csrMain.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,7 @@
from .. import TrameFunctions, generalFunctions, setup_server, vuetify
from .. import TrameFunctions, setup_server, vuetify

server, state, ctrl = setup_server()

# -----------------------------------------------------------------------------
#
# -----------------------------------------------------------------------------


@state.change("csr_bins")
def on_csr_bins_change(csr_bins, **kwargs):
state.csr_bins_error_message = generalFunctions.validate_against(
csr_bins, "int", ["positive"]
)
generalFunctions.update_simulation_validation_status()


# -----------------------------------------------------------------------------
# UI
# -----------------------------------------------------------------------------


class csrConfiguration:
@staticmethod
Expand All @@ -39,4 +22,5 @@ def card():
with vuetify.VCol(classes="py-0"):
TrameFunctions.text_field(
label="CSR Bins",
input=(ctrl.input_change, "['csr_bins']"),
)
2 changes: 2 additions & 0 deletions src/python/impactx/dashboard/Input/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,13 @@ class DashboardDefaults:
"bunch_charge_C": "float",
"mass_MeV": "float",
"charge_qe": "int",
"csr_bins": "int",
}

VALIDATION_CONDITION = {
"charge_qe": ["non_zero"],
"mass_MeV": ["positive"],
"csr_bins": ["positive"],
}

# If a parameter is not included in the dictionary, default step amount is 1.
Expand Down

0 comments on commit f71b1f5

Please sign in to comment.