From 881ff55d5477b60459488921b2f5a6c32f1f95de Mon Sep 17 00:00:00 2001 From: Parthib Roy <159463257+proy30@users.noreply.github.com> Date: Fri, 3 Jan 2025 14:48:16 -0800 Subject: [PATCH] fix lattice validation (#776) --- .../dashboard/Input/latticeConfiguration/latticeMain.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/python/impactx/dashboard/Input/latticeConfiguration/latticeMain.py b/src/python/impactx/dashboard/Input/latticeConfiguration/latticeMain.py index 5371042c2..c3d16e740 100644 --- a/src/python/impactx/dashboard/Input/latticeConfiguration/latticeMain.py +++ b/src/python/impactx/dashboard/Input/latticeConfiguration/latticeMain.py @@ -156,7 +156,12 @@ def on_lattice_element_name_change(selectedLattice, **kwargs): @ctrl.add("add_latticeElement") def on_add_lattice_element_click(): selectedLattice = state.selectedLattice - if selectedLattice: + + if selectedLattice not in state.listOfLatticeElements: + state.isSelectedLatticeListEmpty = ( + f"Lattice element '{selectedLattice}' does not exist." + ) + else: add_lattice_element() state.dirty("selectedLatticeList")