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.

7.2 KB
Raw Blame
import type { Component } from 'solid-js';
import type { NetworkSettingsPanel as NetworkSettingsPanelType } from './NetworkSettingsPanel';
import type { UpdatesSettingsPanel as UpdatesSettingsPanelType } from './UpdatesSettingsPanel';
import type { RecoverySettingsPanel as RecoverySettingsPanelType } from './RecoverySettingsPanel';
import type OrganizationOverviewPanelType from './OrganizationOverviewPanel';
import type OrganizationAccessPanelType from './OrganizationAccessPanel';
import type OrganizationSharingPanelType from './OrganizationSharingPanel';
import type OrganizationBillingPanelType from './OrganizationBillingPanel';
import type { APIAccessPanel as APIAccessPanelType } from './APIAccessPanel';
import type { SecurityOverviewPanel as SecurityOverviewPanelType } from './SecurityOverviewPanel';
import type { SecurityAuthPanel as SecurityAuthPanelType } from './SecurityAuthPanel';
import type { RelaySettingsPanel as RelaySettingsPanelType } from './RelaySettingsPanel';
import type { ReportingPanel as ReportingPanelType } from './ReportingPanel';
import type { AuditWebhookPanel as AuditWebhookPanelType } from './AuditWebhookPanel';
import type AuditLogPanelType from './AuditLogPanel';
import type { RolesPanel as RolesPanelType } from './RolesPanel';
import type { UserAssignmentsPanel as UserAssignmentsPanelType } from './UserAssignmentsPanel';
import type { InfrastructureWorkspace as InfrastructureWorkspaceType } from './InfrastructureWorkspace';
import type { SystemLogsPanelProps } from './useSystemLogsPanelState';
import type { DiagnosticsPanelProps } from './useDiagnosticsPanelState';
import type { SettingsTab } from './settingsNavigationModel';
import { SETTINGS_PANEL_REGISTRY_LOADERS } from './settingsPanelRegistryLoaders';

export interface SettingsPanelRegistryEntry {
  component: Component<any>;
  getProps?: () => object;
}

export type SettingsDispatchableTab = SettingsTab;

export type SettingsPanelRegistry = Record<SettingsDispatchableTab, SettingsPanelRegistryEntry>;

export interface SettingsPanelRegistryContext {
  getInfrastructurePanelProps: () => Parameters<typeof InfrastructureWorkspaceType>[0];
  systemGeneralPanel: Component;
  systemAiPanel: Component;
  systemAiPatrolPanel: Component;
  systemAiAgentsPanel: Component;
  systemBillingPanel: Component;
  securitySsoPanel: Component;
  getNetworkPanelProps: () => Parameters<typeof NetworkSettingsPanelType>[0];
  getUpdatesPanelProps: () => Parameters<typeof UpdatesSettingsPanelType>[0];
  getRecoveryPanelProps: () => Parameters<typeof RecoverySettingsPanelType>[0];
  getOrganizationOverviewPanelProps: () => Parameters<typeof OrganizationOverviewPanelType>[0];
  getOrganizationAccessPanelProps: () => Parameters<typeof OrganizationAccessPanelType>[0];
  getOrganizationSharingPanelProps: () => Parameters<typeof OrganizationSharingPanelType>[0];
  getOrganizationBillingPanelProps: () => Parameters<typeof OrganizationBillingPanelType>[0];
  getApiAccessPanelProps: () => Parameters<typeof APIAccessPanelType>[0];
  getSecurityOverviewPanelProps: () => Parameters<typeof SecurityOverviewPanelType>[0];
  getSecurityAuthPanelProps: () => Parameters<typeof SecurityAuthPanelType>[0];
  getRelayPanelProps: () => Parameters<typeof RelaySettingsPanelType>[0];
  getReportingPanelProps: () => Parameters<typeof ReportingPanelType>[0];
  getDiagnosticsPanelProps: () => DiagnosticsPanelProps;
  getSystemLogsPanelProps: () => SystemLogsPanelProps;
  getAuditWebhookPanelProps: () => Parameters<typeof AuditWebhookPanelType>[0];
  getAuditLogPanelProps: () => Parameters<typeof AuditLogPanelType>[0];
  getRolesPanelProps: () => Parameters<typeof RolesPanelType>[0];
  getUserAssignmentsPanelProps: () => Parameters<typeof UserAssignmentsPanelType>[0];
}

