Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
refactor(frontend): streamline AI integration & fix table layouts
rcourtmana6413b734655
diff --git a/frontend-modern/src/App.tsx b/frontend-modern/src/App.tsxindex a34363005c..391186eb88 100644--- a/frontend-modern/src/App.tsx+++ b/frontend-modern/src/App.tsx@@ -899,7 +899,6 @@ function App() {title={aiChatStore.context.context?.name ? `AI Assistant - ${aiChatStore.context.context.name}` : 'AI Assistant (⌘K)'}aria-label="Expand AI Assistant">- {/* Double chevron left - expand */}<svgclass="h-4 w-4 flex-shrink-0"fill="none"@@ -913,12 +912,6 @@ function App() {d="M11 19l-7-7 7-7M18 19l-7-7 7-7"/></svg>- {/* Context indicator - shows count when items are in context */}- <Show when={aiChatStore.contextItems.length > 0}>- <span class="min-w-[18px] h-[18px] px-1 flex items-center justify-center text-[10px] font-bold bg-green-500 text-white rounded-full">- {aiChatStore.contextItems.length}- </span>- </Show></button></Show><TooltipRoot />diff --git a/frontend-modern/src/components/AI/AIChat.tsx b/frontend-modern/src/components/AI/AIChat.tsxdeleted file mode 100644index edad0df140..0000000000--- a/frontend-modern/src/components/AI/AIChat.tsx+++ /dev/null@@ -1,130 +0,0 @@-import { Component, Show, createEffect, onMount, onCleanup } from 'solid-js';-import { aiChatStore } from '@/stores/aiChat';--interface AIChatProps {- onClose: () => void;-}--/**- * AIChat component - Embeds OpenCode's web UI in a slide-out panel.- *- * OpenCode provides the full chat experience including:- * - Message display and streaming- * - Tool execution visualization- * - Session management- * - Model selection- *- * Pulse provides infrastructure context via MCP tools.- */-export const AIChat: Component<AIChatProps> = (props) => {- const isOpen = () => aiChatStore.isOpen;- let iframeRef: HTMLIFrameElement | undefined;-- // Focus iframe when panel opens for keyboard navigation- createEffect(() => {- if (isOpen() && iframeRef) {- setTimeout(() => iframeRef?.focus(), 100);- }- });-- // Handle escape key to close panel- const handleKeyDown = (e: KeyboardEvent) => {- if (e.key === 'Escape' && isOpen()) {- props.onClose();- }- };-- onMount(() => {- document.addEventListener('keydown', handleKeyDown);- });-- onCleanup(() => {- document.removeEventListener('keydown', handleKeyDown);- });-- return (- <div- class={`flex-shrink-0 h-full bg-white dark:bg-gray-900 border-l border-gray-200 dark:border-gray-700 flex flex-col transition-all duration-300 overflow-hidden ${- isOpen() ? 'w-[500px]' : 'w-0 border-l-0'- }`}- >- <Show when={isOpen()}>- {/* Header */}- <div class="flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-700 bg-gradient-to-r from-purple-50 to-pink-50 dark:from-purple-900/20 dark:to-pink-900/20">- <div class="flex items-center gap-3">- <div class="p-2 bg-purple-100 dark:bg-purple-900/40 rounded-lg">- <svg- class="w-5 h-5 text-purple-600 dark:text-purple-300"- fill="none"- stroke="currentColor"- viewBox="0 0 24 24"- >- <path- stroke-linecap="round"- stroke-linejoin="round"- stroke-width="1.8"- d="M9.75 3.104v5.714a2.25 2.25 0 01-.659 1.591L5 14.5M9.75 3.104c-.251.023-.501.05-.75.082m.75-.082a24.301 24.301 0 014.5 0m0 0v5.714c0 .597.237 1.17.659 1.591L19.8 15.3M14.25 3.104c.251.023.501.05.75.082M19.8 15.3l-1.57.393A9.065 9.065 0 0112 15a9.065 9.065 0 00-6.23.693L5 14.5m14.8.8l1.402 1.402c1.232 1.232.65 3.318-1.067 3.611l-2.576.43a18.003 18.003 0 01-5.118 0l-2.576-.43c-1.717-.293-2.299-2.379-1.067-3.611L5 14.5"- />- </svg>- </div>- <div>- <h2 class="text-sm font-semibold text-gray-900 dark:text-gray-100">- AI Assistant- </h2>- <p class="text-xs text-gray-500 dark:text-gray-400">- Powered by OpenCode- </p>- </div>- </div>- <div class="flex items-center gap-2">- {/* Open in new tab */}- <a- href="/opencode/"- target="_blank"- rel="noopener noreferrer"- class="p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800"- title="Open in new tab"- >- <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">- <path- stroke-linecap="round"- stroke-linejoin="round"- stroke-width="2"- d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"- />- </svg>- </a>- {/* Collapse panel */}- <button- onClick={props.onClose}- class="p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800"- title="Collapse panel (Esc)"- >- <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">- <path- stroke-linecap="round"- stroke-linejoin="round"- stroke-width="2"- d="M13 5l7 7-7 7M6 5l7 7-7 7"- />- </svg>- </button>- </div>- </div>-- {/* OpenCode iframe */}- <div class="flex-1 relative">- <iframe- ref={iframeRef}- src="/opencode/"- class="absolute inset-0 w-full h-full border-0"- title="AI Assistant"- allow="clipboard-read; clipboard-write"- />- </div>- </Show>- </div>- );-};--export default AIChat;diff --git a/frontend-modern/src/components/AI/Chat/ChatHeader.tsx b/frontend-modern/src/components/AI/Chat/ChatHeader.tsxdeleted file mode 100644index d94847a432..0000000000--- a/frontend-modern/src/components/AI/Chat/ChatHeader.tsx+++ /dev/null@@ -1,303 +0,0 @@-import { Component, Show, For, createSignal } from 'solid-js';-import { aiChatStore } from '@/stores/aiChat';-import {- PROVIDER_DISPLAY_NAMES,- groupModelsByProvider,-} from '../aiChatUtils';-import type { ModelInfo } from './types';--interface ChatHeaderProps {- title: string;- subtitle?: string;- onClose: () => void;- // Model selection- models: ModelInfo[];- selectedModel: string;- onModelChange: (model: string) => void;- // Autonomous mode- autonomousMode: boolean;- onToggleAutonomous: () => void;- isTogglingAutonomous: boolean;-}--export const ChatHeader: Component<ChatHeaderProps> = (props) => {- const [showModelSelector, setShowModelSelector] = createSignal(false);- const [showSessionPicker, setShowSessionPicker] = createSignal(false);- const [showAllModels, setShowAllModels] = createSignal(false);-- // Filter models based on notable status- const filteredModels = () => {- if (showAllModels()) {- return props.models;- }- // Show notable models, or all if none are notable- const notable = props.models.filter(m => m.notable);- return notable.length > 0 ? notable : props.models;- };-- // Count hidden models- const hiddenModelCount = () => {- const notable = props.models.filter(m => m.notable);- return props.models.length - notable.length;- };-- return (- <div class="flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-700 bg-gradient-to-r from-purple-50 to-violet-50 dark:from-purple-900/20 dark:to-violet-900/20">- {/* Left side - title */}- <div class="flex items-center gap-3">- <div class="p-2 bg-gradient-to-br from-purple-500 to-violet-500 rounded-xl shadow-lg">- <svg- class="w-5 h-5 text-white"- fill="none"- stroke="currentColor"- viewBox="0 0 24 24"- >- <path- stroke-linecap="round"- stroke-linejoin="round"- stroke-width="1.8"- d="M9.75 3.104v5.714a2.25 2.25 0 01-.659 1.591L5 14.5M9.75 3.104c-.251.023-.501.05-.75.082m.75-.082a24.301 24.301 0 014.5 0m0 0v5.714c0 .597.237 1.17.659 1.591L19.8 15.3M14.25 3.104c.251.023.501.05.75.082M19.8 15.3l-1.57.393A9.065 9.065 0 0112 15a9.065 9.065 0 00-6.23.693L5 14.5m14.8.8l1.402 1.402c1.232 1.232.65 3.318-1.067 3.611l-2.576.43a18.003 18.003 0 01-5.118 0l-2.576-.43c-1.717-.293-2.299-2.379-1.067-3.611L5 14.5"- />- </svg>- </div>- <div>- <h2 class="text-sm font-semibold text-gray-900 dark:text-gray-100">- {props.title}- </h2>- <Show when={props.subtitle}>- <p class="text-xs text-gray-500 dark:text-gray-400">{props.subtitle}</p>- </Show>- </div>- </div>-- {/* Right side - controls */}- <div class="flex items-center gap-2">- {/* Model selector */}- <Show when={props.models.length > 0}>- <div class="relative">- <button- onClick={() => setShowModelSelector(!showModelSelector())}- class="flex items-center gap-1.5 px-2.5 py-1.5 text-xs text-gray-600 dark:text-gray-300 hover:text-gray-800 dark:hover:text-gray-100 rounded-lg border border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600 bg-white dark:bg-gray-800 transition-colors"- >- <svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" />- </svg>- <span class="max-w-[80px] truncate font-medium">- {props.selectedModel || 'Default'}- </span>- <svg class="w-3 h-3 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />- </svg>- </button>-- <Show when={showModelSelector()}>- <div class="absolute right-0 top-full mt-1 w-64 max-h-80 overflow-y-auto bg-white dark:bg-gray-800 rounded-xl shadow-xl border border-gray-200 dark:border-gray-700 z-50 py-1">- <button- onClick={() => { props.onModelChange(''); setShowModelSelector(false); }}- class={`w-full px-3 py-2 text-left text-sm hover:bg-gray-50 dark:hover:bg-gray-700 ${!props.selectedModel ? 'bg-purple-50 dark:bg-purple-900/30' : ''}`}- >- <div class="font-medium text-gray-900 dark:text-gray-100">Default</div>- <div class="text-xs text-gray-500 dark:text-gray-400">Use configured default model</div>- </button>- <For each={Array.from(groupModelsByProvider(filteredModels()).entries())}>- {([provider, models]) => (- <>- <div class="px-3 py-1.5 text-xs font-semibold text-gray-500 dark:text-gray-400 bg-gray-50 dark:bg-gray-700/50 sticky top-0">- {PROVIDER_DISPLAY_NAMES[provider] || provider}- </div>- <For each={models}>- {(model) => (- <button- onClick={() => { props.onModelChange(model.id); setShowModelSelector(false); }}- class={`w-full px-3 py-2 text-left text-sm hover:bg-gray-50 dark:hover:bg-gray-700 ${props.selectedModel === model.id ? 'bg-purple-50 dark:bg-purple-900/30' : ''}`}- >- <div class="flex items-center gap-1.5">- <span class="font-medium text-gray-900 dark:text-gray-100">- {model.name || model.id.split(':').pop()}- </span>- <Show when={model.notable}>- <span class="px-1 py-0.5 text-[10px] font-medium bg-gradient-to-r from-purple-500 to-violet-500 text-white rounded">- NEW- </span>- </Show>- </div>- </button>- )}- </For>- </>- )}- </For>- {/* Show/hide older models toggle */}- <Show when={hiddenModelCount() > 0}>- <div class="border-t border-gray-200 dark:border-gray-700 mt-1 pt-1">- <button- onClick={() => setShowAllModels(!showAllModels())}- class="w-full px-3 py-2 text-left text-xs text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-1.5"- >- <svg class={`w-3 h-3 transition-transform ${showAllModels() ? 'rotate-180' : ''}`} fill="none" stroke="currentColor" viewBox="0 0 24 24">- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />- </svg>- {showAllModels() ? 'Hide older models' : `Show ${hiddenModelCount()} older models`}- </button>- </div>- </Show>- </div>- </Show>- </div>- </Show>-- {/* Autonomous mode toggle */}- <button- onClick={props.onToggleAutonomous}- disabled={props.isTogglingAutonomous}- class={`p-2 rounded-lg transition-all ${props.autonomousMode- ? 'text-amber-600 dark:text-amber-400 bg-amber-100 dark:bg-amber-900/40 hover:bg-amber-200 dark:hover:bg-amber-900/60 shadow-sm'- : 'text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800'- } ${props.isTogglingAutonomous ? 'opacity-50 cursor-wait' : ''}`}- title={props.autonomousMode ? 'Autonomous Mode: ON (commands run without approval)' : 'Autonomous Mode: OFF (commands need approval)'}- >- <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z" />- </svg>- </button>-- {/* Session management */}- <div class="relative">- <button- onClick={() => {- setShowSessionPicker(!showSessionPicker());- if (!showSessionPicker()) {- aiChatStore.refreshSessions();- }- }}- class="p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors"- title="Chat sessions"- >- <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10" />- </svg>- </button>-- <Show when={showSessionPicker()}>- <div class="absolute right-0 top-full mt-1 w-72 max-h-96 bg-white dark:bg-gray-800 rounded-xl shadow-xl border border-gray-200 dark:border-gray-700 z-50 overflow-hidden">- {/* New conversation */}- <button- onClick={() => {- aiChatStore.newConversation();- setShowSessionPicker(false);- }}- class="w-full px-3 py-2.5 text-left text-sm flex items-center gap-2 text-purple-600 dark:text-purple-400 hover:bg-purple-50 dark:hover:bg-purple-900/20 border-b border-gray-200 dark:border-gray-700"- >- <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />- </svg>- <span class="font-medium">New conversation</span>- </button>-- {/* Session list */}- <div class="max-h-64 overflow-y-auto">- <Show when={aiChatStore.sessions.length > 0} fallback={- <div class="px-3 py-6 text-center text-xs text-gray-500 dark:text-gray-400">- No previous conversations- </div>- }>- <For each={aiChatStore.sessions}>- {(session) => {- const isCurrentSession = () => session.id === aiChatStore.sessionId;- const sessionDate = new Date(session.updated_at);- const isToday = sessionDate.toDateString() === new Date().toDateString();- const dateStr = isToday- ? sessionDate.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })- : sessionDate.toLocaleDateString([], { month: 'short', day: 'numeric' });-- return (- <div- class={`group relative px-3 py-2.5 flex items-start gap-2 hover:bg-gray-50 dark:hover:bg-gray-700/50 cursor-pointer ${isCurrentSession() ? 'bg-purple-50 dark:bg-purple-900/20' : ''}`}- onClick={() => {- if (!isCurrentSession()) {- aiChatStore.switchSession(session.id);- }- setShowSessionPicker(false);- }}- >- <div class="flex-1 min-w-0">- <div class="flex items-center gap-2">- <span class={`text-sm font-medium truncate ${isCurrentSession() ? 'text-purple-700 dark:text-purple-300' : 'text-gray-900 dark:text-gray-100'}`}>- {session.title || 'Untitled conversation'}- </span>- <Show when={isCurrentSession()}>- <span class="flex-shrink-0 w-1.5 h-1.5 rounded-full bg-purple-500" />- </Show>- </div>- <div class="flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400">- <span>{session.message_count} messages</span>- <span>·</span>- <span>{dateStr}</span>- </div>- </div>- {/* Delete button */}- <button- type="button"- class="flex-shrink-0 p-1 rounded opacity-0 group-hover:opacity-100 hover:bg-red-100 dark:hover:bg-red-900/30 text-gray-400 hover:text-red-500 transition-opacity"- onClick={(e) => {- e.stopPropagation();- if (confirm('Delete this conversation?')) {- aiChatStore.deleteSession(session.id);- }- }}- title="Delete conversation"- >- <svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" />- </svg>- </button>- </div>- );- }}- </For>- </Show>- </div>-- {/* Sync status */}- <div class="px-3 py-2 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50">- <div class="flex items-center justify-between text-xs text-gray-500 dark:text-gray-400">- <span class="flex items-center gap-1.5">- <Show when={aiChatStore.syncing} fallback={- <svg class="w-3 h-3 text-green-500" fill="currentColor" viewBox="0 0 20 20">- <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" />- </svg>- }>- <svg class="w-3 h-3 animate-spin" fill="none" viewBox="0 0 24 24">- <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4" />- <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" />- </svg>- </Show>- {aiChatStore.syncing ? 'Syncing...' : 'Synced'}- </span>- <button- type="button"- onClick={() => setShowSessionPicker(false)}- class="text-gray-400 hover:text-gray-600 dark:hover:text-gray-200"- >- Close- </button>- </div>- </div>- </div>- </Show>- </div>-- {/* Close button */}- <button- onClick={props.onClose}- class="p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors"- title="Collapse panel"- >- <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 5l7 7-7 7M6 5l7 7-7 7" />- </svg>- </button>- </div>- </div>- );-};diff --git a/frontend-modern/src/components/AI/Chat/ChatInput.tsx b/frontend-modern/src/components/AI/Chat/ChatInput.tsxdeleted file mode 100644index ce7b70af2a..0000000000--- a/frontend-modern/src/components/AI/Chat/ChatInput.tsx+++ /dev/null@@ -1,193 +0,0 @@-import { Component, Show, For } from 'solid-js';-import type { ChatContextItem } from './types';--interface ChatInputProps {- value: string;- onChange: (value: string) => void;- onSubmit: () => void;- onStop: () => void;- isLoading: boolean;- queuedMessage: string | null;- onClearQueue: () => void;- placeholder?: string;- contextItems: ChatContextItem[];- onAddContext: () => void;- onRemoveContext: (id: string) => void;- onClearAllContext: () => void;- disabled?: boolean;-}--export const ChatInput: Component<ChatInputProps> = (props) => {- let inputRef: HTMLTextAreaElement | undefined;-- const handleKeyDown = (e: KeyboardEvent) => {- if (e.key === 'Enter' && !e.shiftKey) {- e.preventDefault();- props.onSubmit();- }- };-- const placeholder = () => {- if (props.isLoading) {- return props.queuedMessage- ? 'Type another message to replace queued...'- : 'Type to queue your next message...';- }- return props.placeholder || 'Ask about your infrastructure...';- };-- return (- <div class="border-t border-gray-200 dark:border-gray-700 p-4 bg-white dark:bg-gray-900">- {/* Context section */}- <div class="mb-3 px-3 py-2.5 bg-gray-50 dark:bg-gray-800/50 rounded-xl border border-gray-200 dark:border-gray-700">- <div class="flex items-center justify-between mb-2">- <div class="flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400">- <svg class="w-3.5 h-3.5 text-purple-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />- </svg>- <span class="font-medium">- Context {props.contextItems.length > 0 ? `(${props.contextItems.length})` : ''}- </span>- </div>- <Show when={props.contextItems.length > 0}>- <button- type="button"- onClick={props.onClearAllContext}- class="text-[10px] text-gray-400 hover:text-red-500 transition-colors"- >- Clear all- </button>- </Show>- </div>-- {/* Context items */}- <div class="flex flex-wrap gap-1.5">- <For each={props.contextItems}>- {(item) => (- <span class="inline-flex items-center gap-1 px-2 py-1 text-[11px] rounded-lg bg-purple-100 text-purple-800 dark:bg-purple-900/40 dark:text-purple-200">- <span class="text-[9px] uppercase text-purple-500 dark:text-purple-400 font-semibold">- {item.type}- </span>- <span class="font-medium">{item.name}</span>- <button- type="button"- onClick={() => props.onRemoveContext(item.id)}- class="ml-0.5 p-0.5 rounded hover:bg-purple-200 dark:hover:bg-purple-800 transition-colors"- >- <svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />- </svg>- </button>- </span>- )}- </For>-- {/* Add context button */}- <button- type="button"- onClick={props.onAddContext}- class="inline-flex items-center gap-1 px-2 py-1 text-[11px] rounded-lg border border-dashed border-gray-300 dark:border-gray-600 text-gray-500 dark:text-gray-400 hover:border-purple-400 hover:text-purple-600 dark:hover:border-purple-500 dark:hover:text-purple-400 transition-colors"- >- <svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />- </svg>- <span>Add</span>- </button>- </div>-- <Show when={props.contextItems.length === 0}>- <p class="mt-2 text-[10px] text-gray-400 dark:text-gray-500">- Add VMs, containers, or hosts to provide context for your questions- </p>- </Show>- </div>-- {/* Queued message indicator */}- <Show when={props.queuedMessage}>- <div class="flex items-center gap-2 px-3 py-2 mb-2 text-xs rounded-lg bg-amber-50 dark:bg-amber-900/30 border border-amber-200 dark:border-amber-700 text-amber-700 dark:text-amber-300">- <svg class="w-4 h-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" />- </svg>- <span class="flex-1 truncate">- <span class="font-medium">Queued:</span> "{props.queuedMessage!.substring(0, 50)}- {props.queuedMessage!.length > 50 ? '...' : ''}"- </span>- <button- type="button"- onClick={props.onClearQueue}- class="p-0.5 rounded hover:bg-amber-200 dark:hover:bg-amber-800 transition-colors"- >- <svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />- </svg>- </button>- </div>- </Show>-- {/* Input form */}- <form onSubmit={(e) => { e.preventDefault(); props.onSubmit(); }} class="flex gap-2">- <textarea- ref={inputRef}- value={props.value}- onInput={(e) => props.onChange(e.currentTarget.value)}- onKeyDown={handleKeyDown}- placeholder={placeholder()}- rows={2}- disabled={props.disabled}- class={`flex-1 px-4 py-3 text-sm rounded-xl border bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-2 focus:border-transparent resize-none transition-all ${- props.isLoading- ? 'border-amber-300 dark:border-amber-600 focus:ring-amber-500'- : 'border-gray-200 dark:border-gray-700 focus:ring-purple-500'- } ${props.disabled ? 'opacity-50 cursor-not-allowed' : ''}`}- />-- <div class="flex flex-col gap-1.5 self-end">- <Show- when={props.isLoading}- fallback={- <button- type="submit"- disabled={!props.value.trim() || props.disabled}- class="px-4 py-3 bg-gradient-to-r from-purple-600 to-violet-600 hover:from-purple-700 hover:to-violet-700 text-white rounded-xl disabled:opacity-50 disabled:cursor-not-allowed transition-all shadow-lg hover:shadow-xl disabled:shadow-none"- >- <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8" />- </svg>- </button>- }- >- {/* Queue button when loading */}- <button- type="submit"- disabled={!props.value.trim()}- class="px-4 py-2.5 bg-amber-500 hover:bg-amber-600 text-white rounded-xl disabled:opacity-50 disabled:cursor-not-allowed transition-colors shadow-sm"- title={props.queuedMessage ? 'Replace queued message' : 'Queue message'}- >- <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" />- </svg>- </button>- {/* Stop button */}- <button- type="button"- onClick={props.onStop}- class="px-4 py-2.5 bg-red-500 hover:bg-red-600 text-white rounded-xl transition-colors shadow-sm"- title="Stop generating"- >- <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24">- <rect x="6" y="6" width="12" height="12" rx="1" />- </svg>- </button>- </Show>- </div>- </form>-- {/* Help text */}- <p class="text-xs text-gray-400 dark:text-gray-500 mt-2 text-center">- {props.isLoading- ? 'Type and press Enter to queue your next message'- : 'Press Enter to send, Shift+Enter for new line'}- </p>- </div>- );-};diff --git a/frontend-modern/src/components/AI/Chat/ContextPicker.tsx b/frontend-modern/src/components/AI/Chat/ContextPicker.tsxdeleted file mode 100644index e637b95612..0000000000--- a/frontend-modern/src/components/AI/Chat/ContextPicker.tsx+++ /dev/null@@ -1,160 +0,0 @@-import { Component, Show, For, createSignal, createMemo } from 'solid-js';-import type { ChatContextItem } from './types';--interface ContextPickerProps {- isOpen: boolean;- onClose: () => void;- resources: ChatContextItem[];- selectedIds: string[];- onSelect: (resource: ChatContextItem) => void;-}--export const ContextPicker: Component<ContextPickerProps> = (props) => {- const [search, setSearch] = createSignal('');-- const filteredResources = createMemo(() => {- const term = search().toLowerCase();- if (!term) return props.resources;- return props.resources.filter(- (r) =>- r.name.toLowerCase().includes(term) ||- r.type.toLowerCase().includes(term) ||- (r.node && r.node.toLowerCase().includes(term))- );- });-- const isSelected = (id: string) => props.selectedIds.includes(id);-- const getTypeIcon = (type: string) => {- switch (type) {- case 'vm':- return { bg: 'bg-blue-100 dark:bg-blue-900/40', text: 'text-blue-600 dark:text-blue-400', label: 'VM' };- case 'container':- return { bg: 'bg-green-100 dark:bg-green-900/40', text: 'text-green-600 dark:text-green-400', label: 'CT' };- case 'node':- return { bg: 'bg-orange-100 dark:bg-orange-900/40', text: 'text-orange-600 dark:text-orange-400', label: 'N' };- case 'host':- return { bg: 'bg-purple-100 dark:bg-purple-900/40', text: 'text-purple-600 dark:text-purple-400', label: 'H' };- default:- return { bg: 'bg-gray-100 dark:bg-gray-700', text: 'text-gray-600 dark:text-gray-400', label: '?' };- }- };-- const getStatusColor = (status: string) => {- switch (status) {- case 'running':- case 'online':- return 'bg-green-500';- case 'stopped':- case 'offline':- return 'bg-gray-400';- default:- return 'bg-yellow-500';- }- };-- return (- <Show when={props.isOpen}>- <div class="absolute bottom-full left-0 mb-1 w-72 max-h-80 bg-white dark:bg-gray-800 rounded-xl shadow-xl border border-gray-200 dark:border-gray-700 overflow-hidden z-50">- {/* Search input */}- <div class="p-2 border-b border-gray-200 dark:border-gray-700">- <div class="relative">- <svg- class="absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"- fill="none"- stroke="currentColor"- viewBox="0 0 24 24"- >- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />- </svg>- <input- type="text"- value={search()}- onInput={(e) => setSearch(e.currentTarget.value)}- placeholder="Search VMs, containers, hosts..."- class="w-full pl-9 pr-3 py-2 text-sm rounded-lg border border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent"- autofocus- />- </div>- </div>-- {/* Resource list */}- <div class="max-h-56 overflow-y-auto">- <Show- when={filteredResources().length > 0}- fallback={- <div class="p-6 text-center text-xs text-gray-500 dark:text-gray-400">- No resources found- </div>- }- >- <For each={filteredResources()}>- {(resource) => {- const typeInfo = getTypeIcon(resource.type);- const selected = isSelected(resource.id);-- return (- <button- type="button"- onClick={() => !selected && props.onSelect(resource)}- disabled={selected}- class={`w-full px-3 py-2.5 text-left flex items-center gap-2.5 text-xs transition-colors ${- selected- ? 'bg-purple-50 dark:bg-purple-900/20 text-gray-400 dark:text-gray-500 cursor-default'- : 'hover:bg-gray-50 dark:hover:bg-gray-700/50 text-gray-700 dark:text-gray-300'- }`}- >- {/* Type icon */}- <span- class={`flex-shrink-0 w-6 h-6 rounded-lg flex items-center justify-center text-[9px] font-bold uppercase ${typeInfo.bg} ${typeInfo.text}`}- >- {typeInfo.label}- </span>-- {/* Name and details */}- <div class="flex-1 min-w-0">- <div class="font-medium truncate">{resource.name}</div>- <Show when={resource.node}>- <div class="text-[10px] text-gray-400">{resource.node}</div>- </Show>- </div>-- {/* Status indicator */}- <span- class={`flex-shrink-0 w-2 h-2 rounded-full ${getStatusColor(resource.status)}`}- />-- {/* Selected checkmark */}- <Show when={selected}>- <svg class="w-4 h-4 text-purple-500" fill="currentColor" viewBox="0 0 20 20">- <path- fill-rule="evenodd"- d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"- clip-rule="evenodd"- />- </svg>- </Show>- </button>- );- }}- </For>- </Show>- </div>-- {/* Close button */}- <div class="p-2 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50">- <button- type="button"- onClick={() => {- props.onClose();- setSearch('');- }}- class="w-full px-2 py-1.5 text-xs text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 transition-colors"- >- Close- </button>- </div>- </div>- </Show>- );-};diff --git a/frontend-modern/src/components/AI/Chat/index.tsx b/frontend-modern/src/components/AI/Chat/index.tsxindex a0ec3833c2..1c59ffc94d 100644--- a/frontend-modern/src/components/AI/Chat/index.tsx+++ b/frontend-modern/src/components/AI/Chat/index.tsx@@ -34,8 +34,6 @@ export const AIChat: Component<AIChatProps> = (props) => {const [modelsError, setModelsError] = createSignal('');const [defaultModel, setDefaultModel] = createSignal('');const [chatOverrideModel, setChatOverrideModel] = createSignal('');- const [showSessionActions, setShowSessionActions] = createSignal(false);- const [sessionActionLoading, setSessionActionLoading] = createSignal<string | null>(null);const loadModelSelections = (): Record<string, string> => {try {@@ -215,7 +213,6 @@ export const AIChat: Component<AIChatProps> = (props) => {// Only close if click is outside dropdown containersif (!target.closest('[data-dropdown]')) {setShowSessions(false);- setShowSessionActions(false);}};document.addEventListener('click', handleClickOutside);@@ -224,13 +221,14 @@ export const AIChat: Component<AIChatProps> = (props) => {// Handle submitconst handleSubmit = () => {+ if (chat.isLoading()) return;const prompt = input().trim();if (!prompt) return;chat.sendMessage(prompt);setInput('');};- // Handle key down - allow sending even while loading (will abort and send)+ // Handle key down - submit when not loadingconst handleKeyDown = (e: KeyboardEvent) => {if (e.key === 'Enter' && !e.shiftKey) {e.preventDefault();@@ -336,61 +334,6 @@ export const AIChat: Component<AIChatProps> = (props) => {};- // Session action handlers- const handleSummarize = async () => {- const sessionId = chat.sessionId();- if (!sessionId) return;-- setSessionActionLoading('summarize');- setShowSessionActions(false);- try {- await OpenCodeAPI.summarizeSession(sessionId);- notificationStore.success('Session summarized to save context');- } catch (error) {- notificationStore.error('Failed to summarize session');- } finally {- setSessionActionLoading(null);- }- };-- const handleGetDiff = async () => {- const sessionId = chat.sessionId();- if (!sessionId) return;-- setSessionActionLoading('diff');- setShowSessionActions(false);- try {- const diff = await OpenCodeAPI.getSessionDiff(sessionId);- const files = diff.files || [];- if (files.length === 0) {- notificationStore.info('No file changes in this session');- } else {- notificationStore.success(`${files.length} file(s) changed in this session`);- // Could open a modal here to show detailed diff- }- } catch (error) {- notificationStore.error('Failed to get session diff');- } finally {- setSessionActionLoading(null);- }- };-- const handleRevert = async () => {- const sessionId = chat.sessionId();- if (!sessionId) return;-- setSessionActionLoading('revert');- setShowSessionActions(false);- try {- await OpenCodeAPI.revertSession(sessionId);- notificationStore.success('Session changes reverted');- } catch (error) {- notificationStore.error('Failed to revert session');- } finally {- setSessionActionLoading(null);- }- };-return (<divclass={`flex-shrink-0 h-full bg-white dark:bg-slate-900 border-l border-slate-200 dark:border-slate-700 flex flex-col transition-all duration-300 overflow-hidden ${isOpen() ? 'w-[480px]' : 'w-0 border-l-0'@@ -414,6 +357,18 @@ export const AIChat: Component<AIChatProps> = (props) => {</div><div class="flex items-center gap-1.5">+ {/* New chat */}+ <button+ onClick={handleNewConversation}+ class="flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] text-slate-600 dark:text-slate-300 hover:text-slate-800 dark:hover:text-slate-100 rounded-lg border border-slate-200 dark:border-slate-700 hover:border-slate-300 dark:hover:border-slate-600 bg-white dark:bg-slate-800 transition-colors"+ title="New chat"+ >+ <svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />+ </svg>+ <span class="font-medium">New</span>+ </button>+{/* Model selector */}<ModelSelectormodels={models()}@@ -431,7 +386,8 @@ export const AIChat: Component<AIChatProps> = (props) => {<div class="relative" data-dropdown><buttononClick={() => {- setShowSessions(!showSessions());+ const next = !showSessions();+ setShowSessions(next);}}class="p-2 text-slate-400 hover:text-slate-600 dark:hover:text-slate-300 rounded-lg hover:bg-slate-100 dark:hover:bg-slate-700 transition-colors"title="Chat sessions"@@ -491,66 +447,6 @@ export const AIChat: Component<AIChatProps> = (props) => {</Show></div>- {/* Session Actions Menu */}- <div class="relative" data-dropdown>- <button- onClick={() => {- if (!chat.sessionId()) {- notificationStore.info('Send a message first to start a session');- return;- }- setShowSessions(false);- setShowSessionActions(!showSessionActions());- }}- disabled={sessionActionLoading() !== null}- class="p-2 text-slate-400 hover:text-slate-600 dark:hover:text-slate-300 rounded-lg hover:bg-slate-100 dark:hover:bg-slate-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"- title="Session actions (summarize, diff, revert)"- >- <Show when={sessionActionLoading()} fallback={- <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6V4m0 2a2 2 0 100 4m0-4a2 2 0 110 4m-6 8a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4m6 6v10m6-2a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4" />- </svg>- }>- <svg class="w-4 h-4 animate-spin" fill="none" viewBox="0 0 24 24">- <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="3" />- <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" />- </svg>- </Show>- </button>-- <Show when={showSessionActions()}>- <div class="absolute right-0 top-full mt-1 w-48 bg-white dark:bg-slate-800 rounded-xl shadow-xl border border-slate-200 dark:border-slate-700 z-50 overflow-hidden">- <button- onClick={handleSummarize}- class="w-full px-3 py-2 text-left text-sm flex items-center gap-2 text-slate-700 dark:text-slate-200 hover:bg-slate-100 dark:hover:bg-slate-700"- >- <svg class="w-4 h-4 text-purple-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16m-7 6h7" />- </svg>- Summarize context- </button>- <button- onClick={handleGetDiff}- class="w-full px-3 py-2 text-left text-sm flex items-center gap-2 text-slate-700 dark:text-slate-200 hover:bg-slate-100 dark:hover:bg-slate-700"- >- <svg class="w-4 h-4 text-blue-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2" />- </svg>- View file changes- </button>- <button- onClick={handleRevert}- class="w-full px-3 py-2 text-left text-sm flex items-center gap-2 text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 border-t border-slate-200 dark:border-slate-700"- >- <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 10h10a8 8 0 018 8v2M3 10l6 6m-6-6l6-6" />- </svg>- Revert changes- </button>- </div>- </Show>- </div>-{/* Close button */}<buttononClick={(e) => {@@ -638,34 +534,38 @@ export const AIChat: Component<AIChatProps> = (props) => {class="flex-1 px-4 py-3 text-sm rounded-xl border border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-800 text-slate-900 dark:text-slate-100 placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent resize-none"/><div class="flex gap-1.5 self-end">- {/* Send button - always visible, sends new message (aborts current if streaming) */}- <button- type="submit"- disabled={!input().trim()}- class="px-4 py-3 bg-gradient-to-r from-purple-600 to-violet-600 hover:from-purple-700 hover:to-violet-700 text-white rounded-xl disabled:opacity-50 disabled:cursor-not-allowed transition-all shadow-lg shadow-purple-500/20 hover:shadow-xl hover:shadow-purple-500/30"- title={chat.isLoading() ? "Send (will interrupt current response)" : "Send"}+ <Show+ when={!chat.isLoading()}+ fallback={+ <button+ type="button"+ onClick={chat.stop}+ class="px-4 py-3 bg-red-500 hover:bg-red-600 text-white rounded-xl transition-colors shadow-lg shadow-red-500/20"+ title="Stop"+ >+ <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24">+ <rect x="6" y="6" width="12" height="12" rx="1" />+ </svg>+ </button>+ }>- <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8" />- </svg>- </button>- {/* Stop button - only visible while streaming */}- <Show when={chat.isLoading()}><button- type="button"- onClick={chat.stop}- class="px-4 py-3 bg-red-500 hover:bg-red-600 text-white rounded-xl transition-colors shadow-lg shadow-red-500/20"- title="Stop"+ type="submit"+ disabled={!input().trim()}+ class="px-4 py-3 bg-gradient-to-r from-purple-600 to-violet-600 hover:from-purple-700 hover:to-violet-700 text-white rounded-xl disabled:opacity-50 disabled:cursor-not-allowed transition-all shadow-lg shadow-purple-500/20 hover:shadow-xl hover:shadow-purple-500/30"+ title="Send">- <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24">- <rect x="6" y="6" width="12" height="12" rx="1" />+ <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8" /></svg></button></Show></div></form><p class="text-[10px] text-slate-400 dark:text-slate-500 mt-2 text-center">- Press Enter to send · Shift+Enter for new line+ {chat.isLoading()+ ? 'Generating... click Stop to interrupt'+ : 'Press Enter to send · Shift+Enter for new line'}</p></div></Show>diff --git a/frontend-modern/src/components/AI/Chat/types.ts b/frontend-modern/src/components/AI/Chat/types.tsindex 657885789d..3a56e9e5e7 100644--- a/frontend-modern/src/components/AI/Chat/types.ts+++ b/frontend-modern/src/components/AI/Chat/types.ts@@ -80,15 +80,6 @@ export interface ModelInfo {notable?: boolean;}-export interface ChatContextItem {- id: string;- type: string;- name: string;- status: string;- node?: string;- data: Record<string, unknown>;-}-// Stream event types from backendexport type StreamEventKind =| 'content'diff --git a/frontend-modern/src/components/Dashboard/Dashboard.tsx b/frontend-modern/src/components/Dashboard/Dashboard.tsxindex 4983e2d764..e889ee2c9c 100644--- a/frontend-modern/src/components/Dashboard/Dashboard.tsx+++ b/frontend-modern/src/components/Dashboard/Dashboard.tsx@@ -836,26 +836,6 @@ export function Dashboard(props: DashboardProps) {const handleNodeSelect = (nodeId: string | null, nodeType: 'pve' | 'pbs' | 'pmg' | null) => {logger.debug('handleNodeSelect called', { nodeId, nodeType });- // If AI sidebar is open, add node to AI context instead of filtering- if (aiChatStore.isOpen && nodeId && nodeType === 'pve') {- const node = props.nodes.find((n) => n.id === nodeId);- if (node) {- // Toggle: remove if already in context, add if not- if (aiChatStore.hasContextItem(nodeId)) {- aiChatStore.removeContextItem(nodeId);- } else {- aiChatStore.addContextItem('node', nodeId, node.name, {- nodeName: node.name,- name: node.name,- type: 'Proxmox Node',- status: node.status,- instance: node.instance,- });- }- }- return;- }-// Track selected node for filtering (independent of search)if (nodeType === 'pve' || nodeType === null) {setSelectedNode(nodeId);@@ -915,43 +895,7 @@ export function Dashboard(props: DashboardProps) {}};- // Handle row click - add guest to AI context (works even when sidebar is closed)- const handleGuestRowClick = (guest: VM | Container) => {- // Only enable if AI is configured- if (!aiChatStore.enabled) return;- // Use canonical format: instance:node:vmid- const guestId = guest.id || `${guest.instance}:${guest.node}:${guest.vmid}`;- const guestType = guest.type === 'qemu' ? 'vm' : 'container';- const isOCI = guest.type === 'oci' || ('isOci' in guest && guest.isOci === true);-- // Toggle: remove if already in context, add if not- if (aiChatStore.hasContextItem(guestId)) {- aiChatStore.removeContextItem(guestId);- // If no items left in context and sidebar is open, keep it open for now- } else {- // Build context with OCI-specific info when applicable- const contextData: Record<string, unknown> = {- guestName: guest.name,- name: guest.name,- type: guest.type === 'qemu' ? 'Virtual Machine' : (isOCI ? 'OCI Container' : 'LXC Container'),- vmid: guest.vmid,- node: guest.node,- status: guest.status,- };-- // Add OCI image info if available- if (isOCI && 'osTemplate' in guest && guest.osTemplate) {- contextData.ociImage = guest.osTemplate;- }-- aiChatStore.addContextItem(guestType, guestId, guest.name, contextData);- // Auto-open the sidebar when first item is selected- if (!aiChatStore.isOpen) {- aiChatStore.open();- }- }- };return (<div class="space-y-3">@@ -1118,7 +1062,7 @@ export function Dashboard(props: DashboardProps) {<ComponentErrorBoundary name="Guest Table"><Card padding="none" tone="glass" class="mb-4 overflow-hidden"><div class="overflow-x-auto">- <table class="w-full border-collapse whitespace-nowrap" style={{ "min-width": isMobile() ? "800px" : "900px" }}>+ <table class="w-full border-collapse whitespace-nowrap" style={{ "table-layout": "fixed", "min-width": isMobile() ? "800px" : "900px" }}><thead><tr class="bg-gray-50 dark:bg-gray-700/50 text-gray-600 dark:text-gray-300 border-b border-gray-200 dark:border-gray-700"><For each={visibleColumns()}>@@ -1135,10 +1079,8 @@ export function Dashboard(props: DashboardProps) {${isSortable ? 'cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600' : ''}`}style={{...((['cpu', 'memory', 'disk'].includes(col.id))- ? (isMobile()- ? { "min-width": "60px" }- : { "width": "140px", "min-width": "140px", "max-width": "140px" })- : (col.width && (!isMobile() || col.id !== 'name') ? { "min-width": col.width } : {})),+ ? { "width": isMobile() ? "60px" : "140px" }+ : (col.width && (!isMobile() || col.id !== 'name') ? { "width": col.width } : {})),"vertical-align": 'middle'}}onClick={() => isSortable && handleSort(sortKeyForCol!)}@@ -1177,7 +1119,7 @@ export function Dashboard(props: DashboardProps) {<NodeGroupHeader node={node!} renderAs="tr" colspan={totalColumns()} /></Show><For each={guests} fallback={<></>}>- {(guest, index) => {+ {(guest) => {// Use canonical format: instance:node:vmidconst guestId = guest.id || `${guest.instance}:${guest.node}:${guest.vmid}`;// Create a getter function for metadata to ensure reactivity@@ -1189,12 +1131,6 @@ export function Dashboard(props: DashboardProps) {const parentNode = node ?? guestParentNodeMap().get(guestId);const parentNodeOnline = parentNode ? isNodeOnline(parentNode) : true;- // Get adjacent guest IDs for merged AI context borders- const prevGuest = guests[index() - 1];- const nextGuest = guests[index() + 1];- const prevGuestId = prevGuest ? (prevGuest.id || `${prevGuest.instance}:${prevGuest.node}:${prevGuest.vmid}`) : null;- const nextGuestId = nextGuest ? (nextGuest.id || `${nextGuest.instance}:${nextGuest.node}:${nextGuest.vmid}`) : null;-return (<ComponentErrorBoundary name="GuestRow"><GuestRow@@ -1207,9 +1143,6 @@ export function Dashboard(props: DashboardProps) {onCustomUrlUpdate={handleCustomUrlUpdate}isGroupedView={groupingMode() === 'grouped'}visibleColumnIds={visibleColumnIds()}- aboveGuestId={prevGuestId}- belowGuestId={nextGuestId}- onRowClick={aiChatStore.enabled ? handleGuestRowClick : undefined}/></ComponentErrorBoundary>);diff --git a/frontend-modern/src/components/Dashboard/GuestDrawer.tsx b/frontend-modern/src/components/Dashboard/GuestDrawer.tsxindex e09948e041..8aca017025 100644--- a/frontend-modern/src/components/Dashboard/GuestDrawer.tsx+++ b/frontend-modern/src/components/Dashboard/GuestDrawer.tsx@@ -1,11 +1,7 @@-import { Component, Show, For, createSignal, createEffect } from 'solid-js';+import { Component, Show, For } from 'solid-js';import { VM, Container } from '@/types/api';-import { formatBytes, formatPercent, formatSpeed, formatUptime } from '@/utils/format';+import { formatBytes, formatUptime } from '@/utils/format';import { DiskList } from './DiskList';-import { aiChatStore } from '@/stores/aiChat';-import { AIAPI } from '@/api/ai';-import { GuestMetadataAPI } from '@/api/guestMetadata';-import { logger } from '@/utils/logger';type Guest = VM | Container;@@ -16,190 +12,10 @@ interface GuestDrawerProps {}export const GuestDrawer: Component<GuestDrawerProps> = (props) => {- const [aiEnabled, setAiEnabled] = createSignal(false);- const [annotations, setAnnotations] = createSignal<string[]>([]);- const [newAnnotation, setNewAnnotation] = createSignal('');- const [saving, setSaving] = createSignal(false);-- // Build guest ID for metadata - use canonical format: instance:node:vmid- const guestId = () => props.guest.id || `${props.guest.instance}:${props.guest.node}:${props.guest.vmid}`;-- // Check if AI is enabled and load annotations on mount- createEffect(() => {- AIAPI.getSettings()- .then((settings) => setAiEnabled(settings.enabled && settings.configured))- .catch((err) => logger.debug('[GuestDrawer] AI settings check failed:', err));-- // Load existing annotations- GuestMetadataAPI.getMetadata(guestId())- .then((meta) => {- if (meta.notes && Array.isArray(meta.notes)) setAnnotations(meta.notes);- })- .catch((err) => logger.debug('[GuestDrawer] Failed to load annotations:', err));- });-- // Update AI context whenever guest changes or annotations are loaded- createEffect(() => {- const guestType = props.guest.type === 'qemu' ? 'vm' : 'container';- // Track annotations to re-run when they change- void annotations();- aiChatStore.setTargetContext(guestType, guestId(), {- guestName: props.guest.name,- ...buildGuestContext(),- });- });-- // Note: We no longer clear context on unmount - context accumulates across navigation- // Users can clear individual items or all context from the AI panel-- const saveAnnotations = async (updated: string[]) => {- setSaving(true);- try {- await GuestMetadataAPI.updateMetadata(guestId(), { notes: updated });- logger.debug('[GuestDrawer] Annotations saved');- } catch (err) {- logger.error('[GuestDrawer] Failed to save annotations:', err);- } finally {- setSaving(false);- }- };-- const addAnnotation = () => {- const text = newAnnotation().trim();- if (!text) return;- const updated = [...annotations(), text];- setAnnotations(updated);- setNewAnnotation('');- saveAnnotations(updated);- };-- const removeAnnotation = (index: number) => {- const updated = annotations().filter((_, i) => i !== index);- setAnnotations(updated);- saveAnnotations(updated);- };-- const handleKeyDown = (e: KeyboardEvent) => {- if (e.key === 'Enter') {- e.preventDefault();- addAnnotation();- }- };-const isVM = (guest: Guest): guest is VM => {return guest.type === 'qemu';};- // Build comprehensive context for AI- const buildGuestContext = () => {- const guest = props.guest;- const context: Record<string, unknown> = {- name: guest.name,- type: guest.type === 'qemu' ? 'Virtual Machine' : 'LXC Container',- vmid: guest.vmid,- node: guest.node, // PVE node this guest lives on- guest_node: guest.node, // For backend agent routing- status: guest.status,- uptime: guest.uptime ? formatUptime(guest.uptime) : 'Not running',- };-- // CPU info - include both formatted and raw values- // Raw values enable backend baseline comparison- if (guest.cpu !== undefined) {- const cpuPercent = guest.cpu * 100;- context.cpu_usage = formatPercent(cpuPercent);- context.cpu_usage_raw = cpuPercent; // For baseline comparison- }- if (guest.cpus) {- context.cpu_cores = guest.cpus;- }-- // Memory info - include both formatted and raw values- if (guest.memory) {- context.memory_used = formatBytes(guest.memory.used || 0);- context.memory_total = formatBytes(guest.memory.total || 0);- context.memory_usage = formatPercent(guest.memory.usage || 0);- context.memory_usage_raw = guest.memory.usage || 0; // For baseline comparison- if (guest.memory.balloon && guest.memory.balloon !== guest.memory.total) {- context.memory_balloon = formatBytes(guest.memory.balloon);- }- if (guest.memory.swapTotal && guest.memory.swapTotal > 0) {- context.swap_used = formatBytes(guest.memory.swapUsed || 0);- context.swap_total = formatBytes(guest.memory.swapTotal);- }- }-- // Disk info - include both formatted and raw values- if (guest.disk && guest.disk.total > 0) {- const diskPercent = (guest.disk.used / guest.disk.total) * 100;- context.disk_used = formatBytes(guest.disk.used || 0);- context.disk_total = formatBytes(guest.disk.total || 0);- context.disk_usage = formatPercent(diskPercent);- context.disk_usage_raw = diskPercent; // For baseline comparison- }-- // I/O rates- if (guest.diskRead !== undefined) {- context.disk_read_rate = formatSpeed(guest.diskRead);- }- if (guest.diskWrite !== undefined) {- context.disk_write_rate = formatSpeed(guest.diskWrite);- }- if (guest.networkIn !== undefined) {- context.network_in_rate = formatSpeed(guest.networkIn);- }- if (guest.networkOut !== undefined) {- context.network_out_rate = formatSpeed(guest.networkOut);- }-- // OS info (both VMs and containers can have this)- if (guest.osName) context.os_name = guest.osName;- if (guest.osVersion) context.os_version = guest.osVersion;- if (guest.agentVersion) context.guest_agent = guest.agentVersion;- if (guest.ipAddresses?.length) context.ip_addresses = guest.ipAddresses;-- // Tags- if (guest.tags?.length) {- context.tags = guest.tags;- }-- // Backup info - Pulse already has this from PBS- if (guest.lastBackup) {- const backupDate = new Date(guest.lastBackup);- const now = new Date();- const daysSinceBackup = Math.floor((now.getTime() - backupDate.getTime()) / (1000 * 60 * 60 * 24));- context.last_backup = backupDate.toISOString();- context.days_since_backup = daysSinceBackup;- if (daysSinceBackup > 30) {- context.backup_status = 'CRITICAL - No backup in over 30 days';- } else if (daysSinceBackup > 7) {- context.backup_status = 'Warning - Backup is over a week old';- } else {- context.backup_status = 'OK';- }- } else {- context.backup_status = 'NEVER - No backup recorded';- }-- // User annotations (for AI context)- if (annotations().length > 0) {- context.user_annotations = annotations();- }-- return context;- };-- const handleAskAI = () => {- const guestType = props.guest.type === 'qemu' ? 'vm' : 'container';- // Use canonical format: instance:node:vmid- const guestId = props.guest.id || `${props.guest.instance}:${props.guest.node}:${props.guest.vmid}`;-- aiChatStore.openForTarget(guestType, guestId, {- guestName: props.guest.name,- ...buildGuestContext(),- });- };-const hasOsInfo = () => {// Both VMs and containers can have OS inforeturn (props.guest.osName?.length ?? 0) > 0 || (props.guest.osVersion?.length ?? 0) > 0;@@ -438,71 +254,6 @@ export const GuestDrawer: Component<GuestDrawerProps> = (props) => {</Show></div>- {/* Bottom row: AI Context & Ask AI - only show when AI is enabled */}- <Show when={aiEnabled()}>- <div class="mt-3 pt-3 border-t border-gray-200 dark:border-gray-700 space-y-2">- <div class="flex items-center gap-1.5">- <span class="text-[10px] font-medium text-gray-500 dark:text-gray-400">AI Context</span>- <Show when={saving()}>- <span class="text-[9px] text-gray-400">saving...</span>- </Show>- </div>-- {/* Existing annotations */}- <Show when={annotations().length > 0}>- <div class="flex flex-wrap gap-1.5">- <For each={annotations()}>- {(annotation, index) => (- <span class="inline-flex items-center gap-1 px-2 py-1 text-[11px] rounded-md bg-purple-100 text-purple-800 dark:bg-purple-900/40 dark:text-purple-200">- <span class="max-w-[300px] truncate">{annotation}</span>- <button- type="button"- onClick={() => removeAnnotation(index())}- class="ml-0.5 p-0.5 rounded hover:bg-purple-200 dark:hover:bg-purple-800 transition-colors"- title="Remove"- >- <svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />- </svg>- </button>- </span>- )}- </For>- </div>- </Show>-- {/* Add new annotation + Ask AI */}- <div class="flex items-center gap-2">- <input- type="text"- value={newAnnotation()}- onInput={(e) => setNewAnnotation(e.currentTarget.value)}- onKeyDown={handleKeyDown}- placeholder="Add context for AI (press Enter)..."- class="flex-1 px-2 py-1.5 text-[11px] rounded border border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-1 focus:ring-purple-500 focus:border-purple-500"- />- <button- type="button"- onClick={addAnnotation}- disabled={!newAnnotation().trim()}- class="px-2 py-1.5 text-[11px] rounded border border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors"- >- Add- </button>- <button- type="button"- onClick={handleAskAI}- class="flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-gradient-to-r from-purple-500 to-pink-500 text-white text-[11px] font-medium shadow-sm hover:from-purple-600 hover:to-pink-600 transition-all"- title={`Ask AI about ${props.guest.name}`}- >- <svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.75 3.104v5.714a2.25 2.25 0 01-.659 1.591L5 14.5M9.75 3.104c-.251.023-.501.05-.75.082m.75-.082a24.301 24.301 0 014.5 0m0 0v5.714c0 .597.237 1.17.659 1.591L19.8 15.3M14.25 3.104c.251.023.501.05.75.082M19.8 15.3l-1.57.393A9.065 9.065 0 0112 15a9.065 9.065 0 00-6.23.693L5 14.5m14.8.8l1.402 1.402c1.232 1.232.65 3.318-1.067 3.611l-2.576.43a18.003 18.003 0 01-5.118 0l-2.576-.43c-1.717-.293-2.299-2.379-1.067-3.611L5 14.5" />- </svg>- Ask AI- </button>- </div>- </div>- </Show></div>);};diff --git a/frontend-modern/src/components/Dashboard/GuestRow.tsx b/frontend-modern/src/components/Dashboard/GuestRow.tsxindex 46310ed0b3..3b062b5525 100644--- a/frontend-modern/src/components/Dashboard/GuestRow.tsx+++ b/frontend-modern/src/components/Dashboard/GuestRow.tsx@@ -19,7 +19,7 @@ import { ResponsiveMetricCell } from '@/components/shared/responsive';import { EnhancedCPUBar } from '@/components/Dashboard/EnhancedCPUBar';import { useBreakpoint } from '@/hooks/useBreakpoint';import { useMetricsViewMode } from '@/stores/metricsViewMode';-import { aiChatStore } from '@/stores/aiChat';+import { useAlertsActivation } from '@/stores/alertsActivation';import { useAnomalyForMetric } from '@/hooks/useAnomalies';@@ -449,7 +449,7 @@ export const GUEST_COLUMNS: GuestColumnDef[] = [{ id: 'node', label: 'Node', icon: <svg class="w-3.5 h-3.5 block" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01" /></svg>, priority: 'essential', width: '55px', toggleable: true, sortKey: 'node' },// Supplementary - visible on lg+ (Now essential), user toggleable- { id: 'backup', label: 'Backup', icon: <svg class="w-3.5 h-3.5 block" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z" /></svg>, priority: 'essential', width: '50px', toggleable: true },+ { id: 'backup', label: 'Backup', icon: <svg class="w-3.5 h-3.5 block" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z" /></svg>, priority: 'essential', width: '90px', toggleable: true },{ id: 'tags', label: 'Tags', icon: <svg class="w-3.5 h-3.5 block" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z" /></svg>, priority: 'essential', width: '60px', toggleable: true },// Detailed - visible on xl+ (Now essential), user toggleable@@ -484,12 +484,6 @@ interface GuestRowProps {isGroupedView?: boolean;/** IDs of columns that should be visible */visibleColumnIds?: string[];- /** Guest ID of the row above (for checking AI context adjacency) */- aboveGuestId?: string | null;- /** Guest ID of the row below (for checking AI context adjacency) */- belowGuestId?: string | null;- /** Called when user clicks the row (for AI context selection) */- onRowClick?: (guest: Guest) => void;}export function GuestRow(props: GuestRowProps) {@@ -730,17 +724,7 @@ export function GuestRow(props: GuestRowProps) {return '#9ca3af';});- // Check AI context state reactively from the store- // Show selection even when sidebar is closed - makes selection persistent- const isInAIContext = createMemo(() => aiChatStore.enabled && aiChatStore.hasContextItem(guestId()));- const isAboveInAIContext = createMemo(() => {- if (!props.aboveGuestId) return false;- return aiChatStore.hasContextItem(props.aboveGuestId);- });- const isBelowInAIContext = createMemo(() => {- if (!props.belowGuestId) return false;- return aiChatStore.hasContextItem(props.belowGuestId);- });+const rowClass = createMemo(() => {const base = 'transition-all duration-200 relative';@@ -754,23 +738,14 @@ export function GuestRow(props: GuestRowProps) {? '': 'hover:bg-gray-50 dark:hover:bg-gray-700/30';const stoppedDimming = !isRunning() ? 'opacity-60' : '';- // Make row clickable if AI is enabled (for context selection)- const clickable = aiChatStore.enabled ? 'cursor-pointer' : '';- // AI context highlight with merged borders for adjacent rows- let aiContext = '';- if (isInAIContext()) {- aiContext = 'ai-context-row';- if (isAboveInAIContext()) aiContext += ' ai-context-no-top';- if (isBelowInAIContext()) aiContext += ' ai-context-no-bottom';- }- return `${base} ${hover} ${defaultHover} ${alertBg} ${stoppedDimming} ${clickable} ${aiContext}`;+ return `${base} ${hover} ${defaultHover} ${alertBg} ${stoppedDimming}`;});const rowStyle = createMemo(() => {const styles: Record<string, string> = {};- // Alert styling (only if not in AI context - AI context uses CSS class)- if (!isInAIContext() && showAlertHighlight()) {+ // Alert styling+ if (showAlertHighlight()) {const color = alertAccentColor();if (color) {styles['box-shadow'] = `inset 4px 0 0 0 ${color}`;@@ -780,17 +755,7 @@ export function GuestRow(props: GuestRowProps) {return styles;});- const handleRowClick = (e: MouseEvent) => {- // Don't trigger if clicking on interactive elements- const target = e.target as HTMLElement;- if (target.closest('[data-prevent-toggle]') ||- target.closest('a') ||- target.closest('button') ||- target.closest('input')) {- return;- }- props.onRowClick?.(props.guest);- };+@@ -799,7 +764,6 @@ export function GuestRow(props: GuestRowProps) {<trclass={rowClass()}style={rowStyle()}- onClick={handleRowClick}data-guest-id={guestId()}>{/* Name - always visible */}@@ -858,14 +822,7 @@ export function GuestRow(props: GuestRowProps) {<Show when={!isColVisible('backup')}><BackupIndicator lastBackup={props.guest.lastBackup} isTemplate={props.guest.template} /></Show>- {/* AI context indicator - shows when row is selected for AI */}- <Show when={isInAIContext()}>- <span class="flex-shrink-0 text-purple-500 dark:text-purple-400" title="Selected for AI context">- <svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="2">- <path stroke-linecap="round" stroke-linejoin="round" d="M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 00-2.456 2.456z" />- </svg>- </span>- </Show>+</div></div>diff --git a/frontend-modern/src/components/Docker/DockerHostSummaryTable.tsx b/frontend-modern/src/components/Docker/DockerHostSummaryTable.tsxindex 08ce28e14a..1a3405574c 100644--- a/frontend-modern/src/components/Docker/DockerHostSummaryTable.tsx+++ b/frontend-modern/src/components/Docker/DockerHostSummaryTable.tsx@@ -1,5 +1,4 @@import { Component, For, Show, createMemo, createSignal } from 'solid-js';-import { StackedContainerBar } from './StackedContainerBar';import type { DockerHost } from '@/types/api';import { Card } from '@/components/shared/Card';import { renderDockerStatusBadge } from './DockerStatusBadge';@@ -207,11 +206,12 @@ export const DockerHostSummaryTable: Component<DockerHostSummaryTableProps> = (p<><Card padding="none" tone="glass" class={`mb-4 ${urlEdit.isEditing() ? 'overflow-visible' : 'overflow-hidden'}`}><ScrollableTable persistKey="docker-host-summary" minWidth={isMobile() ? '100%' : '800px'}>- <table class="w-full border-collapse whitespace-nowrap">+ <table class="w-full border-collapse whitespace-nowrap" style={{ "table-layout": "fixed" }}><thead><tr class="bg-gray-50 dark:bg-gray-700/50 text-gray-600 dark:text-gray-300 border-b border-gray-200 dark:border-gray-700"><thclass="pl-3 pr-2 py-1 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-blue-500 whitespace-nowrap"+ style={{ width: "20%" }}onClick={() => handleSort('name')}onKeyDown={(e) => e.key === 'Enter' && handleSort('name')}tabIndex={0}@@ -220,50 +220,57 @@ export const DockerHostSummaryTable: Component<DockerHostSummaryTableProps> = (p>Host {renderSortIndicator('name')}</th>- <th class="px-2 py-1 text-center text-[11px] sm:text-xs font-medium uppercase tracking-wider whitespace-nowrap">+ <th+ class="px-2 py-1 text-center text-[11px] sm:text-xs font-medium uppercase tracking-wider whitespace-nowrap"+ style={{ width: "70px" }}+ >Status</th><thclass="px-2 py-1 text-center text-[11px] sm:text-xs font-medium uppercase tracking-wider cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600 whitespace-nowrap"- style={isMobile() ? { "min-width": "60px" } : { width: "140px", "min-width": "140px", "max-width": "140px" }}+ style={{ width: "140px" }}onClick={() => handleSort('cpu')}>CPU {renderSortIndicator('cpu')}</th><thclass="px-2 py-1 text-center text-[11px] sm:text-xs font-medium uppercase tracking-wider cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600 whitespace-nowrap"- style={isMobile() ? { "min-width": "60px" } : { width: "140px", "min-width": "140px", "max-width": "140px" }}+ style={{ width: "140px" }}onClick={() => handleSort('memory')}>Memory {renderSortIndicator('memory')}</th><thclass="px-2 py-1 text-center text-[11px] sm:text-xs font-medium uppercase tracking-wider cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600 whitespace-nowrap"- style={isMobile() ? { "min-width": "60px" } : { width: "140px", "min-width": "140px", "max-width": "140px" }}+ style={{ width: "140px" }}onClick={() => handleSort('disk')}>Disk {renderSortIndicator('disk')}</th><thclass="px-2 py-1 text-center text-[11px] sm:text-xs font-medium uppercase tracking-wider cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600 whitespace-nowrap"+ style={{ width: "100px" }}onClick={() => handleSort('running')}>Containers {renderSortIndicator('running')}</th><thclass="px-2 py-1 text-center text-[11px] sm:text-xs font-medium uppercase tracking-wider cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600 whitespace-nowrap"+ style={{ width: "80px" }}onClick={() => handleSort('uptime')}>Uptime {renderSortIndicator('uptime')}</th><thclass="px-2 py-1 text-center text-[11px] sm:text-xs font-medium uppercase tracking-wider cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600 whitespace-nowrap"+ style={{ width: "80px" }}onClick={() => handleSort('lastSeen')}>Last Update {renderSortIndicator('lastSeen')}</th><thclass="px-2 py-1 text-center text-[11px] sm:text-xs font-medium uppercase tracking-wider cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600 whitespace-nowrap"+ style={{ width: "70px" }}onClick={() => handleSort('agent')}>Agent {renderSortIndicator('agent')}@@ -422,12 +429,9 @@ export const DockerHostSummaryTable: Component<DockerHostSummaryTableProps> = (pwhen={summary.totalCount > 0}fallback={<span class="text-xs text-gray-400 dark:text-gray-500">—</span>}>- <StackedContainerBar- running={summary.runningCount}- stopped={summary.stoppedCount}- error={summary.errorCount}- total={summary.totalCount}- />+ <span class="text-xs font-semibold text-gray-700 dark:text-gray-200">+ {summary.totalCount}+ </span></Show></div></td>diff --git a/frontend-modern/src/components/Docker/DockerUnifiedTable.tsx b/frontend-modern/src/components/Docker/DockerUnifiedTable.tsxindex 0dbfcfad6b..edcdd4ccb0 100644--- a/frontend-modern/src/components/Docker/DockerUnifiedTable.tsx+++ b/frontend-modern/src/components/Docker/DockerUnifiedTable.tsx@@ -10,8 +10,6 @@ import type { DockerHostMetadata } from '@/api/dockerHostMetadata';import { resolveHostRuntime } from './runtimeDisplay';import { showSuccess, showError } from '@/utils/toast';import { logger } from '@/utils/logger';-import { aiChatStore } from '@/stores/aiChat';-import { AIAPI } from '@/api/ai';import { buildMetricKey } from '@/utils/metricsKeys';import { StatusDot } from '@/components/shared/StatusDot';import {@@ -132,16 +130,16 @@ interface DockerColumnDef extends ColumnConfig {// - supplementary: Visible on large screens and up (lg: 1024px+)// - detailed: Visible on extra large screens and up (xl: 1280px+)export const DOCKER_COLUMNS: DockerColumnDef[] = [- { id: 'resource', label: 'Resource', priority: 'essential', minWidth: 'auto', flex: 1, sortKey: 'resource' },- { id: 'type', label: 'Type', priority: 'essential', minWidth: 'auto', maxWidth: 'auto', sortKey: 'type' },- { id: 'image', label: 'Image / Stack', priority: 'essential', minWidth: '80px', maxWidth: '200px', sortKey: 'image' },- { id: 'status', label: 'Status', priority: 'essential', minWidth: 'auto', maxWidth: 'auto', sortKey: 'status' },+ { id: 'resource', label: 'Resource', priority: 'essential', minWidth: 'auto', flex: 1, sortKey: 'resource', width: '15%' },+ { id: 'type', label: 'Type', priority: 'essential', minWidth: 'auto', maxWidth: 'auto', sortKey: 'type', width: '70px' },+ { id: 'image', label: 'Image / Stack', priority: 'essential', minWidth: '80px', maxWidth: '200px', sortKey: 'image', width: '15%' },+ { id: 'status', label: 'Status', priority: 'essential', minWidth: 'auto', maxWidth: 'auto', sortKey: 'status', width: '90px' },// Metric columns - need fixed width to match progress bar max-width (140px + padding)// Note: Disk column removed - Docker API rarely provides this data- { id: 'cpu', label: 'CPU', priority: 'essential', minWidth: '55px', maxWidth: '156px', sortKey: 'cpu' },- { id: 'memory', label: 'Memory', priority: 'essential', minWidth: '75px', maxWidth: '156px', sortKey: 'memory' },- { id: 'tasks', label: 'Tasks', priority: 'essential', minWidth: 'auto', maxWidth: 'auto', sortKey: 'tasks' },- { id: 'updated', label: 'Uptime', priority: 'essential', minWidth: 'auto', maxWidth: 'auto', sortKey: 'updated' },+ { id: 'cpu', label: 'CPU', priority: 'essential', minWidth: '55px', maxWidth: '156px', sortKey: 'cpu', width: '140px' },+ { id: 'memory', label: 'Memory', priority: 'essential', minWidth: '75px', maxWidth: '156px', sortKey: 'memory', width: '140px' },+ { id: 'tasks', label: 'Tasks', priority: 'essential', minWidth: 'auto', maxWidth: 'auto', sortKey: 'tasks', width: '80px' },+ { id: 'updated', label: 'Uptime', priority: 'essential', minWidth: 'auto', maxWidth: 'auto', sortKey: 'updated', width: '80px' },];// Global state for currently expanded drawer (only one drawer open at a time)@@ -154,6 +152,85 @@ const [dockerEditingValuesVersion, setDockerEditingValuesVersion] = createSignalconst [dockerPopoverPosition, setDockerPopoverPosition] = createSignal<{ top: number; left: number } | null>(null);const toLower = (value?: string | null) => value?.toLowerCase() ?? '';+const MUTABLE_IMAGE_TAGS = new Set([+ 'latest',+ 'stable',+ 'main',+ 'master',+ 'edge',+ 'dev',+ 'nightly',+ 'canary',+]);++type ImageVersionInfo = {+ value: string;+ source: 'label' | 'tag';+ mutable: boolean;+ title: string;+};++const getVersionLabelFromLabels = (labels?: Record<string, string>) => {+ if (!labels) return null;+ if (labels['org.opencontainers.image.version']) {+ return { value: labels['org.opencontainers.image.version'], key: 'org.opencontainers.image.version' };+ }+ if (labels['org.label-schema.version']) {+ return { value: labels['org.label-schema.version'], key: 'org.label-schema.version' };+ }+ return null;+};++const getImageTag = (image?: string): string | undefined => {+ if (!image) return undefined;+ const withoutDigest = image.split('@')[0];+ const lastSlash = withoutDigest.lastIndexOf('/');+ const lastColon = withoutDigest.lastIndexOf(':');+ if (lastColon > lastSlash) return withoutDigest.slice(lastColon + 1);+ return undefined;+};++const getImageVersionInfo = (image?: string, labels?: Record<string, string>): ImageVersionInfo | null => {+ const labelInfo = getVersionLabelFromLabels(labels);+ if (labelInfo && labelInfo.value) {+ return {+ value: labelInfo.value,+ source: 'label',+ mutable: false,+ title: `Version from image label (${labelInfo.key})`,+ };+ }++ const tag = getImageTag(image);+ if (!tag) return null;++ const isMutable = MUTABLE_IMAGE_TAGS.has(tag.toLowerCase());+ return {+ value: tag,+ source: 'tag',+ mutable: isMutable,+ title: isMutable ? 'Tag is mutable; version unverified' : 'Version from image tag (unverified)',+ };+};++const getVersionBadgeClass = (info: ImageVersionInfo) => {+ if (info.source === 'label') {+ return 'bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-200';+ }+ if (info.mutable) {+ return 'bg-yellow-100 text-yellow-800 dark:bg-yellow-900/40 dark:text-yellow-200';+ }+ return 'bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-200';+};+++const MAX_VERSION_LABEL = 12;++const getShortVersionLabel = (value: string) => {+ if (value.length <= MAX_VERSION_LABEL) return value;+ return `${value.slice(0, MAX_VERSION_LABEL - 3)}...`;+};+const ensureMs = (value?: number | string | null): number | null => {if (!value) return null;@@ -802,13 +879,12 @@ const DockerContainerRow: Component<{onCustomUrlUpdate?: (resourceId: string, url: string) => void;showHostContext?: boolean;resourceIndentClass?: string;- aiEnabled?: boolean;- initialNotes?: string[];batchUpdateState?: Record<string, 'updating' | 'queued' | 'error'>;}> = (props) => {const { host, container } = props.row;const runtimeInfo = resolveHostRuntime(host);const runtimeVersion = () => host.runtimeVersion || host.dockerVersion || null;+ const imageVersion = createMemo(() => getImageVersionInfo(container.image, container.labels));const hostStatus = createMemo(() => getDockerHostStatusIndicator(host));const hostDisplayName = () => getHostDisplayName(host);const rowId = buildRowId(host, props.row);@@ -831,82 +907,6 @@ const DockerContainerRow: Component<{return props.batchUpdateState[key];});- // Annotations and AI state - use props passed from parent to avoid per-row API calls- const aiEnabled = () => props.aiEnabled ?? false;- // Check if this container is in AI context- const isInAIContext = createMemo(() => aiChatStore.enabled && aiChatStore.hasContextItem(resourceId()));- // Initialize annotations from props (pre-fetched metadata) instead of per-row API call- const [annotations, setAnnotations] = createSignal<string[]>(props.initialNotes ?? []);- const [newAnnotation, setNewAnnotation] = createSignal('');- const [saving, setSaving] = createSignal(false);-- // Update annotations if props change (e.g., parent re-fetches metadata)- createEffect(() => {- const notes = props.initialNotes;- if (notes && Array.isArray(notes)) {- setAnnotations(notes);- }- });-- const saveAnnotations = async (newAnnotations: string[]) => {- setSaving(true);- try {- await DockerMetadataAPI.updateMetadata(resourceId(), { notes: newAnnotations });- logger.debug('[DockerContainer] Annotations saved');- } catch (err) {- logger.error('[DockerContainer] Failed to save annotations:', err);- } finally {- setSaving(false);- }- };-- const addAnnotation = () => {- const text = newAnnotation().trim();- if (!text) return;- const updated = [...annotations(), text];- setAnnotations(updated);- setNewAnnotation('');- saveAnnotations(updated);- };-- const removeAnnotation = (index: number) => {- const updated = annotations().filter((_, i) => i !== index);- setAnnotations(updated);- saveAnnotations(updated);- };-- const handleKeyDown = (e: KeyboardEvent) => {- if (e.key === 'Enter' && !e.shiftKey) {- e.preventDefault();- addAnnotation();- }- };-- const buildContainerContext = () => {- const ctx: Record<string, unknown> = {- name: container.name,- type: 'Docker Container',- host: host.hostname,- status: container.status || container.state,- image: container.image,- };- if (container.cpuPercent !== undefined) ctx.cpu_usage = formatPercent(container.cpuPercent);- if (container.memoryUsageBytes !== undefined) ctx.memory_used = formatBytes(container.memoryUsageBytes);- if (container.memoryLimitBytes !== undefined) ctx.memory_limit = formatBytes(container.memoryLimitBytes);- if (container.memoryPercent !== undefined) ctx.memory_usage = formatPercent(container.memoryPercent);- if (container.uptimeSeconds) ctx.uptime = formatUptime(container.uptimeSeconds);- if (container.ports?.length) ctx.ports = container.ports.map(p => p.publicPort ? `${p.publicPort}:${p.privatePort}/${p.protocol}` : `${p.privatePort}/${p.protocol}`);- if (annotations().length > 0) ctx.user_notes = annotations().join('; ');- return ctx;- };-- const handleAskAI = () => {- aiChatStore.openForTarget('container', resourceId(), {- containerName: container.name,- ...buildContainerContext(),- });- };-const writableLayerBytes = createMemo(() => container.writableLayerBytes ?? 0);const rootFilesystemBytes = createMemo(() => container.rootFilesystemBytes ?? 0);const hasDiskStats = createMemo(() => writableLayerBytes() > 0 || rootFilesystemBytes() > 0);@@ -1007,24 +1007,7 @@ const DockerContainerRow: Component<{const target = event.target as HTMLElement;if (target.closest('a, button, input, [data-prevent-toggle]')) return;- // If AI is enabled, toggle AI context instead of expanding drawer- if (aiChatStore.enabled) {- if (aiChatStore.hasContextItem(resourceId())) {- aiChatStore.removeContextItem(resourceId());- } else {- aiChatStore.addContextItem('docker', resourceId(), container.name, {- containerName: container.name,- ...buildContainerContext(),- });- // Auto-open the sidebar when first item is selected- if (!aiChatStore.isOpen) {- aiChatStore.open();- }- }- return;- }-- // Standard drawer toggle when AI is not enabled+ // Standard drawer toggleif (!hasDrawerContent()) return;setCurrentlyExpandedRowId(prev => prev === rowId ? null : rowId);};@@ -1279,14 +1262,7 @@ const DockerContainerRow: Component<{<span class="truncate">{hostDisplayName()}</span></span></Show>- {/* AI context indicator - shows when container is selected for AI */}- <Show when={isInAIContext()}>- <span class="flex-shrink-0 text-purple-500 dark:text-purple-400" title="Selected for AI context">- <svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="2">- <path stroke-linecap="round" stroke-linejoin="round" d="M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 00-2.456 2.456z" />- </svg>- </span>- </Show>+</div></div></div>@@ -1313,6 +1289,23 @@ const DockerContainerRow: Component<{>{container.image || '—'}</span>+ <Show when={imageVersion()}>+ {(version) => {+ const display = getShortVersionLabel(version().value);+ const title = `${version().title}: ${version().value}`;+ return (+ <span+ class={`flex-shrink-0 inline-flex items-center gap-0.5 rounded px-1.5 py-0.5 text-[10px] font-medium ${getVersionBadgeClass(version())}`}+ title={title}+ >+ {display}+ <Show when={version().mutable}>+ <span class="text-[9px] leading-none">!</span>+ </Show>+ </span>+ );+ }}+ </Show><UpdateButtonupdateStatus={container.updateStatus}hostId={host.id}@@ -1409,7 +1402,7 @@ const DockerContainerRow: Component<{return (<><tr- class={`transition-all duration-200 ${aiChatStore.enabled || hasDrawerContent() ? 'cursor-pointer' : ''} ${expanded() ? 'bg-gray-50 dark:bg-gray-800/40' : 'hover:bg-gray-50 dark:hover:bg-gray-800/50'} ${!isRunning() ? 'opacity-60' : ''} ${isInAIContext() ? 'ai-context-row' : ''}`}+ class={`transition-all duration-200 ${hasDrawerContent() ? 'cursor-pointer' : ''} ${expanded() ? 'bg-gray-50 dark:bg-gray-800/40' : 'hover:bg-gray-50 dark:hover:bg-gray-800/50'} ${!isRunning() ? 'opacity-60' : ''}`}onClick={toggle}aria-expanded={expanded()}>@@ -1815,71 +1808,10 @@ const DockerContainerRow: Component<{</div></Show>- {/* Annotations & Ask AI row */}- <Show when={aiEnabled()}>- <div class="mt-3 pt-3 border-t border-gray-200 dark:border-gray-700 w-full space-y-2">- <div class="flex items-center gap-1.5">- <span class="text-[10px] font-medium text-gray-500 dark:text-gray-400">AI Context</span>- <Show when={saving()}>- <span class="text-[9px] text-gray-400">saving...</span>- </Show>- </div>- {/* Existing annotations */}- <Show when={annotations().length > 0}>- <div class="flex flex-wrap gap-1.5">- <For each={annotations()}>- {(annotation, index) => (- <span class="inline-flex items-center gap-1 px-2 py-1 text-[11px] rounded-md bg-purple-100 text-purple-800 dark:bg-purple-900/40 dark:text-purple-200">- <span class="max-w-[300px] truncate">{annotation}</span>- <button- type="button"- onClick={() => removeAnnotation(index())}- class="ml-0.5 p-0.5 rounded hover:bg-purple-200 dark:hover:bg-purple-800 transition-colors"- title="Remove"- >- <svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />- </svg>- </button>- </span>- )}- </For>- </div>- </Show>- {/* Add new annotation */}- <div class="flex items-center gap-2">- <input- type="text"- value={newAnnotation()}- onInput={(e) => setNewAnnotation(e.currentTarget.value)}- onKeyDown={handleKeyDown}- placeholder="Add context for AI (press Enter)..."- class="flex-1 px-2 py-1.5 text-[11px] rounded border border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-1 focus:ring-purple-500 focus:border-purple-500"- />- <button- type="button"- onClick={addAnnotation}- disabled={!newAnnotation().trim()}- class="px-2 py-1.5 text-[11px] rounded border border-purple-300 dark:border-purple-600 text-purple-700 dark:text-purple-300 hover:bg-purple-50 dark:hover:bg-purple-900/30 disabled:opacity-40 disabled:cursor-not-allowed transition-colors"- >- Add- </button>- <button- type="button"- onClick={handleAskAI}- class="flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-gradient-to-r from-purple-500 to-pink-500 text-white text-[11px] font-medium shadow-sm hover:from-purple-600 hover:to-pink-600 transition-all"- title={`Ask AI about ${container.name}`}- >- <svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.75 3.104v5.714a2.25 2.25 0 01-.659 1.591L5 14.5M9.75 3.104c-.251.023-.501.05-.75.082m.75-.082a24.301 24.301 0 014.5 0m0 0v5.714c0 .597.237 1.17.659 1.591L19.8 15.3M14.25 3.104c.251.023.501.05.75.082M19.8 15.3l-1.57.393A9.065 9.065 0 0112 15a9.065 9.065 0 00-6.23.693L5 14.5m14.8.8l1.402 1.402c1.232 1.232.65 3.318-1.067 3.611l-2.576.43a18.003 18.003 0 01-5.118 0l-2.576-.43c-1.717-.293-2.299-2.379-1.067-3.611L5 14.5" />- </svg>- Ask AI- </button>- </div>- </div>- </Show>++</div></div></td>@@ -1898,6 +1830,7 @@ const DockerServiceRow: Component<{resourceIndentClass?: string;}> = (props) => {const { host, service, tasks } = props.row;+ const imageVersion = createMemo(() => getImageVersionInfo(service.image, service.labels));const rowId = buildRowId(host, props.row);const resourceId = () => `${host.id}:service:${service.id || service.name}`;const isEditingUrl = createMemo(() => currentlyEditingDockerResourceId() === resourceId());@@ -1916,22 +1849,7 @@ const DockerServiceRow: Component<{const hasTasks = () => tasks.length > 0;- // Check if this service is in AI context- const isInAIContext = createMemo(() => aiChatStore.enabled && aiChatStore.hasContextItem(resourceId()));-- // Build context for AI- const buildServiceContext = () => {- const ctx: Record<string, unknown> = {- name: service.name,- type: 'Docker Swarm Service',- host: host.hostname,- image: service.image,- mode: service.mode,- replicas: `${service.runningTasks ?? 0}/${service.desiredTasks ?? 0}`,- };- if (service.stack) ctx.stack = service.stack;- return ctx;- };+// Update custom URL when prop changes, but only if we're not currently editingcreateEffect(() => {@@ -1961,24 +1879,7 @@ const DockerServiceRow: Component<{const target = event.target as HTMLElement;if (target.closest('a, button, input, [data-prevent-toggle]')) return;- // If AI is enabled, toggle AI context instead of expanding drawer- if (aiChatStore.enabled) {- if (aiChatStore.hasContextItem(resourceId())) {- aiChatStore.removeContextItem(resourceId());- } else {- aiChatStore.addContextItem('docker', resourceId(), service.name, {- serviceName: service.name,- ...buildServiceContext(),- });- // Auto-open the sidebar when first item is selected- if (!aiChatStore.isOpen) {- aiChatStore.open();- }- }- return;- }-- // Standard drawer toggle when AI is not enabled+ // Standard drawer toggleif (!hasTasks()) return;setCurrentlyExpandedRowId(prev => prev === rowId ? null : rowId);};@@ -2204,14 +2105,7 @@ const DockerServiceRow: Component<{<span class="max-w-[160px] truncate">{hostDisplayName()}</span></span></Show>- {/* AI context indicator - shows when service is selected for AI */}- <Show when={isInAIContext()}>- <span class="flex-shrink-0 text-purple-500 dark:text-purple-400" title="Selected for AI context">- <svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="2">- <path stroke-linecap="round" stroke-linejoin="round" d="M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 00-2.456 2.456z" />- </svg>- </span>- </Show>+</div></div></div>@@ -2227,11 +2121,32 @@ const DockerServiceRow: Component<{);case 'image':return (- <div- class="px-2 py-0.5 text-xs text-gray-700 dark:text-gray-300 truncate max-w-[200px]"- title={service.image || undefined}- >- {service.image || '—'}+ <div class="px-2 py-0.5 text-xs text-gray-700 dark:text-gray-300 overflow-hidden">+ <div class="flex items-center gap-1.5 min-w-0">+ <span+ class="truncate"+ title={service.image || undefined}+ >+ {service.image || '—'}+ </span>+ <Show when={imageVersion()}>+ {(version) => {+ const display = getShortVersionLabel(version().value);+ const title = `${version().title}: ${version().value}`;+ return (+ <span+ class={`flex-shrink-0 inline-flex items-center gap-0.5 rounded px-1.5 py-0.5 text-[10px] font-medium ${getVersionBadgeClass(version())}`}+ title={title}+ >+ {display}+ <Show when={version().mutable}>+ <span class="text-[9px] leading-none">!</span>+ </Show>+ </span>+ );+ }}+ </Show>+ </div></div>);case 'status':@@ -2275,7 +2190,7 @@ const DockerServiceRow: Component<{return (<><tr- class={`transition-all duration-200 ${aiChatStore.enabled || hasTasks() ? 'cursor-pointer' : ''} ${expanded() ? 'bg-gray-50 dark:bg-gray-800/40' : 'hover:bg-gray-50 dark:hover:bg-gray-800/50'} ${!isHealthy() ? 'opacity-60' : ''} ${isInAIContext() ? 'ai-context-row' : ''}`}+ class={`transition-all duration-200 ${hasTasks() ? 'cursor-pointer' : ''} ${expanded() ? 'bg-gray-50 dark:bg-gray-800/40' : 'hover:bg-gray-50 dark:hover:bg-gray-800/50'} ${!isHealthy() ? 'opacity-60' : ''}`}onClick={toggle}aria-expanded={expanded()}>@@ -2453,16 +2368,6 @@ const DockerUnifiedTable: Component<DockerUnifiedTableProps> = (props) => {// Use the breakpoint hook for responsive behaviorconst { isMobile } = useBreakpoint();- // AI enabled state - fetched once at the parent level to avoid per-row API calls- const [aiEnabled, setAiEnabled] = createSignal(false);-- // Fetch AI settings once when component mounts- createEffect(() => {- AIAPI.getSettings()- .then((settings) => setAiEnabled(settings.enabled && settings.configured))- .catch((err) => logger.debug('[DockerUnifiedTable] AI settings check failed:', err));- });-// Caches for stable object references to prevent re-animationsconst rowCache = new Map<string, DockerRow>();const tasksCache = new Map<string, DockerTask[]>();@@ -2805,8 +2710,6 @@ const DockerUnifiedTable: Component<DockerUnifiedTableProps> = (props) => {onCustomUrlUpdate={props.onCustomUrlUpdate}showHostContext={!grouped}resourceIndentClass={grouped ? GROUPED_RESOURCE_INDENT : UNGROUPED_RESOURCE_INDENT}- aiEnabled={aiEnabled()}- initialNotes={metadata?.notes}batchUpdateState={props.batchUpdateState}/>@@ -2843,7 +2746,7 @@ const DockerUnifiedTable: Component<DockerUnifiedTableProps> = (props) => {><Card padding="none" tone="glass" class="overflow-hidden"><div class="overflow-x-auto">- <table class="w-full border-collapse whitespace-nowrap" style={{ "min-width": "800px" }}>+ <table class="w-full border-collapse whitespace-nowrap" style={{ "table-layout": "fixed", "min-width": "800px" }}><thead><tr class="border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-700/50 text-gray-600 dark:text-gray-300 text-[11px] sm:text-xs font-medium uppercase tracking-wider sticky top-0 z-20"><For each={DOCKER_COLUMNS}>@@ -2854,7 +2757,11 @@ const DockerUnifiedTable: Component<DockerUnifiedTableProps> = (props) => {return (<thclass={`${isResource ? 'pl-4 sm:pl-5 lg:pl-6 pr-2' : 'px-2'} py-1 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600 text-left font-medium whitespace-nowrap`}- style={{ "min-width": (col.id === 'cpu' || col.id === 'memory' || col.id === 'disk') ? (isMobile() ? '60px' : '140px') : undefined, "width": (col.id === 'cpu' || col.id === 'memory' || col.id === 'disk') && !isMobile() ? '140px' : undefined, "max-width": (col.id === 'cpu' || col.id === 'memory' || col.id === 'disk') && !isMobile() ? '140px' : undefined }}+ style={{+ width: (col.id === 'cpu' || col.id === 'memory')+ ? (isMobile() ? '60px' : col.width)+ : col.width+ }}onClick={() => colSortKey && handleSort(colSortKey)}onKeyDown={(e) => e.key === 'Enter' && colSortKey && handleSort(colSortKey)}tabIndex={0}diff --git a/frontend-modern/src/components/Hosts/HostsOverview.tsx b/frontend-modern/src/components/Hosts/HostsOverview.tsxindex 446608d60d..35aaf2add1 100644--- a/frontend-modern/src/components/Hosts/HostsOverview.tsx+++ b/frontend-modern/src/components/Hosts/HostsOverview.tsx@@ -17,8 +17,6 @@ import { StackedMemoryBar } from '@/components/Dashboard/StackedMemoryBar';import { EnhancedCPUBar } from '@/components/Dashboard/EnhancedCPUBar';import { useBreakpoint, type ColumnPriority } from '@/hooks/useBreakpoint';import { useColumnVisibility } from '@/hooks/useColumnVisibility';-import { aiChatStore } from '@/stores/aiChat';-import { STORAGE_KEYS } from '@/utils/localStorage';import { useResourcesAsLegacy } from '@/hooks/useResources';import { useAlertsActivation } from '@/stores/alertsActivation';@@ -1088,8 +1086,6 @@ const HostRow: Component<HostRowProps> = (props) => {// NOTE: Do NOT destructure props.host - it breaks SolidJS reactivity!// Always access props.host directly to ensure updates flow through.- // Check if this host is in AI context- const isInAIContext = createMemo(() => aiChatStore.enabled && aiChatStore.hasContextItem(props.host.id));// URL editing using shared hookconst urlEdit = createUrlEditState();@@ -1130,39 +1126,7 @@ const HostRow: Component<HostRowProps> = (props) => {}};- // Build context for AI - includes routing fields- const buildHostContext = (): Record<string, unknown> => ({- hostName: props.host.displayName || props.host.hostname,- hostname: props.host.hostname,- node: props.host.hostname, // Used by AI for command routing- target_host: props.host.hostname, // Explicit routing hint- platform: props.host.platform,- osName: props.host.osName,- osVersion: props.host.osVersion,- cpuUsage: props.host.cpuUsage ? `${props.host.cpuUsage.toFixed(1)}%` : undefined,- memoryUsage: props.host.memory?.usage ? `${props.host.memory.usage.toFixed(1)}%` : undefined,- uptime: props.host.uptimeSeconds ? formatUptime(props.host.uptimeSeconds) : undefined,- });- // Handle row click - toggle AI context selection- const handleRowClick = (event: MouseEvent) => {- const target = event.target as HTMLElement;- if (target.closest('a, button, [data-prevent-toggle], [data-url-editor]')) {- return;- }-- // If AI is enabled, toggle AI context- if (aiChatStore.enabled) {- if (aiChatStore.hasContextItem(props.host.id)) {- aiChatStore.removeContextItem(props.host.id);- } else {- aiChatStore.addContextItem('host', props.host.id, props.host.displayName || props.host.hostname, buildHostContext());- if (!aiChatStore.isOpen) {- aiChatStore.open();- }- }- }- };// Reactive getters to ensure values update when WebSocket data changesconst hostStatus = createMemo(() => getHostStatusIndicator(props.host));@@ -1173,15 +1137,13 @@ const HostRow: Component<HostRowProps> = (props) => {const rowClass = () => {const base = 'transition-all duration-200';const hover = 'hover:bg-gray-50 dark:hover:bg-gray-800/50';- const clickable = aiChatStore.enabled ? 'cursor-pointer' : '';- const aiContext = isInAIContext() ? 'ai-context-row' : '';const offline = !isOnline() ? 'opacity-60' : '';- return `${base} ${hover} ${clickable} ${aiContext} ${offline}`;+ return `${base} ${hover} ${offline}`;};return (<>- <tr class={rowClass()} onClick={handleRowClick}>+ <tr class={rowClass()}>{/* Host Name - always visible */}<td class="pl-4 pr-2 py-1 align-middle overflow-hidden"><div class="flex items-center gap-2 min-w-0">@@ -1246,14 +1208,6 @@ const HostRow: Component<HostRowProps> = (props) => {<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z" /></svg></button>- {/* AI context indicator */}- <Show when={isInAIContext()}>- <span class="flex-shrink-0 text-purple-500 dark:text-purple-400" title="Selected for AI context">- <svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="2">- <path stroke-linecap="round" stroke-linejoin="round" d="M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 00-2.456 2.456z" />- </svg>- </span>- </Show></div></div>diff --git a/frontend-modern/src/components/Settings/AISettings.tsx b/frontend-modern/src/components/Settings/AISettings.tsxindex 21e4306248..8ad7595aa3 100644--- a/frontend-modern/src/components/Settings/AISettings.tsx+++ b/frontend-modern/src/components/Settings/AISettings.tsx@@ -8,6 +8,7 @@ import { formField, labelClass, controlClass } from '@/components/shared/Form';import { notificationStore } from '@/stores/notifications';import { logger } from '@/utils/logger';import { AIAPI } from '@/api/ai';+import { OpenCodeAPI, type ChatSession, type FileChange } from '@/api/opencode';import { hasFeature, loadLicenseStatus } from '@/stores/license';import type { AISettings as AISettingsType, AIProvider, AuthMethod } from '@/types/ai';@@ -87,6 +88,17 @@ export const AISettings: Component = () => {const [availableModels, setAvailableModels] = createSignal<{ id: string; name: string; description?: string }[]>([]);const [modelsLoading, setModelsLoading] = createSignal(false);+ const [chatSessions, setChatSessions] = createSignal<ChatSession[]>([]);+ const [chatSessionsLoading, setChatSessionsLoading] = createSignal(false);+ const [chatSessionsError, setChatSessionsError] = createSignal('');+ const [selectedSessionId, setSelectedSessionId] = createSignal('');+ const [sessionActionLoading, setSessionActionLoading] = createSignal<string | null>(null);++ const [showDiffModal, setShowDiffModal] = createSignal(false);+ const [diffFiles, setDiffFiles] = createSignal<FileChange[]>([]);+ const [diffSummary, setDiffSummary] = createSignal('');+ const [diffSessionLabel, setDiffSessionLabel] = createSignal('');+// Accordion state for provider configuration sectionsconst [expandedProviders, setExpandedProviders] = createSignal<Set<AIProvider>>(new Set(['anthropic']));@@ -112,6 +124,8 @@ export const AISettings: Component = () => {const [showAdvancedModels, setShowAdvancedModels] = createSignal(false);const [showPatrolSettings, setShowPatrolSettings] = createSignal(false);+ const [showChatMaintenance, setShowChatMaintenance] = createSignal(false);+const [form, setForm] = createStore({enabled: false,provider: 'anthropic' as AIProvider, // Legacy - kept for compatibility@@ -231,6 +245,140 @@ export const AISettings: Component = () => {}};+ const loadChatSessions = async () => {+ setChatSessionsLoading(true);+ setChatSessionsError('');+ try {+ const sessions = await OpenCodeAPI.listSessions();+ setChatSessions(sessions);+ const current = selectedSessionId();+ if (!current || !sessions.some((session) => session.id === current)) {+ setSelectedSessionId(sessions[0]?.id || '');+ }+ } catch (error) {+ logger.error('[AISettings] Failed to load chat sessions:', error);+ setChatSessions([]);+ const message = error instanceof Error ? error.message : 'Failed to load chat sessions.';+ setChatSessionsError(message);+ } finally {+ setChatSessionsLoading(false);+ }+ };++ const selectedChatSession = createMemo(() => {+ const id = selectedSessionId();+ if (!id) return null;+ return chatSessions().find((session) => session.id === id) || null;+ });++ const formatSessionLabel = (session: ChatSession) => {+ const updatedAt = new Date(session.updated_at);+ const dateLabel = updatedAt.toLocaleDateString([], { month: 'short', day: 'numeric' });+ const timeLabel = updatedAt.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });+ return `${session.title || 'Untitled'} - ${session.message_count} msgs - ${dateLabel} ${timeLabel}`;+ };++ const formatDiffStatus = (status: FileChange['status']) => {+ switch (status) {+ case 'added':+ return 'Added';+ case 'modified':+ return 'Modified';+ case 'deleted':+ return 'Deleted';+ default:+ return 'Changed';+ }+ };++ const diffStatusClasses = (status: FileChange['status']) => {+ switch (status) {+ case 'added':+ return 'bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-200';+ case 'modified':+ return 'bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-200';+ case 'deleted':+ return 'bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-200';+ default:+ return 'bg-gray-100 text-gray-700 dark:bg-gray-900/40 dark:text-gray-200';+ }+ };++ const formatDiffStats = (change: FileChange) => `+${change.added} -${change.removed}`;++ const handleSessionSummarize = async () => {+ const sessionId = selectedSessionId();+ if (!sessionId) {+ notificationStore.info('Select a chat session first.');+ return;+ }++ setSessionActionLoading('summarize');+ try {+ await OpenCodeAPI.summarizeSession(sessionId);+ notificationStore.success('Session summarized.');+ } catch (error) {+ logger.error('[AISettings] Failed to summarize session:', error);+ const message = error instanceof Error ? error.message : 'Failed to summarize session.';+ notificationStore.error(message);+ } finally {+ setSessionActionLoading(null);+ }+ };++ const handleSessionDiff = async () => {+ const sessionId = selectedSessionId();+ if (!sessionId) {+ notificationStore.info('Select a chat session first.');+ return;+ }++ setSessionActionLoading('diff');+ try {+ const diff = await OpenCodeAPI.getSessionDiff(sessionId);+ const files = diff.files || [];+ if (files.length === 0) {+ setDiffFiles([]);+ setDiffSummary('');+ setShowDiffModal(false);+ notificationStore.info('No file changes in this session.');+ return;+ }+ setDiffFiles(files);+ setDiffSummary(diff.summary || '');+ const session = selectedChatSession();+ setDiffSessionLabel(session ? (session.title || 'Untitled session') : 'Selected session');+ setShowDiffModal(true);+ } catch (error) {+ logger.error('[AISettings] Failed to get session diff:', error);+ const message = error instanceof Error ? error.message : 'Failed to get session diff.';+ notificationStore.error(message);+ } finally {+ setSessionActionLoading(null);+ }+ };++ const handleSessionRevert = async () => {+ const sessionId = selectedSessionId();+ if (!sessionId) {+ notificationStore.info('Select a chat session first.');+ return;+ }+ if (!confirm('Revert all changes from this session? This cannot be undone.')) return;++ setSessionActionLoading('revert');+ try {+ await OpenCodeAPI.revertSession(sessionId);+ notificationStore.success('Session changes reverted.');+ } catch (error) {+ logger.error('[AISettings] Failed to revert session:', error);+ const message = error instanceof Error ? error.message : 'Failed to revert session.';+ notificationStore.error(message);+ } finally {+ setSessionActionLoading(null);+ }+ };+const loadSettings = async () => {setLoading(true);try {@@ -1497,6 +1645,118 @@ export const AISettings: Component = () => {</Show></div>+ {/* Chat session maintenance */}+ <div class="border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden">+ <button+ type="button"+ class="w-full px-3 py-2 flex items-center justify-between bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700/50 transition-colors text-left"+ onClick={() => {+ const next = !showChatMaintenance();+ setShowChatMaintenance(next);+ if (next) {+ loadChatSessions();+ }+ }}+ >+ <div class="flex items-center gap-2">+ <svg class="w-4 h-4 text-gray-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6V4m0 2a2 2 0 100 4m0-4a2 2 0 110 4m-6 8a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4m6 6v10m6-2a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4" />+ </svg>+ <span class="text-sm font-medium text-gray-700 dark:text-gray-300">Chat Session Maintenance</span>+ </div>+ <svg class={`w-4 h-4 text-gray-500 transition-transform ${showChatMaintenance() ? 'rotate-180' : ''}`} fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />+ </svg>+ </button>+ <Show when={showChatMaintenance()}>+ <div class="px-3 py-3 bg-white dark:bg-gray-800/50 border-t border-gray-200 dark:border-gray-700 space-y-3">+ <p class="text-xs text-gray-500 dark:text-gray-400">+ Use this panel to summarize, inspect, or revert a specific chat session. It does not change your default AI settings.+ </p>+ <div class="flex items-center justify-between">+ <label class="text-xs font-medium text-gray-600 dark:text-gray-400">Session</label>+ <button+ type="button"+ onClick={loadChatSessions}+ disabled={chatSessionsLoading()}+ class="text-xs text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300 disabled:opacity-50"+ >+ {chatSessionsLoading() ? 'Refreshing...' : 'Refresh'}+ </button>+ </div>++ <Show when={chatSessionsLoading()}>+ <div class="text-xs text-gray-500 dark:text-gray-400">Loading chat sessions...</div>+ </Show>+ <Show when={!chatSessionsLoading()}>+ <Show when={chatSessionsError()}>+ <div class="text-xs text-red-500">{chatSessionsError()}</div>+ </Show>+ <Show when={!chatSessionsError()}>+ <Show+ when={chatSessions().length > 0}+ fallback={+ <div class="text-xs text-gray-500 dark:text-gray-400">+ No chat sessions yet. Start a chat to create one.+ </div>+ }+ >+ <select+ value={selectedSessionId()}+ onChange={(e) => setSelectedSessionId(e.currentTarget.value)}+ class="w-full px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700"+ disabled={saving()}+ >+ <For each={chatSessions()}>+ {(session) => (+ <option value={session.id}>+ {formatSessionLabel(session)}+ </option>+ )}+ </For>+ </select>+ <Show when={selectedChatSession()}>+ <p class="text-[10px] text-gray-500 dark:text-gray-400 mt-1">+ Last updated {new Date(selectedChatSession()!.updated_at).toLocaleString()}+ </p>+ </Show>+ </Show>+ </Show>+ </Show>++ <div class="flex flex-wrap gap-2 pt-1">+ <button+ type="button"+ onClick={handleSessionSummarize}+ disabled={!selectedSessionId() || sessionActionLoading() !== null}+ class="px-3 py-1.5 text-xs font-medium rounded border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50"+ >+ {sessionActionLoading() === 'summarize' ? 'Summarizing...' : 'Summarize context'}+ </button>+ <button+ type="button"+ onClick={handleSessionDiff}+ disabled={!selectedSessionId() || sessionActionLoading() !== null}+ class="px-3 py-1.5 text-xs font-medium rounded border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50"+ >+ {sessionActionLoading() === 'diff' ? 'Loading...' : 'View file changes'}+ </button>+ <button+ type="button"+ onClick={handleSessionRevert}+ disabled={!selectedSessionId() || sessionActionLoading() !== null}+ class="px-3 py-1.5 text-xs font-medium rounded border border-red-200 dark:border-red-700 bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-300 hover:bg-red-100 dark:hover:bg-red-900/40 disabled:opacity-50"+ >+ {sessionActionLoading() === 'revert' ? 'Reverting...' : 'Revert changes'}+ </button>+ </div>+ <p class="text-[10px] text-gray-500 dark:text-gray-400">+ These actions apply to the selected chat session only.+ </p>+ </div>+ </Show>+ </div>+</div>{/* Status indicator */}@@ -1560,6 +1820,60 @@ export const AISettings: Component = () => {</form></Card>+ {/* Session Diff Modal */}+ <Show when={showDiffModal()}>+ <div+ class="fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm p-4"+ onClick={() => setShowDiffModal(false)}+ >+ <div+ class="bg-white dark:bg-gray-800 rounded-xl shadow-2xl max-w-2xl w-full overflow-hidden"+ onClick={(e) => e.stopPropagation()}+ >+ <div class="flex items-start justify-between gap-4 px-6 py-4 border-b border-gray-200 dark:border-gray-700">+ <div>+ <h3 class="text-lg font-semibold text-gray-900 dark:text-white">Session File Changes</h3>+ <p class="text-xs text-gray-500 dark:text-gray-400">+ {diffSessionLabel() || 'Selected session'}+ </p>+ </div>+ <button+ type="button"+ class="text-sm text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white"+ onClick={() => setShowDiffModal(false)}+ >+ Close+ </button>+ </div>+ <div class="p-6 space-y-4 max-h-[70vh] overflow-y-auto">+ <Show when={diffSummary()}>+ <div class="rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900/40 p-3">+ <p class="text-xs font-semibold text-gray-700 dark:text-gray-200">Summary</p>+ <p class="text-xs text-gray-600 dark:text-gray-300 mt-1 whitespace-pre-wrap">{diffSummary()}</p>+ </div>+ </Show>+ <div class="space-y-2">+ <For each={diffFiles()}>+ {(file) => (+ <div class="flex items-center justify-between gap-3 rounded-md border border-gray-200 dark:border-gray-700 px-3 py-2 text-xs">+ <div class="flex items-center gap-2 min-w-0">+ <span+ class={`inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-semibold uppercase ${diffStatusClasses(file.status)}`}+ >+ {formatDiffStatus(file.status)}+ </span>+ <span class="text-gray-700 dark:text-gray-200 truncate">{file.path}</span>+ </div>+ <span class="text-gray-500 dark:text-gray-400 flex-shrink-0">{formatDiffStats(file)}</span>+ </div>+ )}+ </For>+ </div>+ </div>+ </div>+ </div>+ </Show>+{/* First-time Setup Modal */}<Show when={showSetupModal()}><div class="fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm">diff --git a/frontend-modern/src/stores/aiChat.ts b/frontend-modern/src/stores/aiChat.tsindex cbdd53898c..2b5a501a95 100644--- a/frontend-modern/src/stores/aiChat.ts+++ b/frontend-modern/src/stores/aiChat.ts@@ -271,9 +271,11 @@ export const aiChatStore = {logger.error('Failed to save session ID:', e);}- // Clear messages+ // Clear messages and contextsetMessages([]);setSessionTitle('');+ setContextItems([]);+ setAIChatContext({});saveMessagesToStorage([]);localStorage.removeItem(HISTORY_STORAGE_KEY);@@ -370,18 +372,21 @@ export const aiChatStore = {this.newConversation();},- // Convenience method to update context for a specific target (host, VM, container, etc.)- // This is called when user selects/views a specific resource+ // Convenience method to set context for a specific target (host, VM, container, etc.)+ // This replaces any existing context with the new targetsetTargetContext(targetType: string, targetId: string, additionalContext?: Record<string, unknown>) {- // Use addContextItem instead of replacing+ // Clear existing context first since context UI is removed+ setContextItems([]);const name = (additionalContext?.guestName as string) ||(additionalContext?.name as string) ||targetId;this.addContextItem(targetType, targetId, name, additionalContext || {});},- // Open for a specific target - opens the panel and adds to context+ // Open for a specific target - opens the panel with context for this target onlyopenForTarget(targetType: string, targetId: string, additionalContext?: Record<string, unknown>) {+ // Clear existing context first since context UI is removed+ setContextItems([]);const name = (additionalContext?.guestName as string) ||(additionalContext?.name as string) ||targetId;diff --git a/frontend-modern/src/styles/animations.css b/frontend-modern/src/styles/animations.cssindex 03b660bbc2..93f4c263c0 100644--- a/frontend-modern/src/styles/animations.css+++ b/frontend-modern/src/styles/animations.css@@ -211,52 +211,3 @@animation: nodeClick 0.15s ease-out;}-/* AI Context row highlight - subtle left accent bar */-/* Using purple-500 for a clean, modern look */--.ai-context-row {- background-color: rgba(147, 51, 234, 0.04);- box-shadow: inset 3px 0 0 0 rgba(147, 51, 234, 0.6);-}--.ai-context-row:hover {- background-color: rgba(147, 51, 234, 0.08);-}--/* Adjacent rows - keep the left border consistent */-.ai-context-row.ai-context-no-top,-.ai-context-row.ai-context-no-bottom,-.ai-context-row.ai-context-no-top.ai-context-no-bottom {- background-color: rgba(147, 51, 234, 0.04);- box-shadow: inset 3px 0 0 0 rgba(147, 51, 234, 0.6);-}--.ai-context-row.ai-context-no-top:hover,-.ai-context-row.ai-context-no-bottom:hover,-.ai-context-row.ai-context-no-top.ai-context-no-bottom:hover {- background-color: rgba(147, 51, 234, 0.08);-}--/* Dark mode - using purple-400 for better visibility */-.dark .ai-context-row {- background-color: rgba(167, 139, 250, 0.06);- box-shadow: inset 3px 0 0 0 rgba(167, 139, 250, 0.5);-}--.dark .ai-context-row:hover {- background-color: rgba(167, 139, 250, 0.12);-}--.dark .ai-context-row.ai-context-no-top,-.dark .ai-context-row.ai-context-no-bottom,-.dark .ai-context-row.ai-context-no-top.ai-context-no-bottom {- background-color: rgba(167, 139, 250, 0.06);- box-shadow: inset 3px 0 0 0 rgba(167, 139, 250, 0.5);-}--.dark .ai-context-row.ai-context-no-top:hover,-.dark .ai-context-row.ai-context-no-bottom:hover,-.dark .ai-context-row.ai-context-no-top.ai-context-no-bottom:hover {- background-color: rgba(167, 139, 250, 0.12);-}-diff --git a/frontend-modern/src/types/responsive.ts b/frontend-modern/src/types/responsive.tsindex 049fc4e2c6..05e7cc9c63 100644--- a/frontend-modern/src/types/responsive.ts+++ b/frontend-modern/src/types/responsive.ts@@ -29,6 +29,9 @@ export interface ColumnConfig {/** Maximum width for the column (CSS value) */maxWidth?: string;+ /** Fixed width for the column (CSS value) - used with table-layout: fixed */+ width?: string;+/** Flex grow factor for grid layout (default: 1) */flex?: number;