Flatten the options of the CatalogImportPage

This commit is contained in:
Dominik Henneke
2021-02-10 13:54:08 +01:00
parent 9d1426a04a
commit 753bb4c405
4 changed files with 19 additions and 15 deletions
+10
View File
@@ -0,0 +1,10 @@
---
'@backstage/plugin-catalog-import': patch
---
Flatten the options of the `CatalogImportPage` from the `options` property to the `pullRequest` property.
```diff
- <CatalogImportPage options={{ pullRequest: { disable: true } }} />
+ <CatalogImportPage pullRequest={{ disable: true }} />
```
+6 -8
View File
@@ -52,7 +52,7 @@ The pull request feature can be disabled by options that are passed to the `Cata
<Route
path="/catalog-import"
element={<CatalogImportPage options={{ pullRequest: { disable: true } }} />}
element={<CatalogImportPage pullRequest={{ disable: true }} />}
/>
```
@@ -68,13 +68,11 @@ This can be configured by options that are passed to the `CatalogImportPage`:
path="/catalog-import"
element={
<CatalogImportPage
options={{
pullRequest: {
preparePullRequest: () => ({
title: 'My title',
body: 'My **markdown** body',
}),
},
pullRequest={{
preparePullRequest: () => ({
title: 'My title',
body: 'My **markdown** body',
}),
}}
/>
}
@@ -48,11 +48,7 @@ function repositories(configApi: ConfigApi): string[] {
return repos;
}
export const ImportComponentPage = ({
opts,
}: {
opts?: StepperProviderOpts;
}) => {
export const ImportComponentPage = (opts: StepperProviderOpts) => {
const configApi = useApi(configApiRef);
const appTitle = configApi.getOptional('app.title') || 'Backstage';
@@ -19,8 +19,8 @@ import { Route, Routes } from 'react-router-dom';
import { ImportComponentPage } from './ImportComponentPage';
import { StepperProviderOpts } from './ImportStepper/defaults';
export const Router = ({ options }: { options?: StepperProviderOpts }) => (
export const Router = (opts: StepperProviderOpts) => (
<Routes>
<Route element={<ImportComponentPage opts={options} />} />
<Route element={<ImportComponentPage {...opts} />} />
</Routes>
);