Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for Describe tab content in PVC and Pods #1596

Merged
merged 1 commit into from
May 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
242 changes: 128 additions & 114 deletions web-app/src/screens/Console/Tenants/TenantDetails/pods/PodDescribe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,16 +181,18 @@ const HeaderSection = ({ title }: { title: string }) => {
const PodDescribeSummary = ({ describeInfo }: IPodDescribeSummaryProps) => {
return (
<React.Fragment>
<HeaderSection title={"Summary"} />
<Box sx={{ ...twoColCssGridLayoutConfig }}>
<LabelValuePair label={"Name"} value={describeInfo.name} />
<LabelValuePair label={"Namespace"} value={describeInfo.namespace} />
<LabelValuePair label={"Node"} value={describeInfo.nodeName} />
<LabelValuePair label={"Start time"} value={describeInfo.startTime} />
<LabelValuePair label={"Status"} value={describeInfo.phase} />
<LabelValuePair label={"QoS Class"} value={describeInfo.qosClass} />
<LabelValuePair label={"IP"} value={describeInfo.podIP} />
</Box>
<div id="pod-describe-summary-content">
<HeaderSection title={"Summary"} />
<Box sx={{ ...twoColCssGridLayoutConfig }}>
<LabelValuePair label={"Name"} value={describeInfo.name} />
<LabelValuePair label={"Namespace"} value={describeInfo.namespace} />
<LabelValuePair label={"Node"} value={describeInfo.nodeName} />
<LabelValuePair label={"Start time"} value={describeInfo.startTime} />
<LabelValuePair label={"Status"} value={describeInfo.phase} />
<LabelValuePair label={"QoS Class"} value={describeInfo.qosClass} />
<LabelValuePair label={"IP"} value={describeInfo.podIP} />
</Box>
</div>
</React.Fragment>
);
};
Expand All @@ -200,87 +202,97 @@ const PodDescribeAnnotations = ({
}: IPodDescribeAnnotationsProps) => {
return (
<React.Fragment>
<HeaderSection title={"Annotations"} />
<Box>
{annotations.map((annotation, index) => (
<Chip
style={{ margin: "0.5%" }}
label={`${annotation.key}: ${annotation.value}`}
key={index}
/>
))}
</Box>
<div id="pod-describe-annotations-content">
<HeaderSection title={"Annotations"} />
<Box>
{annotations.map((annotation, index) => (
<Chip
style={{ margin: "0.5%" }}
label={`${annotation.key}: ${annotation.value}`}
key={index}
/>
))}
</Box>
</div>
</React.Fragment>
);
};

const PodDescribeLabels = ({ labels }: IPodDescribeLabelsProps) => {
return (
<React.Fragment>
<HeaderSection title={"Labels"} />
<Box>
{labels.map((label, index) => (
<Chip
style={{ margin: "0.5%" }}
label={`${label.key}: ${label.value}`}
key={index}
/>
))}
</Box>
<div id="pod-describe-labels-content">
<HeaderSection title={"Labels"} />
<Box>
{labels.map((label, index) => (
<Chip
style={{ margin: "0.5%" }}
label={`${label.key}: ${label.value}`}
key={index}
/>
))}
</Box>
</div>
</React.Fragment>
);
};

const PodDescribeConditions = ({ conditions }: IPodDescribeConditionsProps) => {
return (
<PodDescribeTable
title="Conditions"
columns={["type", "status"]}
columnsLabels={["Type", "Status"]}
items={conditions}
/>
<div id="pod-describe-conditions-content">
<PodDescribeTable
title="Conditions"
columns={["type", "status"]}
columnsLabels={["Type", "Status"]}
items={conditions}
/>
</div>
);
};

const PodDescribeTolerations = ({
tolerations,
}: IPodDescribeTolerationsProps) => {
return (
<PodDescribeTable
title="Tolerations"
columns={["effect", "key", "operator", "tolerationSeconds"]}
columnsLabels={["Effect", "Key", "Operator", "Seconds of toleration"]}
items={tolerations}
/>
<div id="pod-describe-tolerations-content">
<PodDescribeTable
title="Tolerations"
columns={["effect", "key", "operator", "tolerationSeconds"]}
columnsLabels={["Effect", "Key", "Operator", "Seconds of toleration"]}
items={tolerations}
/>
</div>
);
};

const PodDescribeVolumes = ({ volumes }: IPodDescribeVolumesProps) => {
return (
<React.Fragment>
{volumes.map((volume, index) => (
<React.Fragment key={index}>
<HeaderSection title={`Volume ${volume.name}`} />
<Box sx={{ ...twoColCssGridLayoutConfig }}>
{volume.pvc && (
<React.Fragment>
<LabelValuePair
label={"Type"}
value="Persistant Volume Claim"
/>
<LabelValuePair
label={"Claim Name"}
value={volume.pvc.claimName}
/>
</React.Fragment>
)}
{/* TODO Add component to display projected data (Maybe change API response) */}
{volume.projected && (
<LabelValuePair label={"Type"} value="Projected" />
)}
</Box>
</React.Fragment>
))}
<div id="pod-describe-volumes-content">
{volumes.map((volume, index) => (
<React.Fragment key={index}>
<HeaderSection title={`Volume ${volume.name}`} />
<Box sx={{ ...twoColCssGridLayoutConfig }}>
{volume.pvc && (
<React.Fragment>
<LabelValuePair
label={"Type"}
value="Persistant Volume Claim"
/>
<LabelValuePair
label={"Claim Name"}
value={volume.pvc.claimName}
/>
</React.Fragment>
)}
{/* TODO Add component to display projected data (Maybe change API response) */}
{volume.projected && (
<LabelValuePair label={"Type"} value="Projected" />
)}
</Box>
</React.Fragment>
))}
</div>
</React.Fragment>
);
};
Expand Down Expand Up @@ -325,57 +337,59 @@ const PodDescribeTable = ({
const PodDescribeContainers = ({ containers }: IPodDescribeContainersProps) => {
return (
<React.Fragment>
{containers.map((container, index) => (
<React.Fragment key={index}>
<HeaderSection title={`Container ${container.name}`} />
<Box
style={{ wordBreak: "break-all" }}
sx={{ ...twoColCssGridLayoutConfig }}
>
<LabelValuePair label={"Image"} value={container.image} />
<LabelValuePair label={"Ready"} value={`${container.ready}`} />
<LabelValuePair
label={"Ports"}
value={container.ports.join(", ")}
/>
<LabelValuePair
label={"Host Ports"}
value={container.hostPorts.join(", ")}
<div id="pod-describe-containers-content">
{containers.map((container, index) => (
<React.Fragment key={index}>
<HeaderSection title={`Container ${container.name}`} />
<Box
style={{ wordBreak: "break-all" }}
sx={{ ...twoColCssGridLayoutConfig }}
>
<LabelValuePair label={"Image"} value={container.image} />
<LabelValuePair label={"Ready"} value={`${container.ready}`} />
<LabelValuePair
label={"Ports"}
value={container.ports.join(", ")}
/>
<LabelValuePair
label={"Host Ports"}
value={container.hostPorts.join(", ")}
/>
<LabelValuePair
label={"Arguments"}
value={container.args.join(", ")}
/>
<LabelValuePair
label={"Started"}
value={container.state?.started}
/>
<LabelValuePair label={"State"} value={container.state?.state} />
</Box>
<Box
style={{ wordBreak: "break-all" }}
sx={{ ...twoColCssGridLayoutConfig }}
>
<LabelValuePair label={"Image ID"} value={container.imageID} />
<LabelValuePair
label={"Container ID"}
value={container.containerID}
/>
</Box>
<PodDescribeTable
title="Mounts"
columns={["name", "mountPath"]}
columnsLabels={["Name", "Mount Path"]}
items={container.mounts}
/>
<LabelValuePair
label={"Arguments"}
value={container.args.join(", ")}
<PodDescribeTable
title="Environment Variables"
columns={["key", "value"]}
columnsLabels={["Key", "Value"]}
items={container.environmentVariables}
/>
<LabelValuePair
label={"Started"}
value={container.state?.started}
/>
<LabelValuePair label={"State"} value={container.state?.state} />
</Box>
<Box
style={{ wordBreak: "break-all" }}
sx={{ ...twoColCssGridLayoutConfig }}
>
<LabelValuePair label={"Image ID"} value={container.imageID} />
<LabelValuePair
label={"Container ID"}
value={container.containerID}
/>
</Box>
<PodDescribeTable
title="Mounts"
columns={["name", "mountPath"]}
columnsLabels={["Name", "Mount Path"]}
items={container.mounts}
/>
<PodDescribeTable
title="Environment Variables"
columns={["key", "value"]}
columnsLabels={["Key", "Value"]}
items={container.environmentVariables}
/>
</React.Fragment>
))}
</React.Fragment>
))}
</div>
</React.Fragment>
);
};
Expand Down
Loading