From 99063c39ae20c1f8cee740f0f4b2839abe295660 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Fri, 1 Apr 2022 14:59:50 +0200 Subject: [PATCH] just some more api report cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .changeset/silver-drinks-study.md | 9 +++ plugins/catalog-graph/api-report.md | 35 +---------- .../CatalogGraphCard/CatalogGraphCard.tsx | 29 +++++---- .../CatalogGraphPage/CatalogGraphPage.tsx | 8 +-- .../EntityRelationsGraph.tsx | 33 +++++----- plugins/catalog-react/api-report.md | 5 +- .../UnregisterEntityDialog.test.tsx | 4 +- .../useUnregisterEntityDialogState.test.tsx | 4 +- .../UserListPicker/UserListPicker.test.tsx | 4 +- plugins/catalog-react/src/hooks/useEntity.tsx | 8 +-- .../src/hooks/useEntityOwnership.test.tsx | 4 +- .../src/hooks/useStarredEntities.test.tsx | 4 +- .../src/hooks/useStarredEntity.test.tsx | 4 +- plugins/graphiql/api-report.md | 24 +------ .../GraphiQLBrowser/GraphiQLBrowser.tsx | 4 +- .../components/GraphiQLPage/GraphiQLPage.tsx | 1 + plugins/graphiql/src/index.ts | 2 + .../graphiql/src/lib/api/GraphQLEndpoints.ts | 8 ++- plugins/graphiql/src/lib/api/types.ts | 3 + plugins/graphiql/src/plugin.ts | 2 + plugins/graphiql/src/route-refs.tsx | 1 + plugins/home/api-report.md | 53 ++-------------- .../componentRenderers/ComponentAccordion.tsx | 20 +++--- .../ComponentTabs/ComponentTab.tsx | 9 +-- .../ComponentTabs/ComponentTabs.tsx | 10 +-- .../HeaderWorldClock/HeaderWorldClock.tsx | 9 ++- plugins/home/src/components/SettingsModal.tsx | 9 +-- plugins/home/src/extensions.tsx | 8 +-- .../homePageComponents/RandomJoke/Context.tsx | 7 +-- .../homePageComponents/Toolkit/Context.tsx | 7 +-- plugins/home/src/plugin.ts | 8 +++ .../src/templates/TemplateBackstageLogo.tsx | 6 +- plugins/org/api-report.md | 62 ++++--------------- .../Group/GroupProfile/GroupProfileCard.tsx | 13 ++-- .../Group/MembersList/MembersListCard.tsx | 15 ++--- .../Cards/OwnershipCard/OwnershipCard.tsx | 8 +-- .../User/UserProfileCard/UserProfileCard.tsx | 16 +++-- .../MyGroupsSidebarItem.tsx | 8 +-- plugins/org/src/plugin.ts | 8 +++ scripts/api-extractor.ts | 2 + 40 files changed, 187 insertions(+), 287 deletions(-) create mode 100644 .changeset/silver-drinks-study.md diff --git a/.changeset/silver-drinks-study.md b/.changeset/silver-drinks-study.md new file mode 100644 index 0000000000..f6547057f2 --- /dev/null +++ b/.changeset/silver-drinks-study.md @@ -0,0 +1,9 @@ +--- +'@backstage/plugin-catalog-graph': patch +'@backstage/plugin-catalog-react': patch +'@backstage/plugin-graphiql': patch +'@backstage/plugin-home': patch +'@backstage/plugin-org': patch +--- + +Minor API report cleanup diff --git a/plugins/catalog-graph/api-report.md b/plugins/catalog-graph/api-report.md index d9d8019fd4..1a2b03a292 100644 --- a/plugins/catalog-graph/api-report.md +++ b/plugins/catalog-graph/api-report.md @@ -18,10 +18,7 @@ import { RouteRef } from '@backstage/core-plugin-api'; export const ALL_RELATION_PAIRS: RelationPairs; // @public -export const CatalogGraphPage: ({ - relationPairs, - initialState, -}: { +export const CatalogGraphPage: (props: { relationPairs?: RelationPairs | undefined; initialState?: | { @@ -66,19 +63,7 @@ export enum Direction { } // @public -export const EntityCatalogGraphCard: ({ - variant, - relationPairs, - maxDepth, - unidirectional, - mergeRelations, - kinds, - relations, - direction, - height, - title, - zoom, -}: { +export const EntityCatalogGraphCard: (props: { variant?: InfoCardVariants | undefined; relationPairs?: RelationPairs | undefined; maxDepth?: number | undefined; @@ -116,21 +101,7 @@ export type EntityNodeData = { }; // @public -export const EntityRelationsGraph: ({ - rootEntityNames, - maxDepth, - unidirectional, - mergeRelations, - kinds, - relations, - direction, - onNodeClick, - relationPairs, - className, - zoom, - renderNode, - renderLabel, -}: { +export const EntityRelationsGraph: (props: { rootEntityNames: CompoundEntityRef | CompoundEntityRef[]; maxDepth?: number | undefined; unidirectional?: boolean | undefined; diff --git a/plugins/catalog-graph/src/components/CatalogGraphCard/CatalogGraphCard.tsx b/plugins/catalog-graph/src/components/CatalogGraphCard/CatalogGraphCard.tsx index 4a21418107..ae1ca9c22d 100644 --- a/plugins/catalog-graph/src/components/CatalogGraphCard/CatalogGraphCard.tsx +++ b/plugins/catalog-graph/src/components/CatalogGraphCard/CatalogGraphCard.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { getCompoundEntityRef, parseEntityRef, @@ -51,19 +52,7 @@ const useStyles = makeStyles({ }, }); -export const CatalogGraphCard = ({ - variant = 'gridItem', - relationPairs = ALL_RELATION_PAIRS, - maxDepth = 1, - unidirectional = true, - mergeRelations = true, - kinds, - relations, - direction = Direction.LEFT_RIGHT, - height, - title = 'Relations', - zoom = 'enable-on-click', -}: { +export const CatalogGraphCard = (props: { variant?: InfoCardVariants; relationPairs?: RelationPairs; maxDepth?: number; @@ -76,6 +65,20 @@ export const CatalogGraphCard = ({ title?: string; zoom?: 'enabled' | 'disabled' | 'enable-on-click'; }) => { + const { + variant = 'gridItem', + relationPairs = ALL_RELATION_PAIRS, + maxDepth = 1, + unidirectional = true, + mergeRelations = true, + kinds, + relations, + direction = Direction.LEFT_RIGHT, + height, + title = 'Relations', + zoom = 'enable-on-click', + } = props; + const { entity } = useEntity(); const entityName = getCompoundEntityRef(entity); const catalogEntityRoute = useRouteRef(entityRouteRef); diff --git a/plugins/catalog-graph/src/components/CatalogGraphPage/CatalogGraphPage.tsx b/plugins/catalog-graph/src/components/CatalogGraphPage/CatalogGraphPage.tsx index 15d0cd139b..8e59c127d9 100644 --- a/plugins/catalog-graph/src/components/CatalogGraphPage/CatalogGraphPage.tsx +++ b/plugins/catalog-graph/src/components/CatalogGraphPage/CatalogGraphPage.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { parseEntityRef } from '@backstage/catalog-model'; import { Content, @@ -98,10 +99,7 @@ const useStyles = makeStyles(theme => ({ }, })); -export const CatalogGraphPage = ({ - relationPairs = ALL_RELATION_PAIRS, - initialState, -}: { +export const CatalogGraphPage = (props: { relationPairs?: RelationPairs; initialState?: { selectedRelations?: string[]; @@ -114,6 +112,8 @@ export const CatalogGraphPage = ({ showFilters?: boolean; }; }) => { + const { relationPairs = ALL_RELATION_PAIRS, initialState } = props; + const navigate = useNavigate(); const classes = useStyles(); const catalogEntityRoute = useRouteRef(entityRouteRef); diff --git a/plugins/catalog-graph/src/components/EntityRelationsGraph/EntityRelationsGraph.tsx b/plugins/catalog-graph/src/components/EntityRelationsGraph/EntityRelationsGraph.tsx index bf3fbf8f3a..81c6a8f3c1 100644 --- a/plugins/catalog-graph/src/components/EntityRelationsGraph/EntityRelationsGraph.tsx +++ b/plugins/catalog-graph/src/components/EntityRelationsGraph/EntityRelationsGraph.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { CompoundEntityRef, stringifyEntityRef, @@ -67,21 +68,7 @@ const useStyles = makeStyles(theme => ({ * * @public */ -export const EntityRelationsGraph = ({ - rootEntityNames, - maxDepth = Number.POSITIVE_INFINITY, - unidirectional = true, - mergeRelations = true, - kinds, - relations, - direction = Direction.LEFT_RIGHT, - onNodeClick, - relationPairs = ALL_RELATION_PAIRS, - className, - zoom = 'enabled', - renderNode, - renderLabel, -}: { +export const EntityRelationsGraph = (props: { rootEntityNames: CompoundEntityRef | CompoundEntityRef[]; maxDepth?: number; unidirectional?: boolean; @@ -96,6 +83,22 @@ export const EntityRelationsGraph = ({ renderNode?: DependencyGraphTypes.RenderNodeFunction; renderLabel?: DependencyGraphTypes.RenderLabelFunction; }) => { + const { + rootEntityNames, + maxDepth = Number.POSITIVE_INFINITY, + unidirectional = true, + mergeRelations = true, + kinds, + relations, + direction = Direction.LEFT_RIGHT, + onNodeClick, + relationPairs = ALL_RELATION_PAIRS, + className, + zoom = 'enabled', + renderNode, + renderLabel, + } = props; + const theme = useTheme(); const classes = useStyles(); const rootEntityRefs = useMemo( diff --git a/plugins/catalog-react/api-report.md b/plugins/catalog-react/api-report.md index 71ba6452da..831a34edc8 100644 --- a/plugins/catalog-react/api-report.md +++ b/plugins/catalog-react/api-report.md @@ -236,10 +236,7 @@ export class EntityOwnerFilter implements EntityFilter { export const EntityOwnerPicker: () => JSX.Element | null; // @public -export const EntityProvider: ({ - entity, - children, -}: EntityProviderProps) => JSX.Element; +export const EntityProvider: (props: EntityProviderProps) => JSX.Element; // @public export interface EntityProviderProps { diff --git a/plugins/catalog-react/src/components/UnregisterEntityDialog/UnregisterEntityDialog.test.tsx b/plugins/catalog-react/src/components/UnregisterEntityDialog/UnregisterEntityDialog.test.tsx index 68cb5f2bdf..fd59c0c036 100644 --- a/plugins/catalog-react/src/components/UnregisterEntityDialog/UnregisterEntityDialog.test.tsx +++ b/plugins/catalog-react/src/components/UnregisterEntityDialog/UnregisterEntityDialog.test.tsx @@ -61,14 +61,14 @@ describe('UnregisterEntityDialog', () => { spec: {}, }; - const Wrapper = ({ children }: { children?: React.ReactNode }) => ( + const Wrapper = (props: { children?: React.ReactNode }) => ( - {children} + {props.children} ); diff --git a/plugins/catalog-react/src/components/UnregisterEntityDialog/useUnregisterEntityDialogState.test.tsx b/plugins/catalog-react/src/components/UnregisterEntityDialog/useUnregisterEntityDialogState.test.tsx index 25af7564d1..e458e7d157 100644 --- a/plugins/catalog-react/src/components/UnregisterEntityDialog/useUnregisterEntityDialogState.test.tsx +++ b/plugins/catalog-react/src/components/UnregisterEntityDialog/useUnregisterEntityDialogState.test.tsx @@ -46,9 +46,9 @@ describe('useUnregisterEntityDialogState', () => { }; const catalogApi = catalogApiMock as Partial as CatalogApi; - const Wrapper = ({ children }: { children?: React.ReactNode }) => ( + const Wrapper = (props: { children?: React.ReactNode }) => ( - {children} + {props.children} ); diff --git a/plugins/catalog-react/src/components/UserListPicker/UserListPicker.test.tsx b/plugins/catalog-react/src/components/UserListPicker/UserListPicker.test.tsx index db3ce7cf5d..e008b1039c 100644 --- a/plugins/catalog-react/src/components/UserListPicker/UserListPicker.test.tsx +++ b/plugins/catalog-react/src/components/UserListPicker/UserListPicker.test.tsx @@ -297,10 +297,10 @@ describe('', () => { `('filter resetting for $type entities', ({ type, filterFn }) => { let updateFilters: jest.Mock; - const picker = ({ loading }: { loading: boolean }) => ( + const picker = (props: { loading: boolean }) => ( diff --git a/plugins/catalog-react/src/hooks/useEntity.tsx b/plugins/catalog-react/src/hooks/useEntity.tsx index 580faf487e..6108a5717f 100644 --- a/plugins/catalog-react/src/hooks/useEntity.tsx +++ b/plugins/catalog-react/src/hooks/useEntity.tsx @@ -85,13 +85,13 @@ export interface EntityProviderProps { * * @public */ -export const EntityProvider = ({ entity, children }: EntityProviderProps) => ( +export const EntityProvider = (props: EntityProviderProps) => ( ); diff --git a/plugins/catalog-react/src/hooks/useEntityOwnership.test.tsx b/plugins/catalog-react/src/hooks/useEntityOwnership.test.tsx index 616e4949c1..dc400b5c90 100644 --- a/plugins/catalog-react/src/hooks/useEntityOwnership.test.tsx +++ b/plugins/catalog-react/src/hooks/useEntityOwnership.test.tsx @@ -37,14 +37,14 @@ describe('useEntityOwnership', () => { const identityApi = mockIdentityApi as unknown as IdentityApi; const catalogApi = mockCatalogApi as unknown as CatalogApi; - const Wrapper = ({ children }: { children?: React.ReactNode }) => ( + const Wrapper = (props: { children?: React.ReactNode }) => ( - {children} + {props.children} ); diff --git a/plugins/catalog-react/src/hooks/useStarredEntities.test.tsx b/plugins/catalog-react/src/hooks/useStarredEntities.test.tsx index 16fa19a1cd..eccad8e17f 100644 --- a/plugins/catalog-react/src/hooks/useStarredEntities.test.tsx +++ b/plugins/catalog-react/src/hooks/useStarredEntities.test.tsx @@ -48,9 +48,9 @@ describe('useStarredEntities', () => { beforeEach(() => { mockApi = new MockStarredEntitiesApi(); - wrapper = ({ children }: PropsWithChildren<{}>) => ( + wrapper = (props: PropsWithChildren<{}>) => ( - {children} + {props.children} ); }); diff --git a/plugins/catalog-react/src/hooks/useStarredEntity.test.tsx b/plugins/catalog-react/src/hooks/useStarredEntity.test.tsx index 317a0e391c..77bd16c636 100644 --- a/plugins/catalog-react/src/hooks/useStarredEntity.test.tsx +++ b/plugins/catalog-react/src/hooks/useStarredEntity.test.tsx @@ -30,9 +30,9 @@ describe('useStarredEntity', () => { let wrapper: React.ComponentType; beforeEach(() => { - wrapper = ({ children }: PropsWithChildren<{}>) => ( + wrapper = (props: PropsWithChildren<{}>) => ( - {children} + {props.children} ); }); diff --git a/plugins/graphiql/api-report.md b/plugins/graphiql/api-report.md index 110d3b315d..5c613b1f57 100644 --- a/plugins/graphiql/api-report.md +++ b/plugins/graphiql/api-report.md @@ -12,9 +12,7 @@ import { IconComponent } from '@backstage/core-plugin-api'; import { OAuthApi } from '@backstage/core-plugin-api'; import { RouteRef } from '@backstage/core-plugin-api'; -// Warning: (ae-missing-release-tag) "EndpointConfig" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) +// @public export type EndpointConfig = { id: string; title: string; @@ -25,8 +23,6 @@ export type EndpointConfig = { }; }; -// Warning: (ae-missing-release-tag) "GithubEndpointConfig" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export type GithubEndpointConfig = { id: string; @@ -36,42 +32,28 @@ export type GithubEndpointConfig = { githubAuthApi: OAuthApi; }; -// Warning: (ae-missing-release-tag) "GraphiQLIcon" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export const GraphiQLIcon: IconComponent; -// Warning: (ae-missing-release-tag) "GraphiQLPage" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export const GraphiQLPage: () => JSX.Element; -// Warning: (ae-missing-release-tag) "graphiqlPlugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) const graphiqlPlugin: BackstagePlugin<{}, {}>; export { graphiqlPlugin }; export { graphiqlPlugin as plugin }; -// Warning: (ae-missing-release-tag) "graphiQLRouteRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export const graphiQLRouteRef: RouteRef; -// Warning: (ae-missing-release-tag) "GraphQLBrowseApi" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export type GraphQLBrowseApi = { getEndpoints(): Promise; }; -// Warning: (ae-missing-release-tag) "graphQlBrowseApiRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export const graphQlBrowseApiRef: ApiRef; -// Warning: (ae-missing-release-tag) "GraphQLEndpoint" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export type GraphQLEndpoint = { id: string; @@ -79,8 +61,6 @@ export type GraphQLEndpoint = { fetcher: (body: any) => Promise; }; -// Warning: (ae-missing-release-tag) "GraphQLEndpoints" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export class GraphQLEndpoints implements GraphQLBrowseApi { // (undocumented) @@ -92,8 +72,6 @@ export class GraphQLEndpoints implements GraphQLBrowseApi { static github(config: GithubEndpointConfig): GraphQLEndpoint; } -// Warning: (ae-missing-release-tag) "GraphiQLPage" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export const Router: () => JSX.Element; diff --git a/plugins/graphiql/src/components/GraphiQLBrowser/GraphiQLBrowser.tsx b/plugins/graphiql/src/components/GraphiQLBrowser/GraphiQLBrowser.tsx index 2bd173f720..87419aec94 100644 --- a/plugins/graphiql/src/components/GraphiQLBrowser/GraphiQLBrowser.tsx +++ b/plugins/graphiql/src/components/GraphiQLBrowser/GraphiQLBrowser.tsx @@ -47,7 +47,9 @@ type GraphiQLBrowserProps = { endpoints: GraphQLEndpoint[]; }; -export const GraphiQLBrowser = ({ endpoints }: GraphiQLBrowserProps) => { +export const GraphiQLBrowser = (props: GraphiQLBrowserProps) => { + const { endpoints } = props; + const classes = useStyles(); const [tabIndex, setTabIndex] = useState(0); diff --git a/plugins/graphiql/src/components/GraphiQLPage/GraphiQLPage.tsx b/plugins/graphiql/src/components/GraphiQLPage/GraphiQLPage.tsx index e987ee10fa..0b4399948a 100644 --- a/plugins/graphiql/src/components/GraphiQLPage/GraphiQLPage.tsx +++ b/plugins/graphiql/src/components/GraphiQLPage/GraphiQLPage.tsx @@ -28,6 +28,7 @@ import { Progress, } from '@backstage/core-components'; +/** @public */ export const GraphiQLPage = () => { const graphQlBrowseApi = useApi(graphQlBrowseApiRef); const endpoints = useAsync(() => graphQlBrowseApi.getEndpoints()); diff --git a/plugins/graphiql/src/index.ts b/plugins/graphiql/src/index.ts index 15568b4cf8..284b78fa35 100644 --- a/plugins/graphiql/src/index.ts +++ b/plugins/graphiql/src/index.ts @@ -31,5 +31,7 @@ export { export { GraphiQLPage as Router } from './components'; export * from './lib/api'; export * from './route-refs'; + +/** @public */ export const GraphiQLIcon: IconComponent = GraphiQLIconComponent as IconComponent; diff --git a/plugins/graphiql/src/lib/api/GraphQLEndpoints.ts b/plugins/graphiql/src/lib/api/GraphQLEndpoints.ts index 026911bdeb..7287eb579b 100644 --- a/plugins/graphiql/src/lib/api/GraphQLEndpoints.ts +++ b/plugins/graphiql/src/lib/api/GraphQLEndpoints.ts @@ -17,7 +17,11 @@ import { GraphQLBrowseApi, GraphQLEndpoint } from './types'; import { ErrorApi, OAuthApi } from '@backstage/core-plugin-api'; -// Helper for generic http endpoints +/** + * Helper for generic http endpoints + * + * @public + */ export type EndpointConfig = { id: string; title: string; @@ -29,6 +33,7 @@ export type EndpointConfig = { headers?: { [name in string]: string }; }; +/** @public */ export type GithubEndpointConfig = { id: string; title: string; @@ -46,6 +51,7 @@ export type GithubEndpointConfig = { githubAuthApi: OAuthApi; }; +/** @public */ export class GraphQLEndpoints implements GraphQLBrowseApi { // Create a support static create(config: EndpointConfig): GraphQLEndpoint { diff --git a/plugins/graphiql/src/lib/api/types.ts b/plugins/graphiql/src/lib/api/types.ts index 21eaae4f83..9ba0ca7dff 100644 --- a/plugins/graphiql/src/lib/api/types.ts +++ b/plugins/graphiql/src/lib/api/types.ts @@ -16,6 +16,7 @@ import { createApiRef } from '@backstage/core-plugin-api'; +/** @public */ export type GraphQLEndpoint = { // Will be used as unique key for storing history and query data id: string; @@ -29,10 +30,12 @@ export type GraphQLEndpoint = { fetcher: (body: any) => Promise; }; +/** @public */ export type GraphQLBrowseApi = { getEndpoints(): Promise; }; +/** @public */ export const graphQlBrowseApiRef = createApiRef({ id: 'plugin.graphiql.browse', }); diff --git a/plugins/graphiql/src/plugin.ts b/plugins/graphiql/src/plugin.ts index ce30d5432b..88e33b5c3a 100644 --- a/plugins/graphiql/src/plugin.ts +++ b/plugins/graphiql/src/plugin.ts @@ -22,6 +22,7 @@ import { import { graphQlBrowseApiRef, GraphQLEndpoints } from './lib/api'; import { graphiQLRouteRef } from './route-refs'; +/** @public */ export const graphiqlPlugin = createPlugin({ id: 'graphiql', apis: [ @@ -40,6 +41,7 @@ export const graphiqlPlugin = createPlugin({ ], }); +/** @public */ export const GraphiQLPage = graphiqlPlugin.provide( createRoutableExtension({ name: 'GraphiQLPage', diff --git a/plugins/graphiql/src/route-refs.tsx b/plugins/graphiql/src/route-refs.tsx index 250ed14642..7dce22e77c 100644 --- a/plugins/graphiql/src/route-refs.tsx +++ b/plugins/graphiql/src/route-refs.tsx @@ -16,6 +16,7 @@ import { createRouteRef } from '@backstage/core-plugin-api'; +/** @public */ export const graphiQLRouteRef = createRouteRef({ id: 'graphiql-root', }); diff --git a/plugins/home/api-report.md b/plugins/home/api-report.md index d5f5c52ea1..9bd577da7c 100644 --- a/plugins/home/api-report.md +++ b/plugins/home/api-report.md @@ -19,18 +19,8 @@ export type ClockConfig = { timeZone: string; }; -// Warning: (ae-missing-release-tag) "ComponentAccordion" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) -export const ComponentAccordion: ({ - title, - expanded, - Content, - Actions, - Settings, - ContextProvider, - ...childProps -}: { +export const ComponentAccordion: (props: { title: string; expanded?: boolean | undefined; Content: () => JSX.Element; @@ -44,27 +34,15 @@ export type ComponentRenderer = { Renderer?: (props: RendererProps) => JSX.Element; }; -// Warning: (ae-missing-release-tag) "ComponentTab" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) -export const ComponentTab: ({ - title, - Content, - ContextProvider, - ...childProps -}: { +export const ComponentTab: (props: { title: string; Content: () => JSX.Element; ContextProvider?: ((props: any) => JSX.Element) | undefined; }) => JSX.Element; -// Warning: (ae-missing-release-tag) "ComponentTabs" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) -export const ComponentTabs: ({ - title, - tabs, -}: { +export const ComponentTabs: (props: { title: string; tabs: { label: string; @@ -75,22 +53,14 @@ export const ComponentTabs: ({ // Warning: (ae-forgotten-export) The symbol "CardExtensionProps" needs to be exported by the entry point index.d.ts // // @public -export function createCardExtension({ - title, - components, - name, -}: { +export function createCardExtension(options: { title: string; components: () => Promise; name?: string; }): Extension<(props: CardExtensionProps) => JSX.Element>; -// Warning: (ae-missing-release-tag) "HeaderWorldClock" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) -export const HeaderWorldClock: ({ - clockConfigs, -}: { +export const HeaderWorldClock: (props: { clockConfigs: ClockConfig[]; }) => JSX.Element | null; @@ -100,16 +70,12 @@ export const HomePageCompanyLogo: (props: { className?: string | undefined; }) => JSX.Element; -// Warning: (ae-missing-release-tag) "HomepageCompositionRoot" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export const HomepageCompositionRoot: (props: { title?: string | undefined; children?: ReactNode; }) => JSX.Element; -// Warning: (ae-missing-release-tag) "HomePageRandomJoke" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export const HomePageRandomJoke: ( props: ComponentRenderer & { @@ -135,8 +101,6 @@ export const HomePageToolkit: ( } & ToolkitContentProps, ) => JSX.Element; -// Warning: (ae-missing-release-tag) "homePlugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export const homePlugin: BackstagePlugin< { @@ -148,12 +112,7 @@ export const homePlugin: BackstagePlugin< // Warning: (ae-missing-release-tag) "SettingsModal" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) -export const SettingsModal: ({ - open, - close, - componentName, - children, -}: { +export const SettingsModal: (props: { open: boolean; close: Function; componentName: string; diff --git a/plugins/home/src/componentRenderers/ComponentAccordion.tsx b/plugins/home/src/componentRenderers/ComponentAccordion.tsx index ef44f7f292..8b9795c9c3 100644 --- a/plugins/home/src/componentRenderers/ComponentAccordion.tsx +++ b/plugins/home/src/componentRenderers/ComponentAccordion.tsx @@ -38,15 +38,7 @@ const useStyles = makeStyles((theme: Theme) => ({ }, })); -export const ComponentAccordion = ({ - title, - expanded = false, - Content, - Actions, - Settings, - ContextProvider, - ...childProps -}: { +export const ComponentAccordion = (props: { title: string; expanded?: boolean; Content: () => JSX.Element; @@ -54,6 +46,16 @@ export const ComponentAccordion = ({ Settings?: () => JSX.Element; ContextProvider?: (props: any) => JSX.Element; }) => { + const { + title, + expanded = false, + Content, + Actions, + Settings, + ContextProvider, + ...childProps + } = props; + const classes = useStyles(); const [settingsIsExpanded, setSettingsIsExpanded] = React.useState(false); const [isExpanded, setIsExpanded] = React.useState(expanded); diff --git a/plugins/home/src/componentRenderers/ComponentTabs/ComponentTab.tsx b/plugins/home/src/componentRenderers/ComponentTabs/ComponentTab.tsx index 2b3e4e746c..b195076297 100644 --- a/plugins/home/src/componentRenderers/ComponentTabs/ComponentTab.tsx +++ b/plugins/home/src/componentRenderers/ComponentTabs/ComponentTab.tsx @@ -16,16 +16,13 @@ import React from 'react'; -export const ComponentTab = ({ - title, - Content, - ContextProvider, - ...childProps -}: { +export const ComponentTab = (props: { title: string; Content: () => JSX.Element; ContextProvider?: (props: any) => JSX.Element; }) => { + const { title, Content, ContextProvider, ...childProps } = props; + return ContextProvider ? ( diff --git a/plugins/home/src/componentRenderers/ComponentTabs/ComponentTabs.tsx b/plugins/home/src/componentRenderers/ComponentTabs/ComponentTabs.tsx index d6d3561fe1..20fc9c79b6 100644 --- a/plugins/home/src/componentRenderers/ComponentTabs/ComponentTabs.tsx +++ b/plugins/home/src/componentRenderers/ComponentTabs/ComponentTabs.tsx @@ -23,13 +23,9 @@ type TabType = { Component: () => JSX.Element; }; -export const ComponentTabs = ({ - title, - tabs, -}: { - title: string; - tabs: TabType[]; -}) => { +export const ComponentTabs = (props: { title: string; tabs: TabType[] }) => { + const { title, tabs } = props; + const [value, setValue] = React.useState(0); const handleChange = (_event: any, newValue: number) => { diff --git a/plugins/home/src/components/HeaderWorldClock/HeaderWorldClock.tsx b/plugins/home/src/components/HeaderWorldClock/HeaderWorldClock.tsx index 32bf305020..7e3065cc7a 100644 --- a/plugins/home/src/components/HeaderWorldClock/HeaderWorldClock.tsx +++ b/plugins/home/src/components/HeaderWorldClock/HeaderWorldClock.tsx @@ -68,11 +68,10 @@ function getTimes(clockConfigs: ClockConfig[]) { return clocks; } -export const HeaderWorldClock = ({ - clockConfigs, -}: { - clockConfigs: ClockConfig[]; -}) => { +/** @public */ +export const HeaderWorldClock = (props: { clockConfigs: ClockConfig[] }) => { + const { clockConfigs } = props; + const defaultTimes: TimeObj[] = []; const [clocks, setTimes] = React.useState(defaultTimes); diff --git a/plugins/home/src/components/SettingsModal.tsx b/plugins/home/src/components/SettingsModal.tsx index 25566bccdf..4ee25f9f5c 100644 --- a/plugins/home/src/components/SettingsModal.tsx +++ b/plugins/home/src/components/SettingsModal.tsx @@ -23,17 +23,14 @@ import { DialogTitle, } from '@material-ui/core'; -export const SettingsModal = ({ - open, - close, - componentName, - children, -}: { +export const SettingsModal = (props: { open: boolean; close: Function; componentName: string; children: JSX.Element; }) => { + const { open, close, componentName, children } = props; + return ( close()}> Settings - {componentName} diff --git a/plugins/home/src/extensions.tsx b/plugins/home/src/extensions.tsx index 4139e301a3..f1edbc99b6 100644 --- a/plugins/home/src/extensions.tsx +++ b/plugins/home/src/extensions.tsx @@ -44,15 +44,13 @@ type CardExtensionProps = ComponentRenderer & { title?: string } & T; * * @public */ -export function createCardExtension({ - title, - components, - name, -}: { +export function createCardExtension(options: { title: string; components: () => Promise; name?: string; }) { + const { title, components, name } = options; + return createReactExtension({ name, component: { diff --git a/plugins/home/src/homePageComponents/RandomJoke/Context.tsx b/plugins/home/src/homePageComponents/RandomJoke/Context.tsx index 5c2790d8a5..f1f061d4a7 100644 --- a/plugins/home/src/homePageComponents/RandomJoke/Context.tsx +++ b/plugins/home/src/homePageComponents/RandomJoke/Context.tsx @@ -42,13 +42,12 @@ const getNewJoke = (type: string): Promise => .then(res => res.json()) .then(data => (Array.isArray(data) ? data[0] : data)); -export const ContextProvider = ({ - children, - defaultCategory, -}: { +export const ContextProvider = (props: { children: JSX.Element; defaultCategory?: JokeType; }) => { + const { children, defaultCategory } = props; + const [loading, setLoading] = React.useState(true); const [joke, setJoke] = React.useState({ setup: '', diff --git a/plugins/home/src/homePageComponents/Toolkit/Context.tsx b/plugins/home/src/homePageComponents/Toolkit/Context.tsx index ab614ca01f..3e7b121252 100644 --- a/plugins/home/src/homePageComponents/Toolkit/Context.tsx +++ b/plugins/home/src/homePageComponents/Toolkit/Context.tsx @@ -28,13 +28,12 @@ type ToolkitContextValue = { const Context = createContext(undefined); -export const ContextProvider = ({ - children, - tools, -}: { +export const ContextProvider = (props: { children: JSX.Element; tools: Tool[]; }) => { + const { children, tools } = props; + const [toolsValue, _setTools] = React.useState(tools); const value: ToolkitContextValue = { diff --git a/plugins/home/src/plugin.ts b/plugins/home/src/plugin.ts index 32005a9064..93110faffb 100644 --- a/plugins/home/src/plugin.ts +++ b/plugins/home/src/plugin.ts @@ -23,6 +23,7 @@ import { ToolkitContentProps } from './homePageComponents'; import { rootRouteRef } from './routes'; +/** @public */ export const homePlugin = createPlugin({ id: 'home', routes: { @@ -30,6 +31,7 @@ export const homePlugin = createPlugin({ }, }); +/** @public */ export const HomepageCompositionRoot = homePlugin.provide( createRoutableExtension({ name: 'HomepageCompositionRoot', @@ -39,6 +41,7 @@ export const HomepageCompositionRoot = homePlugin.provide( }), ); +/** @public */ export const ComponentAccordion = homePlugin.provide( createComponentExtension({ name: 'ComponentAccordion', @@ -48,6 +51,8 @@ export const ComponentAccordion = homePlugin.provide( }, }), ); + +/** @public */ export const ComponentTabs = homePlugin.provide( createComponentExtension({ name: 'ComponentTabs', @@ -56,6 +61,8 @@ export const ComponentTabs = homePlugin.provide( }, }), ); + +/** @public */ export const ComponentTab = homePlugin.provide( createComponentExtension({ name: 'ComponentTab', @@ -95,6 +102,7 @@ export const HomePageCompanyLogo = homePlugin.provide( }), ); +/** @public */ export const HomePageRandomJoke = homePlugin.provide( createCardExtension<{ defaultCategory?: 'any' | 'programming' }>({ name: 'HomePageRandomJoke', diff --git a/plugins/home/src/templates/TemplateBackstageLogo.tsx b/plugins/home/src/templates/TemplateBackstageLogo.tsx index c5bca1f773..edce9bb02e 100644 --- a/plugins/home/src/templates/TemplateBackstageLogo.tsx +++ b/plugins/home/src/templates/TemplateBackstageLogo.tsx @@ -21,15 +21,15 @@ type Classes = { path: string; } -export const TemplateBackstageLogo = ({ classes }: { classes: Classes }) => { +export const TemplateBackstageLogo = (props: { classes: Classes }) => { return ( diff --git a/plugins/org/api-report.md b/plugins/org/api-report.md index 1050b2aaff..60d0b20ffc 100644 --- a/plugins/org/api-report.md +++ b/plugins/org/api-report.md @@ -10,73 +10,46 @@ import { ExternalRouteRef } from '@backstage/core-plugin-api'; import { IconComponent } from '@backstage/core-plugin-api'; import { InfoCardVariants } from '@backstage/core-components'; -// Warning: (ae-missing-release-tag) "EntityGroupProfileCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) -export const EntityGroupProfileCard: ({ - variant, -}: { +export const EntityGroupProfileCard: (props: { variant?: InfoCardVariants | undefined; }) => JSX.Element; -// Warning: (ae-missing-release-tag) "EntityMembersListCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) -export const EntityMembersListCard: (_props: { +export const EntityMembersListCard: (props: { memberDisplayTitle?: string | undefined; pageSize?: number | undefined; }) => JSX.Element; -// Warning: (ae-missing-release-tag) "EntityOwnershipCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) -export const EntityOwnershipCard: ({ - variant, - entityFilterKind, -}: { +export const EntityOwnershipCard: (props: { variant?: InfoCardVariants | undefined; entityFilterKind?: string[] | undefined; }) => JSX.Element; -// Warning: (ae-missing-release-tag) "EntityUserProfileCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) -export const EntityUserProfileCard: ({ - variant, -}: { +export const EntityUserProfileCard: (props: { variant?: InfoCardVariants | undefined; }) => JSX.Element; -// Warning: (ae-missing-release-tag) "GroupProfileCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) -export const GroupProfileCard: ({ - variant, -}: { - variant?: InfoCardVariants | undefined; +export const GroupProfileCard: (props: { + variant?: InfoCardVariants; }) => JSX.Element; -// Warning: (ae-missing-release-tag) "MembersListCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) -export const MembersListCard: (_props: { +export const MembersListCard: (props: { memberDisplayTitle?: string; pageSize?: number; }) => JSX.Element; // @public -export const MyGroupsSidebarItem: ({ - singularTitle, - pluralTitle, - icon, -}: { +export const MyGroupsSidebarItem: (props: { singularTitle: string; pluralTitle: string; icon: IconComponent; }) => JSX.Element | null; -// Warning: (ae-missing-release-tag) "orgPlugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) const orgPlugin: BackstagePlugin< {}, @@ -87,23 +60,14 @@ const orgPlugin: BackstagePlugin< export { orgPlugin }; export { orgPlugin as plugin }; -// Warning: (ae-missing-release-tag) "OwnershipCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) -export const OwnershipCard: ({ - variant, - entityFilterKind, -}: { - variant?: InfoCardVariants | undefined; - entityFilterKind?: string[] | undefined; +export const OwnershipCard: (props: { + variant?: InfoCardVariants; + entityFilterKind?: string[]; }) => JSX.Element; -// Warning: (ae-missing-release-tag) "UserProfileCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) -export const UserProfileCard: ({ - variant, -}: { - variant?: InfoCardVariants | undefined; +export const UserProfileCard: (props: { + variant?: InfoCardVariants; }) => JSX.Element; ``` diff --git a/plugins/org/src/components/Cards/Group/GroupProfile/GroupProfileCard.tsx b/plugins/org/src/components/Cards/Group/GroupProfile/GroupProfileCard.tsx index 88167eb062..174067275d 100644 --- a/plugins/org/src/components/Cards/Group/GroupProfile/GroupProfileCard.tsx +++ b/plugins/org/src/components/Cards/Group/GroupProfile/GroupProfileCard.tsx @@ -53,18 +53,15 @@ import { } from '@backstage/core-components'; import { alertApiRef, useApi } from '@backstage/core-plugin-api'; -const CardTitle = ({ title }: { title: string }) => ( +const CardTitle = (props: { title: string }) => ( - {title} + {props.title} ); -export const GroupProfileCard = ({ - variant, -}: { - variant?: InfoCardVariants; -}) => { +/** @public */ +export const GroupProfileCard = (props: { variant?: InfoCardVariants }) => { const catalogApi = useApi(catalogApiRef); const alertApi = useApi(alertApiRef); const { entity: group } = useEntity(); @@ -118,7 +115,7 @@ export const GroupProfileCard = ({ } subheader={description} - variant={variant} + variant={props.variant} action={ <> {allowRefresh && ( diff --git a/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx b/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx index 67bf5c2e42..a73ab03bc4 100644 --- a/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx +++ b/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { DEFAULT_NAMESPACE, GroupEntity, @@ -61,12 +62,12 @@ const useStyles = makeStyles((theme: Theme) => }), ); -const MemberComponent = ({ member }: { member: UserEntity }) => { +const MemberComponent = (props: { member: UserEntity }) => { const classes = useStyles(); const { metadata: { name: metaName }, spec: { profile }, - } = member; + } = props.member; const displayName = profile?.displayName ?? metaName; return ( @@ -92,7 +93,7 @@ const MemberComponent = ({ member }: { member: UserEntity }) => { {displayName} @@ -108,12 +109,14 @@ const MemberComponent = ({ member }: { member: UserEntity }) => { ); }; -export const MembersListCard = (_props: { +/** @public */ +export const MembersListCard = (props: { memberDisplayTitle?: string; pageSize?: number; }) => { + const { memberDisplayTitle = 'Members', pageSize = 50 } = props; + const { entity: groupEntity } = useEntity(); - let { memberDisplayTitle, pageSize } = _props; const { metadata: { name: groupName, namespace: grpNamespace }, spec: { profile }, @@ -128,8 +131,6 @@ export const MembersListCard = (_props: { const pageChange = (_: React.ChangeEvent, pageIndex: number) => { setPage(pageIndex); }; - pageSize = pageSize ? pageSize : 50; - memberDisplayTitle = memberDisplayTitle ? memberDisplayTitle : 'Members'; const { loading, diff --git a/plugins/org/src/components/Cards/OwnershipCard/OwnershipCard.tsx b/plugins/org/src/components/Cards/OwnershipCard/OwnershipCard.tsx index 13e8502b7a..d29298e1a8 100644 --- a/plugins/org/src/components/Cards/OwnershipCard/OwnershipCard.tsx +++ b/plugins/org/src/components/Cards/OwnershipCard/OwnershipCard.tsx @@ -51,13 +51,13 @@ const useStyles = makeStyles(theme => ({ }, })); -export const OwnershipCard = ({ - variant, - entityFilterKind, -}: { +/** @public */ +export const OwnershipCard = (props: { variant?: InfoCardVariants; entityFilterKind?: string[]; }) => { + const { variant, entityFilterKind } = props; + const classes = useStyles(); const { entity } = useEntity(); const isGroup = entity.kind === 'Group'; diff --git a/plugins/org/src/components/Cards/User/UserProfileCard/UserProfileCard.tsx b/plugins/org/src/components/Cards/User/UserProfileCard/UserProfileCard.tsx index bafaad7ba0..148fb03d19 100644 --- a/plugins/org/src/components/Cards/User/UserProfileCard/UserProfileCard.tsx +++ b/plugins/org/src/components/Cards/User/UserProfileCard/UserProfileCard.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { RELATION_MEMBER_OF, UserEntity } from '@backstage/catalog-model'; import { EntityRefLinks, @@ -40,19 +41,16 @@ import { Link, } from '@backstage/core-components'; -const CardTitle = ({ title }: { title?: string }) => - title ? ( +const CardTitle = (props: { title?: string }) => + props.title ? ( - {title} + {props.title} ) : null; -export const UserProfileCard = ({ - variant, -}: { - variant?: InfoCardVariants; -}) => { +/** @public */ +export const UserProfileCard = (props: { variant?: InfoCardVariants }) => { const { entity: user } = useEntity(); if (!user) { return User not found; @@ -72,7 +70,7 @@ export const UserProfileCard = ({ } subheader={description} - variant={variant} + variant={props.variant} > diff --git a/plugins/org/src/components/MyGroupsSidebarItem/MyGroupsSidebarItem.tsx b/plugins/org/src/components/MyGroupsSidebarItem/MyGroupsSidebarItem.tsx index 22f3e76848..c2473670cf 100644 --- a/plugins/org/src/components/MyGroupsSidebarItem/MyGroupsSidebarItem.tsx +++ b/plugins/org/src/components/MyGroupsSidebarItem/MyGroupsSidebarItem.tsx @@ -39,15 +39,13 @@ import { getCompoundEntityRef } from '@backstage/catalog-model'; * * @public */ -export const MyGroupsSidebarItem = ({ - singularTitle, - pluralTitle, - icon, -}: { +export const MyGroupsSidebarItem = (props: { singularTitle: string; pluralTitle: string; icon: IconComponent; }) => { + const { singularTitle, pluralTitle, icon } = props; + const identityApi = useApi(identityApiRef); const catalogApi: CatalogApi = useApi(catalogApiRef); const catalogEntityRoute = useRouteRef(entityRouteRef); diff --git a/plugins/org/src/plugin.ts b/plugins/org/src/plugin.ts index 5da517f1db..ea6856b6b4 100644 --- a/plugins/org/src/plugin.ts +++ b/plugins/org/src/plugin.ts @@ -19,6 +19,7 @@ import { } from '@backstage/core-plugin-api'; import { catalogIndexRouteRef } from './routes'; +/** @public */ export const orgPlugin = createPlugin({ id: 'org', externalRoutes: { @@ -26,6 +27,7 @@ export const orgPlugin = createPlugin({ }, }); +/** @public */ export const EntityGroupProfileCard = orgPlugin.provide( createComponentExtension({ name: 'EntityGroupProfileCard', @@ -34,6 +36,8 @@ export const EntityGroupProfileCard = orgPlugin.provide( }, }), ); + +/** @public */ export const EntityMembersListCard = orgPlugin.provide( createComponentExtension({ name: 'EntityMembersListCard', @@ -42,6 +46,8 @@ export const EntityMembersListCard = orgPlugin.provide( }, }), ); + +/** @public */ export const EntityOwnershipCard = orgPlugin.provide( createComponentExtension({ name: 'EntityOwnershipCard', @@ -50,6 +56,8 @@ export const EntityOwnershipCard = orgPlugin.provide( }, }), ); + +/** @public */ export const EntityUserProfileCard = orgPlugin.provide( createComponentExtension({ name: 'EntityUserProfileCard', diff --git a/scripts/api-extractor.ts b/scripts/api-extractor.ts index 7a7dea4ab1..79f1f1eeb4 100644 --- a/scripts/api-extractor.ts +++ b/scripts/api-extractor.ts @@ -243,6 +243,8 @@ const NO_WARNING_PACKAGES = [ 'plugins/catalog-common', 'plugins/catalog-graph', 'plugins/catalog-react', + 'plugins/graphiql', + 'plugins/org', 'plugins/periskop', 'plugins/periskop-backend', 'plugins/permission-backend',