From d7ff48817b1d1ac3713ab8cbfae32ec7289ca00c Mon Sep 17 00:00:00 2001 From: blam Date: Mon, 27 Feb 2023 12:45:56 +0100 Subject: [PATCH 1/2] chore: moving things around a little Signed-off-by: blam --- .../src/components/TaskSteps/TaskSteps.tsx | 79 ---------------- .../src/components/TaskSteps/index.ts | 16 ---- .../scaffolder-react/src/components/index.ts | 18 ---- .../TaskLogStream/TaskLogStream.test.tsx | 0 .../TaskLogStream/TaskLogStream.tsx | 2 +- .../components/TaskLogStream/index.ts | 0 .../components/TaskSteps/StepIcon.tsx | 0 .../components/TaskSteps/StepTime.test.tsx | 0 .../components/TaskSteps/StepTime.tsx | 0 .../components/TaskSteps}/TaskBorder.test.tsx | 0 .../components/TaskSteps}/TaskBorder.tsx | 2 - .../components/TaskSteps/TaskSteps.test.tsx | 0 .../next/components/TaskSteps/TaskSteps.tsx | 93 +++++++++++++++++++ .../components/TaskSteps}/index.ts | 2 +- .../src/next/components/index.ts | 2 + .../src/next/OngoingTask/OngoingTask.tsx | 24 +++-- 16 files changed, 108 insertions(+), 130 deletions(-) delete mode 100644 plugins/scaffolder-react/src/components/TaskSteps/TaskSteps.tsx delete mode 100644 plugins/scaffolder-react/src/components/TaskSteps/index.ts delete mode 100644 plugins/scaffolder-react/src/components/index.ts rename plugins/scaffolder-react/src/{ => next}/components/TaskLogStream/TaskLogStream.test.tsx (100%) rename plugins/scaffolder-react/src/{ => next}/components/TaskLogStream/TaskLogStream.tsx (99%) rename plugins/scaffolder-react/src/{ => next}/components/TaskLogStream/index.ts (100%) rename plugins/scaffolder-react/src/{ => next}/components/TaskSteps/StepIcon.tsx (100%) rename plugins/scaffolder-react/src/{ => next}/components/TaskSteps/StepTime.test.tsx (100%) rename plugins/scaffolder-react/src/{ => next}/components/TaskSteps/StepTime.tsx (100%) rename plugins/scaffolder-react/src/{components/TaskBorder => next/components/TaskSteps}/TaskBorder.test.tsx (100%) rename plugins/scaffolder-react/src/{components/TaskBorder => next/components/TaskSteps}/TaskBorder.tsx (98%) rename plugins/scaffolder-react/src/{ => next}/components/TaskSteps/TaskSteps.test.tsx (100%) create mode 100644 plugins/scaffolder-react/src/next/components/TaskSteps/TaskSteps.tsx rename plugins/scaffolder-react/src/{components/TaskBorder => next/components/TaskSteps}/index.ts (90%) diff --git a/plugins/scaffolder-react/src/components/TaskSteps/TaskSteps.tsx b/plugins/scaffolder-react/src/components/TaskSteps/TaskSteps.tsx deleted file mode 100644 index 8b43d5e17b..0000000000 --- a/plugins/scaffolder-react/src/components/TaskSteps/TaskSteps.tsx +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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 React from 'react'; -import { - Stepper as MuiStepper, - Step as MuiStep, - StepButton as MuiStepButton, - StepLabel as MuiStepLabel, - StepIconProps, - Box, -} from '@material-ui/core'; -import { TaskStep } from '@backstage/plugin-scaffolder-common'; -import { type Step } from '@backstage/plugin-scaffolder-react'; -import { StepIcon } from './StepIcon'; -import { StepTime } from './StepTime'; - -/** - * - * @public - */ -export interface StepperProps { - steps: (TaskStep & Step)[]; - activeStep?: number; -} - -/** - * The visual stepper of the task event stream - * - * @public - */ -export const TaskSteps = (props: StepperProps) => { - return ( - - {props.steps.map((step, index) => { - const isCompleted = step.status === 'completed'; - const isFailed = step.status === 'failed'; - const isActive = step.status === 'processing'; - const isSkipped = step.status === 'skipped'; - const stepIconProps: Partial = { - completed: isCompleted, - error: isFailed, - active: isActive, - skipped: isSkipped, - }; - - return ( - - - - {step.name} - - - - - ); - })} - - ); -}; diff --git a/plugins/scaffolder-react/src/components/TaskSteps/index.ts b/plugins/scaffolder-react/src/components/TaskSteps/index.ts deleted file mode 100644 index 91f5537bd3..0000000000 --- a/plugins/scaffolder-react/src/components/TaskSteps/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright 2023 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 { TaskSteps, type StepperProps } from './TaskSteps'; diff --git a/plugins/scaffolder-react/src/components/index.ts b/plugins/scaffolder-react/src/components/index.ts deleted file mode 100644 index b724ed32b5..0000000000 --- a/plugins/scaffolder-react/src/components/index.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright 2023 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 { TaskSteps, type StepperProps } from './TaskSteps'; -export { TaskBorder } from './TaskBorder'; -export { TaskLogStream } from './TaskLogStream'; diff --git a/plugins/scaffolder-react/src/components/TaskLogStream/TaskLogStream.test.tsx b/plugins/scaffolder-react/src/next/components/TaskLogStream/TaskLogStream.test.tsx similarity index 100% rename from plugins/scaffolder-react/src/components/TaskLogStream/TaskLogStream.test.tsx rename to plugins/scaffolder-react/src/next/components/TaskLogStream/TaskLogStream.test.tsx diff --git a/plugins/scaffolder-react/src/components/TaskLogStream/TaskLogStream.tsx b/plugins/scaffolder-react/src/next/components/TaskLogStream/TaskLogStream.tsx similarity index 99% rename from plugins/scaffolder-react/src/components/TaskLogStream/TaskLogStream.tsx rename to plugins/scaffolder-react/src/next/components/TaskLogStream/TaskLogStream.tsx index 973627aa02..4ce1df7a29 100644 --- a/plugins/scaffolder-react/src/components/TaskLogStream/TaskLogStream.tsx +++ b/plugins/scaffolder-react/src/next/components/TaskLogStream/TaskLogStream.tsx @@ -28,7 +28,7 @@ const useStyles = makeStyles({ /** * The text of the event stream * - * @public + * @alpha */ export const TaskLogStream = (props: { logs: { [k: string]: string[] } }) => { const styles = useStyles(); diff --git a/plugins/scaffolder-react/src/components/TaskLogStream/index.ts b/plugins/scaffolder-react/src/next/components/TaskLogStream/index.ts similarity index 100% rename from plugins/scaffolder-react/src/components/TaskLogStream/index.ts rename to plugins/scaffolder-react/src/next/components/TaskLogStream/index.ts diff --git a/plugins/scaffolder-react/src/components/TaskSteps/StepIcon.tsx b/plugins/scaffolder-react/src/next/components/TaskSteps/StepIcon.tsx similarity index 100% rename from plugins/scaffolder-react/src/components/TaskSteps/StepIcon.tsx rename to plugins/scaffolder-react/src/next/components/TaskSteps/StepIcon.tsx diff --git a/plugins/scaffolder-react/src/components/TaskSteps/StepTime.test.tsx b/plugins/scaffolder-react/src/next/components/TaskSteps/StepTime.test.tsx similarity index 100% rename from plugins/scaffolder-react/src/components/TaskSteps/StepTime.test.tsx rename to plugins/scaffolder-react/src/next/components/TaskSteps/StepTime.test.tsx diff --git a/plugins/scaffolder-react/src/components/TaskSteps/StepTime.tsx b/plugins/scaffolder-react/src/next/components/TaskSteps/StepTime.tsx similarity index 100% rename from plugins/scaffolder-react/src/components/TaskSteps/StepTime.tsx rename to plugins/scaffolder-react/src/next/components/TaskSteps/StepTime.tsx diff --git a/plugins/scaffolder-react/src/components/TaskBorder/TaskBorder.test.tsx b/plugins/scaffolder-react/src/next/components/TaskSteps/TaskBorder.test.tsx similarity index 100% rename from plugins/scaffolder-react/src/components/TaskBorder/TaskBorder.test.tsx rename to plugins/scaffolder-react/src/next/components/TaskSteps/TaskBorder.test.tsx diff --git a/plugins/scaffolder-react/src/components/TaskBorder/TaskBorder.tsx b/plugins/scaffolder-react/src/next/components/TaskSteps/TaskBorder.tsx similarity index 98% rename from plugins/scaffolder-react/src/components/TaskBorder/TaskBorder.tsx rename to plugins/scaffolder-react/src/next/components/TaskSteps/TaskBorder.tsx index 17eea3997a..2d8e99bfe7 100644 --- a/plugins/scaffolder-react/src/components/TaskBorder/TaskBorder.tsx +++ b/plugins/scaffolder-react/src/next/components/TaskSteps/TaskBorder.tsx @@ -28,8 +28,6 @@ const useStyles = makeStyles((theme: BackstageTheme) => ({ /** * The visual progress of the task event stream - * - * @public */ export const TaskBorder = (props: { isComplete: boolean; diff --git a/plugins/scaffolder-react/src/components/TaskSteps/TaskSteps.test.tsx b/plugins/scaffolder-react/src/next/components/TaskSteps/TaskSteps.test.tsx similarity index 100% rename from plugins/scaffolder-react/src/components/TaskSteps/TaskSteps.test.tsx rename to plugins/scaffolder-react/src/next/components/TaskSteps/TaskSteps.test.tsx diff --git a/plugins/scaffolder-react/src/next/components/TaskSteps/TaskSteps.tsx b/plugins/scaffolder-react/src/next/components/TaskSteps/TaskSteps.tsx new file mode 100644 index 0000000000..cecf3dc76c --- /dev/null +++ b/plugins/scaffolder-react/src/next/components/TaskSteps/TaskSteps.tsx @@ -0,0 +1,93 @@ +/* + * 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 React from 'react'; +import { + Stepper as MuiStepper, + Step as MuiStep, + StepButton as MuiStepButton, + StepLabel as MuiStepLabel, + StepIconProps, + Box, + Paper, +} from '@material-ui/core'; +import { TaskStep } from '@backstage/plugin-scaffolder-common'; +import { type Step } from '@backstage/plugin-scaffolder-react'; +import { StepIcon } from './StepIcon'; +import { StepTime } from './StepTime'; +import { TaskBorder } from './TaskBorder'; + +/** + * Props for the TaskSteps component + * + * @alpha + */ +export interface TaskStepsProps { + steps: (TaskStep & Step)[]; + activeStep?: number; + isComplete?: boolean; + isError?: boolean; +} + +/** + * The visual stepper of the task event stream + * + * @alpha + */ +export const TaskSteps = (props: TaskStepsProps) => { + return ( + + + + + {props.steps.map((step, index) => { + const isCompleted = step.status === 'completed'; + const isFailed = step.status === 'failed'; + const isActive = step.status === 'processing'; + const isSkipped = step.status === 'skipped'; + const stepIconProps: Partial = + { + completed: isCompleted, + error: isFailed, + active: isActive, + skipped: isSkipped, + }; + + return ( + + + + {step.name} + + + + + ); + })} + + + + ); +}; diff --git a/plugins/scaffolder-react/src/components/TaskBorder/index.ts b/plugins/scaffolder-react/src/next/components/TaskSteps/index.ts similarity index 90% rename from plugins/scaffolder-react/src/components/TaskBorder/index.ts rename to plugins/scaffolder-react/src/next/components/TaskSteps/index.ts index e1559957d1..45ff9ccf7c 100644 --- a/plugins/scaffolder-react/src/components/TaskBorder/index.ts +++ b/plugins/scaffolder-react/src/next/components/TaskSteps/index.ts @@ -13,4 +13,4 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -export { TaskBorder } from './TaskBorder'; +export { TaskSteps, type TaskStepsProps } from './TaskSteps'; diff --git a/plugins/scaffolder-react/src/next/components/index.ts b/plugins/scaffolder-react/src/next/components/index.ts index 60a8fd9a51..083d88927e 100644 --- a/plugins/scaffolder-react/src/next/components/index.ts +++ b/plugins/scaffolder-react/src/next/components/index.ts @@ -20,3 +20,5 @@ export * from './TemplateGroup'; export * from './Workflow'; export * from './TemplateOutputs'; export * from './Form'; +export * from './TaskSteps'; +export * from './TaskLogStream'; diff --git a/plugins/scaffolder/src/next/OngoingTask/OngoingTask.tsx b/plugins/scaffolder/src/next/OngoingTask/OngoingTask.tsx index 84730429dd..fc1c1a7413 100644 --- a/plugins/scaffolder/src/next/OngoingTask/OngoingTask.tsx +++ b/plugins/scaffolder/src/next/OngoingTask/OngoingTask.tsx @@ -18,9 +18,6 @@ import { Page, Header, Content, ErrorPanel } from '@backstage/core-components'; import { useNavigate, useParams } from 'react-router-dom'; import { Box, makeStyles, Paper } from '@material-ui/core'; import { - TaskSteps, - TaskBorder, - TaskLogStream, ScaffolderTaskOutput, useTaskEventStream, } from '@backstage/plugin-scaffolder-react'; @@ -28,7 +25,11 @@ import { nextSelectedTemplateRouteRef } from '../routes'; import { useRouteRef } from '@backstage/core-plugin-api'; import qs from 'qs'; import { ContextMenu } from './ContextMenu'; -import { DefaultTemplateOutputs } from '@backstage/plugin-scaffolder-react/alpha'; +import { + DefaultTemplateOutputs, + TaskLogStream, + TaskSteps, +} from '@backstage/plugin-scaffolder-react/alpha'; const useStyles = makeStyles({ contentWrapper: { @@ -132,15 +133,12 @@ export const OngoingTask = (props: { ) : null} - - - - - - + From 1ec47ea20f1d598fd60357d3d757e97925193bc0 Mon Sep 17 00:00:00 2001 From: blam Date: Mon, 27 Feb 2023 13:08:23 +0100 Subject: [PATCH 2/2] chore: fix api reports Signed-off-by: blam --- plugins/scaffolder-react/alpha-api-report.md | 24 +++++++++ plugins/scaffolder-react/api-report.md | 50 ++++--------------- plugins/scaffolder-react/src/hooks/index.ts | 2 +- .../src/hooks/useEventStream.ts | 23 +++++---- plugins/scaffolder-react/src/index.ts | 1 - .../src/next/components/Stepper/Stepper.tsx | 6 ++- .../components/TaskSteps/TaskSteps.test.tsx | 2 +- .../next/components/TaskSteps/TaskSteps.tsx | 4 +- .../src/next/extensions/index.tsx | 3 +- .../src/next/hooks/useTemplateSchema.test.tsx | 2 +- .../next/hooks/useTransformSchemaToProps.ts | 2 +- 11 files changed, 58 insertions(+), 61 deletions(-) diff --git a/plugins/scaffolder-react/alpha-api-report.md b/plugins/scaffolder-react/alpha-api-report.md index ad44cd3707..eca06b9af6 100644 --- a/plugins/scaffolder-react/alpha-api-report.md +++ b/plugins/scaffolder-react/alpha-api-report.md @@ -22,8 +22,10 @@ import { PropsWithChildren } from 'react'; import { default as React_2 } from 'react'; import { ReactNode } from 'react'; import { RJSFSchema } from '@rjsf/utils'; +import { ScaffolderStep } from '@backstage/plugin-scaffolder-react'; import { ScaffolderTaskOutput } from '@backstage/plugin-scaffolder-react'; import { SetStateAction } from 'react'; +import { TaskStep } from '@backstage/plugin-scaffolder-common'; import { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common'; import { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react'; import { UIOptionsType } from '@rjsf/utils'; @@ -140,6 +142,28 @@ export type StepperProps = { layouts?: LayoutOptions[]; }; +// @alpha +export const TaskLogStream: (props: { + logs: { + [k: string]: string[]; + }; +}) => JSX.Element; + +// @alpha +export const TaskSteps: (props: TaskStepsProps) => JSX.Element; + +// @alpha +export interface TaskStepsProps { + // (undocumented) + activeStep?: number; + // (undocumented) + isComplete?: boolean; + // (undocumented) + isError?: boolean; + // (undocumented) + steps: (TaskStep & ScaffolderStep)[]; +} + // @alpha export const TemplateCard: (props: TemplateCardProps) => JSX.Element; diff --git a/plugins/scaffolder-react/api-report.md b/plugins/scaffolder-react/api-report.md index 384c4b80f2..ab11d73c46 100644 --- a/plugins/scaffolder-react/api-report.md +++ b/plugins/scaffolder-react/api-report.md @@ -17,10 +17,6 @@ import { JsonValue } from '@backstage/types'; import { Observable } from '@backstage/types'; import { PropsWithChildren } from 'react'; import { default as React_2 } from 'react'; -import { ScaffolderTask as ScaffolderTask_2 } from '@backstage/plugin-scaffolder-react'; -import { ScaffolderTaskOutput as ScaffolderTaskOutput_2 } from '@backstage/plugin-scaffolder-react'; -import { ScaffolderTaskStatus as ScaffolderTaskStatus_2 } from '@backstage/plugin-scaffolder-react'; -import { Step as Step_2 } from '@backstage/plugin-scaffolder-react'; import { TaskSpec } from '@backstage/plugin-scaffolder-common'; import { TaskStep } from '@backstage/plugin-scaffolder-common'; @@ -236,6 +232,14 @@ export interface ScaffolderScaffoldResponse { taskId: string; } +// @public +export type ScaffolderStep = { + id: string; + status: ScaffolderTaskStatus; + endedAt?: string; + startedAt?: string; +}; + // @public export interface ScaffolderStreamLogsOptions { // (undocumented) @@ -281,38 +285,6 @@ export const SecretsContextProvider: ({ children, }: PropsWithChildren<{}>) => JSX.Element; -// @public -export type Step = { - id: string; - status: ScaffolderTaskStatus_2; - endedAt?: string; - startedAt?: string; -}; - -// @public (undocumented) -export interface StepperProps { - // (undocumented) - activeStep?: number; - // (undocumented) - steps: (TaskStep & Step_2)[]; -} - -// @public -export const TaskBorder: (props: { - isComplete: boolean; - isError: boolean; -}) => JSX.Element; - -// @public -export const TaskLogStream: (props: { - logs: { - [k: string]: string[]; - }; -}) => JSX.Element; - -// @public -export const TaskSteps: (props: StepperProps) => JSX.Element; - // @public export type TaskStream = { loading: boolean; @@ -321,11 +293,11 @@ export type TaskStream = { [stepId in string]: string[]; }; completed: boolean; - task?: ScaffolderTask_2; + task?: ScaffolderTask; steps: { - [stepId in string]: Step; + [stepId in string]: ScaffolderStep; }; - output?: ScaffolderTaskOutput_2; + output?: ScaffolderTaskOutput; }; // @public diff --git a/plugins/scaffolder-react/src/hooks/index.ts b/plugins/scaffolder-react/src/hooks/index.ts index 124950e83d..1016a0af09 100644 --- a/plugins/scaffolder-react/src/hooks/index.ts +++ b/plugins/scaffolder-react/src/hooks/index.ts @@ -19,5 +19,5 @@ export { useCustomLayouts } from './useCustomLayouts'; export { useTaskEventStream, type TaskStream, - type Step, + type ScaffolderStep, } from './useEventStream'; diff --git a/plugins/scaffolder-react/src/hooks/useEventStream.ts b/plugins/scaffolder-react/src/hooks/useEventStream.ts index 101063d258..d8c9cf4c1f 100644 --- a/plugins/scaffolder-react/src/hooks/useEventStream.ts +++ b/plugins/scaffolder-react/src/hooks/useEventStream.ts @@ -15,22 +15,23 @@ */ import { useImmerReducer } from 'use-immer'; import { useEffect } from 'react'; -import { - ScaffolderTask, - ScaffolderTaskStatus, - ScaffolderTaskOutput, - LogEvent, - scaffolderApiRef, -} from '@backstage/plugin-scaffolder-react'; + import { useApi } from '@backstage/core-plugin-api'; import { Subscription } from '@backstage/types'; +import { + LogEvent, + scaffolderApiRef, + ScaffolderTask, + ScaffolderTaskOutput, + ScaffolderTaskStatus, +} from '../api'; /** * The status of the step being processed * * @public */ -export type Step = { +export type ScaffolderStep = { id: string; status: ScaffolderTaskStatus; endedAt?: string; @@ -48,7 +49,7 @@ export type TaskStream = { stepLogs: { [stepId in string]: string[] }; completed: boolean; task?: ScaffolderTask; - steps: { [stepId in string]: Step }; + steps: { [stepId in string]: ScaffolderStep }; output?: ScaffolderTaskOutput; }; @@ -75,7 +76,7 @@ function reducer(draft: TaskStream, action: ReducerAction) { draft.steps = action.data.spec.steps.reduce((current, next) => { current[next.id] = { status: 'open', id: next.id }; return current; - }, {} as { [stepId in string]: Step }); + }, {} as { [stepId in string]: ScaffolderStep }); draft.stepLogs = action.data.spec.steps.reduce((current, next) => { current[next.id] = []; return current; @@ -153,7 +154,7 @@ export const useTaskEventStream = (taskId: string): TaskStream => { loading: true, completed: false, stepLogs: {} as { [stepId in string]: string[] }, - steps: {} as { [stepId in string]: Step }, + steps: {} as { [stepId in string]: ScaffolderStep }, }); useEffect(() => { diff --git a/plugins/scaffolder-react/src/index.ts b/plugins/scaffolder-react/src/index.ts index 38584ab25b..1b20c19414 100644 --- a/plugins/scaffolder-react/src/index.ts +++ b/plugins/scaffolder-react/src/index.ts @@ -20,4 +20,3 @@ export * from './secrets'; export * from './api'; export * from './hooks'; export * from './layouts'; -export * from './components'; diff --git a/plugins/scaffolder-react/src/next/components/Stepper/Stepper.tsx b/plugins/scaffolder-react/src/next/components/Stepper/Stepper.tsx index 444e463064..51a00dfa64 100644 --- a/plugins/scaffolder-react/src/next/components/Stepper/Stepper.tsx +++ b/plugins/scaffolder-react/src/next/components/Stepper/Stepper.tsx @@ -26,7 +26,6 @@ import { type IChangeEvent } from '@rjsf/core-v5'; import { ErrorSchema } from '@rjsf/utils'; import React, { useCallback, useMemo, useState, type ReactNode } from 'react'; import { NextFieldExtensionOptions } from '../../extensions'; -import { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react'; import { createAsyncValidators, type FormValidation, @@ -36,11 +35,14 @@ import { useTemplateSchema } from '../../hooks/useTemplateSchema'; import validator from '@rjsf/validator-ajv8'; import { useFormDataFromQuery } from '../../hooks'; import { FormProps } from '../../types'; -import { LayoutOptions } from '@backstage/plugin-scaffolder-react'; import { useTransformSchemaToProps } from '../../hooks/useTransformSchemaToProps'; import { hasErrors } from './utils'; import * as FieldOverrides from './FieldOverrides'; import { Form } from '../Form'; +import { + TemplateParameterSchema, + LayoutOptions, +} from '@backstage/plugin-scaffolder-react'; const useStyles = makeStyles(theme => ({ backButton: { diff --git a/plugins/scaffolder-react/src/next/components/TaskSteps/TaskSteps.test.tsx b/plugins/scaffolder-react/src/next/components/TaskSteps/TaskSteps.test.tsx index afd1f58190..0945843961 100644 --- a/plugins/scaffolder-react/src/next/components/TaskSteps/TaskSteps.test.tsx +++ b/plugins/scaffolder-react/src/next/components/TaskSteps/TaskSteps.test.tsx @@ -15,8 +15,8 @@ */ import React from 'react'; import { TaskSteps } from './TaskSteps'; -import { ScaffolderTaskStatus } from '@backstage/plugin-scaffolder-react'; import { renderInTestApp } from '@backstage/test-utils'; +import { ScaffolderTaskStatus } from '../../../api'; describe('TaskSteps', () => { it('should render each of the steps', async () => { diff --git a/plugins/scaffolder-react/src/next/components/TaskSteps/TaskSteps.tsx b/plugins/scaffolder-react/src/next/components/TaskSteps/TaskSteps.tsx index cecf3dc76c..632500f07e 100644 --- a/plugins/scaffolder-react/src/next/components/TaskSteps/TaskSteps.tsx +++ b/plugins/scaffolder-react/src/next/components/TaskSteps/TaskSteps.tsx @@ -24,10 +24,10 @@ import { Paper, } from '@material-ui/core'; import { TaskStep } from '@backstage/plugin-scaffolder-common'; -import { type Step } from '@backstage/plugin-scaffolder-react'; import { StepIcon } from './StepIcon'; import { StepTime } from './StepTime'; import { TaskBorder } from './TaskBorder'; +import { ScaffolderStep } from '@backstage/plugin-scaffolder-react'; /** * Props for the TaskSteps component @@ -35,7 +35,7 @@ import { TaskBorder } from './TaskBorder'; * @alpha */ export interface TaskStepsProps { - steps: (TaskStep & Step)[]; + steps: (TaskStep & ScaffolderStep)[]; activeStep?: number; isComplete?: boolean; isError?: boolean; diff --git a/plugins/scaffolder-react/src/next/extensions/index.tsx b/plugins/scaffolder-react/src/next/extensions/index.tsx index b2d402c93f..a856addb29 100644 --- a/plugins/scaffolder-react/src/next/extensions/index.tsx +++ b/plugins/scaffolder-react/src/next/extensions/index.tsx @@ -21,9 +21,8 @@ import { } from './types'; import { Extension, attachComponentData } from '@backstage/core-plugin-api'; import { UIOptionsType } from '@rjsf/utils'; -// eslint-disable-next-line import/no-extraneous-dependencies -import { FieldExtensionComponent } from '@backstage/plugin-scaffolder-react'; import { FIELD_EXTENSION_KEY } from '../../extensions/keys'; +import { FieldExtensionComponent } from '@backstage/plugin-scaffolder-react'; /** * Method for creating field extensions that can be used in the scaffolder diff --git a/plugins/scaffolder-react/src/next/hooks/useTemplateSchema.test.tsx b/plugins/scaffolder-react/src/next/hooks/useTemplateSchema.test.tsx index ab33652338..153c48468d 100644 --- a/plugins/scaffolder-react/src/next/hooks/useTemplateSchema.test.tsx +++ b/plugins/scaffolder-react/src/next/hooks/useTemplateSchema.test.tsx @@ -18,7 +18,7 @@ import { renderHook } from '@testing-library/react-hooks'; import { TestApiProvider } from '@backstage/test-utils'; import React from 'react'; import { featureFlagsApiRef } from '@backstage/core-plugin-api'; -import { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react'; +import { TemplateParameterSchema } from '../../types'; describe('useTemplateSchema', () => { it('should generate the correct schema', () => { diff --git a/plugins/scaffolder-react/src/next/hooks/useTransformSchemaToProps.ts b/plugins/scaffolder-react/src/next/hooks/useTransformSchemaToProps.ts index 612ad5427b..1e714eb874 100644 --- a/plugins/scaffolder-react/src/next/hooks/useTransformSchemaToProps.ts +++ b/plugins/scaffolder-react/src/next/hooks/useTransformSchemaToProps.ts @@ -13,8 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { LayoutOptions } from '../../layouts'; import { type ParsedTemplateSchema } from './useTemplateSchema'; -import { type LayoutOptions } from '@backstage/plugin-scaffolder-react'; interface Options { layouts?: LayoutOptions[];