KI-AGENT: Matrix-Räume in FEDEO provisionieren
This commit is contained in:
@@ -5,11 +5,14 @@ const { $api } = useNuxtApp()
|
||||
const status = ref(null)
|
||||
const identity = ref(null)
|
||||
const tenantSpace = ref(null)
|
||||
const generalRoom = ref(null)
|
||||
const provisionResult = ref(null)
|
||||
const tenantSpaceProvisionResult = ref(null)
|
||||
const generalRoomProvisionResult = ref(null)
|
||||
const loading = ref(false)
|
||||
const provisioning = ref(false)
|
||||
const tenantSpaceProvisioning = ref(false)
|
||||
const generalRoomProvisioning = ref(false)
|
||||
const lastUpdated = ref(null)
|
||||
|
||||
const statusItems = computed(() => [
|
||||
@@ -48,15 +51,17 @@ const statusItems = computed(() => [
|
||||
const loadMatrixInfo = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const [statusRes, identityRes, tenantSpaceRes] = await Promise.all([
|
||||
const [statusRes, identityRes, tenantSpaceRes, generalRoomRes] = await Promise.all([
|
||||
$api("/api/communication/matrix/status"),
|
||||
$api("/api/communication/matrix/me"),
|
||||
$api("/api/communication/matrix/tenant-space")
|
||||
$api("/api/communication/matrix/tenant-space"),
|
||||
$api("/api/communication/matrix/rooms/general")
|
||||
])
|
||||
|
||||
status.value = statusRes
|
||||
identity.value = identityRes
|
||||
tenantSpace.value = tenantSpaceRes
|
||||
generalRoom.value = generalRoomRes
|
||||
lastUpdated.value = new Date()
|
||||
} catch (error) {
|
||||
toast.add({
|
||||
@@ -127,6 +132,44 @@ const provisionTenantSpace = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const provisionGeneralRoom = async () => {
|
||||
generalRoomProvisioning.value = true
|
||||
try {
|
||||
const res = await $api("/api/communication/matrix/rooms/general/provision", {
|
||||
method: "POST"
|
||||
})
|
||||
|
||||
generalRoomProvisionResult.value = res
|
||||
generalRoom.value = {
|
||||
tenantId: res.tenantId,
|
||||
tenantName: res.tenantName,
|
||||
key: res.key,
|
||||
name: res.name,
|
||||
alias: res.alias,
|
||||
exists: true,
|
||||
roomId: res.roomId,
|
||||
servers: res.servers || []
|
||||
}
|
||||
tenantSpace.value = {
|
||||
...tenantSpace.value,
|
||||
exists: true,
|
||||
roomId: res.parentSpaceRoomId || tenantSpace.value?.roomId
|
||||
}
|
||||
|
||||
toast.add({
|
||||
title: res.alreadyExisted ? "Allgemeiner Chat ist bereits vorhanden" : "Allgemeiner Chat erstellt",
|
||||
color: "success"
|
||||
})
|
||||
} catch (error) {
|
||||
toast.add({
|
||||
title: "Allgemeiner Chat konnte nicht erstellt werden",
|
||||
color: "error"
|
||||
})
|
||||
} finally {
|
||||
generalRoomProvisioning.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const formatDateTime = (value) => {
|
||||
if (!value) return "-"
|
||||
|
||||
@@ -334,6 +377,73 @@ onMounted(loadMatrixInfo)
|
||||
</div>
|
||||
</template>
|
||||
</UCard>
|
||||
|
||||
<UCard :ui="{ root: 'rounded-lg' }">
|
||||
<template #header>
|
||||
<div class="flex items-center gap-2">
|
||||
<UIcon name="i-heroicons-chat-bubble-left-right" class="size-5 text-primary" />
|
||||
<h2 class="text-base font-semibold text-highlighted">
|
||||
Allgemeiner Chat
|
||||
</h2>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div class="space-y-4">
|
||||
<div class="grid gap-3 sm:grid-cols-2">
|
||||
<div>
|
||||
<p class="text-xs font-medium uppercase text-muted">
|
||||
Alias
|
||||
</p>
|
||||
<p class="mt-1 break-all font-mono text-sm text-highlighted">
|
||||
{{ generalRoom?.alias || "-" }}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<p class="text-xs font-medium uppercase text-muted">
|
||||
Status
|
||||
</p>
|
||||
<UBadge
|
||||
class="mt-1"
|
||||
:color="generalRoom?.exists ? 'success' : 'neutral'"
|
||||
variant="soft"
|
||||
>
|
||||
{{ generalRoom?.exists ? "Vorhanden" : "Noch nicht erstellt" }}
|
||||
</UBadge>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<p class="text-xs font-medium uppercase text-muted">
|
||||
Raum-ID
|
||||
</p>
|
||||
<p class="mt-1 break-all font-mono text-sm text-highlighted">
|
||||
{{ generalRoom?.roomId || "-" }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<UAlert
|
||||
v-if="generalRoomProvisionResult"
|
||||
icon="i-heroicons-check-circle"
|
||||
color="success"
|
||||
variant="soft"
|
||||
:title="generalRoomProvisionResult.alreadyExisted ? 'Allgemeiner Chat vorhanden' : 'Allgemeiner Chat erstellt'"
|
||||
:description="generalRoomProvisionResult.alias"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<div class="flex justify-end">
|
||||
<UButton
|
||||
icon="i-heroicons-plus"
|
||||
:loading="generalRoomProvisioning"
|
||||
:disabled="!status?.reachable || !status?.provisioningConfigured"
|
||||
@click="provisionGeneralRoom"
|
||||
>
|
||||
Allgemeinen Chat erstellen
|
||||
</UButton>
|
||||
</div>
|
||||
</template>
|
||||
</UCard>
|
||||
</div>
|
||||
|
||||
<UCard :ui="{ root: 'rounded-lg' }">
|
||||
|
||||
Reference in New Issue
Block a user