Format on frontend

This commit is contained in:
Adria Navarro 2024-07-22 11:11:42 +02:00
parent a6f51caa46
commit 3bb3376a82
4 changed files with 21 additions and 11 deletions

View File

@ -51,6 +51,8 @@
$: isAppAction && setPermissions(role)
$: isAppAction && getPermissions(automationId)
$: triggerInfo = $selectedAutomationDisplayData?.triggerInfo
async function setPermissions(role) {
if (!role || !automationId) {
return
@ -185,10 +187,10 @@
{block}
{webhookModal}
/>
{#if isTrigger && $selectedAutomationDisplayData?.triggerInfo}
{#if isTrigger && triggerInfo}
<InlineAlert
header={$selectedAutomationDisplayData.triggerInfo.title}
message={$selectedAutomationDisplayData.triggerInfo.description}
header={triggerInfo.type}
message={`This trigger is tied to the row action ${triggerInfo.rowAction.name} on your ${triggerInfo.table.name} table`}
/>
{/if}
{#if lastStep}

View File

@ -54,8 +54,12 @@ export async function getBuilderData(
result[automation._id!] = {
displayName: `${tableName}: ${automation.name}`,
triggerInfo: {
title: "Automation trigger",
description: `This trigger is tied to the row action ${rowActionName} on your ${tableName} table`,
type: "Automation trigger",
table: { id: tableId, name: tableName },
rowAction: {
id: rowActionId,
name: rowActionName,
},
},
}
}

View File

@ -11,7 +11,6 @@ import {
VirtualDocumentType,
} from "@budibase/types"
import automations from "./automations"
import tables from "./tables"
function ensureUniqueAndThrow(
doc: TableRowActions,
@ -45,8 +44,6 @@ export async function create(tableId: string, rowAction: { name: string }) {
doc = { _id: rowActionsId, actions: {} }
}
const { name: tableName } = await tables.getTable(tableId)
ensureUniqueAndThrow(doc, action.name)
const appId = context.getAppId()
@ -59,7 +56,7 @@ export async function create(tableId: string, rowAction: { name: string }) {
}${SEPARATOR}${utils.newid()}`
const automation = await automations.create({
name: `${tableName}: ${action.name}`,
name: action.name,
appId,
definition: {
trigger: {

View File

@ -6,8 +6,15 @@ export interface DeleteAutomationResponse extends DocumentDestroyResponse {}
export interface AutomationBuilderData {
displayName: string
triggerInfo?: {
title: string
description: string
type: string
table: {
id: string
name: string
}
rowAction: {
id: string
name: string
}
}
}