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
AI features checkpoint: Host selection, memory sparklines, UI refinements
rcourtmane176861b35fc
diff --git a/frontend-modern/src/components/AI/AIChat.tsx b/frontend-modern/src/components/AI/AIChat.tsxindex 3894adc572..52d4f20092 100644--- a/frontend-modern/src/components/AI/AIChat.tsx+++ b/frontend-modern/src/components/AI/AIChat.tsx@@ -557,10 +557,15 @@ export const AIChat: Component<AIChatProps> = (props) => {success: result.success,};+ const remainingApprovals = m.pendingApprovals?.filter((a) => a.toolId !== approval.toolId) || [];+return {...m,- pendingApprovals: m.pendingApprovals?.filter((a) => a.toolId !== approval.toolId),+ pendingApprovals: remainingApprovals,toolCalls: [...(m.toolCalls || []), newToolCall],+ // Clear the stale "I need approval" content after the last approval is processed+ // The tool output will show the result instead+ content: remainingApprovals.length === 0 ? '' : m.content,};}));diff --git a/frontend-modern/src/components/AI/GuestNotes.tsx b/frontend-modern/src/components/AI/GuestNotes.tsxindex a6b514849e..fac1e8f6a6 100644--- a/frontend-modern/src/components/AI/GuestNotes.tsx+++ b/frontend-modern/src/components/AI/GuestNotes.tsx@@ -23,6 +23,8 @@ interface GuestNotesProps {guestId: string;guestName?: string;guestType?: string;+ customUrl?: string;+ onCustomUrlUpdate?: (guestId: string, url: string) => void;}const CATEGORY_LABELS: Record<string, string> = {@@ -101,6 +103,16 @@ export const GuestNotes: Component<GuestNotesProps> = (props) => {const [title, setTitle] = createSignal('');const [content, setContent] = createSignal('');+ // Guest URL state+ const [guestUrl, setGuestUrl] = createSignal(props.customUrl || '');+ const [isEditingUrl, setIsEditingUrl] = createSignal(false);+ const [isSavingUrl, setIsSavingUrl] = createSignal(false);++ // Sync URL from props+ createEffect(() => {+ setGuestUrl(props.customUrl || '');+ });+// File input ref for importlet fileInputRef: HTMLInputElement | undefined;@@ -115,11 +127,24 @@ export const GuestNotes: Component<GuestNotesProps> = (props) => {const loadKnowledge = async (guestId: string) => {setIsLoading(true);try {- const response = await apiFetch(`/api/ai/knowledge?guest_id=${encodeURIComponent(guestId)}`);- if (response.ok) {- const data = await response.json();+ // Fetch knowledge and metadata in parallel+ const [knowledgeResponse, metadataResponse] = await Promise.all([+ apiFetch(`/api/ai/knowledge?guest_id=${encodeURIComponent(guestId)}`),+ apiFetch(`/api/guests/metadata/${encodeURIComponent(guestId)}`),+ ]);++ if (knowledgeResponse.ok) {+ const data = await knowledgeResponse.json();setKnowledge(data);}++ // Load customUrl from metadata if not provided via props+ if (metadataResponse.ok) {+ const metadata = await metadataResponse.json();+ if (metadata.customUrl && !props.customUrl) {+ setGuestUrl(metadata.customUrl);+ }+ }} catch (error) {console.error('Failed to load guest knowledge:', error);} finally {@@ -127,6 +152,30 @@ export const GuestNotes: Component<GuestNotesProps> = (props) => {}};+ const saveGuestUrl = async () => {+ const url = guestUrl().trim();+ setIsSavingUrl(true);+ try {+ const response = await apiFetch(`/api/guests/metadata/${encodeURIComponent(props.guestId)}`, {+ method: 'PUT',+ headers: { 'Content-Type': 'application/json' },+ body: JSON.stringify({ customUrl: url }),+ });+ if (response.ok) {+ notificationStore.success(url ? 'Guest URL saved' : 'Guest URL cleared');+ setIsEditingUrl(false);+ props.onCustomUrlUpdate?.(props.guestId, url);+ } else {+ notificationStore.error('Failed to save guest URL');+ }+ } catch (error) {+ console.error('Failed to save guest URL:', error);+ notificationStore.error('Failed to save guest URL');+ } finally {+ setIsSavingUrl(false);+ }+ };+const saveNote = async () => {if (!title().trim() || !content().trim()) return;@@ -408,6 +457,85 @@ export const GuestNotes: Component<GuestNotesProps> = (props) => {{/* Expandable content */}<Show when={isExpanded()}><div class="mt-2 space-y-2 px-2">+ {/* Guest URL field */}+ <div class="bg-gray-800/50 rounded p-2 border border-gray-700">+ <div class="flex items-center justify-between mb-1">+ <span class="text-xs font-medium text-gray-400 flex items-center gap-1">+ <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="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" />+ </svg>+ Guest URL+ </span>+ <Show when={guestUrl() && !isEditingUrl()}>+ <a+ href={guestUrl()}+ target="_blank"+ rel="noopener noreferrer"+ class="text-xs text-blue-400 hover:text-blue-300 flex items-center gap-1"+ >+ Open+ <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="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" />+ </svg>+ </a>+ </Show>+ </div>+ <Show when={isEditingUrl()} fallback={+ <div class="flex items-center gap-2">+ <Show when={guestUrl()} fallback={+ <span class="text-xs text-gray-500 italic">No URL set</span>+ }>+ <span class="text-xs text-gray-300 break-all font-mono">{guestUrl()}</span>+ </Show>+ <button+ onClick={() => setIsEditingUrl(true)}+ class="text-xs text-blue-400 hover:text-blue-300 ml-auto"+ >+ {guestUrl() ? 'Edit' : 'Add'}+ </button>+ </div>+ }>+ <div class="space-y-2">+ <input+ type="text"+ value={guestUrl()}+ onInput={(e) => setGuestUrl(e.target.value)}+ onKeyDown={(e) => {+ if (e.key === 'Enter') {+ e.preventDefault();+ saveGuestUrl();+ } else if (e.key === 'Escape') {+ e.preventDefault();+ setGuestUrl(props.customUrl || '');+ setIsEditingUrl(false);+ }+ }}+ placeholder="https://192.168.1.100:8080"+ class="w-full bg-gray-700 text-xs text-gray-200 rounded px-2 py-1.5 border border-gray-600 placeholder-gray-500 font-mono"+ autofocus+ />+ <div class="flex gap-2 justify-end">+ <button+ onClick={() => {+ setGuestUrl(props.customUrl || '');+ setIsEditingUrl(false);+ }}+ class="text-xs px-2 py-1 text-gray-400 hover:text-gray-200"+ >+ Cancel+ </button>+ <button+ onClick={saveGuestUrl}+ disabled={isSavingUrl()}+ class="text-xs px-3 py-1 bg-blue-600 text-white rounded hover:bg-blue-500 disabled:opacity-50"+ >+ {isSavingUrl() ? 'Saving...' : 'Save'}+ </button>+ </div>+ </div>+ </Show>+ </div>+{/* Search and filter bar - only show if there are notes */}<Show when={hasNotes()}><div class="flex gap-2 mb-2">@@ -437,7 +565,7 @@ export const GuestNotes: Component<GuestNotesProps> = (props) => {{/* Notes list */}<Show when={hasNotes()} fallback={- <p class="text-xs text-gray-500 italic">No saved notes yet. The AI will automatically save useful discoveries.</p>+ <p class="text-xs text-gray-500 italic">No saved notes yet. Add notes to remember passwords, paths, and configs.</p>}><Show when={filteredNotes().length > 0} fallback={<p class="text-xs text-gray-500 italic">No notes match your search.</p>diff --git a/frontend-modern/src/components/Dashboard/Dashboard.tsx b/frontend-modern/src/components/Dashboard/Dashboard.tsxindex 055af95e60..84a5a1aaeb 100644--- a/frontend-modern/src/components/Dashboard/Dashboard.tsx+++ b/frontend-modern/src/components/Dashboard/Dashboard.tsx@@ -897,10 +897,10 @@ export function Dashboard(props: DashboardProps) {}};- // Handle row click - add guest to AI context when sidebar is open+ // Handle row click - add guest to AI context (works even when sidebar is closed)const handleGuestRowClick = (guest: VM | Container) => {- // Only add to context if AI is enabled and sidebar is open- if (!aiChatStore.enabled || !aiChatStore.isOpen) return;+ // Only enable if AI is configured+ if (!aiChatStore.enabled) return;const guestId = guest.id || `${guest.instance}-${guest.vmid}`;const guestType = guest.type === 'qemu' ? 'vm' : 'container';@@ -908,6 +908,7 @@ export function Dashboard(props: DashboardProps) {// Toggle: remove if already in context, add if notif (aiChatStore.hasContextItem(guestId)) {aiChatStore.removeContextItem(guestId);+ // If no items left in context and sidebar is open, keep it open for now} else {aiChatStore.addContextItem(guestType, guestId, guest.name, {guestName: guest.name,@@ -917,6 +918,10 @@ export function Dashboard(props: DashboardProps) {node: guest.node,status: guest.status,});+ // Auto-open the sidebar when first item is selected+ if (!aiChatStore.isOpen) {+ aiChatStore.open();+ }}};diff --git a/frontend-modern/src/components/Dashboard/GuestRow.tsx b/frontend-modern/src/components/Dashboard/GuestRow.tsxindex 33888b5a47..cdf00a2ceb 100644--- a/frontend-modern/src/components/Dashboard/GuestRow.tsx+++ b/frontend-modern/src/components/Dashboard/GuestRow.tsx@@ -32,12 +32,7 @@ function getIOColorClass(bytesPerSec: number): string {return 'text-red-600 dark:text-red-400';}-// Global editing state - use a signal so all components react-const [currentlyEditingGuestId, setCurrentlyEditingGuestId] = createSignal<string | null>(null);-// Store the editing value globally so it survives re-renders-const editingValues = new Map<string, string>();-// Signal to trigger reactivity when editing values change-const [editingValuesVersion, setEditingValuesVersion] = createSignal(0);+const GROUPED_FIRST_CELL_INDENT = 'pl-5 sm:pl-6 lg:pl-8';const DEFAULT_FIRST_CELL_INDENT = 'pl-4';@@ -482,7 +477,6 @@ interface GuestRowProps {export function GuestRow(props: GuestRowProps) {const guestId = createMemo(() => buildGuestId(props.guest));- const isEditingUrl = createMemo(() => currentlyEditingGuestId() === guestId());// Use breakpoint hook directly for responsive behaviorconst { isMobile } = useBreakpoint();@@ -505,12 +499,64 @@ export function GuestRow(props: GuestRowProps) {const [customUrl, setCustomUrl] = createSignal<string | undefined>(props.customUrl);const [shouldAnimateIcon, setShouldAnimateIcon] = createSignal(false);- const editingUrlValue = createMemo(() => {- editingValuesVersion(); // Subscribe to changes- return editingValues.get(guestId()) || '';- });+ const [isEditingUrl, setIsEditingUrl] = createSignal(false);+ const [editingUrlValue, setEditingUrlValue] = createSignal('');+ const [isSavingUrl, setIsSavingUrl] = createSignal(false);let urlInputRef: HTMLInputElement | undefined;+ // Focus input when editing starts+ createEffect(() => {+ if (isEditingUrl() && urlInputRef) {+ urlInputRef.focus();+ urlInputRef.select();+ }+ });++ const startEditingUrl = (event: MouseEvent) => {+ event.stopPropagation();+ setEditingUrlValue(customUrl() || '');+ setIsEditingUrl(true);+ };++ const saveUrl = async () => {+ const newUrl = editingUrlValue().trim();+ setIsSavingUrl(true);++ try {+ await GuestMetadataAPI.updateMetadata(guestId(), { customUrl: newUrl });++ const hadUrl = !!customUrl();+ if (!hadUrl && newUrl) {+ setShouldAnimateIcon(true);+ setTimeout(() => setShouldAnimateIcon(false), 200);+ }++ setCustomUrl(newUrl || undefined);+ setIsEditingUrl(false);++ if (props.onCustomUrlUpdate) {+ props.onCustomUrlUpdate(guestId(), newUrl);+ }++ if (newUrl) {+ showSuccess('Guest URL saved');+ } else {+ showSuccess('Guest URL cleared');+ }+ } catch (err: unknown) {+ const message = err instanceof Error ? err.message : 'Failed to save guest URL';+ logger.error('Failed to save guest URL:', err);+ showError(message);+ } finally {+ setIsSavingUrl(false);+ }+ };++ const cancelEditingUrl = () => {+ setIsEditingUrl(false);+ setEditingUrlValue('');+ };+const ipAddresses = createMemo(() => props.guest.ipAddresses ?? []);const networkInterfaces = createMemo(() => props.guest.networkInterfaces ?? []);const hasNetworkInterfaces = createMemo(() => networkInterfaces().length > 0);@@ -519,22 +565,19 @@ export function GuestRow(props: GuestRowProps) {const agentVersion = createMemo(() => props.guest.agentVersion?.trim() ?? '');const hasOsInfo = createMemo(() => osName().length > 0 || osVersion().length > 0);- // Update custom URL when prop changes, but only if we're not currently editing+ // Update custom URL when prop changescreateEffect(() => {- // Don't update customUrl from props if this guest is currently being edited- if (currentlyEditingGuestId() !== guestId()) {- const prevUrl = customUrl();- const newUrl = props.customUrl;-- // Only animate when URL transitions from empty to having a value- if (!prevUrl && newUrl) {- setShouldAnimateIcon(true);- // Remove animation class after it completes- setTimeout(() => setShouldAnimateIcon(false), 200);- }-- setCustomUrl(newUrl);+ const prevUrl = customUrl();+ const newUrl = props.customUrl;++ // Only animate when URL transitions from empty to having a value+ if (!prevUrl && newUrl) {+ setShouldAnimateIcon(true);+ // Remove animation class after it completes+ setTimeout(() => setShouldAnimateIcon(false), 200);}++ setCustomUrl(newUrl);});const cpuPercent = createMemo(() => (props.guest.cpu || 0) * 100);@@ -574,137 +617,7 @@ export function GuestRow(props: GuestRowProps) {});const memoryTooltip = createMemo(() => memoryExtraLines()?.join('\n') ?? undefined);- const startEditingUrl = (event: MouseEvent) => {- event.stopPropagation();-- const currentEditing = currentlyEditingGuestId();- if (currentEditing !== null && currentEditing !== guestId()) {- const currentInput = document.querySelector(`input[data-guest-id="${currentEditing}"]`) as HTMLInputElement;- if (currentInput) {- currentInput.blur();- }- }- editingValues.set(guestId(), customUrl() || '');- setEditingValuesVersion(v => v + 1);- setCurrentlyEditingGuestId(guestId());- };-- createEffect(() => {- if (isEditingUrl() && urlInputRef) {- urlInputRef.focus();- urlInputRef.select();- }- });-- let isCurrentlyMounted = true;-- createEffect(() => {- if (isEditingUrl() && isCurrentlyMounted) {- const handleGlobalClick = (e: MouseEvent) => {- if (currentlyEditingGuestId() !== guestId()) return;-- const target = e.target as HTMLElement;- const isClickingGuestName = target.closest('[data-guest-name-editable]');-- if (!target.closest('[data-url-editor]') && !isClickingGuestName) {- e.preventDefault();- e.stopPropagation();- e.stopImmediatePropagation();- cancelEditingUrl();- }- };-- const handleGlobalMouseDown = (e: MouseEvent) => {- if (currentlyEditingGuestId() !== guestId()) return;-- const target = e.target as HTMLElement;- const isClickingGuestName = target.closest('[data-guest-name-editable]');-- if (!target.closest('[data-url-editor]') && !isClickingGuestName) {- e.preventDefault();- e.stopPropagation();- e.stopImmediatePropagation();- }- };-- document.addEventListener('mousedown', handleGlobalMouseDown, true);- document.addEventListener('click', handleGlobalClick, true);- return () => {- document.removeEventListener('mousedown', handleGlobalMouseDown, true);- document.removeEventListener('click', handleGlobalClick, true);- };- }- });-- const saveUrl = async () => {- if (currentlyEditingGuestId() !== guestId()) return;-- const newUrl = (editingValues.get(guestId()) || '').trim();-- editingValues.delete(guestId());- setEditingValuesVersion(v => v + 1);- setCurrentlyEditingGuestId(null);-- if (newUrl === (customUrl() || '')) return;-- try {- await GuestMetadataAPI.updateMetadata(guestId(), { customUrl: newUrl });-- const hadUrl = !!customUrl();- if (!hadUrl && newUrl) {- setShouldAnimateIcon(true);- setTimeout(() => setShouldAnimateIcon(false), 200);- }-- setCustomUrl(newUrl || undefined);-- if (props.onCustomUrlUpdate) {- props.onCustomUrlUpdate(guestId(), newUrl);- }-- if (newUrl) {- showSuccess('Guest URL saved');- } else {- showSuccess('Guest URL cleared');- }- } catch (err: any) {- logger.error('Failed to save guest URL:', err);- showError(err.message || 'Failed to save guest URL');- }- };-- const deleteUrl = async () => {- if (currentlyEditingGuestId() !== guestId()) return;-- editingValues.delete(guestId());- setEditingValuesVersion(v => v + 1);- setCurrentlyEditingGuestId(null);-- if (customUrl()) {- try {- await GuestMetadataAPI.updateMetadata(guestId(), { customUrl: '' });- setCustomUrl(undefined);-- if (props.onCustomUrlUpdate) {- props.onCustomUrlUpdate(guestId(), '');- }-- showSuccess('Guest URL removed');- } catch (err: any) {- logger.error('Failed to remove guest URL:', err);- showError(err.message || 'Failed to remove guest URL');- }- }- };-- const cancelEditingUrl = () => {- if (currentlyEditingGuestId() !== guestId()) return;-- editingValues.delete(guestId());- setEditingValuesVersion(v => v + 1);- setCurrentlyEditingGuestId(null);- };const diskPercent = createMemo(() => {if (!props.guest.disk || props.guest.disk.total === 0) return 0;@@ -765,7 +678,8 @@ export function GuestRow(props: GuestRowProps) {});// Check AI context state reactively from the store- const isInAIContext = createMemo(() => aiChatStore.isOpen && aiChatStore.hasContextItem(guestId()));+ // 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);@@ -816,8 +730,7 @@ export function GuestRow(props: GuestRowProps) {const handleRowClick = (e: MouseEvent) => {// Don't trigger if clicking on interactive elementsconst target = e.target as HTMLElement;- if (target.closest('[data-url-editor]') ||- target.closest('[data-prevent-toggle]') ||+ if (target.closest('[data-prevent-toggle]') ||target.closest('a') ||target.closest('button') ||target.closest('input')) {@@ -846,13 +759,10 @@ export function GuestRow(props: GuestRowProps) {<Showwhen={isEditingUrl()}fallback={- <div class="flex items-center gap-1.5 min-w-0">+ <div class="flex items-center gap-1.5 min-w-0 group/name"><span- class="text-xs font-medium text-gray-900 dark:text-gray-100 cursor-text select-none whitespace-nowrap"- style="cursor: text;"- title={`${props.guest.name}${customUrl() ? ' - Click to edit URL' : ' - Click to add URL'}`}- onClick={startEditingUrl}- data-guest-name-editable+ class="text-xs font-medium text-gray-900 dark:text-gray-100 select-none whitespace-nowrap"+ title={props.guest.name}>{props.guest.name}</span>@@ -862,7 +772,7 @@ export function GuestRow(props: GuestRowProps) {target="_blank"rel="noopener noreferrer"class={`flex-shrink-0 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 transition-colors ${shouldAnimateIcon() ? 'animate-fadeIn' : ''}`}- title="Open in new tab"+ title={`Open ${customUrl()}`}onClick={(event) => event.stopPropagation()}><svg@@ -880,23 +790,39 @@ export function GuestRow(props: GuestRowProps) {</svg></a></Show>+ {/* Edit URL button - shows on hover */}+ <button+ type="button"+ onClick={startEditingUrl}+ class="flex-shrink-0 opacity-0 group-hover/name:opacity-100 text-gray-400 hover:text-blue-500 dark:hover:text-blue-400 transition-all"+ title={customUrl() ? 'Edit URL' : 'Add URL'}+ >+ <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="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>{/* Show backup indicator in name cell only if backup column is hidden */}<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>}>+ {/* URL editing mode */}<div class="flex items-center gap-1 min-w-0" data-url-editor><inputref={urlInputRef}type="text"value={editingUrlValue()}- data-guest-id={guestId()}- onInput={(e) => {- editingValues.set(guestId(), e.currentTarget.value);- setEditingValuesVersion(v => v + 1);- }}+ onInput={(e) => setEditingUrlValue(e.currentTarget.value)}onKeyDown={(e) => {if (e.key === 'Enter') {e.preventDefault();@@ -907,30 +833,31 @@ export function GuestRow(props: GuestRowProps) {}}}onClick={(e) => e.stopPropagation()}- placeholder="https://192.168.1.100:8006"- class="min-w-0 px-2 py-0.5 text-sm border border-blue-500 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"+ placeholder="https://192.168.1.100:8080"+ class="w-40 px-2 py-0.5 text-xs border border-blue-500 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-1 focus:ring-blue-500"+ disabled={isSavingUrl()}/><buttontype="button"- data-url-editor-buttononClick={(e) => {e.stopPropagation();saveUrl();}}- class="flex-shrink-0 w-6 h-6 flex items-center justify-center text-xs bg-blue-600 text-white rounded hover:bg-blue-700 transition-colors"- title="Save (or press Enter)"+ disabled={isSavingUrl()}+ class="flex-shrink-0 w-5 h-5 flex items-center justify-center text-xs bg-blue-600 text-white rounded hover:bg-blue-700 transition-colors disabled:opacity-50"+ title="Save (Enter)">✓</button><buttontype="button"- data-url-editor-buttononClick={(e) => {e.stopPropagation();- deleteUrl();+ cancelEditingUrl();}}- class="flex-shrink-0 w-6 h-6 flex items-center justify-center text-xs bg-red-600 text-white rounded hover:bg-red-700 transition-colors"- title="Delete URL"+ disabled={isSavingUrl()}+ class="flex-shrink-0 w-5 h-5 flex items-center justify-center text-xs bg-gray-500 text-white rounded hover:bg-gray-600 transition-colors disabled:opacity-50"+ title="Cancel (Esc)">✕</button>@@ -1039,6 +966,7 @@ export function GuestRow(props: GuestRowProps) {balloon={props.guest.memory?.balloon || 0}swapUsed={props.guest.memory?.swapUsed || 0}swapTotal={props.guest.memory?.swapTotal || 0}+ resourceId={metricsKey()}/>}>diff --git a/frontend-modern/src/components/Dashboard/StackedMemoryBar.tsx b/frontend-modern/src/components/Dashboard/StackedMemoryBar.tsxindex 869885cd80..788a556e36 100644--- a/frontend-modern/src/components/Dashboard/StackedMemoryBar.tsx+++ b/frontend-modern/src/components/Dashboard/StackedMemoryBar.tsx@@ -1,6 +1,9 @@import { Show, For, createMemo, createSignal, onMount, onCleanup } from 'solid-js';import { Portal } from 'solid-js/web';import { formatBytes, formatPercent } from '@/utils/format';+import { Sparkline } from '@/components/shared/Sparkline';+import { useMetricsViewMode } from '@/stores/metricsViewMode';+import { getMetricHistoryForRange, getMetricsVersion } from '@/stores/metricsHistory';interface StackedMemoryBarProps {used: number;@@ -8,6 +11,7 @@ interface StackedMemoryBarProps {swapUsed?: number;swapTotal?: number;balloon?: number;+ resourceId?: string; // Required for sparkline mode to fetch history}// Colors for memory segments@@ -18,6 +22,17 @@ const MEMORY_COLORS = {};export function StackedMemoryBar(props: StackedMemoryBarProps) {+ const { viewMode, timeRange } = useMetricsViewMode();++ // Get metric history for sparkline+ // Depends on metricsVersion to re-fetch when data is seeded (e.g., on time range change)+ const metricHistory = createMemo(() => {+ // Subscribe to version changes so we re-read when new data is seeded+ getMetricsVersion();+ if (viewMode() !== 'sparklines' || !props.resourceId) return [];+ return getMetricHistoryForRange(props.resourceId, timeRange());+ });+const [containerWidth, setContainerWidth] = createSignal(100);const [showTooltip, setShowTooltip] = createSignal(false);const [tooltipPos, setTooltipPos] = createSignal({ x: 0, y: 0 });@@ -121,115 +136,129 @@ export function StackedMemoryBar(props: StackedMemoryBarProps) {};return (- <div ref={containerRef} class="metric-text w-full h-4 flex items-center justify-center">- <div- class="relative w-full h-full overflow-hidden bg-gray-200 dark:bg-gray-600 rounded cursor-help"- onMouseEnter={handleMouseEnter}- onMouseLeave={handleMouseLeave}- >- {/* Stacked segments - use absolute positioning like MetricBar for correct width scaling */}- <For each={segments()}>- {(segment, idx) => {- // Calculate left offset as sum of previous segments- const leftOffset = () => {- let offset = 0;- const segs = segments();- for (let i = 0; i < idx(); i++) {- offset += segs[i].percent;- }- return offset;- };- return (- <div- class="absolute top-0 h-full transition-all duration-300"- style={{- left: `${leftOffset()}%`,- width: `${segment.percent}%`,- 'background-color': segment.color,- 'border-right': idx() < segments().length - 1 ? '1px solid rgba(255,255,255,0.3)' : 'none',- }}- />- );- }}- </For>-- {/* Swap Indicator (Thin line at bottom if swap is used) */}- {/* Swap Indicator (Thin line at bottom if swap is used) */}- <Show when={hasSwap() && (props.swapUsed || 0) > 0}>- <div- class="absolute bottom-0 left-0 h-[3px] w-full bg-purple-500"- style={{ width: `${Math.min(swapPercent(), 100)}%` }}- />- </Show>-- {/* Label overlay */}- <span class="absolute inset-0 flex items-center justify-center text-[10px] font-semibold text-gray-700 dark:text-gray-100 leading-none pointer-events-none">- <span class="flex items-center gap-1 whitespace-nowrap px-0.5">- <span>{displayLabel()}</span>- <Show when={showSublabel()}>- <span class="metric-sublabel font-normal text-gray-500 dark:text-gray-300">- ({displaySublabel()})- </span>- </Show>- </span>- </span>- </div>-- {/* Tooltip */}- <Show when={showTooltip()}>- <Portal mount={document.body}>+ <Show+ when={viewMode() === 'sparklines' && props.resourceId}+ fallback={+ <div ref={containerRef} class="metric-text w-full h-4 flex items-center justify-center"><div- class="fixed z-[9999] pointer-events-none"- style={{- left: `${tooltipPos().x}px`,- top: `${tooltipPos().y - 8}px`,- transform: 'translate(-50%, -100%)',- }}+ class="relative w-full h-full overflow-hidden bg-gray-200 dark:bg-gray-600 rounded cursor-help"+ onMouseEnter={handleMouseEnter}+ onMouseLeave={handleMouseLeave}>- <div class="bg-gray-900 dark:bg-gray-800 text-white text-[10px] rounded-md shadow-lg px-2 py-1.5 min-w-[140px] border border-gray-700">- <div class="font-medium mb-1 text-gray-300 border-b border-gray-700 pb-1">- Memory Composition- </div>+ {/* Stacked segments - use absolute positioning like MetricBar for correct width scaling */}+ <For each={segments()}>+ {(segment, idx) => {+ // Calculate left offset as sum of previous segments+ const leftOffset = () => {+ let offset = 0;+ const segs = segments();+ for (let i = 0; i < idx(); i++) {+ offset += segs[i].percent;+ }+ return offset;+ };+ return (+ <div+ class="absolute top-0 h-full transition-all duration-300"+ style={{+ left: `${leftOffset()}%`,+ width: `${segment.percent}%`,+ 'background-color': segment.color,+ 'border-right': idx() < segments().length - 1 ? '1px solid rgba(255,255,255,0.3)' : 'none',+ }}+ />+ );+ }}+ </For>- {/* RAM Breakdown */}- <div class="flex justify-between gap-3 py-0.5">- <span class="text-green-400">Used</span>- <span class="whitespace-nowrap text-gray-300">- {formatBytes(props.used, 0)}- </span>- </div>+ {/* Swap Indicator (Thin line at bottom if swap is used) */}+ <Show when={hasSwap() && (props.swapUsed || 0) > 0}>+ <div+ class="absolute bottom-0 left-0 h-[3px] w-full bg-purple-500"+ style={{ width: `${Math.min(swapPercent(), 100)}%` }}+ />+ </Show>- <Show when={(props.balloon || 0) > 0 && (props.balloon || 0) < props.total}>- <div class="flex justify-between gap-3 py-0.5 border-t border-gray-700/50">- <span class="text-yellow-400">Balloon Limit</span>- <span class="whitespace-nowrap text-gray-300">- {formatBytes(props.balloon || 0, 0)}+ {/* Label overlay */}+ <span class="absolute inset-0 flex items-center justify-center text-[10px] font-semibold text-gray-700 dark:text-gray-100 leading-none pointer-events-none">+ <span class="flex items-center gap-1 whitespace-nowrap px-0.5">+ <span>{displayLabel()}</span>+ <Show when={showSublabel()}>+ <span class="metric-sublabel font-normal text-gray-500 dark:text-gray-300">+ ({displaySublabel()})</span>- </div>- </Show>+ </Show>+ </span>+ </span>+ </div>- <div class="flex justify-between gap-3 py-0.5 border-t border-gray-700/50">- <span class="text-gray-400">Free</span>- <span class="whitespace-nowrap text-gray-300">- {formatBytes(props.total - props.used, 0)}- </span>- </div>+ {/* Tooltip */}+ <Show when={showTooltip()}>+ <Portal mount={document.body}>+ <div+ class="fixed z-[9999] pointer-events-none"+ style={{+ left: `${tooltipPos().x}px`,+ top: `${tooltipPos().y - 8}px`,+ transform: 'translate(-50%, -100%)',+ }}+ >+ <div class="bg-gray-900 dark:bg-gray-800 text-white text-[10px] rounded-md shadow-lg px-2 py-1.5 min-w-[140px] border border-gray-700">+ <div class="font-medium mb-1 text-gray-300 border-b border-gray-700 pb-1">+ Memory Composition+ </div>- {/* Swap Section */}- <Show when={hasSwap()}>- <div class="mt-1 pt-1 border-t border-gray-600">+ {/* RAM Breakdown */}<div class="flex justify-between gap-3 py-0.5">- <span class="text-purple-400">Swap</span>+ <span class="text-green-400">Used</span>+ <span class="whitespace-nowrap text-gray-300">+ {formatBytes(props.used, 0)}+ </span>+ </div>++ <Show when={(props.balloon || 0) > 0 && (props.balloon || 0) < props.total}>+ <div class="flex justify-between gap-3 py-0.5 border-t border-gray-700/50">+ <span class="text-yellow-400">Balloon Limit</span>+ <span class="whitespace-nowrap text-gray-300">+ {formatBytes(props.balloon || 0, 0)}+ </span>+ </div>+ </Show>++ <div class="flex justify-between gap-3 py-0.5 border-t border-gray-700/50">+ <span class="text-gray-400">Free</span><span class="whitespace-nowrap text-gray-300">- {formatBytes(props.swapUsed || 0, 0)} / {formatBytes(props.swapTotal || 0, 0)}+ {formatBytes(props.total - props.used, 0)}</span></div>++ {/* Swap Section */}+ <Show when={hasSwap()}>+ <div class="mt-1 pt-1 border-t border-gray-600">+ <div class="flex justify-between gap-3 py-0.5">+ <span class="text-purple-400">Swap</span>+ <span class="whitespace-nowrap text-gray-300">+ {formatBytes(props.swapUsed || 0, 0)} / {formatBytes(props.swapTotal || 0, 0)}+ </span>+ </div>+ </div>+ </Show></div>- </Show>- </div>- </div>- </Portal>- </Show>- </div>+ </div>+ </Portal>+ </Show>+ </div>+ }+ >+ {/* Sparkline mode - full width, flex centered like stacked bars */}+ <div class="metric-text w-full h-4 flex items-center justify-center">+ <Sparkline+ data={metricHistory()}+ metric="memory"+ width={0}+ height={16}+ />+ </div>+ </Show>);}diff --git a/frontend-modern/src/components/Docker/DockerUnifiedTable.tsx b/frontend-modern/src/components/Docker/DockerUnifiedTable.tsxindex 86f5540ff3..5f2dc24f9b 100644--- a/frontend-modern/src/components/Docker/DockerUnifiedTable.tsx+++ b/frontend-modern/src/components/Docker/DockerUnifiedTable.tsx@@ -794,6 +794,8 @@ const DockerContainerRow: Component<{// Annotations and AI stateconst [aiEnabled, setAiEnabled] = createSignal(false);+ // Check if this container is in AI context+ const isInAIContext = createMemo(() => aiChatStore.enabled && aiChatStore.hasContextItem(resourceId()));const [annotations, setAnnotations] = createSignal<string[]>([]);const [newAnnotation, setNewAnnotation] = createSignal('');const [saving, setSaving] = createSignal(false);@@ -968,10 +970,28 @@ const DockerContainerRow: Component<{});const toggle = (event: MouseEvent) => {- if (!hasDrawerContent()) return;const target = event.target as HTMLElement;if (target.closest('a, button, input, [data-prevent-toggle]')) return;- // Toggle: if this row is currently expanded, close it; otherwise open it (closing any other)++ // 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+ if (!hasDrawerContent()) return;setCurrentlyExpandedRowId(prev => prev === rowId ? null : rowId);};@@ -1220,6 +1240,14 @@ 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>}>@@ -1303,6 +1331,7 @@ const DockerContainerRow: Component<{balloon={0}swapUsed={0}swapTotal={0}+ resourceId={metricsKey}/></div></div>@@ -1354,7 +1383,7 @@ const DockerContainerRow: Component<{return (<><tr- 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' : ''}`}+ 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' : ''}`}onClick={toggle}aria-expanded={expanded()}>@@ -1384,399 +1413,399 @@ const DockerContainerRow: Component<{<div class="text-[11px] font-medium uppercase tracking-wide text-gray-700 dark:text-gray-200">Summary</div>- <div class="mt-2 space-y-1 text-[11px] text-gray-600 dark:text-gray-300">- <div class="flex items-center justify-between gap-2">- <span class="font-medium text-gray-700 dark:text-gray-200">Runtime</span>- <span- class={`inline-flex items-center gap-2 rounded-full px-2 py-0.5 text-[10px] font-semibold ${runtimeInfo.badgeClass}`}- title={runtimeInfo.raw || runtimeInfo.label}- >- {runtimeInfo.label}- <Show when={runtimeVersion()}>- {(version) => (- <span class="text-[10px] text-gray-500 dark:text-gray-400">{version()}</span>- )}- </Show>- </span>- </div>- <div class="flex items-start justify-between gap-2">- <span class="font-medium text-gray-700 dark:text-gray-200">Image</span>- <span class="flex-1 truncate text-right text-gray-600 dark:text-gray-300" title={container.image}>- {container.image || '—'}- </span>- </div>- <Show when={podName()}>- {(name) => (+ <div class="mt-2 space-y-1 text-[11px] text-gray-600 dark:text-gray-300"><div class="flex items-center justify-between gap-2">- <span class="font-medium text-gray-700 dark:text-gray-200">Pod</span>- <span class="text-right text-gray-600 dark:text-gray-300">- {name()}- <Show when={isPodInfra()}>- <span class="ml-2 rounded bg-purple-100 px-1.5 py-0.5 text-[10px] font-semibold text-purple-700 dark:bg-purple-900/40 dark:text-purple-200">- infra- </span>+ <span class="font-medium text-gray-700 dark:text-gray-200">Runtime</span>+ <span+ class={`inline-flex items-center gap-2 rounded-full px-2 py-0.5 text-[10px] font-semibold ${runtimeInfo.badgeClass}`}+ title={runtimeInfo.raw || runtimeInfo.label}+ >+ {runtimeInfo.label}+ <Show when={runtimeVersion()}>+ {(version) => (+ <span class="text-[10px] text-gray-500 dark:text-gray-400">{version()}</span>+ )}</Show></span></div>- )}- </Show>- <Show when={podmanMetadata()?.composeProject}>- {(project) => (- <div class="flex items-center justify-between gap-2">- <span class="font-medium text-gray-700 dark:text-gray-200">Compose Project</span>- <span class="text-right text-gray-600 dark:text-gray-300">{project()}</span>+ <div class="flex items-start justify-between gap-2">+ <span class="font-medium text-gray-700 dark:text-gray-200">Image</span>+ <span class="flex-1 truncate text-right text-gray-600 dark:text-gray-300" title={container.image}>+ {container.image || '—'}+ </span></div>- )}- </Show>- <Show when={podmanMetadata()?.composeService}>- {(service) => (+ <Show when={podName()}>+ {(name) => (+ <div class="flex items-center justify-between gap-2">+ <span class="font-medium text-gray-700 dark:text-gray-200">Pod</span>+ <span class="text-right text-gray-600 dark:text-gray-300">+ {name()}+ <Show when={isPodInfra()}>+ <span class="ml-2 rounded bg-purple-100 px-1.5 py-0.5 text-[10px] font-semibold text-purple-700 dark:bg-purple-900/40 dark:text-purple-200">+ infra+ </span>+ </Show>+ </span>+ </div>+ )}+ </Show>+ <Show when={podmanMetadata()?.composeProject}>+ {(project) => (+ <div class="flex items-center justify-between gap-2">+ <span class="font-medium text-gray-700 dark:text-gray-200">Compose Project</span>+ <span class="text-right text-gray-600 dark:text-gray-300">{project()}</span>+ </div>+ )}+ </Show>+ <Show when={podmanMetadata()?.composeService}>+ {(service) => (+ <div class="flex items-center justify-between gap-2">+ <span class="font-medium text-gray-700 dark:text-gray-200">Compose Service</span>+ <span class="text-right text-gray-600 dark:text-gray-300">{service()}</span>+ </div>+ )}+ </Show>+ <Show when={podmanMetadata()?.autoUpdatePolicy}>+ {(policy) => (+ <div class="flex items-center justify-between gap-2">+ <span class="font-medium text-gray-700 dark:text-gray-200">Auto Update</span>+ <span class="text-right text-gray-600 dark:text-gray-300">+ {policy()}+ <Show when={podmanMetadata()?.autoUpdateRestart}>+ {(restart) => (+ <span class="ml-2 text-[10px] text-gray-500 dark:text-gray-400">restart: {restart()}</span>+ )}+ </Show>+ </span>+ </div>+ )}+ </Show>+ <Show when={podmanMetadata()?.userNamespace}>+ {(userns) => (+ <div class="flex items-center justify-between gap-2">+ <span class="font-medium text-gray-700 dark:text-gray-200">User Namespace</span>+ <span class="text-right text-gray-600 dark:text-gray-300">{userns()}</span>+ </div>+ )}+ </Show><div class="flex items-center justify-between gap-2">- <span class="font-medium text-gray-700 dark:text-gray-200">Compose Service</span>- <span class="text-right text-gray-600 dark:text-gray-300">{service()}</span>+ <span class="font-medium text-gray-700 dark:text-gray-200">State</span>+ <span class="text-right text-gray-600 dark:text-gray-300">{statusLabel()}</span></div>- )}- </Show>- <Show when={podmanMetadata()?.autoUpdatePolicy}>- {(policy) => (<div class="flex items-center justify-between gap-2">- <span class="font-medium text-gray-700 dark:text-gray-200">Auto Update</span>- <span class="text-right text-gray-600 dark:text-gray-300">- {policy()}- <Show when={podmanMetadata()?.autoUpdateRestart}>- {(restart) => (- <span class="ml-2 text-[10px] text-gray-500 dark:text-gray-400">restart: {restart()}</span>- )}- </Show>- </span>+ <span class="font-medium text-gray-700 dark:text-gray-200">Restarts</span>+ <span class="text-right text-gray-600 dark:text-gray-300">{restarts()}</span></div>- )}- </Show>- <Show when={podmanMetadata()?.userNamespace}>- {(userns) => (+ <Show when={createdRelative()}>+ {(created) => (+ <div class="flex flex-col gap-0.5">+ <span class="font-medium text-gray-700 dark:text-gray-200">Created</span>+ <div class="text-right text-gray-600 dark:text-gray-300">+ {created()}+ <Show when={createdAbsolute()}>+ {(abs) => (+ <div class="text-[10px] text-gray-500 dark:text-gray-400">{abs()}</div>+ )}+ </Show>+ </div>+ </div>+ )}+ </Show>+ <Show when={startedRelative()}>+ {(started) => (+ <div class="flex flex-col gap-0.5">+ <span class="font-medium text-gray-700 dark:text-gray-200">Started</span>+ <div class="text-right text-gray-600 dark:text-gray-300">+ {started()}+ <Show when={startedAbsolute()}>+ {(abs) => (+ <div class="text-[10px] text-gray-500 dark:text-gray-400">{abs()}</div>+ )}+ </Show>+ </div>+ </div>+ )}+ </Show><div class="flex items-center justify-between gap-2">- <span class="font-medium text-gray-700 dark:text-gray-200">User Namespace</span>- <span class="text-right text-gray-600 dark:text-gray-300">{userns()}</span>- </div>- )}- </Show>- <div class="flex items-center justify-between gap-2">- <span class="font-medium text-gray-700 dark:text-gray-200">State</span>- <span class="text-right text-gray-600 dark:text-gray-300">{statusLabel()}</span>- </div>- <div class="flex items-center justify-between gap-2">- <span class="font-medium text-gray-700 dark:text-gray-200">Restarts</span>- <span class="text-right text-gray-600 dark:text-gray-300">{restarts()}</span>- </div>- <Show when={createdRelative()}>- {(created) => (- <div class="flex flex-col gap-0.5">- <span class="font-medium text-gray-700 dark:text-gray-200">Created</span>- <div class="text-right text-gray-600 dark:text-gray-300">- {created()}- <Show when={createdAbsolute()}>- {(abs) => (- <div class="text-[10px] text-gray-500 dark:text-gray-400">{abs()}</div>- )}- </Show>- </div>+ <span class="font-medium text-gray-700 dark:text-gray-200">Uptime</span>+ <span class="text-right text-gray-600 dark:text-gray-300">{uptime()}</span></div>- )}- </Show>- <Show when={startedRelative()}>- {(started) => (- <div class="flex flex-col gap-0.5">- <span class="font-medium text-gray-700 dark:text-gray-200">Started</span>- <div class="text-right text-gray-600 dark:text-gray-300">- {started()}- <Show when={startedAbsolute()}>- {(abs) => (- <div class="text-[10px] text-gray-500 dark:text-gray-400">{abs()}</div>- )}- </Show>- </div>+ </div>+ <Show when={runtimeInfo.id === 'podman'}>+ <div class="mt-3 rounded border border-dashed border-purple-200 px-2 py-1 text-[10px] text-purple-700 dark:border-purple-700/60 dark:text-purple-200">+ Podman hosts report container metrics, but Swarm services and tasks are unavailable. Runtime annotations and compose metadata appear below when present.</div>- )}- </Show>- <div class="flex items-center justify-between gap-2">- <span class="font-medium text-gray-700 dark:text-gray-200">Uptime</span>- <span class="text-right text-gray-600 dark:text-gray-300">{uptime()}</span>- </div>- </div>- <Show when={runtimeInfo.id === 'podman'}>- <div class="mt-3 rounded border border-dashed border-purple-200 px-2 py-1 text-[10px] text-purple-700 dark:border-purple-700/60 dark:text-purple-200">- Podman hosts report container metrics, but Swarm services and tasks are unavailable. Runtime annotations and compose metadata appear below when present.- </div>- </Show>- </div>- <Show when={container.ports && container.ports.length > 0}>- <div class="rounded border border-gray-200 bg-white/70 p-3 shadow-sm dark:border-gray-600/70 dark:bg-gray-900/30">- <div class="text-[11px] font-medium uppercase tracking-wide text-gray-700 dark:text-gray-200">- Ports- </div>- <div class="mt-1 flex flex-wrap gap-1 text-[11px] text-gray-600 dark:text-gray-300">- {container.ports!.map((port) => {- const label = port.publicPort- ? `${port.publicPort}:${port.privatePort}/${port.protocol}`- : `${port.privatePort}/${port.protocol}`;- return (- <span class="rounded bg-blue-100 px-1.5 py-0.5 text-blue-700 dark:bg-blue-900/40 dark:text-blue-200">- {label}- </span>- );- })}- </div>- </div>- </Show>-- <Show when={container.networks && container.networks.length > 0}>- <div class="rounded border border-gray-200 bg-white/70 p-3 shadow-sm dark:border-gray-600/70 dark:bg-gray-900/30">- <div class="text-[11px] font-medium uppercase tracking-wide text-gray-700 dark:text-gray-200">- Networks+ </Show></div>- <div class="mt-1 space-y-1 text-[11px] text-gray-600 dark:text-gray-300">- {container.networks!.map((network) => (- <div class="rounded border border-dashed border-gray-200 p-2 last:mb-0 dark:border-gray-700/70">- <div class="font-medium text-gray-700 dark:text-gray-200">{network.name}</div>- <div class="mt-0.5 flex flex-wrap gap-1 text-[10px] text-gray-500 dark:text-gray-400">- <Show when={network.ipv4}>+ <Show when={container.ports && container.ports.length > 0}>+ <div class="rounded border border-gray-200 bg-white/70 p-3 shadow-sm dark:border-gray-600/70 dark:bg-gray-900/30">+ <div class="text-[11px] font-medium uppercase tracking-wide text-gray-700 dark:text-gray-200">+ Ports+ </div>+ <div class="mt-1 flex flex-wrap gap-1 text-[11px] text-gray-600 dark:text-gray-300">+ {container.ports!.map((port) => {+ const label = port.publicPort+ ? `${port.publicPort}:${port.privatePort}/${port.protocol}`+ : `${port.privatePort}/${port.protocol}`;+ return (<span class="rounded bg-blue-100 px-1.5 py-0.5 text-blue-700 dark:bg-blue-900/40 dark:text-blue-200">- {network.ipv4}- </span>- </Show>- <Show when={network.ipv6}>- <span class="rounded bg-purple-100 px-1.5 py-0.5 text-purple-700 dark:bg-purple-900/40 dark:text-purple-200">- {network.ipv6}+ {label}</span>- </Show>- </div>- </div>- ))}- </div>- </div>- </Show>-- <Show when={hasPodmanMetadata()}>- <div class="rounded border border-purple-200 bg-white/70 p-3 shadow-sm dark:border-purple-700/60 dark:bg-purple-950/20">- <div class="text-[11px] font-medium uppercase tracking-wide text-purple-700 dark:text-purple-200">- Podman Metadata- </div>- <div class="mt-1 space-y-2 text-[11px] text-gray-600 dark:text-gray-300">- <For each={podmanMetadataSections()}>- {(section) => (- <div class="space-y-1 border-b border-purple-100 pb-1 last:border-b-0 last:pb-0 dark:border-purple-800/30">- <div class="text-[10px] font-semibold uppercase tracking-wide text-purple-600 dark:text-purple-300">- {section.title}- </div>- <div class="space-y-1">- <For each={section.items}>- {(item) => (- <div class="flex items-start justify-between gap-2">- <span class="font-medium text-gray-700 dark:text-gray-200">{item.label}</span>- <span- class="max-w-[220px] break-all text-right text-gray-600 dark:text-gray-300"- title={item.value || '—'}- >- {item.value || '—'}- </span>- </div>- )}- </For>- </div>- </div>- )}- </For>- </div>- </div>- </Show>-- <Show when={hasBlockIo()}>- <div class="rounded border border-gray-200 bg-white/70 p-3 shadow-sm dark:border-gray-600/70 dark:bg-gray-900/30">- <div class="text-[11px] font-medium uppercase tracking-wide text-gray-700 dark:text-gray-200">- Block I/O- </div>- <div class="mt-1 space-y-1 text-[11px] text-gray-600 dark:text-gray-300">- <div class="flex items-center justify-between">- <span>Read</span>- <div class="text-right">- <div class="font-semibold text-gray-900 dark:text-gray-100">- {formatBytes(blockIoReadBytes())}- </div>- <Show when={blockIoReadRateLabel()}>- <div class="text-[10px] text-gray-500 dark:text-gray-400">- {blockIoReadRateLabel()}- </div>- </Show>- </div>- </div>- <div class="flex items-center justify-between">- <span>Write</span>- <div class="text-right">- <div class="font-semibold text-gray-900 dark:text-gray-100">- {formatBytes(blockIoWriteBytes())}- </div>- <Show when={blockIoWriteRateLabel()}>- <div class="text-[10px] text-gray-500 dark:text-gray-400">- {blockIoWriteRateLabel()}- </div>- </Show>+ );+ })}</div></div>- </div>- </div>- </Show>+ </Show>- <Show when={hasMounts()}>- <div class="rounded border border-gray-200 bg-white/70 p-3 shadow-sm dark:border-gray-600/70 dark:bg-gray-900/30">- <div class="text-[11px] font-medium uppercase tracking-wide text-gray-700 dark:text-gray-200">- Mounts- </div>- <div class="mt-1 space-y-1 text-[11px] text-gray-600 dark:text-gray-300">- <For each={mounts()}>- {(mount) => {- const destination = mount.destination || mount.source || mount.name || 'mount';- const rw = mount.rw === false ? 'read-only' : 'read-write';- return (+ <Show when={container.networks && container.networks.length > 0}>+ <div class="rounded border border-gray-200 bg-white/70 p-3 shadow-sm dark:border-gray-600/70 dark:bg-gray-900/30">+ <div class="text-[11px] font-medium uppercase tracking-wide text-gray-700 dark:text-gray-200">+ Networks+ </div>+ <div class="mt-1 space-y-1 text-[11px] text-gray-600 dark:text-gray-300">+ {container.networks!.map((network) => (<div class="rounded border border-dashed border-gray-200 p-2 last:mb-0 dark:border-gray-700/70">- <div class="flex items-center justify-between gap-2">- <span class="truncate font-medium text-gray-700 dark:text-gray-200" title={destination}>- {destination}- </span>- <Show when={mount.type}>- <span class="text-[10px] uppercase tracking-wide text-gray-500 dark:text-gray-400">- {mount.type}- </span>- </Show>- </div>- <Show when={mount.source}>- <div class="mt-1 truncate text-[11px] text-gray-600 dark:text-gray-300" title={mount.source}>- {mount.source}- </div>- </Show>- <div class="mt-1 flex flex-wrap gap-1 text-[10px] text-gray-500 dark:text-gray-400">- <span- class={`rounded px-1.5 py-0.5 ${mount.rw === false- ? 'bg-gray-200 text-gray-700 dark:bg-gray-700/60 dark:text-gray-200'- : 'bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300'- }`}- >- {rw}- </span>- <Show when={mount.mode}>- <span class="rounded bg-gray-200 px-1.5 py-0.5 text-gray-700 dark:bg-gray-700/60 dark:text-gray-200">- mode: {mount.mode}- </span>- </Show>- <Show when={mount.driver}>+ <div class="font-medium text-gray-700 dark:text-gray-200">{network.name}</div>+ <div class="mt-0.5 flex flex-wrap gap-1 text-[10px] text-gray-500 dark:text-gray-400">+ <Show when={network.ipv4}><span class="rounded bg-blue-100 px-1.5 py-0.5 text-blue-700 dark:bg-blue-900/40 dark:text-blue-200">- {mount.driver}+ {network.ipv4}</span></Show>- <Show when={mount.name}>+ <Show when={network.ipv6}><span class="rounded bg-purple-100 px-1.5 py-0.5 text-purple-700 dark:bg-purple-900/40 dark:text-purple-200">- {mount.name}- </span>- </Show>- <Show when={mount.propagation}>- <span class="rounded bg-gray-100 px-1.5 py-0.5 text-gray-600 dark:bg-gray-800/40 dark:text-gray-300">- {mount.propagation}+ {network.ipv6}</span></Show></div></div>- );- }}- </For>- </div>- </div>- </Show>+ ))}+ </div>+ </div>+ </Show>- <Show when={container.labels && Object.keys(container.labels).length > 0}>- <div class="rounded border border-gray-200 bg-white/70 p-3 shadow-sm dark:border-gray-600/70 dark:bg-gray-900/30">- <div class="text-[11px] font-medium uppercase tracking-wide text-gray-700 dark:text-gray-200">- Labels- </div>- <div class="mt-1 flex flex-wrap gap-1 text-[11px] text-gray-600 dark:text-gray-300">- {Object.entries(container.labels!).map(([key, value]) => {- const fullLabel = value ? `${key}: ${value}` : key;- return (- <span- class="max-w-full truncate rounded bg-gray-200 px-1.5 py-0.5 text-gray-700 dark:bg-gray-700/60 dark:text-gray-200"- title={fullLabel}- >- {key}- <Show when={value}>: {value}</Show>- </span>- );- })}- </div>- </div>+ <Show when={hasPodmanMetadata()}>+ <div class="rounded border border-purple-200 bg-white/70 p-3 shadow-sm dark:border-purple-700/60 dark:bg-purple-950/20">+ <div class="text-[11px] font-medium uppercase tracking-wide text-purple-700 dark:text-purple-200">+ Podman Metadata+ </div>+ <div class="mt-1 space-y-2 text-[11px] text-gray-600 dark:text-gray-300">+ <For each={podmanMetadataSections()}>+ {(section) => (+ <div class="space-y-1 border-b border-purple-100 pb-1 last:border-b-0 last:pb-0 dark:border-purple-800/30">+ <div class="text-[10px] font-semibold uppercase tracking-wide text-purple-600 dark:text-purple-300">+ {section.title}+ </div>+ <div class="space-y-1">+ <For each={section.items}>+ {(item) => (+ <div class="flex items-start justify-between gap-2">+ <span class="font-medium text-gray-700 dark:text-gray-200">{item.label}</span>+ <span+ class="max-w-[220px] break-all text-right text-gray-600 dark:text-gray-300"+ title={item.value || '—'}+ >+ {item.value || '—'}+ </span>+ </div>+ )}+ </For>+ </div>+ </div>+ )}+ </For>+ </div>+ </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>+ <Show when={hasBlockIo()}>+ <div class="rounded border border-gray-200 bg-white/70 p-3 shadow-sm dark:border-gray-600/70 dark:bg-gray-900/30">+ <div class="text-[11px] font-medium uppercase tracking-wide text-gray-700 dark:text-gray-200">+ Block I/O+ </div>+ <div class="mt-1 space-y-1 text-[11px] text-gray-600 dark:text-gray-300">+ <div class="flex items-center justify-between">+ <span>Read</span>+ <div class="text-right">+ <div class="font-semibold text-gray-900 dark:text-gray-100">+ {formatBytes(blockIoReadBytes())}+ </div>+ <Show when={blockIoReadRateLabel()}>+ <div class="text-[10px] text-gray-500 dark:text-gray-400">+ {blockIoReadRateLabel()}+ </div>+ </Show>+ </div>+ </div>+ <div class="flex items-center justify-between">+ <span>Write</span>+ <div class="text-right">+ <div class="font-semibold text-gray-900 dark:text-gray-100">+ {formatBytes(blockIoWriteBytes())}+ </div>+ <Show when={blockIoWriteRateLabel()}>+ <div class="text-[10px] text-gray-500 dark:text-gray-400">+ {blockIoWriteRateLabel()}+ </div>+ </Show>+ </div>+ </div>+ </div></div>+ </Show>- {/* 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>- )}+ <Show when={hasMounts()}>+ <div class="rounded border border-gray-200 bg-white/70 p-3 shadow-sm dark:border-gray-600/70 dark:bg-gray-900/30">+ <div class="text-[11px] font-medium uppercase tracking-wide text-gray-700 dark:text-gray-200">+ Mounts+ </div>+ <div class="mt-1 space-y-1 text-[11px] text-gray-600 dark:text-gray-300">+ <For each={mounts()}>+ {(mount) => {+ const destination = mount.destination || mount.source || mount.name || 'mount';+ const rw = mount.rw === false ? 'read-only' : 'read-write';+ return (+ <div class="rounded border border-dashed border-gray-200 p-2 last:mb-0 dark:border-gray-700/70">+ <div class="flex items-center justify-between gap-2">+ <span class="truncate font-medium text-gray-700 dark:text-gray-200" title={destination}>+ {destination}+ </span>+ <Show when={mount.type}>+ <span class="text-[10px] uppercase tracking-wide text-gray-500 dark:text-gray-400">+ {mount.type}+ </span>+ </Show>+ </div>+ <Show when={mount.source}>+ <div class="mt-1 truncate text-[11px] text-gray-600 dark:text-gray-300" title={mount.source}>+ {mount.source}+ </div>+ </Show>+ <div class="mt-1 flex flex-wrap gap-1 text-[10px] text-gray-500 dark:text-gray-400">+ <span+ class={`rounded px-1.5 py-0.5 ${mount.rw === false+ ? 'bg-gray-200 text-gray-700 dark:bg-gray-700/60 dark:text-gray-200'+ : 'bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300'+ }`}+ >+ {rw}+ </span>+ <Show when={mount.mode}>+ <span class="rounded bg-gray-200 px-1.5 py-0.5 text-gray-700 dark:bg-gray-700/60 dark:text-gray-200">+ mode: {mount.mode}+ </span>+ </Show>+ <Show when={mount.driver}>+ <span class="rounded bg-blue-100 px-1.5 py-0.5 text-blue-700 dark:bg-blue-900/40 dark:text-blue-200">+ {mount.driver}+ </span>+ </Show>+ <Show when={mount.name}>+ <span class="rounded bg-purple-100 px-1.5 py-0.5 text-purple-700 dark:bg-purple-900/40 dark:text-purple-200">+ {mount.name}+ </span>+ </Show>+ <Show when={mount.propagation}>+ <span class="rounded bg-gray-100 px-1.5 py-0.5 text-gray-600 dark:bg-gray-800/40 dark:text-gray-300">+ {mount.propagation}+ </span>+ </Show>+ </div>+ </div>+ );+ }}</For></div>- </Show>+ </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>+ <Show when={container.labels && Object.keys(container.labels).length > 0}>+ <div class="rounded border border-gray-200 bg-white/70 p-3 shadow-sm dark:border-gray-600/70 dark:bg-gray-900/30">+ <div class="text-[11px] font-medium uppercase tracking-wide text-gray-700 dark:text-gray-200">+ Labels+ </div>+ <div class="mt-1 flex flex-wrap gap-1 text-[11px] text-gray-600 dark:text-gray-300">+ {Object.entries(container.labels!).map(([key, value]) => {+ const fullLabel = value ? `${key}: ${value}` : key;+ return (+ <span+ class="max-w-full truncate rounded bg-gray-200 px-1.5 py-0.5 text-gray-700 dark:bg-gray-700/60 dark:text-gray-200"+ title={fullLabel}+ >+ {key}+ <Show when={value}>: {value}</Show>+ </span>+ );+ })}+ </div></div>- </div>- </Show>+ </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>@@ -1813,6 +1842,23 @@ 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(() => {if (currentlyEditingDockerResourceId() !== resourceId()) {@@ -1838,10 +1884,28 @@ const DockerServiceRow: Component<{});const toggle = (event: MouseEvent) => {- if (!hasTasks()) return;const target = event.target as HTMLElement;if (target.closest('a, button, input, [data-prevent-toggle]')) return;- // Toggle: if this row is currently expanded, close it; otherwise open it (closing any other)++ // 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+ if (!hasTasks()) return;setCurrentlyExpandedRowId(prev => prev === rowId ? null : rowId);};@@ -2052,6 +2116,14 @@ 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>}>@@ -2130,7 +2202,7 @@ const DockerServiceRow: Component<{return (<><tr- 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' : ''}`}+ 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' : ''}`}onClick={toggle}aria-expanded={expanded()}>@@ -2165,111 +2237,111 @@ const DockerServiceRow: Component<{</div><div class="mt-2 overflow-x-auto"><table class="min-w-full divide-y divide-gray-100 dark:divide-gray-800/60 text-xs">- <thead class="bg-gray-100 dark:bg-gray-900/40 text-[10px] uppercase tracking-wide text-gray-600 dark:text-gray-200">- <tr>- <th class="py-1 pr-2 text-left font-medium">Task</th>- <th class="py-1 px-2 text-left font-medium w-[80px]">Type</th>- <th class="py-1 px-2 text-left font-medium">Node</th>- <th class="py-1 px-2 text-left font-medium">State</th>- <th class="py-1 px-2 text-left font-medium w-[120px]">CPU</th>- <th class="py-1 px-2 text-left font-medium w-[140px]">Memory</th>- <th class="py-1 px-2 text-left font-medium">Updated</th>- </tr>- </thead>- <tbody class="divide-y divide-gray-100 dark:divide-gray-800/50">- <For each={tasks}>- {(task) => {- const container = findContainerForTask(host.containers || [], task);- const cpu = container?.cpuPercent ?? 0;- const mem = container?.memoryPercent ?? 0;- const updated = ensureMs(task.updatedAt ?? task.createdAt ?? task.startedAt);- const taskLabel = () => {- if (task.containerName) return task.containerName;- if (task.containerId) return task.containerId.slice(0, 12);- if (task.slot !== undefined) return `slot-${task.slot}`;- return task.id ?? 'Task';- };- const taskTitle = () => {- const label = taskLabel();- if (task.containerId && task.containerId !== label) {- return `${label} \u2014 ${task.containerId}`;- }- if (task.id && task.id !== label) {- return `${label} \u2014 ${task.id}`;- }- return label;- };- const state = toLower(task.currentState ?? task.desiredState ?? 'unknown');- const taskMetricsKey = container?.id ? buildMetricKey('dockerContainer', container.id) : undefined;- const stateClass = () => {- if (state === 'running') {- return 'bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300';- }- if (state === 'failed' || state === 'error') {- return 'bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300';- }- return 'bg-gray-200 text-gray-600 dark:bg-gray-700 dark:text-gray-300';- };- return (- <tr class="hover:bg-gray-100 dark:hover:bg-gray-800/40">- <td class="py-1 pr-2">- <div class="flex items-center gap-1 text-sm text-gray-900 dark:text-gray-100">- <span class="truncate font-medium" title={taskTitle()}>- {taskLabel()}- </span>- </div>- </td>- <td class="py-1 px-2">- <span- class={`inline-flex items-center rounded px-2 py-0.5 text-[10px] font-medium whitespace-nowrap ${typeBadgeClass(- 'task',- )}`}- >- Task- </span>- </td>- <td class="py-1 px-2 text-gray-600 dark:text-gray-400">- {task.nodeName || task.nodeId || '—'}- </td>- <td class="py-1 px-2">- <span class={`rounded px-2 py-0.5 text-[10px] font-medium whitespace-nowrap ${stateClass()}`}>- {task.currentState || task.desiredState || 'Unknown'}- </span>- </td>- <td class="py-1 px-2 w-[120px]">- <Show when={cpu > 0} fallback={<span class="text-gray-400">—</span>}>- <MetricBar- value={Math.min(100, cpu)}- label={formatPercent(cpu)}- type="cpu"- resourceId={taskMetricsKey}- />- </Show>- </td>- <td class="py-1 px-2 w-[140px]">- <Show when={mem > 0} fallback={<span class="text-gray-400">—</span>}>- <MetricBar- value={Math.min(100, mem)}- label={formatPercent(mem)}- type="memory"- resourceId={taskMetricsKey}- />- </Show>- </td>- <td class="py-1 px-2 text-gray-600 dark:text-gray-400 whitespace-nowrap">- <Show when={updated} fallback="—">- {(timestamp) => (- <span title={new Date(timestamp()).toLocaleString(undefined, { dateStyle: 'medium', timeStyle: 'short' })}>- {formatRelativeTime(timestamp())}+ <thead class="bg-gray-100 dark:bg-gray-900/40 text-[10px] uppercase tracking-wide text-gray-600 dark:text-gray-200">+ <tr>+ <th class="py-1 pr-2 text-left font-medium">Task</th>+ <th class="py-1 px-2 text-left font-medium w-[80px]">Type</th>+ <th class="py-1 px-2 text-left font-medium">Node</th>+ <th class="py-1 px-2 text-left font-medium">State</th>+ <th class="py-1 px-2 text-left font-medium w-[120px]">CPU</th>+ <th class="py-1 px-2 text-left font-medium w-[140px]">Memory</th>+ <th class="py-1 px-2 text-left font-medium">Updated</th>+ </tr>+ </thead>+ <tbody class="divide-y divide-gray-100 dark:divide-gray-800/50">+ <For each={tasks}>+ {(task) => {+ const container = findContainerForTask(host.containers || [], task);+ const cpu = container?.cpuPercent ?? 0;+ const mem = container?.memoryPercent ?? 0;+ const updated = ensureMs(task.updatedAt ?? task.createdAt ?? task.startedAt);+ const taskLabel = () => {+ if (task.containerName) return task.containerName;+ if (task.containerId) return task.containerId.slice(0, 12);+ if (task.slot !== undefined) return `slot-${task.slot}`;+ return task.id ?? 'Task';+ };+ const taskTitle = () => {+ const label = taskLabel();+ if (task.containerId && task.containerId !== label) {+ return `${label} \u2014 ${task.containerId}`;+ }+ if (task.id && task.id !== label) {+ return `${label} \u2014 ${task.id}`;+ }+ return label;+ };+ const state = toLower(task.currentState ?? task.desiredState ?? 'unknown');+ const taskMetricsKey = container?.id ? buildMetricKey('dockerContainer', container.id) : undefined;+ const stateClass = () => {+ if (state === 'running') {+ return 'bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300';+ }+ if (state === 'failed' || state === 'error') {+ return 'bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300';+ }+ return 'bg-gray-200 text-gray-600 dark:bg-gray-700 dark:text-gray-300';+ };+ return (+ <tr class="hover:bg-gray-100 dark:hover:bg-gray-800/40">+ <td class="py-1 pr-2">+ <div class="flex items-center gap-1 text-sm text-gray-900 dark:text-gray-100">+ <span class="truncate font-medium" title={taskTitle()}>+ {taskLabel()}+ </span>+ </div>+ </td>+ <td class="py-1 px-2">+ <span+ class={`inline-flex items-center rounded px-2 py-0.5 text-[10px] font-medium whitespace-nowrap ${typeBadgeClass(+ 'task',+ )}`}+ >+ Task</span>- )}- </Show>- </td>- </tr>- );- }}- </For>- </tbody>+ </td>+ <td class="py-1 px-2 text-gray-600 dark:text-gray-400">+ {task.nodeName || task.nodeId || '—'}+ </td>+ <td class="py-1 px-2">+ <span class={`rounded px-2 py-0.5 text-[10px] font-medium whitespace-nowrap ${stateClass()}`}>+ {task.currentState || task.desiredState || 'Unknown'}+ </span>+ </td>+ <td class="py-1 px-2 w-[120px]">+ <Show when={cpu > 0} fallback={<span class="text-gray-400">—</span>}>+ <MetricBar+ value={Math.min(100, cpu)}+ label={formatPercent(cpu)}+ type="cpu"+ resourceId={taskMetricsKey}+ />+ </Show>+ </td>+ <td class="py-1 px-2 w-[140px]">+ <Show when={mem > 0} fallback={<span class="text-gray-400">—</span>}>+ <MetricBar+ value={Math.min(100, mem)}+ label={formatPercent(mem)}+ type="memory"+ resourceId={taskMetricsKey}+ />+ </Show>+ </td>+ <td class="py-1 px-2 text-gray-600 dark:text-gray-400 whitespace-nowrap">+ <Show when={updated} fallback="—">+ {(timestamp) => (+ <span title={new Date(timestamp()).toLocaleString(undefined, { dateStyle: 'medium', timeStyle: 'short' })}>+ {formatRelativeTime(timestamp())}+ </span>+ )}+ </Show>+ </td>+ </tr>+ );+ }}+ </For>+ </tbody></table></div></div>diff --git a/frontend-modern/src/components/Hosts/HostsFilter.tsx b/frontend-modern/src/components/Hosts/HostsFilter.tsxindex 244bccb74e..9472018553 100644--- a/frontend-modern/src/components/Hosts/HostsFilter.tsx+++ b/frontend-modern/src/components/Hosts/HostsFilter.tsx@@ -1,6 +1,8 @@import { Component, Show, For, createSignal, createMemo, onMount, createEffect, onCleanup } from 'solid-js';import { Card } from '@/components/shared/Card';import { SearchTipsPopover } from '@/components/shared/SearchTipsPopover';+import { ColumnPicker } from '@/components/shared/ColumnPicker';+import type { ColumnDef } from '@/hooks/useColumnVisibility';import { STORAGE_KEYS } from '@/utils/localStorage';import { createSearchHistoryManager } from '@/utils/searchHistory';@@ -13,6 +15,11 @@ interface HostsFilterProps {onReset?: () => void;activeHostName?: string;onClearHost?: () => void;+ // Column visibility+ availableColumns?: ColumnDef[];+ isColumnHidden?: (id: string) => boolean;+ onColumnToggle?: (id: string) => void;+ onColumnReset?: () => void;}export const HostsFilter: Component<HostsFilterProps> = (props) => {@@ -301,11 +308,10 @@ export const HostsFilter: Component<HostsFilterProps> = (props) => {type="button"aria-pressed={props.statusFilter() === 'all'}onClick={() => props.setStatusFilter('all')}- class={`px-2.5 py-1 text-xs font-medium rounded-md transition-all ${- props.statusFilter() === 'all'- ? 'bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 shadow-sm'- : 'text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100'- }`}+ class={`px-2.5 py-1 text-xs font-medium rounded-md transition-all ${props.statusFilter() === 'all'+ ? 'bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 shadow-sm'+ : 'text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100'+ }`}title="Show all hosts">All@@ -316,11 +322,10 @@ export const HostsFilter: Component<HostsFilterProps> = (props) => {onClick={() =>props.setStatusFilter(props.statusFilter() === 'online' ? 'all' : 'online')}- class={`px-2.5 py-1 text-xs font-medium rounded-md transition-all ${- props.statusFilter() === 'online'- ? 'bg-white dark:bg-gray-800 text-green-600 dark:text-green-400 shadow-sm'- : 'text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100'- }`}+ class={`px-2.5 py-1 text-xs font-medium rounded-md transition-all ${props.statusFilter() === 'online'+ ? 'bg-white dark:bg-gray-800 text-green-600 dark:text-green-400 shadow-sm'+ : 'text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100'+ }`}title="Show online hosts only">Online@@ -331,11 +336,10 @@ export const HostsFilter: Component<HostsFilterProps> = (props) => {onClick={() =>props.setStatusFilter(props.statusFilter() === 'degraded' ? 'all' : 'degraded')}- class={`px-2.5 py-1 text-xs font-medium rounded-md transition-all ${- props.statusFilter() === 'degraded'- ? 'bg-white dark:bg-gray-800 text-amber-600 dark:text-amber-400 shadow-sm'- : 'text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100'- }`}+ class={`px-2.5 py-1 text-xs font-medium rounded-md transition-all ${props.statusFilter() === 'degraded'+ ? 'bg-white dark:bg-gray-800 text-amber-600 dark:text-amber-400 shadow-sm'+ : 'text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100'+ }`}title="Show degraded hosts only">Degraded@@ -346,11 +350,10 @@ export const HostsFilter: Component<HostsFilterProps> = (props) => {onClick={() =>props.setStatusFilter(props.statusFilter() === 'offline' ? 'all' : 'offline')}- class={`px-2.5 py-1 text-xs font-medium rounded-md transition-all ${- props.statusFilter() === 'offline'- ? 'bg-white dark:bg-gray-800 text-red-600 dark:text-red-400 shadow-sm'- : 'text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100'- }`}+ class={`px-2.5 py-1 text-xs font-medium rounded-md transition-all ${props.statusFilter() === 'offline'+ ? 'bg-white dark:bg-gray-800 text-red-600 dark:text-red-400 shadow-sm'+ : 'text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100'+ }`}title="Show offline hosts only">Offline@@ -373,6 +376,17 @@ export const HostsFilter: Component<HostsFilterProps> = (props) => {</div></Show>+ {/* Column Picker */}+ <Show when={props.availableColumns && props.isColumnHidden && props.onColumnToggle}>+ <div class="h-5 w-px bg-gray-200 dark:bg-gray-600 hidden sm:block" aria-hidden="true"></div>+ <ColumnPicker+ columns={props.availableColumns!}+ isHidden={props.isColumnHidden!}+ onToggle={props.onColumnToggle!}+ onReset={props.onColumnReset}+ />+ </Show>+<Show when={hasActiveFilters()}><div class="h-5 w-px bg-gray-200 dark:bg-gray-600 hidden sm:block" aria-hidden="true"></div><buttondiff --git a/frontend-modern/src/components/Hosts/HostsOverview.tsx b/frontend-modern/src/components/Hosts/HostsOverview.tsxindex 94912bb2f8..c1954d7edb 100644--- a/frontend-modern/src/components/Hosts/HostsOverview.tsx+++ b/frontend-modern/src/components/Hosts/HostsOverview.tsx@@ -1,11 +1,11 @@import type { Component } from 'solid-js';-import { For, Show, createMemo, createSignal, createEffect, on, onMount, onCleanup } from 'solid-js';+import { For, Show, createMemo, createSignal, onMount, onCleanup } from 'solid-js';+import { Portal } from 'solid-js/web';import { useNavigate } from '@solidjs/router';import type { Host } from '@/types/api';-import { formatBytes, formatNumber, formatPercent, formatRelativeTime, formatUptime } from '@/utils/format';+import { formatBytes, formatRelativeTime, formatUptime } from '@/utils/format';import { Card } from '@/components/shared/Card';import { EmptyState } from '@/components/shared/EmptyState';-import { MetricBar } from '@/components/Dashboard/MetricBar';import { StackedDiskBar } from '@/components/Dashboard/StackedDiskBar';import { HostsFilter } from './HostsFilter';import { useWebSocket } from '@/App';@@ -14,15 +14,253 @@ import { getHostStatusIndicator } from '@/utils/status';import { MetricText } from '@/components/shared/responsive';import { StackedMemoryBar } from '@/components/Dashboard/StackedMemoryBar';import { EnhancedCPUBar } from '@/components/Dashboard/EnhancedCPUBar';-import { TemperatureGauge } from '@/components/shared/TemperatureGauge';-import { useBreakpoint } from '@/hooks/useBreakpoint';-import { GuestMetadataAPI } from '@/api/guestMetadata';-import { AIAPI } from '@/api/ai';+import { useBreakpoint, type ColumnPriority } from '@/hooks/useBreakpoint';+import { useColumnVisibility } from '@/hooks/useColumnVisibility';import { aiChatStore } from '@/stores/aiChat';-import { logger } from '@/utils/logger';+import { STORAGE_KEYS } from '@/utils/localStorage';++// Column definition for hosts table+export interface HostColumnDef {+ id: string;+ label: string;+ icon?: string;+ priority: ColumnPriority;+ toggleable?: boolean;+ width?: string;+ sortKey?: string;+}++// Host table column definitions+export const HOST_COLUMNS: HostColumnDef[] = [+ // Essential - always visible+ { id: 'name', label: 'Host', priority: 'essential', width: '140px', sortKey: 'name' },+ { id: 'platform', label: 'Platform', priority: 'essential', width: '90px', sortKey: 'platform' },+ { id: 'cpu', label: 'CPU', priority: 'essential', width: '140px', sortKey: 'cpu' },+ { id: 'memory', label: 'Memory', priority: 'essential', width: '140px', sortKey: 'memory' },+ { id: 'disk', label: 'Disk', priority: 'essential', width: '140px', sortKey: 'disk' },++ // Secondary - visible on md+, toggleable+ { id: 'temp', label: 'Temp', 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 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"/></svg>', priority: 'secondary', width: '50px', toggleable: true },+ { id: 'uptime', label: 'Uptime', 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="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>', priority: 'secondary', width: '65px', toggleable: true, sortKey: 'uptime' },+ { id: 'agent', label: 'Agent', priority: 'secondary', width: '60px', toggleable: true },++ // Supplementary - visible on lg+, toggleable+ // Note: CPU count and load average removed - they're shown in the EnhancedCPUBar tooltip+ { id: 'ip', label: 'IP', 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="M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"/></svg>', priority: 'supplementary', width: '50px', toggleable: true },++ // Detailed - visible on xl+, toggleable+ { id: 'arch', label: 'Arch', priority: 'detailed', width: '55px', toggleable: true },+ { id: 'kernel', label: 'Kernel', priority: 'detailed', width: '120px', toggleable: true },+ { id: 'raid', label: 'RAID', priority: 'detailed', width: '60px', toggleable: true },+];++// Network info cell with rich tooltip showing interfaces, IPs, and traffic (matches GuestRow pattern)+interface NetworkInterface {+ name: string;+ addresses?: string[];+ mac?: string;+ rxBytes?: number;+ txBytes?: number;+}++function HostNetworkInfoCell(props: { networkInterfaces: NetworkInterface[] }) {+ const [showTooltip, setShowTooltip] = createSignal(false);+ const [tooltipPos, setTooltipPos] = createSignal({ x: 0, y: 0 });++ const hasInterfaces = () => props.networkInterfaces.length > 0;++ const totalIps = () => {+ return props.networkInterfaces.reduce((sum, iface) => sum + (iface.addresses?.length || 0), 0);+ };++ const handleMouseEnter = (e: MouseEvent) => {+ const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();+ setTooltipPos({ x: rect.left + rect.width / 2, y: rect.top });+ setShowTooltip(true);+ };++ const handleMouseLeave = () => {+ setShowTooltip(false);+ };++ return (+ <>+ <span+ class="inline-flex items-center gap-1 text-xs text-gray-600 dark:text-gray-400 cursor-help"+ onMouseEnter={handleMouseEnter}+ onMouseLeave={handleMouseLeave}+ >+ <Show when={hasInterfaces()} fallback={<span class="text-gray-400">—</span>}>+ {/* Network globe icon */}+ <svg class="w-3.5 h-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1.5">+ <path stroke-linecap="round" stroke-linejoin="round" d="M12 21a9.004 9.004 0 008.716-6.747M12 21a9.004 9.004 0 01-8.716-6.747M12 21c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m0 0a8.997 8.997 0 017.843 4.582M12 3a8.997 8.997 0 00-7.843 4.582m15.686 0A11.953 11.953 0 0112 10.5c-2.998 0-5.74-1.1-7.843-2.918m15.686 0A8.959 8.959 0 0121 12c0 .778-.099 1.533-.284 2.253m0 0A17.919 17.919 0 0112 16.5c-3.162 0-6.133-.815-8.716-2.247m0 0A9.015 9.015 0 013 12c0-1.605.42-3.113 1.157-4.418" />+ </svg>+ <span class="text-[10px] font-medium">{totalIps()}</span>+ </Show>+ </span>++ <Show when={showTooltip() && hasInterfaces()}>+ <Portal mount={document.body}>+ <div+ class="fixed z-[9999] pointer-events-none"+ style={{+ left: `${tooltipPos().x}px`,+ top: `${tooltipPos().y - 8}px`,+ transform: 'translate(-50%, -100%)',+ }}+ >+ <div class="bg-gray-900 dark:bg-gray-800 text-white text-[10px] rounded-md shadow-lg px-2 py-1.5 min-w-[180px] max-w-[280px] border border-gray-700">+ <div class="font-medium mb-1 text-gray-300 border-b border-gray-700 pb-1">+ Network Interfaces+ </div>++ <For each={props.networkInterfaces}>+ {(iface, idx) => (+ <div class="py-1" classList={{ 'border-t border-gray-700/50': idx() > 0 }}>+ <div class="flex items-center gap-2 text-blue-400 font-medium">+ <span>{iface.name || 'eth' + idx()}</span>+ <Show when={iface.mac}>+ <span class="text-[9px] text-gray-500 font-normal">{iface.mac}</span>+ </Show>+ </div>+ <Show when={iface.addresses && iface.addresses.length > 0}>+ <div class="mt-0.5 flex flex-wrap gap-1">+ <For each={iface.addresses}>+ {(ip) => (+ <span class="text-gray-300 font-mono">{ip}</span>+ )}+ </For>+ </div>+ </Show>+ <Show when={!iface.addresses || iface.addresses.length === 0}>+ <span class="text-gray-500 text-[9px]">No IP assigned</span>+ </Show>+ <Show when={(iface.rxBytes || 0) > 0 || (iface.txBytes || 0) > 0}>+ <div class="mt-0.5 text-[9px] text-gray-500">+ RX: {formatBytes(iface.rxBytes || 0)} / TX: {formatBytes(iface.txBytes || 0)}+ </div>+ </Show>+ </div>+ )}+ </For>+ </div>+ </div>+ </Portal>+ </Show>+ </>+ );+}++// Temperature cell with rich tooltip showing all sensor readings+function HostTemperatureCell(props: { sensors: Record<string, number> | null | undefined }) {+ const [showTooltip, setShowTooltip] = createSignal(false);+ const [tooltipPos, setTooltipPos] = createSignal({ x: 0, y: 0 });++ // Get the primary (highest) temperature for display+ const primaryTemp = createMemo(() => {+ if (!props.sensors) return null;+ const temps = Object.values(props.sensors);+ if (temps.length === 0) return null;+ // Find package/composite temp first, otherwise show max+ const keys = Object.keys(props.sensors);+ const packageKey = keys.find(k =>+ k.toLowerCase().includes('package') ||+ k.toLowerCase().includes('composite') ||+ k.toLowerCase().includes('tctl')+ );+ if (packageKey) return props.sensors[packageKey];+ return Math.max(...temps);+ });++ const hasSensors = () => props.sensors && Object.keys(props.sensors).length > 0;++ // Color based on temperature+ const textColorClass = createMemo(() => {+ const temp = primaryTemp();+ if (temp === null) return 'text-gray-400';+ if (temp >= 80) return 'text-red-600 dark:text-red-400';+ if (temp >= 70) return 'text-yellow-600 dark:text-yellow-400';+ return 'text-gray-600 dark:text-gray-400';+ });-// Global drawer state to persist across re-renders-const drawerState = new Map<string, boolean>();+ const handleMouseEnter = (e: MouseEvent) => {+ const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();+ setTooltipPos({ x: rect.left + rect.width / 2, y: rect.top });+ setShowTooltip(true);+ };++ const handleMouseLeave = () => {+ setShowTooltip(false);+ };++ // Sort sensors: package/composite first, then cores, then others+ const sortedSensors = createMemo(() => {+ if (!props.sensors) return [];+ return Object.entries(props.sensors).sort(([a], [b]) => {+ const aLower = a.toLowerCase();+ const bLower = b.toLowerCase();+ // Package/composite/tctl first+ const aIsPrimary = aLower.includes('package') || aLower.includes('composite') || aLower.includes('tctl');+ const bIsPrimary = bLower.includes('package') || bLower.includes('composite') || bLower.includes('tctl');+ if (aIsPrimary && !bIsPrimary) return -1;+ if (bIsPrimary && !aIsPrimary) return 1;+ // Then cores by number+ const aCoreMatch = aLower.match(/core\s*(\d+)/);+ const bCoreMatch = bLower.match(/core\s*(\d+)/);+ if (aCoreMatch && bCoreMatch) {+ return parseInt(aCoreMatch[1]) - parseInt(bCoreMatch[1]);+ }+ return a.localeCompare(b);+ });+ });++ return (+ <>+ <span+ class={`inline-flex items-center text-xs whitespace-nowrap ${textColorClass()} ${hasSensors() ? 'cursor-help' : ''}`}+ onMouseEnter={handleMouseEnter}+ onMouseLeave={handleMouseLeave}+ >+ <Show when={primaryTemp() !== null} fallback={<span class="text-gray-400">—</span>}>+ {Math.round(primaryTemp()!)}°C+ </Show>+ </span>++ <Show when={showTooltip() && hasSensors()}>+ <Portal mount={document.body}>+ <div+ class="fixed z-[9999] pointer-events-none"+ style={{+ left: `${tooltipPos().x}px`,+ top: `${tooltipPos().y - 8}px`,+ transform: 'translate(-50%, -100%)',+ }}+ >+ <div class="bg-gray-900 dark:bg-gray-800 text-white text-[10px] rounded-md shadow-lg px-2 py-1.5 min-w-[160px] max-w-[240px] border border-gray-700">+ <div class="font-medium mb-1 text-gray-300 border-b border-gray-700 pb-1">+ Temperature Sensors+ </div>++ <div class="space-y-0.5">+ <For each={sortedSensors()}>+ {([name, temp]) => {+ const colorClass = temp >= 80 ? 'text-red-400' : temp >= 70 ? 'text-yellow-400' : 'text-gray-200';+ return (+ <div class="flex justify-between gap-3 py-0.5">+ <span class="text-gray-400 truncate max-w-[120px]">{name}</span>+ <span class={`font-medium font-mono ${colorClass}`}>{Math.round(temp)}°C</span>+ </div>+ );+ }}+ </For>+ </div>+ </div>+ </div>+ </Portal>+ </Show>+ </>+ );+}type SortKey = 'name' | 'platform' | 'cpu' | 'memory' | 'disk' | 'uptime';@@ -40,6 +278,15 @@ export const HostsOverview: Component<HostsOverviewProps> = (props) => {const [sortDirection, setSortDirection] = createSignal<'asc' | 'desc'>('asc');const { isMobile } = useBreakpoint();+ // Column visibility management+ const columnVisibility = useColumnVisibility(+ STORAGE_KEYS.HOSTS_HIDDEN_COLUMNS,+ HOST_COLUMNS as HostColumnDef[]+ );+ const visibleColumns = columnVisibility.visibleColumns;+ const visibleColumnIds = createMemo(() => visibleColumns().map(c => c.id));+ const isColVisible = (colId: string) => visibleColumnIds().includes(colId);+const handleSort = (key: SortKey) => {if (sortKey() === key) {setSortDirection(sortDirection() === 'asc' ? 'desc' : 'asc');@@ -58,18 +305,13 @@ export const HostsOverview: Component<HostsOverviewProps> = (props) => {let searchInputRef: HTMLInputElement | undefined;const handleKeyDown = (e: KeyboardEvent) => {- // Don't interfere if user is already typing in an inputconst target = e.target as HTMLElement;if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || target.isContentEditable) {return;}-- // Don't interfere with modifier key shortcuts (except Shift for capitals)if (e.ctrlKey || e.metaKey || e.altKey) {return;}-- // Focus search on printable characters and start typingif (e.key.length === 1 && searchInputRef) {e.preventDefault();searchInputRef.focus();@@ -90,7 +332,6 @@ export const HostsOverview: Component<HostsOverviewProps> = (props) => {const reconnect = () => wsContext.reconnect();const isInitialLoading = createMemo(() => {- // Only show loading spinner when we've never been connected and have no hostsreturn !connected() && !reconnecting() && props.hosts.length === 0;});@@ -133,12 +374,10 @@ export const HostsOverview: Component<HostsOverviewProps> = (props) => {const matchesSearch = (host: Host) => {const term = search().toLowerCase();if (!term) return true;-const hostname = (host.hostname || '').toLowerCase();const displayName = (host.displayName || '').toLowerCase();const platform = (host.platform || '').toLowerCase();const osName = (host.osName || '').toLowerCase();-return (hostname.includes(term) ||displayName.includes(term) ||@@ -158,33 +397,6 @@ export const HostsOverview: Component<HostsOverviewProps> = (props) => {return sortedHosts().filter((host) => matchesSearch(host) && matchesStatus(host));});- const getTemperatureValue = (host: Host) => {- if (!host.sensors?.temperatureCelsius) return null;- const temps = host.sensors.temperatureCelsius;-- // Try to find a "package" or "composite" temperature first- const packageKey = Object.keys(temps).find(k =>- k.toLowerCase().includes('package') ||- k.toLowerCase().includes('composite') ||- k.toLowerCase().includes('tctl')- );-- if (packageKey) return temps[packageKey];-- // Fallback: average of all core temps- const coreKeys = Object.keys(temps).filter(k => k.toLowerCase().includes('core'));- if (coreKeys.length > 0) {- const sum = coreKeys.reduce((acc, k) => acc + temps[k], 0);- return sum / coreKeys.length;- }-- // Fallback: just take the first available value if any- const values = Object.values(temps);- if (values.length > 0) return values[0];-- return null;- };-const getDiskStats = (host: Host) => {if (!host.disks || host.disks.length === 0) return { percent: 0, used: 0, total: 0 };const totalUsed = host.disks.reduce((sum, d) => sum + (d.used ?? 0), 0);@@ -196,6 +408,29 @@ export const HostsOverview: Component<HostsOverviewProps> = (props) => {};};+++ const getRaidStatus = (host: Host): { status: string; color: string } => {+ if (!host.raid || host.raid.length === 0) return { status: '-', color: 'text-gray-400' };++ let hasDegraded = false;+ let hasRebuilding = false;++ for (const array of host.raid) {+ const state = array.state.toLowerCase();+ if (state.includes('degraded') || array.failedDevices > 0) {+ hasDegraded = true;+ }+ if (state.includes('recover') || state.includes('resync') || array.rebuildPercent > 0) {+ hasRebuilding = true;+ }+ }++ if (hasDegraded) return { status: 'Degraded', color: 'text-red-600 dark:text-red-400' };+ if (hasRebuilding) return { status: 'Rebuild', color: 'text-amber-600 dark:text-amber-400' };+ return { status: 'OK', color: 'text-green-600 dark:text-green-400' };+ };+const 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";return (@@ -276,7 +511,7 @@ export const HostsOverview: Component<HostsOverviewProps> = (props) => {when={sortedHosts().length === 0}fallback={<>- {/* Filters */}+ {/* Filters with column visibility */}<HostsFiltersearch={search}setSearch={setSearch}@@ -284,6 +519,10 @@ export const HostsOverview: Component<HostsOverviewProps> = (props) => {setStatusFilter={setStatusFilter}onReset={() => setSearch('')}searchInputRef={(el) => (searchInputRef = el)}+ availableColumns={columnVisibility.availableToggles()}+ isColumnHidden={columnVisibility.isHiddenByUser}+ onColumnToggle={columnVisibility.toggle}+ onColumnReset={columnVisibility.resetToDefaults}/>{/* Host Table */}@@ -307,569 +546,71 @@ export const HostsOverview: Component<HostsOverviewProps> = (props) => {<table class="w-full border-collapse whitespace-nowrap"><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">- <th- class={`${thClass} text-left pl-4`}- onClick={() => handleSort('name')}- >+ {/* Essential columns */}+ <th class={`${thClass} text-left pl-4`} onClick={() => handleSort('name')}>Host {renderSortIndicator('name')}</th>- <th class={thClass} onClick={() => handleSort('platform')}>- Platform {renderSortIndicator('platform')}- </th>- <th class={thClass} onClick={() => handleSort('cpu')}>- CPU {renderSortIndicator('cpu')}- </th>- <th class={thClass} onClick={() => handleSort('memory')}>- Memory {renderSortIndicator('memory')}- </th>- <th class={thClass}>- Temp- </th>- <th class={thClass} onClick={() => handleSort('disk')}>- Disk {renderSortIndicator('disk')}- </th>- <th class={thClass} onClick={() => handleSort('uptime')}>- Uptime {renderSortIndicator('uptime')}- </th>- <th class={`${thClass} text-right pr-4`}>- Agent- </th>+ <Show when={isColVisible('platform')}>+ <th class={thClass} onClick={() => handleSort('platform')}>+ Platform {renderSortIndicator('platform')}+ </th>+ </Show>+ <Show when={isColVisible('cpu')}>+ <th class={thClass} onClick={() => handleSort('cpu')}>+ CPU {renderSortIndicator('cpu')}+ </th>+ </Show>+ <Show when={isColVisible('memory')}>+ <th class={thClass} onClick={() => handleSort('memory')}>+ Memory {renderSortIndicator('memory')}+ </th>+ </Show>+ <Show when={isColVisible('disk')}>+ <th class={thClass} onClick={() => handleSort('disk')}>+ Disk {renderSortIndicator('disk')}+ </th>+ </Show>++ {/* Secondary columns */}+ <Show when={isColVisible('temp')}>+ <th class={thClass} title="Temperature">+ <span class="inline-flex items-center justify-center" innerHTML={HOST_COLUMNS.find(c => c.id === 'temp')?.icon} />+ </th>+ </Show>+ <Show when={isColVisible('uptime')}>+ <th class={thClass} onClick={() => handleSort('uptime')} title="Uptime">+ <span class="inline-flex items-center justify-center gap-1">+ <span innerHTML={HOST_COLUMNS.find(c => c.id === 'uptime')?.icon} />+ {renderSortIndicator('uptime')}+ </span>+ </th>+ </Show>+ <Show when={isColVisible('agent')}>+ <th class={thClass}>Agent</th>+ </Show>++ {/* Supplementary columns */}+ <Show when={isColVisible('ip')}>+ <th class={thClass} title="IP Address">+ <span class="inline-flex items-center justify-center" innerHTML={HOST_COLUMNS.find(c => c.id === 'ip')?.icon} />+ </th>+ </Show>++ {/* Detailed columns */}+ <Show when={isColVisible('arch')}>+ <th class={thClass}>Arch</th>+ </Show>+ <Show when={isColVisible('kernel')}>+ <th class={thClass}>Kernel</th>+ </Show>+ <Show when={isColVisible('raid')}>+ <th class={thClass}>RAID</th>+ </Show></tr></thead><tbody class="divide-y divide-gray-200 dark:divide-gray-700"><For each={filteredHosts()}>- {(host) => {- // Drawer state- const [drawerOpen, setDrawerOpen] = createSignal(drawerState.get(host.id) ?? false);-- // AI and annotations state- const [aiEnabled, setAiEnabled] = createSignal(false);- const [annotations, setAnnotations] = createSignal<string[]>([]);- const [newAnnotation, setNewAnnotation] = createSignal('');- const [saving, setSaving] = createSignal(false);-- // Load AI settings and annotations when drawer opens- createEffect(() => {- if (drawerOpen()) {- AIAPI.getSettings()- .then((settings) => setAiEnabled(settings.enabled && settings.configured))- .catch((err) => logger.debug('[HostsOverview] AI settings check failed:', err));-- GuestMetadataAPI.getMetadata(`host-${host.id}`)- .then((meta) => {- if (meta.notes && Array.isArray(meta.notes)) setAnnotations(meta.notes);- })- .catch((err) => logger.debug('[HostsOverview] Failed to load annotations:', err));- }- });-- const saveAnnotations = async (updated: string[]) => {- setSaving(true);- try {- await GuestMetadataAPI.updateMetadata(`host-${host.id}`, { notes: updated });- } catch (err) {- logger.error('[HostsOverview] 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 handleAskAI = () => {- const context: Record<string, unknown> = {- hostName: host.displayName || host.hostname,- hostname: host.hostname,- platform: host.platform,- osName: host.osName,- osVersion: host.osVersion,- cpuUsage: host.cpuUsage ? `${host.cpuUsage.toFixed(1)}%` : undefined,- memoryUsage: host.memory?.usage ? `${host.memory.usage.toFixed(1)}%` : undefined,- uptime: host.uptimeSeconds ? formatUptime(host.uptimeSeconds) : undefined,- };- if (annotations().length > 0) context.user_annotations = annotations();-- aiChatStore.openForTarget('host', host.id, context);- };-- // Check if we have additional info to show in drawer- const hasDrawerContent = createMemo(() => {- return (- (host.disks && host.disks.length > 0) ||- (host.diskIO && host.diskIO.length > 0) ||- (host.networkInterfaces && host.networkInterfaces.length > 0) ||- (host.raid && host.raid.length > 0) ||- host.loadAverage ||- host.cpuCount ||- host.kernelVersion ||- host.architecture ||- host.agentVersion ||- (host.sensors?.temperatureCelsius && Object.keys(host.sensors.temperatureCelsius).length > 0)- );- });-- const toggleDrawer = (event: MouseEvent) => {- if (!hasDrawerContent()) return;- const target = event.target as HTMLElement;- if (target.closest('a, button, [data-prevent-toggle]')) {- return;- }- setDrawerOpen((prev) => !prev);- };-- // Sync drawer state- createEffect(on(() => host.id, (id) => {- const stored = drawerState.get(id);- if (stored !== undefined) {- setDrawerOpen(stored);- } else {- setDrawerOpen(false);- }- }));-- createEffect(() => {- drawerState.set(host.id, drawerOpen());- });-- const rowClass = () => {- const base = 'transition-all duration-200';- const hover = 'hover:bg-gray-50 dark:hover:bg-gray-800/50';- const clickable = hasDrawerContent() ? 'cursor-pointer' : '';- const expanded = drawerOpen() ? 'bg-gray-50 dark:bg-gray-800/40' : '';- return `${base} ${hover} ${clickable} ${expanded}`;- };-- const hostStatus = createMemo(() => getHostStatusIndicator(host));- const cpuPercent = host.cpuUsage ?? 0;- const memPercent = host.memory?.usage ?? 0;- const tempValue = getTemperatureValue(host);- const diskStats = getDiskStats(host);-- return (- <>- <tr- class={rowClass()}- onClick={toggleDrawer}- aria-expanded={drawerOpen()}- >- {/* Host Name */}- <td class="pl-4 pr-2 py-1 align-middle">- <div class="flex items-center gap-2 min-w-0">- <StatusDot- variant={hostStatus().variant}- title={hostStatus().label}- ariaLabel={hostStatus().label}- size="xs"- />- <div class="min-w-0">- <p class="text-sm font-semibold text-gray-900 dark:text-gray-100 whitespace-nowrap">- {host.displayName || host.hostname || host.id}- </p>- <Show when={host.displayName && host.displayName !== host.hostname}>- <p class="text-xs text-gray-500 dark:text-gray-400 mt-0.5 whitespace-nowrap">- {host.hostname}- </p>- </Show>- <Show when={host.lastSeen}>- <p class="text-[10px] text-gray-500 dark:text-gray-400 mt-0.5 whitespace-nowrap">- Updated {formatRelativeTime(host.lastSeen!)}- </p>- </Show>- </div>- </div>- </td>-- {/* Platform */}- <td class="px-2 py-1 align-middle">- <div class="text-xs text-gray-700 dark:text-gray-300">- <p class="font-medium capitalize whitespace-nowrap">{host.platform || '—'}</p>- <Show when={host.osName}>- <p class="text-[10px] text-gray-500 dark:text-gray-400 mt-0.5 whitespace-nowrap">- {host.osName} {host.osVersion}- </p>- </Show>- </div>- </td>-- {/* CPU */}- <td class="px-2 py-1 align-middle" style={{ "min-width": "140px" }}>- <Show when={isMobile()}>- <div class="md:hidden flex justify-center">- <MetricText value={cpuPercent} type="cpu" />- </div>- </Show>- <div class="hidden md:block">- <EnhancedCPUBar- usage={cpuPercent}- loadAverage={host.loadAverage?.[0]}- cores={host.cpuCount}- />- </div>- </td>-- {/* Memory */}- <td class="px-2 py-1 align-middle" style={{ "min-width": "140px" }}>- <Show when={isMobile()}>- <div class="md:hidden flex justify-center">- <MetricText value={memPercent} type="memory" />- </div>- </Show>- <div class="hidden md:block">- <StackedMemoryBar- used={host.memory?.used || 0}- total={host.memory?.total || 0}- balloon={host.memory?.balloon || 0}- swapUsed={host.memory?.swapUsed || 0}- swapTotal={host.memory?.swapTotal || 0}- />- </div>- </td>-- {/* Temperature */}- <td class="px-2 py-1 align-middle">- <div class="flex justify-center">- <Show when={tempValue !== null} fallback={<span class="text-xs text-gray-400">—</span>}>- <TemperatureGauge value={tempValue!} />- </Show>- </div>- </td>-- {/* Disk */}- <td class="px-2 py-1 align-middle" style={{ "min-width": "140px" }}>- <Show when={isMobile()}>- <div class="md:hidden flex justify-center">- <MetricText value={diskStats.percent} type="disk" />- </div>- </Show>- <div class="hidden md:block">- <StackedDiskBar- disks={host.disks}- aggregateDisk={{- total: diskStats.total,- used: diskStats.used,- free: diskStats.total - diskStats.used,- usage: diskStats.percent / 100- }}- />- </div>- </td>-- {/* Uptime */}- <td class="px-2 py-1 align-middle">- <div class="flex justify-center">- <Show- when={host.uptimeSeconds}- fallback={<span class="text-xs text-gray-400">—</span>}- >- <span class="text-xs text-gray-700 dark:text-gray-300 whitespace-nowrap">- {formatUptime(host.uptimeSeconds!)}- </span>- </Show>- </div>- </td>-- {/* Agent Version */}- <td class="px-2 py-1 pr-4 align-middle">- <div class="flex justify-end">- <Show- when={host.agentVersion}- fallback={<span class="text-xs text-gray-400">—</span>}- >- <span class="text-xs text-gray-700 dark:text-gray-300 whitespace-nowrap">- {host.agentVersion}- </span>- </Show>- </div>- </td>- </tr>-- {/* Drawer - Additional Info */}- <Show when={drawerOpen() && hasDrawerContent()}>- <tr>- <td colspan={8} class="p-0">- <div class="bg-gray-50 dark:bg-gray-900/50 px-4 py-3 border-t border-gray-100 dark:border-gray-800/50">- <div class="flex flex-wrap gap-3 [&>*]:flex-1 [&>*]:basis-[calc(25%-0.75rem)] [&>*]:min-w-[200px] [&>*]:max-w-full">- {/* System Info */}- <div class="rounded border border-gray-200 bg-white/70 p-3 shadow-sm dark:border-gray-600/70 dark:bg-gray-900/30">- <div class="text-[11px] font-medium uppercase tracking-wide text-gray-700 dark:text-gray-200 mb-2">System</div>- <div class="space-y-1.5 text-[11px]">- <Show when={host.cpuCount}>- <div class="flex items-center justify-between">- <span class="text-gray-500 dark:text-gray-400">CPUs</span>- <span class="font-medium text-gray-700 dark:text-gray-200">{host.cpuCount}</span>- </div>- </Show>- <Show when={host.loadAverage && host.loadAverage.length > 0}>- <div class="flex items-center justify-between">- <span class="text-gray-500 dark:text-gray-400">Load Avg</span>- <span class="font-medium text-gray-700 dark:text-gray-200">{host.loadAverage!.map(l => l.toFixed(2)).join(', ')}</span>- </div>- </Show>- <Show when={host.architecture}>- <div class="flex items-center justify-between">- <span class="text-gray-500 dark:text-gray-400">Arch</span>- <span class="font-medium text-gray-700 dark:text-gray-200">{host.architecture}</span>- </div>- </Show>- <Show when={host.kernelVersion}>- <div class="flex items-center justify-between">- <span class="text-gray-500 dark:text-gray-400">Kernel</span>- <span class="font-medium text-gray-700 dark:text-gray-200 truncate ml-2">{host.kernelVersion}</span>- </div>- </Show>- <Show when={host.agentVersion}>- <div class="flex items-center justify-between">- <span class="text-gray-500 dark:text-gray-400">Agent</span>- <span class="font-medium text-gray-700 dark:text-gray-200">{host.agentVersion}</span>- </div>- </Show>- </div>- </div>-- {/* Temperature Sensors */}- <Show when={host.sensors?.temperatureCelsius && Object.keys(host.sensors.temperatureCelsius).length > 0}>- <div class="rounded border border-gray-200 bg-white/70 p-3 shadow-sm dark:border-gray-600/70 dark:bg-gray-900/30">- <div class="text-[11px] font-medium uppercase tracking-wide text-gray-700 dark:text-gray-200 mb-2">Temperatures</div>- <div class="space-y-1.5 text-[11px]">- <For each={Object.entries(host.sensors!.temperatureCelsius!).slice(0, 5)}>- {([name, temp]) => (- <div class="flex items-center justify-between">- <span class="text-gray-500 dark:text-gray-400 truncate mr-2">{name}</span>- <span class={`font-medium ${temp > 80 ? 'text-red-600 dark:text-red-400' : 'text-gray-700 dark:text-gray-200'}`}>- {temp.toFixed(1)}°C- </span>- </div>- )}- </For>- </div>- </div>- </Show>-- {/* RAID Arrays */}- <For each={host.raid || []}>- {(array) => {- const isDegraded = () => array.state.toLowerCase().includes('degraded') || array.failedDevices > 0;- const isRebuilding = () => array.state.toLowerCase().includes('recover') || array.state.toLowerCase().includes('resync') || array.rebuildPercent > 0;- const isHealthy = () => !isDegraded() && !isRebuilding() && array.state.toLowerCase().includes('clean');-- const stateColor = () => {- if (isDegraded()) return 'text-red-600 dark:text-red-400 font-semibold';- if (isRebuilding()) return 'text-amber-600 dark:text-amber-400';- if (isHealthy()) return 'text-green-600 dark:text-green-400';- return 'text-gray-700 dark:text-gray-200';- };-- return (- <div class="rounded border border-gray-200 bg-white/70 p-3 shadow-sm dark:border-gray-600/70 dark:bg-gray-900/30">- <div class="text-[11px] font-medium uppercase tracking-wide text-gray-700 dark:text-gray-200 mb-2">- RAID {array.level.replace('raid', '')} - {array.device}- </div>- <div class="space-y-1.5 text-[11px]">- <div class="flex items-center justify-between">- <span class="text-gray-500 dark:text-gray-400">State</span>- <span class={`font-medium ${stateColor()}`}>{array.state}</span>- </div>- <div class="flex items-center justify-between">- <span class="text-gray-500 dark:text-gray-400">Devices</span>- <span class="font-medium text-gray-700 dark:text-gray-200">- {array.activeDevices}/{array.totalDevices}- {array.failedDevices > 0 && <span class="text-red-600 dark:text-red-400"> ({array.failedDevices} failed)</span>}- </span>- </div>- <Show when={isRebuilding() && array.rebuildPercent > 0}>- <div class="flex items-center justify-between">- <span class="text-gray-500 dark:text-gray-400">Rebuild</span>- <span class="font-medium text-amber-600 dark:text-amber-400">- {array.rebuildPercent.toFixed(1)}%- </span>- </div>- </Show>- </div>- </div>- );- }}- </For>-- {/* Disk Info */}- <Show when={host.disks && host.disks.length > 0}>- <div class="rounded border border-gray-200 bg-white/70 p-3 shadow-sm dark:border-gray-600/70 dark:bg-gray-900/30">- <div class="text-[11px] font-medium uppercase tracking-wide text-gray-700 dark:text-gray-200 mb-2">Disks</div>- <div class="space-y-2 text-[11px]">- <For each={host.disks?.slice(0, 3)}>- {(disk) => {- const diskPercent = () => disk.usage ?? 0;- return (- <div class="rounded border border-dashed border-gray-200 p-2 dark:border-gray-700">- <div class="flex items-center justify-between">- <span class="font-medium text-gray-700 dark:text-gray-200 truncate">{disk.mountpoint || disk.device}</span>- <span class="text-[10px] text-gray-500 dark:text-gray-400 ml-2">- {formatBytes(disk.used ?? 0, 0)} / {formatBytes(disk.total ?? 0, 0)}- </span>- </div>- <Show when={diskPercent() > 0}>- <div class="mt-1">- <MetricBar- value={diskPercent()}- label={formatPercent(diskPercent())}- type="disk"- class="max-w-none"- />- </div>- </Show>- </div>- );- }}- </For>- </div>- </div>- </Show>-- {/* Disk I/O */}- <Show when={host.diskIO && host.diskIO.length > 0}>- <div class="rounded border border-gray-200 bg-white/70 p-3 shadow-sm dark:border-gray-600/70 dark:bg-gray-900/30">- <div class="text-[11px] font-medium uppercase tracking-wide text-gray-700 dark:text-gray-200 mb-2">Disk I/O</div>- <div class="space-y-2 text-[11px]">- <For each={host.diskIO?.slice(0, 3)}>- {(io) => (- <div class="rounded border border-dashed border-gray-200 p-2 dark:border-gray-700">- <div class="font-medium text-gray-700 dark:text-gray-200 mb-1">{io.device}</div>- <div class="grid grid-cols-2 gap-x-2 gap-y-0.5 text-[10px]">- <div class="flex items-center justify-between">- <span class="text-gray-500 dark:text-gray-400">Read:</span>- <span class="text-gray-600 dark:text-gray-300">{formatBytes(io.readBytes ?? 0, 1)}</span>- </div>- <div class="flex items-center justify-between">- <span class="text-gray-500 dark:text-gray-400">Write:</span>- <span class="text-gray-600 dark:text-gray-300">{formatBytes(io.writeBytes ?? 0, 1)}</span>- </div>- </div>- </div>- )}- </For>- </div>- </div>- </Show>-- {/* Network Interfaces */}- <Show when={host.networkInterfaces && host.networkInterfaces.length > 0}>- <div class="rounded border border-gray-200 bg-white/70 p-3 shadow-sm dark:border-gray-600/70 dark:bg-gray-900/30">- <div class="text-[11px] font-medium uppercase tracking-wide text-gray-700 dark:text-gray-200 mb-2">Network</div>- <div class="space-y-2 text-[11px]">- <For each={host.networkInterfaces?.slice(0, 4)}>- {(iface) => (- <div class="rounded border border-dashed border-gray-200 p-2 dark:border-gray-700">- <div class="font-medium text-gray-700 dark:text-gray-200">{iface.name}</div>- <Show when={iface.addresses && iface.addresses.length > 0}>- <div class="flex flex-wrap gap-1 mt-1">- <For each={iface.addresses}>- {(addr) => (- <span class="inline-block rounded bg-blue-100 px-1.5 py-0.5 text-[10px] text-blue-700 dark:bg-blue-900/40 dark:text-blue-200">- {addr}- </span>- )}- </For>- </div>- </Show>- </div>- )}- </For>- </div>- </div>- </Show>- </div>-- {/* AI Context & Ask AI row */}- <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 ${host.displayName || host.hostname}`}- >- <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>- </td>- </tr>- </Show>- </>- );- }}+ {(host) => <HostRow host={host} isColVisible={isColVisible} isMobile={isMobile} getDiskStats={getDiskStats} getRaidStatus={getRaidStatus} />}</For></tbody></table>@@ -912,3 +653,268 @@ export const HostsOverview: Component<HostsOverviewProps> = (props) => {</div>);};++// Individual host row component+interface HostRowProps {+ host: Host;+ isColVisible: (colId: string) => boolean;+ isMobile: () => boolean;++ getDiskStats: (host: Host) => { percent: number; used: number; total: number };++ getRaidStatus: (host: Host) => { status: string; color: string };+}++const HostRow: Component<HostRowProps> = (props) => {+ const { host } = props;++ // Check if this host is in AI context+ const isInAIContext = createMemo(() => aiChatStore.enabled && aiChatStore.hasContextItem(host.id));++ // Build context for AI - includes routing fields+ const buildHostContext = (): Record<string, unknown> => ({+ hostName: host.displayName || host.hostname,+ hostname: host.hostname,+ node: host.hostname, // Used by AI for command routing+ target_host: host.hostname, // Explicit routing hint+ platform: host.platform,+ osName: host.osName,+ osVersion: host.osVersion,+ cpuUsage: host.cpuUsage ? `${host.cpuUsage.toFixed(1)}%` : undefined,+ memoryUsage: host.memory?.usage ? `${host.memory.usage.toFixed(1)}%` : undefined,+ uptime: host.uptimeSeconds ? formatUptime(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]')) {+ return;+ }++ // If AI is enabled, toggle AI context+ if (aiChatStore.enabled) {+ if (aiChatStore.hasContextItem(host.id)) {+ aiChatStore.removeContextItem(host.id);+ } else {+ aiChatStore.addContextItem('host', host.id, host.displayName || host.hostname, buildHostContext());+ if (!aiChatStore.isOpen) {+ aiChatStore.open();+ }+ }+ }+ };++ const hostStatus = createMemo(() => getHostStatusIndicator(host));+ const cpuPercent = host.cpuUsage ?? 0;+ const memPercent = host.memory?.usage ?? 0;+ const diskStats = props.getDiskStats(host);+ const raidStatus = props.getRaidStatus(host);++ 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' : '';+ return `${base} ${hover} ${clickable} ${aiContext}`;+ };++ return (+ <tr class={rowClass()} onClick={handleRowClick}>+ {/* Host Name - always visible */}+ <td class="pl-4 pr-2 py-1 align-middle">+ <div class="flex items-center gap-2 min-w-0">+ <StatusDot+ variant={hostStatus().variant}+ title={hostStatus().label}+ ariaLabel={hostStatus().label}+ size="xs"+ />+ <div class="min-w-0 flex items-center gap-1.5">+ <div>+ <p class="text-sm font-semibold text-gray-900 dark:text-gray-100 whitespace-nowrap">+ {host.displayName || host.hostname || host.id}+ </p>+ <Show when={host.displayName && host.displayName !== host.hostname}>+ <p class="text-xs text-gray-500 dark:text-gray-400 mt-0.5 whitespace-nowrap">+ {host.hostname}+ </p>+ </Show>+ <Show when={host.lastSeen}>+ <p class="text-[10px] text-gray-500 dark:text-gray-400 mt-0.5 whitespace-nowrap">+ Updated {formatRelativeTime(host.lastSeen!)}+ </p>+ </Show>+ </div>+ {/* 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>+ </td>++ {/* Platform */}+ <Show when={props.isColVisible('platform')}>+ <td class="px-2 py-1 align-middle">+ <div class="text-xs text-gray-700 dark:text-gray-300">+ <p class="font-medium capitalize whitespace-nowrap">{host.platform || '—'}</p>+ <Show when={host.osName}>+ <p class="text-[10px] text-gray-500 dark:text-gray-400 mt-0.5 whitespace-nowrap">+ {host.osName} {host.osVersion}+ </p>+ </Show>+ </div>+ </td>+ </Show>++ {/* CPU */}+ <Show when={props.isColVisible('cpu')}>+ <td class="px-2 py-1 align-middle" style={{ "min-width": "140px" }}>+ <Show when={props.isMobile()}>+ <div class="md:hidden flex justify-center">+ <MetricText value={cpuPercent} type="cpu" />+ </div>+ </Show>+ <div class="hidden md:block">+ <EnhancedCPUBar+ usage={cpuPercent}+ loadAverage={host.loadAverage?.[0]}+ cores={host.cpuCount}+ />+ </div>+ </td>+ </Show>++ {/* Memory */}+ <Show when={props.isColVisible('memory')}>+ <td class="px-2 py-1 align-middle" style={{ "min-width": "140px" }}>+ <Show when={props.isMobile()}>+ <div class="md:hidden flex justify-center">+ <MetricText value={memPercent} type="memory" />+ </div>+ </Show>+ <div class="hidden md:block">+ <StackedMemoryBar+ used={host.memory?.used || 0}+ total={host.memory?.total || 0}+ balloon={host.memory?.balloon || 0}+ swapUsed={host.memory?.swapUsed || 0}+ swapTotal={host.memory?.swapTotal || 0}+ />+ </div>+ </td>+ </Show>++ {/* Disk */}+ <Show when={props.isColVisible('disk')}>+ <td class="px-2 py-1 align-middle" style={{ "min-width": "140px" }}>+ <Show when={props.isMobile()}>+ <div class="md:hidden flex justify-center">+ <MetricText value={diskStats.percent} type="disk" />+ </div>+ </Show>+ <div class="hidden md:block">+ <StackedDiskBar+ disks={host.disks}+ aggregateDisk={{+ total: diskStats.total,+ used: diskStats.used,+ free: diskStats.total - diskStats.used,+ usage: diskStats.percent / 100+ }}+ />+ </div>+ </td>+ </Show>++ {/* Temperature - shows primary temp with all sensors in tooltip */}+ <Show when={props.isColVisible('temp')}>+ <td class="px-2 py-1 align-middle">+ <div class="flex justify-center">+ <HostTemperatureCell sensors={host.sensors?.temperatureCelsius} />+ </div>+ </td>+ </Show>++ {/* Uptime */}+ <Show when={props.isColVisible('uptime')}>+ <td class="px-2 py-1 align-middle">+ <div class="flex justify-center">+ <Show when={host.uptimeSeconds} fallback={<span class="text-xs text-gray-400">—</span>}>+ <span class="text-xs text-gray-700 dark:text-gray-300 whitespace-nowrap">+ {formatUptime(host.uptimeSeconds!)}+ </span>+ </Show>+ </div>+ </td>+ </Show>++ {/* Agent Version */}+ <Show when={props.isColVisible('agent')}>+ <td class="px-2 py-1 align-middle">+ <div class="flex justify-center">+ <Show when={host.agentVersion} fallback={<span class="text-xs text-gray-400">—</span>}>+ <span class="text-xs text-gray-700 dark:text-gray-300 whitespace-nowrap">+ {host.agentVersion}+ </span>+ </Show>+ </div>+ </td>+ </Show>++ {/* IP Address - uses icon + count with tooltip */}+ <Show when={props.isColVisible('ip')}>+ <td class="px-2 py-1 align-middle">+ <div class="flex justify-center">+ <HostNetworkInfoCell networkInterfaces={host.networkInterfaces || []} />+ </div>+ </td>+ </Show>++ {/* Architecture */}+ <Show when={props.isColVisible('arch')}>+ <td class="px-2 py-1 align-middle">+ <div class="flex justify-center">+ <Show when={host.architecture} fallback={<span class="text-xs text-gray-400">—</span>}>+ <span class="text-[10px] text-gray-700 dark:text-gray-300 whitespace-nowrap">+ {host.architecture}+ </span>+ </Show>+ </div>+ </td>+ </Show>++ {/* Kernel */}+ <Show when={props.isColVisible('kernel')}>+ <td class="px-2 py-1 align-middle">+ <div class="flex justify-center">+ <Show when={host.kernelVersion} fallback={<span class="text-xs text-gray-400">—</span>}>+ <span+ class="text-[10px] text-gray-700 dark:text-gray-300 max-w-[100px] truncate"+ title={host.kernelVersion}+ >+ {host.kernelVersion}+ </span>+ </Show>+ </div>+ </td>+ </Show>++ {/* RAID Status */}+ <Show when={props.isColVisible('raid')}>+ <td class="px-2 py-1 align-middle">+ <div class="flex justify-center">+ <span class={`text-[10px] font-medium ${raidStatus.color}`}>+ {raidStatus.status}+ </span>+ </div>+ </td>+ </Show>+ </tr>+ );+};diff --git a/frontend-modern/src/components/shared/NodeSummaryTable.tsx b/frontend-modern/src/components/shared/NodeSummaryTable.tsxindex e9fc28943d..23dccbadc6 100644--- a/frontend-modern/src/components/shared/NodeSummaryTable.tsx+++ b/frontend-modern/src/components/shared/NodeSummaryTable.tsx@@ -616,6 +616,7 @@ export const NodeSummaryTable: Component<NodeSummaryTableProps> = (props) => {balloon={node!.memory?.balloon || 0}swapUsed={node!.memory?.swapUsed || 0}swapTotal={node!.memory?.swapTotal || 0}+ resourceId={metricsKey}/>}>diff --git a/frontend-modern/src/styles/animations.css b/frontend-modern/src/styles/animations.cssindex 88e397a4e5..03b660bbc2 100644--- a/frontend-modern/src/styles/animations.css+++ b/frontend-modern/src/styles/animations.css@@ -211,178 +211,52 @@animation: nodeClick 0.15s ease-out;}-/* AI Context row highlight with mergeable borders */-/* Using purple-600 (147, 51, 234) for a true purple */--/* Full border - single row or first/last of group */-@keyframes ai-context-pulse-full {- 0%, 100% {- background-color: rgba(147, 51, 234, 0.08);- box-shadow:- inset 2px 0 0 0 rgba(147, 51, 234, 0.4),- inset -2px 0 0 0 rgba(147, 51, 234, 0.4),- inset 0 2px 0 0 rgba(147, 51, 234, 0.4),- inset 0 -2px 0 0 rgba(147, 51, 234, 0.4);- }- 50% {- background-color: rgba(147, 51, 234, 0.16);- box-shadow:- inset 2px 0 0 0 rgba(147, 51, 234, 0.8),- inset -2px 0 0 0 rgba(147, 51, 234, 0.8),- inset 0 2px 0 0 rgba(147, 51, 234, 0.8),- inset 0 -2px 0 0 rgba(147, 51, 234, 0.8);- }-}--/* No top border - middle or bottom of group */-@keyframes ai-context-pulse-no-top {- 0%, 100% {- background-color: rgba(147, 51, 234, 0.08);- box-shadow:- inset 2px 0 0 0 rgba(147, 51, 234, 0.4),- inset -2px 0 0 0 rgba(147, 51, 234, 0.4),- inset 0 -2px 0 0 rgba(147, 51, 234, 0.4);- }- 50% {- background-color: rgba(147, 51, 234, 0.16);- box-shadow:- inset 2px 0 0 0 rgba(147, 51, 234, 0.8),- inset -2px 0 0 0 rgba(147, 51, 234, 0.8),- inset 0 -2px 0 0 rgba(147, 51, 234, 0.8);- }-}--/* No bottom border - top of group */-@keyframes ai-context-pulse-no-bottom {- 0%, 100% {- background-color: rgba(147, 51, 234, 0.08);- box-shadow:- inset 2px 0 0 0 rgba(147, 51, 234, 0.4),- inset -2px 0 0 0 rgba(147, 51, 234, 0.4),- inset 0 2px 0 0 rgba(147, 51, 234, 0.4);- }- 50% {- background-color: rgba(147, 51, 234, 0.16);- box-shadow:- inset 2px 0 0 0 rgba(147, 51, 234, 0.8),- inset -2px 0 0 0 rgba(147, 51, 234, 0.8),- inset 0 2px 0 0 rgba(147, 51, 234, 0.8);- }-}--/* Side borders only - middle of group */-@keyframes ai-context-pulse-sides {- 0%, 100% {- background-color: rgba(147, 51, 234, 0.08);- box-shadow:- inset 2px 0 0 0 rgba(147, 51, 234, 0.4),- inset -2px 0 0 0 rgba(147, 51, 234, 0.4);- }- 50% {- background-color: rgba(147, 51, 234, 0.16);- box-shadow:- inset 2px 0 0 0 rgba(147, 51, 234, 0.8),- inset -2px 0 0 0 rgba(147, 51, 234, 0.8);- }-}+/* AI Context row highlight - subtle left accent bar */+/* Using purple-500 for a clean, modern look */.ai-context-row {- animation: ai-context-pulse-full 2s ease-in-out infinite;-}--.ai-context-row.ai-context-no-top {- animation: ai-context-pulse-no-top 2s ease-in-out infinite;+ 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-bottom {- animation: ai-context-pulse-no-bottom 2s ease-in-out infinite;+.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 {- animation: ai-context-pulse-sides 2s ease-in-out infinite;+ background-color: rgba(147, 51, 234, 0.04);+ box-shadow: inset 3px 0 0 0 rgba(147, 51, 234, 0.6);}-/* Dark mode - using purple-400 (167, 139, 250) */-@keyframes ai-context-pulse-full-dark {- 0%, 100% {- background-color: rgba(147, 51, 234, 0.12);- box-shadow:- inset 2px 0 0 0 rgba(167, 139, 250, 0.5),- inset -2px 0 0 0 rgba(167, 139, 250, 0.5),- inset 0 2px 0 0 rgba(167, 139, 250, 0.5),- inset 0 -2px 0 0 rgba(167, 139, 250, 0.5);- }- 50% {- background-color: rgba(147, 51, 234, 0.24);- box-shadow:- inset 2px 0 0 0 rgba(167, 139, 250, 0.9),- inset -2px 0 0 0 rgba(167, 139, 250, 0.9),- inset 0 2px 0 0 rgba(167, 139, 250, 0.9),- inset 0 -2px 0 0 rgba(167, 139, 250, 0.9);- }-}--@keyframes ai-context-pulse-no-top-dark {- 0%, 100% {- background-color: rgba(147, 51, 234, 0.12);- box-shadow:- inset 2px 0 0 0 rgba(167, 139, 250, 0.5),- inset -2px 0 0 0 rgba(167, 139, 250, 0.5),- inset 0 -2px 0 0 rgba(167, 139, 250, 0.5);- }- 50% {- background-color: rgba(147, 51, 234, 0.24);- box-shadow:- inset 2px 0 0 0 rgba(167, 139, 250, 0.9),- inset -2px 0 0 0 rgba(167, 139, 250, 0.9),- inset 0 -2px 0 0 rgba(167, 139, 250, 0.9);- }-}--@keyframes ai-context-pulse-no-bottom-dark {- 0%, 100% {- background-color: rgba(147, 51, 234, 0.12);- box-shadow:- inset 2px 0 0 0 rgba(167, 139, 250, 0.5),- inset -2px 0 0 0 rgba(167, 139, 250, 0.5),- inset 0 2px 0 0 rgba(167, 139, 250, 0.5);- }- 50% {- background-color: rgba(147, 51, 234, 0.24);- box-shadow:- inset 2px 0 0 0 rgba(167, 139, 250, 0.9),- inset -2px 0 0 0 rgba(167, 139, 250, 0.9),- inset 0 2px 0 0 rgba(167, 139, 250, 0.9);- }-}--@keyframes ai-context-pulse-sides-dark {- 0%, 100% {- background-color: rgba(147, 51, 234, 0.12);- box-shadow:- inset 2px 0 0 0 rgba(167, 139, 250, 0.5),- inset -2px 0 0 0 rgba(167, 139, 250, 0.5);- }- 50% {- background-color: rgba(147, 51, 234, 0.24);- box-shadow:- inset 2px 0 0 0 rgba(167, 139, 250, 0.9),- inset -2px 0 0 0 rgba(167, 139, 250, 0.9);- }+.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 {- animation: ai-context-pulse-full-dark 2s ease-in-out infinite;+ 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 {- animation: ai-context-pulse-no-top-dark 2s ease-in-out infinite;+.dark .ai-context-row:hover {+ background-color: rgba(167, 139, 250, 0.12);}-.dark .ai-context-row.ai-context-no-bottom {- animation: ai-context-pulse-no-bottom-dark 2s ease-in-out infinite;+.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.ai-context-no-bottom {- animation: ai-context-pulse-sides-dark 2s ease-in-out infinite;+.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/internal/ai/routing.go b/internal/ai/routing.goindex 840927679d..c97ddadfbe 100644--- a/internal/ai/routing.go+++ b/internal/ai/routing.go@@ -25,11 +25,12 @@ type RoutingResult struct {// RoutingError represents a routing failure with actionable informationtype RoutingError struct {- TargetNode string- TargetVMID int- AvailableAgents []string- Reason string- Suggestion string+ TargetNode string+ TargetVMID int+ AvailableAgents []string+ Reason string+ Suggestion string+ AskForClarification bool // If true, AI should ask the user which host to use}func (e *RoutingError) Error() string {@@ -39,6 +40,21 @@ func (e *RoutingError) Error() string {return e.Reason}+// ForAI returns a message suitable for returning to the AI as a tool result+// This encourages the AI to ask the user for clarification rather than just failing+func (e *RoutingError) ForAI() string {+ if e.AskForClarification && len(e.AvailableAgents) > 0 {+ return fmt.Sprintf(+ "ROUTING_CLARIFICATION_NEEDED: %s\n\n"++ "Available hosts: %s\n\n"++ "Please ask the user which host they want to run this command on. "++ "Do NOT try the command again until the user specifies which host. "++ "Present the available hosts in a friendly way and ask them to clarify.",+ e.Reason, strings.Join(e.AvailableAgents, ", "))+ }+ return e.Error()+}+// routeToAgent determines which agent should execute a command.// This is the authoritative routing function that should be used for all command execution.//@@ -141,13 +157,20 @@ func (s *Service) routeToAgent(req ExecuteRequest, command string, agents []agenStr("command", command).Msg("Routing via 'guest_node' in context")} else if req.TargetType == "host" {- if hostname, ok := req.Context["hostname"].(string); ok && hostname != "" {+ // Check multiple possible keys for hostname - frontend uses host_name+ hostname := ""+ if h, ok := req.Context["hostname"].(string); ok && h != "" {+ hostname = h+ } else if h, ok := req.Context["host_name"].(string); ok && h != "" {+ hostname = h+ }+ if hostname != "" {result.TargetNode = strings.ToLower(hostname)result.RoutingMethod = "context_hostname"log.Debug().Str("hostname", hostname).Str("command", command).- Msg("Routing via 'hostname' in context")+ Msg("Routing via hostname in context")} else {// For host target type with no node info, log a warning// This is a common source of routing issues@@ -252,10 +275,10 @@ func (s *Service) routeToAgent(req ExecuteRequest, command string, agents []agenMsg("Routing failed - cannot determine target agent")return nil, &RoutingError{- AvailableAgents: agentHostnames,- Reason: "Cannot determine which agent should execute this command",- Suggestion: fmt.Sprintf("Use target_host parameter with one of: %s. Or specify VMID in the command for pct/qm commands.",- strings.Join(agentHostnames, ", ")),+ AvailableAgents: agentHostnames,+ Reason: "Cannot determine which host should execute this command",+ Suggestion: fmt.Sprintf("Please specify which host: %s", strings.Join(agentHostnames, ", ")),+ AskForClarification: true,}}diff --git a/internal/ai/service.go b/internal/ai/service.goindex 4a7e6c8db0..8c09668253 100644--- a/internal/ai/service.go+++ b/internal/ai/service.go@@ -617,19 +617,7 @@ Examples of actions you can perform:- View processes: ps aux --sort=-%mem | head -20- Check logs: tail -100 /var/log/syslog-Always execute the commands rather than telling the user how to do it.--## Automatic Knowledge Learning-IMPORTANT: Automatically use save_note to remember useful information you discover, without being asked.-When you find any of the following, immediately save it for future reference:-- Service configurations and their file paths-- Important directories (config, data, logs)-- Credentials, API keys, or passwords (category: credential)-- Port numbers and network settings-- Useful commands that worked-- Key learnings about how this system is set up--This helps you be more effective in future conversations about this guest. Save notes silently without mentioning it to the user.`+Always execute the commands rather than telling the user how to do it.`}// Inject previously learned knowledge about this guest@@ -766,19 +754,7 @@ Examples of actions you can perform:- View processes: ps aux --sort=-%mem | head -20- Check logs: tail -100 /var/log/syslog-Always execute the commands rather than telling the user how to do it.--## Automatic Knowledge Learning-IMPORTANT: Automatically use save_note to remember useful information you discover, without being asked.-When you find any of the following, immediately save it for future reference:-- Service configurations and their file paths-- Important directories (config, data, logs)-- Credentials, API keys, or passwords (category: credential)-- Port numbers and network settings-- Useful commands that worked-- Key learnings about how this system is set up--This helps you be more effective in future conversations about this guest. Save notes silently without mentioning it to the user.`+Always execute the commands rather than telling the user how to do it.`}// Inject previously learned knowledge about this guest@@ -928,7 +904,12 @@ This helps you be more effective in future conversations about this guest. Saveif needsApproval {// Don't execute - tell the AI the command needs user approval- result = "This command requires user approval. The command was not executed. Please suggest the command to the user and let them decide whether to run it."+ // The approval button has been sent to the frontend - tell AI to direct user to it+ result = fmt.Sprintf("COMMAND_BLOCKED: This command (%s) requires user approval and was NOT executed. "++ "An approval button has been displayed to the user in the chat. "++ "DO NOT attempt to run this command again. "++ "Tell the user to click the 'Run' button that appeared above to execute the command, "++ "or explain what the command does if they need help deciding.", toolInput)execution = ToolExecution{Name: tc.Name,Input: toolInput,@@ -1188,8 +1169,11 @@ func (s *Service) executeTool(ctx context.Context, req ExecuteRequest, tc providreturn execution.Output, execution}if decision == agentexec.PolicyRequireApproval {- // For now, just inform the AI. Future: implement approval workflow- execution.Output = fmt.Sprintf("This command requires user approval: %s\nThe command was not executed. Please suggest the command to the user and let them decide whether to run it.", command)+ // Direct the AI to tell the user about the approval button+ execution.Output = fmt.Sprintf("COMMAND_BLOCKED: This command (%s) requires user approval and was NOT executed. "++ "An approval button has been displayed to the user. "++ "DO NOT attempt to run this command again. "++ "Tell the user to click the 'Run' button to execute it.", command)execution.Success = true // Not an error, just needs approvalreturn execution.Output, execution}@@ -1542,7 +1526,13 @@ func (s *Service) executeOnAgent(ctx context.Context, req ExecuteRequest, comman// Use the new robust routing logicrouteResult, err := s.routeToAgent(req, command, agents)if err != nil {- // Return actionable error message+ // Check if this is a routing error that should ask for clarification+ if routingErr, ok := err.(*RoutingError); ok && routingErr.AskForClarification {+ // Return a message that encourages the AI to ask the user for clarification+ // instead of just failing with an error+ return routingErr.ForAI(), nil+ }+ // Return actionable error message for other errorsreturn "", err}