Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

feat(dashboard): streamline drawer details and discovery

rcourtmanc07fd4757632
diff --git a/frontend-modern/src/components/Dashboard/Dashboard.tsx b/frontend-modern/src/components/Dashboard/Dashboard.tsx
index ce3dcbacd5..59ba989dce 100644
--- a/frontend-modern/src/components/Dashboard/Dashboard.tsx
+++ b/frontend-modern/src/components/Dashboard/Dashboard.tsx
@@ -24,7 +24,6 @@ import { usePersistentSignal } from '@/hooks/usePersistentSignal';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import { useBreakpoint } from '@/hooks/useBreakpoint';
import { STORAGE_KEYS } from '@/utils/localStorage';
-import { getBackupInfo } from '@/utils/format';
import { aiChatStore } from '@/stores/aiChat';
import { isKioskMode, subscribeToKioskMode } from '@/utils/url';
@@ -204,8 +203,6 @@ interface DashboardProps {
type ViewMode = 'all' | 'vm' | 'lxc';
type StatusMode = 'all' | 'running' | 'degraded' | 'stopped';
type GroupingMode = 'grouped' | 'flat';
-type ProblemsMode = 'all' | 'problems';
-
export function Dashboard(props: DashboardProps) {
const navigate = useNavigate();
const ws = useWebSocket();
@@ -230,7 +227,32 @@ export function Dashboard(props: DashboardProps) {
const [search, setSearch] = createSignal('');
const [isSearchLocked, setIsSearchLocked] = createSignal(false);
const [selectedNode, setSelectedNode] = createSignal<string | null>(null);
- const [selectedGuestId, setSelectedGuestId] = createSignal<string | null>(null);
+ const [selectedGuestId, setSelectedGuestIdRaw] = createSignal<string | null>(null);
+
+ // Wrap setSelectedGuestId to preserve scroll position. Opening/closing the
+ // drawer mounts/unmounts GuestDrawer (which contains DiscoveryTab). The
+ // DiscoveryTab initialization triggers SolidJS to recreate the <For> row,
+ // which detaches/reattaches DOM and resets the scroll container's scrollTop.
+ // We find the scroll container, save its position, and restore it after.
+ let tableRef: HTMLDivElement | undefined;
+ const setSelectedGuestId = (id: string | null) => {
+ // Find the nearest ancestor scroll container from the table
+ let scroller: HTMLElement | null = tableRef ?? null;
+ while (scroller) {
+ const { overflowY } = getComputedStyle(scroller);
+ if ((overflowY === 'auto' || overflowY === 'scroll') && scroller.scrollHeight > scroller.clientHeight) {
+ break;
+ }
+ scroller = scroller.parentElement;
+ }
+ const scrollTop = scroller?.scrollTop ?? 0;
+ setSelectedGuestIdRaw(id);
+ // Restore scroll position — opening the drawer can cause layout changes
+ if (scroller) scroller.scrollTop = scrollTop;
+ requestAnimationFrame(() => {
+ if (scroller) scroller.scrollTop = scrollTop;
+ });
+ };
const [guestMetadata, setGuestMetadata] = createSignal<GuestMetadataRecord>(
readGuestMetadataCache(),
);
@@ -269,15 +291,6 @@ export function Dashboard(props: DashboardProps) {
},
);
- // Problems mode - show only guests with issues
- const [problemsMode, setProblemsMode] = usePersistentSignal<ProblemsMode>(
- 'dashboardProblemsMode',
- 'all',
- {
- deserialize: (raw) => (raw === 'all' || raw === 'problems' ? raw : 'all'),
- },
- );
-
const [showFilters, setShowFilters] = usePersistentSignal<boolean>(
'dashboardShowFilters',
false,
@@ -587,8 +600,7 @@ export function Dashboard(props: DashboardProps) {
sortDirection() !== 'asc' ||
selectedNode() !== null ||
viewMode() !== 'all' ||
- statusMode() !== 'all' ||
- problemsMode() !== 'all';
+ statusMode() !== 'all';
if (hasActiveFilters) {
// Clear ALL filters including search text, tag filters, node selection, and view modes
@@ -599,7 +611,6 @@ export function Dashboard(props: DashboardProps) {
setSelectedNode(null);
setViewMode('all');
setStatusMode('all');
- setProblemsMode('all');
// Blur the search input if it's focused
if (searchInputRef && document.activeElement === searchInputRef) {
@@ -633,32 +644,6 @@ export function Dashboard(props: DashboardProps) {
return () => document.removeEventListener('keydown', handleKeyDown);
});
- // Compute guests with problems - used for AI investigation regardless of filter state
- const problemGuests = createMemo(() => {
- return allGuests().filter((g) => {
- // Skip templates
- if (g.template) return false;
-
- // Check for degraded status
- const status = (g.status || '').toLowerCase();
- const isDegraded = DEGRADED_HEALTH_STATUSES.has(status) ||
- (status !== 'running' && !OFFLINE_HEALTH_STATUSES.has(status) && status !== 'stopped');
- if (isDegraded) return true;
-
- // Check for backup issues
- const backupInfo = getBackupInfo(g.lastBackup, alertsActivation.getBackupThresholds());
- if (backupInfo.status === 'stale' || backupInfo.status === 'critical' || backupInfo.status === 'never') {
- return true;
- }
-
- // Check for high resource usage (>90%)
- if (g.cpu > 0.9) return true;
- if (g.memory && g.memory.usage && g.memory.usage > 90) return true;
-
- return false;
- });
- });
-
// Filter guests based on current settings
const filteredGuests = createMemo(() => {
let guests = allGuests();
@@ -698,32 +683,6 @@ export function Dashboard(props: DashboardProps) {
guests = guests.filter((g) => g.status !== 'running');
}
- // Filter by problems mode - show guests that need attention (includes backup issues)
- if (problemsMode() === 'problems') {
- guests = guests.filter((g) => {
- // Skip templates
- if (g.template) return false;
-
- // Check for degraded status
- const status = (g.status || '').toLowerCase();
- const isDegraded = DEGRADED_HEALTH_STATUSES.has(status) ||
- (status !== 'running' && !OFFLINE_HEALTH_STATUSES.has(status) && status !== 'stopped');
- if (isDegraded) return true;
-
- // Check for backup issues
- const backupInfo = getBackupInfo(g.lastBackup, alertsActivation.getBackupThresholds());
- if (backupInfo.status === 'stale' || backupInfo.status === 'critical' || backupInfo.status === 'never') {
- return true;
- }
-
- // Check for high resource usage (>90%)
- if (g.cpu > 0.9) return true;
- if (g.memory && g.memory.usage && g.memory.usage > 90) return true;
-
- return false;
- });
- }
-
// Apply search/filter
const searchTerm = search().trim();
if (searchTerm) {
@@ -928,9 +887,6 @@ export function Dashboard(props: DashboardProps) {
setViewMode={setViewMode}
statusMode={statusMode}
setStatusMode={setStatusMode}
- problemsMode={problemsMode}
- setProblemsMode={setProblemsMode}
- filteredProblemGuests={problemGuests}
groupingMode={groupingMode}
setGroupingMode={setGroupingMode}
setSortKey={setSortKey}
@@ -1064,7 +1020,7 @@ export function Dashboard(props: DashboardProps) {
<Show when={connected() && initialDataReceived() && filteredGuests().length > 0}>
<ComponentErrorBoundary name="Guest Table">
<Card padding="none" tone="glass" class="mb-4 overflow-hidden">
- <div class="overflow-x-auto">
+ <div ref={tableRef} class="overflow-x-auto">
<table class="w-full border-collapse whitespace-nowrap" style={{ "table-layout": "fixed", "min-width": isMobile() ? "800px" : "900px" }}>
<thead>
<tr class="bg-gray-50 dark:bg-gray-700/50 text-gray-600 dark:text-gray-300 border-b border-gray-200 dark:border-gray-700">
@@ -1156,6 +1112,8 @@ export function Dashboard(props: DashboardProps) {
guest={guest}
metricsKey={buildMetricKey(guest.type === 'qemu' ? 'vm' : 'container', guestId)}
onClose={() => setSelectedGuestId(null)}
+ customUrl={getMetadata()?.customUrl}
+ onCustomUrlChange={handleCustomUrlUpdate}
/>
</div>
</td>
diff --git a/frontend-modern/src/components/Dashboard/DashboardFilter.tsx b/frontend-modern/src/components/Dashboard/DashboardFilter.tsx
index 7bcca02394..4bacb2b48c 100644
--- a/frontend-modern/src/components/Dashboard/DashboardFilter.tsx
+++ b/frontend-modern/src/components/Dashboard/DashboardFilter.tsx
@@ -3,9 +3,7 @@ import { Card } from '@/components/shared/Card';
import { SearchTipsPopover } from '@/components/shared/SearchTipsPopover';
import { MetricsViewToggle } from '@/components/shared/MetricsViewToggle';
import { ColumnPicker } from '@/components/shared/ColumnPicker';
-import { InvestigateProblemsButton } from './InvestigateProblemsButton';
import type { ColumnDef } from '@/hooks/useColumnVisibility';
-import type { VM, Container } from '@/types/api';
import { STORAGE_KEYS } from '@/utils/localStorage';
import { createSearchHistoryManager } from '@/utils/searchHistory';
@@ -17,10 +15,6 @@ interface DashboardFilterProps {
setViewMode: (value: 'all' | 'vm' | 'lxc') => void;
statusMode: () => 'all' | 'running' | 'degraded' | 'stopped';
setStatusMode: (value: 'all' | 'running' | 'degraded' | 'stopped') => void;
- problemsMode: () => 'all' | 'problems';
- setProblemsMode: (value: 'all' | 'problems') => void;
- /** Guests that match the problems filter - used for AI investigation */
- filteredProblemGuests?: () => (VM | Container)[];
groupingMode: () => 'grouped' | 'flat';
setGroupingMode: (value: 'grouped' | 'flat') => void;
setSortKey: (value: string) => void;
@@ -302,34 +296,6 @@ export const DashboardFilter: Component<DashboardFilterProps> = (props) => {
{/* Row 2: Filters - grouped for logical wrapping */}
<div class="flex flex-wrap items-center gap-x-1.5 sm:gap-x-2 gap-y-2">
- {/* Problems Toggle - Prominent "Show me issues" button */}
- <button
- type="button"
- onClick={() => props.setProblemsMode(props.problemsMode() === 'problems' ? 'all' : 'problems')}
- class={`inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-semibold rounded-lg transition-all duration-150 active:scale-95 ${props.problemsMode() === 'problems'
- ? 'bg-gradient-to-r from-red-500 to-orange-500 text-white shadow-md shadow-red-500/25 ring-1 ring-red-400'
- : 'bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 hover:bg-gray-200 dark:hover:bg-gray-600'
- }`}
- title="Show guests that need attention: degraded status, backup issues, or high resource usage (>90%)"
- >
- <svg class={`w-3.5 h-3.5 ${props.problemsMode() === 'problems' ? 'animate-pulse' : ''}`} viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
- <path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" />
- <line x1="12" y1="9" x2="12" y2="13" />
- <line x1="12" y1="17" x2="12.01" y2="17" />
- </svg>
- Problems
- </button>
-
- {/* AI Investigation button - appears when problems mode is active */}
- <Show when={props.filteredProblemGuests}>
- <InvestigateProblemsButton
- problemGuests={props.filteredProblemGuests!()}
- isProblemsMode={props.problemsMode() === 'problems'}
- />
- </Show>
-
- <div class="h-5 w-px bg-gray-200 dark:bg-gray-600 hidden sm:block"></div>
-
{/* Primary Filters Group: Type + Status */}
<div class="flex flex-wrap items-center gap-2">
{/* Type Filter */}
@@ -492,7 +458,6 @@ export const DashboardFilter: Component<DashboardFilterProps> = (props) => {
props.search().trim() !== '' ||
props.viewMode() !== 'all' ||
props.statusMode() !== 'all' ||
- props.problemsMode() !== 'all' ||
props.groupingMode() !== 'grouped'
}>
<div class="h-5 w-px bg-gray-200 dark:bg-gray-600 hidden sm:block"></div>
@@ -503,7 +468,6 @@ export const DashboardFilter: Component<DashboardFilterProps> = (props) => {
props.setSortDirection('asc');
props.setViewMode('all');
props.setStatusMode('all');
- props.setProblemsMode('all');
props.setGroupingMode('grouped');
}}
title="Reset all filters"
diff --git a/frontend-modern/src/components/Dashboard/GuestDrawer.tsx b/frontend-modern/src/components/Dashboard/GuestDrawer.tsx
index 0373ddda1f..b3eb66358f 100644
--- a/frontend-modern/src/components/Dashboard/GuestDrawer.tsx
+++ b/frontend-modern/src/components/Dashboard/GuestDrawer.tsx
@@ -1,9 +1,10 @@
-import { Component, Show, For, createSignal } from 'solid-js';
+import { Component, Show, For, Suspense, createSignal } from 'solid-js';
import { VM, Container } from '@/types/api';
import { formatBytes, formatUptime } from '@/utils/format';
import { DiskList } from './DiskList';
-import { UnifiedHistoryChart } from '../shared/UnifiedHistoryChart';
-import { HistoryTimeRange, ResourceType } from '@/api/charts';
+import { HistoryChart } from '../shared/HistoryChart';
+import { ResourceType, HistoryTimeRange } from '@/api/charts';
+import { hasFeature } from '@/stores/license';
import { DiscoveryTab } from '../Discovery/DiscoveryTab';
import type { ResourceType as DiscoveryResourceType } from '@/types/discovery';
@@ -13,9 +14,16 @@ interface GuestDrawerProps {
guest: Guest;
metricsKey: string;
onClose: () => void;
+ customUrl?: string;
+ onCustomUrlChange?: (guestId: string, url: string) => void;
}
export const GuestDrawer: Component<GuestDrawerProps> = (props) => {
+ const guestId = () => {
+ if (props.guest.id) return props.guest.id;
+ return `${props.guest.instance}:${props.guest.node}:${props.guest.vmid}`;
+ };
+
const isVM = (guest: Guest): guest is VM => {
return guest.type === 'qemu';
};
@@ -97,20 +105,29 @@ export const GuestDrawer: Component<GuestDrawerProps> = (props) => {
return { type, id };
};
- const [activeTab, setActiveTab] = createSignal<'overview' | 'history' | 'discovery'>('overview');
+ const [activeTab, setActiveTab] = createSignal<'overview' | 'discovery'>('overview');
+
+ // All tabs are always rendered (hidden via CSS) to avoid any DOM
+ // mount/unmount during tab switches. Mounting new components inside
+ // a <For>-rendered table row causes SolidJS to recreate the row,
+ // which detaches the element and resets the scroll container.
+ const switchTab = (tab: 'overview' | 'discovery') => {
+ setActiveTab(tab);
+ };
+
+ const [historyRange, setHistoryRange] = createSignal<HistoryTimeRange>('1h');
+ const isHistoryLocked = () => !hasFeature('long_term_metrics') && (historyRange() === '30d' || historyRange() === '90d');
// Get discovery resource type for the guest
const discoveryResourceType = (): DiscoveryResourceType => {
return isVM(props.guest) ? 'vm' : 'lxc';
};
- const [historyRange, setHistoryRange] = createSignal<HistoryTimeRange>('24h');
-
return (
<div class="space-y-3">
{/* Tabs */}
<div class="flex items-center gap-6 border-b border-gray-200 dark:border-gray-700 px-1 mb-1">
<button
- onClick={() => setActiveTab('overview')}
+ onClick={() => switchTab('overview')}
class={`pb-2 text-sm font-medium transition-colors relative ${activeTab() === 'overview'
? 'text-blue-600 dark:text-blue-400'
: 'text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200'
@@ -122,19 +139,7 @@ export const GuestDrawer: Component<GuestDrawerProps> = (props) => {
)}
</button>
<button
- onClick={() => setActiveTab('history')}
- class={`pb-2 text-sm font-medium transition-colors relative ${activeTab() === 'history'
- ? 'text-blue-600 dark:text-blue-400'
- : 'text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200'
- }`}
- >
- History
- {activeTab() === 'history' && (
- <div class="absolute bottom-0 left-0 right-0 h-0.5 bg-blue-600 dark:bg-blue-400 rounded-t-full" />
- )}
- </button>
- <button
- onClick={() => setActiveTab('discovery')}
+ onClick={() => switchTab('discovery')}
class={`pb-2 text-sm font-medium transition-colors relative ${activeTab() === 'discovery'
? 'text-blue-600 dark:text-blue-400'
: 'text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200'
@@ -147,228 +152,343 @@ export const GuestDrawer: Component<GuestDrawerProps> = (props) => {
</button>
</div>
- <Show when={activeTab() === 'overview'}>
- {/* Flex layout - items grow to fill space, max ~4 per row */}
- <div class="flex flex-wrap gap-3 [&>*]:flex-1 [&>*]:basis-[calc(25%-0.75rem)] [&>*]:min-w-[200px] [&>*]:max-w-full">
- {/* System Info - always show */}
- <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={props.guest.cpus}>
- <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">{props.guest.cpus}</span>
- </div>
- </Show>
- <Show when={props.guest.uptime > 0}>
- <div class="flex items-center justify-between">
- <span class="text-gray-500 dark:text-gray-400">Uptime</span>
- <span class="font-medium text-gray-700 dark:text-gray-200">{formatUptime(props.guest.uptime)}</span>
- </div>
- </Show>
- <Show when={props.guest.node}>
- <div class="flex items-center justify-between">
- <span class="text-gray-500 dark:text-gray-400">Node</span>
- <span class="font-medium text-gray-700 dark:text-gray-200">{props.guest.node}</span>
- </div>
- </Show>
- <Show when={hasAgentInfo()}>
- <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 truncate ml-2" title={isVM(props.guest) ? `QEMU guest agent ${agentVersion()}` : agentVersion()}>
- {isVM(props.guest) ? `QEMU ${agentVersion()}` : agentVersion()}
- </span>
- </div>
- </Show>
- </div>
- </div>
-
- {/* Guest Info - OS and IPs */}
- <Show when={hasOsInfo() || ipAddresses().length > 0}>
+ {/* Use CSS hidden instead of Show to avoid mount/unmount which causes scroll jumps.
+ overflow-anchor: none prevents browser scroll anchoring from jumping when display toggles. */}
+ <div class={activeTab() === 'overview' ? '' : 'hidden'} style={{ "overflow-anchor": "none" }}>
+ {/* Flex layout - items grow to fill space, max ~4 per row */}
+ <div class="flex flex-wrap gap-3 [&>*]:flex-1 [&>*]:basis-[calc(25%-0.75rem)] [&>*]:min-w-[200px] [&>*]:max-w-full">
+ {/* System Info - always show */}
<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">Guest Info</div>
- <div class="space-y-2">
- <Show when={hasOsInfo()}>
- <div class="text-[11px] text-gray-600 dark:text-gray-300">
- <Show when={osName().length > 0}>
- <span class="font-medium">{osName()}</span>
- </Show>
- <Show when={osName().length > 0 && osVersion().length > 0}>
- <span class="text-gray-400 dark:text-gray-500 mx-1">•</span>
- </Show>
- <Show when={osVersion().length > 0}>
- <span>{osVersion()}</span>
- </Show>
+ <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={props.guest.cpus}>
+ <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">{props.guest.cpus}</span>
</div>
</Show>
- <Show when={ipAddresses().length > 0}>
- <div class="flex flex-wrap gap-1">
- <For each={ipAddresses()}>
- {(ip) => (
- <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" title={ip}>
- {ip}
- </span>
- )}
- </For>
+ <Show when={props.guest.uptime > 0}>
+ <div class="flex items-center justify-between">
+ <span class="text-gray-500 dark:text-gray-400">Uptime</span>
+ <span class="font-medium text-gray-700 dark:text-gray-200">{formatUptime(props.guest.uptime)}</span>
+ </div>
+ </Show>
+ <Show when={props.guest.node}>
+ <div class="flex items-center justify-between">
+ <span class="text-gray-500 dark:text-gray-400">Node</span>
+ <span class="font-medium text-gray-700 dark:text-gray-200">{props.guest.node}</span>
+ </div>
+ </Show>
+ <Show when={hasAgentInfo()}>
+ <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 truncate ml-2" title={isVM(props.guest) ? `QEMU guest agent ${agentVersion()}` : agentVersion()}>
+ {isVM(props.guest) ? `QEMU ${agentVersion()}` : agentVersion()}
+ </span>
</div>
</Show>
</div>
</div>
- </Show>
- {/* Memory Details */}
- <Show when={memoryExtraLines() && memoryExtraLines()!.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">Memory</div>
- <div class="space-y-1 text-[11px] text-gray-600 dark:text-gray-300">
- <For each={memoryExtraLines()!}>{(line) => <div>{line}</div>}</For>
+ {/* Guest Info - OS and IPs */}
+ <Show when={hasOsInfo() || ipAddresses().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">Guest Info</div>
+ <div class="space-y-2">
+ <Show when={hasOsInfo()}>
+ <div class="text-[11px] text-gray-600 dark:text-gray-300">
+ <Show when={osName().length > 0}>
+ <span class="font-medium">{osName()}</span>
+ </Show>
+ <Show when={osName().length > 0 && osVersion().length > 0}>
+ <span class="text-gray-400 dark:text-gray-500 mx-1">•</span>
+ </Show>
+ <Show when={osVersion().length > 0}>
+ <span>{osVersion()}</span>
+ </Show>
+ </div>
+ </Show>
+ <Show when={ipAddresses().length > 0}>
+ <div class="flex flex-wrap gap-1">
+ <For each={ipAddresses()}>
+ {(ip) => (
+ <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" title={ip}>
+ {ip}
+ </span>
+ )}
+ </For>
+ </div>
+ </Show>
+ </div>
</div>
- </div>
- </Show>
+ </Show>
- {/* Backup Info */}
- <Show when={props.guest.lastBackup}>
- <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">Backup</div>
- <div class="space-y-1 text-[11px]">
- {(() => {
- const backupDate = new Date(props.guest.lastBackup);
- const now = new Date();
- const daysSince = Math.floor((now.getTime() - backupDate.getTime()) / (1000 * 60 * 60 * 24));
- const isOld = daysSince > 7;
- const isCritical = daysSince > 30;
- return (
- <>
- <div class="flex items-center justify-between">
- <span class="text-gray-500 dark:text-gray-400">Last Backup</span>
- <span class={`font-medium ${isCritical ? 'text-red-600 dark:text-red-400' : isOld ? 'text-amber-600 dark:text-amber-400' : 'text-green-600 dark:text-green-400'}`}>
- {daysSince === 0 ? 'Today' : daysSince === 1 ? 'Yesterday' : `${daysSince}d ago`}
- </span>
- </div>
- <div class="text-[10px] text-gray-400 dark:text-gray-500">
- {backupDate.toLocaleDateString()}
- </div>
- </>
- );
- })()}
+ {/* Memory Details */}
+ <Show when={memoryExtraLines() && memoryExtraLines()!.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">Memory</div>
+ <div class="space-y-1 text-[11px] text-gray-600 dark:text-gray-300">
+ <For each={memoryExtraLines()!}>{(line) => <div>{line}</div>}</For>
+ </div>
</div>
- </div>
- </Show>
+ </Show>
- {/* Tags */}
- <Show when={props.guest.tags && (Array.isArray(props.guest.tags) ? props.guest.tags.length > 0 : props.guest.tags.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">Tags</div>
- <div class="flex flex-wrap gap-1">
- <For each={Array.isArray(props.guest.tags) ? props.guest.tags : (props.guest.tags?.split(',') || [])}>
- {(tag) => (
- <span class="inline-block rounded bg-gray-100 px-1.5 py-0.5 text-[10px] text-gray-700 dark:bg-gray-700 dark:text-gray-200">
- {tag.trim()}
- </span>
- )}
- </For>
+ {/* Backup Info */}
+ <Show when={props.guest.lastBackup}>
+ <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">Backup</div>
+ <div class="space-y-1 text-[11px]">
+ {(() => {
+ const backupDate = new Date(props.guest.lastBackup);
+ const now = new Date();
+ const daysSince = Math.floor((now.getTime() - backupDate.getTime()) / (1000 * 60 * 60 * 24));
+ const isOld = daysSince > 7;
+ const isCritical = daysSince > 30;
+ return (
+ <>
+ <div class="flex items-center justify-between">
+ <span class="text-gray-500 dark:text-gray-400">Last Backup</span>
+ <span class={`font-medium ${isCritical ? 'text-red-600 dark:text-red-400' : isOld ? 'text-amber-600 dark:text-amber-400' : 'text-green-600 dark:text-green-400'}`}>
+ {daysSince === 0 ? 'Today' : daysSince === 1 ? 'Yesterday' : `${daysSince}d ago`}
+ </span>
+ </div>
+ <div class="text-[10px] text-gray-400 dark:text-gray-500">
+ {backupDate.toLocaleDateString()}
+ </div>
+ </>
+ );
+ })()}
+ </div>
</div>
- </div>
- </Show>
+ </Show>
- {/* Filesystems */}
- <Show when={hasFilesystemDetails() && props.guest.disks && props.guest.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">Filesystems</div>
- <div class="text-[11px] text-gray-600 dark:text-gray-300">
- <DiskList
- disks={props.guest.disks || []}
- diskStatusReason={isVM(props.guest) ? props.guest.diskStatusReason : undefined}
- />
+ {/* Tags */}
+ <Show when={props.guest.tags && (Array.isArray(props.guest.tags) ? props.guest.tags.length > 0 : props.guest.tags.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">Tags</div>
+ <div class="flex flex-wrap gap-1">
+ <For each={Array.isArray(props.guest.tags) ? props.guest.tags : (props.guest.tags?.split(',') || [])}>
+ {(tag) => (
+ <span class="inline-block rounded bg-gray-100 px-1.5 py-0.5 text-[10px] text-gray-700 dark:bg-gray-700 dark:text-gray-200">
+ {tag.trim()}
+ </span>
+ )}
+ </For>
+ </div>
</div>
- </div>
- </Show>
+ </Show>
- {/* Network Interfaces */}
- <Show when={hasNetworkInterfaces()}>
- <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">
- <For each={networkInterfaces().slice(0, 4)}>
- {(iface) => {
- const addresses = iface.addresses ?? [];
- const hasTraffic = (iface.rxBytes ?? 0) > 0 || (iface.txBytes ?? 0) > 0;
- return (
- <div class="rounded border border-dashed border-gray-200 p-2 dark:border-gray-700">
- <div class="flex items-center gap-2 text-[11px] font-medium text-gray-700 dark:text-gray-200">
- <span class="truncate">{iface.name || 'interface'}</span>
- <Show when={iface.mac}>
- <span class="text-[9px] text-gray-400 dark:text-gray-500 font-normal">{iface.mac}</span>
+ {/* Filesystems */}
+ <Show when={hasFilesystemDetails() && props.guest.disks && props.guest.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">Filesystems</div>
+ <div class="text-[11px] text-gray-600 dark:text-gray-300">
+ <DiskList
+ disks={props.guest.disks || []}
+ diskStatusReason={isVM(props.guest) ? props.guest.diskStatusReason : undefined}
+ />
+ </div>
+ </div>
+ </Show>
+
+ {/* Network Interfaces */}
+ <Show when={hasNetworkInterfaces()}>
+ <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">
+ <For each={networkInterfaces().slice(0, 4)}>
+ {(iface) => {
+ const addresses = iface.addresses ?? [];
+ const hasTraffic = (iface.rxBytes ?? 0) > 0 || (iface.txBytes ?? 0) > 0;
+ return (
+ <div class="rounded border border-dashed border-gray-200 p-2 dark:border-gray-700">
+ <div class="flex items-center gap-2 text-[11px] font-medium text-gray-700 dark:text-gray-200">
+ <span class="truncate">{iface.name || 'interface'}</span>
+ <Show when={iface.mac}>
+ <span class="text-[9px] text-gray-400 dark:text-gray-500 font-normal">{iface.mac}</span>
+ </Show>
+ </div>
+ <Show when={addresses.length > 0}>
+ <div class="flex flex-wrap gap-1 mt-1">
+ <For each={addresses}>
+ {(ip) => (
+ <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">
+ {ip}
+ </span>
+ )}
+ </For>
+ </div>
+ </Show>
+ <Show when={hasTraffic}>
+ <div class="flex gap-3 mt-1 text-[10px] text-gray-500 dark:text-gray-400">
+ <span>RX {formatBytes(iface.rxBytes ?? 0)}</span>
+ <span>TX {formatBytes(iface.txBytes ?? 0)}</span>
+ </div>
</Show>
</div>
- <Show when={addresses.length > 0}>
- <div class="flex flex-wrap gap-1 mt-1">
- <For each={addresses}>
- {(ip) => (
- <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">
- {ip}
- </span>
- )}
- </For>
- </div>
- </Show>
- <Show when={hasTraffic}>
- <div class="flex gap-3 mt-1 text-[10px] text-gray-500 dark:text-gray-400">
- <span>RX {formatBytes(iface.rxBytes ?? 0)}</span>
- <span>TX {formatBytes(iface.txBytes ?? 0)}</span>
- </div>
- </Show>
- </div>
- );
- }}
- </For>
+ );
+ }}
+ </For>
+ </div>
</div>
+ </Show>
+ </div>
+
+ {/* Performance History */}
+ <div class="mt-3 space-y-3">
+ {/* Shared range selector */}
+ <div class="flex items-center gap-2">
+ <svg class="w-3.5 h-3.5 text-gray-400" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
+ <circle cx="12" cy="12" r="10" />
+ <path stroke-linecap="round" d="M12 6v6l4 2" />
+ </svg>
+ <select
+ value={historyRange()}
+ onChange={(e) => setHistoryRange(e.currentTarget.value as HistoryTimeRange)}
+ class="text-[11px] font-medium pl-2 pr-6 py-1 rounded-md border border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 cursor-pointer focus:ring-1 focus:ring-blue-500 focus:border-blue-500 appearance-none"
+ style={{ "background-image": "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E\")", "background-repeat": "no-repeat", "background-position": "right 6px center" }}
+ >
+ <option value="1h">Last 1 hour</option>
+ <option value="6h">Last 6 hours</option>
+ <option value="12h">Last 12 hours</option>
+ <option value="24h">Last 24 hours</option>
+ <option value="7d">Last 7 days</option>
+ <option value="30d">Last 30 days</option>
+ <option value="90d">Last 90 days</option>
+ </select>
</div>
- </Show>
- </div>
- </Show>
-
- <Show when={activeTab() === 'history'}>
- <div class="space-y-6">
- {/* Toolbar: Range */}
- <div class="flex flex-wrap items-center gap-2 bg-gray-50 dark:bg-gray-800/50 p-2 rounded-lg border border-gray-100 dark:border-gray-700/50 shadow-sm">
- <div class="flex items-center gap-2 sm:ml-auto">
- <span class="text-[10px] font-semibold text-gray-400 uppercase tracking-widest">Range</span>
- <div class="flex bg-gray-100 dark:bg-gray-700 rounded-md p-0.5">
- {(['24h', '7d', '30d', '90d'] as HistoryTimeRange[]).map(r => (
- <button
- onClick={() => setHistoryRange(r)}
- class={`px-2.5 py-1 text-[10px] font-semibold rounded-md transition-all ${historyRange() === r
- ? 'bg-white dark:bg-gray-600 text-blue-600 dark:text-blue-400 shadow-sm'
- : 'text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white'
- }`}
- >
- {r}
- </button>
- ))}
+
+ <div class="relative">
+ <div class="space-y-3">
+ <div class="flex flex-wrap gap-3 [&>*]:flex-1 [&>*]:basis-[calc(33.333%-0.5rem)] [&>*]:min-w-[250px]">
+ <div class="rounded border border-gray-200 bg-white/70 p-3 shadow-sm dark:border-gray-600/70 dark:bg-gray-900/30">
+ <HistoryChart
+ resourceType={metricsResource().type}
+ resourceId={metricsResource().id}
+ metric="cpu"
+ height={120}
+ color="#8b5cf6"
+ label="CPU"
+ unit="%"
+ range={historyRange()}
+ hideSelector={true}
+ compact={true}
+ hideLock={true}
+ />
+ </div>
+ <div class="rounded border border-gray-200 bg-white/70 p-3 shadow-sm dark:border-gray-600/70 dark:bg-gray-900/30">
+ <HistoryChart
+ resourceType={metricsResource().type}
+ resourceId={metricsResource().id}
+ metric="memory"
+ height={120}
+ color="#f59e0b"
+ label="Memory"
+ unit="%"
+ range={historyRange()}
+ hideSelector={true}
+ compact={true}
+ hideLock={true}
+ />
+ </div>
+ <div class="rounded border border-gray-200 bg-white/70 p-3 shadow-sm dark:border-gray-600/70 dark:bg-gray-900/30">
+ <HistoryChart
+ resourceType={metricsResource().type}
+ resourceId={metricsResource().id}
+ metric="disk"
+ height={120}
+ color="#10b981"
+ label="Disk"
+ unit="%"
+ range={historyRange()}
+ hideSelector={true}
+ compact={true}
+ hideLock={true}
+ />
+ </div>
+ </div>
+
+ <div class="flex flex-wrap gap-3 [&>*]:flex-1 [&>*]:basis-[calc(50%-0.375rem)] [&>*]:min-w-[250px]">
+ <div class="rounded border border-gray-200 bg-white/70 p-3 shadow-sm dark:border-gray-600/70 dark:bg-gray-900/30">
+ <HistoryChart
+ resourceType={metricsResource().type}
+ resourceId={metricsResource().id}
+ metric="netin"
+ height={120}
+ color="#3b82f6"
+ label="Net In"
+ unit="B/s"
+ range={historyRange()}
+ hideSelector={true}
+ compact={true}
+ hideLock={true}
+ />
+ </div>
+ <div class="rounded border border-gray-200 bg-white/70 p-3 shadow-sm dark:border-gray-600/70 dark:bg-gray-900/30">
+ <HistoryChart
+ resourceType={metricsResource().type}
+ resourceId={metricsResource().id}
+ metric="netout"
+ height={120}
+ color="#6366f1"
+ label="Net Out"
+ unit="B/s"
+ range={historyRange()}
+ hideSelector={true}
+ compact={true}
+ hideLock={true}
+ />
+ </div>
+ </div>
</div>
+
+ {/* Single shared Pro lock overlay */}
+ <Show when={isHistoryLocked()}>
+ <div class="absolute inset-0 z-10 flex flex-col items-center justify-center backdrop-blur-sm bg-white/60 dark:bg-gray-900/60 rounded-lg">
+ <div class="bg-gradient-to-br from-indigo-500 to-purple-600 rounded-full p-3 shadow-lg mb-3">
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect>
+ <path d="M7 11V7a5 5 0 0 1 10 0v4"></path>
+ </svg>
+ </div>
+ <h3 class="text-lg font-bold text-gray-900 dark:text-white mb-1">{historyRange() === '30d' ? '30' : '90'}-Day History</h3>
+ <p class="text-sm text-gray-600 dark:text-gray-300 text-center max-w-[260px] mb-4">
+ Upgrade to Pulse Pro to unlock {historyRange() === '30d' ? '30' : '90'} days of historical data retention.
+ </p>
+ <a
+ href="https://pulserelay.pro/pricing"
+ target="_blank"
+ class="px-4 py-2 bg-indigo-600 hover:bg-indigo-700 text-white text-sm font-medium rounded-md shadow-sm transition-colors"
+ >
+ Unlock Pro Features
+ </a>
+ </div>
+ </Show>
</div>
</div>
+ </div>
- <UnifiedHistoryChart
- resourceType={metricsResource().type}
- resourceId={metricsResource().id}
- label="Resource Performance"
- height={280}
- range={historyRange()}
- hideSelector={true}
- />
+ {/* Always rendered, hidden via CSS. Wrapped in a local Suspense
+ so DiscoveryTab's createResource loading state doesn't bubble
+ up to the app-level Suspense and replace the entire page. */}
+ <div class={activeTab() === 'discovery' ? '' : 'hidden'} style={{ "overflow-anchor": "none" }}>
+ <Suspense fallback={
+ <div class="flex items-center justify-center py-8">
+ <div class="animate-spin h-6 w-6 border-2 border-blue-500 border-t-transparent rounded-full" />
+ <span class="ml-2 text-sm text-gray-500 dark:text-gray-400">Loading discovery...</span>
+ </div>
+ }>
+ <DiscoveryTab
+ resourceType={discoveryResourceType()}
+ hostId={props.guest.node}
+ resourceId={String(props.guest.vmid)}
+ hostname={props.guest.name}
+ guestId={guestId()}
+ customUrl={props.customUrl}
+ onCustomUrlChange={(url) => props.onCustomUrlChange?.(guestId(), url)}
+ />
+ </Suspense>
</div>
- </Show>
-
- <Show when={activeTab() === 'discovery'}>
- <DiscoveryTab
- resourceType={discoveryResourceType()}
- hostId={props.guest.node}
- resourceId={String(props.guest.vmid)}
- hostname={props.guest.name}
- />
- </Show>
</div>
);
};
diff --git a/frontend-modern/src/components/Dashboard/GuestRow.tsx b/frontend-modern/src/components/Dashboard/GuestRow.tsx
index 657f17cbb4..27054d7267 100644
--- a/frontend-modern/src/components/Dashboard/GuestRow.tsx
+++ b/frontend-modern/src/components/Dashboard/GuestRow.tsx
@@ -9,10 +9,6 @@ import { StackedMemoryBar } from './StackedMemoryBar';
import { StatusDot } from '@/components/shared/StatusDot';
import { getGuestPowerIndicator, isGuestRunning } from '@/utils/status';
-import { GuestMetadataAPI } from '@/api/guestMetadata';
-import { UrlEditPopover, createUrlEditState } from '@/components/shared/UrlEditPopover';
-import { showSuccess, showError } from '@/utils/toast';
-import { logger } from '@/utils/logger';
import { buildMetricKey } from '@/utils/metricsKeys';
import { type ColumnPriority } from '@/hooks/useBreakpoint';
import { ResponsiveMetricCell } from '@/components/shared/responsive';
@@ -343,31 +339,26 @@ function BackupStatusCell(props: { lastBackup: string | number | null | undefine
return (
<>
<span
- class={`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] font-medium rounded ${config().bgColor} ${config().color}`}
+ class={`flex-shrink-0 cursor-help ${config().color}`}
onMouseEnter={handleMouseEnter}
onMouseLeave={handleMouseLeave}
+ aria-label={`Backup status: ${info().status}`}
>
- {/* Status icon */}
- <Show when={info().status === 'fresh'}>
- <svg class="w-3 h-3" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5">
- <path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7" />
- </svg>
- </Show>
- <Show when={info().status === 'stale'}>
- <svg class="w-3 h-3" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
- <path stroke-linecap="round" stroke-linejoin="round" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
- </svg>
- </Show>
- <Show when={info().status === 'critical' || info().status === 'never'}>
- <svg class="w-3 h-3" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5">
- <path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
- </svg>
- </Show>
- {/* Status text */}
- {info().status === 'fresh' && 'OK'}
- {info().status === 'stale' && info().ageFormatted}
- {info().status === 'critical' && info().ageFormatted}
- {info().status === 'never' && 'Never'}
+ <svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ {/* Shield shape */}
+ <path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" />
+
+ {/* Inner icon based on status */}
+ <Show when={config().icon === 'check'}>
+ <path d="m9 12 2 2 4-4" />
+ </Show>
+ <Show when={config().icon === 'warning'}>
+ <path d="M12 8v4M12 16h.01" />
+ </Show>
+ <Show when={config().icon === 'x'}>
+ <path d="M10 10l4 4M14 10l-4 4" />
+ </Show>
+ </svg>
</span>
<Show when={showTooltip()}>
@@ -522,70 +513,6 @@ export function GuestRow(props: GuestRowProps) {
const diskAnomaly = useAnomalyForMetric(() => props.guest.id, () => 'disk');
const [customUrl, setCustomUrl] = createSignal<string | undefined>(props.customUrl);
- const [shouldAnimateIcon, setShouldAnimateIcon] = createSignal(false);
-
- // URL editing using shared hook
- const urlEdit = createUrlEditState();
-
- const handleStartEditingUrl = (event: MouseEvent) => {
- urlEdit.startEditing(guestId(), customUrl() || '', event);
- };
-
- const handleSaveUrl = async () => {
- const newUrl = urlEdit.editingValue().trim();
- urlEdit.setIsSaving(true);
-
- 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');
- }
-
- urlEdit.finishEditing();
- } 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);
- urlEdit.setIsSaving(false);
- }
- };
-
- const handleDeleteUrl = async () => {
- urlEdit.setIsSaving(true);
-
- try {
- await GuestMetadataAPI.updateMetadata(guestId(), { customUrl: '' });
-
- setCustomUrl(undefined);
-
- if (props.onCustomUrlUpdate) {
- props.onCustomUrlUpdate(guestId(), '');
- }
-
- showSuccess('Guest URL removed');
- urlEdit.finishEditing();
- } catch (err: unknown) {
- const message = err instanceof Error ? err.message : 'Failed to remove guest URL';
- logger.error('Failed to remove guest URL:', err);
- showError(message);
- urlEdit.setIsSaving(false);
- }
- };
const ipAddresses = createMemo(() => props.guest.ipAddresses ?? []);
const networkInterfaces = createMemo(() => props.guest.networkInterfaces ?? []);
@@ -615,18 +542,7 @@ export function GuestRow(props: GuestRowProps) {
// Update custom URL when prop changes
createEffect(() => {
- const prevUrl = customUrl();
- const newUrl = props.customUrl;
-
- // Only animate when URL transitions from empty to having a value
- // Use a tracking variable to prevent initial mount animation if desired, but here we want to animate on first add
- if (prevUrl === undefined && newUrl) {
- setShouldAnimateIcon(true);
- // Remove animation class after it completes
- setTimeout(() => setShouldAnimateIcon(false), 200);
- }
-
- setCustomUrl(newUrl);
+ setCustomUrl(props.customUrl);
});
const cpuPercent = createMemo(() => (props.guest.cpu || 0) * 100);
@@ -791,7 +707,7 @@ export function GuestRow(props: GuestRowProps) {
href={customUrl()}
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' : ''}`}
+ class="flex-shrink-0 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 transition-colors"
title={`Open ${customUrl()}`}
onClick={(event) => event.stopPropagation()}
>
@@ -810,17 +726,6 @@ export function GuestRow(props: GuestRowProps) {
</svg>
</a>
</Show>
- {/* Edit URL button - shows on hover */}
- <button
- type="button"
- onClick={handleStartEditingUrl}
- 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} />
@@ -1100,20 +1005,6 @@ export function GuestRow(props: GuestRowProps) {
</Show>
</tr>
- {/* URL editing popover - using shared component */}
- <UrlEditPopover
- isOpen={urlEdit.isEditing() && urlEdit.editingId() === guestId()}
- value={urlEdit.editingValue()}
- position={urlEdit.position()}
- isSaving={urlEdit.isSaving()}
- hasExistingUrl={!!customUrl()}
- placeholder="https://192.168.1.100:8080"
- helpText="Add a URL to quickly access this guest's web interface"
- onValueChange={urlEdit.setEditingValue}
- onSave={handleSaveUrl}
- onCancel={urlEdit.cancelEditing}
- onDelete={handleDeleteUrl}
- />
</>
);
}
diff --git a/frontend-modern/src/components/Dashboard/InvestigateProblemsButton.tsx b/frontend-modern/src/components/Dashboard/InvestigateProblemsButton.tsx
deleted file mode 100644
index e65d9f07ae..0000000000
--- a/frontend-modern/src/components/Dashboard/InvestigateProblemsButton.tsx
+++ /dev/null
@@ -1,156 +0,0 @@
-import { Component, Show, createMemo } from 'solid-js';
-import { aiChatStore } from '@/stores/aiChat';
-import type { VM, Container } from '@/types/api';
-import { getBackupInfo } from '@/utils/format';
-import { DEGRADED_HEALTH_STATUSES, OFFLINE_HEALTH_STATUSES } from '@/utils/status';
-import { useAlertsActivation } from '@/stores/alertsActivation';
-
-interface ProblemGuest {
- guest: VM | Container;
- issues: string[];
-}
-
-interface InvestigateProblemsButtonProps {
- /** The filtered guests currently showing as "problems" */
- problemGuests: (VM | Container)[];
- /** Whether the problems filter is active */
- isProblemsMode: boolean;
-}
-
-/**
- * "Investigate Problems with AI" button.
- * Appears when the Problems filter is active and finds results.
- * Opens AI chat with rich context about all problem guests.
- */
-export const InvestigateProblemsButton: Component<InvestigateProblemsButtonProps> = (props) => {
- // Analyze each guest to determine what issues they have
- const analyzedProblems = createMemo((): ProblemGuest[] => {
- return props.problemGuests.map(guest => {
- const issues: string[] = [];
-
- // Check for degraded status
- const status = (guest.status || '').toLowerCase();
- const isDegraded = DEGRADED_HEALTH_STATUSES.has(status) ||
- (status !== 'running' && !OFFLINE_HEALTH_STATUSES.has(status) && status !== 'stopped');
- if (isDegraded) {
- issues.push(`Status: ${status || 'unknown'}`);
- }
-
- // Check for backup issues
- if (!guest.template) {
- const alertsActivation = useAlertsActivation();
- const backupInfo = getBackupInfo(guest.lastBackup, alertsActivation.getBackupThresholds());
- if (backupInfo.status === 'critical') {
- issues.push('Backup: Critical (very overdue)');
- } else if (backupInfo.status === 'stale') {
- issues.push('Backup: Stale');
- } else if (backupInfo.status === 'never') {
- issues.push('Backup: Never backed up');
- }
- }
-
- // Check for high CPU
- if (guest.cpu > 0.9) {
- issues.push(`CPU: ${(guest.cpu * 100).toFixed(0)}%`);
- }
-
- // Check for high memory
- if (guest.memory && guest.memory.usage && guest.memory.usage > 90) {
- issues.push(`Memory: ${guest.memory.usage.toFixed(0)}%`);
- }
-
- return { guest, issues };
- }).filter(p => p.issues.length > 0);
- });
-
- const handleClick = (e: MouseEvent) => {
- e.stopPropagation();
- e.preventDefault();
-
- const problems = analyzedProblems();
- if (problems.length === 0) return;
-
- // Build a rich prompt with all problem details
- const problemSummary = problems.map(({ guest, issues }) => {
- const type = guest.type === 'qemu' ? 'VM' : 'LXC';
- return `- **${guest.name}** (${type} ${guest.vmid} on ${guest.node}): ${issues.join(', ')}`;
- }).join('\n');
-
- // Categorize issues for better AI understanding
- const issueCategories = {
- backup: problems.filter(p => p.issues.some(i => i.startsWith('Backup:'))).length,
- cpu: problems.filter(p => p.issues.some(i => i.startsWith('CPU:'))).length,
- memory: problems.filter(p => p.issues.some(i => i.startsWith('Memory:'))).length,
- status: problems.filter(p => p.issues.some(i => i.startsWith('Status:'))).length,
- };
-
- const categoryBreakdown = Object.entries(issueCategories)
- .filter(([, count]) => count > 0)
- .map(([type, count]) => `${count} ${type}`)
- .join(', ');
-
- const prompt = `I have ${problems.length} guest${problems.length !== 1 ? 's' : ''} that need attention (${categoryBreakdown}):
-
-${problemSummary}
-
-Please help me:
-1. **Prioritize** - Which issues should I address first?
-2. **Investigate** - For the most critical issues, check their current status
-3. **Remediate** - Suggest specific steps to resolve each issue
-4. **Prevent** - Recommend any configuration changes to prevent these issues
-
-Start with the most critical problems first.`;
-
- // Open AI chat with this rich context
- aiChatStore.openWithPrompt(prompt, {
- context: {
- problemCount: problems.length,
- issueCategories,
- guests: problems.map(p => ({
- id: p.guest.id,
- name: p.guest.name,
- vmid: p.guest.vmid,
- type: p.guest.type,
- node: p.guest.node,
- issues: p.issues,
- })),
- },
- });
- };
-
- // Only show if problems mode is active AND there are results AND AI is enabled
- const shouldShow = createMemo(() =>
- props.isProblemsMode && props.problemGuests.length > 0 && aiChatStore.enabled === true
- );
-
- return (
- <Show when={shouldShow()}>
- <button
- type="button"
- onClick={handleClick}
- class="inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-semibold rounded-lg
- bg-gradient-to-r from-purple-500 to-blue-500
- hover:from-purple-600 hover:to-blue-600
- text-white shadow-md shadow-purple-500/25
- hover:shadow-lg hover:shadow-purple-500/30
- transition-all duration-150 active:scale-95
- ring-1 ring-purple-400/50"
- title={`Ask Pulse Assistant to help investigate and resolve ${props.problemGuests.length} problem${props.problemGuests.length !== 1 ? 's' : ''}`}
- >
- <svg class="w-3.5 h-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"
- />
- </svg>
- <span>Investigate {props.problemGuests.length} with Pulse Assistant</span>
- <svg class="w-3 h-3 opacity-70" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
- <path stroke-linecap="round" stroke-linejoin="round" d="M13 7l5 5m0 0l-5 5m5-5H6" />
- </svg>
- </button>
- </Show>
- );
-};
-
-export default InvestigateProblemsButton;
diff --git a/frontend-modern/src/components/Discovery/DiscoveryTab.tsx b/frontend-modern/src/components/Discovery/DiscoveryTab.tsx
index 4ff1d8d00f..7e5a414f28 100644
--- a/frontend-modern/src/components/Discovery/DiscoveryTab.tsx
+++ b/frontend-modern/src/components/Discovery/DiscoveryTab.tsx
@@ -8,6 +8,7 @@ import {
getCategoryDisplayName,
getConfidenceLevel,
} from '../../api/discovery';
+import { GuestMetadataAPI } from '../../api/guestMetadata';
import { eventBus } from '../../stores/events';
interface DiscoveryTabProps {
@@ -15,6 +16,12 @@ interface DiscoveryTabProps {
hostId: string;
resourceId: string;
hostname: string;
+ /** Canonical guest ID used for metadata API calls */
+ guestId?: string;
+ /** Current custom URL for this guest */
+ customUrl?: string;
+ /** Called after a URL is saved or deleted so the parent can update its state */
+ onCustomUrlChange?: (url: string) => void;
}
// Construct the resource ID in the same format the backend uses
@@ -25,6 +32,43 @@ const makeResourceId = (type: ResourceType, hostId: string, resourceId: string)
export const DiscoveryTab: Component<DiscoveryTabProps> = (props) => {
const [isScanning, setIsScanning] = createSignal(false);
const [editingNotes, setEditingNotes] = createSignal(false);
+
+ // --- Guest URL editing state ---
+ const [urlValue, setUrlValue] = createSignal(props.customUrl ?? '');
+ const [urlSaving, setUrlSaving] = createSignal(false);
+
+ // Keep local value in sync with prop changes
+ createEffect(() => {
+ setUrlValue(props.customUrl ?? '');
+ });
+
+ const handleSaveUrl = async () => {
+ if (!props.guestId) return;
+ const trimmed = urlValue().trim();
+ setUrlSaving(true);
+ try {
+ await GuestMetadataAPI.updateMetadata(props.guestId, { customUrl: trimmed });
+ props.onCustomUrlChange?.(trimmed);
+ } catch (err) {
+ console.error('Failed to save guest URL:', err);
+ } finally {
+ setUrlSaving(false);
+ }
+ };
+
+ const handleDeleteUrl = async () => {
+ if (!props.guestId) return;
+ setUrlSaving(true);
+ try {
+ await GuestMetadataAPI.updateMetadata(props.guestId, { customUrl: '' });
+ setUrlValue('');
+ props.onCustomUrlChange?.('');
+ } catch (err) {
+ console.error('Failed to remove guest URL:', err);
+ } finally {
+ setUrlSaving(false);
+ }
+ };
const [notesText, setNotesText] = createSignal('');
const [saveError, setSaveError] = createSignal<string | null>(null);
const [scanProgress, setScanProgress] = createSignal<DiscoveryProgress | null>(null);
@@ -409,6 +453,48 @@ export const DiscoveryTab: Component<DiscoveryTabProps> = (props) => {
</details>
</Show>
+ {/* Web Interface URL */}
+ <Show when={props.guestId}>
+ <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">
+ Web Interface URL
+ </div>
+ <div class="flex items-center gap-2">
+ <input
+ type="url"
+ class="flex-1 text-xs px-2.5 py-1.5 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:ring-1 focus:ring-blue-500 focus:border-blue-500 transition-colors"
+ placeholder="https://192.168.1.100:8080"
+ value={urlValue()}
+ onInput={(e) => setUrlValue(e.currentTarget.value)}
+ onKeyDown={(e) => { if (e.key === 'Enter') handleSaveUrl(); }}
+ disabled={urlSaving()}
+ />
+ <button
+ type="button"
+ class="px-2.5 py-1.5 text-xs font-medium rounded-md bg-blue-600 text-white hover:bg-blue-700 disabled:opacity-50 transition-colors"
+ disabled={urlSaving() || urlValue().trim() === (props.customUrl ?? '')}
+ onClick={handleSaveUrl}
+ >
+ Save
+ </button>
+ <Show when={props.customUrl}>
+ <button
+ type="button"
+ class="px-2.5 py-1.5 text-xs font-medium rounded-md text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-900/20 disabled:opacity-50 transition-colors"
+ disabled={urlSaving()}
+ onClick={handleDeleteUrl}
+ title="Remove URL"
+ >
+ Remove
+ </button>
+ </Show>
+ </div>
+ <p class="mt-1.5 text-[10px] text-gray-400 dark:text-gray-500">
+ Add a URL to quickly access this guest's web interface from the dashboard.
+ </p>
+ </div>
+ </Show>
+
{/* Footer with Update button */}
<div class="flex items-center justify-between pt-2 border-t border-gray-200 dark:border-gray-700">
<span class="text-xs text-gray-500 dark:text-gray-400">