前端页面调整

This commit is contained in:
2026-06-10 14:04:14 +08:00
parent a34566e6fa
commit 9516adc810
2 changed files with 45 additions and 42 deletions
+1 -1
View File
@@ -158,7 +158,7 @@ const routes: RouteRecordRaw[] = [
path: '/admin/acp-sessions', path: '/admin/acp-sessions',
name: 'admin-acp-sessions', name: 'admin-acp-sessions',
component: () => import('@/views/acp/AcpAdminSessionsView.vue'), component: () => import('@/views/acp/AcpAdminSessionsView.vue'),
meta: { requiresAdmin: true }, meta: { requiresAuth: true, requiresAdmin: true },
}, },
{ {
path: '/admin/acp/agent-kinds', path: '/admin/acp/agent-kinds',
+44 -41
View File
@@ -1,6 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted } from 'vue' import { onMounted } from 'vue'
import { useAcpStore } from '@/stores/acp' import { useAcpStore } from '@/stores/acp'
import AppShell from '@/components/layout/AppShell.vue'
import SessionStatusBadge from '@/components/acp/SessionStatusBadge.vue' import SessionStatusBadge from '@/components/acp/SessionStatusBadge.vue'
const store = useAcpStore() const store = useAcpStore()
@@ -21,47 +22,49 @@ async function terminate(id: string) {
</script> </script>
<template> <template>
<div class="p-6 space-y-4"> <AppShell>
<div class="flex items-center justify-between"> <div class="space-y-4">
<h1 class="text-2xl font-semibold">All ACP Sessions</h1> <div class="flex items-center justify-between">
<span class="text-sm text-gray-500">Global admin view (all users)</span> <h2 class="text-lg font-semibold">ACP 会话管理</h2>
</div> <span class="text-sm text-gray-500">全局管理员视图所有用户</span>
</div>
<div v-if="store.loading" class="text-gray-500">Loading...</div> <div v-if="store.loading" class="text-gray-500">Loading...</div>
<div v-else-if="store.error" class="text-red-600">{{ store.error }}</div> <div v-else-if="store.error" class="text-red-600">{{ store.error }}</div>
<div v-else-if="store.sessions.length === 0" class="text-gray-500"> <div v-else-if="store.sessions.length === 0" class="text-gray-500">
No sessions. No sessions.
</div> </div>
<table v-else class="w-full text-sm"> <table v-else class="w-full text-sm">
<thead class="text-left"> <thead class="text-left">
<tr class="border-b"> <tr class="border-b">
<th class="px-3 py-2">User</th> <th class="px-3 py-2">User</th>
<th class="px-3 py-2">Branch</th> <th class="px-3 py-2">Branch</th>
<th class="px-3 py-2">Status</th> <th class="px-3 py-2">Status</th>
<th class="px-3 py-2">Started</th> <th class="px-3 py-2">Started</th>
<th class="px-3 py-2 text-right">Actions</th> <th class="px-3 py-2 text-right">Actions</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr v-for="s in store.sessions" :key="s.id" class="border-t hover:bg-gray-50"> <tr v-for="s in store.sessions" :key="s.id" class="border-t hover:bg-gray-50">
<td class="px-3 py-2 font-mono text-xs">{{ s.user_id }}</td> <td class="px-3 py-2 font-mono text-xs">{{ s.user_id }}</td>
<td class="px-3 py-2 font-mono text-xs">{{ s.branch }}</td> <td class="px-3 py-2 font-mono text-xs">{{ s.branch }}</td>
<td class="px-3 py-2"><SessionStatusBadge :status="s.status" /></td> <td class="px-3 py-2"><SessionStatusBadge :status="s.status" /></td>
<td class="px-3 py-2 text-xs text-gray-500"> <td class="px-3 py-2 text-xs text-gray-500">
{{ new Date(s.started_at).toLocaleString() }} {{ new Date(s.started_at).toLocaleString() }}
</td> </td>
<td class="px-3 py-2 text-right space-x-2"> <td class="px-3 py-2 text-right space-x-2">
<button <button
v-if="s.status === 'starting' || s.status === 'running'" v-if="s.status === 'starting' || s.status === 'running'"
class="text-red-600 hover:underline" class="text-red-600 hover:underline"
@click="terminate(s.id)" @click="terminate(s.id)"
> >
Terminate Terminate
</button> </button>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
</AppShell>
</template> </template>