chore: update react imports

Signed-off-by: Paul Schultz <pschultz@pobox.com>
This commit is contained in:
Paul Schultz
2025-01-28 10:21:17 -06:00
parent 02981a2377
commit 2e26579e06
1282 changed files with 2776 additions and 3434 deletions
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import React from 'react';
import { screen } from '@testing-library/react';
import { renderInTestApp } from '@backstage/test-utils';
import { Cluster } from './Cluster';
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React from 'react';
import { ReactNode } from 'react';
import Accordion from '@material-ui/core/Accordion';
import AccordionDetails from '@material-ui/core/AccordionDetails';
import AccordionSummary from '@material-ui/core/AccordionSummary';
@@ -46,7 +46,7 @@ type ClusterSummaryProps = {
clusterName: string;
totalNumberOfPods: number;
numberOfPodsWithErrors: number;
children?: React.ReactNode;
children?: ReactNode;
};
const ClusterSummary = ({
@@ -110,7 +110,7 @@ const ClusterSummary = ({
export type ClusterProps = {
clusterObjects: ClusterObjects;
podsWithErrors: Set<string>;
children?: React.ReactNode;
children?: ReactNode;
};
/**
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import React from 'react';
import { screen } from '@testing-library/react';
import { CronJobsAccordions } from './CronJobsAccordions';
import * as oneCronJobsFixture from '../../__fixtures__/1-cronjobs.json';
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { useContext } from 'react';
import { ReactNode, useContext } from 'react';
import Accordion from '@material-ui/core/Accordion';
import AccordionDetails from '@material-ui/core/AccordionDetails';
import AccordionSummary from '@material-ui/core/AccordionSummary';
@@ -34,18 +34,18 @@ import { humanizeCron } from '../../utils/crons';
* @public
*/
export type CronJobsAccordionsProps = {
children?: React.ReactNode;
children?: ReactNode;
};
type CronJobAccordionProps = {
cronJob: V1CronJob;
ownedJobs: V1Job[];
children?: React.ReactNode;
children?: ReactNode;
};
type CronJobSummaryProps = {
cronJob: V1CronJob;
children?: React.ReactNode;
children?: ReactNode;
};
const CronJobSummary = ({ cronJob }: CronJobSummaryProps) => {
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import * as oneCronJobsFixture from '../../__fixtures__/1-cronjobs.json';
import { renderInTestApp, TestApiProvider } from '@backstage/test-utils';
import { CronJobDrawer } from './CronJobsDrawer';
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { V1CronJob } from '@kubernetes/client-node';
import { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';
import Typography from '@material-ui/core/Typography';
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import React from 'react';
import { screen } from '@testing-library/react';
import { renderInTestApp } from '@backstage/test-utils';
import { kubernetesProviders } from '../../../hooks/test-utils';
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React, { useContext } from 'react';
import { ReactNode, useContext } from 'react';
import Accordion from '@material-ui/core/Accordion';
import AccordionDetails from '@material-ui/core/AccordionDetails';
import AccordionSummary from '@material-ui/core/AccordionSummary';
@@ -43,7 +43,7 @@ import { READY_COLUMNS, RESOURCE_COLUMNS } from '../../Pods/PodsTable';
type RolloutAccordionsProps = {
rollouts: any[];
defaultExpanded?: boolean;
children?: React.ReactNode;
children?: ReactNode;
};
type RolloutAccordionProps = {
@@ -51,7 +51,7 @@ type RolloutAccordionProps = {
ownedPods: V1Pod[];
defaultExpanded?: boolean;
matchingHpa?: V2HorizontalPodAutoscaler;
children?: React.ReactNode;
children?: ReactNode;
};
type RolloutSummaryProps = {
@@ -59,7 +59,7 @@ type RolloutSummaryProps = {
numberOfCurrentPods: number;
numberOfPodsWithErrors: number;
hpa?: V2HorizontalPodAutoscaler;
children?: React.ReactNode;
children?: ReactNode;
};
const AbortedTitle = (
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import React from 'react';
import { KubernetesStructuredMetadataTableDrawer } from '../../KubernetesDrawer';
import Typography from '@material-ui/core/Typography';
import Grid from '@material-ui/core/Grid';
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import React from 'react';
import { screen } from '@testing-library/react';
import pauseSteps from './__fixtures__/pause-steps';
import setWeightSteps from './__fixtures__/setweight-steps';
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React from 'react';
import { ReactNode } from 'react';
import Step from '@material-ui/core/Step';
import StepLabel from '@material-ui/core/StepLabel';
import Stepper from '@material-ui/core/Stepper';
@@ -30,7 +30,7 @@ interface StepsProgressProps {
currentStepIndex: number;
aborted: boolean;
steps: ArgoRolloutCanaryStep[];
children?: React.ReactNode;
children?: ReactNode;
}
const isSetWeightStep = (step: ArgoRolloutCanaryStep): step is SetWeightStep =>
@@ -42,7 +42,7 @@ const isPauseStep = (step: ArgoRolloutCanaryStep): step is PauseStep =>
const isAnalysisStep = (step: ArgoRolloutCanaryStep): step is AnalysisStep =>
step.hasOwnProperty('analysis');
const createLabelForStep = (step: ArgoRolloutCanaryStep): React.ReactNode => {
const createLabelForStep = (step: ArgoRolloutCanaryStep): ReactNode => {
if (isSetWeightStep(step)) {
return `setWeight ${step.setWeight}%`;
} else if (isPauseStep(step)) {
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React, { useContext } from 'react';
import { ReactNode, useContext } from 'react';
import lodash, { Dictionary } from 'lodash';
import { RolloutAccordions } from './ArgoRollouts';
import { DefaultCustomResourceAccordions } from './DefaultCustomResource';
@@ -26,7 +26,7 @@ import { GroupedResponsesContext } from '../../hooks';
* @public
*/
export interface CustomResourcesProps {
children?: React.ReactNode;
children?: ReactNode;
}
const kindToResource = (customResources: any[]): Dictionary<any[]> => {
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import React from 'react';
import { screen } from '@testing-library/react';
import { renderInTestApp } from '@backstage/test-utils';
import { kubernetesProviders } from '../../hooks/test-utils';
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React from 'react';
import { ReactNode } from 'react';
import Accordion from '@material-ui/core/Accordion';
import AccordionDetails from '@material-ui/core/AccordionDetails';
import AccordionSummary from '@material-ui/core/AccordionSummary';
@@ -27,20 +27,20 @@ type DefaultCustomResourceAccordionsProps = {
customResources: any[];
customResourceName: string;
defaultExpanded?: boolean;
children?: React.ReactNode;
children?: ReactNode;
};
type DefaultCustomResourceAccordionProps = {
customResource: any;
customResourceName: string;
defaultExpanded?: boolean;
children?: React.ReactNode;
children?: ReactNode;
};
type DefaultCustomResourceSummaryProps = {
customResource: any;
customResourceName: string;
children?: React.ReactNode;
children?: ReactNode;
};
const DefaultCustomResourceSummary = ({
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import React from 'react';
import { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';
import Typography from '@material-ui/core/Typography';
import Grid from '@material-ui/core/Grid';
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import React from 'react';
import { screen } from '@testing-library/react';
import { DaemonSetsAccordions } from './DaemonSetsAccordions';
import * as oneDaemonsFixture from '../../__fixtures__/2-daemonsets.json';
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React, { useContext } from 'react';
import { ReactNode, useContext } from 'react';
import Accordion from '@material-ui/core/Accordion';
import AccordionDetails from '@material-ui/core/AccordionDetails';
import AccordionSummary from '@material-ui/core/AccordionSummary';
@@ -32,20 +32,20 @@ import { StatusError, StatusOK } from '@backstage/core-components';
import { READY_COLUMNS, RESOURCE_COLUMNS } from '../Pods/PodsTable';
type DaemonSetsAccordionsProps = {
children?: React.ReactNode;
children?: ReactNode;
};
type DaemonSetAccordionProps = {
daemonset: V1DaemonSet;
ownedPods: V1Pod[];
children?: React.ReactNode;
children?: ReactNode;
};
type DaemonSetSummaryProps = {
daemonset: V1DaemonSet;
numberOfCurrentPods: number;
numberOfPodsWithErrors: number;
children?: React.ReactNode;
children?: ReactNode;
};
const DaemonSetSummary = ({
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import React from 'react';
import * as daemonsets from '../../__fixtures__/2-daemonsets.json';
import { renderInTestApp, TestApiProvider } from '@backstage/test-utils';
import { DaemonSetDrawer } from './DaemonSetsDrawer';
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import React from 'react';
import { V1DaemonSet } from '@kubernetes/client-node';
import { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';
import Typography from '@material-ui/core/Typography';
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import React from 'react';
import * as deployments from '../../__fixtures__/2-deployments.json';
import {
renderInTestApp,
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React from 'react';
import { ReactNode } from 'react';
import { V1Deployment } from '@kubernetes/client-node';
import { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';
import { renderCondition } from '../../utils/pod';
@@ -41,7 +41,7 @@ export const DeploymentDrawer = ({
.reduce((accum, next) => {
accum[next[0]] = next[1];
return accum;
}, {} as { [key: string]: React.ReactNode });
}, {} as { [key: string]: ReactNode });
return {
strategy: deploymentObj.spec?.strategy ?? '???',
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import React from 'react';
import { screen } from '@testing-library/react';
import { DeploymentsAccordions } from './DeploymentsAccordions';
import * as twoDeployFixture from '../../__fixtures__/2-deployments.json';
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React, { useContext } from 'react';
import { ReactNode, useContext } from 'react';
import Accordion from '@material-ui/core/Accordion';
import AccordionDetails from '@material-ui/core/AccordionDetails';
import AccordionSummary from '@material-ui/core/AccordionSummary';
@@ -41,14 +41,14 @@ import { StatusError, StatusOK } from '@backstage/core-components';
import { READY_COLUMNS, RESOURCE_COLUMNS } from '../Pods/PodsTable';
type DeploymentsAccordionsProps = {
children?: React.ReactNode;
children?: ReactNode;
};
type DeploymentAccordionProps = {
deployment: V1Deployment;
ownedPods: V1Pod[];
matchingHpa?: V2HorizontalPodAutoscaler;
children?: React.ReactNode;
children?: ReactNode;
};
type DeploymentSummaryProps = {
@@ -56,7 +56,7 @@ type DeploymentSummaryProps = {
numberOfCurrentPods: number;
numberOfPodsWithErrors: number;
hpa?: V2HorizontalPodAutoscaler;
children?: React.ReactNode;
children?: ReactNode;
};
const DeploymentSummary = ({
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import React from 'react';
import { screen } from '@testing-library/react';
import { renderInTestApp } from '@backstage/test-utils';
import { ErrorPanel } from './ErrorPanel';
@@ -14,14 +14,14 @@
* limitations under the License.
*/
import React from 'react';
import { ReactNode } from 'react';
import Typography from '@material-ui/core/Typography';
import { ClusterObjects } from '@backstage/plugin-kubernetes-common';
import { WarningPanel } from '@backstage/core-components';
const clustersWithErrorsToErrorMessage = (
clustersWithErrors: ClusterObjects[],
): React.ReactNode => {
): ReactNode => {
return clustersWithErrors.map((c, i) => {
return (
<div key={i}>
@@ -52,7 +52,7 @@ export type ErrorPanelProps = {
entityName: string;
errorMessage?: string;
clustersWithErrors?: ClusterObjects[];
children?: React.ReactNode;
children?: ReactNode;
};
/**
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { DetectedError } from '@backstage/plugin-kubernetes-common';
import { renderInTestApp } from '@backstage/test-utils';
import { MatcherFunction, screen } from '@testing-library/react';
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from 'react';
import {
ClusterAttributes,
DetectedError,
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import React from 'react';
import { screen } from '@testing-library/react';
import * as hpas from './__fixtures__/horizontalpodautoscalers.json';
import { renderInTestApp, TestApiProvider } from '@backstage/test-utils';
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React from 'react';
import { ReactNode } from 'react';
import { V2HorizontalPodAutoscaler } from '@kubernetes/client-node';
import { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';
@@ -22,7 +22,7 @@ import { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';
export const HorizontalPodAutoscalerDrawer = (props: {
hpa: V2HorizontalPodAutoscaler;
expanded?: boolean;
children?: React.ReactNode;
children?: ReactNode;
}) => {
const { hpa, expanded, children } = props;
@@ -20,7 +20,6 @@ import {
textContentMatcher,
} from '@backstage/test-utils';
import { screen } from '@testing-library/react';
import React from 'react';
import { IngressDrawer } from './IngressDrawer';
import * as ingresses from './__fixtures__/2-ingresses.json';
import { kubernetesClusterLinkFormatterApiRef } from '../../api';
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import React from 'react';
import { V1Ingress } from '@kubernetes/client-node';
import { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';
import Typography from '@material-ui/core/Typography';
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import React from 'react';
import { screen } from '@testing-library/react';
import * as oneIngressFixture from './__fixtures__/2-ingresses.json';
import { renderInTestApp } from '@backstage/test-utils';
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React, { useContext } from 'react';
import { useContext } from 'react';
import Accordion from '@material-ui/core/Accordion';
import AccordionDetails from '@material-ui/core/AccordionDetails';
import AccordionSummary from '@material-ui/core/AccordionSummary';
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import React from 'react';
import { screen } from '@testing-library/react';
import { JobsAccordions } from './JobsAccordions';
import * as oneCronJobsFixture from '../../__fixtures__/1-cronjobs.json';
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { useContext } from 'react';
import { ReactNode, useContext } from 'react';
import Accordion from '@material-ui/core/Accordion';
import AccordionDetails from '@material-ui/core/AccordionDetails';
import AccordionSummary from '@material-ui/core/AccordionSummary';
@@ -37,18 +37,18 @@ import {
*/
export type JobsAccordionsProps = {
jobs: V1Job[];
children?: React.ReactNode;
children?: ReactNode;
};
type JobAccordionProps = {
job: V1Job;
ownedPods: V1Pod[];
children?: React.ReactNode;
children?: ReactNode;
};
type JobSummaryProps = {
job: V1Job;
children?: React.ReactNode;
children?: ReactNode;
};
const JobSummary = ({ job }: JobSummaryProps) => {
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import * as oneCronJobsFixture from '../../__fixtures__/1-cronjobs.json';
import { renderInTestApp, TestApiProvider } from '@backstage/test-utils';
import { JobDrawer } from './JobsDrawer';
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { V1Job } from '@kubernetes/client-node';
import { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';
import Typography from '@material-ui/core/Typography';
@@ -21,7 +21,7 @@ import DialogTitle from '@material-ui/core/DialogTitle';
import IconButton from '@material-ui/core/IconButton';
import { Theme, createStyles, makeStyles } from '@material-ui/core/styles';
import CloseIcon from '@material-ui/icons/Close';
import React, { useState } from 'react';
import { ReactNode, useState } from 'react';
const useStyles = makeStyles((theme: Theme) =>
createStyles({
@@ -38,9 +38,9 @@ const useStyles = makeStyles((theme: Theme) =>
export interface KubernetesDialogProps {
buttonAriaLabel: string;
buttonIcon: React.ReactNode;
buttonIcon: ReactNode;
buttonText: string;
children?: React.ReactNode;
children?: ReactNode;
disabled?: boolean;
title: string;
}
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { ChangeEvent, useState } from 'react';
import { ReactNode, ChangeEvent, useState } from 'react';
import { IObjectMeta } from '@kubernetes-models/apimachinery/apis/meta/v1/ObjectMeta';
import Drawer from '@material-ui/core/Drawer';
@@ -61,8 +61,8 @@ export interface KubernetesObject {
interface KubernetesDrawerContentProps {
close: () => void;
kubernetesObject: KubernetesObject;
header?: React.ReactNode;
children?: React.ReactNode;
header?: ReactNode;
children?: ReactNode;
}
const KubernetesDrawerContent = ({
@@ -128,9 +128,9 @@ const KubernetesDrawerContent = ({
export interface KubernetesDrawerProps {
open?: boolean;
kubernetesObject: KubernetesObject;
label: React.ReactNode;
drawerContentsHeader?: React.ReactNode;
children?: React.ReactNode;
label: ReactNode;
drawerContentsHeader?: ReactNode;
children?: ReactNode;
}
const useDrawerStyles = makeStyles((theme: Theme) =>
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React, { ChangeEvent, useContext, useState } from 'react';
import { ReactNode, ChangeEvent, useContext, useState } from 'react';
import Button from '@material-ui/core/Button';
import Typography from '@material-ui/core/Typography';
import IconButton from '@material-ui/core/IconButton';
@@ -91,7 +91,7 @@ const PodDrawerButton = withStyles({
export type LinkErrorPanelProps = {
cluster: ClusterAttributes;
errorMessage?: string;
children?: React.ReactNode;
children?: ReactNode;
};
/**
@@ -257,7 +257,7 @@ export interface KubernetesStructuredMetadataTableDrawerProps<
buttonVariant?: 'h5' | 'subtitle2';
kind: string;
expanded?: boolean;
children?: React.ReactNode;
children?: ReactNode;
}
/**
@@ -17,7 +17,7 @@ import { CodeSnippet } from '@backstage/core-components';
import FormControlLabel from '@material-ui/core/FormControlLabel';
import Switch from '@material-ui/core/Switch';
import jsyaml from 'js-yaml';
import React, { useState } from 'react';
import { useState } from 'react';
/**
* Props of ManifestYaml
@@ -24,7 +24,6 @@ import {
import '@testing-library/jest-dom';
import { screen } from '@testing-library/react';
import WS from 'jest-websocket-mock';
import React from 'react';
import './matchMedia.mock';
import { PodExecTerminal } from './PodExecTerminal';
@@ -18,7 +18,7 @@ import 'xterm/css/xterm.css';
import { discoveryApiRef, useApi } from '@backstage/core-plugin-api';
import { ClusterAttributes } from '@backstage/plugin-kubernetes-common';
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles';
import React, { useEffect, useMemo, useState } from 'react';
import { useRef, useEffect, useMemo, useState } from 'react';
import { Terminal } from 'xterm';
import { FitAddon } from 'xterm-addon-fit';
@@ -60,7 +60,7 @@ export const PodExecTerminal = (props: PodExecTerminalProps) => {
const [baseUrl, setBaseUrl] = useState(window.location.host);
const terminalRef = React.useRef(null);
const terminalRef = useRef(null);
const discoveryApi = useApi(discoveryApiRef);
const namespace = podNamespace ?? 'default';
@@ -15,7 +15,6 @@
*/
import OpenInBrowserIcon from '@material-ui/icons/OpenInBrowser';
import React from 'react';
import { KubernetesDialog } from '../KubernetesDialog';
import { useIsPodExecTerminalSupported } from '../../hooks';
@@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { render } from '@testing-library/react';
import { ErrorList } from './ErrorList';
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { Fragment } from 'react';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
@@ -60,7 +60,7 @@ export const ErrorList = ({ podAndErrors }: ErrorListProps) => {
.flatMap(onlyPodWithErrors => {
return onlyPodWithErrors.errors.map((error, i) => {
return (
<React.Fragment
<Fragment
key={`${
onlyPodWithErrors.pod.metadata?.name ?? 'unknown'
}-eli-${i}`}
@@ -83,7 +83,7 @@ export const ErrorList = ({ podAndErrors }: ErrorListProps) => {
</Grid>
</Grid>
</ListItem>
</React.Fragment>
</Fragment>
);
});
})}
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { EventsContent } from './Events';
import { render } from '@testing-library/react';
import { Event } from 'kubernetes-models/v1';
@@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import Avatar from '@material-ui/core/Avatar';
import Container from '@material-ui/core/Container';
import Grid from '@material-ui/core/Grid';
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { Fragment } from 'react';
import { FixDialog } from './FixDialog';
import { Pod } from 'kubernetes-models/v1/Pod';
@@ -21,13 +21,13 @@ import { renderInTestApp } from '@backstage/test-utils';
jest.mock('../Events', () => ({
Events: () => {
return <React.Fragment />;
return <Fragment />;
},
}));
jest.mock('../PodLogs', () => ({
PodLogs: () => {
return <React.Fragment />;
return <Fragment />;
},
}));
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { useState } from 'react';
import { FC, useState } from 'react';
import Button from '@material-ui/core/Button';
import Grid from '@material-ui/core/Grid';
@@ -64,7 +64,7 @@ export interface FixDialogProps {
*
* @public
*/
export const FixDialog: React.FC<FixDialogProps> = ({
export const FixDialog: FC<FixDialogProps> = ({
open,
pod,
error,
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { useState } from 'react';
import { useState } from 'react';
import Grid from '@material-ui/core/Grid';
import Typography from '@material-ui/core/Typography';
@@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { screen } from '@testing-library/react';
import '@testing-library/jest-dom';
@@ -23,7 +23,7 @@ import Grid from '@material-ui/core/Grid';
import Typography from '@material-ui/core/Typography';
import { IContainer, IContainerStatus } from 'kubernetes-models/v1';
import { DateTime } from 'luxon';
import React from 'react';
import { FC } from 'react';
import { useIsPodExecTerminalEnabled } from '../../../hooks';
import { bytesToMiB, formatMillicores } from '../../../utils/resources';
@@ -106,7 +106,7 @@ export interface ContainerCardProps {
*
* @public
*/
export const ContainerCard: React.FC<ContainerCardProps> = ({
export const ContainerCard: FC<ContainerCardProps> = ({
podScope,
containerSpec,
containerStatus,
@@ -14,8 +14,6 @@
* limitations under the License.
*/
import React from 'react';
import { screen } from '@testing-library/react';
import '@testing-library/jest-dom';
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import Grid from '@material-ui/core/Grid';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
@@ -14,8 +14,6 @@
* limitations under the License.
*/
import React from 'react';
import { screen } from '@testing-library/react';
import {
TestApiProvider,
@@ -14,8 +14,6 @@
* limitations under the License.
*/
import React from 'react';
import { ItemCardGrid } from '@backstage/core-components';
import Grid from '@material-ui/core/Grid';
import Typography from '@material-ui/core/Typography';
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { FC } from 'react';
import {
DismissableBanner,
@@ -41,7 +41,7 @@ export interface PodLogsProps {
*
* @public
*/
export const PodLogs: React.FC<PodLogsProps> = ({
export const PodLogs: FC<PodLogsProps> = ({
containerScope,
previous,
}: PodLogsProps) => {
@@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import SubjectIcon from '@material-ui/icons/Subject';
import { KubernetesDialog } from '../../KubernetesDialog';
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import React from 'react';
import { screen } from '@testing-library/react';
import * as pod from './__fixtures__/pod.json';
import * as crashingPod from './__fixtures__/crashing-pod.json';
+2 -2
View File
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React, { useContext } from 'react';
import { ReactNode, useContext } from 'react';
import { PodDrawer } from './PodDrawer';
import {
containersReady,
@@ -60,7 +60,7 @@ export type PodColumns = 'READY' | 'RESOURCE';
export type PodsTablesProps = {
pods: Pod | V1Pod[];
extraColumns?: PodColumns[];
children?: React.ReactNode;
children?: ReactNode;
};
const READY: TableColumn<Pod>[] = [
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import React from 'react';
import { screen } from '@testing-library/react';
import { ResourceUtilization } from './ResourceUtilization';
import { renderInTestApp } from '@backstage/test-utils';
@@ -16,7 +16,6 @@
import Grid from '@material-ui/core/Grid';
import Typography from '@material-ui/core/Typography';
import React from 'react';
import { GaugePropsGetColor, LinearGauge } from '@backstage/core-components';
import { currentToDeclaredResourceToPerc } from '../../utils/resources';
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import React from 'react';
import { screen } from '@testing-library/react';
import * as services from './__fixtures__/2-services.json';
import {
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import React from 'react';
import { V1Service } from '@kubernetes/client-node';
import { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';
import Typography from '@material-ui/core/Typography';
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import React from 'react';
import { screen } from '@testing-library/react';
import * as twoDeployFixture from './__fixtures__/2-services.json';
import { renderInTestApp } from '@backstage/test-utils';
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React, { useContext } from 'react';
import { useContext } from 'react';
import Accordion from '@material-ui/core/Accordion';
import AccordionDetails from '@material-ui/core/AccordionDetails';
import AccordionSummary from '@material-ui/core/AccordionSummary';
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import React from 'react';
import * as statefulsets from '../../__fixtures__/2-statefulsets.json';
import {
renderInTestApp,
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React from 'react';
import { ReactNode } from 'react';
import { V1StatefulSet } from '@kubernetes/client-node';
import { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';
import { renderCondition } from '../../utils/pod';
@@ -41,7 +41,7 @@ export const StatefulSetDrawer = ({
.reduce((accum, next) => {
accum[next[0]] = next[1];
return accum;
}, {} as { [key: string]: React.ReactNode });
}, {} as { [key: string]: ReactNode });
return {
updateStrategy: statefulset.spec?.updateStrategy ?? '???',
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import React from 'react';
import { screen } from '@testing-library/react';
import { StatefulSetsAccordions } from './StatefulSetsAccordions';
import * as twoStatefulSetsFixture from '../../__fixtures__/2-statefulsets.json';
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React, { useContext } from 'react';
import { ReactNode, useContext } from 'react';
import Accordion from '@material-ui/core/Accordion';
import AccordionDetails from '@material-ui/core/AccordionDetails';
import AccordionSummary from '@material-ui/core/AccordionSummary';
@@ -38,14 +38,14 @@ import { StatusError, StatusOK } from '@backstage/core-components';
import { READY_COLUMNS, RESOURCE_COLUMNS } from '../Pods/PodsTable';
type StatefulSetsAccordionsProps = {
children?: React.ReactNode;
children?: ReactNode;
};
type StatefulSetAccordionProps = {
statefulset: V1StatefulSet;
ownedPods: V1Pod[];
matchingHpa?: V2HorizontalPodAutoscaler;
children?: React.ReactNode;
children?: ReactNode;
};
type StatefulSetSummaryProps = {
@@ -53,7 +53,7 @@ type StatefulSetSummaryProps = {
numberOfCurrentPods: number;
numberOfPodsWithErrors: number;
hpa?: V2HorizontalPodAutoscaler;
children?: React.ReactNode;
children?: ReactNode;
};
const StatefulSetSummary = ({
@@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { createContext } from 'react';
import { ClusterAttributes } from '@backstage/plugin-kubernetes-common';
/**
* @public
*/
export const ClusterContext = React.createContext<ClusterAttributes>({
export const ClusterContext = createContext<ClusterAttributes>({
name: '',
});
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { createContext } from 'react';
import { GroupedResponses } from '@backstage/plugin-kubernetes-common';
/**
@@ -21,7 +21,7 @@ import { GroupedResponses } from '@backstage/plugin-kubernetes-common';
*
* @public
*/
export const GroupedResponsesContext = React.createContext<GroupedResponses>({
export const GroupedResponsesContext = createContext<GroupedResponses>({
pods: [],
replicaSets: [],
deployments: [],
@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { createContext } from 'react';
/**
* @public
*/
export const PodNamesWithErrorsContext = React.createContext<Set<string>>(
export const PodNamesWithErrorsContext = createContext<Set<string>>(
new Set<string>(),
);
@@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { createContext } from 'react';
import { ClientPodStatus } from '@backstage/plugin-kubernetes-common';
/**
* @public
*/
export const PodNamesWithMetricsContext = React.createContext<
export const PodNamesWithMetricsContext = createContext<
Map<string, ClientPodStatus>
>(new Map<string, ClientPodStatus>());
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React from 'react';
import { ReactNode } from 'react';
import { GroupedResponsesContext } from './GroupedResponses';
import { PodNamesWithErrorsContext } from './PodNamesWithErrors';
import {
@@ -33,7 +33,7 @@ export const kubernetesProviders = (
>(),
cluster: ClusterAttributes = { name: 'some-cluster' },
) => {
return (node: React.ReactNode) => (
return (node: ReactNode) => (
<ClusterContext.Provider value={cluster}>
<GroupedResponsesContext.Provider value={groupedResponses}>
<PodMetricsContext.Provider value={podNameToMetrics}>
@@ -18,7 +18,6 @@ import { configApiRef } from '@backstage/core-plugin-api';
import { TestApiProvider } from '@backstage/test-utils';
import { renderHook } from '@testing-library/react';
import { PropsWithChildren } from 'react';
import React from 'react';
import { useIsPodDeleteEnabled } from './useIsPodDeleteEnabled';
@@ -18,7 +18,6 @@ import { configApiRef } from '@backstage/core-plugin-api';
import { TestApiProvider } from '@backstage/test-utils';
import { renderHook } from '@testing-library/react';
import { PropsWithChildren } from 'react';
import React from 'react';
import { useIsPodExecTerminalEnabled } from './useIsPodExecTerminalEnabled';
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { ReactNode } from 'react';
import { renderHook } from '@testing-library/react';
import { DetectedErrorsContext, useMatchingErrors } from './useMatchingErrors';
import {
@@ -40,7 +40,7 @@ const genericErrorWithRef = (resourceRef: ResourceRef): DetectedError => {
describe('useMatchingErrors', () => {
it('should filter non-matching resources', () => {
const wrapper = ({ children }: { children: React.ReactNode }) => (
const wrapper = ({ children }: { children: ReactNode }) => (
<DetectedErrorsContext.Provider
value={[
genericErrorWithRef({
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { useContext } from 'react';
import { createContext, useContext } from 'react';
import {
DetectedError,
ResourceRef,
@@ -26,7 +26,7 @@ import { IIoK8sApimachineryPkgApisMetaV1ObjectMeta as V1ObjectMeta } from '@kube
*
* @public
*/
export const DetectedErrorsContext = React.createContext<DetectedError[]>([]);
export const DetectedErrorsContext = createContext<DetectedError[]>([]);
/**
*
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { ReactNode } from 'react';
import { renderHook } from '@testing-library/react';
import { PodMetricsContext, usePodMetrics } from './usePodMetrics';
import { ClientPodStatus } from '@backstage/plugin-kubernetes-common';
@@ -45,7 +45,7 @@ describe('usePodMetrics', () => {
const metrics = new Map<string, ClientPodStatus[]>();
metrics.set('cluster', [clientPodStatus]);
metrics.set('other-cluster', [otherClientPodStatus]);
const wrapper = ({ children }: { children: React.ReactNode }) => (
const wrapper = ({ children }: { children: ReactNode }) => (
<PodMetricsContext.Provider value={metrics}>
{children}
</PodMetricsContext.Provider>
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { useContext } from 'react';
import { createContext, useContext } from 'react';
import { IObjectMeta } from '@kubernetes-models/apimachinery/apis/meta/v1/ObjectMeta';
import { ClientPodStatus } from '@backstage/plugin-kubernetes-common';
@@ -22,9 +22,9 @@ import { ClientPodStatus } from '@backstage/plugin-kubernetes-common';
*
* @public
*/
export const PodMetricsContext = React.createContext<
Map<string, ClientPodStatus[]>
>(new Map());
export const PodMetricsContext = createContext<Map<string, ClientPodStatus[]>>(
new Map(),
);
/**
* @public
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import React from 'react';
import {
currentToDeclaredResourceToPerc,
podStatusToCpuUtil,
+2 -2
View File
@@ -19,7 +19,7 @@ import {
V1PodCondition,
V1DeploymentCondition,
} from '@kubernetes/client-node';
import React, { Fragment, ReactNode } from 'react';
import { Fragment, ReactNode } from 'react';
import Chip from '@material-ui/core/Chip';
import {
StatusAborted,
@@ -87,7 +87,7 @@ export const containerStatuses = (pod: Pod): ReactNode => {
}
return accum;
}, [] as React.ReactNode[]);
}, [] as ReactNode[]);
if (errors.length === 0) {
return <StatusOK>OK</StatusOK>;