chore(deps): bump topology to BS v1.38.1 (#3877)

Signed-off-by: logonoff <git@logonoff.co>
This commit is contained in:
logonoff 2025-04-30 16:50:27 -04:00 committed by GitHub
parent e53d4bac78
commit e35ad72924
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
105 changed files with 1587 additions and 1566 deletions

View File

@ -0,0 +1,5 @@
---
'@backstage-community/plugin-topology': minor
---
Backstage version bump to v1.38.1

View File

@ -6,7 +6,7 @@ To start the app, run:
```sh
yarn install
yarn dev
yarn start
```
To generate knip reports for this app, run:

View File

@ -1,3 +1,3 @@
{
"version": "1.36.0"
"version": "1.38.1"
}

View File

@ -8,7 +8,7 @@
"scripts": {
"tsc": "tsc",
"tsc:full": "tsc --skipLibCheck true --incremental false",
"dev": "yarn workspaces foreach -A --include backend --include app --parallel -v -i run start",
"start": "backstage-cli repo start",
"build:all": "backstage-cli repo build --all",
"build:api-reports": "yarn build:api-reports:only",
"build:api-reports:only": "backstage-repo-tools api-reports -o ae-wrong-input-file-type,ae-undocumented --validate-release-tags",
@ -34,9 +34,9 @@
"directory": "workspaces/topology"
},
"devDependencies": {
"@backstage/cli": "^0.30.0",
"@backstage/cli": "^0.32.0",
"@backstage/e2e-test-utils": "^0.1.1",
"@backstage/repo-tools": "^0.13.0",
"@backstage/repo-tools": "^0.13.2",
"@changesets/cli": "^2.27.1",
"knip": "^5.27.4",
"node-gyp": "^9.0.0",

View File

@ -20,30 +20,30 @@
},
"dependencies": {
"@backstage-community/plugin-topology": "workspace:^",
"@backstage/app-defaults": "^1.5.17",
"@backstage/app-defaults": "^1.6.1",
"@backstage/catalog-model": "^1.7.3",
"@backstage/cli": "^0.30.0",
"@backstage/core-app-api": "^1.15.5",
"@backstage/core-components": "^0.16.4",
"@backstage/core-plugin-api": "^1.10.4",
"@backstage/integration-react": "^1.2.4",
"@backstage/plugin-api-docs": "^0.12.4",
"@backstage/plugin-catalog": "^1.27.0",
"@backstage/cli": "^0.32.0",
"@backstage/core-app-api": "^1.16.1",
"@backstage/core-components": "^0.17.1",
"@backstage/core-plugin-api": "^1.10.6",
"@backstage/integration-react": "^1.2.6",
"@backstage/plugin-api-docs": "^0.12.6",
"@backstage/plugin-catalog": "^1.29.0",
"@backstage/plugin-catalog-common": "^1.1.3",
"@backstage/plugin-catalog-graph": "^0.4.16",
"@backstage/plugin-catalog-import": "^0.12.10",
"@backstage/plugin-catalog-react": "^1.15.2",
"@backstage/plugin-kubernetes": "^0.12.4",
"@backstage/plugin-org": "^0.6.36",
"@backstage/plugin-permission-react": "^0.4.31",
"@backstage/plugin-scaffolder": "^1.28.0",
"@backstage/plugin-search": "^1.4.23",
"@backstage/plugin-search-react": "^1.8.6",
"@backstage/plugin-techdocs": "^1.12.3",
"@backstage/plugin-techdocs-module-addons-contrib": "^1.1.21",
"@backstage/plugin-techdocs-react": "^1.2.14",
"@backstage/plugin-user-settings": "^0.8.19",
"@backstage/theme": "^0.6.4",
"@backstage/plugin-catalog-graph": "^0.4.18",
"@backstage/plugin-catalog-import": "^0.12.13",
"@backstage/plugin-catalog-react": "^1.17.0",
"@backstage/plugin-kubernetes": "^0.12.6",
"@backstage/plugin-org": "^0.6.38",
"@backstage/plugin-permission-react": "^0.4.33",
"@backstage/plugin-scaffolder": "^1.30.1",
"@backstage/plugin-search": "^1.4.25",
"@backstage/plugin-search-react": "^1.8.8",
"@backstage/plugin-techdocs": "^1.12.5",
"@backstage/plugin-techdocs-module-addons-contrib": "^1.1.23",
"@backstage/plugin-techdocs-react": "^1.2.16",
"@backstage/plugin-user-settings": "^0.8.21",
"@backstage/theme": "^0.6.5",
"@mui/icons-material": "5.16.14",
"@mui/lab": "5.0.0-alpha.175",
"@mui/material": "5.16.14",
@ -56,11 +56,11 @@
"react-use": "^17.2.4"
},
"devDependencies": {
"@backstage/test-utils": "^1.7.5",
"@backstage/test-utils": "^1.7.7",
"@playwright/test": "^1.32.3",
"@testing-library/dom": "^9.0.0",
"@testing-library/dom": "^10.0.0",
"@testing-library/jest-dom": "^6.0.0",
"@testing-library/react": "^14.0.0",
"@testing-library/react": "^16.0.0",
"@testing-library/user-event": "^14.0.0",
"@types/react-dom": "*",
"cross-env": "^7.0.0"

View File

@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { render, waitFor } from '@testing-library/react';
import App from './App';

View File

@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { Navigate, Route } from 'react-router-dom';
import { apiDocsPlugin, ApiExplorerPage } from '@backstage/plugin-api-docs';
import {

View File

@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { makeStyles } from '@mui/styles';
const useStyles = makeStyles({

View File

@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { makeStyles } from '@mui/styles';
const useStyles = makeStyles({

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { PropsWithChildren } from 'react';
import { PropsWithChildren } from 'react';
import { makeStyles } from '@mui/styles';
import HomeIcon from '@mui/icons-material/Home';
import ExtensionIcon from '@mui/icons-material/Extension';

View File

@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import Button from '@mui/material/Button';
import Grid from '@mui/material/Grid';
@ -96,7 +95,6 @@ const cicdContent = (
<EntityGithubActionsContent />
</EntitySwitch.Case>
*/}
<EntitySwitch.Case>
<EmptyState
title="No CI/CD available for this entity"

View File

@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { Theme } from '@mui/material/styles';
import Paper from '@mui/material/Paper';
import Grid from '@mui/material/Grid';

View File

@ -14,7 +14,6 @@
* limitations under the License.
*/
import '@backstage/cli/asset-types';
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';

View File

@ -21,29 +21,29 @@
"build-image": "docker build ../.. -f Dockerfile --tag backstage"
},
"dependencies": {
"@backstage/backend-defaults": "^0.8.0",
"@backstage/backend-defaults": "^0.9.0",
"@backstage/config": "^1.3.2",
"@backstage/plugin-app-backend": "^0.4.5",
"@backstage/plugin-auth-backend": "^0.24.3",
"@backstage/plugin-auth-backend-module-github-provider": "^0.3.0",
"@backstage/plugin-auth-backend-module-guest-provider": "^0.2.5",
"@backstage/plugin-auth-node": "^0.6.0",
"@backstage/plugin-catalog-backend": "^1.31.0",
"@backstage/plugin-catalog-backend-module-logs": "^0.1.7",
"@backstage/plugin-catalog-backend-module-scaffolder-entity-model": "^0.2.5",
"@backstage/plugin-kubernetes-backend": "^0.19.3",
"@backstage/plugin-permission-backend": "^0.5.54",
"@backstage/plugin-permission-backend-module-allow-all-policy": "^0.2.5",
"@backstage/plugin-app-backend": "^0.5.1",
"@backstage/plugin-auth-backend": "^0.24.5",
"@backstage/plugin-auth-backend-module-github-provider": "^0.3.2",
"@backstage/plugin-auth-backend-module-guest-provider": "^0.2.7",
"@backstage/plugin-auth-node": "^0.6.2",
"@backstage/plugin-catalog-backend": "^1.32.1",
"@backstage/plugin-catalog-backend-module-logs": "^0.1.9",
"@backstage/plugin-catalog-backend-module-scaffolder-entity-model": "^0.2.7",
"@backstage/plugin-kubernetes-backend": "^0.19.5",
"@backstage/plugin-permission-backend": "^0.6.0",
"@backstage/plugin-permission-backend-module-allow-all-policy": "^0.2.7",
"@backstage/plugin-permission-common": "^0.8.4",
"@backstage/plugin-permission-node": "^0.8.8",
"@backstage/plugin-proxy-backend": "^0.5.11",
"@backstage/plugin-scaffolder-backend": "^1.30.0",
"@backstage/plugin-search-backend": "^1.8.2",
"@backstage/plugin-search-backend-module-catalog": "^0.3.1",
"@backstage/plugin-search-backend-module-pg": "^0.5.41",
"@backstage/plugin-search-backend-module-techdocs": "^0.3.6",
"@backstage/plugin-search-backend-node": "^1.3.8",
"@backstage/plugin-techdocs-backend": "^1.11.6",
"@backstage/plugin-permission-node": "^0.9.1",
"@backstage/plugin-proxy-backend": "^0.6.1",
"@backstage/plugin-scaffolder-backend": "^1.32.1",
"@backstage/plugin-search-backend": "^2.0.1",
"@backstage/plugin-search-backend-module-catalog": "^0.3.3",
"@backstage/plugin-search-backend-module-pg": "^0.5.43",
"@backstage/plugin-search-backend-module-techdocs": "^0.4.1",
"@backstage/plugin-search-backend-node": "^1.3.10",
"@backstage/plugin-techdocs-backend": "^2.0.1",
"app": "link:../app",
"better-sqlite3": "^9.0.0",
"node-gyp": "^10.0.0",
@ -51,7 +51,7 @@
"winston": "^3.2.1"
},
"devDependencies": {
"@backstage/cli": "^0.30.0",
"@backstage/cli": "^0.32.0",
"@types/express": "^4.17.6",
"@types/express-serve-static-core": "^4.17.5",
"@types/luxon": "^2.0.4"

View File

@ -32,7 +32,7 @@ export default defineConfig({
? []
: [
{
command: 'yarn dev',
command: 'yarn start',
port: 3000,
reuseExistingServer: true,
timeout: 60_000,

View File

@ -15,7 +15,7 @@ Then, to start the Backstage development session, you need to run the following
```console
cd workspaces/topology
yarn install
yarn dev
yarn start
```
You will notice that when running the Backstage development session with mock data, the Topology tab will not show any data. To view live data from a Kubernetes cluster using the toplology plugin, you will need to [add annotations to your Kubernetes resources](./README.md#Entity%20annotation%2Flabel). Once added, you should be able to see the data in the Topology tab.

View File

@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { Entity } from '@backstage/catalog-model';
import { createDevApp } from '@backstage/dev-utils';
import { Page, Header, TabbedLayout } from '@backstage/core-components';

View File

@ -11,7 +11,7 @@
},
"backstage": {
"role": "frontend-plugin",
"supported-versions": "1.36.0",
"supported-versions": "1.38.0",
"pluginId": "topology",
"pluginPackages": [
"@backstage-community/plugin-topology"
@ -34,16 +34,16 @@
},
"dependencies": {
"@backstage/catalog-model": "^1.7.3",
"@backstage/core-components": "^0.16.4",
"@backstage/core-plugin-api": "^1.10.4",
"@backstage/plugin-catalog-react": "^1.15.2",
"@backstage/plugin-kubernetes-common": "^0.9.3",
"@backstage/plugin-kubernetes-react": "^0.5.4",
"@backstage/core-components": "^0.17.1",
"@backstage/core-plugin-api": "^1.10.6",
"@backstage/plugin-catalog-react": "^1.17.0",
"@backstage/plugin-kubernetes-common": "^0.9.4",
"@backstage/plugin-kubernetes-react": "^0.5.6",
"@backstage/plugin-permission-common": "^0.8.4",
"@backstage/plugin-permission-react": "^0.4.31",
"@backstage/theme": "^0.6.4",
"@janus-idp/shared-react": "^2.16.0",
"@kubernetes/client-node": "1.0.0-rc7",
"@backstage/plugin-permission-react": "^0.4.33",
"@backstage/theme": "^0.6.5",
"@janus-idp/shared-react": "^2.18.0",
"@kubernetes/client-node": "1.1.2",
"@mui/icons-material": "5.16.14",
"@mui/lab": "5.0.0-alpha.175",
"@mui/material": "^5.15.17",
@ -68,15 +68,16 @@
"react-router-dom": "^6.0.0"
},
"devDependencies": {
"@backstage/cli": "^0.30.0",
"@backstage/core-app-api": "^1.15.5",
"@backstage/dev-utils": "^1.1.7",
"@backstage/test-utils": "^1.7.5",
"@redhat-developer/red-hat-developer-hub-theme": "0.4.0",
"@testing-library/jest-dom": "6.6.3",
"@testing-library/react": "14.3.1",
"@backstage/cli": "^0.32.0",
"@backstage/core-app-api": "^1.16.1",
"@backstage/dev-utils": "^1.1.9",
"@backstage/test-utils": "^1.7.7",
"@redhat-developer/red-hat-developer-hub-theme": "0.5.1",
"@testing-library/dom": "^10.0.0",
"@testing-library/jest-dom": "^6.0.0",
"@testing-library/react": "^16.0.0",
"@testing-library/react-hooks": "8.0.1",
"@testing-library/user-event": "14.6.1",
"@testing-library/user-event": "^14.0.0",
"@types/git-url-parse": "9.0.3",
"@types/react": "^18.3.11",
"cross-fetch": "4.0.0",

View File

@ -3,10 +3,8 @@
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
/// <reference types="react" />
import { BackstagePlugin } from '@backstage/core-plugin-api';
import { JSX as JSX_2 } from 'react';
import { JSX as JSX_2 } from 'react/jsx-runtime';
import { RouteRef } from '@backstage/core-plugin-api';
// @public (undocumented)

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import type { ReactNode } from 'react';
import classNames from 'classnames';
@ -63,7 +63,7 @@ export const ResourceIcon = ({ className, kind }: ResourceIconProps) => {
export type ResourceNameProps = {
kind: string;
name: React.ReactNode;
name: ReactNode;
large?: boolean;
};

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import type { PropsWithChildren } from 'react';
import { Badge } from '@patternfly/react-core';
import classNames from 'classnames';
@ -45,7 +45,7 @@ const ResourceStatus = ({
badgeAlt,
children,
noStatusBackground,
}: React.PropsWithChildren<ResourceStatusProps>) => {
}: PropsWithChildren<ResourceStatusProps>) => {
return (
<span
className={classNames(

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import type { ReactNode, PropsWithChildren, Ref, LegacyRef } from 'react';
import {
BadgeLocation,
@ -41,7 +41,7 @@ type BaseNodeProps = {
innerRadius?: number;
icon?: string;
kind?: string;
labelIcon?: React.ReactNode;
labelIcon?: ReactNode;
labelIconPadding?: number;
badge?: string;
badgeColor?: string;
@ -49,7 +49,7 @@ type BaseNodeProps = {
badgeBorderColor?: string;
badgeClassName?: string;
badgeLocation?: BadgeLocation;
attachments?: React.ReactNode;
attachments?: ReactNode;
element: Node;
hoverRef?: (node: Element) => () => void;
dragging?: boolean;
@ -70,11 +70,11 @@ const BaseNode = ({
children,
alertVariant,
...rest
}: React.PropsWithChildren<BaseNodeProps>) => {
}: PropsWithChildren<BaseNodeProps>) => {
const [hover, internalHoverRef] = useHover();
const nodeHoverRefs = useCombineRefs(
internalHoverRef,
hoverRef as React.Ref<Element>,
hoverRef as Ref<Element>,
);
const { width, height } = element.getDimensions();
const cx = width / 2;
@ -96,7 +96,7 @@ const BaseNode = ({
return (
<Layer id={hover ? TOP_LAYER : DEFAULT_LAYER}>
<g
ref={nodeHoverRefs as React.LegacyRef<SVGGElement>}
ref={nodeHoverRefs as LegacyRef<SVGGElement>}
data-test-id={element.getLabel()}
>
<DefaultNode

View File

@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import {
Graph,
GraphComponent,

View File

@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import {
DefaultEdge,
GraphElement,

View File

@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import {
DefaultGroup,
GraphElement,

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import type { MouseEvent } from 'react';
import { makeStyles } from '@mui/styles';
import {
@ -52,7 +52,7 @@ const VmNode = ({
const { kind, osImage } = vmData;
const iconRadius = Math.min(width, height) * 0.25;
const onNodeSelect = (e: React.MouseEvent) => {
const onNodeSelect = (e: MouseEvent) => {
const params = new URLSearchParams(window.location.search);
params.set('selectedId', element.getId());
history.replaceState(null, '', `?${params.toString()}`);

View File

@ -13,7 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import type { MouseEvent } from 'react';
import { useContext } from 'react';
import {
GraphElement,
@ -87,7 +89,7 @@ const InnerWorkloadNode = observer(
const workloadData = data.data;
const donutStatus = workloadData.podsData;
const [hover, hoverRef] = useHover();
const { filters } = React.useContext(FilterContext);
const { filters } = useContext(FilterContext);
const size = Math.min(width, height);
const { radius, decoratorRadius } = calculateRadius(size);
const cx = width / 2;
@ -95,7 +97,7 @@ const InnerWorkloadNode = observer(
const controller = useVisualizationController();
const detailsLevel = controller.getGraph().getDetailsLevel();
const showDetails = hover || detailsLevel !== ScaleDetailsLevel.low;
const onNodeSelect = (e: React.MouseEvent) => {
const onNodeSelect = (e: MouseEvent) => {
const params = new URLSearchParams(window.location.search);
params.set('selectedId', element.getId());
history.replaceState(null, '', `?${params.toString()}`);

View File

@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { Link, MemoryRouter } from 'react-router-dom';
import { Decorator as PfDecorator } from '@patternfly/react-topology';

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import * as React from 'react';
import { Link } from 'react-router-dom';
import { Decorator as PfDecorator } from '@patternfly/react-topology';

View File

@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { Node } from '@patternfly/react-topology';
import { render } from '@testing-library/react';

View File

@ -13,7 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from 'react';
import type { FC } from 'react';
import { useRef } from 'react';
import { Tooltip, TooltipPosition } from '@patternfly/react-core';
import { Node } from '@patternfly/react-topology';
@ -32,7 +34,7 @@ interface DefaultDecoratorProps {
y: number;
}
const EditDecorator: React.FC<DefaultDecoratorProps> = ({
const EditDecorator: FC<DefaultDecoratorProps> = ({
element,
radius,
x,
@ -43,7 +45,7 @@ const EditDecorator: React.FC<DefaultDecoratorProps> = ({
const cheURL = getCheDecoratorData(cheCluster);
const cheEnabled = !!cheURL;
const editUrl = editURL || getEditURL(vcsURI, vcsRef, cheURL);
const decoratorRef = React.useRef<SVGGElement | null>(null);
const decoratorRef = useRef<SVGGElement | null>(null);
const repoIcon = (
<RouteDecoratorIcon
routeURL={editUrl}

View File

@ -13,18 +13,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from 'react';
import type { ComponentProps, ReactNode, FC } from 'react';
import Decorator from './Decorator';
type PipelineDecoratorBubbleProps = React.ComponentProps<typeof Decorator> & {
children: React.ReactNode;
type PipelineDecoratorBubbleProps = ComponentProps<typeof Decorator> & {
children: ReactNode;
radius: number;
x: number;
y: number;
};
const PipelineDecoratorBubble: React.FC<PipelineDecoratorBubbleProps> = ({
const PipelineDecoratorBubble: FC<PipelineDecoratorBubbleProps> = ({
children,
radius,
x,

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { useRef } from 'react';
import { Tooltip, TooltipPosition } from '@patternfly/react-core';
@ -39,7 +39,7 @@ export const PipelineRunDecorator = ({
x: number;
y: number;
}) => {
const decoratorRef = React.useRef<SVGGElement | null>(null);
const decoratorRef = useRef<SVGGElement | null>(null);
const latestPipelineRun = getLatestPipelineRun(
pipelinesData.pipelineRuns,

View File

@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from 'react';
import { random } from 'lodash';
import {

View File

@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { render, screen } from '@testing-library/react';
import { UrlDecorator } from './UrlDecorator';

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { useRef } from 'react';
import { Tooltip, TooltipPosition } from '@patternfly/react-core';
@ -28,7 +28,7 @@ interface DefaultDecoratorProps {
}
export const UrlDecorator = ({ url, radius, x, y }: DefaultDecoratorProps) => {
const decoratorRef = React.useRef<SVGGElement | null>(null);
const decoratorRef = useRef<SVGGElement | null>(null);
if (!url) {
return null;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from 'react';
import type { ReactElement, ReactNode } from 'react';
import {
Node,
@ -30,7 +30,7 @@ const getDecoratorForQuadrant = (
centerY: number,
nodeRadius: number,
decoratorRadius: number,
): React.ReactElement | null => {
): ReactElement | null => {
let x: number;
let y: number;
const deltaX = nodeRadius > 0 ? nodeRadius : 0;
@ -71,7 +71,7 @@ export const getNodeDecorators = (
centerY: number,
nodeRadius: number, // -1 to use width/height
decoratorRadius: number,
): React.ReactNode => {
): ReactNode => {
return (
<>
{decorators.map(decorator =>

View File

@ -13,15 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from 'react';
import type { CSSProperties, ReactElement } from 'react';
const BitbucketIcon = ({
style,
title,
}: {
style: React.CSSProperties;
style: CSSProperties;
title: string;
}): React.ReactElement => {
}): ReactElement => {
return (
<svg
height="1em"

View File

@ -13,13 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from 'react';
import type { CSSProperties, ReactElement } from 'react';
const CheIcon = ({
style,
}: {
style: React.CSSProperties;
}): React.ReactElement => {
const CheIcon = ({ style }: { style: CSSProperties }): ReactElement => {
return (
<svg
height="1em"

View File

@ -13,15 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from 'react';
import type { CSSProperties, ReactElement } from 'react';
const GitAltIcon = ({
style,
title,
}: {
style: React.CSSProperties;
style: CSSProperties;
title: string;
}): React.ReactElement => {
}): ReactElement => {
return (
<svg
height="1em"

View File

@ -13,15 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from 'react';
import type { CSSProperties, ReactElement } from 'react';
const GithubIcon = ({
style,
title,
}: {
style: React.CSSProperties;
style: CSSProperties;
title: string;
}): React.ReactElement => {
}): ReactElement => {
return (
<svg
height="1em"

View File

@ -13,15 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from 'react';
import type { CSSProperties, ReactElement } from 'react';
const GitlabIcon = ({
style,
title,
}: {
style: React.CSSProperties;
style: CSSProperties;
title: string;
}): React.ReactElement => {
}): ReactElement => {
return (
<svg
height="1em"

View File

@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from 'react';
import { detectGitType, GitProvider } from '../../utils/git-utils';
import BitbucketIcon from './BitbucketIcon';
import CheIcon from './CheIcon';

View File

@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from 'react';
import type { CSSProperties, ReactElement } from 'react';
const UrlDecoratorIcon = ({
style,
}: {
style: React.CSSProperties;
}): React.ReactElement => {
style: CSSProperties;
}): ReactElement => {
return (
<svg
height="1em"

View File

@ -13,17 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from 'react';
import type { CSSProperties, ReactElement } from 'react';
const VirtualMachineIcon = ({
style,
x,
y,
}: {
style: React.CSSProperties;
style: CSSProperties;
x: number;
y: number;
}): React.ReactElement => {
}): ReactElement => {
return (
<svg
viewBox="0 64 1170 1024"

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { memo } from 'react';
import { PodRCData } from '../../types/pods';
import { usePodRingLabel } from '../../utils/pod-ring-utils';
@ -76,7 +76,7 @@ export const podSetInnerRadius = (size: number, data?: PodRCData) => {
return radius - innerStrokeWidth - podStatusInset;
};
const PodSet = React.memo(function PodSet({
const PodSet = memo(function PodSet({
size,
data,
x = 0,

View File

@ -13,7 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import type { ReactElement } from 'react';
import { useState, useRef, useMemo, memo } from 'react';
import { ChartDonut } from '@patternfly/react-charts/victory';
import { Tooltip } from '@patternfly/react-core';
@ -48,9 +50,9 @@ interface PodStatusProps {
data: any[];
showTooltip?: boolean;
title?: string;
titleComponent?: React.ReactElement;
titleComponent?: ReactElement;
subTitle?: string;
subTitleComponent?: React.ReactElement;
subTitleComponent?: ReactElement;
}
const { podStatusInnerRadius, podStatusOuterRadius } = calculateRadius(130); // default value of size is 130
@ -78,12 +80,12 @@ const PodStatus = ({
subTitleComponent,
data,
}: PodStatusProps) => {
const [updateOnEnd, setUpdateOnEnd] = React.useState<boolean>(false);
const [updateOnEnd, setUpdateOnEnd] = useState<boolean>(false);
const forceUpdate = useForceUpdate();
const prevVData = React.useRef<PodData[] | null>(null);
const chartTriggerRef = React.useRef<SVGGElement | null>(null);
const prevVData = useRef<PodData[] | null>(null);
const chartTriggerRef = useRef<SVGGElement | null>(null);
const vData = React.useMemo(() => {
const vData = useMemo(() => {
const updateVData: PodData[] = podStatus.map((pod: any) => ({
x: pod,
y: _.sumBy(data, (d: any) => +(getPodStatus(d) === pod)) || 0,
@ -118,7 +120,7 @@ const PodStatus = ({
const truncSubTitle = subTitle
? _.truncate(subTitle, { length: MAX_POD_TITLE_LENGTH })
: undefined;
const chartDonut = React.useMemo(() => {
const chartDonut = useMemo(() => {
return (
<ChartDonut
ariaTitle={`${title}${subTitle && ` ${subTitle}`}`}
@ -204,4 +206,4 @@ const PodStatus = ({
return chartDonut;
};
export default React.memo((props: PodStatusProps) => <PodStatus {...props} />);
export default memo((props: PodStatusProps) => <PodStatus {...props} />);

View File

@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { useTheme } from '@mui/material/styles';
import { render } from '@testing-library/react';

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { useLayoutEffect } from 'react';
import { useTheme } from '@mui/material/styles';
@ -42,7 +42,7 @@ export const TopologyComponent = () => {
const {
palette: { mode },
} = useTheme();
React.useLayoutEffect(() => {
useLayoutEffect(() => {
const htmlTagElement = document.documentElement;
const scalprumStyles = Array.from(

View File

@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import {
action,
Controller,

View File

@ -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 { TopologyEmptyState } from './TopologyEmptyState';

View File

@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import TopologyIcon from '@mui/icons-material/HubOutlined';
import {
EmptyState,

View File

@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { WarningPanel } from '@backstage/core-components';
import { useEntity } from '@backstage/plugin-catalog-react';

View File

@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { PipelineRunKind } from '@janus-idp/shared-react';
import { fromNow } from '../../../common/utils/datetime';

View File

@ -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 { mockTektonResources } from '../../../__fixtures__/1-tektonResources';

View File

@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import {
PipelineKind,
PipelineRunKind,

View File

@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { fireEvent, render, within } from '@testing-library/react';
import { mockKubernetesResponse } from '../../../../__fixtures__/1-deployments';

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import type { ReactNode } from 'react';
import { V1Container } from '@kubernetes/client-node';
import MenuItem from '@mui/material/MenuItem';
@ -24,7 +24,7 @@ import ResourceName from '../../../../common/components/ResourceName';
type ContainerSelectorType = {
containersList: V1Container[];
containerSelected: string;
onContainerChange: (event: SelectChangeEvent, child: React.ReactNode) => void;
onContainerChange: (event: SelectChangeEvent, child: ReactNode) => void;
};
export const ContainerSelector = ({

View File

@ -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 { usePodLogs } from '../../../../hooks/usePodLogs';

View File

@ -13,7 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import type { SetStateAction, Dispatch } from 'react';
import { useEffect } from 'react';
import { DismissableBanner, LogViewer } from '@backstage/core-components';
@ -25,7 +27,7 @@ import { ContainerScope } from './types';
type PodLogsProps = {
podScope: ContainerScope;
setLogText: React.Dispatch<React.SetStateAction<string>>;
setLogText: Dispatch<SetStateAction<string>>;
stopPolling: boolean;
};
@ -39,7 +41,7 @@ export const PodLogs = ({
stopPolling,
});
React.useEffect(() => {
useEffect(() => {
if (!loading && value !== undefined) setLogText(value.text);
}, [loading, setLogText, value]);

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { useContext } from 'react';
import { useContext } from 'react';
import { V1Pod } from '@kubernetes/client-node';
import { fireEvent, render } from '@testing-library/react';

View File

@ -13,7 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { useState } from 'react';
import { useState } from 'react';
import * as React from 'react';
import { ErrorBoundary } from '@backstage/core-components';
import { RequirePermission } from '@backstage/plugin-permission-react';

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import type { PropsWithChildren } from 'react';
import { fireEvent, render, screen } from '@testing-library/react';
@ -23,7 +23,7 @@ import PodLogsDownload from './PodLogsDownload';
jest.mock('@mui/material', () => ({
...jest.requireActual('@mui/material'),
IconButton: ({ children, ...rest }: React.PropsWithChildren<any>) => (
IconButton: ({ children, ...rest }: PropsWithChildren<any>) => (
<button {...rest}>{children}</button>
),
}));

View File

@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import IconButton from '@mui/material/IconButton';
import DownloadIcon from '@mui/icons-material/GetApp';

View File

@ -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 { workloadNodeData } from '../../../../__fixtures__/workloadNodeData';

View File

@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import ResourceName from '../../../../common/components/ResourceName';
import { IngressModel } from '../../../../models';
import { IngressData } from '../../../../types/ingresses';

View File

@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { CodeSnippet } from '@backstage/core-components';
import { V1Ingress } from '@kubernetes/client-node';

View File

@ -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 { workloadNodeData } from '../../../../__fixtures__/workloadNodeData';

View File

@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import ResourceName from '../../../../common/components/ResourceName';
import { RouteModel } from '../../../../models';
import { RouteData } from '../../../../types/route';

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from 'react';
import type { FC } from 'react';
import { V1CronJob } from '@kubernetes/client-node';
import { Timestamp, TimestampFormat } from '@patternfly/react-core';
@ -21,9 +21,7 @@ import { Timestamp, TimestampFormat } from '@patternfly/react-core';
import TopologySideBarDetailsItem from './TopologySideBarDetailsItem';
import TopologyWorkloadDetails from './TopologyWorkloadDetails';
const TopologyCronJobDetails: React.FC<{ resource: V1CronJob }> = ({
resource,
}) => {
const TopologyCronJobDetails: FC<{ resource: V1CronJob }> = ({ resource }) => {
return (
<TopologyWorkloadDetails resource={resource}>
<TopologySideBarDetailsItem label="Schedule">

View File

@ -13,14 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from 'react';
import type { FC } from 'react';
import { V1DaemonSet } from '@kubernetes/client-node';
import TopologySideBarDetailsItem from './TopologySideBarDetailsItem';
import TopologyWorkloadDetails from './TopologyWorkloadDetails';
const TopologyDaemonSetDetails: React.FC<{ resource: V1DaemonSet }> = ({
const TopologyDaemonSetDetails: FC<{ resource: V1DaemonSet }> = ({
resource,
}) => {
return (

View File

@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { V1Deployment } from '@kubernetes/client-node';
import TopologySideBarDetailsItem from './TopologySideBarDetailsItem';

View File

@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { BaseNode } from '@patternfly/react-topology';
import { render } from '@testing-library/react';

View File

@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from 'react';
import {
V1CronJob,
V1DaemonSet,

View File

@ -13,14 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from 'react';
import type { FC } from 'react';
import { V1Job } from '@kubernetes/client-node';
import TopologySideBarDetailsItem from './TopologySideBarDetailsItem';
import TopologyWorkloadDetails from './TopologyWorkloadDetails';
const TopologyJobDetails: React.FC<{ resource: V1Job }> = ({ resource }) => {
const TopologyJobDetails: FC<{ resource: V1Job }> = ({ resource }) => {
return (
<TopologyWorkloadDetails resource={resource}>
<TopologySideBarDetailsItem label="Desired completions">

View File

@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { Label } from '@patternfly/react-core';
import './TopologyResourceLabels.css';

View File

@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { BaseNode } from '@patternfly/react-topology';
import { render } from '@testing-library/react';

View File

@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { V1Pod, V1Service, V1ServicePort } from '@kubernetes/client-node';
import ArrowRightAltIcon from '@mui/icons-material/ArrowRightAlt';
import { ChartLabel } from '@patternfly/react-charts/victory';

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import type { PropsWithChildren } from 'react';
import './TopologyResourcesTabPanelItem.css';
@ -28,7 +28,7 @@ const TopologyResourcesTabPanelItem = ({
children,
dataTest,
showResCount,
}: React.PropsWithChildren<TopologyResourcesTabPanelItemProps>) => {
}: PropsWithChildren<TopologyResourcesTabPanelItemProps>) => {
const emptyState = (
<span className="bs-topology-text-muted">{`No ${resourceLabel} found for this resource.`}</span>
);

View File

@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import {
BaseNode,
TopologySideBar as PFTopologySideBar,

View File

@ -13,7 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import type { PropsWithChildren, ChangeEvent } from 'react';
import { useState } from 'react';
import Divider from '@mui/material/Divider';
import Tab from '@mui/material/Tab';
@ -30,7 +32,7 @@ interface TabPanelProps {
value: number;
}
const TabPanel = (props: React.PropsWithChildren<TabPanelProps>) => {
const TabPanel = (props: PropsWithChildren<TabPanelProps>) => {
const { children, value, index } = props;
return (
@ -45,8 +47,8 @@ const TabPanel = (props: React.PropsWithChildren<TabPanelProps>) => {
type TopologySideBarBodyProps = { node: BaseNode };
const TopologySideBarBody = ({ node }: TopologySideBarBodyProps) => {
const [value, setValue] = React.useState(0);
const handleChange = (_event: React.ChangeEvent<{}>, newValue: number) => {
const [value, setValue] = useState(0);
const handleChange = (_event: ChangeEvent<{}>, newValue: number) => {
setValue(newValue);
};

View File

@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import Divider from '@mui/material/Divider';
import { BaseNode } from '@patternfly/react-topology';

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import type { PropsWithChildren } from 'react';
import './TopologySideBarDetailsItem.css';
@ -26,7 +26,7 @@ const TopologySideBarDetailsItem = ({
label,
children,
emptyText,
}: React.PropsWithChildren<TopologySideBarDetailsItemProps>) => {
}: PropsWithChildren<TopologySideBarDetailsItemProps>) => {
return (
<div className="topology-side-bar-details-item">
<dt>{label}</dt>

View File

@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import Typography from '@mui/material/Typography';
import { Split, SplitItem, Stack, StackItem } from '@patternfly/react-core';

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { useContext } from 'react';
import { Status } from '@janus-idp/shared-react';
@ -50,7 +50,7 @@ type TopologyVirtualMachineDetailsProps = {
const TopologyVirtualMachineDetails = ({
vm,
}: TopologyVirtualMachineDetailsProps) => {
const resources = React.useContext(K8sResourcesContext);
const resources = useContext(K8sResourcesContext);
const allPods = resources?.watchResourcesData?.pods?.data?.filter(isV1Pod);
const allVMIs =
resources?.watchResourcesData?.virtualmachineinstances?.data?.filter(

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from 'react';
import type { PropsWithChildren } from 'react';
import { V1OwnerReference } from '@kubernetes/client-node';
import { Timestamp, TimestampFormat } from '@patternfly/react-core';
@ -25,7 +25,7 @@ import TopologySideBarDetailsItem from './TopologySideBarDetailsItem';
const TopologyWorkloadDetails = ({
resource,
children,
}: React.PropsWithChildren<{ resource: K8sWorkloadResource }>) => {
}: PropsWithChildren<{ resource: K8sWorkloadResource }>) => {
return (
<dl style={{ maxWidth: '100%' }}>
<TopologySideBarDetailsItem label="Name">

View File

@ -13,7 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import type { MouseEvent, Ref } from 'react';
import { useContext, useState } from 'react';
import { LabelGroup, ToolbarItem, Label } from '@patternfly/react-core';
import {
@ -33,20 +35,19 @@ type TopologyToolbarProps = {
const TopologyToolbar = ({ showFilters }: TopologyToolbarProps) => {
const { clusters: k8sClusters, setSelectedCluster: setClusterContext } =
React.useContext(K8sResourcesContext);
useContext(K8sResourcesContext);
const { filters, setAppliedTopologyFilters } =
React.useContext(FilterContext);
const { filters, setAppliedTopologyFilters } = useContext(FilterContext);
const clusterOptions = k8sClusters.map(cluster => ({
value: cluster,
disabled: false,
}));
const [clusterFilterIsExpanded, setClusterFilterIsExpanded] =
React.useState<boolean>(false);
useState<boolean>(false);
const [displayOptionsIsExpanded, setDisplayOptionsIsExpanded] =
React.useState<boolean>(false);
useState<boolean>(false);
const [clusterSelected, setClusterSelected] = React.useState<
const [clusterSelected, setClusterSelected] = useState<
string | number | undefined
>();
@ -59,7 +60,7 @@ const TopologyToolbar = ({ showFilters }: TopologyToolbarProps) => {
};
const onClusterChange = (
_e: React.MouseEvent | undefined,
_e: MouseEvent | undefined,
selection: string | number | undefined,
) => {
const index = k8sClusters.findIndex(cluster => cluster === selection);
@ -69,7 +70,7 @@ const TopologyToolbar = ({ showFilters }: TopologyToolbarProps) => {
};
const onDisplayOptionChange = (
e: React.MouseEvent | undefined,
e: MouseEvent | undefined,
selection: string | number | undefined,
) => {
if (filters && filters.length !== 0 && selection && e) {
@ -94,7 +95,7 @@ const TopologyToolbar = ({ showFilters }: TopologyToolbarProps) => {
onOpenChange={onClusterFilterToggle}
onSelect={onClusterChange}
isOpen={clusterFilterIsExpanded}
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
toggle={(toggleRef: Ref<MenuToggleElement>) => (
<MenuToggle
ref={toggleRef}
isExpanded={clusterFilterIsExpanded}
@ -124,7 +125,7 @@ const TopologyToolbar = ({ showFilters }: TopologyToolbarProps) => {
onOpenChange={onDisplayOptionsToggle}
onSelect={(event, value) => onDisplayOptionChange(event, value)}
isOpen={displayOptionsIsExpanded}
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
toggle={(toggleRef: Ref<MenuToggleElement>) => (
<MenuToggle
ref={toggleRef}
isExpanded={displayOptionsIsExpanded}

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import type { FC } from 'react';
import { usePermission } from '@backstage/plugin-permission-react';
@ -54,7 +54,7 @@ jest.mock('@patternfly/react-topology', () => ({
useEventListener: () => {},
action: () => {},
createTopologyControlButtons: () => {},
observer: (a: React.FC) => a,
observer: (a: FC) => a,
VisualizationSurface: () => <div>VisualizationSurface</div>,
TopologyView: () => <div>TopologyView</div>,
}));

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { useContext, useEffect } from 'react';
import { InfoCard, Progress } from '@backstage/core-components';
@ -51,7 +51,7 @@ const TopologyViewWorkloadComponent = ({
const layout = 'ColaNoForce';
const { loaded, dataModel } = useWorkloadsWatcher();
const { clusters, selectedClusterErrors, responseError } =
React.useContext(K8sResourcesContext);
useContext(K8sResourcesContext);
const graphDimensions = controller.hasGraph()
? controller.getGraph().getDimensions()
: undefined;
@ -69,7 +69,7 @@ const TopologyViewWorkloadComponent = ({
...(selectedClusterErrors ?? []),
];
React.useEffect(() => {
useEffect(() => {
const model = {
graph: {
id: 'g1',
@ -80,13 +80,13 @@ const TopologyViewWorkloadComponent = ({
controller.fromModel(model);
}, [controller]);
React.useEffect(() => {
useEffect(() => {
if (graphDimensions && loaded && dataModel) {
controller.fromModel(dataModel, true);
}
}, [graphDimensions, layout, loaded, dataModel, controller]);
React.useEffect(() => {
useEffect(() => {
if (dataModel) {
const selectedNode: BaseNode | null = selectedId
? (controller.getElementById(selectedId) as BaseNode)

View File

@ -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 { TopologyWorkloadView } from './TopologyWorkloadView';

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { memo } from 'react';
import {
ComponentFactory,
@ -25,7 +25,7 @@ import TopologyComponentFactory from '../Graph/TopologyComponentFactory';
import defaultLayoutFactory from '../layouts/defaultLayoutFactory';
import TopologyViewWorkloadComponent from './TopologyViewWorkloadComponent';
export const TopologyWorkloadView = React.memo(() => {
export const TopologyWorkloadView = memo(() => {
const controller = new Visualization();
controller.registerLayoutFactory(defaultLayoutFactory);
controller.registerComponentFactory(

View File

@ -13,7 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from 'react';
import type { FC } from 'react';
import { useState, useCallback } from 'react';
import {
ExpandableSection,
@ -26,15 +28,12 @@ import { deviceKey, deviceLabel } from '../../../utils/vm-utils';
import './boot-order.css';
export const BootOrderEmptySummary: React.FC<BootOrderEmptySummaryProps> = ({
export const BootOrderEmptySummary: FC<BootOrderEmptySummaryProps> = ({
devices,
}) => {
const [isExpanded, setIsExpanded] = React.useState<boolean>(false);
const [isExpanded, setIsExpanded] = useState<boolean>(false);
const options = devices.filter(device => !device.value.bootOrder);
const onToggle = React.useCallback(
() => setIsExpanded(!isExpanded),
[isExpanded],
);
const onToggle = useCallback(() => setIsExpanded(!isExpanded), [isExpanded]);
// Note(Yaacov):
// className='text-secondary' is a hack to fix TextVariants being overriden.

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from 'react';
import type { FC } from 'react';
import * as _ from 'lodash';
@ -22,9 +22,7 @@ import { deviceKey, deviceLabel } from '../../../utils/vm-utils';
import { BootOrderEmptySummary } from './boot-order-empty-summary';
// NOTE(yaacov): using <ol> because '@patternfly/react-core' <List> currently miss isOrder parameter.
export const BootOrderSummary: React.FC<BootOrderSummaryProps> = ({
devices,
}) => {
export const BootOrderSummary: FC<BootOrderSummaryProps> = ({ devices }) => {
const sources = _.sortBy(
devices.filter(device => device.value.bootOrder),
'value.bootOrder',

View File

@ -30,7 +30,6 @@
* limitations under the License.
*/
import React from 'react';
import Button from '@mui/material/Button';
import Box from '@mui/material/Box';
import Grid from '@mui/material/Grid';

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { ReactNode } from 'react';
import { ReactNode } from 'react';
import { usePermission } from '@backstage/plugin-permission-react';
import { Progress } from '@backstage/core-components';
import {

View File

@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from 'react';
import { createContext } from 'react';
import { FilterContextType } from '../types/types';
export const FilterContext = React.createContext<FilterContextType>({});
export const FilterContext = createContext<FilterContextType>({});

View File

@ -13,10 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { createContext } from 'react';
import { K8sResourcesContextData } from '../types/types';
export const K8sResourcesContext = React.createContext<K8sResourcesContextData>(
{ clusters: [], setSelectedCluster: () => {} },
);
export const K8sResourcesContext = createContext<K8sResourcesContextData>({
clusters: [],
setSelectedCluster: () => {},
});

View File

@ -13,14 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as React from 'react';
import { useState } from 'react';
import { TOPOLOGY_FILTERS } from '../const';
import { DisplayFilters, FilterContextType } from '../types/types';
export const useFilterContextValues = (): FilterContextType => {
const [filters, setFilters] =
React.useState<DisplayFilters>(TOPOLOGY_FILTERS);
const [filters, setFilters] = useState<DisplayFilters>(TOPOLOGY_FILTERS);
return { filters, setAppliedTopologyFilters: setFilters };
};

View File

@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { useState, useCallback } from 'react';
export const useForceUpdate = () => {
const [, setTick] = React.useState(0);
const update = React.useCallback(() => {
const [, setTick] = useState(0);
const update = useCallback(() => {
setTick(tick => tick + 1);
}, []);
return update;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { useState, useCallback, useEffect } from 'react';
import useAsyncRetry from 'react-use/lib/useAsyncRetry';
import useInterval from 'react-use/lib/useInterval';
@ -33,9 +33,9 @@ export const usePodLogs = ({
stopPolling,
intervalMs = 5000,
}: PodLogsOptions) => {
const [loadingData, setLoadingData] = React.useState<boolean>(true);
const [loadingData, setLoadingData] = useState<boolean>(true);
const kubernetesProxyApi = useApi(kubernetesProxyApiRef);
const getLogs = React.useCallback(async (): Promise<{ text: string }> => {
const getLogs = useCallback(async (): Promise<{ text: string }> => {
const { podName, podNamespace, containerName, clusterName } = podScope;
return await kubernetesProxyApi.getPodLogs({
podName: podName,
@ -52,7 +52,7 @@ export const usePodLogs = ({
useInterval(() => retry(), stopPolling ? null : intervalMs);
React.useEffect(() => {
useEffect(() => {
let mounted = true;
if (!loading && mounted) {
setLoadingData(prevState => {

Some files were not shown because too many files have changed in this diff Show More