@@ -9,10 +9,20 @@ export const PODSTATUS_COMPONENTS: { key: keyof DemoDetails['state']; label: str
|
||||
{ key: 'dbm', label: 'Redis' },
|
||||
]
|
||||
|
||||
// PodStatusPanel : vue d'ensemble des 4 composants d'une démo (statut + CPU/mémoire live).
|
||||
// lbtelegram n'est installé que pour certaines démos (voir
|
||||
// ProvisionConfig.LBTelegramEnabled) : sa phase reste "" quand le chart
|
||||
// n'est pas déployé, auquel cas on ne l'affiche pas et on ne le compte pas
|
||||
// dans le calcul de santé ci-dessous.
|
||||
export const PODSTATUS_OPTIONAL_COMPONENTS: { key: keyof DemoDetails['state']; label: string }[] = [
|
||||
{ key: 'lb', label: 'Load-balancer Telegram' },
|
||||
]
|
||||
|
||||
// PodStatusPanel : vue d'ensemble des composants d'une démo (statut + CPU/mémoire live).
|
||||
export function PodStatusPanel({ state }: { state: DemoDetails['state'] }) {
|
||||
const allRunning = PODSTATUS_COMPONENTS.every((c) => state[c.key].phase === 'Running')
|
||||
const downCount = PODSTATUS_COMPONENTS.filter((c) => state[c.key].phase !== 'Running').length
|
||||
const optionalPresent = PODSTATUS_OPTIONAL_COMPONENTS.filter((c) => state[c.key].phase !== '')
|
||||
const allComponents = [...PODSTATUS_COMPONENTS, ...optionalPresent]
|
||||
const allRunning = allComponents.every((c) => state[c.key].phase === 'Running')
|
||||
const downCount = allComponents.filter((c) => state[c.key].phase !== 'Running').length
|
||||
|
||||
return (
|
||||
<Stack spacing={3}>
|
||||
@@ -35,7 +45,7 @@ export function PodStatusPanel({ state }: { state: DemoDetails['state'] }) {
|
||||
horizontal — surtout dans le contexte carte mobile, déjà à l'étroit
|
||||
avec son propre padding. */}
|
||||
<SimpleGrid columns={{ base: 1, lg: 4 }} spacing={3}>
|
||||
{PODSTATUS_COMPONENTS.map((c) => (
|
||||
{allComponents.map((c) => (
|
||||
<ComponentCard key={c.key} title={c.label} cs={state[c.key]} />
|
||||
))}
|
||||
</SimpleGrid>
|
||||
|
||||
@@ -119,6 +119,9 @@ export interface DemoState {
|
||||
web: ComponentState
|
||||
db: ComponentState
|
||||
dbm: ComponentState
|
||||
// lb (load-balancer Telegram) est optionnel : phase reste "" si le chart
|
||||
// lbtelegram n'est pas installé pour cette démo.
|
||||
lb: ComponentState
|
||||
}
|
||||
|
||||
export interface DemoDetails {
|
||||
|
||||
Reference in New Issue
Block a user