Fix label proptype to allow for dates and numbers, add comments
This commit is contained in:
1 parent
a0c73469fa
commit
e3c13d93ec
2 files changed
+10
-5
No files matched your search
@@ -162,7 +162,11 @@ export const InfrastructureTooltip = ({
|
|||||||
InfrastructureTooltip.propTypes = {
|
InfrastructureTooltip.propTypes = {
|
||||||
active: PropTypes.bool,
|
active: PropTypes.bool,
|
||||||
payload: PropTypes.array,
|
payload: PropTypes.array,
|
||||||
label: PropTypes.string,
|
label: PropTypes.oneOfType([
|
||||||
|
PropTypes.instanceOf(Date),
|
||||||
|
PropTypes.string,
|
||||||
|
PropTypes.number,
|
||||||
|
]),
|
||||||
yKey: PropTypes.string,
|
yKey: PropTypes.string,
|
||||||
yIdx: PropTypes.number,
|
yIdx: PropTypes.number,
|
||||||
yLabel: PropTypes.string,
|
yLabel: PropTypes.string,
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ const InfrastructureDetails = () => {
|
|||||||
yKey="memory.usage_percent"
|
yKey="memory.usage_percent"
|
||||||
customTooltip={({ active, payload, label }) => (
|
customTooltip={({ active, payload, label }) => (
|
||||||
<InfrastructureTooltip
|
<InfrastructureTooltip
|
||||||
label={label?.toString() ?? ""}
|
label={label}
|
||||||
yKey="memory.usage_percent"
|
yKey="memory.usage_percent"
|
||||||
yLabel="Memory Usage"
|
yLabel="Memory Usage"
|
||||||
active={active}
|
active={active}
|
||||||
@@ -207,7 +207,7 @@ const InfrastructureDetails = () => {
|
|||||||
yKey="cpu.usage_percent"
|
yKey="cpu.usage_percent"
|
||||||
customTooltip={({ active, payload, label }) => (
|
customTooltip={({ active, payload, label }) => (
|
||||||
<InfrastructureTooltip
|
<InfrastructureTooltip
|
||||||
label={label?.toString() ?? ""}
|
label={label}
|
||||||
yKey="cpu.usage_percent"
|
yKey="cpu.usage_percent"
|
||||||
yLabel="CPU Usage"
|
yLabel="CPU Usage"
|
||||||
active={active}
|
active={active}
|
||||||
@@ -222,16 +222,17 @@ const InfrastructureDetails = () => {
|
|||||||
gradientEndColor="#ffffff"
|
gradientEndColor="#ffffff"
|
||||||
/>
|
/>
|
||||||
{latestCheck.disk.map((disk, idx) => {
|
{latestCheck.disk.map((disk, idx) => {
|
||||||
|
// disk is an array of disks, so we need to map over it
|
||||||
return (
|
return (
|
||||||
<AreaChart
|
<AreaChart
|
||||||
key={disk._id}
|
key={disk._id}
|
||||||
data={testData}
|
data={testData}
|
||||||
dataKey={`disk[${idx}].usage_percent`}
|
dataKey={`disk[${idx}].usage_percent`}
|
||||||
xKey="createdAt"
|
xKey="createdAt"
|
||||||
yKey={`disk[${idx}].usage_percent`}
|
yKey={`disk[${idx}].usage_percent`} // We are looking for the usage_percent of the current disk in the array
|
||||||
customTooltip={({ active, payload, label }) => (
|
customTooltip={({ active, payload, label }) => (
|
||||||
<InfrastructureTooltip
|
<InfrastructureTooltip
|
||||||
label={label?.toString() ?? ""}
|
label={label} // label must be a string
|
||||||
yKey={`disk.usage_percent`}
|
yKey={`disk.usage_percent`}
|
||||||
yLabel="Disk Usage"
|
yLabel="Disk Usage"
|
||||||
yIdx={idx}
|
yIdx={idx}
|
||||||
|
|||||||
Reference in new issue
Block a user