From 6cedd8410fa930facb4f48567fc9d86ffbb9865f Mon Sep 17 00:00:00 2001 From: Reviewer Date: Fri, 12 Jun 2026 17:02:50 +0200 Subject: [PATCH] refactor(frontend): deduplicate CSS keyframes, unify types, extract format utils, add UI states, trim mock data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove duplicate @keyframes pulse-* from 3 component files (already in nexus-tokens.css) - Rename AgentDetail → AgentDetailData in dashboard types to avoid collision with types/agent.ts - Extract shared formatNumber/initials/formatTime to utils/format.ts - Simplify FlowBoard: use agentStore modal/selection getters instead of duplicating local state - Add error banner + empty state to IrisChat; add loading skeleton + error/empty states to TaskStrip - Remove 105-line unused mockAgents array from useFlowLayout - Reduce operations store fallbacks from hardcoded preview data to minimal safe defaults - Update operations store tests to match lean fallback structure - Net: -73 lines, cleaner imports, fewer magic strings --- .../dashboard/v2/AgentDetailModal.vue | 25 +--- .../src/components/dashboard/v2/AgentNode.vue | 17 --- .../src/components/dashboard/v2/IrisChat.vue | 46 +++++++ .../src/components/dashboard/v2/TaskStrip.vue | 54 ++++++++ frontend/src/components/dashboard/v2/types.ts | 3 +- frontend/src/components/layout/AppSidebar.vue | 5 +- frontend/src/components/layout/Sidebar.vue | 4 +- frontend/src/components/layout/Topbar.vue | 5 - frontend/src/composables/useFlowLayout.ts | 128 +----------------- frontend/src/stores/agents.ts | 6 +- frontend/src/stores/operations.ts | 35 +---- frontend/src/utils/format.ts | 30 ++++ frontend/src/views/Dashboard/FlowBoard.vue | 46 ++----- frontend/tests/operations.test.ts | 15 +- 14 files changed, 173 insertions(+), 246 deletions(-) create mode 100644 frontend/src/utils/format.ts diff --git a/frontend/src/components/dashboard/v2/AgentDetailModal.vue b/frontend/src/components/dashboard/v2/AgentDetailModal.vue index 7e5cdab..e1362eb 100644 --- a/frontend/src/components/dashboard/v2/AgentDetailModal.vue +++ b/frontend/src/components/dashboard/v2/AgentDetailModal.vue @@ -12,12 +12,13 @@ */ import { ref, onMounted, onUnmounted, watch } from 'vue' -import type { ThinkingItem, AgentDetail } from './types' +import type { ThinkingItem, AgentDetailData } from './types' +import { formatNumber } from '../../../utils/format' /* ── Props ──────────────────────────────────────────── */ const props = defineProps<{ - agent: AgentDetail + agent: AgentDetailData // Agent-Liste für Pfeilnavigation (IDs in Anzeigereihenfolge) agentOrder: string[] }>() @@ -97,7 +98,7 @@ interface MetricDef { sub?: string } -function getMetrics(a: AgentDetail): MetricDef[] { +function getMetrics(a: AgentDetailData): MetricDef[] { return [ { label: 'Tasks aktiv', @@ -132,12 +133,6 @@ function getMetrics(a: AgentDetail): MetricDef[] { ] } -function formatNumber(n: number): string { - if (n >= 1_000_000) return (n / 1_000_000).toFixed(1) + 'M' - if (n >= 1_000) return (n / 1_000).toFixed(1) + 'k' - return String(n) -} - /* ── Pretty Model Name ────────────────────────────── */ function modelLabel(alias: string): string { @@ -453,18 +448,6 @@ const typeConfig: Record diff --git a/frontend/src/components/dashboard/v2/IrisChat.vue b/frontend/src/components/dashboard/v2/IrisChat.vue index 00424ac..a1c896d 100644 --- a/frontend/src/components/dashboard/v2/IrisChat.vue +++ b/frontend/src/components/dashboard/v2/IrisChat.vue @@ -19,6 +19,7 @@ import type { ChatMessage } from './types' const props = defineProps<{ messages: ChatMessage[] isThinking: boolean + error?: string | null }>() const emit = defineEmits<{ @@ -79,6 +80,12 @@ watch(
+ +
+ + Chat unavailable: {{ error }} +
+
@@ -89,6 +96,11 @@ watch( thinking…
+ +
+ No messages yet. Ask Iris something. +
+