mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 16:28:31 +00:00
* fix(agent): address agent builder feedback * feat(identities): let builders bind existing identities Binding an Agent or a Local Baserow integration to an existing identity takes the new identity.bind permission, held by workspace builders and admins. Creating, editing and deleting identities stays admin-only. ADR 013 updated and trimmed of migration and deployment details. * fix(agent): show ask before changes only for the Everything preset * fix(agent): fix CI and polish the tools modal and input table Update tests for the identity bind rule and the key/value input table, keep table keys on one line, use one toggle style in the external tools modal, and apply Prettier. * fix(agent): compact the pending approvals menu Each conversation is one line: its title with an ellipsis, then Always allow, Reject and Approve. The chat keeps the full approval card. * feat(agent): make the conversation sidebar collapsible * address feedback * Added a little bit of space after the trigger --------- Co-authored-by: Bram Wiepjes <bramw@protonmail.com>
51 lines
1.6 KiB
JavaScript
51 lines
1.6 KiB
JavaScript
import { computed, nextTick, reactive, ref, watch } from 'vue'
|
|
|
|
/** Local disclosure state; collapsing never unmounts a form or discards its draft. */
|
|
export function useExpandedItems(items, retainedItems = items) {
|
|
const expandedIds = reactive(new Set())
|
|
const allExpanded = computed(
|
|
() =>
|
|
items.value.length > 0 &&
|
|
items.value.every(({ id }) => expandedIds.has(id))
|
|
)
|
|
function toggle(id) {
|
|
if (expandedIds.has(id)) expandedIds.delete(id)
|
|
else expandedIds.add(id)
|
|
}
|
|
function toggleAll() {
|
|
if (allExpanded.value) expandedIds.clear()
|
|
else items.value.forEach(({ id }) => expandedIds.add(id))
|
|
}
|
|
watch(
|
|
() => new Set(retainedItems.value.map(({ id }) => id)),
|
|
(ids) => {
|
|
for (const id of expandedIds) if (!ids.has(id)) expandedIds.delete(id)
|
|
}
|
|
)
|
|
return { expandedIds, allExpanded, toggle, toggleAll }
|
|
}
|
|
|
|
/** Expand and scroll to a newly created configuration card once its form exists. */
|
|
export function useAgentCardList(items, createItem, retainedItems = items) {
|
|
const disclosure = useExpandedItems(items, retainedItems)
|
|
const list = ref(null)
|
|
const creating = ref(false)
|
|
async function addItem(type) {
|
|
if (creating.value) return
|
|
creating.value = true
|
|
try {
|
|
const item = await createItem(type)
|
|
if (!item) return
|
|
disclosure.expandedIds.add(item.id)
|
|
await nextTick()
|
|
list.value
|
|
?.querySelector(`[data-card-id="${item.id}"]`)
|
|
?.scrollIntoView?.({ block: 'start' })
|
|
} finally {
|
|
creating.value = false
|
|
}
|
|
}
|
|
|
|
return { ...disclosure, list, creating, addItem }
|
|
}
|