Merge pull request #22041 from awanlin/topic/devtools-alpha-di

[DevTools] Added alpha support for the New Frontend System
This commit is contained in:
Patrik Oldsberg
2024-01-21 11:31:37 +01:00
committed by GitHub
8 changed files with 149 additions and 6 deletions
+18
View File
@@ -0,0 +1,18 @@
/*
* 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 * from './alpha/index';
export { default } from './alpha/index';
+17
View File
@@ -0,0 +1,17 @@
/*
* 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 { default } from './plugin';
+70
View File
@@ -0,0 +1,70 @@
/*
* 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 React from 'react';
import {
createApiExtension,
createApiFactory,
createNavItemExtension,
createPageExtension,
createPlugin,
discoveryApiRef,
identityApiRef,
} from '@backstage/frontend-plugin-api';
import { devToolsApiRef, DevToolsClient } from '../api';
import {
compatWrapper,
convertLegacyRouteRef,
} from '@backstage/core-compat-api';
import BuildIcon from '@material-ui/icons/Build';
import { rootRouteRef } from '../routes';
/** @alpha */
export const devToolsApi = createApiExtension({
factory: createApiFactory({
api: devToolsApiRef,
deps: { discoveryApi: discoveryApiRef, identityApi: identityApiRef },
factory: ({ discoveryApi, identityApi }) =>
new DevToolsClient({ discoveryApi, identityApi }),
}),
});
/** @alpha */
export const devToolsPage = createPageExtension({
defaultPath: '/devtools',
routeRef: convertLegacyRouteRef(rootRouteRef),
loader: () =>
import('../components/DevToolsPage').then(m =>
compatWrapper(<m.DevToolsPage />),
),
});
/** @alpha */
export const devToolsNavItem = createNavItemExtension({
title: 'DevTools',
routeRef: convertLegacyRouteRef(rootRouteRef),
icon: BuildIcon,
});
/** @alpha */
export default createPlugin({
id: 'devtools',
routes: {
root: convertLegacyRouteRef(rootRouteRef),
},
extensions: [devToolsApi, devToolsPage, devToolsNavItem],
});