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

add confirmation page for callback step results

parent 9ed6c0e3
No related branches found
No related tags found
1 merge request!96Make use of new callback step for external provisioning
......@@ -7,10 +7,14 @@ import logging
import requests
from orchestrator import step
from orchestrator.config.assignee import Assignee
from orchestrator.types import State, UUIDstr, strEnum
from orchestrator.utils.errors import ProcessFailureError
from orchestrator.utils.json import json_dumps
from orchestrator.workflow import Step, callback_step, begin, StepList
from orchestrator.workflow import Step, callback_step, begin, StepList, inputstep
from pydantic_forms.core import FormPage, ReadOnlyField
from pydantic_forms.types import FormGenerator
from pydantic_forms.validators import LongText
from gso import settings
from gso.products.product_types.iptrunk import Iptrunk, IptrunkProvisioning
......@@ -268,7 +272,23 @@ def _clean_up_state(state: State) -> State:
return state
@inputstep("Confirm provisioning proxy results", assignee=Assignee("SYSTEM"))
def _show_pp_results(state: State) -> FormGenerator:
if "callback_result" not in state:
return state
class ConfirmRunPage(FormPage):
class Config:
title: str = f"Execution for {state['subscription']['product']['name']} completed."
run_status: str = ReadOnlyField(state["callback_result"]["status"])
run_results: LongText = ReadOnlyField(json.dumps(state["callback_result"]["output"], indent=4))
yield ConfirmRunPage
return state
def pp_interaction(provisioning_step: Step, interaction_name: str) -> StepList:
return begin >> callback_step(
name=interaction_name, action_step=provisioning_step, validate_step=_evaluate_pp_results
) >> _clean_up_state
) >> _show_pp_results >> _clean_up_state
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment