diff --git a/gso/utils/workflow_steps.py b/gso/utils/workflow_steps.py index 7b3b5cc91fe5899b1c8580501d85da3a638459d9..bcc1cacb36009b6db7eccca2f0787e26db95dd7f 100644 --- a/gso/utils/workflow_steps.py +++ b/gso/utils/workflow_steps.py @@ -3,9 +3,14 @@ import json from typing import Any -from orchestrator import step +from orchestrator import inputstep, step +from orchestrator.config.assignee import Assignee from orchestrator.types import State, UUIDstr from orchestrator.utils.json import json_dumps +from pydantic import ConfigDict +from pydantic_forms.core import FormPage +from pydantic_forms.types import FormGenerator +from pydantic_forms.validators import Label from gso.products.product_types.iptrunk import Iptrunk from gso.services.lso_client import execute_playbook @@ -101,3 +106,18 @@ def run_checks_after_base_config(subscription: dict[str, Any], callback_route: s inventory=subscription["router"]["router_fqdn"], extra_vars={"wfo_router_json": subscription}, ) + + +@inputstep("Prompt for new SharePoint checklist", assignee=Assignee.SYSTEM) +def prompt_sharepoint_checklist_url(checklist_url: str) -> FormGenerator: + """Prompt the operator with the checklist in SharePoint for approving this new router.""" + + class SharepointPrompt(FormPage): + model_config = ConfigDict(title="Complete new checklist") + + info_label_1: Label = f"A new checklist has been created at: {checklist_url}" + info_label_2: Label = "Click proceed to finish the workflow." + + yield SharepointPrompt + + return {} diff --git a/gso/workflows/router/create_router.py b/gso/workflows/router/create_router.py index dc33293d257b623141d22a1f05dcf5730b5a7ac8..233d982c0ea1a275b12b9540399c1bbd4d8b20dd 100644 --- a/gso/workflows/router/create_router.py +++ b/gso/workflows/router/create_router.py @@ -23,7 +23,12 @@ from gso.services.partners import get_partner_by_name from gso.services.sharepoint import SharePointClient from gso.utils.helpers import generate_fqdn, iso_from_ipv4 from gso.utils.shared_enums import PortNumber, Vendor -from gso.utils.workflow_steps import deploy_base_config_dry, deploy_base_config_real, run_checks_after_base_config +from gso.utils.workflow_steps import ( + deploy_base_config_dry, + deploy_base_config_real, + prompt_sharepoint_checklist_url, + run_checks_after_base_config, +) def _site_selector() -> Choice: @@ -228,21 +233,6 @@ def create_new_sharepoint_checklist(subscription: RouterProvisioning, tt_number: return {"checklist_url": new_list_item_url} -@inputstep("Prompt for new Sharepoint checklist", assignee=Assignee.SYSTEM) -def prompt_sharepoint_checklist_url(checklist_url: str) -> FormGenerator: - """Prompt the operator with the checklist in SharePoint for approving this new router.""" - - class SharepointPrompt(FormPage): - model_config = ConfigDict(title="Complete new checklist") - - info_label_1: Label = f"A new checklist has been created at: {checklist_url}" - info_label_2: Label = "Click proceed to finish the workflow." - - yield SharepointPrompt - - return {} - - @workflow( "Create router", initial_input_form=wrap_create_initial_input_form(initial_input_form_generator),