Skip to content

Commit

Permalink
Filter null values before storing it in the state
Browse files Browse the repository at this point in the history
  • Loading branch information
cesnietor committed Apr 25, 2023
1 parent 183df0b commit e093fb8
Showing 1 changed file with 21 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -306,17 +306,13 @@ const PodDescribeTable = ({
</TableHead>
<TableBody>
{items.map((item, i) => {
if (item) {
return (
<TableRow key={i}>
{columns.map((column, j) => (
<TableCell key={j}>{item[column]}</TableCell>
))}
</TableRow>
);
} else {
return <React.Fragment />;
}
return (
<TableRow key={i}>
{columns.map((column, j) => (
<TableCell key={j}>{item[column]}</TableCell>
))}
</TableRow>
);
})}
</TableBody>
</Table>
Expand Down Expand Up @@ -416,7 +412,8 @@ const PodDescribe = ({
`/api/v1/namespaces/${namespace}/tenants/${tenant}/pods/${podName}/describe`
)
.then((res: DescribeResponse) => {
setDescribeInfo(res);
const cleanRes = cleanDescribeResponseEnvVariables(res);
setDescribeInfo(cleanRes);
setLoading(false);
})
.catch((err: ErrorResponseHandler) => {
Expand All @@ -426,6 +423,18 @@ const PodDescribe = ({
}
}, [loading, podName, namespace, tenant, dispatch]);

const cleanDescribeResponseEnvVariables = (
res: DescribeResponse
): DescribeResponse => {
res.containers = res.containers.map((c) => {
c.environmentVariables = c.environmentVariables.filter(
(item) => item !== null
);
return c;
});
return res;
};

const renderTabComponent = (index: number, info: DescribeResponse) => {
switch (index) {
case 0:
Expand Down

0 comments on commit e093fb8

Please sign in to comment.