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
import type { Accessor, Component, Setter } from 'solid-js';
import type { VersionInfo } from '@/api/updates';
import type { SecurityStatus as SecurityStatusInfo } from '@/types/config';
import { AICostDashboard } from '@/components/AI/AICostDashboard';
import { AgentIntegrationsPanel } from './AgentIntegrationsPanel';
import { AISettings, AIPatrolSettings } from './AISettings';
import { ProLicensePanel } from './ProLicensePanel';
import { SSOProvidersPanel } from './SSOProvidersPanel';
import type { InfrastructurePlatformSettingsProps } from './proxmoxSettingsModel';
import type { SettingsPanelRegistryContext } from './settingsPanelRegistry';
import type { SettingsSystemPanels } from './useSettingsSystemPanels';
export interface UseSettingsPanelRegistryParams {
securityStatus: Accessor<SecurityStatusInfo | null>;
securityStatusLoading: Accessor<boolean>;
organizationMonitoredSystemUsage: Accessor<number>;
organizationGuestUsage: Accessor<number>;
loadSecurityStatus: () => Promise<void>;
showQuickSecuritySetup: Accessor<boolean>;
setShowQuickSecuritySetup: Setter<boolean>;
showQuickSecurityWizard: Accessor<boolean>;
setShowQuickSecurityWizard: Setter<boolean>;
showPasswordModal: Accessor<boolean>;
setShowPasswordModal: Setter<boolean>;
hideLocalLogin: Accessor<boolean>;
hideLocalLoginLocked: Accessor<boolean>;
savingHideLocalLogin: Accessor<boolean>;
handleHideLocalLoginChange: (enabled: boolean) => Promise<void>;
versionInfo: Accessor<VersionInfo | null>;
getInfrastructurePanelProps: () => InfrastructurePlatformSettingsProps;
systemPanels: SettingsSystemPanels;
}
export function buildSettingsPanelRegistryContext(
params: UseSettingsPanelRegistryParams,
): SettingsPanelRegistryContext {
const settingsCapabilities = () => params.securityStatus()?.settingsCapabilities ?? null;
const currentUser = () =>
params.securityStatus()?.currentUsername ??
(params.securityStatus()?.proxyAuthUsername ||
params.securityStatus()?.ssoSessionUsername ||
params.securityStatus()?.authUsername);
const systemAiPanel: Component = () => (
<div class="space-y-6">
<AISettings />
<AICostDashboard />
</div>
);
const systemBillingPanel: Component = () => (
<div class="space-y-6">
<ProLicensePanel />
</div>
);
const systemAiPatrolPanel: Component = () => <AIPatrolSettings />;
const systemAiAgentsPanel: Component = () => <AgentIntegrationsPanel />;
const securitySsoPanel: Component = () => (
<div class="space-y-6">
<SSOProvidersPanel
currentUser={currentUser()}
onConfigUpdated={params.loadSecurityStatus}
canManage={settingsCapabilities()?.singleSignOnWrite === true}
/>
</div>
);
return {
getInfrastructurePanelProps: params.getInfrastructurePanelProps,
systemGeneralPanel: params.systemPanels.systemGeneralPanel,
systemAiPanel,
systemAiPatrolPanel,
systemAiAgentsPanel,
systemBillingPanel,
securitySsoPanel,
getNetworkPanelProps: params.systemPanels.getNetworkPanelProps,
getUpdatesPanelProps: params.systemPanels.getUpdatesPanelProps,
getRecoveryPanelProps: params.systemPanels.getRecoveryPanelProps,
getOrganizationOverviewPanelProps: () => ({
currentUser: currentUser(),
}),
getOrganizationAccessPanelProps: () => ({
currentUser: currentUser(),
}),
getOrganizationSharingPanelProps: () => ({
currentUser: currentUser(),
}),
getOrganizationBillingPanelProps: () => ({
nodeUsage: params.organizationMonitoredSystemUsage(),
guestUsage: params.organizationGuestUsage(),
}),
getApiAccessPanelProps: () => ({
currentUser: currentUser(),
currentTokenHint: params.securityStatus()?.apiTokenHint,
onTokensChanged: () => {
void params.loadSecurityStatus();
},
refreshing: params.securityStatusLoading(),
canManage: settingsCapabilities()?.apiAccessWrite === true,
}),
getSecurityOverviewPanelProps: () => ({
securityStatus: params.securityStatus,
securityStatusLoading: params.securityStatusLoading,
}),
getSecurityAuthPanelProps: () => ({
securityStatus: params.securityStatus,
securityStatusLoading: params.securityStatusLoading,
versionInfo: params.versionInfo,
showQuickSecuritySetup: params.showQuickSecuritySetup,
setShowQuickSecuritySetup: params.setShowQuickSecuritySetup,
showQuickSecurityWizard: params.showQuickSecurityWizard,
setShowQuickSecurityWizard: params.setShowQuickSecurityWizard,
showPasswordModal: params.showPasswordModal,
setShowPasswordModal: params.setShowPasswordModal,
hideLocalLogin: params.hideLocalLogin,
hideLocalLoginLocked: params.hideLocalLoginLocked,
savingHideLocalLogin: params.savingHideLocalLogin,
handleHideLocalLoginChange: params.handleHideLocalLoginChange,
loadSecurityStatus: params.loadSecurityStatus,
canManage: settingsCapabilities()?.authenticationWrite === true,
}),
getRelayPanelProps: () => ({
canManage: settingsCapabilities()?.relayWrite === true,
}),
getReportingPanelProps: () => ({
currentUser: currentUser(),
// Non-secret identity facts only; equal scope sets keep the same workspace.
accessKey: JSON.stringify([
params.securityStatus()?.apiTokenHint,
params.securityStatus()?.tokenScopes?.slice().sort(),
]),
canRead: settingsCapabilities()?.reportingRead === true,
}),
getDiagnosticsPanelProps: () => ({
currentUser: currentUser(),
accessKey: JSON.stringify([
params.securityStatus()?.apiTokenHint,
params.securityStatus()?.tokenScopes?.slice().sort(),
]),
canRead: settingsCapabilities()?.diagnosticsRead === true,
}),
getSystemLogsPanelProps: () => ({
currentUser: currentUser(),
accessKey: JSON.stringify([
params.securityStatus()?.apiTokenHint,
params.securityStatus()?.tokenScopes?.slice().sort(),
]),
canRead: settingsCapabilities()?.systemLogsRead === true,
}),
getAuditLogPanelProps: () => ({
currentUser: currentUser(),
accessKey: JSON.stringify([
params.securityStatus()?.apiTokenHint,
params.securityStatus()?.tokenScopes?.slice().sort(),
]),
canRead: settingsCapabilities()?.auditLog === true,
}),
getAuditWebhookPanelProps: () => ({
currentUser: currentUser(),
canRead: settingsCapabilities()?.auditWebhooksRead === true,
canManage: settingsCapabilities()?.auditWebhooksWrite === true,
}),
getRolesPanelProps: () => ({
currentUser: currentUser(),
canManage: settingsCapabilities()?.roles === true,
}),
getUserAssignmentsPanelProps: () => ({
currentUser: currentUser(),
canManage: settingsCapabilities()?.users === true,
}),
};
}