chore: moving the scaffolderApiRef and types to -react
Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright 2022 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export * from './ref';
|
||||
export * from './types';
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2022 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { createApiRef } from '@backstage/core-plugin-api';
|
||||
import { ScaffolderApi } from './types';
|
||||
|
||||
export const scaffolderApiRef = createApiRef<ScaffolderApi>({
|
||||
id: 'plugin.scaffolder.service',
|
||||
});
|
||||
@@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { TaskSpec, TaskStep } from '@backstage/plugin-scaffolder-common';
|
||||
import { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react';
|
||||
import { JsonObject, JsonValue, Observable } from '@backstage/types';
|
||||
import { JSONSchema7 } from 'json-schema';
|
||||
import { TemplateParameterSchema } from '../types';
|
||||
|
||||
/**
|
||||
* The status of each task in a Scaffolder Job
|
||||
@@ -156,7 +156,6 @@ export interface ScaffolderDryRunResponse {
|
||||
steps: TaskStep[];
|
||||
output: ScaffolderTaskOutput;
|
||||
}
|
||||
|
||||
/**
|
||||
* An API to interact with the scaffolder backend.
|
||||
*
|
||||
@@ -18,5 +18,6 @@ export * from './routes';
|
||||
export * from './extensions';
|
||||
export * from './types';
|
||||
export * from './secrets';
|
||||
export * from './api';
|
||||
|
||||
export * from './next';
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
import { parseEntityRef } from '@backstage/catalog-model';
|
||||
import {
|
||||
createApiRef,
|
||||
DiscoveryApi,
|
||||
FetchApi,
|
||||
IdentityApi,
|
||||
@@ -38,20 +37,11 @@ import {
|
||||
ScaffolderTask,
|
||||
ScaffolderDryRunOptions,
|
||||
ScaffolderDryRunResponse,
|
||||
} from './types';
|
||||
TemplateParameterSchema,
|
||||
} from '@backstage/plugin-scaffolder-react';
|
||||
|
||||
import { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react';
|
||||
import queryString from 'qs';
|
||||
|
||||
/**
|
||||
* Utility API reference for the {@link ScaffolderApi}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export const scaffolderApiRef = createApiRef<ScaffolderApi>({
|
||||
id: 'plugin.scaffolder.service',
|
||||
});
|
||||
|
||||
/**
|
||||
* An API to interact with the scaffolder backend.
|
||||
*
|
||||
|
||||
@@ -14,12 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import { scaffolderApiRef } from '../../api';
|
||||
import { ActionsPage } from './ActionsPage';
|
||||
import { rootRouteRef } from '@backstage/plugin-scaffolder-react';
|
||||
import {
|
||||
rootRouteRef,
|
||||
scaffolderApiRef,
|
||||
ScaffolderApi,
|
||||
} from '@backstage/plugin-scaffolder-react';
|
||||
import { renderInTestApp, TestApiRegistry } from '@backstage/test-utils';
|
||||
import { ApiProvider } from '@backstage/core-app-api';
|
||||
import { ScaffolderApi } from '../../types';
|
||||
|
||||
const scaffolderApiMock: jest.Mocked<ScaffolderApi> = {
|
||||
scaffold: jest.fn(),
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
import React from 'react';
|
||||
import useAsync from 'react-use/lib/useAsync';
|
||||
import { scaffolderApiRef } from '../../api';
|
||||
import { scaffolderApiRef } from '@backstage/plugin-scaffolder-react';
|
||||
import {
|
||||
Typography,
|
||||
Paper,
|
||||
|
||||
@@ -24,9 +24,11 @@ import {
|
||||
import React from 'react';
|
||||
import { identityApiRef } from '@backstage/core-plugin-api';
|
||||
import { ListTasksPage } from './ListTasksPage';
|
||||
import { ScaffolderApi } from '../../types';
|
||||
import { scaffolderApiRef } from '../../api';
|
||||
import { rootRouteRef } from '@backstage/plugin-scaffolder-react';
|
||||
import {
|
||||
rootRouteRef,
|
||||
scaffolderApiRef,
|
||||
ScaffolderApi,
|
||||
} from '@backstage/plugin-scaffolder-react';
|
||||
import { act, fireEvent } from '@testing-library/react';
|
||||
|
||||
describe('<ListTasksPage />', () => {
|
||||
|
||||
@@ -28,9 +28,11 @@ import { useApi, useRouteRef } from '@backstage/core-plugin-api';
|
||||
import { CatalogFilterLayout } from '@backstage/plugin-catalog-react';
|
||||
import useAsync from 'react-use/lib/useAsync';
|
||||
import React, { useState } from 'react';
|
||||
import { scaffolderApiRef } from '../../api';
|
||||
import { rootRouteRef } from '@backstage/plugin-scaffolder-react';
|
||||
import { ScaffolderTask } from '../../types';
|
||||
import {
|
||||
rootRouteRef,
|
||||
ScaffolderTask,
|
||||
scaffolderApiRef,
|
||||
} from '@backstage/plugin-scaffolder-react';
|
||||
import { OwnerListPicker } from './OwnerListPicker';
|
||||
import {
|
||||
CreatedAtColumn,
|
||||
|
||||
+4
-2
@@ -18,9 +18,11 @@ import { renderInTestApp, TestApiProvider } from '@backstage/test-utils';
|
||||
|
||||
import React from 'react';
|
||||
import { TemplateTitleColumn } from './TemplateTitleColumn';
|
||||
import { scaffolderApiRef } from '../../../api';
|
||||
import { ScaffolderApi } from '../../../types';
|
||||
import { entityRouteRef } from '@backstage/plugin-catalog-react';
|
||||
import {
|
||||
scaffolderApiRef,
|
||||
ScaffolderApi,
|
||||
} from '@backstage/plugin-scaffolder-react';
|
||||
|
||||
describe('<TemplateTitleColumn />', () => {
|
||||
const scaffolderApiMock: jest.Mocked<ScaffolderApi> = {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
import { useApi } from '@backstage/core-plugin-api';
|
||||
import React from 'react';
|
||||
import { scaffolderApiRef } from '../../../api';
|
||||
import { scaffolderApiRef } from '@backstage/plugin-scaffolder-react';
|
||||
import useAsync from 'react-use/lib/useAsync';
|
||||
import { parseEntityRef } from '@backstage/catalog-model';
|
||||
import { EntityRefLink } from '@backstage/plugin-catalog-react';
|
||||
|
||||
@@ -51,8 +51,9 @@ import {
|
||||
rootRouteRef,
|
||||
scaffolderTaskRouteRef,
|
||||
selectedTemplateRouteRef,
|
||||
ScaffolderTaskStatus,
|
||||
ScaffolderTaskOutput,
|
||||
} from '@backstage/plugin-scaffolder-react';
|
||||
import { ScaffolderTaskStatus, ScaffolderTaskOutput } from '../../types';
|
||||
import { useTaskEventStream } from '../hooks/useEventStream';
|
||||
import { TaskErrors } from './TaskErrors';
|
||||
import { TaskPageLinks } from './TaskPageLinks';
|
||||
|
||||
@@ -19,7 +19,7 @@ import { entityRouteRef } from '@backstage/plugin-catalog-react';
|
||||
import { Box } from '@material-ui/core';
|
||||
import LanguageIcon from '@material-ui/icons/Language';
|
||||
import React from 'react';
|
||||
import { ScaffolderTaskOutput } from '../../types';
|
||||
import { ScaffolderTaskOutput } from '@backstage/plugin-scaffolder-react';
|
||||
import { IconLink } from './IconLink';
|
||||
import { IconComponent, useApp, useRouteRef } from '@backstage/core-plugin-api';
|
||||
|
||||
|
||||
@@ -26,8 +26,10 @@ import React, {
|
||||
useRef,
|
||||
useState,
|
||||
} from 'react';
|
||||
import { scaffolderApiRef } from '../../api';
|
||||
import { ScaffolderDryRunResponse } from '../../types';
|
||||
import {
|
||||
scaffolderApiRef,
|
||||
ScaffolderDryRunResponse,
|
||||
} from '@backstage/plugin-scaffolder-react';
|
||||
|
||||
const MAX_CONTENT_SIZE = 64 * 1024;
|
||||
const CHUNK_SIZE = 32 * 1024;
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import { renderInTestApp, TestApiProvider } from '@backstage/test-utils';
|
||||
import { act, screen, waitFor } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import React, { useEffect } from 'react';
|
||||
import { scaffolderApiRef } from '../../../api';
|
||||
import { scaffolderApiRef } from '@backstage/plugin-scaffolder-react';
|
||||
import { DryRunProvider, useDryRun } from '../DryRunContext';
|
||||
import { DryRunResults } from './DryRunResults';
|
||||
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import { renderInTestApp, TestApiProvider } from '@backstage/test-utils';
|
||||
import { act, screen } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import React, { useEffect } from 'react';
|
||||
import { scaffolderApiRef } from '../../../api';
|
||||
import { scaffolderApiRef } from '@backstage/plugin-scaffolder-react';
|
||||
import { DryRunProvider, useDryRun } from '../DryRunContext';
|
||||
import { DryRunResultsList } from './DryRunResultsList';
|
||||
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ import { renderInTestApp, TestApiProvider } from '@backstage/test-utils';
|
||||
import { screen } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import React, { ReactNode, useEffect } from 'react';
|
||||
import { scaffolderApiRef } from '../../../api';
|
||||
import { scaffolderApiRef } from '@backstage/plugin-scaffolder-react';
|
||||
import { DryRunProvider, useDryRun } from '../DryRunContext';
|
||||
import { DryRunResultsView } from './DryRunResultsView';
|
||||
|
||||
|
||||
@@ -22,9 +22,11 @@ import {
|
||||
import { act, fireEvent, screen, within } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import { Route, Routes } from 'react-router-dom';
|
||||
import { scaffolderApiRef } from '../../api';
|
||||
import { ScaffolderApi } from '../../types';
|
||||
import { rootRouteRef } from '@backstage/plugin-scaffolder-react';
|
||||
import {
|
||||
rootRouteRef,
|
||||
scaffolderApiRef,
|
||||
ScaffolderApi,
|
||||
} from '@backstage/plugin-scaffolder-react';
|
||||
import { TemplatePage } from './TemplatePage';
|
||||
import {
|
||||
featureFlagsApiRef,
|
||||
|
||||
@@ -19,13 +19,13 @@ import qs from 'qs';
|
||||
import React, { ComponentType, useCallback, useContext, useState } from 'react';
|
||||
import { Navigate, useNavigate } from 'react-router-dom';
|
||||
import useAsync from 'react-use/lib/useAsync';
|
||||
import { scaffolderApiRef } from '../../api';
|
||||
import {
|
||||
rootRouteRef,
|
||||
scaffolderTaskRouteRef,
|
||||
selectedTemplateRouteRef,
|
||||
FieldExtensionOptions,
|
||||
SecretsContext,
|
||||
scaffolderApiRef,
|
||||
} from '@backstage/plugin-scaffolder-react';
|
||||
import { MultistepJsonForm } from '../MultistepJsonForm';
|
||||
import { createValidator } from './createValidator';
|
||||
|
||||
@@ -23,12 +23,12 @@ import {
|
||||
scmAuthApiRef,
|
||||
ScmAuthApi,
|
||||
} from '@backstage/integration-react';
|
||||
import { scaffolderApiRef } from '../../../api';
|
||||
import { ScaffolderApi } from '../../../types';
|
||||
|
||||
import {
|
||||
SecretsContextProvider,
|
||||
SecretsContext,
|
||||
scaffolderApiRef,
|
||||
ScaffolderApi,
|
||||
} from '@backstage/plugin-scaffolder-react';
|
||||
import { act, fireEvent } from '@testing-library/react';
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
import React from 'react';
|
||||
import { RepoUrlPickerHost } from './RepoUrlPickerHost';
|
||||
import { renderInTestApp, TestApiProvider } from '@backstage/test-utils';
|
||||
import { scaffolderApiRef } from '../../../api';
|
||||
import { scaffolderApiRef } from '@backstage/plugin-scaffolder-react';
|
||||
import { fireEvent, within } from '@testing-library/react';
|
||||
|
||||
describe('RepoUrlPickerHostField', () => {
|
||||
|
||||
@@ -18,7 +18,7 @@ import { Progress, Select, SelectItem } from '@backstage/core-components';
|
||||
import FormControl from '@material-ui/core/FormControl';
|
||||
import FormHelperText from '@material-ui/core/FormHelperText';
|
||||
import { useApi } from '@backstage/core-plugin-api';
|
||||
import { scaffolderApiRef } from '../../../api';
|
||||
import { scaffolderApiRef } from '@backstage/plugin-scaffolder-react';
|
||||
import useAsync from 'react-use/lib/useAsync';
|
||||
|
||||
export const RepoUrlPickerHost = (props: {
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
*/
|
||||
import { useImmerReducer } from 'use-immer';
|
||||
import { useEffect } from 'react';
|
||||
import { scaffolderApiRef } from '../../api';
|
||||
import {
|
||||
ScaffolderTask,
|
||||
ScaffolderTaskStatus,
|
||||
ScaffolderTaskOutput,
|
||||
LogEvent,
|
||||
} from '../../types';
|
||||
scaffolderApiRef,
|
||||
} from '@backstage/plugin-scaffolder-react';
|
||||
import { useApi } from '@backstage/core-plugin-api';
|
||||
import { Subscription } from '@backstage/types';
|
||||
|
||||
|
||||
@@ -20,23 +20,7 @@
|
||||
* @packageDocumentation
|
||||
*/
|
||||
|
||||
export { scaffolderApiRef, ScaffolderClient } from './api';
|
||||
export type {
|
||||
ListActionsResponse,
|
||||
LogEvent,
|
||||
ScaffolderApi,
|
||||
ScaffolderDryRunOptions,
|
||||
ScaffolderDryRunResponse,
|
||||
ScaffolderGetIntegrationsListOptions,
|
||||
ScaffolderGetIntegrationsListResponse,
|
||||
ScaffolderOutputLink,
|
||||
ScaffolderScaffoldOptions,
|
||||
ScaffolderScaffoldResponse,
|
||||
ScaffolderStreamLogsOptions,
|
||||
ScaffolderTask,
|
||||
ScaffolderTaskOutput,
|
||||
ScaffolderTaskStatus,
|
||||
} from './types';
|
||||
export { ScaffolderClient } from './api';
|
||||
|
||||
export { createScaffolderLayout, ScaffolderLayouts } from './layouts';
|
||||
export type { LayoutOptions, LayoutTemplate, LayoutComponent } from './layouts';
|
||||
@@ -52,19 +36,38 @@ export {
|
||||
} from './plugin';
|
||||
export * from './components';
|
||||
|
||||
/** @deprecated - use imports from @backstage/plugin-scaffolder-react instead */
|
||||
export {
|
||||
createScaffolderFieldExtension,
|
||||
ScaffolderFieldExtensions,
|
||||
rootRouteRef,
|
||||
selectedTemplateRouteRef,
|
||||
useTemplateSecrets,
|
||||
scaffolderApiRef,
|
||||
/** @deprecated - use imports from @backstage/plugin-scaffolder-react instead */
|
||||
type ScaffolderApi,
|
||||
/** @deprecated */
|
||||
type ScaffolderUseTemplateSecrets,
|
||||
/** @deprecated */
|
||||
type TemplateParameterSchema,
|
||||
type CustomFieldExtensionSchema,
|
||||
type CustomFieldValidator,
|
||||
type FieldExtensionOptions,
|
||||
type FieldExtensionComponentProps,
|
||||
type FieldExtensionComponent,
|
||||
type ListActionsResponse,
|
||||
type LogEvent,
|
||||
type ScaffolderDryRunOptions,
|
||||
type ScaffolderDryRunResponse,
|
||||
type ScaffolderGetIntegrationsListOptions,
|
||||
type ScaffolderGetIntegrationsListResponse,
|
||||
type ScaffolderOutputLink,
|
||||
type ScaffolderScaffoldOptions,
|
||||
type ScaffolderScaffoldResponse,
|
||||
type ScaffolderStreamLogsOptions,
|
||||
type ScaffolderTask,
|
||||
type ScaffolderTaskOutput,
|
||||
type ScaffolderTaskStatus,
|
||||
} from '@backstage/plugin-scaffolder-react';
|
||||
|
||||
export type { TaskPageProps } from './components/TaskPage';
|
||||
|
||||
@@ -22,9 +22,12 @@ import {
|
||||
} from '@backstage/test-utils';
|
||||
import { act, fireEvent } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import { scaffolderApiRef } from '../../api';
|
||||
import { nextRouteRef, rootRouteRef } from '@backstage/plugin-scaffolder-react';
|
||||
import { ScaffolderApi } from '../../types';
|
||||
import {
|
||||
nextRouteRef,
|
||||
rootRouteRef,
|
||||
ScaffolderApi,
|
||||
scaffolderApiRef,
|
||||
} from '@backstage/plugin-scaffolder-react';
|
||||
import { TemplateWizardPage } from './TemplateWizardPage';
|
||||
|
||||
jest.mock('react-router-dom', () => {
|
||||
|
||||
@@ -31,7 +31,7 @@ import {
|
||||
useRouteRef,
|
||||
useRouteRefParams,
|
||||
} from '@backstage/core-plugin-api';
|
||||
import { scaffolderApiRef } from '../../api';
|
||||
import { scaffolderApiRef } from '@backstage/plugin-scaffolder-react';
|
||||
import useAsync from 'react-use/lib/useAsync';
|
||||
import { makeStyles } from '@material-ui/core';
|
||||
import { BackstageTheme } from '@backstage/theme';
|
||||
|
||||
@@ -21,8 +21,9 @@ import {
|
||||
rootRouteRef,
|
||||
viewTechDocRouteRef,
|
||||
createScaffolderFieldExtension,
|
||||
scaffolderApiRef,
|
||||
} from '@backstage/plugin-scaffolder-react';
|
||||
import { scaffolderApiRef, ScaffolderClient } from './api';
|
||||
import { ScaffolderClient } from './api';
|
||||
import {
|
||||
EntityPicker,
|
||||
EntityPickerSchema,
|
||||
|
||||
@@ -22430,6 +22430,7 @@ __metadata:
|
||||
"@backstage/plugin-playlist": "workspace:^"
|
||||
"@backstage/plugin-rollbar": "workspace:^"
|
||||
"@backstage/plugin-scaffolder": "workspace:^"
|
||||
"@backstage/plugin-scaffolder-react": "workspace:^"
|
||||
"@backstage/plugin-search": "workspace:^"
|
||||
"@backstage/plugin-search-common": "workspace:^"
|
||||
"@backstage/plugin-search-react": "workspace:^"
|
||||
|
||||
Reference in New Issue
Block a user