All files / src/app/admin/components/_components constants.tsx

100% Statements 21/21
100% Branches 0/0
100% Functions 0/0
100% Lines 21/21

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 1827x           7x   7x         7x                                   7x                     7x                                             7x                       7x                             7x                                                     7x         7x                         7x                   7x                   7x   7x   7x   7x     7x             7x         7x   7x  
"use client";
 
import { HardDrive, Server, Shield } from "lucide-react";
import type { AcaAppSpec, AciGroupSpec, PgFlexSpec } from "@/lib/azure-pricing";
import type { Severity } from "./types";
 
export const REFRESH_INTERVAL = 30_000;
 
export const MAX_HISTORY = 2880;
 
export const LAYER_META: Record<
  string,
  { label: string; icon: React.ComponentType<any>; color: string }
> = {
  "edc-core": {
    label: "EDC-V Core",
    icon: Server,
    color: "text-(--accent)",
  },
  identity: {
    label: "Identity & Trust",
    icon: Shield,
    color: "text-(--accent)",
  },
  infrastructure: {
    label: "Infrastructure",
    icon: HardDrive,
    color: "text-(--warning-text)",
  },
};
 
export const STATUS_COLORS: Record<string, string> = {
  healthy: "bg-emerald-500",
  running: "bg-blue-500",
  unhealthy: "bg-red-500",
  stopped: "bg-gray-600",
  unknown: "bg-gray-500",
};
 
export const SEVERITY_STYLES: Record<
  Severity,
  { dot: string; border: string; bg: string }
> = {
  critical: {
    dot: "bg-red-500 animate-pulse",
    border: "border-red-500/60",
    bg: "bg-red-900/10",
  },
  warning: {
    dot: "bg-yellow-500",
    border: "border-yellow-500/40",
    bg: "bg-yellow-900/10",
  },
  healthy: {
    dot: "bg-emerald-500",
    border: "border-(--border)",
    bg: "",
  },
  unknown: {
    dot: "bg-gray-500",
    border: "border-(--border)",
    bg: "",
  },
};
 
export const ROLE_COLORS: Record<string, string> = {
  DATA_HOLDER: "bg-blue-500/20 text-(--accent)",
  DATA_USER: "bg-(--badge-active-bg) text-(--badge-active-text)",
  HDAB: "bg-purple-500/20 text-(--accent)",
  "health-data-access-body": "bg-purple-500/20 text-(--accent)",
  "data-holder": "bg-blue-500/20 text-(--accent)",
  "data-user": "bg-(--badge-active-bg) text-(--badge-active-text)",
};
 
// Hoisted out of AzureCostEstimatorPanel so TopoComponentCard can use it too.
// Kept in sync with the diagnosis catalogue at
// /api/admin/components/[name]/diagnosis.
export const KNOWN_BROKEN_ACA_APPS = new Set<string>([
  "mvhd-controlplane",
  "mvhd-identityhub",
  "mvhd-issuerservice",
]);
 
