Skip to content
Snippets Groups Projects
Verified Commit 66a59fe7 authored by Karel van Klink's avatar Karel van Klink :smiley_cat:
Browse files

Remove unused labels in LSO interactions, and improve the looks of the result confirmation page

parent b0c7c1b7
No related branches found
No related tags found
1 merge request!434Remove unused labels in LSO interactions, and improve the looks of the result confirmation page
Pipeline #95019 passed
......@@ -15,7 +15,7 @@ from orchestrator.utils.errors import ProcessFailureError
from orchestrator.workflow import Step, StepList, begin, callback_step, conditional, inputstep
from pydantic import ConfigDict
from pydantic_forms.types import FormGenerator, State, UUIDstr
from pydantic_forms.validators import Label, LongText, ReadOnlyField
from pydantic_forms.validators import Label, LongText
from unidecode import unidecode
from gso import settings
......@@ -146,13 +146,11 @@ def _show_results(state: State) -> FormGenerator:
class ConfirmRunPage(SubmitFormPage):
model_config = ConfigDict()
if "lso_result_extra_label" in state:
extra_label: Label = state["lso_result_extra_label"]
run_status: ReadOnlyField(state["callback_result"]["status"], default_type=str) # type: ignore[valid-type]
run_results: ReadOnlyField(json.dumps(state["callback_result"], indent=4), default_type=LongText) # type: ignore[valid-type]
run_status: Label = f"Callback result: {state["callback_result"]["status"]}"
run_results: LongText = json.dumps(state["callback_result"], indent=4)
yield ConfirmRunPage
return state
return {}
@step("Clean up keys from state")
......@@ -160,8 +158,6 @@ def _clean_state() -> State:
return {
"__remove_keys": [
"run_results",
"lso_result_title",
"lso_result_extra_label",
"callback_result",
"playbook_name",
"callback_route",
......@@ -198,10 +194,6 @@ def lso_interaction(provisioning_step: Step) -> StepList:
to provision service subscriptions. If the playbook fails, this step will also fail, allowing for the user to retry
provisioning from the UI.
Optionally, the keys `lso_result_title` and `lso_result_extra_label` can be added to the state before running
this interaction. They will be used to customise the input step that shows the outcome of the LSO
interaction.
Args:
provisioning_step: A workflow step that performs an operation remotely using the provisioning proxy.
......@@ -216,7 +208,6 @@ def lso_interaction(provisioning_step: Step) -> StepList:
>> callback_step(
name=RUNNING_ANSIBLE_PLAYBOOK_STEP_NAME, action_step=_execute_playbook, validate_step=_evaluate_results
)
>> step("Inject result title")(lambda: {"lso_result_title": provisioning_step.name})
>> _show_results
)
>> _clean_state
......@@ -248,7 +239,6 @@ def indifferent_lso_interaction(provisioning_step: Step) -> StepList:
>> callback_step(
name=RUNNING_ANSIBLE_PLAYBOOK_STEP_NAME, action_step=_execute_playbook, validate_step=_ignore_results
)
>> step("Inject result title")(lambda: {"lso_result_title": provisioning_step.name})
>> _show_results
)
>> _clean_state
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment