From 08c87dd8546ad5f98dc08dfebfd2f48b494364ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Fri, 19 Aug 2022 13:24:22 +0200 Subject: [PATCH] explore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- plugins/explore/api-report.md | 48 +++++++++---------- .../src/components/DomainCard/DomainCard.tsx | 9 ++-- .../src/components/DomainCard/index.ts | 1 + .../ExploreLayout/ExploreLayout.tsx | 17 +++---- .../src/components/ExploreLayout/index.ts | 1 + plugins/explore/src/components/index.ts | 4 +- plugins/explore/src/extensions.tsx | 4 ++ plugins/explore/src/plugin.ts | 1 + plugins/explore/src/routes.ts | 2 + scripts/api-extractor.ts | 1 - 10 files changed, 46 insertions(+), 42 deletions(-) diff --git a/plugins/explore/api-report.md b/plugins/explore/api-report.md index f4c7345b6c..9653c0fb63 100644 --- a/plugins/explore/api-report.md +++ b/plugins/explore/api-report.md @@ -12,8 +12,6 @@ import { ExternalRouteRef } from '@backstage/core-plugin-api'; import { RouteRef } from '@backstage/core-plugin-api'; import { TabProps } from '@material-ui/core'; -// Warning: (ae-missing-release-tag) "catalogEntityRouteRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public @deprecated (undocumented) export const catalogEntityRouteRef: ExternalRouteRef< { @@ -24,34 +22,30 @@ export const catalogEntityRouteRef: ExternalRouteRef< true >; -// Warning: (ae-forgotten-export) The symbol "DomainCardProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "DomainCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) -export const DomainCard: ({ entity }: DomainCardProps) => JSX.Element; +export const DomainCard: (props: { entity: DomainEntity }) => JSX.Element; -// Warning: (ae-missing-release-tag) "DomainExplorerContent" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export const DomainExplorerContent: (props: { title?: string | undefined; }) => JSX.Element; -// Warning: (ae-missing-release-tag) "ExploreLayout" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public export const ExploreLayout: { - ({ title, subtitle, children }: ExploreLayoutProps): JSX.Element; + (props: ExploreLayoutProps): JSX.Element; Route: (props: SubRoute) => null; }; -// Warning: (ae-missing-release-tag) "ExplorePage" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// +// @public (undocumented) +export type ExploreLayoutProps = { + title?: string; + subtitle?: string; + children?: default_2.ReactNode; +}; + // @public (undocumented) export const ExplorePage: () => JSX.Element; -// Warning: (ae-missing-release-tag) "explorePlugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) const explorePlugin: BackstagePlugin< { @@ -72,27 +66,29 @@ const explorePlugin: BackstagePlugin< export { explorePlugin }; export { explorePlugin as plugin }; -// Warning: (ae-missing-release-tag) "exploreRouteRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export const exploreRouteRef: RouteRef; -// Warning: (ae-missing-release-tag) "GroupsExplorerContent" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export const GroupsExplorerContent: (props: { title?: string | undefined; }) => JSX.Element; -// Warning: (ae-missing-release-tag) "ToolExplorerContent" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// +// @public (undocumented) +export type SubRoute = { + path: string; + title: string; + children: JSX.Element; + tabProps?: TabProps< + default_2.ElementType, + { + component?: default_2.ElementType; + } + >; +}; + // @public (undocumented) export const ToolExplorerContent: (props: { title?: string | undefined; }) => JSX.Element; - -// Warnings were encountered during analysis: -// -// src/components/ExploreLayout/ExploreLayout.d.ts:29:5 - (ae-forgotten-export) The symbol "ExploreLayoutProps" needs to be exported by the entry point index.d.ts -// src/components/ExploreLayout/ExploreLayout.d.ts:30:5 - (ae-forgotten-export) The symbol "SubRoute" needs to be exported by the entry point index.d.ts ``` diff --git a/plugins/explore/src/components/DomainCard/DomainCard.tsx b/plugins/explore/src/components/DomainCard/DomainCard.tsx index 94e4f145c3..a20a5e1f0c 100644 --- a/plugins/explore/src/components/DomainCard/DomainCard.tsx +++ b/plugins/explore/src/components/DomainCard/DomainCard.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { DomainEntity, RELATION_OWNED_BY } from '@backstage/catalog-model'; import { EntityRefLinks, @@ -33,13 +34,11 @@ import React from 'react'; import { Button, ItemCardHeader } from '@backstage/core-components'; import { useRouteRef } from '@backstage/core-plugin-api'; -type DomainCardProps = { - entity: DomainEntity; -}; +/** @public */ +export const DomainCard = (props: { entity: DomainEntity }) => { + const { entity } = props; -export const DomainCard = ({ entity }: DomainCardProps) => { const catalogEntityRoute = useRouteRef(entityRouteRef); - const ownedByRelations = getEntityRelations(entity, RELATION_OWNED_BY); const url = catalogEntityRoute(entityRouteParams(entity)); diff --git a/plugins/explore/src/components/DomainCard/index.ts b/plugins/explore/src/components/DomainCard/index.ts index 5d62a09e89..dbae755460 100644 --- a/plugins/explore/src/components/DomainCard/index.ts +++ b/plugins/explore/src/components/DomainCard/index.ts @@ -13,4 +13,5 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + export { DomainCard } from './DomainCard'; diff --git a/plugins/explore/src/components/ExploreLayout/ExploreLayout.tsx b/plugins/explore/src/components/ExploreLayout/ExploreLayout.tsx index bc9553c612..3ddf0b17f8 100644 --- a/plugins/explore/src/components/ExploreLayout/ExploreLayout.tsx +++ b/plugins/explore/src/components/ExploreLayout/ExploreLayout.tsx @@ -24,8 +24,8 @@ import { default as React } from 'react'; // TODO: This layout could be a shared based component if it was possible to create custom TabbedLayouts // A generalized version of createSubRoutesFromChildren, etc. would be required - -type SubRoute = { +/** @public */ +export type SubRoute = { path: string; title: string; children: JSX.Element; @@ -40,7 +40,8 @@ attachComponentData(Route, dataKey, true); // This causes all mount points that are discovered within this route to use the path of the route itself attachComponentData(Route, 'core.gatherMountPoints', true); -type ExploreLayoutProps = { +/** @public */ +export type ExploreLayoutProps = { title?: string; subtitle?: string; children?: React.ReactNode; @@ -57,12 +58,12 @@ type ExploreLayoutProps = { * * * ``` + * + * @public */ -export const ExploreLayout = ({ - title, - subtitle, - children, -}: ExploreLayoutProps) => { +export const ExploreLayout = (props: ExploreLayoutProps) => { + const { title, subtitle, children } = props; + const routes = useElementFilter(children, elements => elements .selectByComponentData({ diff --git a/plugins/explore/src/components/ExploreLayout/index.ts b/plugins/explore/src/components/ExploreLayout/index.ts index fa98ec78da..4d1781b3f4 100644 --- a/plugins/explore/src/components/ExploreLayout/index.ts +++ b/plugins/explore/src/components/ExploreLayout/index.ts @@ -14,4 +14,5 @@ * limitations under the License. */ +export type { ExploreLayoutProps, SubRoute } from './ExploreLayout'; export { ExploreLayout } from './ExploreLayout'; diff --git a/plugins/explore/src/components/index.ts b/plugins/explore/src/components/index.ts index cefc549684..f8fba16910 100644 --- a/plugins/explore/src/components/index.ts +++ b/plugins/explore/src/components/index.ts @@ -14,5 +14,5 @@ * limitations under the License. */ -export { DomainCard } from './DomainCard'; -export { ExploreLayout } from './ExploreLayout'; +export * from './DomainCard'; +export * from './ExploreLayout'; diff --git a/plugins/explore/src/extensions.tsx b/plugins/explore/src/extensions.tsx index 6800f86966..c6d66c4c12 100644 --- a/plugins/explore/src/extensions.tsx +++ b/plugins/explore/src/extensions.tsx @@ -21,6 +21,7 @@ import { createRoutableExtension, } from '@backstage/core-plugin-api'; +/** @public */ export const ExplorePage = explorePlugin.provide( createRoutableExtension({ name: 'ExplorePage', @@ -30,6 +31,7 @@ export const ExplorePage = explorePlugin.provide( }), ); +/** @public */ export const DomainExplorerContent = explorePlugin.provide( createComponentExtension({ name: 'DomainExplorerContent', @@ -42,6 +44,7 @@ export const DomainExplorerContent = explorePlugin.provide( }), ); +/** @public */ export const GroupsExplorerContent = explorePlugin.provide( createComponentExtension({ name: 'GroupsExplorerContent', @@ -54,6 +57,7 @@ export const GroupsExplorerContent = explorePlugin.provide( }), ); +/** @public */ export const ToolExplorerContent = explorePlugin.provide( createComponentExtension({ name: 'ToolExplorerContent', diff --git a/plugins/explore/src/plugin.ts b/plugins/explore/src/plugin.ts index cefb884834..a4bb538265 100644 --- a/plugins/explore/src/plugin.ts +++ b/plugins/explore/src/plugin.ts @@ -19,6 +19,7 @@ import { catalogEntityRouteRef, exploreRouteRef } from './routes'; import { exampleTools } from './util/examples'; import { createApiFactory, createPlugin } from '@backstage/core-plugin-api'; +/** @public */ export const explorePlugin = createPlugin({ id: 'explore', apis: [ diff --git a/plugins/explore/src/routes.ts b/plugins/explore/src/routes.ts index e8b393c4f6..0f66974a03 100644 --- a/plugins/explore/src/routes.ts +++ b/plugins/explore/src/routes.ts @@ -19,12 +19,14 @@ import { createRouteRef, } from '@backstage/core-plugin-api'; +/** @public */ export const exploreRouteRef = createRouteRef({ id: 'explore', }); /** * @deprecated This route is no longer used and can be removed + * @public */ export const catalogEntityRouteRef = createExternalRouteRef({ id: 'catalog-entity', diff --git a/scripts/api-extractor.ts b/scripts/api-extractor.ts index b4fc287c03..000f0b8c84 100644 --- a/scripts/api-extractor.ts +++ b/scripts/api-extractor.ts @@ -210,7 +210,6 @@ const ALLOW_WARNINGS = [ 'plugins/circleci', 'plugins/cost-insights', 'plugins/dynatrace', - 'plugins/explore', 'plugins/explore-react', 'plugins/git-release-manager', 'plugins/github-actions',