Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Improve Patrol header mobile controls
rcourtman3f16d7845a92
diff --git a/frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx b/frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsxindex cda8533b98..f8c1f00ceb 100644--- a/frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx+++ b/frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx@@ -60,9 +60,9 @@ export function PatrolIntelligenceHeader(props: { state: PatrolIntelligenceState}class="relative z-[200] mb-3"actions={- <div class="flex flex-wrap items-center justify-end gap-3">+ <div class="hidden sm:flex flex-wrap items-center justify-end gap-3"><Show when={recency().timestamp}>- <div class="hidden sm:flex items-center gap-3 text-xs text-muted">+ <div class="flex items-center gap-3 text-xs text-muted"><span>{recency().label}:{' '}{formatRelativeTime(recency().timestamp, {@@ -115,7 +115,7 @@ export function PatrolIntelligenceHeader(props: { state: PatrolIntelligenceState/><div class="rounded-md border border-border bg-surface px-4 py-3">- <div class="flex flex-wrap items-center gap-4">+ <div class="flex flex-wrap items-center gap-3"><div class="flex items-center gap-2 bg-surface-hover px-3 py-1.5 rounded-md border border-border"><TogglePrimitivechecked={state.patrolEnabledLocal()}@@ -127,252 +127,294 @@ export function PatrolIntelligenceHeader(props: { state: PatrolIntelligenceState<span class="text-sm font-medium text-base-content">{runtimePresentation().label}</span></div>- <div class="relative z-[120] ml-auto" ref={state.setAdvancedSettingsRef}>+ <div class="flex flex-wrap items-center gap-2 sm:ml-auto"><button- onClick={() => state.setShowAdvancedSettings(!state.showAdvancedSettings())}- disabled={!state.patrolEnabledLocal()}- class={`flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-md transition-all shadow-sm ${state.showAdvancedSettings() ? 'bg-blue-50 text-blue-700 border border-blue-200 dark:bg-blue-900 dark:text-blue-300 dark:border-blue-800' : ' text-base-content border border-border hover:bg-surface-alt'} ${!state.patrolEnabledLocal() ? 'opacity-50 cursor-not-allowed hidden' : ''}`}+ onClick={() => state.handleRunPatrol()}+ disabled={+ state.isTriggeringPatrol() ||+ !state.canTriggerPatrol() ||+ state.manualRunRequested() ||+ state.patrolStream.isStreaming()+ }+ title={state.triggerPatrolDisabledReason()}+ class="sm:hidden flex items-center gap-2 px-3 py-1.5 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 disabled:bg-surface-alt disabled:text-muted rounded-md transition-colors">- <SettingsIcon class="w-4 h-4" />- Configure Patrol+ <PlayIcon+ class={`w-4 h-4 ${state.isTriggeringPatrol() || state.manualRunRequested() || state.patrolStream.isStreaming() ? 'animate-pulse' : ''}`}+ />+ {state.isTriggeringPatrol()+ ? 'Starting…'+ : state.manualRunRequested() || state.patrolStream.isStreaming()+ ? 'Running…'+ : 'Run Patrol'}</button>- <Show when={state.showAdvancedSettings()}>- <div class="fixed right-4 top-32 z-[9999] isolate max-h-[calc(100vh-10rem)] w-[calc(100vw-2rem)] overflow-y-auto rounded-md border border-border bg-surface p-5 shadow-sm animate-slide-up transform origin-top-right sm:right-8 sm:top-[13rem] sm:max-h-[36rem] sm:w-[340px]">- <div class="flex items-center justify-between mb-5 pb-3 border-b border-border-subtle">- <h4 class="text-base font-semibold tracking-tight text-base-content">- Patrol Configuration- </h4>- <button- onClick={() => state.setShowAdvancedSettings(false)}- class="p-1 rounded-md hover:text-base-content hover:bg-surface-hover transition-colors"- >- <XIcon class="w-4 h-4" />- </button>- </div>+ <button+ onClick={() => state.loadAllData()}+ disabled={state.isRefreshing()}+ aria-label="Refresh"+ class="sm:hidden flex items-center gap-2 px-3 py-1.5 text-sm font-medium text-base-content bg-surface border border-border rounded-md hover:bg-surface-hover disabled:opacity-50 transition-colors"+ >+ <RefreshCwIcon class={`w-4 h-4 ${state.isRefreshing() ? 'animate-spin' : ''}`} />+ <span class="sr-only sm:not-sr-only">Refresh</span>+ </button>- <div class="space-y-6">- <div class="grid grid-cols-2 gap-4">- <FormSelect- label="Provider model"- labelClass="text-xs font-semibold uppercase tracking-wider text-muted"- fieldClass="space-y-1.5"- ref={state.setPatrolModelSelectRef}- value={state.patrolModel()}- onChange={(e) => state.handleModelChange(e.currentTarget.value)}- disabled={state.isUpdatingSettings() || !state.patrolEnabledLocal()}- selectBaseClass="w-full text-sm bg-base border border-border rounded-md py-2 pl-3 pr-8 text-base-content focus:ring-2 focus:ring-blue-500 focus:border-blue-500 disabled:opacity-50"- >- <option value="">- Default ({state.defaultModel().split(':').pop() || 'not set'})- </option>- <Show when={patrolModelStale()}>- <option value={state.patrolModel()} disabled>- {state.patrolModel().split(':').pop()} (unavailable)- </option>- </Show>- {Array.from(groupModelsByProvider(state.availableModels()).entries()).map(- ([provider, models]) => (- <optgroup label={provider.charAt(0).toUpperCase() + provider.slice(1)}>- {models.map((model) => (- <option value={model.id}>- {model.name || model.id.split(':').pop()}- </option>- ))}- </optgroup>- ),- )}- </FormSelect>+ <div class="relative z-[120]" ref={state.setAdvancedSettingsRef}>+ <button+ onClick={() => state.setShowAdvancedSettings(!state.showAdvancedSettings())}+ disabled={!state.patrolEnabledLocal()}+ aria-label="Configure Patrol"+ title="Configure Patrol"+ class={`flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-md transition-all shadow-sm ${state.showAdvancedSettings() ? 'bg-blue-50 text-blue-700 border border-blue-200 dark:bg-blue-900 dark:text-blue-300 dark:border-blue-800' : ' text-base-content border border-border hover:bg-surface-alt'} ${!state.patrolEnabledLocal() ? 'opacity-50 cursor-not-allowed hidden' : ''}`}+ >+ <SettingsIcon class="w-4 h-4" />+ <span class="sr-only sm:not-sr-only">Configure Patrol</span>+ </button>- <FormSelect- label="Run Every"- labelClass="text-xs font-semibold uppercase tracking-wider text-muted"- fieldClass="space-y-1.5"- value={state.patrolInterval()}- onChange={(e) =>- state.handleIntervalChange(parseInt(e.currentTarget.value, 10))- }- disabled={state.isUpdatingSettings() || !state.patrolEnabledLocal()}- selectBaseClass="w-full text-sm bg-base border border-border rounded-md py-2 pl-3 pr-8 text-base-content focus:ring-2 focus:ring-blue-500 focus:border-blue-500 disabled:opacity-50"+ <Show when={state.showAdvancedSettings()}>+ <div class="fixed right-4 top-32 z-[9999] isolate max-h-[calc(100vh-10rem)] w-[calc(100vw-2rem)] overflow-y-auto rounded-md border border-border bg-surface p-5 shadow-sm animate-slide-up transform origin-top-right sm:right-8 sm:top-[13rem] sm:max-h-[36rem] sm:w-[340px]">+ <div class="flex items-center justify-between mb-5 pb-3 border-b border-border-subtle">+ <h4 class="text-base font-semibold tracking-tight text-base-content">+ Patrol Configuration+ </h4>+ <button+ onClick={() => state.setShowAdvancedSettings(false)}+ class="p-1 rounded-md hover:text-base-content hover:bg-surface-hover transition-colors">- <For each={scheduleOptions()}>- {(preset) => <option value={preset.value}>{preset.label}</option>}- </For>- </FormSelect>+ <XIcon class="w-4 h-4" />+ </button></div>- <div class="space-y-2">- <div class="flex items-center justify-between">- <label class="text-xs font-semibold uppercase tracking-wider text-muted flex items-center gap-1.5">- Operational Mode- <div class="relative group">- <CircleHelpIcon class="w-3.5 h-3.5 cursor-help" />- <div class="absolute left-1/2 -translate-x-1/2 bottom-full mb-2 hidden group-hover:block w-64 p-3 bg-surface text-white rounded-md shadow-md text-xs z-50 pointer-events-none before:absolute before:top-full before:left-1/2 before:-translate-x-1/2 before:border-4 before:border-transparent before:border-t-slate-800">- <strong>Monitor:</strong> Detect only.- <br />- <strong>Investigate:</strong> Detect & propose fixes.- <br />- <strong>Remediate:</strong> Execute approved safe actions under policy.- </div>- </div>- </label>- </div>-- <div class="flex items-center bg-base rounded-md p-1 border shadow-inner">- <For each={['monitor', 'approval', 'assisted'] as const}>- {(level) => {- const isProLocked = () =>- state.autoFixLocked() && (level === 'approval' || level === 'assisted');- const isDisabled = () => !state.patrolEnabledLocal() || isProLocked();- const isActive = () =>- level === 'assisted'- ? state.autonomyLevel() === 'assisted' ||- state.autonomyLevel() === 'full'- : state.autonomyLevel() === level;-- return (- <button- onClick={() => state.handleAutonomyChange(level)}- disabled={isDisabled()}- title={- !presentationPolicyHidesUpgradePrompts() && isProLocked()- ? level === 'approval'- ? 'Investigation is not enabled on this plan'- : 'Safe remediation workflows are not enabled on this plan'- : undefined- }- class={`flex-1 py-1.5 px-2 text-xs font-semibold rounded-md transition-all duration-200 ${isActive() ? ' text-blue-600 dark:text-blue-400 shadow-[0_1px_3px_rgba(0,0,0,0.1)]' : isDisabled() ? ' ' : 'text-muted hover:text-base-content hover:bg-surface-hover'} ${isDisabled() ? 'opacity-50 cursor-not-allowed' : ''}`}- >- {level === 'monitor'- ? 'Monitor'- : level === 'approval'- ? 'Investigate'- : 'Remediate'}- </button>- );- }}- </For>- </div>- <Show when={!presentationPolicyHidesUpgradePrompts() && state.autoFixLocked()}>- <div class="pl-1 text-[11px] text-slate-500">- Investigation and safe remediation workflows are not enabled on this plan.- </div>- </Show>- </div>+ <div class="space-y-6">+ <div class="grid grid-cols-2 gap-4">+ <FormSelect+ label="Provider model"+ labelClass="text-xs font-semibold uppercase tracking-wider text-muted"+ fieldClass="space-y-1.5"+ ref={state.setPatrolModelSelectRef}+ value={state.patrolModel()}+ onChange={(e) => state.handleModelChange(e.currentTarget.value)}+ disabled={state.isUpdatingSettings() || !state.patrolEnabledLocal()}+ selectBaseClass="w-full text-sm bg-base border border-border rounded-md py-2 pl-3 pr-8 text-base-content focus:ring-2 focus:ring-blue-500 focus:border-blue-500 disabled:opacity-50"+ >+ <option value="">+ Default ({state.defaultModel().split(':').pop() || 'not set'})+ </option>+ <Show when={patrolModelStale()}>+ <option value={state.patrolModel()} disabled>+ {state.patrolModel().split(':').pop()} (unavailable)+ </option>+ </Show>+ {Array.from(groupModelsByProvider(state.availableModels()).entries()).map(+ ([provider, models]) => (+ <optgroup label={provider.charAt(0).toUpperCase() + provider.slice(1)}>+ {models.map((model) => (+ <option value={model.id}>+ {model.name || model.id.split(':').pop()}+ </option>+ ))}+ </optgroup>+ ),+ )}+ </FormSelect>- <div class="space-y-4 pt-4 border-t border-border-subtle">- <div class="flex items-start justify-between gap-3">- <div class="flex-1">- <label class="text-sm font-medium text-base-content">- Alert-Triggered Analysis- </label>- <p class="text-[11px] text-muted mt-0.5 leading-tight">- Analyze infrastructure automatically when critical alerts fire.- </p>- </div>- <Toggle- checked={state.alertTriggeredAnalysis()}+ <FormSelect+ label="Run Every"+ labelClass="text-xs font-semibold uppercase tracking-wider text-muted"+ fieldClass="space-y-1.5"+ value={state.patrolInterval()}onChange={(e) =>- state.handleAlertTriggeredAnalysisChange(e.currentTarget.checked)+ state.handleIntervalChange(parseInt(e.currentTarget.value, 10))}- disabled={state.isUpdatingSettings() || state.alertAnalysisLocked()}- />+ disabled={state.isUpdatingSettings() || !state.patrolEnabledLocal()}+ selectBaseClass="w-full text-sm bg-base border border-border rounded-md py-2 pl-3 pr-8 text-base-content focus:ring-2 focus:ring-blue-500 focus:border-blue-500 disabled:opacity-50"+ >+ <For each={scheduleOptions()}>+ {(preset) => <option value={preset.value}>{preset.label}</option>}+ </For>+ </FormSelect></div>- <Show- when={!presentationPolicyHidesUpgradePrompts() && state.alertAnalysisLocked()}- >- <div class="-my-1 pl-1 text-[11px]">- Alert-triggered analysis is not enabled on this plan.+ <div class="space-y-2">+ <div class="flex items-center justify-between">+ <label class="text-xs font-semibold uppercase tracking-wider text-muted flex items-center gap-1.5">+ Operational Mode+ <div class="relative group">+ <CircleHelpIcon class="w-3.5 h-3.5 cursor-help" />+ <div class="absolute left-1/2 -translate-x-1/2 bottom-full mb-2 hidden group-hover:block w-64 p-3 bg-surface text-white rounded-md shadow-md text-xs z-50 pointer-events-none before:absolute before:top-full before:left-1/2 before:-translate-x-1/2 before:border-4 before:border-transparent before:border-t-slate-800">+ <strong>Monitor:</strong> Detect only.+ <br />+ <strong>Investigate:</strong> Detect & propose fixes.+ <br />+ <strong>Remediate:</strong> Execute approved safe actions under+ policy.+ </div>+ </div>+ </label></div>- </Show>- <div class="rounded-md border border-border-subtle bg-surface-alt/60 px-3 py-2.5">- <p class="text-[11px] font-medium text-base-content">- Full patrols run on the {selectedScheduleLabel().toLowerCase()} schedule.- </p>- <p class="mt-1 text-[11px] leading-tight text-muted">- Alert and anomaly triggers run targeted scoped checks that update{' '}- <span class="font-medium text-base-content">Last activity</span> without- resetting{' '}- <span class="font-medium text-base-content">Last full patrol</span>.- </p>- </div>+ <div class="flex items-center bg-base rounded-md p-1 border shadow-inner">+ <For each={['monitor', 'approval', 'assisted'] as const}>+ {(level) => {+ const isProLocked = () =>+ state.autoFixLocked() &&+ (level === 'approval' || level === 'assisted');+ const isDisabled = () => !state.patrolEnabledLocal() || isProLocked();+ const isActive = () =>+ level === 'assisted'+ ? state.autonomyLevel() === 'assisted' ||+ state.autonomyLevel() === 'full'+ : state.autonomyLevel() === level;- <div class="flex items-start justify-between gap-3">- <div class="flex-1">- <label class="text-sm font-medium text-base-content">- Alert-Triggered Patrols- </label>- <p class="text-[11px] text-muted mt-0.5 leading-tight">- Run scoped Patrol checks when alerts fire or clear.- </p>+ return (+ <button+ onClick={() => state.handleAutonomyChange(level)}+ disabled={isDisabled()}+ title={+ !presentationPolicyHidesUpgradePrompts() && isProLocked()+ ? level === 'approval'+ ? 'Investigation is not enabled on this plan'+ : 'Safe remediation workflows are not enabled on this plan'+ : undefined+ }+ class={`flex-1 py-1.5 px-2 text-xs font-semibold rounded-md transition-all duration-200 ${isActive() ? ' text-blue-600 dark:text-blue-400 shadow-[0_1px_3px_rgba(0,0,0,0.1)]' : isDisabled() ? ' ' : 'text-muted hover:text-base-content hover:bg-surface-hover'} ${isDisabled() ? 'opacity-50 cursor-not-allowed' : ''}`}+ >+ {level === 'monitor'+ ? 'Monitor'+ : level === 'approval'+ ? 'Investigate'+ : 'Remediate'}+ </button>+ );+ }}+ </For></div>- <Toggle- checked={state.patrolAlertTriggers()}- onChange={(e) =>- state.handlePatrolAlertTriggersChange(e.currentTarget.checked)- }- disabled={state.isUpdatingSettings() || !state.patrolEnabledLocal()}- />+ <Show+ when={!presentationPolicyHidesUpgradePrompts() && state.autoFixLocked()}+ >+ <div class="pl-1 text-[11px] text-slate-500">+ Investigation and safe remediation workflows are not enabled on this plan.+ </div>+ </Show></div>- <div class="flex items-start justify-between gap-3">- <div class="flex-1">- <label class="text-sm font-medium text-base-content">- Anomaly-Triggered Patrols- </label>- <p class="text-[11px] text-muted mt-0.5 leading-tight">- Run scoped Patrol checks when learned baselines detect high-signal- anomalies.- </p>+ <div class="space-y-4 pt-4 border-t border-border-subtle">+ <div class="flex items-start justify-between gap-3">+ <div class="flex-1">+ <label class="text-sm font-medium text-base-content">+ Alert-Triggered Analysis+ </label>+ <p class="text-[11px] text-muted mt-0.5 leading-tight">+ Analyze infrastructure automatically when critical alerts fire.+ </p>+ </div>+ <Toggle+ checked={state.alertTriggeredAnalysis()}+ onChange={(e) =>+ state.handleAlertTriggeredAnalysisChange(e.currentTarget.checked)+ }+ disabled={state.isUpdatingSettings() || state.alertAnalysisLocked()}+ /></div>- <Toggle- checked={state.patrolAnomalyTriggers()}- onChange={(e) =>- state.handlePatrolAnomalyTriggersChange(e.currentTarget.checked)++ <Show+ when={+ !presentationPolicyHidesUpgradePrompts() && state.alertAnalysisLocked()}- disabled={state.isUpdatingSettings() || !state.patrolEnabledLocal()}- />- </div>+ >+ <div class="-my-1 pl-1 text-[11px]">+ Alert-triggered analysis is not enabled on this plan.+ </div>+ </Show>- <div class="flex items-start justify-between gap-3">- <div class="flex-1">- <label class="text-sm font-medium text-red-600 dark:text-red-400">- Autonomous critical remediation- </label>- <p class="text-[11px] text-muted mt-0.5 leading-tight">- Permit Patrol to execute critical remediation actions without approval.+ <div class="rounded-md border border-border-subtle bg-surface-alt/60 px-3 py-2.5">+ <p class="text-[11px] font-medium text-base-content">+ Full patrols run on the {selectedScheduleLabel().toLowerCase()} schedule.+ </p>+ <p class="mt-1 text-[11px] leading-tight text-muted">+ Alert and anomaly triggers run targeted scoped checks that update{' '}+ <span class="font-medium text-base-content">Last activity</span> without+ resetting{' '}+ <span class="font-medium text-base-content">Last full patrol</span>.</p></div>- <Toggle- checked={!state.autoFixLocked() && state.fullModeUnlocked()}- onChange={(e) => state.setFullModeUnlocked(e.currentTarget.checked)}- disabled={- state.autoFixLocked() ||- !(- state.autonomyLevel() === 'assisted' || state.autonomyLevel() === 'full'- )- }- />++ <div class="flex items-start justify-between gap-3">+ <div class="flex-1">+ <label class="text-sm font-medium text-base-content">+ Alert-Triggered Patrols+ </label>+ <p class="text-[11px] text-muted mt-0.5 leading-tight">+ Run scoped Patrol checks when alerts fire or clear.+ </p>+ </div>+ <Toggle+ checked={state.patrolAlertTriggers()}+ onChange={(e) =>+ state.handlePatrolAlertTriggersChange(e.currentTarget.checked)+ }+ disabled={state.isUpdatingSettings() || !state.patrolEnabledLocal()}+ />+ </div>++ <div class="flex items-start justify-between gap-3">+ <div class="flex-1">+ <label class="text-sm font-medium text-base-content">+ Anomaly-Triggered Patrols+ </label>+ <p class="text-[11px] text-muted mt-0.5 leading-tight">+ Run scoped Patrol checks when learned baselines detect high-signal+ anomalies.+ </p>+ </div>+ <Toggle+ checked={state.patrolAnomalyTriggers()}+ onChange={(e) =>+ state.handlePatrolAnomalyTriggersChange(e.currentTarget.checked)+ }+ disabled={state.isUpdatingSettings() || !state.patrolEnabledLocal()}+ />+ </div>++ <div class="flex items-start justify-between gap-3">+ <div class="flex-1">+ <label class="text-sm font-medium text-red-600 dark:text-red-400">+ Autonomous critical remediation+ </label>+ <p class="text-[11px] text-muted mt-0.5 leading-tight">+ Permit Patrol to execute critical remediation actions without approval.+ </p>+ </div>+ <Toggle+ checked={!state.autoFixLocked() && state.fullModeUnlocked()}+ onChange={(e) => state.setFullModeUnlocked(e.currentTarget.checked)}+ disabled={+ state.autoFixLocked() ||+ !(+ state.autonomyLevel() === 'assisted' ||+ state.autonomyLevel() === 'full'+ )+ }+ />+ </div></div>- </div>- <div class="pt-4 border-t border-border-subtle">- <button- onClick={state.saveAdvancedSettings}- disabled={state.isSavingAdvanced()}- class="w-full py-2.5 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md shadow-sm transition-all focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:cursor-not-allowed disabled:bg-blue-300 disabled:hover:bg-blue-300 dark:disabled:bg-blue-900 flex items-center justify-center gap-2"- >- <Show when={state.isSavingAdvanced()}>- <div class="animate-spin w-4 h-4 border-2 border-current border-t-transparent rounded-full"></div>- </Show>- <Show when={!state.isSavingAdvanced()}>Apply Configuration</Show>- </button>+ <div class="pt-4 border-t border-border-subtle">+ <button+ onClick={state.saveAdvancedSettings}+ disabled={state.isSavingAdvanced()}+ class="w-full py-2.5 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md shadow-sm transition-all focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:cursor-not-allowed disabled:bg-blue-300 disabled:hover:bg-blue-300 dark:disabled:bg-blue-900 flex items-center justify-center gap-2"+ >+ <Show when={state.isSavingAdvanced()}>+ <div class="animate-spin w-4 h-4 border-2 border-current border-t-transparent rounded-full"></div>+ </Show>+ <Show when={!state.isSavingAdvanced()}>Apply Configuration</Show>+ </button>+ </div></div></div>- </div>- </Show>+ </Show>+ </div></div></div></div>