Maharshi Gor
commited on
Commit
·
c225678
1
Parent(s):
e9811e1
Bugfix: double remove of step_id in UI state
Browse files
src/components/structs.py
CHANGED
@@ -83,6 +83,8 @@ class PipelineUIState(BaseModel):
|
|
83 |
|
84 |
def remove_step(self, step_id: str) -> "PipelineUIState":
|
85 |
"""Remove a step from the pipeline."""
|
|
|
|
|
86 |
self.step_ids.remove(step_id)
|
87 |
self.steps.pop(step_id)
|
88 |
return self.model_copy(update={"step_ids": self.step_ids, "steps": self.steps})
|
@@ -90,7 +92,7 @@ class PipelineUIState(BaseModel):
|
|
90 |
def update_step(self, step_id: str, ui_state: ModelStepUIState) -> "PipelineUIState":
|
91 |
"""Update a step in the pipeline."""
|
92 |
if step_id not in self.steps:
|
93 |
-
raise ValueError(f"Step {step_id} not found in pipeline")
|
94 |
return self.model_copy(update={"steps": self.steps | {step_id: ui_state}})
|
95 |
|
96 |
|
@@ -125,7 +127,7 @@ class PipelineState(BaseModel):
|
|
125 |
return self.model_copy(update={"workflow": workflow, "ui_state": self.ui_state})
|
126 |
|
127 |
def remove_step(self, position: int) -> "PipelineState":
|
128 |
-
step_id = self.ui_state.step_ids
|
129 |
|
130 |
workflow = self.workflow.remove_step(step_id)
|
131 |
ui_state = self.ui_state.remove_step(step_id)
|
|
|
83 |
|
84 |
def remove_step(self, step_id: str) -> "PipelineUIState":
|
85 |
"""Remove a step from the pipeline."""
|
86 |
+
if step_id not in self.step_ids:
|
87 |
+
raise ValueError(f"Step {step_id} not found in pipeline. Step IDs: {self.step_ids}")
|
88 |
self.step_ids.remove(step_id)
|
89 |
self.steps.pop(step_id)
|
90 |
return self.model_copy(update={"step_ids": self.step_ids, "steps": self.steps})
|
|
|
92 |
def update_step(self, step_id: str, ui_state: ModelStepUIState) -> "PipelineUIState":
|
93 |
"""Update a step in the pipeline."""
|
94 |
if step_id not in self.steps:
|
95 |
+
raise ValueError(f"Step {step_id} not found in pipeline. Step IDs: {self.step_ids}")
|
96 |
return self.model_copy(update={"steps": self.steps | {step_id: ui_state}})
|
97 |
|
98 |
|
|
|
127 |
return self.model_copy(update={"workflow": workflow, "ui_state": self.ui_state})
|
128 |
|
129 |
def remove_step(self, position: int) -> "PipelineState":
|
130 |
+
step_id = self.ui_state.step_ids[position]
|
131 |
|
132 |
workflow = self.workflow.remove_step(step_id)
|
133 |
ui_state = self.ui_state.remove_step(step_id)
|