refactor: apply review suggestions
Signed-off-by: Camila Belo <camilaibs@gmail.com>
This commit is contained in:
@@ -35,7 +35,10 @@ import {
|
||||
convertLegacyRouteRef,
|
||||
convertLegacyRouteRefs,
|
||||
} from '@backstage/core-compat-api';
|
||||
import { EntityContentBlueprint } from '@backstage/plugin-catalog-react/alpha';
|
||||
import {
|
||||
EntityContentBlueprint,
|
||||
EntityIconLinkBlueprint,
|
||||
} from '@backstage/plugin-catalog-react/alpha';
|
||||
import { SearchResultListItemBlueprint } from '@backstage/plugin-search-react/alpha';
|
||||
import { AddonBlueprint } from '@backstage/plugin-techdocs-react/alpha';
|
||||
import { TechDocsClient, TechDocsStorageClient } from './client';
|
||||
@@ -43,15 +46,36 @@ import {
|
||||
rootCatalogDocsRouteRef,
|
||||
rootDocsRouteRef,
|
||||
rootRouteRef,
|
||||
viewTechDocRouteRef,
|
||||
} from './routes';
|
||||
import { TechDocsReaderLayout } from './reader';
|
||||
import { attachTechDocsAddonComponentData } from '@backstage/plugin-techdocs-react/alpha';
|
||||
import {
|
||||
attachTechDocsAddonComponentData,
|
||||
useTechdocsReaderIconLinkProps,
|
||||
} from '@backstage/plugin-techdocs-react/alpha';
|
||||
import {
|
||||
TechDocsAddons,
|
||||
techdocsApiRef,
|
||||
techdocsStorageApiRef,
|
||||
} from '@backstage/plugin-techdocs-react';
|
||||
|
||||
import { techdocsTranslationRef } from './translation';
|
||||
|
||||
export { techdocsTranslationRef } from './translation';
|
||||
|
||||
/** @alpha */
|
||||
const techdocsEntityIconLink = EntityIconLinkBlueprint.make({
|
||||
name: 'read-docs',
|
||||
params: {
|
||||
useProps: () => {
|
||||
return useTechdocsReaderIconLinkProps({
|
||||
translationRef: techdocsTranslationRef,
|
||||
externalRouteRef: viewTechDocRouteRef,
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
/** @alpha */
|
||||
const techDocsStorageApi = ApiBlueprint.make({
|
||||
name: 'storage',
|
||||
@@ -243,6 +267,7 @@ export default createFrontendPlugin({
|
||||
techDocsNavItem,
|
||||
techDocsPage,
|
||||
techDocsReaderPage,
|
||||
techdocsEntityIconLink,
|
||||
techDocsEntityContent,
|
||||
techDocsEntityContentEmptyState,
|
||||
techDocsSearchResultListItemExtension,
|
||||
@@ -252,4 +277,7 @@ export default createFrontendPlugin({
|
||||
docRoot: rootDocsRouteRef,
|
||||
entityContent: rootCatalogDocsRouteRef,
|
||||
}),
|
||||
externalRoutes: convertLegacyRouteRefs({
|
||||
viewTechDoc: viewTechDocRouteRef,
|
||||
}),
|
||||
});
|
||||
|
||||
@@ -14,7 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { createRouteRef } from '@backstage/core-plugin-api';
|
||||
import {
|
||||
createRouteRef,
|
||||
createExternalRouteRef,
|
||||
} from '@backstage/core-plugin-api';
|
||||
|
||||
export const rootRouteRef = createRouteRef({
|
||||
id: 'techdocs:index-page',
|
||||
@@ -28,3 +31,10 @@ export const rootDocsRouteRef = createRouteRef({
|
||||
export const rootCatalogDocsRouteRef = createRouteRef({
|
||||
id: 'techdocs:catalog-reader-view',
|
||||
});
|
||||
|
||||
export const viewTechDocRouteRef = createExternalRouteRef({
|
||||
id: 'view-techdoc',
|
||||
optional: true,
|
||||
params: ['namespace', 'kind', 'name'],
|
||||
defaultTarget: 'techdocs.docRoot',
|
||||
});
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright 2025 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 { createTranslationRef } from '@backstage/core-plugin-api/alpha';
|
||||
|
||||
/** @alpha */
|
||||
export const techdocsTranslationRef = createTranslationRef({
|
||||
id: 'techdocs',
|
||||
messages: {
|
||||
aboutCard: {
|
||||
viewTechdocs: 'View TechDocs',
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user