apply core-imports codemod to all packages and plugins
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { createApiRef } from '@backstage/core';
|
||||
import { RestEndpointMethodTypes } from '@octokit/rest';
|
||||
import { createApiRef } from '@backstage/core-plugin-api';
|
||||
|
||||
export const githubActionsApiRef = createApiRef<GithubActionsApi>({
|
||||
id: 'plugin.githubactions.service',
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ConfigApi, OAuthApi } from '@backstage/core';
|
||||
import { readGitHubIntegrationConfigs } from '@backstage/integration';
|
||||
import { GithubActionsApi } from './GithubActionsApi';
|
||||
import { Octokit, RestEndpointMethodTypes } from '@octokit/rest';
|
||||
import { ConfigApi, OAuthApi } from '@backstage/core-plugin-api';
|
||||
|
||||
export class GithubActionsClient implements GithubActionsApi {
|
||||
private readonly configApi: ConfigApi;
|
||||
|
||||
@@ -14,14 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import {
|
||||
configApiRef,
|
||||
errorApiRef,
|
||||
InfoCard,
|
||||
InfoCardVariants,
|
||||
StructuredMetadataTable,
|
||||
useApi,
|
||||
} from '@backstage/core';
|
||||
import { readGitHubIntegrationConfigs } from '@backstage/integration';
|
||||
import { useEntity } from '@backstage/plugin-catalog-react';
|
||||
import {
|
||||
@@ -38,6 +30,13 @@ import { useWorkflowRuns, WorkflowRun } from '../useWorkflowRuns';
|
||||
import { WorkflowRunsTable } from '../WorkflowRunsTable';
|
||||
import { WorkflowRunStatus } from '../WorkflowRunStatus';
|
||||
|
||||
import { configApiRef, errorApiRef, useApi } from '@backstage/core-plugin-api';
|
||||
import {
|
||||
InfoCard,
|
||||
InfoCardVariants,
|
||||
StructuredMetadataTable,
|
||||
} from '@backstage/core-components';
|
||||
|
||||
const useStyles = makeStyles<Theme>({
|
||||
externalLinkIcon: {
|
||||
fontSize: 'inherit',
|
||||
|
||||
@@ -14,14 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {
|
||||
ApiProvider,
|
||||
ApiRegistry,
|
||||
errorApiRef,
|
||||
configApiRef,
|
||||
ConfigApi,
|
||||
ConfigReader,
|
||||
} from '@backstage/core';
|
||||
import { EntityProvider } from '@backstage/plugin-catalog-react';
|
||||
import { lightTheme } from '@backstage/theme';
|
||||
import { ThemeProvider } from '@material-ui/core';
|
||||
@@ -32,6 +24,17 @@ import { useWorkflowRuns } from '../useWorkflowRuns';
|
||||
import type { Props as RecentWorkflowRunsCardProps } from './RecentWorkflowRunsCard';
|
||||
import { RecentWorkflowRunsCard } from './RecentWorkflowRunsCard';
|
||||
|
||||
import {
|
||||
ApiProvider,
|
||||
ApiRegistry,
|
||||
ConfigReader,
|
||||
} from '@backstage/core-app-api';
|
||||
import {
|
||||
errorApiRef,
|
||||
configApiRef,
|
||||
ConfigApi,
|
||||
} from '@backstage/core-plugin-api';
|
||||
|
||||
jest.mock('../useWorkflowRuns', () => ({
|
||||
useWorkflowRuns: jest.fn(),
|
||||
}));
|
||||
|
||||
@@ -14,15 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import {
|
||||
configApiRef,
|
||||
errorApiRef,
|
||||
InfoCard,
|
||||
InfoCardVariants,
|
||||
Link,
|
||||
Table,
|
||||
useApi,
|
||||
} from '@backstage/core';
|
||||
import { readGitHubIntegrationConfigs } from '@backstage/integration';
|
||||
import { useEntity } from '@backstage/plugin-catalog-react';
|
||||
import React, { useEffect } from 'react';
|
||||
@@ -32,6 +23,14 @@ import { useWorkflowRuns } from '../useWorkflowRuns';
|
||||
import { WorkflowRunStatus } from '../WorkflowRunStatus';
|
||||
import { Typography } from '@material-ui/core';
|
||||
|
||||
import { configApiRef, errorApiRef, useApi } from '@backstage/core-plugin-api';
|
||||
import {
|
||||
InfoCard,
|
||||
InfoCardVariants,
|
||||
Link,
|
||||
Table,
|
||||
} from '@backstage/core-components';
|
||||
|
||||
const firstLine = (message: string): string => message.split('\n')[0];
|
||||
|
||||
export type Props = {
|
||||
|
||||
@@ -21,7 +21,7 @@ import { rootRouteRef, buildRouteRef } from '../routes';
|
||||
import { WorkflowRunDetails } from './WorkflowRunDetails';
|
||||
import { WorkflowRunsTable } from './WorkflowRunsTable';
|
||||
import { GITHUB_ACTIONS_ANNOTATION } from './useProjectName';
|
||||
import { MissingAnnotationEmptyState } from '@backstage/core';
|
||||
import { MissingAnnotationEmptyState } from '@backstage/core-components';
|
||||
|
||||
export const isGithubActionsAvailable = (entity: Entity) =>
|
||||
Boolean(entity.metadata.annotations?.[GITHUB_ACTIONS_ANNOTATION]);
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { configApiRef, Breadcrumbs, Link, useApi } from '@backstage/core';
|
||||
import { readGitHubIntegrationConfigs } from '@backstage/integration';
|
||||
import {
|
||||
Accordion,
|
||||
@@ -46,6 +45,9 @@ import { useWorkflowRunJobs } from './useWorkflowRunJobs';
|
||||
import { useWorkflowRunsDetails } from './useWorkflowRunsDetails';
|
||||
import { WorkflowRunLogs } from '../WorkflowRunLogs';
|
||||
|
||||
import { configApiRef, useApi } from '@backstage/core-plugin-api';
|
||||
import { Breadcrumbs, Link } from '@backstage/core-components';
|
||||
|
||||
const useStyles = makeStyles<Theme>(theme => ({
|
||||
root: {
|
||||
maxWidth: 720,
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { useAsync } from 'react-use';
|
||||
import { useApi, useRouteRefParams } from '@backstage/core';
|
||||
import { githubActionsApiRef } from '../../api';
|
||||
import { buildRouteRef } from '../../routes';
|
||||
import { useApi, useRouteRefParams } from '@backstage/core-plugin-api';
|
||||
|
||||
export const useWorkflowRunJobs = ({
|
||||
hostname,
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { useApi, useRouteRefParams } from '@backstage/core';
|
||||
import { useAsync } from 'react-use';
|
||||
import { githubActionsApiRef } from '../../api';
|
||||
import { buildRouteRef } from '../../routes';
|
||||
import { useApi, useRouteRefParams } from '@backstage/core-plugin-api';
|
||||
|
||||
export const useWorkflowRunsDetails = ({
|
||||
hostname,
|
||||
|
||||
@@ -34,8 +34,8 @@ import { useProjectName } from '../useProjectName';
|
||||
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
|
||||
import DescriptionIcon from '@material-ui/icons/Description';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { configApiRef, useApi } from '@backstage/core';
|
||||
import { readGitHubIntegrationConfigs } from '@backstage/integration';
|
||||
import { configApiRef, useApi } from '@backstage/core-plugin-api';
|
||||
|
||||
const LazyLog = React.lazy(() => import('react-lazylog/build/LazyLog'));
|
||||
const LinePart = React.lazy(() => import('react-lazylog/build/LinePart'));
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { useApi } from '@backstage/core';
|
||||
import { useAsync } from 'react-use';
|
||||
import { githubActionsApiRef } from '../../api';
|
||||
import { useApi } from '@backstage/core-plugin-api';
|
||||
|
||||
export const useDownloadWorkflowRunLogs = ({
|
||||
hostname,
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import {
|
||||
StatusPending,
|
||||
StatusRunning,
|
||||
@@ -21,8 +22,7 @@ import {
|
||||
StatusWarning,
|
||||
StatusAborted,
|
||||
StatusError,
|
||||
} from '@backstage/core';
|
||||
import React from 'react';
|
||||
} from '@backstage/core-components';
|
||||
|
||||
export const WorkflowRunStatus = ({
|
||||
status,
|
||||
|
||||
@@ -25,13 +25,6 @@ import {
|
||||
import RetryIcon from '@material-ui/icons/Replay';
|
||||
import GitHubIcon from '@material-ui/icons/GitHub';
|
||||
import { Link as RouterLink, generatePath } from 'react-router-dom';
|
||||
import {
|
||||
EmptyState,
|
||||
Table,
|
||||
TableColumn,
|
||||
configApiRef,
|
||||
useApi,
|
||||
} from '@backstage/core';
|
||||
import { useWorkflowRuns, WorkflowRun } from '../useWorkflowRuns';
|
||||
import { WorkflowRunStatus } from '../WorkflowRunStatus';
|
||||
import SyncIcon from '@material-ui/icons/Sync';
|
||||
@@ -40,6 +33,9 @@ import { useProjectName } from '../useProjectName';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { readGitHubIntegrationConfigs } from '@backstage/integration';
|
||||
|
||||
import { EmptyState, Table, TableColumn } from '@backstage/core-components';
|
||||
import { configApiRef, useApi } from '@backstage/core-plugin-api';
|
||||
|
||||
const generatedColumns: TableColumn[] = [
|
||||
{
|
||||
title: 'ID',
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
import { useState } from 'react';
|
||||
import { useAsyncRetry } from 'react-use';
|
||||
import { githubActionsApiRef } from '../api/GithubActionsApi';
|
||||
import { useApi, errorApiRef } from '@backstage/core';
|
||||
import { useApi, errorApiRef } from '@backstage/core-plugin-api';
|
||||
|
||||
export type WorkflowRun = {
|
||||
workflowName: string;
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { githubActionsApiRef, GithubActionsClient } from './api';
|
||||
import { rootRouteRef } from './routes';
|
||||
import {
|
||||
configApiRef,
|
||||
createPlugin,
|
||||
@@ -21,9 +23,7 @@ import {
|
||||
githubAuthApiRef,
|
||||
createRoutableExtension,
|
||||
createComponentExtension,
|
||||
} from '@backstage/core';
|
||||
import { githubActionsApiRef, GithubActionsClient } from './api';
|
||||
import { rootRouteRef } from './routes';
|
||||
} from '@backstage/core-plugin-api';
|
||||
|
||||
export const githubActionsPlugin = createPlugin({
|
||||
id: 'github-actions',
|
||||
|
||||
@@ -14,9 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { createRouteRef } from '@backstage/core';
|
||||
import { createRouteRef } from '@backstage/core-plugin-api';
|
||||
|
||||
// TODO(freben): This is just a demo route for now
|
||||
export const rootRouteRef = createRouteRef({
|
||||
path: '',
|
||||
title: 'GitHub Actions',
|
||||
|
||||
Reference in New Issue
Block a user