From b9827143b0f1e833903800487f10a21d2c540b3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl-Erik=20Bergstr=C3=B6m?= Date: Wed, 5 Jul 2023 15:39:12 +0200 Subject: [PATCH] chore(org): update api-report MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Carl-Erik Bergström --- plugins/org/api-report.md | 14 ++++++++++++-- .../Cards/OwnershipCard/ComponentsGrid.tsx | 4 ++-- .../Cards/OwnershipCard/OwnershipCard.tsx | 6 ++++-- .../Cards/OwnershipCard/useGetEntities.ts | 11 ++++++----- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/plugins/org/api-report.md b/plugins/org/api-report.md index 7f21bfbb6b..a55e069dac 100644 --- a/plugins/org/api-report.md +++ b/plugins/org/api-report.md @@ -10,6 +10,12 @@ import { ExternalRouteRef } from '@backstage/core-plugin-api'; import { IconComponent } from '@backstage/core-plugin-api'; import { InfoCardVariants } from '@backstage/core-components'; +// @public (undocumented) +export const DefaultRelationType: { + readonly Direct: 'direct'; + readonly Aggregated: 'aggregated'; +}; + // @public (undocumented) export const EntityGroupProfileCard: (props: { variant?: InfoCardVariants | undefined; @@ -28,7 +34,7 @@ export const EntityOwnershipCard: (props: { variant?: InfoCardVariants | undefined; entityFilterKind?: string[] | undefined; hideRelationsToggle?: boolean | undefined; - relationsType?: string | undefined; + relationsType?: RelationType | undefined; entityLimit?: number | undefined; }) => JSX.Element; @@ -75,10 +81,14 @@ export const OwnershipCard: (props: { variant?: InfoCardVariants; entityFilterKind?: string[]; hideRelationsToggle?: boolean; - relationsType?: string; + relationsType?: RelationType; entityLimit?: number; }) => JSX.Element; +// @public (undocumented) +export type RelationType = + (typeof DefaultRelationType)[keyof typeof DefaultRelationType]; + // @public (undocumented) export const UserProfileCard: (props: { variant?: InfoCardVariants; diff --git a/plugins/org/src/components/Cards/OwnershipCard/ComponentsGrid.tsx b/plugins/org/src/components/Cards/OwnershipCard/ComponentsGrid.tsx index 05c1ac8d7e..ce2f12eaaf 100644 --- a/plugins/org/src/components/Cards/OwnershipCard/ComponentsGrid.tsx +++ b/plugins/org/src/components/Cards/OwnershipCard/ComponentsGrid.tsx @@ -33,7 +33,7 @@ import { import React from 'react'; import pluralize from 'pluralize'; import { catalogIndexRouteRef } from '../../../routes'; -import { AnyRelationsType, useGetEntities } from './useGetEntities'; +import { RelationType, useGetEntities } from './useGetEntities'; const useStyles = makeStyles((theme: BackstageTheme) => createStyles({ @@ -113,7 +113,7 @@ export const ComponentsGrid = ({ entityLimit = 6, }: { entity: Entity; - relationsType: AnyRelationsType; + relationsType: RelationType; entityFilterKind?: string[]; entityLimit?: number; }) => { diff --git a/plugins/org/src/components/Cards/OwnershipCard/OwnershipCard.tsx b/plugins/org/src/components/Cards/OwnershipCard/OwnershipCard.tsx index ae3c12c01b..5fb555087c 100644 --- a/plugins/org/src/components/Cards/OwnershipCard/OwnershipCard.tsx +++ b/plugins/org/src/components/Cards/OwnershipCard/OwnershipCard.tsx @@ -27,7 +27,9 @@ import { } from '@material-ui/core'; import React, { useState } from 'react'; import { ComponentsGrid } from './ComponentsGrid'; -import { AnyRelationsType, DefaultRelationType } from './useGetEntities'; +import { type RelationType, DefaultRelationType } from './useGetEntities'; + +export { type RelationType, DefaultRelationType } from './useGetEntities'; const useStyles = makeStyles(theme => ({ list: { @@ -57,7 +59,7 @@ export const OwnershipCard = (props: { variant?: InfoCardVariants; entityFilterKind?: string[]; hideRelationsToggle?: boolean; - relationsType?: AnyRelationsType; + relationsType?: RelationType; entityLimit?: number; }) => { const { diff --git a/plugins/org/src/components/Cards/OwnershipCard/useGetEntities.ts b/plugins/org/src/components/Cards/OwnershipCard/useGetEntities.ts index 13390b4233..c66518866a 100644 --- a/plugins/org/src/components/Cards/OwnershipCard/useGetEntities.ts +++ b/plugins/org/src/components/Cards/OwnershipCard/useGetEntities.ts @@ -122,7 +122,7 @@ const getChildOwnershipEntityRefs = async ( const getOwners = async ( entity: Entity, - relationsType: AnyRelationsType, + relationsType: RelationType, catalogApi: CatalogApi, ): Promise => { const isGroup = entity.kind === 'Group'; @@ -148,14 +148,15 @@ const getOwners = async ( return owners; }; +/** @public */ export const DefaultRelationType = { Direct: 'direct', Aggregated: 'aggregated', } as const; -export type AnyRelationsType = - | (typeof DefaultRelationType)[keyof typeof DefaultRelationType] - | string; +/** @public */ +export type RelationType = + (typeof DefaultRelationType)[keyof typeof DefaultRelationType]; const getOwnedEntitiesByOwners = ( owners: string[], @@ -180,7 +181,7 @@ const getOwnedEntitiesByOwners = ( export function useGetEntities( entity: Entity, - relationsType: AnyRelationsType, + relationsType: RelationType, entityFilterKind?: string[], entityLimit = 6, ): {