/** * FilesystemsPage — lists CephFilesystem resources. */ import { Loader, NameValueTable, SectionBox, SectionHeader, SimpleTable, StatusLabel, } from '@kinvolk/headlamp-plugin/lib/CommonComponents'; import React, { useState } from 'react'; import { CephFilesystem, formatAge, phaseToStatus } from '../api/k8s'; import { useRookCephContext } from '../api/RookCephDataContext'; function FilesystemDetail({ fs, onClose }: { fs: CephFilesystem; onClose: () => void }) { return (
{ if (e.key === 'Escape') onClose(); }} style={{ position: 'fixed', top: 0, right: 0, bottom: 0, width: '480px', backgroundColor: 'var(--mui-palette-background-paper, #fff)', boxShadow: '-4px 0 16px rgba(0,0,0,0.15)', zIndex: 1300, overflowY: 'auto', padding: '24px', }} >
{fs.metadata.name}
{fs.status?.phase ?? 'Unknown'} ), }, { name: 'Age', value: formatAge(fs.metadata.creationTimestamp) }, ]} /> {fs.spec?.dataPools && fs.spec.dataPools.length > 0 && ( {fs.spec.dataPools.map((pool, i) => ( ))} )} {fs.spec?.metadataPool && ( )} {fs.status?.info && Object.keys(fs.status.info).length > 0 && ( ({ name: k, value: v }))} /> )}
); } export default function FilesystemsPage() { const { filesystems, loading, error } = useRookCephContext(); const [selected, setSelected] = useState(null); if (loading) return ; return ( <> {error && ( {error} }]} /> )} {filesystems.length === 0 ? ( ) : ( ( ), }, { label: 'Phase', getter: (f: CephFilesystem) => ( {f.status?.phase ?? 'Unknown'} ), }, { label: 'Active MDS', getter: (f: CephFilesystem) => String(f.spec?.metadataServer?.activeCount ?? '—'), }, { label: 'Active Standby', getter: (f: CephFilesystem) => String(f.spec?.metadataServer?.activeStandby ?? '—'), }, { label: 'Data Pools', getter: (f: CephFilesystem) => String(f.spec?.dataPools?.length ?? 0), }, { label: 'Age', getter: (f: CephFilesystem) => formatAge(f.metadata.creationTimestamp), }, ]} data={filesystems} /> )} {selected && ( <>
setSelected(null)} /> setSelected(null)} /> )} ); }