apply core-imports codemod to all packages and plugins
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { createApiRef, DiscoveryApi, ConfigApi } from '@backstage/core';
|
||||
import { Service, Incident, OnCall } from '../components/types';
|
||||
import {
|
||||
PagerDutyApi,
|
||||
@@ -25,6 +24,11 @@ import {
|
||||
ClientApiConfig,
|
||||
RequestOptions,
|
||||
} from './types';
|
||||
import {
|
||||
createApiRef,
|
||||
DiscoveryApi,
|
||||
ConfigApi,
|
||||
} from '@backstage/core-plugin-api';
|
||||
|
||||
export class UnauthorizedError extends Error {}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import { Incident, OnCall, Service } from '../components/types';
|
||||
import { DiscoveryApi } from '@backstage/core';
|
||||
import { DiscoveryApi } from '@backstage/core-plugin-api';
|
||||
|
||||
export type TriggerAlarmRequest = {
|
||||
integrationKey: string;
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import { EmptyState } from '@backstage/core';
|
||||
import { Button } from '@material-ui/core';
|
||||
import { EmptyState } from '@backstage/core-components';
|
||||
|
||||
export const MissingTokenError = () => (
|
||||
<EmptyState
|
||||
|
||||
@@ -18,8 +18,8 @@ import { render, waitFor } from '@testing-library/react';
|
||||
import { EscalationPolicy } from './EscalationPolicy';
|
||||
import { wrapInTestApp } from '@backstage/test-utils';
|
||||
import { User } from '../types';
|
||||
import { ApiProvider, ApiRegistry } from '@backstage/core';
|
||||
import { pagerDutyApiRef } from '../../api';
|
||||
import { ApiProvider, ApiRegistry } from '@backstage/core-app-api';
|
||||
|
||||
const mockPagerDutyApi = {
|
||||
getOnCallByPolicyId: () => [],
|
||||
|
||||
@@ -20,9 +20,11 @@ import { EscalationUsersEmptyState } from './EscalationUsersEmptyState';
|
||||
import { EscalationUser } from './EscalationUser';
|
||||
import { useAsync } from 'react-use';
|
||||
import { pagerDutyApiRef } from '../../api';
|
||||
import { useApi, Progress } from '@backstage/core';
|
||||
import { Alert } from '@material-ui/lab';
|
||||
|
||||
import { useApi } from '@backstage/core-plugin-api';
|
||||
import { Progress } from '@backstage/core-components';
|
||||
|
||||
type Props = {
|
||||
policyId: string;
|
||||
};
|
||||
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
ListItemText,
|
||||
makeStyles,
|
||||
} from '@material-ui/core';
|
||||
import { StatusWarning } from '@backstage/core';
|
||||
import { StatusWarning } from '@backstage/core-components';
|
||||
|
||||
const useStyles = makeStyles({
|
||||
denseListIcon: {
|
||||
|
||||
@@ -17,9 +17,9 @@ import React from 'react';
|
||||
import { render, waitFor } from '@testing-library/react';
|
||||
import { Incidents } from './Incidents';
|
||||
import { wrapInTestApp } from '@backstage/test-utils';
|
||||
import { ApiProvider, ApiRegistry } from '@backstage/core';
|
||||
import { pagerDutyApiRef } from '../../api';
|
||||
import { Incident } from '../types';
|
||||
import { ApiProvider, ApiRegistry } from '@backstage/core-app-api';
|
||||
|
||||
const mockPagerDutyApi = {
|
||||
getIncidentsByServiceId: () => [],
|
||||
|
||||
@@ -20,9 +20,11 @@ import { IncidentListItem } from './IncidentListItem';
|
||||
import { IncidentsEmptyState } from './IncidentEmptyState';
|
||||
import { useAsyncFn } from 'react-use';
|
||||
import { pagerDutyApiRef } from '../../api';
|
||||
import { useApi, Progress } from '@backstage/core';
|
||||
import { Alert } from '@material-ui/lab';
|
||||
|
||||
import { useApi } from '@backstage/core-plugin-api';
|
||||
import { Progress } from '@backstage/core-components';
|
||||
|
||||
type Props = {
|
||||
serviceId: string;
|
||||
refreshIncidents: boolean;
|
||||
|
||||
@@ -19,15 +19,12 @@ import { PagerDutyCard } from '../PagerDutyCard';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { EntityProvider } from '@backstage/plugin-catalog-react';
|
||||
import { wrapInTestApp } from '@backstage/test-utils';
|
||||
import {
|
||||
alertApiRef,
|
||||
ApiProvider,
|
||||
ApiRegistry,
|
||||
createApiRef,
|
||||
} from '@backstage/core';
|
||||
import { pagerDutyApiRef, UnauthorizedError, PagerDutyClient } from '../../api';
|
||||
import { Service } from '../types';
|
||||
|
||||
import { alertApiRef, createApiRef } from '@backstage/core-plugin-api';
|
||||
import { ApiProvider, ApiRegistry } from '@backstage/core-app-api';
|
||||
|
||||
const mockPagerDutyApi: Partial<PagerDutyClient> = {
|
||||
getServiceByIntegrationKey: async () => [],
|
||||
getOnCallByPolicyId: async () => [],
|
||||
|
||||
@@ -14,12 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import {
|
||||
useApi,
|
||||
Progress,
|
||||
HeaderIconLinkRow,
|
||||
IconLinkVerticalProps,
|
||||
} from '@backstage/core';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { Card, CardHeader, Divider, CardContent } from '@material-ui/core';
|
||||
import { Incidents } from '../Incident';
|
||||
@@ -34,6 +28,13 @@ import { usePagerdutyEntity } from '../../hooks';
|
||||
import { PAGERDUTY_INTEGRATION_KEY } from '../constants';
|
||||
import { TriggerDialog } from '../TriggerDialog';
|
||||
|
||||
import { useApi } from '@backstage/core-plugin-api';
|
||||
import {
|
||||
Progress,
|
||||
HeaderIconLinkRow,
|
||||
IconLinkVerticalProps,
|
||||
} from '@backstage/core-components';
|
||||
|
||||
export const isPluginApplicableToEntity = (entity: Entity) =>
|
||||
Boolean(entity.metadata.annotations?.[PAGERDUTY_INTEGRATION_KEY]);
|
||||
|
||||
|
||||
@@ -16,19 +16,19 @@
|
||||
import React from 'react';
|
||||
import { act, fireEvent, screen, waitFor } from '@testing-library/react';
|
||||
import { renderInTestApp } from '@backstage/test-utils';
|
||||
import {
|
||||
ApiRegistry,
|
||||
alertApiRef,
|
||||
createApiRef,
|
||||
ApiProvider,
|
||||
IdentityApi,
|
||||
identityApiRef,
|
||||
} from '@backstage/core';
|
||||
import { pagerDutyApiRef } from '../../api';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { EntityProvider } from '@backstage/plugin-catalog-react';
|
||||
import { TriggerButton } from './';
|
||||
|
||||
import { ApiRegistry, ApiProvider } from '@backstage/core-app-api';
|
||||
import {
|
||||
alertApiRef,
|
||||
createApiRef,
|
||||
IdentityApi,
|
||||
identityApiRef,
|
||||
} from '@backstage/core-plugin-api';
|
||||
|
||||
describe('TriggerButton', () => {
|
||||
const mockIdentityApi: Partial<IdentityApi> = {
|
||||
getUserId: () => 'guest@example.com',
|
||||
|
||||
@@ -16,19 +16,19 @@
|
||||
import React from 'react';
|
||||
import { fireEvent, act } from '@testing-library/react';
|
||||
import { renderInTestApp } from '@backstage/test-utils';
|
||||
import {
|
||||
ApiRegistry,
|
||||
alertApiRef,
|
||||
createApiRef,
|
||||
ApiProvider,
|
||||
IdentityApi,
|
||||
identityApiRef,
|
||||
} from '@backstage/core';
|
||||
import { pagerDutyApiRef } from '../../api';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { EntityProvider } from '@backstage/plugin-catalog-react';
|
||||
import { TriggerDialog } from './TriggerDialog';
|
||||
|
||||
import { ApiRegistry, ApiProvider } from '@backstage/core-app-api';
|
||||
import {
|
||||
alertApiRef,
|
||||
createApiRef,
|
||||
IdentityApi,
|
||||
identityApiRef,
|
||||
} from '@backstage/core-plugin-api';
|
||||
|
||||
describe('TriggerDialog', () => {
|
||||
const mockIdentityApi: Partial<IdentityApi> = {
|
||||
getUserId: () => 'guest@example.com',
|
||||
|
||||
@@ -25,11 +25,15 @@ import {
|
||||
Typography,
|
||||
CircularProgress,
|
||||
} from '@material-ui/core';
|
||||
import { useApi, alertApiRef, identityApiRef } from '@backstage/core';
|
||||
import { useAsyncFn } from 'react-use';
|
||||
import { pagerDutyApiRef } from '../../api';
|
||||
import { Alert } from '@material-ui/lab';
|
||||
import { usePagerdutyEntity } from '../../hooks';
|
||||
import {
|
||||
useApi,
|
||||
alertApiRef,
|
||||
identityApiRef,
|
||||
} from '@backstage/core-plugin-api';
|
||||
|
||||
type Props = {
|
||||
showDialog: boolean;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { pagerDutyApiRef, PagerDutyClient } from './api';
|
||||
import {
|
||||
createApiFactory,
|
||||
createPlugin,
|
||||
@@ -20,8 +21,7 @@ import {
|
||||
discoveryApiRef,
|
||||
configApiRef,
|
||||
createComponentExtension,
|
||||
} from '@backstage/core';
|
||||
import { pagerDutyApiRef, PagerDutyClient } from './api';
|
||||
} from '@backstage/core-plugin-api';
|
||||
|
||||
export const rootRouteRef = createRouteRef({
|
||||
path: '/pagerduty',
|
||||
|
||||
Reference in New Issue
Block a user