Merge pull request #20645 from backstage/rugvip/migrate-import

catalog-import: add support for new frontend system
This commit is contained in:
Patrik Oldsberg
2023-10-18 23:56:40 +02:00
committed by GitHub
5 changed files with 126 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-import': patch
---
Create an experimental plugin that is compatible with the declarative integration system, it is exported from the `/alpha` subpath.
@@ -0,0 +1,19 @@
## API Report File for "@backstage/plugin-catalog-import"
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
import { BackstagePlugin } from '@backstage/frontend-plugin-api';
import { RouteRef } from '@backstage/frontend-plugin-api';
// @alpha (undocumented)
const _default: BackstagePlugin<
{
importPage: RouteRef<undefined>;
},
{}
>;
export default _default;
// (No @packageDocumentation comment for this package)
```
+17 -3
View File
@@ -6,9 +6,22 @@
"types": "src/index.ts",
"license": "Apache-2.0",
"publishConfig": {
"access": "public",
"main": "dist/index.esm.js",
"types": "dist/index.d.ts"
"access": "public"
},
"exports": {
".": "./src/index.ts",
"./alpha": "./src/alpha.tsx",
"./package.json": "./package.json"
},
"typesVersions": {
"*": {
"alpha": [
"src/alpha.tsx"
],
"package.json": [
"package.json"
]
}
},
"backstage": {
"role": "frontend-plugin"
@@ -39,6 +52,7 @@
"@backstage/core-components": "workspace:^",
"@backstage/core-plugin-api": "workspace:^",
"@backstage/errors": "workspace:^",
"@backstage/frontend-plugin-api": "workspace:^",
"@backstage/integration": "workspace:^",
"@backstage/integration-react": "workspace:^",
"@backstage/plugin-catalog-common": "workspace:^",
+84
View File
@@ -0,0 +1,84 @@
/*
* 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.
*/
import {
configApiRef,
createApiFactory,
discoveryApiRef,
identityApiRef,
} from '@backstage/core-plugin-api';
import { convertLegacyRouteRef } from '@backstage/core-plugin-api/alpha';
import {
createApiExtension,
createPageExtension,
createPlugin,
} from '@backstage/frontend-plugin-api';
import {
scmAuthApiRef,
scmIntegrationsApiRef,
} from '@backstage/integration-react';
import React from 'react';
import { CatalogImportClient, catalogImportApiRef } from './api';
import { rootRouteRef } from './plugin';
import { catalogApiRef } from '@backstage/plugin-catalog-react';
// TODO: It's currently possible to override the import page with a custom one. We need to decide
// whether this type of override is typically done with an input or by overriding the entire extension.
const CatalogImportPageExtension = createPageExtension({
id: 'plugin.catalog-import.page',
defaultPath: '/catalog-import',
routeRef: convertLegacyRouteRef(rootRouteRef),
loader: () => import('./components/ImportPage').then(m => <m.ImportPage />),
});
const CatalogImportService = createApiExtension({
factory: createApiFactory({
api: catalogImportApiRef,
deps: {
discoveryApi: discoveryApiRef,
scmAuthApi: scmAuthApiRef,
identityApi: identityApiRef,
scmIntegrationsApi: scmIntegrationsApiRef,
catalogApi: catalogApiRef,
configApi: configApiRef,
},
factory: ({
discoveryApi,
scmAuthApi,
identityApi,
scmIntegrationsApi,
catalogApi,
configApi,
}) =>
new CatalogImportClient({
discoveryApi,
scmAuthApi,
scmIntegrationsApi,
identityApi,
catalogApi,
configApi,
}),
}),
});
/** @alpha */
export default createPlugin({
id: 'catalog-import',
extensions: [CatalogImportService, CatalogImportPageExtension],
routes: {
importPage: convertLegacyRouteRef(rootRouteRef),
},
});
+1
View File
@@ -5779,6 +5779,7 @@ __metadata:
"@backstage/core-plugin-api": "workspace:^"
"@backstage/dev-utils": "workspace:^"
"@backstage/errors": "workspace:^"
"@backstage/frontend-plugin-api": "workspace:^"
"@backstage/integration": "workspace:^"
"@backstage/integration-react": "workspace:^"
"@backstage/plugin-catalog-common": "workspace:^"