Update project with latest eslint rules

This commit is contained in:
Debajyoti Halder
2021-01-29 11:55:12 +05:30
parent da661f836e
commit 6106345e6d
49 changed files with 173 additions and 157 deletions
@@ -32,8 +32,8 @@ export const DeploymentDrawer = ({
object={deployment}
expanded={expanded}
kind="Deployment"
renderObject={(deployment: V1Deployment) => {
const conditions = (deployment.status?.conditions ?? [])
renderObject={(deploymentObj: V1Deployment) => {
const conditions = (deploymentObj.status?.conditions ?? [])
.map(renderCondition)
.reduce((accum, next) => {
accum[next[0]] = next[1];
@@ -41,10 +41,10 @@ export const DeploymentDrawer = ({
}, {} as { [key: string]: React.ReactNode });
return {
strategy: deployment.spec?.strategy ?? '???',
minReadySeconds: deployment.spec?.minReadySeconds ?? '???',
strategy: deploymentObj.spec?.strategy ?? '???',
minReadySeconds: deploymentObj.spec?.minReadySeconds ?? '???',
progressDeadlineSeconds:
deployment.spec?.progressDeadlineSeconds ?? '???',
deploymentObj.spec?.progressDeadlineSeconds ?? '???',
...conditions,
};
}}
@@ -32,16 +32,16 @@ export const HorizontalPodAutoscalerDrawer = ({
kind="HorizontalPodAutoscaler"
object={hpa}
expanded={expanded}
renderObject={(hpa: V1HorizontalPodAutoscaler) => {
renderObject={(hpaObject: V1HorizontalPodAutoscaler) => {
return {
targetCPUUtilizationPercentage:
hpa.spec?.targetCPUUtilizationPercentage,
hpaObject.spec?.targetCPUUtilizationPercentage,
currentCPUUtilizationPercentage:
hpa.status?.currentCPUUtilizationPercentage,
minReplicas: hpa.spec?.minReplicas,
maxReplicas: hpa.spec?.maxReplicas,
currentReplicas: hpa.status?.currentReplicas,
desiredReplicas: hpa.status?.desiredReplicas,
hpaObject.status?.currentCPUUtilizationPercentage,
minReplicas: hpaObject.spec?.minReplicas,
maxReplicas: hpaObject.spec?.maxReplicas,
currentReplicas: hpaObject.status?.currentReplicas,
desiredReplicas: hpaObject.status?.desiredReplicas,
};
}}
>
@@ -31,8 +31,8 @@ export const IngressDrawer = ({
object={ingress}
expanded={expanded}
kind="Ingress"
renderObject={(ingress: ExtensionsV1beta1Ingress) => {
return ingress.spec || {};
renderObject={(ingressObject: ExtensionsV1beta1Ingress) => {
return ingressObject.spec || {};
}}
>
<Grid
+8 -8
View File
@@ -37,17 +37,17 @@ export const PodDrawer = ({
object={pod}
expanded={expanded}
kind="Pod"
renderObject={(pod: V1Pod) => {
const phase = pod.status?.phase ?? 'unknown';
renderObject={(podObject: V1Pod) => {
const phase = podObject.status?.phase ?? 'unknown';
const ports =
pod.spec?.containers?.map(c => {
podObject.spec?.containers?.map(c => {
return {
[c.name]: c.ports,
};
}) ?? 'N/A';
const conditions = (pod.status?.conditions ?? [])
const conditions = (podObject.status?.conditions ?? [])
.map(renderCondition)
.reduce((accum, next) => {
accum[next[0]] = next[1];
@@ -55,11 +55,11 @@ export const PodDrawer = ({
}, {} as { [key: string]: React.ReactNode });
return {
images: imageChips(pod),
images: imageChips(podObject),
phase: phase,
'Containers Ready': containersReady(pod),
'Total Restarts': totalRestarts(pod),
'Container Statuses': containerStatuses(pod),
'Containers Ready': containersReady(podObject),
'Total Restarts': totalRestarts(podObject),
'Container Statuses': containerStatuses(podObject),
...conditions,
'Exposed ports': ports,
};
@@ -31,8 +31,8 @@ export const ServiceDrawer = ({
object={service}
expanded={expanded}
kind="Service"
renderObject={(service: V1Service) => {
return service.spec || {};
renderObject={(serviceObject: V1Service) => {
return serviceObject.spec || {};
}}
>
<Grid
+4 -4
View File
@@ -36,9 +36,9 @@ export const imageChips = (pod: V1Pod): ReactNode => {
export const containersReady = (pod: V1Pod): string => {
const containerStatuses = pod.status?.containerStatuses ?? [];
const containersReady = containerStatuses.filter(cs => cs.ready).length;
const containersReadyItem = containerStatuses.filter(cs => cs.ready).length;
return `${containersReady}/${containerStatuses.length}`;
return `${containersReadyItem}/${containerStatuses.length}`;
};
export const totalRestarts = (pod: V1Pod): number => {
@@ -47,8 +47,8 @@ export const totalRestarts = (pod: V1Pod): number => {
};
export const containerStatuses = (pod: V1Pod): ReactNode => {
const containerStatuses = pod.status?.containerStatuses ?? [];
const errors = containerStatuses.reduce((accum, next) => {
const containerStatusesItem = pod.status?.containerStatuses ?? [];
const errors = containerStatusesItem.reduce((accum, next) => {
if (next.state === undefined) {
return accum;
}