mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 08:18:42 +00:00
* feat: trigger automations and agents when a row comment is posted * fix: verify row comment trigger access at setup and dispatch * refactor: pass the trigger event source as a plain task argument Drop the Celery headers and the per-type flag kept for the previous release's workers: Agent Builder is behind a feature flag. A service type names what it watches through get_event_source_id. Check a table's trigger read permissions in one call, add the trigger's msgid and shorten the changelog entry. * feat: lock agent triggers the workspace's license doesn't cover The configuration lists every trigger type the instance offers, and the license is checked apart. A locked trigger shows switched off with read-only settings that open the upgrade modal; it can still be renamed, replaced by another type or deleted, and resumes once coverage returns. Menus mark paid items with the lock badge, in Agents and Automations. * address feedback * fix: address second round of row comment trigger feedback - Treat an integration the service list loads as None as trashed - Restore a locked trigger as it was; license checked on edit and fire - Drop a queued event whose trigger watches another source, no skip - Disable the mention checkbox when the host's form can't be used - Fence the comment event text as labelled JSON for agents - Mention the license in the trigger API docs and error * fix: address third round of row comment trigger feedback - pass the run identity's name to the comment form from the agent host - keep only server-decided data in service form choices - log comments a misconfigured comment trigger skips - mention the license in the remaining trigger type texts * test: serialize comment trigger nodes with the user's table access
214 lines
6.1 KiB
Vue
214 lines
6.1 KiB
Vue
<template>
|
|
<div class="workflow-add-node-menu">
|
|
<GroupedMenu
|
|
ref="groupedMenu"
|
|
:items="menuGroups"
|
|
:search-placeholder="searchPlaceholder"
|
|
:empty-text="$t('workflowNodeContext.noResults')"
|
|
@select="onMenuItemSelected"
|
|
@disabled-click="onMenuItemSelected"
|
|
@close="$emit('close')"
|
|
>
|
|
<template #item-meta="{ item }">
|
|
<template v-if="item.meta">
|
|
<component
|
|
:is="component"
|
|
v-for="(component, index) in getNodeContextComponents(item.meta)"
|
|
:key="index"
|
|
:workflow="resolvedWorkflow"
|
|
:automation="resolvedAutomation"
|
|
:node="getNodeContextNode(item.meta)"
|
|
:node-type="item.meta"
|
|
/>
|
|
</template>
|
|
</template>
|
|
</GroupedMenu>
|
|
<template v-for="nodeType in nodeTypes" :key="nodeType.getType()">
|
|
<component
|
|
:is="getDeactivatedClickModal(nodeType)[0]"
|
|
v-if="getDeactivatedClickModal(nodeType) !== null"
|
|
:ref="`deactivatedClickModal_${nodeType.getType()}`"
|
|
v-bind="getDeactivatedClickModal(nodeType)[1]"
|
|
:name="nodeType.name"
|
|
:workspace="resolvedWorkspace"
|
|
/>
|
|
</template>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { unref } from 'vue'
|
|
import GroupedMenu from '@baserow/modules/core/components/GroupedMenu'
|
|
|
|
export default {
|
|
name: 'WorkflowAddNodeMenu',
|
|
components: { GroupedMenu },
|
|
inject: ['workspace', 'workflow', 'automation'],
|
|
props: {
|
|
node: {
|
|
type: Object,
|
|
required: false,
|
|
default: () => null,
|
|
},
|
|
onlyTrigger: {
|
|
type: Boolean,
|
|
required: false,
|
|
default: () => false,
|
|
},
|
|
},
|
|
emits: ['change', 'recipe', 'close'],
|
|
computed: {
|
|
resolvedAutomation() {
|
|
return unref(this.automation)
|
|
},
|
|
resolvedWorkflow() {
|
|
return unref(this.workflow)
|
|
},
|
|
resolvedWorkspace() {
|
|
return unref(this.workspace)
|
|
},
|
|
editingTriggerNode() {
|
|
return this.onlyTrigger
|
|
},
|
|
hasWorkflowTrigger() {
|
|
return this.resolvedWorkflow?.nodes?.some(
|
|
(node) => this.$registry.get('node', node.type)?.isTrigger
|
|
)
|
|
},
|
|
searchPlaceholder() {
|
|
return this.$t(
|
|
this.hasWorkflowTrigger
|
|
? 'workflowNodeContext.searchPlaceholderActions'
|
|
: 'workflowNodeContext.searchPlaceholderTrigger'
|
|
)
|
|
},
|
|
nodeTypes() {
|
|
return this.$registry
|
|
.getOrderedList('node')
|
|
.filter(
|
|
(nodeType) =>
|
|
nodeType.isEnabled() &&
|
|
this.node?.type !== nodeType.type &&
|
|
(this.editingTriggerNode
|
|
? nodeType.isTrigger
|
|
: nodeType.isWorkflowAction)
|
|
)
|
|
},
|
|
/**
|
|
* Recipes insert pre-configured nodes, so they are only offered when
|
|
* adding an action: not when picking a trigger, nor when replacing a node.
|
|
*/
|
|
recipes() {
|
|
if (this.editingTriggerNode || this.node) {
|
|
return []
|
|
}
|
|
return this.$registry
|
|
.getOrderedList('automationNodeRecipe')
|
|
.filter((recipe) => recipe.isEnabled())
|
|
},
|
|
menuGroups() {
|
|
const groups = new Map()
|
|
const addToGroup = (group, item) => {
|
|
if (!groups.has(group.id)) {
|
|
groups.set(group.id, { ...group, children: [] })
|
|
}
|
|
groups.get(group.id).children.push(item)
|
|
}
|
|
|
|
this.nodeTypes.forEach((nodeType) => {
|
|
addToGroup(nodeType.group, this.makeNodeTypeMenuItem(nodeType))
|
|
})
|
|
this.recipes.forEach((recipe) => {
|
|
addToGroup(recipe.group, this.makeRecipeMenuItem(recipe))
|
|
})
|
|
|
|
return Array.from(groups.values())
|
|
},
|
|
},
|
|
methods: {
|
|
focus() {
|
|
return this.$refs.groupedMenu?.focus()
|
|
},
|
|
makeNodeTypeMenuItem(nodeType) {
|
|
return {
|
|
id: `node-${nodeType.getType()}`,
|
|
label: nodeType.name,
|
|
value: nodeType.getType(),
|
|
icon: nodeType.iconClass,
|
|
iconColor: nodeType.iconColor,
|
|
image: nodeType.image,
|
|
description: nodeType.description,
|
|
aliases: nodeType.aliases,
|
|
disabled: nodeType.isDeactivated({
|
|
workspace: this.resolvedWorkspace,
|
|
}),
|
|
disabledReason: nodeType.isDeactivatedReason({
|
|
workspace: this.resolvedWorkspace,
|
|
}),
|
|
locked: this.getDeactivatedClickModal(nodeType) !== null,
|
|
meta: nodeType,
|
|
}
|
|
},
|
|
/**
|
|
* Unlike node type items this carries no `meta`, so the item-meta slot and
|
|
* the deactivated modals above, which both expect a node type, skip it.
|
|
*/
|
|
makeRecipeMenuItem(recipe) {
|
|
return {
|
|
id: `recipe-${recipe.getType()}`,
|
|
label: recipe.name,
|
|
value: recipe.getType(),
|
|
icon: recipe.iconClass,
|
|
iconColor: recipe.iconColor,
|
|
description: recipe.description,
|
|
aliases: recipe.aliases,
|
|
recipe,
|
|
}
|
|
},
|
|
onMenuItemSelected(item) {
|
|
if (item.recipe) {
|
|
this.$emit('recipe', item.recipe.getType())
|
|
return
|
|
}
|
|
this.onChange(item.meta)
|
|
},
|
|
onChange(nodeType) {
|
|
if (nodeType.isDeactivated({ workspace: this.resolvedWorkspace })) {
|
|
const deactivatedClickModal = this.getDeactivatedClickModal(nodeType)
|
|
if (deactivatedClickModal !== null) {
|
|
this.$refs[`deactivatedClickModal_${nodeType.getType()}`][0].show()
|
|
}
|
|
return
|
|
}
|
|
this.$emit('change', nodeType.getType())
|
|
},
|
|
getDeactivatedClickModal(nodeType) {
|
|
return nodeType.getDeactivatedClickModal({
|
|
workspace: this.resolvedWorkspace,
|
|
})
|
|
},
|
|
getNodeContextNode(nodeType) {
|
|
return {
|
|
...(this.node || {}),
|
|
type: nodeType.getType(),
|
|
}
|
|
},
|
|
getNodeContextComponents(nodeType) {
|
|
const node = this.getNodeContextNode(nodeType)
|
|
return Object.values(this.$registry.getAll('plugin')).reduce(
|
|
(components, plugin) =>
|
|
components.concat(
|
|
plugin.getAutomationWorkflowNodeContextComponents({
|
|
workflow: this.resolvedWorkflow,
|
|
automation: this.resolvedAutomation,
|
|
node,
|
|
nodeType,
|
|
})
|
|
),
|
|
[]
|
|
)
|
|
},
|
|
},
|
|
}
|
|
</script>
|