refactor: SOLID architecture — backend service layer + frontend V2 components
## Backend — Service Layer & Repository Refactoring ### Neue Services (21 neue Dateien) **Interfaces & Implementierungen:** - `IOpenClawGatewayClient` — Interface für OpenClawGatewayClient (DIP-Fix: DashboardController hing an konkreter Klasse) - `IAgentConfigService` / `AgentConfigService` — Agent-Config-File-I/O aus AgentsController extrahiert - `IProjectService` / `ProjectService` — Projekt-CRUD + Activity-Logging (SRP) - `ITaskService` / `TaskService` — Task-State-Machine, Approve/Reject, Dashboard-Operationen (eliminiert Duplikation zwischen TasksController und DashboardController) - `IDashboardService` / `DashboardService` — Queue-Aggregation, Priority-Normalisierung, Gateway-Delegation - `IOperationsService` / `OperationsService` — Metriken-Berechnung aus OperationsController - `ITeamService` / `TeamService` — IDENTITY.md-Lesen aus TeamController - `IMemoryService` / `MemoryService` — File-I/O aus MemoryController - `IIncidentService` / `IncidentService` — File-Parsing (Regex-Source-Generatoren) aus IncidentsController - `IDocService` / `DocService` — Directory-Scan aus DocsController - `ICalendarService` / `CalendarService` — Gateway-HTTP-Calls + Fallback-Daten aus CalendarController ### Repository-Fixes **IUserRepository / UserRepository:** - `SaveChangesAsync` entfernt (leaky abstraction — Caller sollten nie SaveChanges steuern) - `RevokeTokenAsync(tokenHash)` — atomares Token-Revoke inkl. SaveChanges - `RevokeFamilyAsync(familyId)` — Batch-Revoke einer Token-Familie inkl. SaveChanges - `RemoveExpiredTokensAsync` speichert jetzt selbst (war vorher dependent auf nachfolgenden Save) ### AuthService-Fixes - `GetUserAsync`: unnötiges `Task.Run` entfernt → direkt `_users.GetByIdAsync().AsTask()` - `RevokeAsync`: delegiert jetzt an `IUserRepository.RevokeTokenAsync` - `RefreshAsync`: Token-Reuse-Detection delegiert an `IUserRepository.RevokeFamilyAsync` ### Bug-Fix - `OpenClawGatewayClient.ReadAgentGoalAsync`: pre-existing `CS1656` behoben (`reader` war `using`-Variable und wurde neu zugewiesen — in `reader2` umbenannt) ### Controller (16 Stück — alle slim) Alle Controller reduziert auf: Input validieren → Service aufrufen → HTTP-Result zurückgeben. Kein Business-Logic, kein File-I/O, keine direkte Repository-Nutzung (außer AgentsController für Activity-Log). **Program.cs — neue Registrierungen:** - `AddHttpClient<IOpenClawGatewayClient, OpenClawGatewayClient>` (war vorher konkrete Klasse) - Scoped: IDashboardService, IProjectService, ITaskService, IOperationsService, ITeamService, ICalendarService - Singleton: IAgentConfigService, IMemoryService, IIncidentService, IDocService --- ## Frontend — Dashboard V2 Components **AgentDetailModal.vue, IrisChat.vue, TaskStrip.vue:** - V2 Design-System: Dark Space Theme, Glass-Panels, Gradient-Akzente - Stores (agents, chat, tasks) nutzen Service + Mapper-Pattern - NexusLayout, FlowBoard, Topbar — Layoutfixes für fullHeight-Route-Meta Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,11 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* TaskStrip — Untere Leiste im V2 Dashboard Stage
|
||||
*
|
||||
* Props:
|
||||
* tasks – TaskItem[]
|
||||
*/
|
||||
|
||||
import type { TaskItem } from './types'
|
||||
|
||||
defineProps<{
|
||||
@@ -13,213 +6,143 @@ defineProps<{
|
||||
loading?: boolean
|
||||
error?: string | null
|
||||
}>()
|
||||
|
||||
function prioLabel(p: TaskItem['priority']): string {
|
||||
return p === 'high' ? 'P0' : p === 'medium' ? 'P1' : 'P2'
|
||||
}
|
||||
|
||||
function prioColor(p: TaskItem['priority']): string {
|
||||
return p === 'high' ? '#fda4b0' : p === 'medium' ? '#fcd34d' : '#9db6ff'
|
||||
}
|
||||
|
||||
function dotClass(s: TaskItem['status']): string {
|
||||
return s === 'active' ? 'work' : s === 'blocked' ? 'block' : 'queue'
|
||||
}
|
||||
|
||||
function statusLabel(s: TaskItem['status']): string {
|
||||
return s === 'active' ? 'Läuft' : s === 'blocked' ? 'Blocker' : 'Queue'
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="taskstrip v2-scroll">
|
||||
<!-- Loading skeleton -->
|
||||
<div class="tstrip">
|
||||
<template v-if="loading">
|
||||
<div v-for="n in 3" :key="'sk-' + n" class="taskcard skeleton" />
|
||||
<div v-for="n in 4" :key="n" class="tcard skeleton"></div>
|
||||
</template>
|
||||
|
||||
<!-- Error -->
|
||||
<div v-else-if="error" class="task-error">
|
||||
<span class="error-icon">⚠</span> {{ error }}
|
||||
</div>
|
||||
<div v-else-if="error" class="tstrip-msg">⚠ {{ error }}</div>
|
||||
<div v-else-if="!tasks.length" class="tstrip-msg">Keine aktiven Tasks</div>
|
||||
|
||||
<!-- Empty -->
|
||||
<div v-else-if="!tasks.length" class="task-empty">
|
||||
No active tasks
|
||||
</div>
|
||||
|
||||
<!-- Tasks -->
|
||||
<div
|
||||
v-for="task in tasks"
|
||||
:key="task.id"
|
||||
class="taskcard"
|
||||
:class="`task-${task.status}`"
|
||||
>
|
||||
<!-- Priority Badge -->
|
||||
<span class="prio-badge" :class="`prio-${task.priority}`">
|
||||
{{ task.priority === 'high' ? 'P0' : task.priority === 'medium' ? 'P1' : 'P2' }}
|
||||
</span>
|
||||
|
||||
<!-- Title -->
|
||||
<div class="task-title">{{ task.title }}</div>
|
||||
|
||||
<!-- Agent -->
|
||||
<div class="task-agent">{{ task.agent }}</div>
|
||||
|
||||
<!-- Progress Bar -->
|
||||
<div class="task-progress">
|
||||
<div class="bar-track">
|
||||
<div
|
||||
class="bar-fill"
|
||||
:style="{ width: task.progress + '%' }"
|
||||
></div>
|
||||
<template v-else>
|
||||
<div
|
||||
v-for="task in tasks.slice(0, 4)"
|
||||
:key="task.id"
|
||||
class="tcard"
|
||||
:class="{ block: task.status === 'blocked' }"
|
||||
>
|
||||
<div class="tcard-row">
|
||||
<span class="pr" :style="{ background: 'rgba(124,108,255,.14)', color: prioColor(task.priority) }">
|
||||
{{ prioLabel(task.priority) }}
|
||||
</span>
|
||||
<span class="dot" :class="dotClass(task.status)"></span>
|
||||
<span class="stl">{{ statusLabel(task.status) }}</span>
|
||||
</div>
|
||||
<div class="tt">{{ task.title }}</div>
|
||||
<div class="ow">{{ task.agent }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.taskstrip {
|
||||
.tstrip {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 10px;
|
||||
padding: 0 16px 14px;
|
||||
overflow-x: auto;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
/* ── Task Card ────────────────────────────────────── */
|
||||
.taskcard {
|
||||
min-width: 196px;
|
||||
max-width: 220px;
|
||||
flex: 0 0 auto;
|
||||
.tcard {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
padding: 11px 13px;
|
||||
border-radius: 12px;
|
||||
background: var(--glass);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--r);
|
||||
padding: 12px 13px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
position: relative;
|
||||
transition: border-color 0.15s, background 0.15s;
|
||||
}
|
||||
|
||||
/* ── Status Variants ──────────────────────────────── */
|
||||
.task-active {
|
||||
border-left: 2px solid var(--st-work);
|
||||
background: rgba(61, 220, 151, 0.04);
|
||||
.tcard.block {
|
||||
border-color: rgba(251,113,133,.35);
|
||||
background: rgba(251,113,133,.07);
|
||||
}
|
||||
|
||||
.task-pending {
|
||||
border-left: 2px solid var(--st-think);
|
||||
background: rgba(52, 214, 245, 0.04);
|
||||
.tcard-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 7px;
|
||||
}
|
||||
|
||||
.task-blocked {
|
||||
border-left: 2px solid var(--st-block);
|
||||
background: rgba(255, 106, 106, 0.04);
|
||||
}
|
||||
|
||||
/* ── Priority Badge ───────────────────────────────── */
|
||||
.prio-badge {
|
||||
display: inline-block;
|
||||
align-self: flex-start;
|
||||
.pr {
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 9px;
|
||||
font-size: 10px;
|
||||
font-weight: 600;
|
||||
padding: 1px 7px;
|
||||
border-radius: 20px;
|
||||
line-height: 1.5;
|
||||
padding: 1px 6px;
|
||||
border-radius: 5px;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.prio-high {
|
||||
background: rgba(255, 106, 106, 0.18);
|
||||
color: var(--st-block);
|
||||
.dot {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.prio-medium {
|
||||
background: rgba(124, 108, 255, 0.14);
|
||||
color: var(--a-mid);
|
||||
}
|
||||
.dot.work { background: var(--st-work); animation: pulse-work 1.8s infinite; }
|
||||
.dot.queue { background: var(--st-queue); }
|
||||
.dot.block { background: var(--st-block); animation: pulse-block 1.4s infinite; }
|
||||
.dot.idle { background: var(--st-idle); }
|
||||
|
||||
.prio-low {
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
.stl {
|
||||
margin-left: auto;
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 10px;
|
||||
color: var(--tx-3);
|
||||
}
|
||||
|
||||
/* ── Title ─────────────────────────────────────────── */
|
||||
.task-title {
|
||||
font-family: 'Manrope', sans-serif;
|
||||
.tt {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
margin-top: 7px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
color: var(--tx);
|
||||
line-height: 1.4;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 1;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* ── Agent ─────────────────────────────────────────── */
|
||||
.task-agent {
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 9px;
|
||||
.ow {
|
||||
font-size: 10.5px;
|
||||
color: var(--tx-3);
|
||||
font-variant-numeric: tabular-nums;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
/* ── Progress Bar ──────────────────────────────────── */
|
||||
.task-progress {
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.bar-track {
|
||||
height: 3px;
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
border-radius: 2px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.bar-fill {
|
||||
height: 100%;
|
||||
border-radius: 2px;
|
||||
transition: width 0.4s ease;
|
||||
}
|
||||
|
||||
/* Status-specific bar colors */
|
||||
.task-active .bar-fill {
|
||||
background: var(--grad);
|
||||
}
|
||||
|
||||
.task-pending .bar-fill {
|
||||
background: var(--grad);
|
||||
opacity: 0.45;
|
||||
}
|
||||
|
||||
.task-blocked .bar-fill {
|
||||
background: var(--st-block);
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
/* ── Skeleton ─────────────────────────────────── */
|
||||
.taskcard.skeleton {
|
||||
height: 98px;
|
||||
.skeleton {
|
||||
height: 78px;
|
||||
background: var(--glass);
|
||||
animation: skeleton-pulse 1.5s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes skeleton-pulse {
|
||||
0%, 100% { opacity: 0.5; }
|
||||
50% { opacity: 0.8; }
|
||||
50% { opacity: 0.8; }
|
||||
}
|
||||
|
||||
/* ── Error ────────────────────────────────────── */
|
||||
.task-error {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-family: 'Manrope', sans-serif;
|
||||
font-size: 11px;
|
||||
color: #fda4b0;
|
||||
padding: 12px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.error-icon { flex: 0 0 auto; font-size: 14px; }
|
||||
|
||||
/* ── Empty ────────────────────────────────────── */
|
||||
.task-empty {
|
||||
.tstrip-msg {
|
||||
font-family: 'Manrope', sans-serif;
|
||||
font-size: 11px;
|
||||
color: var(--tx-3);
|
||||
font-style: italic;
|
||||
padding: 12px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user