update comments and api reports

Signed-off-by: Chris Suich <csuich2@gmail.com>
This commit is contained in:
Chris Suich
2025-04-28 14:07:39 -04:00
parent ae717aa54c
commit 3dfede520a
3 changed files with 38 additions and 0 deletions
+17
View File
@@ -27,6 +27,12 @@ import {
} from '@backstage/plugin-techdocs-common';
import { RouteFunc } from '@backstage/core-plugin-api';
/**
* The RouteFunc used by buildTechDocsURL() to build the TechDocs link for
* an entity.
*
* @public
*/
export type TechDocsRouteFunc = RouteFunc<{
namespace: string;
kind: string;
@@ -52,6 +58,11 @@ export function toLowercaseEntityRefMaybe(
return entityRef;
}
/**
* Get the entity path annotation from the given entity and ensure it starts with a slash.
*
* @public
*/
export function getEntityRootTechDocsPath(entity: Entity): string {
let path = entity.metadata.annotations?.[TECHDOCS_EXTERNAL_PATH_ANNOTATION];
if (!path) {
@@ -63,6 +74,12 @@ export function getEntityRootTechDocsPath(entity: Entity): string {
return path;
}
/**
* Build the TechDocs URL for the given entity. This helper should be used anywhere there
* is a link to an entities TechDocs.
*
* @public
*/
export const buildTechDocsURL = (
entity: Entity,
routeFunc: TechDocsRouteFunc | undefined,