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

Add optional customisation to LSO interaction result page

parent a51686ad
Branches
Tags
No related merge requests found
This commit is part of merge request !175. Comments created here will be created in the context of that merge request.
...@@ -15,7 +15,7 @@ from orchestrator.utils.errors import ProcessFailureError ...@@ -15,7 +15,7 @@ from orchestrator.utils.errors import ProcessFailureError
from orchestrator.workflow import Step, StepList, begin, callback_step, inputstep from orchestrator.workflow import Step, StepList, begin, callback_step, inputstep
from pydantic_forms.core import FormPage, ReadOnlyField from pydantic_forms.core import FormPage, ReadOnlyField
from pydantic_forms.types import FormGenerator from pydantic_forms.types import FormGenerator
from pydantic_forms.validators import LongText from pydantic_forms.validators import Label, LongText
from gso import settings from gso import settings
...@@ -124,15 +124,22 @@ def _show_results(state: State) -> FormGenerator: ...@@ -124,15 +124,22 @@ def _show_results(state: State) -> FormGenerator:
if "callback_result" not in state: if "callback_result" not in state:
return 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 ConfirmRunPage(FormPage):
class Config: 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_status: str = ReadOnlyField(state["callback_result"]["status"])
run_results: LongText = ReadOnlyField(json.dumps(state["callback_result"], indent=4)) run_results: LongText = ReadOnlyField(json.dumps(state["callback_result"], indent=4))
yield ConfirmRunPage yield ConfirmRunPage
state.pop("run_results") [state.pop(key) for key in ["run_results", "lso_result_title", "lso_result_extra_label"]]
return state return state
...@@ -143,6 +150,10 @@ def lso_interaction(provisioning_step: Step) -> StepList: ...@@ -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 to provision service subscriptions. If the playbook fails, this step will also fail, allowing for the user to retry
provisioning from the UI. 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. :param provisioning_step: A workflow step that performs an operation remotely using the provisioning proxy.
:type provisioning_step: :class:`Step` :type provisioning_step: :class:`Step`
:return: A list of steps that is executed as part of the workflow. :return: A list of steps that is executed as part of the workflow.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment