mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 16:28:31 +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
112 lines
3.2 KiB
Vue
112 lines
3.2 KiB
Vue
<template>
|
|
<Context
|
|
ref="context"
|
|
class="agent-service-picker"
|
|
max-height-if-outside-viewport
|
|
@shown="focusMenu"
|
|
>
|
|
<GroupedMenu
|
|
ref="menu"
|
|
:items="groups"
|
|
:search-placeholder="searchPlaceholder"
|
|
:empty-text="emptyText"
|
|
@select="select"
|
|
@disabled-click="showLockedModal"
|
|
@close="context.hide()"
|
|
/>
|
|
<template v-for="serviceType in lockedTypes" :key="serviceType.getType()">
|
|
<component
|
|
:is="lockedModalOf(serviceType)[0]"
|
|
:ref="(modal) => (lockedModals[serviceType.getType()] = modal)"
|
|
:workspace="workspace"
|
|
v-bind="lockedModalOf(serviceType)[1]"
|
|
/>
|
|
</template>
|
|
</Context>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { computed, nextTick, ref } from 'vue'
|
|
import { useNuxtApp } from '#app'
|
|
import Context from '@baserow/modules/core/components/Context'
|
|
import GroupedMenu from '@baserow/modules/core/components/GroupedMenu'
|
|
|
|
const props = defineProps({
|
|
searchPlaceholder: { type: String, required: true },
|
|
emptyText: { type: String, required: true },
|
|
/** Explicitly supported service types, supplied by Agent configuration. */
|
|
availableTypes: { type: Array, required: true },
|
|
/** The Agent's workspace, which decides the deactivated types. */
|
|
workspace: { type: Object, default: null },
|
|
})
|
|
const emit = defineEmits(['select'])
|
|
const { $registry } = useNuxtApp()
|
|
const context = ref(null)
|
|
const menu = ref(null)
|
|
|
|
const serviceTypes = computed(() =>
|
|
$registry
|
|
.getOrderedList('service')
|
|
.filter((serviceType) =>
|
|
props.availableTypes.includes(serviceType.getType())
|
|
)
|
|
)
|
|
/** @returns {Array|null} The upgrade modal of a type the license locks. */
|
|
const lockedModalOf = (serviceType) =>
|
|
serviceType.getDeactivatedClickModal({ workspace: props.workspace })
|
|
const lockedTypes = computed(() =>
|
|
serviceTypes.value.filter((serviceType) => lockedModalOf(serviceType))
|
|
)
|
|
const lockedModals = {}
|
|
const groups = computed(() => {
|
|
const byGroup = new Map()
|
|
for (const serviceType of serviceTypes.value) {
|
|
const group = serviceType.group
|
|
if (!byGroup.has(group.id))
|
|
byGroup.set(group.id, { ...group, children: [] })
|
|
byGroup.get(group.id).children.push({
|
|
id: serviceType.getType(),
|
|
value: serviceType.getType(),
|
|
label: serviceType.name,
|
|
description: serviceType.description,
|
|
icon: serviceType.icon,
|
|
iconColor: serviceType.iconColor,
|
|
disabled: serviceType.isDeactivated({ workspace: props.workspace }),
|
|
disabledReason: serviceType.isDeactivatedReason({
|
|
workspace: props.workspace,
|
|
}),
|
|
locked: Boolean(lockedModalOf(serviceType)),
|
|
})
|
|
}
|
|
return [...byGroup.values()]
|
|
})
|
|
|
|
async function focusMenu() {
|
|
await nextTick()
|
|
menu.value?.focus()
|
|
}
|
|
|
|
function showLockedModal(item) {
|
|
const modal = lockedModals[item.value]
|
|
if (!modal) return
|
|
context.value.hide()
|
|
modal.show()
|
|
}
|
|
|
|
function select(item) {
|
|
context.value.hide()
|
|
emit('select', item.value)
|
|
}
|
|
|
|
/**
|
|
* Opens or closes the picker next to the element that opened it.
|
|
*
|
|
* @param {HTMLElement} target The element the picker is placed against.
|
|
*/
|
|
function toggle(target) {
|
|
context.value.toggle(target, 'bottom', 'right', 4)
|
|
}
|
|
|
|
defineExpose({ toggle })
|
|
</script>
|