export const createSettingsPanelRegistry = (
  context: SettingsPanelRegistryContext,
): SettingsPanelRegistry => ({
  'infrastructure-systems': {
    component: SETTINGS_PANEL_REGISTRY_LOADERS.InfrastructureWorkspace,
    getProps: context.getInfrastructurePanelProps,
  },
  'monitoring-availability': {
    component: SETTINGS_PANEL_REGISTRY_LOADERS.AvailabilitySettingsPanel,
  },
  'system-general': {
    component: context.systemGeneralPanel,
  },
  'system-network': {
    component: SETTINGS_PANEL_REGISTRY_LOADERS.NetworkSettingsPanel,
    getProps: context.getNetworkPanelProps,
  },
  'system-updates': {
    component: SETTINGS_PANEL_REGISTRY_LOADERS.UpdatesSettingsPanel,
    getProps: context.getUpdatesPanelProps,
  },
  'system-recovery': {
    component: SETTINGS_PANEL_REGISTRY_LOADERS.RecoverySettingsPanel,
    getProps: context.getRecoveryPanelProps,
  },
  'system-ai': {
    component: context.systemAiPanel,
  },
  'system-ai-patrol': {
    component: context.systemAiPatrolPanel,
  },
  'system-ai-agents': {
    component: context.systemAiAgentsPanel,
  },
  'system-relay': {
    component: SETTINGS_PANEL_REGISTRY_LOADERS.RelaySettingsPanel,
    getProps: context.getRelayPanelProps,
  },
  'system-billing': {
    component: context.systemBillingPanel,
  },
  'support-diagnostics': {
    component: SETTINGS_PANEL_REGISTRY_LOADERS.DiagnosticsPanel,
    getProps: context.getDiagnosticsPanelProps,
  },
  'support-reporting': {
    component: SETTINGS_PANEL_REGISTRY_LOADERS.ReportingPanel,
    getProps: context.getReportingPanelProps,
  },
  'support-logs': {
    component: SETTINGS_PANEL_REGISTRY_LOADERS.SystemLogsPanel,
    getProps: context.getSystemLogsPanelProps,
  },
  'organization-overview': {
    component: SETTINGS_PANEL_REGISTRY_LOADERS.OrganizationOverviewPanel,
    getProps: context.getOrganizationOverviewPanelProps,
  },
  'organization-access': {
    component: SETTINGS_PANEL_REGISTRY_LOADERS.OrganizationAccessPanel,
    getProps: context.getOrganizationAccessPanelProps,
  },
  'organization-sharing': {
    component: SETTINGS_PANEL_REGISTRY_LOADERS.OrganizationSharingPanel,
    getProps: context.getOrganizationSharingPanelProps,
  },
  'organization-billing': {
    component: SETTINGS_PANEL_REGISTRY_LOADERS.OrganizationBillingPanel,
    getProps: context.getOrganizationBillingPanelProps,
  },
  'organization-billing-admin': {
    component: SETTINGS_PANEL_REGISTRY_LOADERS.BillingAdminPanel,
  },
  api: {
    component: SETTINGS_PANEL_REGISTRY_LOADERS.APIAccessPanel,
    getProps: context.getApiAccessPanelProps,
  },
  'security-overview': {
    component: SETTINGS_PANEL_REGISTRY_LOADERS.SecurityOverviewPanel,
    getProps: context.getSecurityOverviewPanelProps,
  },
  'security-data-handling': {
    component: SETTINGS_PANEL_REGISTRY_LOADERS.DataHandlingPanel,
  },
  'security-auth': {
    component: SETTINGS_PANEL_REGISTRY_LOADERS.SecurityAuthPanel,
    getProps: context.getSecurityAuthPanelProps,
  },
  'security-sso': {
    component: context.securitySsoPanel,
  },
  'security-roles': {
    component: SETTINGS_PANEL_REGISTRY_LOADERS.RolesPanel,
    getProps: context.getRolesPanelProps,
  },
  'security-users': {
    component: SETTINGS_PANEL_REGISTRY_LOADERS.UserAssignmentsPanel,
    getProps: context.getUserAssignmentsPanelProps,
  },
  'security-audit': {
    component: SETTINGS_PANEL_REGISTRY_LOADERS.AuditLogPanel,
    getProps: context.getAuditLogPanelProps,
  },
  'security-webhooks': {
    component: SETTINGS_PANEL_REGISTRY_LOADERS.AuditWebhookPanel,
    getProps: context.getAuditWebhookPanelProps,
  },
});