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.

Enhance discovery UI and table consistency

rcourtmana1b9de8f1068
diff --git a/frontend-modern/src/api/charts.ts b/frontend-modern/src/api/charts.ts
index 9a5ed45e3b..827455228b 100644
--- a/frontend-modern/src/api/charts.ts
+++ b/frontend-modern/src/api/charts.ts
@@ -48,7 +48,7 @@ export interface ChartsResponse {
// Persistent metrics history types (SQLite-backed, longer retention)
export type HistoryTimeRange = '1h' | '6h' | '12h' | '24h' | '7d' | '30d' | '90d';
-export type ResourceType = 'node' | 'guest' | 'vm' | 'container' | 'storage' | 'docker' | 'dockerHost';
+export type ResourceType = 'node' | 'guest' | 'vm' | 'container' | 'storage' | 'docker' | 'dockerHost' | 'k8s' | 'host';
export interface MetricsHistoryParams {
resourceType: ResourceType;
diff --git a/frontend-modern/src/api/kubernetesMetadata.ts b/frontend-modern/src/api/kubernetesMetadata.ts
new file mode 100644
index 0000000000..e0ccc56ae7
--- /dev/null
+++ b/frontend-modern/src/api/kubernetesMetadata.ts
@@ -0,0 +1,42 @@
+// Kubernetes Metadata API
+import { apiFetchJSON } from '@/utils/apiClient';
+
+export interface KubernetesMetadata {
+ id: string; // resource ID
+ customUrl?: string;
+ description?: string;
+ tags?: string[];
+ notes?: string[]; // User annotations for AI context
+}
+
+export class KubernetesMetadataAPI {
+ private static baseUrl = '/api/kubernetes/metadata';
+
+ // Get metadata for a specific kubernetes resource (pod, deployment, etc.)
+ static async getMetadata(resourceId: string): Promise<KubernetesMetadata> {
+ return apiFetchJSON(`${this.baseUrl}/${encodeURIComponent(resourceId)}`);
+ }
+
+ // Get all kubernetes metadata
+ static async getAllMetadata(): Promise<Record<string, KubernetesMetadata>> {
+ return apiFetchJSON(this.baseUrl);
+ }
+
+ // Update metadata for a kubernetes resource
+ static async updateMetadata(
+ resourceId: string,
+ metadata: Partial<KubernetesMetadata>,
+ ): Promise<KubernetesMetadata> {
+ return apiFetchJSON(`${this.baseUrl}/${encodeURIComponent(resourceId)}`, {
+ method: 'PUT',
+ body: JSON.stringify(metadata),
+ });
+ }
+
+ // Delete metadata for a kubernetes resource
+ static async deleteMetadata(resourceId: string): Promise<void> {
+ await apiFetchJSON(`${this.baseUrl}/${encodeURIComponent(resourceId)}`, {
+ method: 'DELETE',
+ });
+ }
+}
diff --git a/frontend-modern/src/components/Dashboard/Dashboard.tsx b/frontend-modern/src/components/Dashboard/Dashboard.tsx
index 59ba989dce..2d39cd69b6 100644
--- a/frontend-modern/src/components/Dashboard/Dashboard.tsx
+++ b/frontend-modern/src/components/Dashboard/Dashboard.tsx
@@ -1039,7 +1039,7 @@ export function Dashboard(props: DashboardProps) {
style={{
...((['cpu', 'memory', 'disk'].includes(col.id))
? { "width": isMobile() ? "60px" : "140px" }
- : (col.width && (!isMobile() || col.id !== 'name') ? { "width": col.width } : {})),
+ : (col.width ? { "width": col.width } : {})),
"vertical-align": 'middle'
}}
onClick={() => isSortable && handleSort(sortKeyForCol!)}
@@ -1103,6 +1103,7 @@ export function Dashboard(props: DashboardProps) {
isGroupedView={groupingMode() === 'grouped'}
visibleColumnIds={visibleColumnIds()}
onClick={() => setSelectedGuestId(selectedGuestId() === guestId ? null : guestId)}
+ isExpanded={selectedGuestId() === guestId}
/>
<Show when={selectedGuestId() === guestId}>
<tr>
diff --git a/frontend-modern/src/components/Dashboard/GuestRow.tsx b/frontend-modern/src/components/Dashboard/GuestRow.tsx
index 27054d7267..2c28e6811a 100644
--- a/frontend-modern/src/components/Dashboard/GuestRow.tsx
+++ b/frontend-modern/src/components/Dashboard/GuestRow.tsx
@@ -423,7 +423,7 @@ export interface GuestColumnDef {
export const GUEST_COLUMNS: GuestColumnDef[] = [
// Essential - always visible (fixed widths ensure no overlap)
- { id: 'name', label: 'Name', priority: 'essential', width: '120px', sortKey: 'name' },
+ { id: 'name', label: 'Name', priority: 'essential', width: '200px', sortKey: 'name' },
// Secondary - visible on md+ (Now essential for mobile scroll)
{ id: 'type', label: 'Type', priority: 'essential', width: '40px', sortKey: 'type' },
@@ -449,6 +449,9 @@ export const GUEST_COLUMNS: GuestColumnDef[] = [
{ id: 'diskWrite', label: 'D Write', 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="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12" /></svg>, priority: 'essential', width: '55px', toggleable: true, sortKey: 'diskWrite' },
{ id: 'netIn', label: 'Net In', icon: <svg class="w-3.5 h-3.5 block" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16l-4-4m0 0l4-4m-4 4h18" /></svg>, priority: 'essential', width: '55px', toggleable: true, sortKey: 'networkIn' },
{ id: 'netOut', label: 'Net Out', 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="M17 8l4 4m0 0l-4 4m4-4H3" /></svg>, priority: 'essential', width: '55px', toggleable: true, sortKey: 'networkOut' },
+
+ // Link column - at the end like NodeSummaryTable
+ { id: 'link', label: '', priority: 'essential', width: '28px' },
];
interface GuestRowProps {
@@ -477,6 +480,8 @@ interface GuestRowProps {
visibleColumnIds?: string[];
/** Click handler for the row */
onClick?: () => void;
+ /** Whether the row details are expanded */
+ isExpanded?: boolean;
}
export function GuestRow(props: GuestRowProps) {
@@ -688,6 +693,11 @@ export function GuestRow(props: GuestRowProps) {
{/* Name - always visible */}
<td class={`pr-2 py-1 align-middle whitespace-nowrap ${props.isGroupedView ? GROUPED_FIRST_CELL_INDENT : DEFAULT_FIRST_CELL_INDENT}`}>
<div class="flex items-center gap-2 min-w-0">
+ <div class={`transition-transform duration-200 ${props.isExpanded ? 'rotate-90' : ''}`}>
+ <svg class="w-3.5 h-3.5 text-gray-500" fill="none" viewBox="0 0 24 24" stroke="currentColor">
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
+ </svg>
+ </div>
<div class="flex items-center gap-1.5 min-w-0">
<StatusDot
variant={guestStatus().variant}
@@ -697,35 +707,11 @@ export function GuestRow(props: GuestRowProps) {
/>
<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 select-none whitespace-nowrap"
+ class="text-xs font-medium text-gray-900 dark:text-gray-100 select-none truncate"
title={props.guest.name}
>
{props.guest.name}
</span>
- <Show when={customUrl() && customUrl() !== ''}>
- <a
- 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"
- title={`Open ${customUrl()}`}
- onClick={(event) => event.stopPropagation()}
- >
- <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="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
- />
- </svg>
- </a>
- </Show>
{/* 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} />
@@ -1003,6 +989,26 @@ export function GuestRow(props: GuestRowProps) {
</div>
</td>
</Show>
+
+ {/* Link Column - at the end like NodeSummaryTable */}
+ <Show when={isColVisible('link')}>
+ <td class="px-0 py-1 align-middle text-center">
+ <Show when={customUrl() && customUrl() !== ''} fallback={<span class="text-xs text-gray-300 dark:text-gray-700">-</span>}>
+ <a
+ href={customUrl()}
+ target="_blank"
+ rel="noopener noreferrer"
+ class="inline-flex justify-center items-center 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()}
+ >
+ <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="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" />
+ </svg>
+ </a>
+ </Show>
+ </td>
+ </Show>
</tr>
</>
diff --git a/frontend-modern/src/components/Discovery/DiscoveryTab.tsx b/frontend-modern/src/components/Discovery/DiscoveryTab.tsx
index 42ea45ba22..1405435698 100644
--- a/frontend-modern/src/components/Discovery/DiscoveryTab.tsx
+++ b/frontend-modern/src/components/Discovery/DiscoveryTab.tsx
@@ -33,6 +33,10 @@ const makeResourceId = (type: ResourceType, hostId: string, resourceId: string)
export const DiscoveryTab: Component<DiscoveryTabProps> = (props) => {
const [isScanning, setIsScanning] = createSignal(false);
const [editingNotes, setEditingNotes] = createSignal(false);
+ // Track if initial fetch has completed to prevent flash of "no data" state
+ const [hasFetched, setHasFetched] = createSignal(false);
+ // Delayed loading spinner - only show after 150ms to prevent flash
+ const [showLoadingSpinner, setShowLoadingSpinner] = createSignal(false);
// --- Guest URL editing state ---
const [urlValue, setUrlValue] = createSignal(props.customUrl ?? '');
@@ -95,13 +99,30 @@ export const DiscoveryTab: Component<DiscoveryTabProps> = (props) => {
() => ({ type: props.resourceType, host: props.hostId, id: props.resourceId }),
async (params) => {
try {
- return await getDiscovery(params.type, params.host, params.id);
+ const result = await getDiscovery(params.type, params.host, params.id);
+ setHasFetched(true);
+ return result;
} catch {
+ setHasFetched(true);
return null;
}
}
);
+ // Delay showing loading spinner to prevent flash for fast API calls
+ createEffect(() => {
+ if (discovery.loading) {
+ const timer = setTimeout(() => {
+ if (discovery.loading) {
+ setShowLoadingSpinner(true);
+ }
+ }, 150);
+ onCleanup(() => clearTimeout(timer));
+ } else {
+ setShowLoadingSpinner(false);
+ }
+ });
+
// Handle triggering a new discovery
const handleTriggerDiscovery = async (force = false) => {
setIsScanning(true);
@@ -194,6 +215,7 @@ export const DiscoveryTab: Component<DiscoveryTabProps> = (props) => {
});
const confidenceInfo = () => {
+ if (discovery.loading) return null;
const d = discovery();
if (!d || d.confidence === undefined || d.confidence === null) return null;
return getConfidenceLevel(d.confidence);
@@ -220,12 +242,12 @@ export const DiscoveryTab: Component<DiscoveryTabProps> = (props) => {
};
// Accessor that returns discovery only when valid (for use with Show component)
- const validDiscovery = () => hasValidDiscovery() ? discovery() : null;
+ const validDiscovery = () => (!discovery.loading && hasValidDiscovery()) ? discovery() : null;
return (
<div class="space-y-4">
{/* AI Provider Badge - Always visible when AI is configured */}
- <Show when={discoveryInfo()?.ai_provider}>
+ <Show when={!discoveryInfo.loading && discoveryInfo()?.ai_provider}>
<div class="flex items-center gap-2">
<Show
when={discoveryInfo()?.ai_provider?.is_local}
@@ -251,7 +273,7 @@ export const DiscoveryTab: Component<DiscoveryTabProps> = (props) => {
</Show>
{/* "What Discovery Does" Explanation - Shown when no discovery yet */}
- <Show when={!discovery() && !discovery.loading && showExplanation()}>
+ <Show when={hasFetched() && !discovery() && !discovery.loading && showExplanation()}>
<div class="rounded border border-amber-200 bg-amber-50/80 p-3 shadow-sm dark:border-amber-800/50 dark:bg-amber-900/20">
<div class="flex items-start justify-between gap-3">
<div class="flex items-start gap-2.5">
@@ -280,7 +302,7 @@ export const DiscoveryTab: Component<DiscoveryTabProps> = (props) => {
</Show>
{/* Commands Preview - Expandable before first scan */}
- <Show when={!discovery() && !discovery.loading && discoveryInfo()?.commands && discoveryInfo()!.commands!.length > 0}>
+ <Show when={hasFetched() && !discovery() && !discovery.loading && !discoveryInfo.loading && discoveryInfo()?.commands && discoveryInfo()!.commands!.length > 0}>
<details class="rounded border border-gray-200 bg-white/70 shadow-sm dark:border-gray-600/70 dark:bg-gray-900/30" open={showCommandsPreview()}>
<summary
class="p-2.5 text-xs font-medium text-gray-700 dark:text-gray-300 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800/50 flex items-center gap-2"
@@ -310,8 +332,8 @@ export const DiscoveryTab: Component<DiscoveryTabProps> = (props) => {
</details>
</Show>
- {/* Loading state */}
- <Show when={discovery.loading}>
+ {/* Loading state - delayed to prevent flash for fast loads */}
+ <Show when={showLoadingSpinner()}>
<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"></div>
<span class="ml-2 text-sm text-gray-500 dark:text-gray-400">Loading discovery...</span>
@@ -386,8 +408,8 @@ export const DiscoveryTab: Component<DiscoveryTabProps> = (props) => {
</div>
</Show>
- {/* No discovery yet */}
- <Show when={!discovery.loading && !discovery() && !isScanning()}>
+ {/* No discovery yet - only show after initial fetch completes to prevent flash */}
+ <Show when={hasFetched() && !discovery.loading && !discovery() && !isScanning()}>
<div class="text-center py-8">
<div class="text-gray-500 dark:text-gray-400 mb-4">
<svg class="w-12 h-12 mx-auto mb-2 opacity-50" fill="none" viewBox="0 0 24 24" stroke="currentColor">
@@ -416,7 +438,7 @@ export const DiscoveryTab: Component<DiscoveryTabProps> = (props) => {
</Show>
{/* Discovery exists but has no meaningful data - show re-scan option */}
- <Show when={!discovery.loading && discovery() && !hasValidDiscovery() && !isScanning()}>
+ <Show when={hasFetched() && !discovery.loading && discovery() && !hasValidDiscovery() && !isScanning()}>
<div class="text-center py-8">
<div class="text-gray-500 dark:text-gray-400 mb-4">
<svg class="w-12 h-12 mx-auto mb-2 opacity-50" fill="none" viewBox="0 0 24 24" stroke="currentColor">
diff --git a/frontend-modern/src/components/Docker/DockerUnifiedTable.tsx b/frontend-modern/src/components/Docker/DockerUnifiedTable.tsx
index 603b5fa4ff..954d08fe6b 100644
--- a/frontend-modern/src/components/Docker/DockerUnifiedTable.tsx
+++ b/frontend-modern/src/components/Docker/DockerUnifiedTable.tsx
@@ -12,11 +12,11 @@ import {
formatAbsoluteTime,
} from '@/utils/format';
import type { DockerMetadata } from '@/api/dockerMetadata';
-import { DockerMetadataAPI } from '@/api/dockerMetadata';
import type { DockerHostMetadata } from '@/api/dockerHostMetadata';
import { resolveHostRuntime } from './runtimeDisplay';
-import { showSuccess, showError } from '@/utils/toast';
-import { logger } from '@/utils/logger';
+
+// ... (other imports remain) ...
+
import { buildMetricKey } from '@/utils/metricsKeys';
import { StatusDot } from '@/components/shared/StatusDot';
import {
@@ -32,11 +32,14 @@ import { usePersistentSignal } from '@/hooks/usePersistentSignal';
import { ResponsiveMetricCell } from '@/components/shared/responsive';
import { useBreakpoint } from '@/hooks/useBreakpoint';
import { StackedMemoryBar } from '@/components/Dashboard/StackedMemoryBar';
-import { UrlEditPopover } from '@/components/shared/UrlEditPopover';
+
import { UpdateButton } from '@/components/Docker/UpdateBadge';
import type { ColumnConfig } from '@/types/responsive';
+import { DiscoveryTab } from '@/components/Discovery/DiscoveryTab';
+import { HistoryChart } from '@/components/shared/HistoryChart';
+import type { HistoryTimeRange } from '@/api/charts';
-const typeBadgeClass = (type: 'container' | 'service' | 'task' | 'unknown') => {
+const typeBadgeClass = (type: 'container' | 'service' | 'task' | 'dockerHost' | 'unknown') => {
switch (type) {
case 'container':
return 'bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-200';
@@ -44,6 +47,8 @@ const typeBadgeClass = (type: 'container' | 'service' | 'task' | 'unknown') => {
return 'bg-purple-50 text-purple-700 dark:bg-purple-900/30 dark:text-purple-200';
case 'task':
return 'bg-slate-200 text-slate-600 dark:bg-slate-700 dark:text-slate-200';
+ case 'dockerHost':
+ return 'bg-slate-200 text-slate-600 dark:bg-slate-700 dark:text-slate-200';
default:
return 'bg-gray-200 text-gray-600 dark:bg-gray-700 dark:text-gray-300';
}
@@ -72,6 +77,7 @@ type DockerRow =
tasks: DockerTask[];
};
+
interface DockerUnifiedTableProps {
hosts: DockerHost[];
searchTerm?: string;
@@ -80,6 +86,7 @@ interface DockerUnifiedTableProps {
dockerMetadata?: Record<string, DockerMetadata>;
dockerHostMetadata?: Record<string, DockerHostMetadata>;
onCustomUrlUpdate?: (resourceId: string, url: string) => void;
+ onHostCustomUrlUpdate?: (hostId: string, url: string) => void;
batchUpdateState?: Record<string, 'updating' | 'queued' | 'error'>;
groupingMode?: 'grouped' | 'flat';
}
@@ -152,11 +159,7 @@ export const DOCKER_COLUMNS: DockerColumnDef[] = [
// Global state for currently expanded drawer (only one drawer open at a time)
const [currentlyExpandedRowId, setCurrentlyExpandedRowId] = createSignal<string | null>(null);
-// Global editing state for Docker resource URLs
-const [currentlyEditingDockerResourceId, setCurrentlyEditingDockerResourceId] = createSignal<string | null>(null);
-const dockerEditingValues = new Map<string, string>();
-const [dockerEditingValuesVersion, setDockerEditingValuesVersion] = createSignal(0);
-const [dockerPopoverPosition, setDockerPopoverPosition] = createSignal<{ top: number; left: number } | null>(null);
+
const toLower = (value?: string | null) => value?.toLowerCase() ?? '';
@@ -758,10 +761,12 @@ const DockerHostGroupHeader: Component<{
host: DockerHost;
columnCount: number;
customUrl?: string;
+ onCustomUrlUpdate?: (hostId: string, url: string) => void;
}> = (props) => {
const displayName = getHostDisplayName(props.host);
const hostStatus = () => getDockerHostStatusIndicator(props.host);
const isOnline = () => hostStatus().variant === 'success';
+
return (
<tr class="bg-gray-50 dark:bg-gray-900/40">
<td colspan={props.columnCount} class="py-0.5 pr-2 pl-4">
@@ -785,19 +790,16 @@ const DockerHostGroupHeader: Component<{
rel="noopener noreferrer"
class="inline-flex items-center gap-1 text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300 hover:underline"
title={`Open ${props.customUrl}`}
- onClick={(e) => e.stopPropagation()}
>
<span>{displayName}</span>
<svg class="w-3.5 h-3.5 flex-shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
- <path stroke-linecap="round" stroke-linejoin="round" d="M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1" />
+ <path stroke-linecap="round" stroke-linejoin="round" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" />
</svg>
</a>
</Show>
- <Show when={props.host.displayName && props.host.displayName !== props.host.hostname}>
- <span class="text-[10px] font-medium text-slate-500 dark:text-slate-400">
- ({props.host.hostname})
- </span>
- </Show>
+ <span class="text-xs font-normal text-slate-500 dark:text-slate-400 ml-1">
+ ({props.host.hostname})
+ </span>
</div>
</td>
</tr>
@@ -819,18 +821,15 @@ const DockerContainerRow: Component<{
const hostStatus = createMemo(() => getDockerHostStatusIndicator(host));
const hostDisplayName = () => getHostDisplayName(host);
const rowId = buildRowId(host, props.row);
- const resourceId = () => `${host.id}:container:${container.id || container.name}`;
- const isEditingUrl = createMemo(() => currentlyEditingDockerResourceId() === resourceId());
+
const resourceIndent = () => props.resourceIndentClass ?? GROUPED_RESOURCE_INDENT;
const [customUrl, setCustomUrl] = createSignal<string | undefined>(props.customUrl);
+ const [activeTab, setActiveTab] = createSignal<'overview' | 'discovery'>('overview');
+ const [historyRange, setHistoryRange] = createSignal<HistoryTimeRange>('1h');
const [shouldAnimateIcon, setShouldAnimateIcon] = createSignal(false);
const expanded = createMemo(() => currentlyExpandedRowId() === rowId);
- const editingUrlValue = createMemo(() => {
- dockerEditingValuesVersion(); // Subscribe to changes
- return dockerEditingValues.get(resourceId()) || '';
- });
- let urlInputRef: HTMLInputElement | undefined;
+
const batchState = createMemo(() => {
if (!props.batchUpdateState) return undefined;
@@ -910,29 +909,22 @@ const DockerContainerRow: Component<{
);
});
- // Update custom URL when prop changes, but only if we're not currently editing
+ // Update custom URL when prop changes
createEffect(() => {
- if (currentlyEditingDockerResourceId() !== resourceId()) {
- const prevUrl = customUrl();
- const newUrl = props.customUrl;
-
- // Only animate when URL transitions from empty to having a value
- if (!prevUrl && newUrl) {
- setShouldAnimateIcon(true);
- setTimeout(() => setShouldAnimateIcon(false), 200);
- }
+ const prevUrl = customUrl();
+ const newUrl = props.customUrl;
- setCustomUrl(newUrl);
+ // Only animate when URL transitions from empty to having a value
+ if (!prevUrl && newUrl) {
+ setShouldAnimateIcon(true);
+ setTimeout(() => setShouldAnimateIcon(false), 200);
}
+
+ setCustomUrl(newUrl);
});
// Auto-focus the input when editing starts
- createEffect(() => {
- if (isEditingUrl() && urlInputRef) {
- urlInputRef.focus();
- urlInputRef.select();
- }
- });
+
const toggle = (event: MouseEvent) => {
const target = event.target as HTMLElement;
@@ -943,151 +935,12 @@ const DockerContainerRow: Component<{
setCurrentlyExpandedRowId(prev => prev === rowId ? null : rowId);
};
- const startEditingUrl = (event: MouseEvent) => {
- event.stopPropagation();
- event.preventDefault();
-
- // Calculate popover position from the button
- const button = event.currentTarget as HTMLElement;
- const rect = button.getBoundingClientRect();
- setDockerPopoverPosition({ top: rect.bottom + 4, left: Math.max(8, rect.left - 100) });
-
- // If another resource is being edited, save it first
- const currentEditing = currentlyEditingDockerResourceId();
- if (currentEditing !== null && currentEditing !== resourceId()) {
- const currentInput = document.querySelector(`input[data-resource-id="${currentEditing}"]`) as HTMLInputElement;
- if (currentInput) {
- currentInput.blur();
- }
- }
- dockerEditingValues.set(resourceId(), customUrl() || '');
- setDockerEditingValuesVersion(v => v + 1);
- setCurrentlyEditingDockerResourceId(resourceId());
- };
// Add global click handler to close editor
- createEffect(() => {
- if (isEditingUrl()) {
- const handleGlobalClick = (e: MouseEvent) => {
- if (currentlyEditingDockerResourceId() !== resourceId()) return;
-
- const target = e.target as HTMLElement;
- const isClickingResourceName = target.closest('[data-resource-name-editable]');
-
- if (!target.closest('[data-url-editor]') && !isClickingResourceName) {
- e.preventDefault();
- e.stopPropagation();
- e.stopImmediatePropagation();
- cancelEditingUrl();
- }
- };
-
- const handleGlobalMouseDown = (e: MouseEvent) => {
- if (currentlyEditingDockerResourceId() !== resourceId()) return;
-
- const target = e.target as HTMLElement;
- const isClickingResourceName = target.closest('[data-resource-name-editable]');
-
- if (!target.closest('[data-url-editor]') && !isClickingResourceName) {
- 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 (currentlyEditingDockerResourceId() !== resourceId()) return;
-
- const newUrl = (dockerEditingValues.get(resourceId()) || '').trim();
-
- // Clear global editing state
- dockerEditingValues.delete(resourceId());
- setDockerEditingValuesVersion(v => v + 1);
- setCurrentlyEditingDockerResourceId(null);
- setDockerPopoverPosition(null);
-
- // If URL hasn't changed, don't save
- if (newUrl === (customUrl() || '')) return;
-
- // Animate if transitioning from no URL to having a URL
- const hadUrl = !!customUrl();
- if (!hadUrl && newUrl) {
- setShouldAnimateIcon(true);
- setTimeout(() => setShouldAnimateIcon(false), 200);
- }
-
- // Optimistically update local and parent state immediately
- setCustomUrl(newUrl || undefined);
- if (props.onCustomUrlUpdate) {
- props.onCustomUrlUpdate(resourceId(), newUrl);
- }
-
- try {
- await DockerMetadataAPI.updateMetadata(resourceId(), { customUrl: newUrl });
-
- if (newUrl) {
- showSuccess('Container URL saved');
- } else {
- showSuccess('Container URL cleared');
- }
- } catch (err: any) {
- logger.error('Failed to save container URL:', err);
- showError(err.message || 'Failed to save container URL');
- // Revert on error
- setCustomUrl(hadUrl ? customUrl() : undefined);
- if (props.onCustomUrlUpdate) {
- props.onCustomUrlUpdate(resourceId(), hadUrl ? customUrl() || '' : '');
- }
- }
- };
-
- const deleteUrl = async () => {
- if (currentlyEditingDockerResourceId() !== resourceId()) return;
-
- // Clear global editing state
- dockerEditingValues.delete(resourceId());
- setDockerEditingValuesVersion(v => v + 1);
- setCurrentlyEditingDockerResourceId(null);
- setDockerPopoverPosition(null);
-
- // If there was a URL set, delete it
- if (customUrl()) {
- try {
- await DockerMetadataAPI.updateMetadata(resourceId(), { customUrl: '' });
- setCustomUrl(undefined);
-
- // Notify parent to update metadata
- if (props.onCustomUrlUpdate) {
- props.onCustomUrlUpdate(resourceId(), '');
- }
- showSuccess('Container URL removed');
- } catch (err: any) {
- logger.error('Failed to remove container URL:', err);
- showError(err.message || 'Failed to remove container URL');
- }
- }
- };
- const cancelEditingUrl = () => {
- if (currentlyEditingDockerResourceId() !== resourceId()) return;
- // Just close without saving
- dockerEditingValues.delete(resourceId());
- setDockerEditingValuesVersion(v => v + 1);
- setCurrentlyEditingDockerResourceId(null);
- setDockerPopoverPosition(null);
- };
const cpuPercent = () => Math.max(0, Math.min(100, container.cpuPercent ?? 0));
const metricsKey = buildMetricKey('dockerContainer', container.id);
@@ -1133,6 +986,11 @@ const DockerContainerRow: Component<{
return (
<div class={`${resourceIndent()} pr-2 py-0.5 overflow-hidden`}>
<div class="flex items-center gap-1.5 min-w-0">
+ <div class={`transition-transform duration-200 ${expanded() ? 'rotate-90' : ''} ${!hasDrawerContent() ? 'invisible' : ''}`}>
+ <svg class="w-3.5 h-3.5 text-gray-500" fill="none" viewBox="0 0 24 24" stroke="currentColor">
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
+ </svg>
+ </div>
<StatusDot
variant={containerStatusIndicator().variant}
title={statusLabel()}
@@ -1174,16 +1032,7 @@ const DockerContainerRow: Component<{
</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 when={props.showHostContext}>
<span
class="inline-flex items-center gap-1 rounded bg-gray-100 px-1.5 py-0.5 text-[10px] font-medium text-gray-600 dark:bg-gray-800 dark:text-gray-300 flex-shrink-0 max-w-[120px]"
@@ -1336,396 +1185,473 @@ const DockerContainerRow: Component<{
</tr>
{/* URL editing popover - using shared component */}
- <UrlEditPopover
- isOpen={isEditingUrl()}
- value={editingUrlValue()}
- position={dockerPopoverPosition()}
- isSaving={false}
- hasExistingUrl={!!customUrl()}
- placeholder="https://example.com:8080"
- helpText="Add a URL to quickly access this container's web interface"
- onValueChange={(value) => { dockerEditingValues.set(resourceId(), value); setDockerEditingValuesVersion(v => v + 1); }}
- onSave={saveUrl}
- onCancel={cancelEditingUrl}
- onDelete={deleteUrl}
- />
+
<Show when={expanded() && hasDrawerContent()}>
<tr>
<td colspan={DOCKER_COLUMNS.length} class="p-0">
<div class="w-0 min-w-full bg-gray-50 dark:bg-gray-900/50 px-4 py-3 overflow-hidden">
- <div class="flex flex-wrap gap-3 [&>*]:flex-1 [&>*]:basis-[calc(25%-0.75rem)] [&>*]:min-w-[200px] [&>*]:max-w-full">
- <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">
- 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="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">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>
- </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">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>
+ <div class="flex border-b border-gray-200 dark:border-gray-700/50 mb-4 bg-white/50 dark:bg-gray-800/50 backdrop-blur-sm sticky top-0 z-10 -mx-4 px-4 pt-2">
+ <button
+ type="button"
+ class={`px-4 py-2 text-xs font-medium border-b-2 transition-colors ${activeTab() === 'overview' ? 'border-blue-500 text-blue-600 dark:text-blue-400' : 'border-transparent text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300'}`}
+ onClick={(e) => { e.stopPropagation(); setActiveTab('overview'); }}
+ >
+ Overview
+ </button>
+ <button
+ type="button"
+ class={`px-4 py-2 text-xs font-medium border-b-2 transition-colors ${activeTab() === 'discovery' ? 'border-blue-500 text-blue-600 dark:text-blue-400' : 'border-transparent text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300'}`}
+ onClick={(e) => { e.stopPropagation(); setActiveTab('discovery'); }}
+ >
+ Discovery
+ </button>
+ </div>
- <Show when={container.networks && container.networks.length > 0}>
+ <div class={activeTab() === 'overview' ? '' : 'hidden'}>
+ <div class="flex flex-wrap gap-3 [&>*]:flex-1 [&>*]:basis-[calc(25%-0.75rem)] [&>*]:min-w-[200px] [&>*]:max-w-full">
<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
+ Summary
</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}>
- <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}
- </span>
- </Show>
+ <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="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>
- </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}
+ )}
+ </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">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>
- <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>
+ </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>
)}
- </For>
+ </Show>
</div>
</div>
)}
- </For>
+ </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>
-
- <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
+ <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>
- <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())}
+ </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
+ </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}>
+ <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}
+ </span>
+ </Show>
+ </div>
</div>
- <Show when={blockIoReadRateLabel()}>
- <div class="text-[10px] text-gray-500 dark:text-gray-400">
- {blockIoReadRateLabel()}
+ ))}
+ </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>
- </Show>
- </div>
+ )}
+ </For>
</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>
+
+ <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>
- <Show when={blockIoWriteRateLabel()}>
- <div class="text-[10px] text-gray-500 dark:text-gray-400">
- {blockIoWriteRateLabel()}
+ </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>
+ <Show when={blockIoWriteRateLabel()}>
+ <div class="text-[10px] text-gray-500 dark:text-gray-400">
+ {blockIoWriteRateLabel()}
+ </div>
+ </Show>
+ </div>
</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 (
- <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}
+ <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>
- </div>
- <Show when={mount.source}>
- <div class="mt-1 truncate text-[11px] text-gray-600 dark:text-gray-300" title={mount.source}>
- {mount.source}
+ <Show when={mount.type}>
+ <span class="text-[10px] uppercase tracking-wide text-gray-500 dark:text-gray-400">
+ {mount.type}
+ </span>
+ </Show>
</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 when={mount.source}>
+ <div class="mt-1 truncate text-[11px] text-gray-600 dark:text-gray-300" title={mount.source}>
+ {mount.source}
+ </div>
</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}
+ <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>
+ <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>
- </div>
- );
- }}
- </For>
+ );
+ }}
+ </For>
+ </div>
</div>
- </div>
- </Show>
+ </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
+ <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 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>
- );
- })}
+ </Show>
+
+ <Show when={container.env && container.env.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">
+ Environment
+ </div>
+ <div class="mt-1 flex flex-wrap gap-1 text-[11px] text-gray-600 dark:text-gray-300">
+ {container.env!.map((envVar) => {
+ const eqIndex = envVar.indexOf('=');
+ if (eqIndex === -1) return null;
+ const name = envVar.substring(0, eqIndex);
+ const value = envVar.substring(eqIndex + 1);
+ const isMasked = value === '***';
+ return (
+ <span
+ class={`max-w-full truncate rounded px-1.5 py-0.5 ${isMasked
+ ? 'bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-200'
+ : 'bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-200'
+ }`}
+ title={isMasked ? `${name} (masked for security)` : `${name}=${value}`}
+ >
+ {name}
+ <Show when={!isMasked && value}>
+ <span class="text-green-600 dark:text-green-300">={value}</span>
+ </Show>
+ <Show when={isMasked}>
+ <span class="text-amber-500 dark:text-amber-400 ml-0.5">🔒</span>
+ </Show>
+ </span>
+ );
+ })}
+ </div>
</div>
+ </Show>
+ </div>
+
+ <div class="mt-3 space-y-3">
+ <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>
- <Show when={container.env && container.env.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">
- Environment
- </div>
- <div class="mt-1 flex flex-wrap gap-1 text-[11px] text-gray-600 dark:text-gray-300">
- {container.env!.map((envVar) => {
- const eqIndex = envVar.indexOf('=');
- if (eqIndex === -1) return null;
- const name = envVar.substring(0, eqIndex);
- const value = envVar.substring(eqIndex + 1);
- const isMasked = value === '***';
- return (
- <span
- class={`max-w-full truncate rounded px-1.5 py-0.5 ${isMasked
- ? 'bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-200'
- : 'bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-200'
- }`}
- title={isMasked ? `${name} (masked for security)` : `${name}=${value}`}
- >
- {name}
- <Show when={!isMasked && value}>
- <span class="text-green-600 dark:text-green-300">={value}</span>
- </Show>
- <Show when={isMasked}>
- <span class="text-amber-500 dark:text-amber-400 ml-0.5">🔒</span>
- </Show>
- </span>
- );
- })}
+ <div class="relative">
+ <div class="space-y-3">
+ <div class="flex flex-wrap gap-3 [&>*]:flex-1 [&>*]:basis-[calc(50%-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="docker"
+ resourceId={container.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="docker"
+ resourceId={container.id}
+ metric="memory"
+ height={120}
+ color="#f59e0b"
+ label="Memory"
+ unit="%"
+ range={historyRange()}
+ hideSelector={true}
+ compact={true}
+ hideLock={true}
+ />
+ </div>
+ </div>
</div>
</div>
- </Show>
-
-
-
-
-
+ </div>
</div>
+
+ <Show when={activeTab() === 'discovery'}>
+ <DiscoveryTab
+ resourceType="docker"
+ hostId={host.id}
+ resourceId={container.id}
+ hostname={container.name}
+ guestId={container.id}
+ customUrl={customUrl()}
+ onCustomUrlChange={(url) => {
+ setCustomUrl(url || undefined);
+ props.onCustomUrlUpdate?.(container.id, url);
+ }}
+ />
+ </Show>
</div>
</td>
</tr>
@@ -1745,7 +1671,8 @@ const DockerServiceRow: Component<{
const { host, service, tasks } = props.row;
const rowId = buildRowId(host, props.row);
const resourceId = () => `${host.id}:service:${service.id || service.name}`;
- const isEditingUrl = createMemo(() => currentlyEditingDockerResourceId() === resourceId());
+ const [activeTab, setActiveTab] = createSignal<'overview' | 'discovery'>('overview');
+ const [historyRange, setHistoryRange] = createSignal<HistoryTimeRange>('1h');
const hostStatus = createMemo(() => getDockerHostStatusIndicator(host));
const hostDisplayName = () => getHostDisplayName(host);
const resourceIndent = () => props.resourceIndentClass ?? GROUPED_RESOURCE_INDENT;
@@ -1753,194 +1680,37 @@ const DockerServiceRow: Component<{
const [customUrl, setCustomUrl] = createSignal<string | undefined>(props.customUrl);
const [shouldAnimateIcon, setShouldAnimateIcon] = createSignal(false);
const expanded = createMemo(() => currentlyExpandedRowId() === rowId);
- const editingUrlValue = createMemo(() => {
- dockerEditingValuesVersion(); // Subscribe to changes
- return dockerEditingValues.get(resourceId()) || '';
- });
- let urlInputRef: HTMLInputElement | undefined;
+
const hasTasks = () => tasks.length > 0;
- // Update custom URL when prop changes, but only if we're not currently editing
+ // Update custom URL when prop changes
createEffect(() => {
- if (currentlyEditingDockerResourceId() !== resourceId()) {
- const prevUrl = customUrl();
- const newUrl = props.customUrl;
-
- // Only animate when URL transitions from empty to having a value
- if (!prevUrl && newUrl) {
- setShouldAnimateIcon(true);
- setTimeout(() => setShouldAnimateIcon(false), 200);
- }
+ const prevUrl = customUrl();
+ const newUrl = props.customUrl;
- setCustomUrl(newUrl);
+ // Only animate when URL transitions from empty to having a value
+ if (!prevUrl && newUrl) {
+ setShouldAnimateIcon(true);
+ setTimeout(() => setShouldAnimateIcon(false), 200);
}
- });
- // Auto-focus the input when editing starts
- createEffect(() => {
- if (isEditingUrl() && urlInputRef) {
- urlInputRef.focus();
- urlInputRef.select();
- }
+ setCustomUrl(newUrl);
});
+
+
const toggle = (event: MouseEvent) => {
const target = event.target as HTMLElement;
if (target.closest('a, button, input, [data-prevent-toggle]')) return;
// Standard drawer toggle
- if (!hasTasks()) return;
setCurrentlyExpandedRowId(prev => prev === rowId ? null : rowId);
};
- const startEditingUrl = (event: MouseEvent) => {
- event.stopPropagation();
- event.preventDefault();
-
- // Calculate popover position from the button
- const button = event.currentTarget as HTMLElement;
- const rect = button.getBoundingClientRect();
- setDockerPopoverPosition({ top: rect.bottom + 4, left: Math.max(8, rect.left - 100) });
-
- // If another resource is being edited, save it first
- const currentEditing = currentlyEditingDockerResourceId();
- if (currentEditing !== null && currentEditing !== resourceId()) {
- const currentInput = document.querySelector(`input[data-resource-id="${currentEditing}"]`) as HTMLInputElement;
- if (currentInput) {
- currentInput.blur();
- }
- }
- dockerEditingValues.set(resourceId(), customUrl() || '');
- setDockerEditingValuesVersion(v => v + 1);
- setCurrentlyEditingDockerResourceId(resourceId());
- };
-
- // Add global click handler to close editor
- createEffect(() => {
- if (isEditingUrl()) {
- const handleGlobalClick = (e: MouseEvent) => {
- if (currentlyEditingDockerResourceId() !== resourceId()) return;
-
- const target = e.target as HTMLElement;
- const isClickingResourceName = target.closest('[data-resource-name-editable]');
-
- if (!target.closest('[data-url-editor]') && !isClickingResourceName) {
- e.preventDefault();
- e.stopPropagation();
- e.stopImmediatePropagation();
- cancelEditingUrl();
- }
- };
-
- const handleGlobalMouseDown = (e: MouseEvent) => {
- if (currentlyEditingDockerResourceId() !== resourceId()) return;
-
- const target = e.target as HTMLElement;
- const isClickingResourceName = target.closest('[data-resource-name-editable]');
-
- if (!target.closest('[data-url-editor]') && !isClickingResourceName) {
- 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 (currentlyEditingDockerResourceId() !== resourceId()) return;
-
- const newUrl = (dockerEditingValues.get(resourceId()) || '').trim();
-
- // Clear global editing state
- dockerEditingValues.delete(resourceId());
- setDockerEditingValuesVersion(v => v + 1);
- setCurrentlyEditingDockerResourceId(null);
- setDockerPopoverPosition(null);
-
- // If URL hasn't changed, don't save
- if (newUrl === (customUrl() || '')) return;
-
- // Animate if transitioning from no URL to having a URL
- const hadUrl = !!customUrl();
- if (!hadUrl && newUrl) {
- setShouldAnimateIcon(true);
- setTimeout(() => setShouldAnimateIcon(false), 200);
- }
-
- // Optimistically update local and parent state immediately
- setCustomUrl(newUrl || undefined);
- if (props.onCustomUrlUpdate) {
- props.onCustomUrlUpdate(resourceId(), newUrl);
- }
-
- try {
- await DockerMetadataAPI.updateMetadata(resourceId(), { customUrl: newUrl });
-
- if (newUrl) {
- showSuccess('Service URL saved');
- } else {
- showSuccess('Service URL cleared');
- }
- } catch (err: any) {
- logger.error('Failed to save service URL:', err);
- showError(err.message || 'Failed to save service URL');
- // Revert on error
- setCustomUrl(hadUrl ? customUrl() : undefined);
- if (props.onCustomUrlUpdate) {
- props.onCustomUrlUpdate(resourceId(), hadUrl ? customUrl() || '' : '');
- }
- }
- };
-
- const deleteUrl = async () => {
- if (currentlyEditingDockerResourceId() !== resourceId()) return;
-
- // Clear global editing state
- dockerEditingValues.delete(resourceId());
- setDockerEditingValuesVersion(v => v + 1);
- setCurrentlyEditingDockerResourceId(null);
- setDockerPopoverPosition(null);
-
- // If there was a URL set, delete it
- if (customUrl()) {
- try {
- await DockerMetadataAPI.updateMetadata(resourceId(), { customUrl: '' });
- setCustomUrl(undefined);
-
- // Notify parent to update metadata
- if (props.onCustomUrlUpdate) {
- props.onCustomUrlUpdate(resourceId(), '');
- }
-
- showSuccess('Service URL removed');
- } catch (err: any) {
- logger.error('Failed to remove service URL:', err);
- showError(err.message || 'Failed to remove service URL');
- }
- }
- };
-
- const cancelEditingUrl = () => {
- if (currentlyEditingDockerResourceId() !== resourceId()) return;
-
- // Just close without saving
- dockerEditingValues.delete(resourceId());
- setDockerEditingValuesVersion(v => v + 1);
- setCurrentlyEditingDockerResourceId(null);
- setDockerPopoverPosition(null);
- };
const badge = serviceHealthBadge(service);
const updatedAt = ensureMs(service.updatedAt ?? service.createdAt);
@@ -1964,6 +1734,11 @@ const DockerServiceRow: Component<{
return (
<div class={`${resourceIndent()} pr-2 py-0.5`}>
<div class="flex items-center gap-1.5 min-w-0">
+ <div class={`transition-transform duration-200 ${expanded() ? 'rotate-90' : ''}`}>
+ <svg class="w-3.5 h-3.5 text-gray-500" fill="none" viewBox="0 0 24 24" stroke="currentColor">
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
+ </svg>
+ </div>
<StatusDot
variant={serviceStatusIndicator().variant}
title={badge.label}
@@ -1993,16 +1768,7 @@ const DockerServiceRow: Component<{
</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 when={service.stack}>
<span class="text-[10px] text-gray-500 dark:text-gray-400 truncate" title={`Stack: ${service.stack}`}>
Stack: {service.stack}
@@ -2085,7 +1851,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 cursor-pointer ${expanded() ? 'bg-gray-50 dark:bg-gray-800/40' : 'hover:bg-gray-50 dark:hover:bg-gray-800/50'} ${!isHealthy() ? 'opacity-60' : ''}`}
onClick={toggle}
aria-expanded={expanded()}
>
@@ -2105,144 +1871,220 @@ const DockerServiceRow: Component<{
</For>
</tr>
- {/* URL editing popover - using shared component */}
- <UrlEditPopover
- isOpen={isEditingUrl()}
- value={editingUrlValue()}
- position={dockerPopoverPosition()}
- isSaving={false}
- hasExistingUrl={!!customUrl()}
- placeholder="https://example.com:8080"
- helpText="Add a URL to quickly access this service's web interface"
- onValueChange={(value) => { dockerEditingValues.set(resourceId(), value); setDockerEditingValuesVersion(v => v + 1); }}
- onSave={saveUrl}
- onCancel={cancelEditingUrl}
- onDelete={deleteUrl}
- />
-
- <Show when={expanded() && hasTasks()}>
+ <Show when={expanded()}>
<tr>
<td colspan={DOCKER_COLUMNS.length} class="p-0">
<div class="w-0 min-w-full bg-gray-50 dark:bg-gray-900/60 px-4 py-3 overflow-hidden">
- <div class="space-y-3">
- <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="flex items-center justify-between text-[11px] font-medium uppercase tracking-wide text-gray-700 dark:text-gray-200">
- <span>Tasks</span>
- <span class="text-[10px] font-normal text-gray-500 dark:text-gray-400">
- {tasks.length} {tasks.length === 1 ? 'entry' : 'entries'}
- </span>
- </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())}
+ <div class="flex border-b border-gray-200 dark:border-gray-700/50 mb-4 bg-white/50 dark:bg-gray-800/50 backdrop-blur-sm sticky top-0 z-10 -mx-4 px-4 pt-2">
+ <button
+ type="button"
+ class={`px-4 py-2 text-xs font-medium border-b-2 transition-colors ${activeTab() === 'overview' ? 'border-blue-500 text-blue-600 dark:text-blue-400' : 'border-transparent text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300'}`}
+ onClick={(e) => { e.stopPropagation(); setActiveTab('overview'); }}
+ >
+ Overview
+ </button>
+ <button
+ type="button"
+ class={`px-4 py-2 text-xs font-medium border-b-2 transition-colors ${activeTab() === 'discovery' ? 'border-blue-500 text-blue-600 dark:text-blue-400' : 'border-transparent text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300'}`}
+ onClick={(e) => { e.stopPropagation(); setActiveTab('discovery'); }}
+ >
+ Discovery
+ </button>
+ </div>
+
+ <div class={activeTab() === 'overview' ? 'space-y-3' : 'hidden'}>
+ <Show when={hasTasks()} fallback={<div class="p-4 text-center text-sm text-gray-500 dark:text-gray-400">No tasks running.</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">
+ <div class="flex items-center justify-between text-[11px] font-medium uppercase tracking-wide text-gray-700 dark:text-gray-200">
+ <span>Tasks</span>
+ <span class="text-[10px] font-normal text-gray-500 dark:text-gray-400">
+ {tasks.length} {tasks.length === 1 ? 'entry' : 'entries'}
+ </span>
+ </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>
- )}
- </Show>
- </td>
- </tr>
- );
- }}
- </For>
- </tbody>
- </table>
+ </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())}
+ </span>
+ )}
+ </Show>
+ </td>
+ </tr>
+ );
+ }}
+ </For>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </Show>
+ </div>
+
+ <div class="mt-3 space-y-3">
+ <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>
+ </select>
+ </div>
+
+ <div class="relative">
+ <div class="space-y-3">
+ <div class="flex flex-wrap gap-3 [&>*]:flex-1 [&>*]:basis-[calc(50%-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="docker"
+ resourceId={service.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="docker"
+ resourceId={service.id || ''}
+ metric="memory"
+ height={120}
+ color="#f59e0b"
+ label="Memory"
+ unit="%"
+ range={historyRange()}
+ hideSelector={true}
+ compact={true}
+ hideLock={true}
+ />
+ </div>
+ </div>
</div>
</div>
</div>
+
+ <Show when={activeTab() === 'discovery'}>
+ <DiscoveryTab
+ resourceType="docker"
+ hostId={host.id}
+ resourceId={service.id || service.name || ''}
+ hostname={service.name || service.id || 'Service'}
+ guestId={resourceId()}
+ customUrl={customUrl()}
+ onCustomUrlChange={(url) => {
+ setCustomUrl(url || undefined);
+ props.onCustomUrlUpdate?.(resourceId(), url);
+ }}
+ />
+ </Show>
</div>
</td>
</tr>
@@ -2707,16 +2549,23 @@ const DockerUnifiedTable: Component<DockerUnifiedTableProps> = (props) => {
}
>
<For each={orderedGroups()}>
- {(group) => (
- <>
- <DockerHostGroupHeader
- host={group.host}
- columnCount={DOCKER_COLUMNS.length}
- customUrl={props.dockerHostMetadata?.[group.host.id]?.customUrl}
- />
- <For each={group.rows}>{(row) => renderRow(row, true)}</For>
- </>
- )}
+ {(group) => {
+ const hostId = group.host.id;
+ const metadata = props.dockerHostMetadata?.[hostId];
+ return (
+ <>
+ <DockerHostGroupHeader
+ host={group.host}
+ columnCount={DOCKER_COLUMNS.length}
+ customUrl={metadata?.customUrl}
+ onCustomUrlUpdate={props.onHostCustomUrlUpdate}
+ />
+ <For each={group.rows}>
+ {(row) => renderRow(row, true)}
+ </For>
+ </>
+ );
+ }}
</For>
</Show>
</tbody>
diff --git a/frontend-modern/src/components/Hosts/HostDrawer.tsx b/frontend-modern/src/components/Hosts/HostDrawer.tsx
new file mode 100644
index 0000000000..1987a5c1a1
--- /dev/null
+++ b/frontend-modern/src/components/Hosts/HostDrawer.tsx
@@ -0,0 +1,358 @@
+import { Component, Show, For, Suspense, createSignal } from 'solid-js';
+import { Host } from '@/types/api';
+import { formatBytes, formatUptime } from '@/utils/format';
+import { HistoryChart } from '../shared/HistoryChart';
+import { ResourceType, HistoryTimeRange } from '@/api/charts';
+import { hasFeature } from '@/stores/license';
+import { DiscoveryTab } from '../Discovery/DiscoveryTab';
+import { StackedDiskBar } from '@/components/Dashboard/StackedDiskBar';
+
+interface HostDrawerProps {
+ host: Host;
+ onClose: () => void;
+ customUrl?: string;
+ onCustomUrlChange?: (hostId: string, url: string) => void;
+}
+
+export const HostDrawer: Component<HostDrawerProps> = (props) => {
+ const [activeTab, setActiveTab] = createSignal<'overview' | 'discovery'>('overview');
+ const [historyRange, setHistoryRange] = createSignal<HistoryTimeRange>('1h');
+
+ // For unified host agents, the backend stores metrics with resourceType 'host'
+ const metricsResource = { type: 'host' as ResourceType, id: props.host.id };
+
+ const switchTab = (tab: 'overview' | 'discovery') => {
+ setActiveTab(tab);
+ };
+
+ const isHistoryLocked = () => !hasFeature('long_term_metrics') && (historyRange() === '30d' || historyRange() === '90d');
+
+ const diskStats = () => {
+ if (!props.host.disks || props.host.disks.length === 0) return { percent: 0, used: 0, total: 0 };
+ const totalUsed = props.host.disks.reduce((sum, d) => sum + (d.used ?? 0), 0);
+ const totalSize = props.host.disks.reduce((sum, d) => sum + (d.total ?? 0), 0);
+ return {
+ percent: totalSize > 0 ? (totalUsed / totalSize) * 100 : 0,
+ used: totalUsed,
+ total: totalSize
+ };
+ };
+
+ 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={() => 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'
+ }`}
+ >
+ Overview
+ {activeTab() === 'overview' && (
+ <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={() => 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'
+ }`}
+ >
+ Discovery
+ {activeTab() === 'discovery' && (
+ <div class="absolute bottom-0 left-0 right-0 h-0.5 bg-blue-600 dark:bg-blue-400 rounded-t-full" />
+ )}
+ </button>
+ </div>
+
+ {/* Overview Tab */}
+ <div class={activeTab() === 'overview' ? '' : 'hidden'} style={{ "overflow-anchor": "none" }}>
+ <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]">
+ <div class="flex items-center justify-between">
+ <span class="text-gray-500 dark:text-gray-400">Hostname</span>
+ <span class="font-medium text-gray-700 dark:text-gray-200 select-all">{props.host.hostname}</span>
+ </div>
+ <div class="flex items-center justify-between">
+ <span class="text-gray-500 dark:text-gray-400">Platform</span>
+ <span class="font-medium text-gray-700 dark:text-gray-200 capitalize">{props.host.platform || 'Unknown'}</span>
+ </div>
+ <div class="flex items-center justify-between">
+ <span class="text-gray-500 dark:text-gray-400">OS</span>
+ <span class="font-medium text-gray-700 dark:text-gray-200">{props.host.osName} {props.host.osVersion}</span>
+ </div>
+ <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">{props.host.kernelVersion}</span>
+ </div>
+ <div class="flex items-center justify-between">
+ <span class="text-gray-500 dark:text-gray-400">Architecture</span>
+ <span class="font-medium text-gray-700 dark:text-gray-200">{props.host.architecture}</span>
+ </div>
+ <Show when={props.host.uptimeSeconds}>
+ <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.host.uptimeSeconds!)}</span>
+ </div>
+ </Show>
+ </div>
+ </div>
+
+ {/* Hardware 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">Hardware</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">CPU</span>
+ <span class="font-medium text-gray-700 dark:text-gray-200">{props.host.cpuCount} Cores</span>
+ </div>
+ <div class="flex items-center justify-between">
+ <span class="text-gray-500 dark:text-gray-400">Memory</span>
+ <span class="font-medium text-gray-700 dark:text-gray-200">
+ {formatBytes(props.host.memory?.total || 0)}
+ </span>
+ </div>
+ <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">{props.host.agentVersion}</span>
+ </div>
+ </div>
+ </div>
+
+ {/* Network Interfaces */}
+ <Show when={props.host.networkInterfaces && props.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="max-h-[140px] overflow-y-auto custom-scrollbar space-y-2">
+ <For each={props.host.networkInterfaces}>
+ {(iface) => (
+ <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}</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={iface.addresses && iface.addresses.length > 0}>
+ <div class="flex flex-wrap gap-1 mt-1">
+ <For each={iface.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>
+ </div>
+ )}
+ </For>
+ </div>
+ </div>
+ </Show>
+
+ {/* Disk Usage */}
+ <Show when={props.host.disks && props.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="max-h-[140px] overflow-y-auto custom-scrollbar space-y-2">
+ {/* Summary bar */}
+ <div class="mb-3">
+ <div class="flex justify-between text-[10px] mb-1">
+ <span class="text-gray-500 dark:text-gray-400">Total Usage</span>
+ <span class="text-gray-700 dark:text-gray-200">
+ {formatBytes(diskStats().used)} / {formatBytes(diskStats().total)}
+ </span>
+ </div>
+ <StackedDiskBar
+ disks={props.host.disks}
+ mode="mini"
+ aggregateDisk={{
+ total: diskStats().total,
+ used: diskStats().used,
+ free: diskStats().total - diskStats().used,
+ usage: diskStats().percent / 100
+ }}
+ />
+ </div>
+
+ <For each={props.host.disks}>
+ {(disk) => (
+ <div class="text-[10px]">
+ <div class="flex justify-between mb-0.5">
+ <span class="text-gray-600 dark:text-gray-300 truncate max-w-[120px]" title={disk.mountpoint}>{disk.mountpoint}</span>
+ <span class="text-gray-500 dark:text-gray-400">{formatBytes(disk.used)} / {formatBytes(disk.total)}</span>
+ </div>
+ <div class="h-1.5 w-full rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden">
+ <div
+ class="h-full rounded-full transition-all duration-500 bg-blue-500"
+ style={{ width: `${Math.min(100, Math.max(0, (disk.used / disk.total) * 100))}%` }}
+ />
+ </div>
+ </div>
+ )}
+ </For>
+ </div>
+ </div>
+ </Show>
+ </div>
+
+ {/* Performance Charts */}
+ <div class="mt-3 space-y-3">
+ <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>
+
+ <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>
+ {/* 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-indigo-500 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>
+
+ {/* Discovery Tab */}
+ <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="host"
+ hostId={props.host.id}
+ resourceId={props.host.id} /* For hosts, typically same as hostId */
+ hostname={props.host.hostname}
+ guestId={props.host.id}
+ customUrl={props.customUrl}
+ onCustomUrlChange={(url) => props.onCustomUrlChange?.(props.host.id, url)}
+ />
+ </Suspense>
+ </div>
+ </div>
+ );
+};
diff --git a/frontend-modern/src/components/Hosts/HostsOverview.tsx b/frontend-modern/src/components/Hosts/HostsOverview.tsx
index 1cc6327475..eb20e7ea36 100644
--- a/frontend-modern/src/components/Hosts/HostsOverview.tsx
+++ b/frontend-modern/src/components/Hosts/HostsOverview.tsx
@@ -21,10 +21,10 @@ import { STORAGE_KEYS } from '@/utils/localStorage';
import { useResourcesAsLegacy } from '@/hooks/useResources';
import { useAlertsActivation } from '@/stores/alertsActivation';
import { HostMetadataAPI, type HostMetadata } from '@/api/hostMetadata';
-import { UrlEditPopover, createUrlEditState } from '@/components/shared/UrlEditPopover';
-import { showSuccess, showError } from '@/utils/toast';
+
import { logger } from '@/utils/logger';
import { isKioskMode, subscribeToKioskMode } from '@/utils/url';
+import { HostDrawer } from './HostDrawer';
// Column definition for hosts table
export interface HostColumnDef {
@@ -661,6 +661,12 @@ export const HostsOverview: Component = () => {
// This fixes the issue where props.hosts would not update when the underlying data changes
const { asHosts } = useResourcesAsLegacy();
+ const [expandedHostId, setExpandedHostId] = createSignal<string | null>(null);
+
+ const toggleHostExpand = (hostId: string) => {
+ setExpandedHostId(prev => prev === hostId ? null : hostId);
+ };
+
// Column visibility management
const columnVisibility = useColumnVisibility(
STORAGE_KEYS.HOSTS_HIDDEN_COLUMNS,
@@ -1047,7 +1053,20 @@ export const HostsOverview: Component = () => {
</thead>
<tbody class="divide-y divide-gray-200 dark:divide-gray-700">
<For each={filteredHosts()}>
- {(host) => <HostRow host={host} isColVisible={isColVisible} isMobile={isMobile} getDiskStats={getDiskStats} customUrl={getHostCustomUrl(host.id)} onUpdateCustomUrl={updateHostCustomUrl} onDeleteCustomUrl={deleteHostCustomUrl} />}
+ {(host) => (
+ <HostRow
+ host={host}
+ isColVisible={isColVisible}
+ isMobile={isMobile}
+ getDiskStats={getDiskStats}
+ customUrl={getHostCustomUrl(host.id)}
+ onUpdateCustomUrl={updateHostCustomUrl}
+ onDeleteCustomUrl={deleteHostCustomUrl}
+ isExpanded={expandedHostId() === host.id}
+ onToggleExpand={() => toggleHostExpand(host.id)}
+ totalColumns={visibleColumnIds().length}
+ />
+ )}
</For>
</tbody>
</table>
@@ -1087,7 +1106,7 @@ export const HostsOverview: Component = () => {
</Card>
</Show>
</Show>
- </div>
+ </div >
);
};
@@ -1100,6 +1119,9 @@ interface HostRowProps {
customUrl?: string;
onUpdateCustomUrl: (hostId: string, url: string) => Promise<boolean>;
onDeleteCustomUrl: (hostId: string) => Promise<boolean>;
+ isExpanded: boolean;
+ onToggleExpand: () => void;
+ totalColumns: number;
}
const HostRow: Component<HostRowProps> = (props) => {
@@ -1107,44 +1129,7 @@ const HostRow: Component<HostRowProps> = (props) => {
// Always access props.host directly to ensure updates flow through.
- // URL editing using shared hook
- const urlEdit = createUrlEditState();
-
- const handleStartEditingUrl = (e: MouseEvent) => {
- urlEdit.startEditing(props.host.id, props.customUrl || '', e);
- };
- const handleSaveUrl = async () => {
- const url = urlEdit.editingValue().trim();
- urlEdit.setIsSaving(true);
- try {
- if (url) {
- await props.onUpdateCustomUrl(props.host.id, url);
- showSuccess('Host URL saved');
- } else {
- await props.onDeleteCustomUrl(props.host.id);
- showSuccess('Host URL removed');
- }
- urlEdit.finishEditing();
- } catch (err) {
- const message = err instanceof Error ? err.message : 'Failed to save URL';
- showError(message);
- urlEdit.setIsSaving(false);
- }
- };
-
- const handleDeleteUrl = async () => {
- urlEdit.setIsSaving(true);
- try {
- await props.onDeleteCustomUrl(props.host.id);
- showSuccess('Host URL removed');
- urlEdit.finishEditing();
- } catch (err) {
- const message = err instanceof Error ? err.message : 'Failed to remove URL';
- showError(message);
- urlEdit.setIsSaving(false);
- }
- };
@@ -1155,18 +1140,24 @@ const HostRow: Component<HostRowProps> = (props) => {
const diskStats = () => props.getDiskStats(props.host);
const rowClass = () => {
- const base = 'transition-all duration-200';
+ const base = 'transition-all duration-200 cursor-pointer';
const hover = 'hover:bg-gray-50 dark:hover:bg-gray-800/50';
const offline = !isOnline() ? 'opacity-60' : '';
- return `${base} ${hover} ${offline}`;
+ const expanded = props.isExpanded ? 'bg-blue-50/50 dark:bg-blue-900/20' : '';
+ return `${base} ${hover} ${offline} ${expanded}`;
};
return (
<>
- <tr class={rowClass()}>
+ <tr class={rowClass()} onClick={props.onToggleExpand}>
{/* Host Name - always visible */}
<td class="pl-4 pr-2 py-1 align-middle overflow-hidden">
<div class="flex items-center gap-2 min-w-0">
+ <div class={`transition-transform duration-200 ${props.isExpanded ? 'rotate-90' : ''}`}>
+ <svg class="w-3.5 h-3.5 text-gray-500" fill="none" viewBox="0 0 24 24" stroke="currentColor">
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
+ </svg>
+ </div>
<StatusDot
variant={hostStatus().variant}
title={hostStatus().label}
@@ -1218,16 +1209,7 @@ const HostRow: Component<HostRowProps> = (props) => {
</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={props.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>
+
</div>
</div>
@@ -1377,19 +1359,27 @@ const HostRow: Component<HostRowProps> = (props) => {
</tr>
{/* URL editing popover - using shared component */}
- <UrlEditPopover
- isOpen={urlEdit.isEditing() && urlEdit.editingId() === props.host.id}
- value={urlEdit.editingValue()}
- position={urlEdit.position()}
- isSaving={urlEdit.isSaving()}
- hasExistingUrl={!!props.customUrl}
- placeholder="https://192.168.1.100:8080"
- helpText="Add a URL to quickly access this host's web interface"
- onValueChange={urlEdit.setEditingValue}
- onSave={handleSaveUrl}
- onCancel={urlEdit.cancelEditing}
- onDelete={handleDeleteUrl}
- />
+
+
+ {/* Drawer Row */}
+ <Show when={props.isExpanded}>
+ <tr>
+ <td colspan={props.totalColumns} class="p-0 border-b border-gray-200 dark:border-gray-700 bg-gray-50/50 dark:bg-gray-800/50">
+ <div class="p-4 cursor-default" onClick={(e) => e.stopPropagation()}>
+ <HostDrawer
+ host={props.host}
+ onClose={props.onToggleExpand}
+ customUrl={props.customUrl}
+ onCustomUrlChange={(hostId, url) => {
+ // Optimistic update via the parent handler, which calls the metadata API
+ // We don't need to await here as the UI will update from the prop change
+ props.onUpdateCustomUrl(hostId, url);
+ }}
+ />
+ </div>
+ </td>
+ </tr>
+ </Show>
</>
);
};
diff --git a/frontend-modern/src/components/Kubernetes/KubernetesClusters.tsx b/frontend-modern/src/components/Kubernetes/KubernetesClusters.tsx
index e5892d90d4..2eb30c55c4 100644
--- a/frontend-modern/src/components/Kubernetes/KubernetesClusters.tsx
+++ b/frontend-modern/src/components/Kubernetes/KubernetesClusters.tsx
@@ -21,6 +21,12 @@ import { StatusDot } from '@/components/shared/StatusDot';
import { ColumnPicker } from '@/components/shared/ColumnPicker';
import { formatRelativeTime, formatBytes } from '@/utils/format';
import { DEGRADED_HEALTH_STATUSES, OFFLINE_HEALTH_STATUSES, type StatusIndicator } from '@/utils/status';
+import { DiscoveryTab } from '@/components/Discovery/DiscoveryTab';
+import { HistoryChart } from '@/components/shared/HistoryChart';
+import type { HistoryTimeRange } from '@/api/charts';
+
+// Global state for expanded row
+const [expandedRowId, setExpandedRowId] = createSignal<string | null>(null);
interface KubernetesClustersProps {
clusters: KubernetesCluster[];
@@ -145,6 +151,225 @@ const POD_COLUMNS: ColumnDef[] = [
{ id: 'age', label: 'Age', priority: 'primary', toggleable: true },
];
+const PodRow: Component<{
+ cluster: KubernetesCluster;
+ pod: KubernetesPod;
+ columns: { isColumnVisible: (id: string) => boolean };
+}> = (props) => {
+ const rowId = `${props.cluster.id}:${props.pod.uid}`;
+ const isExpanded = createMemo(() => expandedRowId() === rowId);
+ const [activeTab, setActiveTab] = createSignal<'overview' | 'discovery'>('overview');
+ const [customUrl, setCustomUrl] = createSignal<string | undefined>(undefined);
+ const [historyRange, setHistoryRange] = createSignal<HistoryTimeRange>('1h');
+
+ const toggle = (e: MouseEvent) => {
+ if ((e.target as HTMLElement).closest('a, button, input')) return;
+ setExpandedRowId(prev => prev === rowId ? null : rowId);
+ };
+
+ const statusBadge = () => getPodStatusBadge(props.pod);
+ const containers = () => props.pod.containers ?? [];
+ const readyContainers = () => containers().filter(c => c.ready).length;
+
+ return (
+ <>
+ <tr
+ class={`transition-colors cursor-pointer ${isExpanded() ? 'bg-gray-50 dark:bg-gray-800/40' : 'hover:bg-gray-50 dark:hover:bg-gray-900/20'}`}
+ onClick={toggle}
+ >
+ <td class="px-4 py-3 text-sm text-gray-900 dark:text-gray-100">
+ <div class="font-medium truncate max-w-[200px]" title={props.pod.name}>{props.pod.name}</div>
+ <div class="text-xs text-gray-500 dark:text-gray-400 truncate">
+ {props.pod.nodeName || 'unscheduled'}
+ </div>
+ </td>
+ <Show when={props.columns.isColumnVisible('namespace')}>
+ <td class="px-4 py-3 text-sm text-gray-700 dark:text-gray-300">
+ <span class="px-2 py-0.5 rounded bg-gray-100 dark:bg-gray-700 text-xs font-mono">
+ {props.pod.namespace}
+ </span>
+ </td>
+ </Show>
+ <Show when={props.columns.isColumnVisible('cluster')}>
+ <td class="px-4 py-3 text-sm text-gray-700 dark:text-gray-300">
+ {getClusterDisplayName(props.cluster)}
+ </td>
+ </Show>
+ <td class="px-4 py-3 text-sm">
+ <span class={`inline-flex px-2 py-0.5 rounded-full text-xs font-medium ${statusBadge().class}`}>
+ {statusBadge().label}
+ </span>
+ </td>
+ <Show when={props.columns.isColumnVisible('ready')}>
+ <td class="px-4 py-3 text-sm">
+ <span class={readyContainers() === containers().length ? 'text-green-600 dark:text-green-400' : 'text-amber-600 dark:text-amber-400'}>
+ {readyContainers()}/{containers().length}
+ </span>
+ </td>
+ </Show>
+ <Show when={props.columns.isColumnVisible('restarts')}>
+ <td class="px-4 py-3 text-sm text-gray-700 dark:text-gray-300">
+ <Show when={(props.pod.restarts ?? 0) > 0} fallback={<span class="text-gray-400">0</span>}>
+ <span class="text-amber-600 dark:text-amber-400 font-medium">{props.pod.restarts}</span>
+ </Show>
+ </td>
+ </Show>
+ <Show when={props.columns.isColumnVisible('image')}>
+ <td class="px-4 py-3 text-sm text-gray-700 dark:text-gray-300">
+ <span class="font-mono text-xs truncate max-w-[150px] block" title={(props.pod.containers ?? [])[0]?.image}>
+ {getPrimaryImage(props.pod)}
+ </span>
+ </td>
+ </Show>
+ <Show when={props.columns.isColumnVisible('age')}>
+ <td class="px-4 py-3 text-sm text-gray-700 dark:text-gray-300 whitespace-nowrap">
+ {formatAge(props.pod.createdAt)}
+ </td>
+ </Show>
+ </tr>
+
+ <Show when={isExpanded()}>
+ <tr>
+ <td colspan={8} class="p-0">
+ <div class="w-0 min-w-full bg-gray-50 dark:bg-gray-900/60 px-4 py-3 overflow-hidden">
+ {/* Tabs Header */}
+ <div class="flex border-b border-gray-200 dark:border-gray-700/50 mb-4 bg-white/50 dark:bg-gray-800/50 backdrop-blur-sm sticky top-0 z-10 -mx-4 px-4 pt-2">
+ <button
+ type="button"
+ class={`px-4 py-2 text-xs font-medium border-b-2 transition-colors ${activeTab() === 'overview' ? 'border-blue-500 text-blue-600 dark:text-blue-400' : 'border-transparent text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300'}`}
+ onClick={(e) => { e.stopPropagation(); setActiveTab('overview'); }}
+ >
+ Overview
+ </button>
+ <button
+ type="button"
+ class={`px-4 py-2 text-xs font-medium border-b-2 transition-colors ${activeTab() === 'discovery' ? 'border-blue-500 text-blue-600 dark:text-blue-400' : 'border-transparent text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300'}`}
+ onClick={(e) => { e.stopPropagation(); setActiveTab('discovery'); }}
+ >
+ Discovery
+ </button>
+ </div>
+
+ <div class={activeTab() === 'overview' ? '' : 'hidden'}>
+ {/* Overview Content */}
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
+ <Card>
+ <div class="p-4 space-y-3">
+ <h3 class="text-sm font-medium text-gray-900 dark:text-gray-100">Details</h3>
+ <div class="grid grid-cols-2 gap-2 text-xs">
+ <div class="text-gray-500 dark:text-gray-400">ID</div>
+ <div class="font-mono truncate" title={props.pod.uid}>{props.pod.uid}</div>
+ <div class="text-gray-500 dark:text-gray-400">QoS Class</div>
+ <div>{props.pod.qosClass || '—'}</div>
+ </div>
+ </div>
+ </Card>
+
+ <Card>
+ <div class="p-4 space-y-3">
+ <div class="flex justify-between items-center">
+ <h3 class="text-sm font-medium text-gray-900 dark:text-gray-100">Containers</h3>
+ <span class="text-xs text-gray-500">{containers().length}</span>
+ </div>
+ <div class="space-y-2 max-h-[300px] overflow-y-auto">
+ <For each={containers()}>
+ {(container) => (
+ <div class="border rounded p-2 text-xs bg-gray-50 dark:bg-gray-800">
+ <div class="flex justify-between font-medium">
+ <span>{container.name}</span>
+ <span class={container.ready ? 'text-green-600' : 'text-amber-600'}>{container.state}</span>
+ </div>
+ <div class="font-mono text-gray-500 truncate" title={container.image}>{container.image}</div>
+ <div class="mt-1 flex gap-2 text-[10px] text-gray-400">
+ <span>Restarts: {container.restartCount}</span>
+ </div>
+ </div>
+ )}
+ </For>
+ </div>
+ </div>
+ </Card>
+ </div>
+ <div class="mt-3 space-y-3">
+ <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>
+
+ <div class="relative">
+ <div class="space-y-3">
+ <div class="flex flex-wrap gap-3 [&>*]:flex-1 [&>*]:basis-[calc(50%-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="k8s"
+ resourceId={props.pod.uid}
+ 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="k8s"
+ resourceId={props.pod.uid}
+ metric="memory"
+ height={120}
+ color="#f59e0b"
+ label="Memory"
+ unit="%"
+ range={historyRange()}
+ hideSelector={true}
+ compact={true}
+ hideLock={true}
+ />
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div class={activeTab() === 'discovery' ? '' : 'hidden'}>
+ <DiscoveryTab
+ resourceType="k8s"
+ hostId={props.cluster.id}
+ resourceId={props.pod.uid}
+ guestId={props.pod.uid}
+ hostname={props.pod.name}
+ customUrl={customUrl()}
+ onCustomUrlChange={setCustomUrl}
+ />
+ </div>
+ </div>
+ </td>
+ </tr>
+ </Show>
+ </>
+ );
+};
+
export const KubernetesClusters: Component<KubernetesClustersProps> = (props) => {
const [search, setSearch] = createSignal('');
// PERFORMANCE: Debounce search term to prevent jank during rapid typing
@@ -1071,62 +1296,12 @@ export const KubernetesClusters: Component<KubernetesClustersProps> = (props) =>
<tr><td colSpan={8} class="px-4 py-8 text-center text-sm text-gray-500 dark:text-gray-400">No pods match the current filters.</td></tr>
}>
{({ cluster, pod }) => {
- const statusBadge = () => getPodStatusBadge(pod);
- const containers = () => pod.containers ?? [];
- const readyContainers = () => containers().filter(c => c.ready).length;
-
return (
- <tr class="hover:bg-gray-50 dark:hover:bg-gray-900/20">
- <td class="px-4 py-3 text-sm text-gray-900 dark:text-gray-100">
- <div class="font-medium truncate max-w-[200px]" title={pod.name}>{pod.name}</div>
- <div class="text-xs text-gray-500 dark:text-gray-400 truncate">
- {pod.nodeName || 'unscheduled'}
- </div>
- </td>
- <Show when={podColumns.isColumnVisible('namespace')}>
- <td class="px-4 py-3 text-sm text-gray-700 dark:text-gray-300">
- <span class="px-2 py-0.5 rounded bg-gray-100 dark:bg-gray-700 text-xs font-mono">
- {pod.namespace}
- </span>
- </td>
- </Show>
- <Show when={podColumns.isColumnVisible('cluster')}>
- <td class="px-4 py-3 text-sm text-gray-700 dark:text-gray-300">
- {getClusterDisplayName(cluster)}
- </td>
- </Show>
- <td class="px-4 py-3 text-sm">
- <span class={`inline-flex px-2 py-0.5 rounded-full text-xs font-medium ${statusBadge().class}`}>
- {statusBadge().label}
- </span>
- </td>
- <Show when={podColumns.isColumnVisible('ready')}>
- <td class="px-4 py-3 text-sm">
- <span class={readyContainers() === containers().length ? 'text-green-600 dark:text-green-400' : 'text-amber-600 dark:text-amber-400'}>
- {readyContainers()}/{containers().length}
- </span>
- </td>
- </Show>
- <Show when={podColumns.isColumnVisible('restarts')}>
- <td class="px-4 py-3 text-sm text-gray-700 dark:text-gray-300">
- <Show when={(pod.restarts ?? 0) > 0} fallback={<span class="text-gray-400">0</span>}>
- <span class="text-amber-600 dark:text-amber-400 font-medium">{pod.restarts}</span>
- </Show>
- </td>
- </Show>
- <Show when={podColumns.isColumnVisible('image')}>
- <td class="px-4 py-3 text-sm text-gray-700 dark:text-gray-300">
- <span class="font-mono text-xs truncate max-w-[150px] block" title={(pod.containers ?? [])[0]?.image}>
- {getPrimaryImage(pod)}
- </span>
- </td>
- </Show>
- <Show when={podColumns.isColumnVisible('age')}>
- <td class="px-4 py-3 text-sm text-gray-700 dark:text-gray-300 whitespace-nowrap">
- {formatAge(pod.createdAt)}
- </td>
- </Show>
- </tr>
+ <PodRow
+ cluster={cluster}
+ pod={pod}
+ columns={podColumns}
+ />
);
}}
</For>
diff --git a/frontend-modern/src/components/Replication/Replication.tsx b/frontend-modern/src/components/Replication/Replication.tsx
index 4b29b9c882..c6985f2e79 100644
--- a/frontend-modern/src/components/Replication/Replication.tsx
+++ b/frontend-modern/src/components/Replication/Replication.tsx
@@ -483,14 +483,14 @@ const Replication: Component = () => {
}
>
<div class="overflow-x-auto">
- <table class="w-full min-w-[900px]">
+ <table class="w-full">
<thead class="bg-gray-50 dark:bg-gray-800/60 border-b border-gray-200 dark:border-gray-700">
<tr>
- <th class={`${thClass} pl-4`}>Guest</th>
- <th class={thClass}>Job</th>
- <th class={thClass}>Source → Target</th>
- <th class={thClass}>Last Sync</th>
- <th class={thClass}>Next Sync</th>
+ <th class={`${thClass} pl-4 w-[160px] sm:w-[220px]`}>Guest</th>
+ <th class={`${thClass} hidden sm:table-cell`}>Job</th>
+ <th class={`${thClass} hidden md:table-cell`}>Source → Target</th>
+ <th class={`${thClass} hidden lg:table-cell`}>Last Sync</th>
+ <th class={`${thClass} hidden sm:table-cell`}>Next Sync</th>
<th class={thClass}>Status</th>
</tr>
</thead>
@@ -509,7 +509,7 @@ const Replication: Component = () => {
: 'hover:bg-gray-50/80 dark:hover:bg-gray-800/50'
}`}>
<td class="px-3 py-3 pl-4">
- <div class="font-medium text-sm text-gray-900 dark:text-gray-100">
+ <div class="font-medium text-sm text-gray-900 dark:text-gray-100 truncate max-w-[140px] sm:max-w-[200px]" title={job.guestName || `VM ${job.guestId ?? ''}`}>
{job.guestName || `VM ${job.guestId ?? ''}`}
</div>
<div class="text-xs text-gray-500 dark:text-gray-400 flex items-center gap-1">
@@ -519,13 +519,13 @@ const Replication: Component = () => {
<span>· ID {job.guestId ?? '—'}</span>
</div>
</td>
- <td class="px-3 py-3">
+ <td class="px-3 py-3 hidden sm:table-cell">
<div class="font-mono text-sm text-gray-700 dark:text-gray-300">{job.jobId || '—'}</div>
<div class="text-xs text-gray-500 dark:text-gray-400">
{job.schedule || '*/15'}
</div>
</td>
- <td class="px-3 py-3">
+ <td class="px-3 py-3 hidden md:table-cell">
<div class="flex items-center gap-2 text-sm">
<span class="text-gray-700 dark:text-gray-300">{job.sourceNode || '—'}</span>
<svg class="w-4 h-4 text-gray-400 flex-shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
@@ -534,7 +534,7 @@ const Replication: Component = () => {
<span class="text-gray-700 dark:text-gray-300">{job.targetNode || '—'}</span>
</div>
</td>
- <td class="px-3 py-3">
+ <td class="px-3 py-3 hidden lg:table-cell">
<Show when={job.lastSyncTime} fallback={
<span class="text-gray-400 text-sm">Never</span>
}>
@@ -549,7 +549,7 @@ const Replication: Component = () => {
</div>
</Show>
</td>
- <td class="px-3 py-3">
+ <td class="px-3 py-3 hidden sm:table-cell">
<div class={`text-sm font-medium ${nextSyncInfo.isOverdue
? 'text-red-600 dark:text-red-400'
: nextSyncInfo.isImminent
diff --git a/frontend-modern/src/components/Storage/Storage.tsx b/frontend-modern/src/components/Storage/Storage.tsx
index 67f16982a5..e0a5d3c930 100644
--- a/frontend-modern/src/components/Storage/Storage.tsx
+++ b/frontend-modern/src/components/Storage/Storage.tsx
@@ -71,7 +71,7 @@ const Storage: Component = () => {
{ id: 'content', label: 'Content', priority: 'supplementary', toggleable: true },
{ id: 'status', label: 'Status', priority: 'primary', toggleable: true },
{ id: 'shared', label: 'Shared', priority: 'detailed', toggleable: true },
- { id: 'free', label: 'Free', priority: 'supplementary', toggleable: true },
+ { id: 'free', label: 'Free', priority: 'secondary', toggleable: true },
{ id: 'total', label: 'Total', priority: 'secondary', toggleable: true },
];
@@ -81,7 +81,7 @@ const Storage: Component = () => {
STORAGE_COLUMNS
);
- const isColumnVisible = (id: string) => !columnVisibility.isHiddenByUser(id);
+ const isColumnVisible = (id: string) => columnVisibility.isColumnVisible(id);
// PERFORMANCE: Debounce search term to prevent jank during rapid typing
const debouncedSearchTerm = useDebouncedValue(() => searchTerm(), 200);
@@ -812,10 +812,10 @@ const Storage: Component = () => {
<style>{`
.overflow-x-auto::-webkit-scrollbar { display: none; }
`}</style>
- <table class="w-full" style={{ "min-width": "800px" }}>
+ <table class="w-full">
<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-600">
- <th class="px-1.5 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider w-auto">
+ <th class="px-1.5 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider" style={{ width: '200px' }}>
Storage
</th>
<Show when={isColumnVisible('type')}>
diff --git a/frontend-modern/src/components/shared/NodeDrawer.tsx b/frontend-modern/src/components/shared/NodeDrawer.tsx
new file mode 100644
index 0000000000..10b5e6856b
--- /dev/null
+++ b/frontend-modern/src/components/shared/NodeDrawer.tsx
@@ -0,0 +1,287 @@
+import { Component, Show, Suspense, createSignal, createEffect } from 'solid-js';
+import { Node } from '@/types/api';
+import { formatBytes, formatUptime } from '@/utils/format';
+import { HistoryChart } from '../shared/HistoryChart';
+import { ResourceType, HistoryTimeRange } from '@/api/charts';
+import { hasFeature } from '@/stores/license';
+import { DiscoveryTab } from '../Discovery/DiscoveryTab';
+import { StackedDiskBar } from '@/components/Dashboard/StackedDiskBar';
+import { HostMetadataAPI } from '@/api/hostMetadata';
+
+interface NodeDrawerProps {
+ node: Node;
+ customUrl?: string; // Nodes don't typically have custom URL in current architecture but we can keep it
+ onCustomUrlChange?: (hostId: string, url: string) => void;
+}
+
+export const NodeDrawer: Component<NodeDrawerProps> = (props) => {
+ const [activeTab, setActiveTab] = createSignal<'overview' | 'discovery'>('overview');
+ const [historyRange, setHistoryRange] = createSignal<HistoryTimeRange>('1h');
+
+ // For nodes, we treat them as 'host' for charts if consistent, or 'node' if charts API expects it.
+ // Charts API (api/charts.ts) shows ResourceType includes 'node' and 'host'.
+ // Typically 'node' is used for PVE nodes.
+ const metricsResource = { type: 'node' as ResourceType, id: props.node.id || props.node.name };
+
+ // Fetch custom URL from metadata
+ const [fetchedCustomUrl, setFetchedCustomUrl] = createSignal<string | undefined>(props.customUrl);
+
+ // Fetch metadata on mount
+ createEffect(() => {
+ const hostId = props.node.id || props.node.name;
+ HostMetadataAPI.getMetadata(hostId).then(meta => {
+ if (meta && meta.customUrl) {
+ setFetchedCustomUrl(meta.customUrl);
+ }
+ }).catch(e => console.error("Failed to load node metadata", e));
+ });
+
+ const handleCustomUrlChange = (url: string) => {
+ setFetchedCustomUrl(url);
+ if (props.onCustomUrlChange) {
+ props.onCustomUrlChange(props.node.id || props.node.name, url);
+ }
+ };
+
+ const switchTab = (tab: 'overview' | 'discovery') => {
+ setActiveTab(tab);
+ };
+
+ const isHistoryLocked = () => !hasFeature('long_term_metrics') && (historyRange() === '30d' || historyRange() === '90d');
+
+ const diskStats = () => {
+ if (!props.node.disk) return { percent: 0, used: 0, total: 0 };
+ const total = props.node.disk.total || 0;
+ const used = props.node.disk.used || 0;
+ return {
+ percent: total > 0 ? (used / total) * 100 : 0,
+ used: used,
+ total: total
+ };
+ };
+
+ 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={() => 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'
+ }`}
+ >
+ Overview
+ {activeTab() === 'overview' && (
+ <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={() => 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'
+ }`}
+ >
+ Discovery
+ {activeTab() === 'discovery' && (
+ <div class="absolute bottom-0 left-0 right-0 h-0.5 bg-blue-600 dark:bg-blue-400 rounded-t-full" />
+ )}
+ </button>
+ </div>
+
+ {/* Overview Tab */}
+ <div class={activeTab() === 'overview' ? '' : 'hidden'} style={{ "overflow-anchor": "none" }}>
+ <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]">
+ <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 select-all">{props.node.name}</span>
+ </div>
+ <div class="flex items-center justify-between">
+ <span class="text-gray-500 dark:text-gray-400">Version</span>
+ <span class="font-medium text-gray-700 dark:text-gray-200">{props.node.pveVersion}</span>
+ </div>
+ <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">{props.node.kernelVersion}</span>
+ </div>
+ <Show when={props.node.uptime}>
+ <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.node.uptime!)}</span>
+ </div>
+ </Show>
+ </div>
+ </div>
+
+ {/* Hardware 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">Hardware</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">CPU Model</span>
+ <div class="font-medium text-gray-700 dark:text-gray-200 text-right truncate max-w-[150px]" title={props.node.cpuInfo?.model || 'Unknown'}>
+ {props.node.cpuInfo?.model || 'Unknown'}
+ </div>
+ </div>
+ <div class="flex items-center justify-between">
+ <span class="text-gray-500 dark:text-gray-400">Cores</span>
+ <span class="font-medium text-gray-700 dark:text-gray-200">{props.node.cpuInfo?.cores || 0}</span>
+ </div>
+ <div class="flex items-center justify-between">
+ <span class="text-gray-500 dark:text-gray-400">Memory</span>
+ <span class="font-medium text-gray-700 dark:text-gray-200">
+ {formatBytes(props.node.memory?.total || 0)}
+ </span>
+ </div>
+ </div>
+ </div>
+
+ {/* Disk Usage */}
+ <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">Root Disk</div>
+ <div class="mb-3">
+ <div class="flex justify-between text-[10px] mb-1">
+ <span class="text-gray-500 dark:text-gray-400">Usage</span>
+ <span class="text-gray-700 dark:text-gray-200">
+ {formatBytes(diskStats().used)} / {formatBytes(diskStats().total)}
+ </span>
+ </div>
+ <StackedDiskBar
+ aggregateDisk={{
+ total: diskStats().total,
+ used: diskStats().used,
+ free: diskStats().total - diskStats().used,
+ usage: diskStats().percent / 100
+ }}
+ />
+ </div>
+ </div>
+ </div>
+
+ {/* Performance Charts */}
+ <div class="mt-3 space-y-3">
+ <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>
+
+ <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>
+ {/* 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-indigo-500 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>
+
+ {/* Discovery Tab */}
+ <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="host" /* Assuming 'host' type works for PVE nodes discovery, or if backend treats them same */
+ hostId={props.node.id || props.node.name}
+ resourceId={props.node.id || props.node.name}
+ hostname={props.node.name}
+ guestId={props.node.id || props.node.name}
+ customUrl={fetchedCustomUrl()}
+ onCustomUrlChange={handleCustomUrlChange}
+ />
+ </Suspense>
+ </div>
+ </div>
+ );
+};
+
diff --git a/frontend-modern/src/components/shared/NodeSummaryTable.tsx b/frontend-modern/src/components/shared/NodeSummaryTable.tsx
index 7a991c00b6..14a634dca7 100644
--- a/frontend-modern/src/components/shared/NodeSummaryTable.tsx
+++ b/frontend-modern/src/components/shared/NodeSummaryTable.tsx
@@ -1,4 +1,4 @@
-import { Component, For, Show, createMemo, createSignal } from 'solid-js';
+import { Component, For, Show, createMemo, createSignal, lazy, Suspense } from 'solid-js';
import type { Node, VM, Container, Storage, PBSInstance } from '@/types/api';
import { formatBytes, formatUptime } from '@/utils/format';
import { useWebSocket } from '@/App';
@@ -18,6 +18,9 @@ import { TemperatureGauge } from '@/components/shared/TemperatureGauge';
import { useBreakpoint } from '@/hooks/useBreakpoint';
import { useMetricsViewMode } from '@/stores/metricsViewMode';
+// Lazy load NodeDrawer to avoid circular dependencies and reduce bundle size
+const NodeDrawer = lazy(() => import('./NodeDrawer').then(m => ({ default: m.NodeDrawer })));
+
interface NodeSummaryTableProps {
nodes: Node[];
pbsInstances?: PBSInstance[];
@@ -52,7 +55,8 @@ export const NodeSummaryTable: Component<NodeSummaryTableProps> = (props) => {
type TableItem = Node | PBSInstance;
const isPVE = (item: TableItem): item is Node => {
- return (item as Node).pveVersion !== undefined;
+ // Check for pveVersion OR if type is specifically 'node' (from API)
+ return (item as Node).pveVersion !== undefined || (item as any).type === 'node';
};
type CountSortKey = 'vmCount' | 'containerCount' | 'storageCount' | 'diskCount' | 'backupCount';
@@ -69,6 +73,13 @@ export const NodeSummaryTable: Component<NodeSummaryTableProps> = (props) => {
const [sortKey, setSortKey] = createSignal<SortKey>('default');
const [sortDirection, setSortDirection] = createSignal<'asc' | 'desc'>('asc');
+ const [expandedNodeId, setExpandedNodeId] = createSignal<string | null>(null);
+
+ const toggleNodeExpand = (nodeId: string, e: MouseEvent) => {
+ e.stopPropagation();
+ setExpandedNodeId(prev => prev === nodeId ? null : nodeId);
+ };
+
const hasAnyTemperatureData = createMemo(() => {
return (
props.nodes?.some(
@@ -354,12 +365,14 @@ export const NodeSummaryTable: Component<NodeSummaryTableProps> = (props) => {
<table class="w-full border-collapse whitespace-nowrap" style={{ "table-layout": "fixed", "min-width": "800px" }}>
<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={`${thClassBase} text-left pl-3`}
onClick={() => handleSort('name')}
>
{props.currentTab === 'backups' ? 'Node / PBS' : 'Node'} {renderSortIndicator('name')}
</th>
+
<th class={thClass} style={{ width: '80px', "min-width": '80px', "max-width": '80px' }} onClick={() => handleSort('uptime')}>
Uptime {renderSortIndicator('uptime')}
</th>
@@ -398,6 +411,10 @@ export const NodeSummaryTable: Component<NodeSummaryTableProps> = (props) => {
Backups {renderSortIndicator('backupCount')}
</th>
</Show>
+ {/* Link icon column moved to end */}
+ <th class={thClass} style={{ width: '28px', "min-width": '28px', "max-width": '28px' }}>
+ {/* Link icon column */}
+ </th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200 dark:divide-gray-700">
@@ -426,6 +443,7 @@ export const NodeSummaryTable: Component<NodeSummaryTableProps> = (props) => {
const nodeId = isPVEItem ? node!.id : pbs!.name;
const isSelected = () => props.selectedNode === nodeId;
+ const isExpanded = () => expandedNodeId() === nodeId;
const resourceId = isPVEItem ? node!.id || node!.name : pbs!.id || pbs!.name;
const metricsKey = buildMetricKey('node', resourceId);
const alertStyles = createMemo(() =>
@@ -484,310 +502,352 @@ export const NodeSummaryTable: Component<NodeSummaryTableProps> = (props) => {
});
return (
- <tr
- class={rowClass()}
- style={{ ...rowStyle(), 'min-height': '36px' }}
- onClick={() => props.onNodeClick(nodeId, isPVEItem ? 'pve' : 'pbs')}
- >
- {/* Name */}
- <td class={`pr-2 py-1 align-middle overflow-hidden ${showAlertHighlight() ? 'pl-4' : 'pl-3'}`}>
- <div class="flex items-center gap-1.5 min-w-0">
- <StatusDot
- variant={statusIndicator().variant}
- title={statusIndicator().label}
- ariaLabel={statusIndicator().label}
- size="xs"
- />
- <a
- href={
- isPVEItem
- ? node!.guestURL || node!.host || `https://${node!.name}:8006`
- : pbs!.guestURL || pbs!.host || `https://${pbs!.name}:8007`
- }
- target="_blank"
- onClick={(e) => e.stopPropagation()}
- class="font-medium text-[11px] text-gray-900 dark:text-gray-100 hover:text-blue-600 dark:hover:text-blue-400 whitespace-nowrap"
- title={displayName()}
- >
- {displayName()}
- </a>
- <Show when={showActualName()}>
- <span class="text-[9px] text-gray-500 dark:text-gray-400 whitespace-nowrap">
- ({(node as Node).name})
- </span>
- </Show>
- <div class="hidden xl:flex items-center gap-1.5 ml-1 flex-shrink min-w-0 overflow-hidden">
+ <>
+ <tr
+ class={rowClass()}
+ style={{ ...rowStyle(), 'min-height': '36px' }}
+ onClick={() => props.onNodeClick(nodeId, isPVEItem ? 'pve' : 'pbs')}
+ >
+ {/* Name */}
+ <td class={`pr-2 py-1 align-middle overflow-hidden ${showAlertHighlight() ? 'pl-4' : 'pl-3'}`}>
+ <div class="flex items-center gap-1.5 min-w-0">
<Show when={isPVEItem}>
- <span class="text-[9px] px-1 py-0 rounded font-medium bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400">
- PVE
- </span>
- </Show>
- <Show when={isPVEItem && node!.pveVersion}>
- <span class="text-[9px] text-gray-500 dark:text-gray-400 whitespace-nowrap">
- v{node!.pveVersion.split('/')[1] || node!.pveVersion}
- </span>
- </Show>
- <Show when={isPVEItem && node!.isClusterMember !== undefined}>
- <span
- class={`text-[9px] px-1 py-0 rounded font-medium whitespace-nowrap ${node!.isClusterMember
- ? 'bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400'
- : 'bg-gray-100 text-gray-600 dark:bg-gray-700/50 dark:text-gray-400'
- }`}
- >
- {node!.isClusterMember ? node!.clusterName : 'Standalone'}
- </span>
- </Show>
- <Show when={isPVEItem && node!.linkedHostAgentId}>
- <span
- class="text-[9px] px-1 py-0 rounded font-medium whitespace-nowrap bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400"
- title="Pulse host agent installed for enhanced metrics"
- >
- +Agent
- </span>
- </Show>
- <Show when={isPVEItem && online && node!.pendingUpdates !== undefined && node!.pendingUpdates > 0}>
- <span
- class={`text-[9px] px-1 py-0 rounded font-medium whitespace-nowrap ${(node!.pendingUpdates ?? 0) >= 10
- ? 'bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400'
- : 'bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400'
- }`}
- title={`${node!.pendingUpdates} pending apt update${node!.pendingUpdates !== 1 ? 's' : ''}`}
+ <div
+ class={`cursor-pointer transition-transform duration-200 ${isExpanded() ? 'rotate-90' : ''}`}
+ onClick={(e) => toggleNodeExpand(nodeId, e)}
>
- {node!.pendingUpdates} updates
- </span>
- </Show>
- <Show when={isPBSItem}>
- <span class="text-[9px] px-1 py-0 rounded font-medium bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400">
- PBS
- </span>
+ <svg class="w-3.5 h-3.5 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300" fill="none" viewBox="0 0 24 24" stroke="currentColor">
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
+ </svg>
+ </div>
</Show>
- <Show when={isPBSItem && pbs!.version}>
+ <StatusDot
+ variant={statusIndicator().variant}
+ title={statusIndicator().label}
+ ariaLabel={statusIndicator().label}
+ size="xs"
+ />
+ <span
+ class="font-medium text-[11px] text-gray-900 dark:text-gray-100 whitespace-nowrap select-text"
+ title={displayName()}
+ >
+ {displayName()}
+ </span>
+ <Show when={showActualName()}>
<span class="text-[9px] text-gray-500 dark:text-gray-400 whitespace-nowrap">
- v{pbs!.version}
+ ({(node as Node).name})
</span>
</Show>
+ <div class="hidden xl:flex items-center gap-1.5 ml-1 flex-shrink min-w-0 overflow-hidden">
+ <Show when={isPVEItem}>
+ <span class="text-[9px] px-1 py-0 rounded font-medium bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400">
+ PVE
+ </span>
+ </Show>
+ <Show when={isPVEItem && node!.pveVersion}>
+ <span class="text-[9px] text-gray-500 dark:text-gray-400 whitespace-nowrap">
+ v{node!.pveVersion.split('/')[1] || node!.pveVersion}
+ </span>
+ </Show>
+ <Show when={isPVEItem && node!.isClusterMember !== undefined}>
+ <span
+ class={`text-[9px] px-1 py-0 rounded font-medium whitespace-nowrap ${node!.isClusterMember
+ ? 'bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400'
+ : 'bg-gray-100 text-gray-600 dark:bg-gray-700/50 dark:text-gray-400'
+ }`}
+ >
+ {node!.isClusterMember ? node!.clusterName : 'Standalone'}
+ </span>
+ </Show>
+ <Show when={isPVEItem && node!.linkedHostAgentId}>
+ <span
+ class="text-[9px] px-1 py-0 rounded font-medium whitespace-nowrap bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400"
+ title="Pulse host agent installed for enhanced metrics"
+ >
+ +Agent
+ </span>
+ </Show>
+ <Show when={isPVEItem && online && node!.pendingUpdates !== undefined && node!.pendingUpdates > 0}>
+ <span
+ class={`text-[9px] px-1 py-0 rounded font-medium whitespace-nowrap ${(node!.pendingUpdates ?? 0) >= 10
+ ? 'bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400'
+ : 'bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400'
+ }`}
+ title={`${node!.pendingUpdates} pending apt update${node!.pendingUpdates !== 1 ? 's' : ''}`}
+ >
+ {node!.pendingUpdates} updates
+ </span>
+ </Show>
+ <Show when={isPBSItem}>
+ <span class="text-[9px] px-1 py-0 rounded font-medium bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400">
+ PBS
+ </span>
+ </Show>
+ <Show when={isPBSItem && pbs!.version}>
+ <span class="text-[9px] text-gray-500 dark:text-gray-400 whitespace-nowrap">
+ v{pbs!.version}
+ </span>
+ </Show>
+ </div>
</div>
- </div>
- </td>
-
- {/* Uptime */}
- <td class={tdClass}>
- <div class="flex justify-center">
- <span
- class={`text-xs whitespace-nowrap ${isPVEItem && (node?.uptime ?? 0) < 3600
- ? 'text-orange-500'
- : 'text-gray-600 dark:text-gray-400'
- }`}
- >
- <Show when={online && uptimeValue} fallback="-">
- <Show when={isMobile()} fallback={formatUptime(uptimeValue)}>
- {formatUptime(uptimeValue, true)}
+ </td>
+
+
+
+ {/* Uptime */}
+ <td class={tdClass}>
+ <div class="flex justify-center">
+ <span
+ class={`text-xs whitespace-nowrap ${isPVEItem && (node?.uptime ?? 0) < 3600
+ ? 'text-orange-500'
+ : 'text-gray-600 dark:text-gray-400'
+ }`}
+ >
+ <Show when={online && uptimeValue} fallback="-">
+ <Show when={isMobile()} fallback={formatUptime(uptimeValue)}>
+ {formatUptime(uptimeValue, true)}
+ </Show>
</Show>
- </Show>
- </span>
- </div>
- </td>
-
- {/* CPU */}
- <td class={tdClass} style={isMobile() ? { "min-width": "80px" } : metricColumnStyle}>
- <div class="h-5">
- <EnhancedCPUBar
- usage={cpuPercentValue}
- loadAverage={isPVEItem ? node!.loadAverage?.[0] : undefined}
- cores={isMobile() ? undefined : (isPVEItem ? node!.cpuInfo?.cores : undefined)}
- model={isPVEItem ? node!.cpuInfo?.model : undefined}
- resourceId={metricsKey}
- />
- </div>
- </td>
-
- {/* Memory */}
- <td class={tdClass} style={isMobile() ? { "min-width": "80px" } : metricColumnStyle}>
- <div class="h-5">
- <Show when={isPVEItem} fallback={
- <ResponsiveMetricCell
- value={memoryPercentValue}
- type="memory"
+ </span>
+ </div>
+ </td>
+
+ {/* CPU */}
+ <td class={tdClass} style={isMobile() ? { "min-width": "80px" } : metricColumnStyle}>
+ <div class="h-5">
+ <EnhancedCPUBar
+ usage={cpuPercentValue}
+ loadAverage={isPVEItem ? node!.loadAverage?.[0] : undefined}
+ cores={isMobile() ? undefined : (isPVEItem ? node!.cpuInfo?.cores : undefined)}
+ model={isPVEItem ? node!.cpuInfo?.model : undefined}
resourceId={metricsKey}
- sublabel={pbs!.memoryTotal ? `${formatBytes(pbs!.memoryUsed)}/${formatBytes(pbs!.memoryTotal)}` : undefined}
- isRunning={online}
- showMobile={false}
/>
- }>
- <Show
- when={viewMode() === 'sparklines'}
- fallback={
- <StackedMemoryBar
- used={node!.memory?.used || 0}
- total={node!.memory?.total || 0}
- balloon={node!.memory?.balloon || 0}
- swapUsed={node!.memory?.swapUsed || 0}
- swapTotal={node!.memory?.swapTotal || 0}
- resourceId={metricsKey}
- />
- }
- >
+ </div>
+ </td>
+
+ {/* Memory */}
+ <td class={tdClass} style={isMobile() ? { "min-width": "80px" } : metricColumnStyle}>
+ <div class="h-5">
+ <Show when={isPVEItem} fallback={
<ResponsiveMetricCell
value={memoryPercentValue}
type="memory"
resourceId={metricsKey}
+ sublabel={pbs!.memoryTotal ? `${formatBytes(pbs!.memoryUsed)}/${formatBytes(pbs!.memoryTotal)}` : undefined}
isRunning={online}
showMobile={false}
/>
- </Show>
- </Show>
- </div>
- </td>
-
- {/* Disk */}
- <td class={tdClass} style={isMobile() ? { "min-width": "80px" } : metricColumnStyle}>
- <div class="h-5">
- <Show when={isPVEItem} fallback={
- <ResponsiveMetricCell
- value={diskPercentValue}
- type="disk"
- resourceId={metricsKey}
- sublabel={diskSublabel}
- isRunning={online}
- showMobile={false}
- />
- }>
- <Show
- when={viewMode() === 'sparklines'}
- fallback={
- <StackedDiskBar
- aggregateDisk={{
- total: node!.disk?.total || 0,
- used: node!.disk?.used || 0,
- free: (node!.disk?.total || 0) - (node!.disk?.used || 0),
- usage: node!.disk?.total ? (node!.disk.used / node!.disk.total) : 0
- }}
+ }>
+ <Show
+ when={viewMode() === 'sparklines'}
+ fallback={
+ <StackedMemoryBar
+ used={node!.memory?.used || 0}
+ total={node!.memory?.total || 0}
+ balloon={node!.memory?.balloon || 0}
+ swapUsed={node!.memory?.swapUsed || 0}
+ swapTotal={node!.memory?.swapTotal || 0}
+ resourceId={metricsKey}
+ />
+ }
+ >
+ <ResponsiveMetricCell
+ value={memoryPercentValue}
+ type="memory"
+ resourceId={metricsKey}
+ isRunning={online}
+ showMobile={false}
/>
- }
- >
+ </Show>
+ </Show>
+ </div>
+ </td>
+
+ {/* Disk */}
+ <td class={tdClass} style={isMobile() ? { "min-width": "80px" } : metricColumnStyle}>
+ <div class="h-5">
+ <Show when={isPVEItem} fallback={
<ResponsiveMetricCell
value={diskPercentValue}
type="disk"
resourceId={metricsKey}
+ sublabel={diskSublabel}
isRunning={online}
showMobile={false}
/>
- </Show>
- </Show>
- </div>
- </td>
-
- {/* Temperature */}
- <Show when={hasAnyTemperatureData()}>
- <td class={tdClass}>
- <div class="flex justify-center">
- <Show
- when={
- online &&
- isPVEItem &&
- cpuTemperatureValue !== null &&
- (node!.temperature?.hasCPU ?? node!.temperature?.hasGPU ?? node!.temperature?.available) &&
- isTemperatureMonitoringEnabled(node!)
- }
- fallback={<span class="text-xs text-gray-400 dark:text-gray-500">-</span>}
- >
- {(() => {
- const value = cpuTemperatureValue as number;
- const temp = node!.temperature;
- const cpuMinValue =
- typeof temp?.cpuMin === 'number' && temp.cpuMin > 0 ? temp.cpuMin : null;
- const cpuMaxValue =
- typeof temp?.cpuMaxRecord === 'number' && temp.cpuMaxRecord > 0
- ? temp.cpuMaxRecord
- : null;
- const hasMinMax = cpuMinValue !== null && cpuMaxValue !== null;
-
- const gpus = temp?.gpu ?? [];
- const hasGPU = gpus.length > 0;
-
- if (hasMinMax || hasGPU) {
- const min = typeof cpuMinValue === 'number' ? Math.round(cpuMinValue) : undefined;
- const max = typeof cpuMaxValue === 'number' ? Math.round(cpuMaxValue) : undefined;
-
- return (
- <div title={`Min: ${min !== undefined ? formatTemperature(min) : '-'}, Max: ${max !== undefined ? formatTemperature(max) : '-'}${hasGPU ? `\nGPU: ${gpus.map(g => formatTemperature(g.edge ?? g.junction ?? g.mem)).join(', ')}` : ''}`}>
- <TemperatureGauge
- value={value}
- min={min}
- max={max}
- critical={temperatureThreshold()}
- warning={Math.max(0, temperatureThreshold() - 5)}
- />
- </div>
- );
- }
-
- return (
- <TemperatureGauge
- value={value}
- critical={temperatureThreshold()}
- warning={Math.max(0, temperatureThreshold() - 5)}
+ }>
+ <Show
+ when={viewMode() === 'sparklines'}
+ fallback={
+ <StackedDiskBar
+ aggregateDisk={{
+ total: node!.disk?.total || 0,
+ used: node!.disk?.used || 0,
+ free: (node!.disk?.total || 0) - (node!.disk?.used || 0),
+ usage: node!.disk?.total ? (node!.disk.used / node!.disk.total) : 0
+ }}
/>
- );
- })()}
+ }
+ >
+ <ResponsiveMetricCell
+ value={diskPercentValue}
+ type="disk"
+ resourceId={metricsKey}
+ isRunning={online}
+ showMobile={false}
+ />
+ </Show>
</Show>
</div>
</td>
- </Show>
-
- {/* Dashboard tab: VMs and CTs */}
- <Show when={props.currentTab === 'dashboard'}>
- <td class={tdClass}>
- <div class="flex justify-center">
- <span class={online ? 'text-xs text-gray-700 dark:text-gray-300' : 'text-xs text-gray-400 dark:text-gray-500'}>
- {online ? getCountValue(item, 'vmCount') ?? '-' : '-'}
- </span>
- </div>
- </td>
- <td class={tdClass}>
- <div class="flex justify-center">
- <span class={online ? 'text-xs text-gray-700 dark:text-gray-300' : 'text-xs text-gray-400 dark:text-gray-500'}>
- {online ? getCountValue(item, 'containerCount') ?? '-' : '-'}
- </span>
- </div>
- </td>
- </Show>
- {/* Storage tab: Storage and Disks */}
- <Show when={props.currentTab === 'storage'}>
- <td class={tdClass}>
- <div class="flex justify-center">
- <span class={online ? 'text-xs text-gray-700 dark:text-gray-300' : 'text-xs text-gray-400 dark:text-gray-500'}>
- {online ? getCountValue(item, 'storageCount') ?? '-' : '-'}
- </span>
- </div>
- </td>
- <td class={tdClass}>
- <div class="flex justify-center">
- <span class={online ? 'text-xs text-gray-700 dark:text-gray-300' : 'text-xs text-gray-400 dark:text-gray-500'}>
- {online ? getCountValue(item, 'diskCount') ?? '-' : '-'}
- </span>
- </div>
- </td>
- </Show>
+ {/* Temperature */}
+ <Show when={hasAnyTemperatureData()}>
+ <td class={tdClass}>
+ <div class="flex justify-center">
+ <Show
+ when={
+ online &&
+ isPVEItem &&
+ cpuTemperatureValue !== null &&
+ (node!.temperature?.hasCPU ?? node!.temperature?.hasGPU ?? node!.temperature?.available) &&
+ isTemperatureMonitoringEnabled(node!)
+ }
+ fallback={<span class="text-xs text-gray-400 dark:text-gray-500">-</span>}
+ >
+ {(() => {
+ const value = cpuTemperatureValue as number;
+ const temp = node!.temperature;
+ const cpuMinValue =
+ typeof temp?.cpuMin === 'number' && temp.cpuMin > 0 ? temp.cpuMin : null;
+ const cpuMaxValue =
+ typeof temp?.cpuMaxRecord === 'number' && temp.cpuMaxRecord > 0
+ ? temp.cpuMaxRecord
+ : null;
+ const hasMinMax = cpuMinValue !== null && cpuMaxValue !== null;
+
+ const gpus = temp?.gpu ?? [];
+ const hasGPU = gpus.length > 0;
+
+ if (hasMinMax || hasGPU) {
+ const min = typeof cpuMinValue === 'number' ? Math.round(cpuMinValue) : undefined;
+ const max = typeof cpuMaxValue === 'number' ? Math.round(cpuMaxValue) : undefined;
+
+ return (
+ <div title={`Min: ${min !== undefined ? formatTemperature(min) : '-'}, Max: ${max !== undefined ? formatTemperature(max) : '-'}${hasGPU ? `\nGPU: ${gpus.map(g => formatTemperature(g.edge ?? g.junction ?? g.mem)).join(', ')}` : ''}`}>
+ <TemperatureGauge
+ value={value}
+ min={min}
+ max={max}
+ critical={temperatureThreshold()}
+ warning={Math.max(0, temperatureThreshold() - 5)}
+ />
+ </div>
+ );
+ }
- {/* Backups tab: Backups */}
- <Show when={props.currentTab === 'backups'}>
- <td class={tdClass}>
- <div class="flex justify-center">
- <span class={online ? 'text-xs text-gray-700 dark:text-gray-300' : 'text-xs text-gray-400 dark:text-gray-500'}>
- {online ? getCountValue(item, 'backupCount') ?? '-' : '-'}
- </span>
- </div>
+ return (
+ <TemperatureGauge
+ value={value}
+ critical={temperatureThreshold()}
+ warning={Math.max(0, temperatureThreshold() - 5)}
+ />
+ );
+ })()}
+ </Show>
+ </div>
+ </td>
+ </Show>
+
+ {/* Dashboard tab: VMs and CTs */}
+ <Show when={props.currentTab === 'dashboard'}>
+ <td class={tdClass}>
+ <div class="flex justify-center">
+ <span class={online ? 'text-xs text-gray-700 dark:text-gray-300' : 'text-xs text-gray-400 dark:text-gray-500'}>
+ {online ? getCountValue(item, 'vmCount') ?? '-' : '-'}
+ </span>
+ </div>
+ </td>
+ <td class={tdClass}>
+ <div class="flex justify-center">
+ <span class={online ? 'text-xs text-gray-700 dark:text-gray-300' : 'text-xs text-gray-400 dark:text-gray-500'}>
+ {online ? getCountValue(item, 'containerCount') ?? '-' : '-'}
+ </span>
+ </div>
+ </td>
+ </Show>
+
+ {/* Storage tab: Storage and Disks */}
+ <Show when={props.currentTab === 'storage'}>
+ <td class={tdClass}>
+ <div class="flex justify-center">
+ <span class={online ? 'text-xs text-gray-700 dark:text-gray-300' : 'text-xs text-gray-400 dark:text-gray-500'}>
+ {online ? getCountValue(item, 'storageCount') ?? '-' : '-'}
+ </span>
+ </div>
+ </td>
+ <td class={tdClass}>
+ <div class="flex justify-center">
+ <span class={online ? 'text-xs text-gray-700 dark:text-gray-300' : 'text-xs text-gray-400 dark:text-gray-500'}>
+ {online ? getCountValue(item, 'diskCount') ?? '-' : '-'}
+ </span>
+ </div>
+ </td>
+ </Show>
+
+ {/* Backups tab: Backups */}
+ <Show when={props.currentTab === 'backups'}>
+ <td class={tdClass}>
+ <div class="flex justify-center">
+ <span class={online ? 'text-xs text-gray-700 dark:text-gray-300' : 'text-xs text-gray-400 dark:text-gray-500'}>
+ {online ? getCountValue(item, 'backupCount') ?? '-' : '-'}
+ </span>
+ </div>
+ </td>
+ </Show>
+
+ {/* Link Column (Moved to end) */}
+ <td class="px-0 py-1 align-middle text-center">
+ <Show when={
+ isPVEItem
+ ? (node!.guestURL || node!.host)
+ : (pbs!.guestURL || pbs!.host)
+ }>
+ <a
+ href={
+ isPVEItem
+ ? node!.guestURL || node!.host || `https://${node!.name}:8006`
+ : pbs!.guestURL || pbs!.host || `https://${pbs!.name}:8007`
+ }
+ target="_blank"
+ rel="noopener noreferrer"
+ onClick={(e) => e.stopPropagation()}
+ class="inline-flex justify-center items-center text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 transition-colors"
+ title={`Open ${displayName()} web interface`}
+ >
+ <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="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" />
+ </svg>
+ </a>
+ </Show>
</td>
+ </tr>
+ <Show when={isExpanded() && isPVEItem}>
+ <tr>
+ <td colspan={11} class="bg-gray-50/50 dark:bg-gray-900/20 px-4 py-4 border-b border-gray-100 dark:border-gray-700 shadow-inner">
+ <Suspense fallback={<div class="flex justify-center p-4">Loading stats...</div>}>
+ <NodeDrawer node={node!} />
+ </Suspense>
+ </td>
+ </tr>
</Show>
- </tr>
+ </>
);
}}
</For>
</tbody>
</table>
</div>
- </Card>
+ </Card >
);
};
diff --git a/internal/servicediscovery/service_test.go b/internal/servicediscovery/service_test.go
index 4e471dd9de..86ecf55fbb 100644
--- a/internal/servicediscovery/service_test.go
+++ b/internal/servicediscovery/service_test.go
@@ -626,6 +626,7 @@ func TestService_FingerprintLoop_StopAndCancel(t *testing.T) {
done := make(chan struct{})
ctx, cancel := context.WithCancel(context.Background())
+ defer cancel() // Always cancel to prevent context leak
go func() {
service.discoveryLoop(ctx)
close(done)