Files
baserow/web-frontend/modules/agent/pages/agent.vue
Davide Silvestri ca3d710b3b feat(agent): choose the identity an Agent runs as (#6540)
* feat(agent): choose the identity an Agent runs as

Agents can run as one of the workspace's Agent identities or with no
workspace access. The tools that act with the identity's permissions
come next.

* fix(agent): refresh the run-as identity label

* fix(agent): flag deleted run-as identities in configuration

* feat(agent): explain unavailable workspace identities

* refactor(agent): return a typed configuration object

* fix(agent): handle run-as identity permissions and lifecycle

* refactor(agent): use constants for readiness and state checks

* fix(agent): record before and after configuration values

* refactor(agent): move configuration transaction to API view

* fix(agent): batch run-as identity invalidations

* test: use real debounce in views admin tests

* fix(agent): keep run-as choices within the viewport

* perf: reuse permission data within batches
2026-11-05 09:16:14 +01:00

53 lines
1.6 KiB
Vue

<template>
<AgentApplicationContent v-if="agent" :agent="agent" />
</template>
<script setup>
import { AGENT_APPLICATION_TYPE } from '@baserow/modules/agent/constants'
import { computed } from 'vue'
import { createError } from '#app'
import AgentApplicationContent from '@baserow/modules/agent/components/AgentApplicationContent'
import AgentApplicationService from '@baserow/modules/agent/services/agentApplication'
import { usePageAsyncData } from '@baserow/modules/core/composables/usePageAsyncData'
import { normalizeError } from '@baserow/modules/database/utils/errors'
definePageMeta({
layout: 'app',
middleware: [
'settings',
'authenticated',
'workspacesAndApplications',
'selectAgentApplication',
],
})
const { $store, $client } = useNuxtApp()
const agentId = Number(useRoute().params.agentId)
const agent = computed(() => {
const application = $store.getters['application/get'](agentId)
return application?.type === AGENT_APPLICATION_TYPE ? application : null
})
useHead(() => ({ title: agent.value?.name }))
await usePageAsyncData(`agent-${agentId}`, async () => {
try {
// Applications are already loaded by middleware. Record this visit without
// fetching the same public data again.
await AgentApplicationService($client).recordView(agentId)
return true
} catch (error) {
if (!error.response) {
throw error
}
const statusCode = error.response.status
throw createError({
statusCode,
message:
statusCode === 404 ? 'Agent not found.' : normalizeError(error).message,
data: { report: statusCode >= 500 },
fatal: true,
})
}
})
</script>