diff --git a/.changeset/real-bulldogs-greet.md b/.changeset/real-bulldogs-greet.md new file mode 100644 index 0000000000..49d8a65d54 --- /dev/null +++ b/.changeset/real-bulldogs-greet.md @@ -0,0 +1,6 @@ +--- +'@backstage/catalog-client': patch +'@backstage/plugin-catalog-import': patch +--- + +Display preview result final step. diff --git a/packages/catalog-client/src/CatalogClient.ts b/packages/catalog-client/src/CatalogClient.ts index 7c9b313ce7..141929f3da 100644 --- a/packages/catalog-client/src/CatalogClient.ts +++ b/packages/catalog-client/src/CatalogClient.ts @@ -134,12 +134,6 @@ export class CatalogClient implements CatalogApi { throw new Error(`Location wasn't added: ${target}`); } - // TODO(jhaals): This will throw using the experimental catalog since all discovered entities are deferred. - if (entities.length === 0) { - throw new Error( - `Location was added but has no entities specified yet: ${target}`, - ); - } return { location, entities, diff --git a/plugins/catalog-import/src/components/ImportStepper/defaults.tsx b/plugins/catalog-import/src/components/ImportStepper/defaults.tsx index a8c9b41abb..1c4891855f 100644 --- a/plugins/catalog-import/src/components/ImportStepper/defaults.tsx +++ b/plugins/catalog-import/src/components/ImportStepper/defaults.tsx @@ -328,7 +328,7 @@ export const defaultStepper: StepperProvider = { stepLabel: Finish, content: ( ), diff --git a/plugins/catalog-import/src/components/StepFinishImportLocation/StepFinishImportLocation.tsx b/plugins/catalog-import/src/components/StepFinishImportLocation/StepFinishImportLocation.tsx index cc5eb9adef..5d7d0b919c 100644 --- a/plugins/catalog-import/src/components/StepFinishImportLocation/StepFinishImportLocation.tsx +++ b/plugins/catalog-import/src/components/StepFinishImportLocation/StepFinishImportLocation.tsx @@ -20,25 +20,25 @@ import LocationOnIcon from '@material-ui/icons/LocationOn'; import React from 'react'; import { BackButton } from '../Buttons'; import { EntityListComponent } from '../EntityListComponent'; -import { ReviewResult } from '../useImportState'; +import { PrepareResult } from '../useImportState'; type Props = { - reviewResult: ReviewResult; + prepareResult: PrepareResult; onReset: () => void; }; -export const StepFinishImportLocation = ({ reviewResult, onReset }: Props) => ( +export const StepFinishImportLocation = ({ prepareResult, onReset }: Props) => ( <> - {reviewResult.type === 'repository' && ( + {prepareResult.type === 'repository' && ( <> The following Pull Request has been opened:{' '} - {reviewResult.pullRequest.url} + {prepareResult.pullRequest.url} @@ -53,7 +53,7 @@ export const StepFinishImportLocation = ({ reviewResult, onReset }: Props) => ( } withLinks /> diff --git a/plugins/catalog-import/src/components/useImportState.test.tsx b/plugins/catalog-import/src/components/useImportState.test.tsx index d1ef3184ad..a4b4b3bc7f 100644 --- a/plugins/catalog-import/src/components/useImportState.test.tsx +++ b/plugins/catalog-import/src/components/useImportState.test.tsx @@ -127,7 +127,7 @@ describe('useImportState', () => { activeState: 'finish', analyzeResult: locationAP, prepareResult: locationAP, - reviewResult: locationR, + reviewResult: locationAP, }); act(() => result.current.onReset()); @@ -138,8 +138,8 @@ describe('useImportState', () => { analysisUrl: undefined, activeState: 'analyze', analyzeResult: undefined, - prepareResult: undefined, - reviewResult: locationR, + prepareResult: locationR, + reviewResult: undefined, }); }); diff --git a/plugins/catalog-import/src/components/useImportState.ts b/plugins/catalog-import/src/components/useImportState.ts index f042c991ef..bcfcff152e 100644 --- a/plugins/catalog-import/src/components/useImportState.ts +++ b/plugins/catalog-import/src/components/useImportState.ts @@ -227,9 +227,9 @@ function reducer(state: ReducerState, action: ReducerActions): ReducerState { return { ...init(action.initialUrl), - // we keep the old reviewResult since the form is animated and an + // we keep the old prepareResult since the form is animated and an // undefined value might crash the last step. - reviewResult: state.reviewResult, + prepareResult: state.prepareResult, }; default: