Format on frontend
This commit is contained in:
parent
a6f51caa46
commit
3bb3376a82
|
@ -51,6 +51,8 @@
|
||||||
$: isAppAction && setPermissions(role)
|
$: isAppAction && setPermissions(role)
|
||||||
$: isAppAction && getPermissions(automationId)
|
$: isAppAction && getPermissions(automationId)
|
||||||
|
|
||||||
|
$: triggerInfo = $selectedAutomationDisplayData?.triggerInfo
|
||||||
|
|
||||||
async function setPermissions(role) {
|
async function setPermissions(role) {
|
||||||
if (!role || !automationId) {
|
if (!role || !automationId) {
|
||||||
return
|
return
|
||||||
|
@ -185,10 +187,10 @@
|
||||||
{block}
|
{block}
|
||||||
{webhookModal}
|
{webhookModal}
|
||||||
/>
|
/>
|
||||||
{#if isTrigger && $selectedAutomationDisplayData?.triggerInfo}
|
{#if isTrigger && triggerInfo}
|
||||||
<InlineAlert
|
<InlineAlert
|
||||||
header={$selectedAutomationDisplayData.triggerInfo.title}
|
header={triggerInfo.type}
|
||||||
message={$selectedAutomationDisplayData.triggerInfo.description}
|
message={`This trigger is tied to the row action ${triggerInfo.rowAction.name} on your ${triggerInfo.table.name} table`}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
{#if lastStep}
|
{#if lastStep}
|
||||||
|
|
|
@ -54,8 +54,12 @@ export async function getBuilderData(
|
||||||
result[automation._id!] = {
|
result[automation._id!] = {
|
||||||
displayName: `${tableName}: ${automation.name}`,
|
displayName: `${tableName}: ${automation.name}`,
|
||||||
triggerInfo: {
|
triggerInfo: {
|
||||||
title: "Automation trigger",
|
type: "Automation trigger",
|
||||||
description: `This trigger is tied to the row action ${rowActionName} on your ${tableName} table`,
|
table: { id: tableId, name: tableName },
|
||||||
|
rowAction: {
|
||||||
|
id: rowActionId,
|
||||||
|
name: rowActionName,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@ import {
|
||||||
VirtualDocumentType,
|
VirtualDocumentType,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
import automations from "./automations"
|
import automations from "./automations"
|
||||||
import tables from "./tables"
|
|
||||||
|
|
||||||
function ensureUniqueAndThrow(
|
function ensureUniqueAndThrow(
|
||||||
doc: TableRowActions,
|
doc: TableRowActions,
|
||||||
|
@ -45,8 +44,6 @@ export async function create(tableId: string, rowAction: { name: string }) {
|
||||||
doc = { _id: rowActionsId, actions: {} }
|
doc = { _id: rowActionsId, actions: {} }
|
||||||
}
|
}
|
||||||
|
|
||||||
const { name: tableName } = await tables.getTable(tableId)
|
|
||||||
|
|
||||||
ensureUniqueAndThrow(doc, action.name)
|
ensureUniqueAndThrow(doc, action.name)
|
||||||
|
|
||||||
const appId = context.getAppId()
|
const appId = context.getAppId()
|
||||||
|
@ -59,7 +56,7 @@ export async function create(tableId: string, rowAction: { name: string }) {
|
||||||
}${SEPARATOR}${utils.newid()}`
|
}${SEPARATOR}${utils.newid()}`
|
||||||
|
|
||||||
const automation = await automations.create({
|
const automation = await automations.create({
|
||||||
name: `${tableName}: ${action.name}`,
|
name: action.name,
|
||||||
appId,
|
appId,
|
||||||
definition: {
|
definition: {
|
||||||
trigger: {
|
trigger: {
|
||||||
|
|
|
@ -6,8 +6,15 @@ export interface DeleteAutomationResponse extends DocumentDestroyResponse {}
|
||||||
export interface AutomationBuilderData {
|
export interface AutomationBuilderData {
|
||||||
displayName: string
|
displayName: string
|
||||||
triggerInfo?: {
|
triggerInfo?: {
|
||||||
title: string
|
type: string
|
||||||
description: string
|
table: {
|
||||||
|
id: string
|
||||||
|
name: string
|
||||||
|
}
|
||||||
|
rowAction: {
|
||||||
|
id: string
|
||||||
|
name: string
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue