diff --git a/gso/services/lso_client.py b/gso/services/lso_client.py index 50bbbc12c2ec963ef394f09c122b2f5702e3eef1..219da5ae51182ccbf54301a799ac1583a06a457d 100644 --- a/gso/services/lso_client.py +++ b/gso/services/lso_client.py @@ -15,7 +15,7 @@ from orchestrator.utils.errors import ProcessFailureError from orchestrator.workflow import Step, StepList, begin, callback_step, inputstep from pydantic_forms.core import FormPage, ReadOnlyField from pydantic_forms.types import FormGenerator -from pydantic_forms.validators import LongText +from pydantic_forms.validators import Label, LongText from gso import settings @@ -124,15 +124,22 @@ def _show_results(state: State) -> FormGenerator: if "callback_result" not in state: return state + if "lso_result_title" in state: + result_title = state["lso_result_title"] + else: + result_title = f"Execution for {state['subscription']['product']['name']} completed." + class ConfirmRunPage(FormPage): class Config: - title: str = f"Execution for {state['subscription']['product']['name']} completed." + title: str = result_title + if "lso_result_extra_label" in state: + extra_label: Label = state["lso_result_extra_label"] run_status: str = ReadOnlyField(state["callback_result"]["status"]) run_results: LongText = ReadOnlyField(json.dumps(state["callback_result"], indent=4)) yield ConfirmRunPage - state.pop("run_results") + [state.pop(key) for key in ["run_results", "lso_result_title", "lso_result_extra_label"]] return state @@ -143,6 +150,10 @@ 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 :term:`LSO` + interaction. + :param provisioning_step: A workflow step that performs an operation remotely using the provisioning proxy. :type provisioning_step: :class:`Step` :return: A list of steps that is executed as part of the workflow.