@swiss-ai-hub/web 0.310.6 → 0.311.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -43,6 +43,15 @@
43
43
  size="small"
44
44
  @click.stop="emit('clone', agent)"
45
45
  />
46
+ <Button
47
+ v-tooltip.top="t('agent.export.button')"
48
+ icon="pi pi-download"
49
+ severity="secondary"
50
+ text
51
+ rounded
52
+ size="small"
53
+ @click.stop="exportAgentInstance(agent)"
54
+ />
46
55
  <Button
47
56
  v-if="showDelete"
48
57
  icon="pi pi-trash"
@@ -93,6 +102,7 @@ const toast = useToast()
93
102
  const confirm = useConfirm()
94
103
  const { tenantId } = useTenant()
95
104
  const { deleteAgentInstance, isDeleting } = useDeleteAgentInstance()
105
+ const { exportAgentInstance } = useExportAgentInstance()
96
106
 
97
107
  const isActive = computed(() => {
98
108
  return route.params.agent_id === props.agent.agent_id && route.params.agent_class === props.agent.agent_class
@@ -0,0 +1,33 @@
1
+ import type { FullAgentInstanceDto } from '@core/sdk/client'
2
+
3
+ const EXPORT_SCHEMA_VERSION = '1.0'
4
+
5
+ type AgentConfigExport = {
6
+ schemaVersion: string
7
+ agentClass: string
8
+ agentId: string
9
+ configuration: Record<string, unknown>
10
+ }
11
+
12
+ export const useExportAgentInstance = () => {
13
+ const buildExport = (instance: FullAgentInstanceDto): AgentConfigExport => ({
14
+ schemaVersion: EXPORT_SCHEMA_VERSION,
15
+ agentClass: instance.agent_class,
16
+ agentId: instance.agent_id,
17
+ configuration: instance.configuration ?? {},
18
+ })
19
+
20
+ const exportAgentInstance = (instance: FullAgentInstanceDto): void => {
21
+ const blob = new Blob([JSON.stringify(buildExport(instance), null, 2)], { type: 'application/json' })
22
+ const url = URL.createObjectURL(blob)
23
+
24
+ const anchor = document.createElement('a')
25
+ anchor.href = url
26
+ anchor.download = `${instance.agent_config.name}_${instance.agent_id}_config.json`
27
+ anchor.click()
28
+
29
+ URL.revokeObjectURL(url)
30
+ }
31
+
32
+ return { exportAgentInstance }
33
+ }
@@ -331,6 +331,8 @@ agent:
331
331
  status: 'Status:'
332
332
  online: Online
333
333
  offline: Offline
334
+ export:
335
+ button: Exportieren
334
336
  configuration:
335
337
  title: Agentenkonfiguration
336
338
  description: Konfigurieren Sie das Laufzeitverhalten und die Einstellungen für
@@ -328,6 +328,8 @@ agent:
328
328
  status: 'Status:'
329
329
  online: Online
330
330
  offline: Offline
331
+ export:
332
+ button: Export
331
333
  configuration:
332
334
  title: Agent Configuration
333
335
  description: Configure the runtime behavior and settings for this agent
@@ -329,6 +329,8 @@ agent:
329
329
  status: 'Statut:'
330
330
  online: En ligne
331
331
  offline: Hors ligne
332
+ export:
333
+ button: Exporter
332
334
  configuration:
333
335
  title: Configuration de l'agent
334
336
  description: Configurez le comportement d'exécution et les paramètres de cet agent
@@ -329,6 +329,8 @@ agent:
329
329
  status: 'Stato:'
330
330
  online: Online
331
331
  offline: Offline
332
+ export:
333
+ button: Esporta
332
334
  configuration:
333
335
  title: Configurazione dell'agente
334
336
  description: Configura il comportamento runtime e le impostazioni per questo agente
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "license": "AGPL-3.0-or-later",
4
4
  "author": "bbv Software Services AG (https://www.bbv.ch)",
5
5
  "type": "module",
6
- "version": "0.310.6",
6
+ "version": "0.311.1",
7
7
  "description": "Swiss AI Hub - Admin & Management UI (Nuxt 3 layer)",
8
8
  "main": "./nuxt.config.ts",
9
9
  "repository": {
@@ -6,9 +6,19 @@
6
6
  size="normal"
7
7
  >
8
8
  <div class="flex flex-col gap-3">
9
- <p class="mb-4 text-sm text-surface-500 dark:text-surface-400">
10
- {{ t('agent.configuration.description') }}
11
- </p>
9
+ <div class="mb-4 flex items-start justify-between gap-4">
10
+ <p class="text-sm text-surface-500 dark:text-surface-400">
11
+ {{ t('agent.configuration.description') }}
12
+ </p>
13
+ <Button
14
+ icon="pi pi-download"
15
+ severity="secondary"
16
+ :label="t('agent.export.button')"
17
+ class="shrink-0"
18
+ :disabled="!agentInstance"
19
+ @click="exportAgent"
20
+ />
21
+ </div>
12
22
  <AgentConfiguration
13
23
  v-if="hasLoaded && configForm && configForm.length > 0"
14
24
  :title="t('agent.configuration.runtimeSettings')"
@@ -40,9 +50,14 @@ const route = useRoute()
40
50
  const { tenantId } = useTenant()
41
51
  const { agentInstance, agentInstanceIsLoading } = useAgentInstance()
42
52
  const { updateAgentInstance } = useUpdateAgentInstance()
53
+ const { exportAgentInstance } = useExportAgentInstance()
43
54
  const { t } = useI18n()
44
55
  const toast = useToast()
45
56
 
57
+ const exportAgent = () => {
58
+ if (agentInstance.value) exportAgentInstance(agentInstance.value)
59
+ }
60
+
46
61
  // Latch so a background refetch or transient `enabled` flip can't remount the form and
47
62
  // re-seed it from server data, dropping unsaved edits (issue #38).
48
63
  const hasLoaded = ref(false)