// Mirrors the live Container Apps in rg-mvhd-dev (read 2026-10-03), with
// sidecars added to their app (Vault's unseal sidecar). Since #927 without the
// nine EDC 0.18 apps (the CFM managers, its four agents and shim, the two JAD
// data planes); siglet, the data plane on EDC 1.0, sized as
// scripts/azure/17-siglet.sh creates it. Since ADR-053 every
// app stops outside Mon-Fri 07-20, Keycloak, Vault and the federation gateway
// included; the UI stays reachable at min=0 with the offline notice, which
// costs next to nothing. The live panel replaces memGiB with the reservation
// the API reports, so this list is the fallback for names, CPU and schedule.
export const ACA_APP_SPECS: AcaAppSpec[] = [
  { name: "mvhd-neo4j", cpu: 1.0, memGiB: 2.0, schedule: "office" },
  { name: "mvhd-controlplane", cpu: 1.0, memGiB: 2.0, schedule: "office" },
  { name: "mvhd-siglet", cpu: 0.25, memGiB: 0.5, schedule: "office" },
  { name: "mvhd-identityhub", cpu: 0.5, memGiB: 1.0, schedule: "office" },
  { name: "mvhd-issuerservice", cpu: 0.5, memGiB: 1.0, schedule: "office" },
  { name: "mvhd-ui", cpu: 0.5, memGiB: 1.0, schedule: "office" },
  { name: "mvhd-nats", cpu: 0.25, memGiB: 0.5, schedule: "office" },
  { name: "mvhd-neo4j-proxy", cpu: 0.25, memGiB: 0.5, schedule: "office" },
  { name: "mvhd-catalog-enricher", cpu: 0.25, memGiB: 0.5, schedule: "office" },
  { name: "mvhd-keycloak", cpu: 1.0, memGiB: 2.0, schedule: "office" },
  { name: "mvhd-vault", cpu: 0.75, memGiB: 1.5, schedule: "office" },
  { name: "mvhd-claude-federation", cpu: 0.5, memGiB: 1.0, schedule: "office" },
  // The access body's Trustee (KBS, Attestation Service, RVPS) for the SPEs of
  // ADR-068, operated as if by MedReg DE (#774). It holds no row-level data,
  // so it stays on ACA (ADR-012).
  { name: "mvhd-trustee", cpu: 0.25, memGiB: 0.5, schedule: "office" },
  // mvhd-postgres is retired (ADR-041 phase 4); nothing used it after the
  // move to the Flexible Server below.
];
 
// ADR-069, #774: the two SPE workspaces are ACI confidential container
// groups (sku Confidential, AMD SEV-SNP, per-workload evidence), sizes from
// scripts/azure/aci/spe-workspace.template.json: neo4j 1.5 vCPU and 4 GB
// (ADR-056's proportions), the spe-ingest sidecar 0.5 vCPU and 1 GB; the init
// container spe-unlock runs before them. Both stop off hours (ADR-053,
// extended by ADR-069) and reload from the sealed extract on every start.
const SPE_WORKSPACE_CONTAINERS = [
  { name: "neo4j", cpu: 1.5, memGiB: 4 },
  { name: "spe-ingest", cpu: 0.5, memGiB: 1 },
];
 
export const ACI_SPE_GROUPS: AciGroupSpec[] = [
  {
    name: "mvhd-spe-1",
    containers: SPE_WORKSPACE_CONTAINERS,
    schedule: "office",
  },
  {
    name: "mvhd-spe-2",
    containers: SPE_WORKSPACE_CONTAINERS,
    schedule: "office",
  },
];
 
export const ACI_SPE_DETAILS = {
  region: "westeurope",
  sku: "Confidential",
  tee: "AMD SEV-SNP",
  initContainer: "spe-unlock",
} as const;
 
// ADR-041: every database lives on this Flexible Server since 2026-10-02.
// The evening stop stops it last and the morning start starts it first
// (ADR-053), so compute bills office hours and storage bills around the clock.
export const AZURE_PG_FLEX: PgFlexSpec = {
  name: "mvhd-pg-b53a0449",
  sku: "Standard_B1ms",
  storageGb: 32,
  schedule: "office",
};
 
// Azure Files share quotas in scripts/azure/env.sh. Standard LRS bills data
// stored, so the quotas are an upper bound. pg-data has had no reader since
// ADR-041; it is billed until someone deletes the share by hand.
export const SHARE_NEO4J_DATA_GIB = 10;
 
export const SHARE_NEO4J_LOGS_GIB = 5;
 
export const SHARE_PG_DATA_GIB = 20;
 
export const SHARE_VAULT_DATA_GIB = 2;
 
export const COMPUTED_STORAGE_GIB =
  SHARE_NEO4J_DATA_GIB +
  SHARE_NEO4J_LOGS_GIB +
  SHARE_PG_DATA_GIB +
  SHARE_VAULT_DATA_GIB;
 
// Billable ingestion into mvhd-logs over the 30 days to 2026-10-03 (Usage
// table).
export const LOG_ANALYTICS_GB_PER_MONTH = 18.3;
 
// Egress estimate per participant and month: DSP messages and transfer
// receipts (300 MB), the audit trail (150 MB) and the UI (500 MB), plus a
// baseline for Keycloak, NATS and image pulls.
export const EGRESS_PER_PARTICIPANT_MB = 300 + 150 + 500;
 
export const EGRESS_INFRA_BASELINE_GB = 2;