Made changes to allow custom modal title

Changed Question to User Prompt
Allows custom title
This commit is contained in:
FlaminWrap 2022-11-14 00:33:00 +00:00
parent de613925dc
commit b18aacc922
4 changed files with 11 additions and 7 deletions

View File

@ -14,6 +14,8 @@
<div class="root"> <div class="root">
<Body size="S">Enter the message you wish to display to the user.</Body> <Body size="S">Enter the message you wish to display to the user.</Body>
<div class="params"> <div class="params">
<Label small>Title</Label>
<Input placeholder="User Prompt" bind:value={parameters.titleText} />
<Label small>Message</Label> <Label small>Message</Label>
<Input <Input
placeholder="Are you sure you want to continue?" placeholder="Are you sure you want to continue?"

View File

@ -16,4 +16,4 @@ export { default as ExportData } from "./ExportData.svelte"
export { default as ContinueIf } from "./ContinueIf.svelte" export { default as ContinueIf } from "./ContinueIf.svelte"
export { default as UpdateFieldValue } from "./UpdateFieldValue.svelte" export { default as UpdateFieldValue } from "./UpdateFieldValue.svelte"
export { default as ShowNotification } from "./ShowNotification.svelte" export { default as ShowNotification } from "./ShowNotification.svelte"
export { default as QuestionPrompt } from "./QuestionPrompt.svelte" export { default as UserPrompt } from "./UserPrompt.svelte"

View File

@ -118,9 +118,9 @@
"dependsOnFeature": "showNotificationAction" "dependsOnFeature": "showNotificationAction"
}, },
{ {
"name": "Question", "name": "User Prompt",
"type": "application", "type": "application",
"component": "QuestionPrompt" "component": "UserPrompt"
} }
] ]
} }

View File

@ -312,7 +312,7 @@ const showNotificationHandler = action => {
notificationStore.actions[type]?.(message, autoDismiss) notificationStore.actions[type]?.(message, autoDismiss)
} }
const questionHandler = action => { const userPromptHandler = action => {
action.parameters action.parameters
return return
} }
@ -336,7 +336,7 @@ const handlerMap = {
["Export Data"]: exportDataHandler, ["Export Data"]: exportDataHandler,
["Continue if / Stop if"]: continueIfHandler, ["Continue if / Stop if"]: continueIfHandler,
["Show Notification"]: showNotificationHandler, ["Show Notification"]: showNotificationHandler,
["Question"]: questionHandler, ["User Prompt"]: userPromptHandler,
} }
const confirmTextMap = { const confirmTextMap = {
@ -344,7 +344,7 @@ const confirmTextMap = {
["Save Row"]: "Are you sure you want to save this row?", ["Save Row"]: "Are you sure you want to save this row?",
["Execute Query"]: "Are you sure you want to execute this query?", ["Execute Query"]: "Are you sure you want to execute this query?",
["Trigger Automation"]: "Are you sure you want to trigger this automation?", ["Trigger Automation"]: "Are you sure you want to trigger this automation?",
["Question"]: "Are you sure you want to contiune?", ["User Prompt"]: "Are you sure you want to contiune?",
} }
/** /**
@ -396,8 +396,10 @@ export const enrichButtonActions = (actions, context) => {
return new Promise(resolve => { return new Promise(resolve => {
const defaultText = confirmTextMap[action["##eventHandlerType"]] const defaultText = confirmTextMap[action["##eventHandlerType"]]
const confirmText = action.parameters?.confirmText || defaultText const confirmText = action.parameters?.confirmText || defaultText
const defaultTitleText = action["##eventHandlerType"]
const titleText = action.parameters?.titleText || defaultTitleText
confirmationStore.actions.showConfirmation( confirmationStore.actions.showConfirmation(
action["##eventHandlerType"], titleText,
confirmText, confirmText,
async () => { async () => {
// When confirmed, execute this action immediately, // When confirmed, execute this action immediately,