MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / ClusterMetricsInner

Function ClusterMetricsInner

console/src/components/ClusterMetrics.tsx:60–260  ·  view source on GitHub ↗
({
  clusterId,
  clusterName,
  replicaName,
  ...props
}: ClusterMetricsProps)

Source from the content-addressed store, hash-verified

58}
59
60export const ClusterMetricsInner = ({
61 clusterId,
62 clusterName,
63 replicaName,
64 ...props
65}: ClusterMetricsProps) => {
66 const { colors } = useTheme<MaterializeTheme>();
67 const regionSlug = useRegionSlug();
68
69 const { getClusterById } = useAllClusters();
70 const cluster = getClusterById(clusterId);
71
72 const { data } = useClusterReplicaMetrics({
73 clusterId,
74 });
75 const clusterHasDisk =
76 Boolean(cluster?.disk) || Boolean(cluster?.replicas.some((r) => r.disk));
77 const replicaCount = data.rows.length;
78 const metrics = data.rows[0];
79 if (replicaCount === 0) {
80 return (
81 <VStack
82 alignItems="flex-start"
83 justifyContent="flex-start"
84 width="100%"
85 {...props}
86 >
87 <Alert
88 variant="info"
89 showLabel={false}
90 label="Cluster paused"
91 message={
92 <Text>
93 <Link
94 to={absoluteClusterPath(regionSlug, {
95 id: clusterId,
96 name: clusterName,
97 })}
98 >
99 <Text
100 as="span"
101 textStyle="text-ui-med"
102 textDecoration="underline"
103 >
104 {clusterName}
105 </Text>
106 </Link>{" "}
107 cluster is currently inactive
108 </Text>
109 }
110 w="100%"
111 />
112 </VStack>
113 );
114 }
115
116 // To support decimal results safely, we divide by 1 million first, then convert to a
117 // number and divide by the remaining 1000.

Callers

nothing calls this directly

Calls 7

useRegionSlugFunction · 0.90
useAllClustersFunction · 0.90
useClusterReplicaMetricsFunction · 0.90
absoluteClusterPathFunction · 0.90
pluralizeFunction · 0.90
formatBytesShortFunction · 0.90
BooleanClass · 0.50

Tested by

no test coverage detected