Returning metadata for prompting executor dynamic inputs #1241
ThaminduDilshan
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Problem Description
Currently we have two main node types; Prompt nodes and Task Execution nodes. Prompt nodes are to get user inputs and task execution nodes are to execute some real work. If a task execution node requires user input and you need to display a proper UI for that, current approach requires adding a PROMPT node before the Task Execution node. However this has some limitations.
Currently first limitation is addressed by allowing to define a meta element for the task execution nodes. However this doesn't allow customizing the appearance of the prompt. Also it might be confusing to have UI prompts for the task execution nodes.
Proposed Solution
We can introduce a optional
onIncompleteedge for the Task Execution nodes that will allow defining an optional node for the incomplete status. If a task execution node requires user input, flow composer can optionally define aonIncompleteedge that will define the view for the user input prompt. If not defined, engine will prompt for the inputs as per the current implementation.However this improvement will not restrict using the current model as well. Above same flow graph can be defined as follows. Even here, the
onIncompleteedge of the Basic Auth Executor node can be pointed to the same prompt node that's asking for username and password.Sample Flow Definition
{ "name": "Default Basic Registration Flow", "handle": "default-basic-flow", "flowType": "REGISTRATION", "nodes": [ { "id": "start", "type": "START", "onSuccess": "user_type_resolver" }, { "id": "user_type_resolver", "type": "TASK_EXECUTION", "executor": { "name": "UserTypeResolver" }, "onIncomplete": "prompt_user_type", "onSuccess": "basic_auth" }, { "id": "prompt_user_type", "type": "PROMPT", "meta": { "components": [ { "type": "TEXT", "id": "heading_user_type", "label": "Select User Type", "variant": "HEADING_2" }, { "type": "BLOCK", "id": "block_user_type", "components": [ { "type": "SELECT", "id": "select_user_type", "ref": "userType", "label": "User Type", "placeholder": "Choose your user type", }, { "type": "ACTION", "id": "action_user_type", "label": "Continue", "variant": "PRIMARY", "eventType": "SUBMIT" } ] } ] }, "prompts": [ { "inputs": [ { "ref": "user_type", "identifier": "userType", "type": "SELECT", "required": true } ], "action": { "ref": "action_user_type", "nextNode": "user_type_resolver" } } ] }, { "id": "basic_auth", "type": "TASK_EXECUTION", "executor": { "name": "BasicAuthExecutor" }, "onIncomplete": "prompt_credentials", "onSuccess": "prompt_user_info" }, { "id": "prompt_credentials", "type": "PROMPT", "meta": { "components": [ { "type": "TEXT", "id": "heading_credentials", "label": "Sign Up", "variant": "HEADING_2" }, { "type": "BLOCK", "id": "block_credentials", "components": [ { "type": "TEXT_INPUT", "id": "input_username", "ref": "username", "label": "Username", "placeholder": "Enter your username", "required": true }, { "type": "PASSWORD_INPUT", "id": "input_password", "ref": "password", "label": "Password", "placeholder": "Enter your password", "required": true }, { "type": "ACTION", "id": "action_credentials", "label": "Continue", "variant": "PRIMARY", "eventType": "SUBMIT" } ] } ] }, "prompts": [ { "inputs": [ { "ref": "input_username", "identifier": "username", "type": "TEXT_INPUT", "required": true }, { "ref": "input_password", "identifier": "password", "type": "PASSWORD_INPUT", "required": true } ], "action": { "ref": "action_credentials", "nextNode": "basic_auth" } } ] }, { "id": "prompt_user_info", "type": "PROMPT", "meta": { "components": [ { "type": "TEXT", "id": "heading_user_info", "label": "Sign Up", "variant": "HEADING_2" }, { "type": "BLOCK", "id": "block_user_info", "components": [ { "type": "TEXT_INPUT", "id": "input_firstName", "ref": "firstName", "label": "First Name", "placeholder": "Enter your first name", "required": true }, { "type": "TEXT_INPUT", "id": "input_lastName", "ref": "lastName", "label": "Last Name", "placeholder": "Enter your last name", "required": true }, { "type": "EMAIL_INPUT", "id": "input_email", "ref": "email", "label": "Email Address", "placeholder": "Enter your email address", "required": true }, { "type": "ACTION", "id": "action_user_info", "label": "Sign Up", "variant": "PRIMARY", "eventType": "SUBMIT" } ] } ] }, "prompts": [ { "inputs": [ { "ref": "input_firstName", "identifier": "firstName", "type": "TEXT_INPUT", "required": true }, { "ref": "input_lastName", "identifier": "lastName", "type": "TEXT_INPUT", "required": true }, { "ref": "input_email", "identifier": "email", "type": "EMAIL_INPUT", "required": true } ], "action": { "ref": "action_user_info", "nextNode": "provisioning" } } ] }, { "id": "provisioning", "type": "TASK_EXECUTION", "executor": { "name": "ProvisioningExecutor", "inputs": [ { "ref": "input_001", "identifier": "username", "type": "TEXT_INPUT", "required": true }, { "ref": "input_002", "identifier": "password", "type": "PASSWORD_INPUT", "required": true }, { "ref": "input_003", "identifier": "firstName", "type": "TEXT_INPUT", "required": true }, { "ref": "input_004", "identifier": "lastName", "type": "TEXT_INPUT", "required": true }, { "ref": "input_005", "identifier": "email", "type": "EMAIL_INPUT", "required": true } ] }, "onSuccess": "auth_assert" }, { "id": "auth_assert", "type": "TASK_EXECUTION", "executor": { "name": "AuthAssertExecutor" }, "onSuccess": "end" }, { "id": "end", "type": "END" } ] }Beta Was this translation helpful? Give feedback.
All reactions