apply core-imports codemod to all packages and plugins

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2021-06-17 17:56:24 +02:00
parent 9b9a8f3925
commit d453c05dc3
541 changed files with 1549 additions and 1321 deletions
+1 -1
View File
@@ -20,8 +20,8 @@ import { useEntity } from '@backstage/plugin-catalog-react';
import { Route, Routes } from 'react-router-dom';
import { rootCatalogKubernetesRouteRef } from './plugin';
import { KubernetesContent } from './components/KubernetesContent';
import { MissingAnnotationEmptyState } from '@backstage/core';
import { Button } from '@material-ui/core';
import { MissingAnnotationEmptyState } from '@backstage/core-components';
const KUBERNETES_ANNOTATION = 'backstage.io/kubernetes-id';
const KUBERNETES_LABEL_SELECTOR_QUERY_ANNOTATION =
@@ -14,12 +14,12 @@
* limitations under the License.
*/
import { DiscoveryApi, IdentityApi } from '@backstage/core';
import { KubernetesApi } from './types';
import {
KubernetesRequestBody,
ObjectsByEntityResponse,
} from '@backstage/plugin-kubernetes-common';
import { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api';
export class KubernetesBackendClient implements KubernetesApi {
private readonly discoveryApi: DiscoveryApi;
+1 -1
View File
@@ -14,11 +14,11 @@
* limitations under the License.
*/
import { createApiRef } from '@backstage/core';
import {
KubernetesRequestBody,
ObjectsByEntityResponse,
} from '@backstage/plugin-kubernetes-common';
import { createApiRef } from '@backstage/core-plugin-api';
export const kubernetesApiRef = createApiRef<KubernetesApi>({
id: 'plugin.kubernetes.service',
@@ -25,7 +25,6 @@ import {
} from '@material-ui/core';
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
import { V1Pod, V1HorizontalPodAutoscaler } from '@kubernetes/client-node';
import { StatusError, StatusOK } from '@backstage/core';
import { PodsTable } from '../../Pods';
import { HorizontalPodAutoscalerDrawer } from '../../HorizontalPodAutoscalers';
import { RolloutDrawer } from './RolloutDrawer';
@@ -41,6 +40,7 @@ import {
getMatchingHpa,
getOwnedPodsThroughReplicaSets,
} from '../../../utils/owner';
import { StatusError, StatusOK } from '@backstage/core-components';
type RolloutAccordionsProps = {
rollouts: any[];
@@ -24,7 +24,7 @@ import {
} from '@material-ui/core';
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
import { DefaultCustomResourceDrawer } from './DefaultCustomResourceDrawer';
import { StructuredMetadataTable } from '@backstage/core';
import { StructuredMetadataTable } from '@backstage/core-components';
type DefaultCustomResourceAccordionsProps = {
customResources: any[];
@@ -29,7 +29,6 @@ import {
V1Pod,
V1HorizontalPodAutoscaler,
} from '@kubernetes/client-node';
import { StatusError, StatusOK } from '@backstage/core';
import { PodsTable } from '../Pods';
import { DeploymentDrawer } from './DeploymentDrawer';
import { HorizontalPodAutoscalerDrawer } from '../HorizontalPodAutoscalers';
@@ -41,6 +40,7 @@ import {
GroupedResponsesContext,
PodNamesWithErrorsContext,
} from '../../hooks';
import { StatusError, StatusOK } from '@backstage/core-components';
type DeploymentsAccordionsProps = {
children?: React.ReactNode;
@@ -14,10 +14,10 @@
* limitations under the License.
*/
import * as React from 'react';
import { Table, TableColumn, InfoCard } from '@backstage/core';
import { DetectedError, DetectedErrorsByCluster } from '../../error-detection';
import { Chip, Typography, Grid } from '@material-ui/core';
import EmptyStateImage from '../../assets/emptystate.svg';
import { Table, TableColumn, InfoCard } from '@backstage/core-components';
type ErrorReportingProps = {
detectedErrors: DetectedErrorsByCluster;
@@ -24,9 +24,9 @@ import {
} from '@material-ui/core';
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
import { ExtensionsV1beta1Ingress } from '@kubernetes/client-node';
import { StructuredMetadataTable } from '@backstage/core';
import { IngressDrawer } from './IngressDrawer';
import { GroupedResponsesContext } from '../../hooks';
import { StructuredMetadataTable } from '@backstage/core-components';
type IngressesAccordionsProps = {};
@@ -15,9 +15,9 @@
*/
import React from 'react';
import { WarningPanel } from '@backstage/core';
import { Typography } from '@material-ui/core';
import { ClusterObjects } from '@backstage/plugin-kubernetes-common';
import { WarningPanel } from '@backstage/core-components';
const clustersWithErrorsToErrorMessage = (
clustersWithErrors: ClusterObjects[],
@@ -23,13 +23,6 @@ import {
Grid,
Typography,
} from '@material-ui/core';
import {
Content,
Page,
Progress,
StatusError,
StatusOK,
} from '@backstage/core';
import { Entity } from '@backstage/catalog-model';
import { ClusterObjects } from '@backstage/plugin-kubernetes-common';
import { ErrorPanel } from './ErrorPanel';
@@ -42,13 +35,20 @@ import { IngressesAccordions } from '../IngressesAccordions';
import { ServicesAccordions } from '../ServicesAccordions';
import { CustomResources } from '../CustomResources';
import EmptyStateImage from '../../assets/emptystate.svg';
import {
GroupedResponsesContext,
PodNamesWithErrorsContext,
useKubernetesObjects,
} from '../../hooks';
import {
Content,
Page,
Progress,
StatusError,
StatusOK,
} from '@backstage/core-components';
type ClusterSummaryProps = {
clusterName: string;
totalNumberOfPods: number;
@@ -30,8 +30,11 @@ import {
import Close from '@material-ui/icons/Close';
import { V1ObjectMeta } from '@kubernetes/client-node';
import { withStyles } from '@material-ui/core/styles';
import { CodeSnippet, StructuredMetadataTable } from '@backstage/core';
import jsYaml from 'js-yaml';
import {
CodeSnippet,
StructuredMetadataTable,
} from '@backstage/core-components';
const useDrawerStyles = makeStyles((theme: Theme) =>
createStyles({
+1 -1
View File
@@ -15,7 +15,6 @@
*/
import React from 'react';
import { Table, TableColumn } from '@backstage/core';
import { V1Pod } from '@kubernetes/client-node';
import { PodDrawer } from './PodDrawer';
import {
@@ -23,6 +22,7 @@ import {
containerStatuses,
totalRestarts,
} from '../../utils/pod';
import { Table, TableColumn } from '@backstage/core-components';
const columns: TableColumn<V1Pod>[] = [
{
@@ -25,9 +25,9 @@ import {
} from '@material-ui/core';
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
import { V1Service } from '@kubernetes/client-node';
import { StructuredMetadataTable } from '@backstage/core';
import { ServiceDrawer } from './ServiceDrawer';
import { GroupedResponsesContext } from '../../hooks';
import { StructuredMetadataTable } from '@backstage/core-components';
type ServiceSummaryProps = {
service: V1Service;
@@ -16,8 +16,8 @@
import { useKubernetesObjects } from './useKubernetesObjects';
import { Entity } from '@backstage/catalog-model';
import { useApi } from '@backstage/core';
import { renderHook } from '@testing-library/react-hooks';
import { useApi } from '@backstage/core-plugin-api';
jest.mock('@backstage/core');
@@ -15,7 +15,6 @@
*/
import { Entity } from '@backstage/catalog-model';
import { useApi } from '@backstage/core';
import { kubernetesApiRef } from '../api/types';
import { kubernetesAuthProvidersApiRef } from '../kubernetes-auth-provider/types';
import { useEffect, useState } from 'react';
@@ -23,6 +22,7 @@ import {
KubernetesRequestBody,
ObjectsByEntityResponse,
} from '@backstage/plugin-kubernetes-common';
import { useApi } from '@backstage/core-plugin-api';
export interface KubernetesObjects {
kubernetesObjects: ObjectsByEntityResponse | undefined;
@@ -14,9 +14,9 @@
* limitations under the License.
*/
import { OAuthApi } from '@backstage/core';
import { KubernetesAuthProvider } from './types';
import { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common';
import { OAuthApi } from '@backstage/core-plugin-api';
export class GoogleKubernetesAuthProvider implements KubernetesAuthProvider {
authProvider: OAuthApi;
@@ -14,12 +14,12 @@
* limitations under the License.
*/
import { OAuthApi } from '@backstage/core';
import { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common';
import { KubernetesAuthProvider, KubernetesAuthProvidersApi } from './types';
import { GoogleKubernetesAuthProvider } from './GoogleKubernetesAuthProvider';
import { ServiceAccountKubernetesAuthProvider } from './ServiceAccountKubernetesAuthProvider';
import { AwsKubernetesAuthProvider } from './AwsKubernetesAuthProvider';
import { OAuthApi } from '@backstage/core-plugin-api';
export class KubernetesAuthProviders implements KubernetesAuthProvidersApi {
private readonly kubernetesAuthProviderMap: Map<
@@ -14,8 +14,8 @@
* limitations under the License.
*/
import { createApiRef } from '@backstage/core';
import { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common';
import { createApiRef } from '@backstage/core-plugin-api';
export interface KubernetesAuthProvider {
decorateRequestBodyForAuth(
+5 -5
View File
@@ -13,6 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { KubernetesBackendClient } from './api/KubernetesBackendClient';
import { kubernetesApiRef } from './api/types';
import { kubernetesAuthProvidersApiRef } from './kubernetes-auth-provider/types';
import { KubernetesAuthProviders } from './kubernetes-auth-provider/KubernetesAuthProviders';
import {
createApiFactory,
createPlugin,
@@ -21,11 +25,7 @@ import {
identityApiRef,
googleAuthApiRef,
createRoutableExtension,
} from '@backstage/core';
import { KubernetesBackendClient } from './api/KubernetesBackendClient';
import { kubernetesApiRef } from './api/types';
import { kubernetesAuthProvidersApiRef } from './kubernetes-auth-provider/types';
import { KubernetesAuthProviders } from './kubernetes-auth-provider/KubernetesAuthProviders';
} from '@backstage/core-plugin-api';
export const rootCatalogKubernetesRouteRef = createRouteRef({
path: '*',
+3 -3
View File
@@ -16,14 +16,14 @@
import { V1Pod, V1PodCondition } from '@kubernetes/client-node';
import React, { Fragment, ReactNode } from 'react';
import { Chip } from '@material-ui/core';
import { V1DeploymentCondition } from '@kubernetes/client-node/dist/gen/model/v1DeploymentCondition';
import {
StatusAborted,
StatusError,
StatusOK,
SubvalueCell,
} from '@backstage/core';
import { Chip } from '@material-ui/core';
import { V1DeploymentCondition } from '@kubernetes/client-node/dist/gen/model/v1DeploymentCondition';
} from '@backstage/core-components';
export const imageChips = (pod: V1Pod): ReactNode => {
const containerStatuses = pod.status?.containerStatuses ?? [];