@backstage/plugin-catalog 1.33.1-next.0 → 1.34.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # @backstage/plugin-catalog
2
2
 
3
+ ## 1.34.0-next.1
4
+
5
+ ### Minor Changes
6
+
7
+ - 4d58894: Added support for group alias IDs and configurable content ordering on the entity page. Groups can now declare `aliases` so that content targeting an aliased group is included in the group. A new `defaultContentOrder` option (default `title`) controls how content items within each group are sorted, with support for both a page-level default and per-group overrides.
8
+
9
+ ### Patch Changes
10
+
11
+ - 07ba746: Fixed entity page tab groups not respecting the ordering from the `groups` configuration.
12
+ - Updated dependencies
13
+ - @backstage/ui@0.13.0-next.1
14
+ - @backstage/catalog-client@1.14.0-next.1
15
+ - @backstage/plugin-catalog-react@2.1.0-next.1
16
+ - @backstage/plugin-scaffolder-common@2.0.0-next.1
17
+ - @backstage/catalog-model@1.7.6
18
+ - @backstage/core-compat-api@0.5.9-next.1
19
+ - @backstage/core-components@0.18.8-next.0
20
+ - @backstage/core-plugin-api@1.12.4-next.0
21
+ - @backstage/errors@1.2.7
22
+ - @backstage/frontend-plugin-api@0.14.2-next.0
23
+ - @backstage/integration-react@1.2.16-next.1
24
+ - @backstage/types@1.2.2
25
+ - @backstage/version-bridge@1.0.12
26
+ - @backstage/plugin-catalog-common@1.1.8
27
+ - @backstage/plugin-permission-react@0.4.41-next.0
28
+ - @backstage/plugin-search-common@1.2.22
29
+ - @backstage/plugin-search-react@1.10.5-next.0
30
+ - @backstage/plugin-techdocs-common@0.1.1
31
+ - @backstage/plugin-techdocs-react@1.3.9-next.0
32
+
3
33
  ## 1.33.1-next.0
4
34
 
5
35
  ### Patch Changes
@@ -22,6 +22,7 @@ const EntityLayout = (props) => {
22
22
  NotFoundComponent,
23
23
  parentEntityRelations,
24
24
  groupDefinitions,
25
+ defaultContentOrder,
25
26
  showNavItemIcons
26
27
  } = props;
27
28
  const { kind } = useRouteRefParams(entityRouteRef);
@@ -67,6 +68,7 @@ const EntityLayout = (props) => {
67
68
  {
68
69
  routes,
69
70
  groupDefinitions,
71
+ defaultContentOrder,
70
72
  showIcons: showNavItemIcons
71
73
  }
72
74
  ),
@@ -1 +1 @@
1
- {"version":3,"file":"EntityLayout.esm.js","sources":["../../../../src/alpha/components/EntityLayout/EntityLayout.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ComponentProps, ReactNode, ReactElement } from 'react';\n\nimport Alert from '@material-ui/lab/Alert';\n\nimport {\n attachComponentData,\n useElementFilter,\n useRouteRefParams,\n} from '@backstage/core-plugin-api';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport {\n Content,\n Link,\n Page,\n Progress,\n WarningPanel,\n} from '@backstage/core-components';\nimport { Entity } from '@backstage/catalog-model';\nimport {\n entityRouteRef,\n useAsyncEntity,\n} from '@backstage/plugin-catalog-react';\n\nimport { catalogTranslationRef } from '../../translation';\nimport { EntityHeader } from '../EntityHeader';\nimport { EntityTabs } from '../EntityTabs';\nimport { EntityContentGroupDefinitions } from '@backstage/plugin-catalog-react/alpha';\n\nexport type EntityLayoutRouteProps = {\n path: string;\n title: string;\n group?: string;\n icon?: string | ReactElement;\n children: JSX.Element;\n if?: (entity: Entity) => boolean;\n};\n\nconst dataKey = 'plugin.catalog.entityLayoutRoute';\nconst Route: (props: EntityLayoutRouteProps) => null = () => null;\nattachComponentData(Route, dataKey, true);\nattachComponentData(Route, 'core.gatherMountPoints', true); // This causes all mount points that are discovered within this route to use the path of the route itself\n\n/** @public */\nexport interface EntityLayoutProps {\n UNSTABLE_contextMenuOptions?: ComponentProps<\n typeof EntityHeader\n >['UNSTABLE_contextMenuOptions'];\n UNSTABLE_extraContextMenuItems?: ComponentProps<\n typeof EntityHeader\n >['UNSTABLE_extraContextMenuItems'];\n contextMenuItems?: ComponentProps<typeof EntityHeader>['contextMenuItems'];\n children?: ReactNode;\n header?: JSX.Element;\n NotFoundComponent?: ReactNode;\n /**\n * An array of relation types used to determine the parent entities in the hierarchy.\n * These relations are prioritized in the order provided, allowing for flexible\n * navigation through entity relationships.\n *\n * For example, use relation types like `[\"partOf\", \"memberOf\", \"ownedBy\"]` to define how the entity is related to\n * its parents in the Entity Catalog.\n *\n * It adds breadcrumbs in the Entity page to enhance user navigation and context awareness.\n */\n parentEntityRelations?: string[];\n groupDefinitions: EntityContentGroupDefinitions;\n showNavItemIcons?: boolean;\n}\n\n/**\n * EntityLayout is a compound component, which allows you to define a layout for\n * entities using a sub-navigation mechanism.\n *\n * Consists of two parts: EntityLayout and EntityLayout.Route\n *\n * @example\n * ```jsx\n * <EntityLayout>\n * <EntityLayout.Route path=\"/example\" title=\"Example tab\">\n * <div>This is rendered under /example/anything-here route</div>\n * </EntityLayout.Route>\n * </EntityLayout>\n * ```\n *\n * @public\n */\nexport const EntityLayout = (props: EntityLayoutProps) => {\n const {\n UNSTABLE_extraContextMenuItems,\n UNSTABLE_contextMenuOptions,\n contextMenuItems,\n children,\n header,\n NotFoundComponent,\n parentEntityRelations,\n groupDefinitions,\n showNavItemIcons,\n } = props;\n const { kind } = useRouteRefParams(entityRouteRef);\n const { entity, loading, error } = useAsyncEntity();\n\n const routes = useElementFilter(\n children,\n elements =>\n elements\n .selectByComponentData({\n key: dataKey,\n withStrictError:\n 'Child of EntityLayout must be an EntityLayout.Route',\n })\n .getElements<EntityLayoutRouteProps>() // all nodes, element data, maintain structure or not?\n .flatMap(({ props: elementProps }) => {\n if (!entity) {\n return [];\n }\n if (elementProps.if && !elementProps.if(entity)) {\n return [];\n }\n return [\n {\n path: elementProps.path,\n title: elementProps.title,\n group: elementProps.group,\n children: elementProps.children,\n icon: elementProps.icon,\n },\n ];\n }),\n [entity],\n );\n\n const { t } = useTranslationRef(catalogTranslationRef);\n\n return (\n <Page themeId={entity?.spec?.type?.toString() ?? 'home'}>\n {header ?? (\n <EntityHeader\n parentEntityRelations={parentEntityRelations}\n UNSTABLE_contextMenuOptions={UNSTABLE_contextMenuOptions}\n UNSTABLE_extraContextMenuItems={UNSTABLE_extraContextMenuItems}\n contextMenuItems={contextMenuItems}\n />\n )}\n\n {loading && <Progress />}\n\n {entity && (\n <EntityTabs\n routes={routes}\n groupDefinitions={groupDefinitions}\n showIcons={showNavItemIcons}\n />\n )}\n\n {error && (\n <Content>\n <Alert severity=\"error\">{error.toString()}</Alert>\n </Content>\n )}\n\n {!loading && !error && !entity && (\n <Content>\n {NotFoundComponent ? (\n NotFoundComponent\n ) : (\n <WarningPanel title={t('entityLabels.warningPanelTitle')}>\n {t('entityPage.notFoundMessage', {\n kind,\n link: (\n <Link to=\"https://backstage.io/docs/features/software-catalog/references\">\n {t('entityPage.notFoundLinkText')}\n </Link>\n ),\n })}\n </WarningPanel>\n )}\n </Content>\n )}\n </Page>\n );\n};\n\nEntityLayout.Route = Route;\n"],"names":[],"mappings":";;;;;;;;;;AAqDA,MAAM,OAAA,GAAU,kCAAA;AAChB,MAAM,QAAiD,MAAM,IAAA;AAC7D,mBAAA,CAAoB,KAAA,EAAO,SAAS,IAAI,CAAA;AACxC,mBAAA,CAAoB,KAAA,EAAO,0BAA0B,IAAI,CAAA;AA8ClD,MAAM,YAAA,GAAe,CAAC,KAAA,KAA6B;AACxD,EAAA,MAAM;AAAA,IACJ,8BAAA;AAAA,IACA,2BAAA;AAAA,IACA,gBAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA;AAAA,IACA,iBAAA;AAAA,IACA,qBAAA;AAAA,IACA,gBAAA;AAAA,IAC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AA,EAAS,CAAA;AAAA,IAErB,MAAA,oBACC,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,MAAA;AAAA,QACA,gBAAA;AAAA,QACA,SAAA,EAAW;AAAA;AAAA,KACb;AAAA,IAGD,KAAA,oBACC,GAAA,CAAC,OAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,KAAA,EAAA,EAAM,UAAS,OAAA,EAAS,QAAA,EAAA,KAAA,CAAM,QAAA,EAAS,EAAE,CAAA,EAC5C,CAAA;AAAA,IAGD,CAAC,OAAA,IAAW,CAAC,KAAA,IAAS,CAAC,0BACtB,GAAA,CAAC,OAAA,EAAA,EACE,QAAA,EAAA,iBAAA,GACC,iBAAA,uBAEC,YAAA,EAAA,EAAa,KAAA,EAAO,EAAE,gCAAgC,CAAA,EACpD,YAAE,4BAAA,EAA8B;AAAA,MAC/B,IAAA;AAAA,MACA,sBACE,GAAA,CAAC,IAAA,EAAA,EAAK,IAAG,gEAAA,EACN,QAAA,EAAA,CAAA,CAAE,6BAA6B,CAAA,EAClC;AAAA,KAEH,GACH,CAAA,EAEJ;AAAA,GAAA,EAEJ,CAAA;AAEJ;AAEA,YAAA,CAAa,KAAA,GAAQ,KAAA;;;;"}
1
+ {"version":3,"file":"EntityLayout.esm.js","sources":["../../../../src/alpha/components/EntityLayout/EntityLayout.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ComponentProps, ReactNode, ReactElement } from 'react';\n\nimport Alert from '@material-ui/lab/Alert';\n\nimport {\n attachComponentData,\n useElementFilter,\n useRouteRefParams,\n} from '@backstage/core-plugin-api';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport {\n Content,\n Link,\n Page,\n Progress,\n WarningPanel,\n} from '@backstage/core-components';\nimport { Entity } from '@backstage/catalog-model';\nimport {\n entityRouteRef,\n useAsyncEntity,\n} from '@backstage/plugin-catalog-react';\n\nimport { catalogTranslationRef } from '../../translation';\nimport { EntityHeader } from '../EntityHeader';\nimport { EntityTabs } from '../EntityTabs';\nimport { EntityContentGroupDefinitions } from '@backstage/plugin-catalog-react/alpha';\n\nexport type EntityLayoutRouteProps = {\n path: string;\n title: string;\n group?: string;\n icon?: string | ReactElement;\n children: JSX.Element;\n if?: (entity: Entity) => boolean;\n};\n\nconst dataKey = 'plugin.catalog.entityLayoutRoute';\nconst Route: (props: EntityLayoutRouteProps) => null = () => null;\nattachComponentData(Route, dataKey, true);\nattachComponentData(Route, 'core.gatherMountPoints', true); // This causes all mount points that are discovered within this route to use the path of the route itself\n\n/** @public */\nexport interface EntityLayoutProps {\n UNSTABLE_contextMenuOptions?: ComponentProps<\n typeof EntityHeader\n >['UNSTABLE_contextMenuOptions'];\n UNSTABLE_extraContextMenuItems?: ComponentProps<\n typeof EntityHeader\n >['UNSTABLE_extraContextMenuItems'];\n contextMenuItems?: ComponentProps<typeof EntityHeader>['contextMenuItems'];\n children?: ReactNode;\n header?: JSX.Element;\n NotFoundComponent?: ReactNode;\n /**\n * An array of relation types used to determine the parent entities in the hierarchy.\n * These relations are prioritized in the order provided, allowing for flexible\n * navigation through entity relationships.\n *\n * For example, use relation types like `[\"partOf\", \"memberOf\", \"ownedBy\"]` to define how the entity is related to\n * its parents in the Entity Catalog.\n *\n * It adds breadcrumbs in the Entity page to enhance user navigation and context awareness.\n */\n parentEntityRelations?: string[];\n groupDefinitions: EntityContentGroupDefinitions;\n defaultContentOrder?: 'title' | 'natural';\n showNavItemIcons?: boolean;\n}\n\n/**\n * EntityLayout is a compound component, which allows you to define a layout for\n * entities using a sub-navigation mechanism.\n *\n * Consists of two parts: EntityLayout and EntityLayout.Route\n *\n * @example\n * ```jsx\n * <EntityLayout>\n * <EntityLayout.Route path=\"/example\" title=\"Example tab\">\n * <div>This is rendered under /example/anything-here route</div>\n * </EntityLayout.Route>\n * </EntityLayout>\n * ```\n *\n * @public\n */\nexport const EntityLayout = (props: EntityLayoutProps) => {\n const {\n UNSTABLE_extraContextMenuItems,\n UNSTABLE_contextMenuOptions,\n contextMenuItems,\n children,\n header,\n NotFoundComponent,\n parentEntityRelations,\n groupDefinitions,\n defaultContentOrder,\n showNavItemIcons,\n } = props;\n const { kind } = useRouteRefParams(entityRouteRef);\n const { entity, loading, error } = useAsyncEntity();\n\n const routes = useElementFilter(\n children,\n elements =>\n elements\n .selectByComponentData({\n key: dataKey,\n withStrictError:\n 'Child of EntityLayout must be an EntityLayout.Route',\n })\n .getElements<EntityLayoutRouteProps>() // all nodes, element data, maintain structure or not?\n .flatMap(({ props: elementProps }) => {\n if (!entity) {\n return [];\n }\n if (elementProps.if && !elementProps.if(entity)) {\n return [];\n }\n return [\n {\n path: elementProps.path,\n title: elementProps.title,\n group: elementProps.group,\n children: elementProps.children,\n icon: elementProps.icon,\n },\n ];\n }),\n [entity],\n );\n\n const { t } = useTranslationRef(catalogTranslationRef);\n\n return (\n <Page themeId={entity?.spec?.type?.toString() ?? 'home'}>\n {header ?? (\n <EntityHeader\n parentEntityRelations={parentEntityRelations}\n UNSTABLE_contextMenuOptions={UNSTABLE_contextMenuOptions}\n UNSTABLE_extraContextMenuItems={UNSTABLE_extraContextMenuItems}\n contextMenuItems={contextMenuItems}\n />\n )}\n\n {loading && <Progress />}\n\n {entity && (\n <EntityTabs\n routes={routes}\n groupDefinitions={groupDefinitions}\n defaultContentOrder={defaultContentOrder}\n showIcons={showNavItemIcons}\n />\n )}\n\n {error && (\n <Content>\n <Alert severity=\"error\">{error.toString()}</Alert>\n </Content>\n )}\n\n {!loading && !error && !entity && (\n <Content>\n {NotFoundComponent ? (\n NotFoundComponent\n ) : (\n <WarningPanel title={t('entityLabels.warningPanelTitle')}>\n {t('entityPage.notFoundMessage', {\n kind,\n link: (\n <Link to=\"https://backstage.io/docs/features/software-catalog/references\">\n {t('entityPage.notFoundLinkText')}\n </Link>\n ),\n })}\n </WarningPanel>\n )}\n </Content>\n )}\n </Page>\n );\n};\n\nEntityLayout.Route = Route;\n"],"names":[],"mappings":";;;;;;;;;;AAqDA,MAAM,OAAA,GAAU,kCAAA;AAChB,MAAM,QAAiD,MAAM,IAAA;AAC7D,mBAAA,CAAoB,KAAA,EAAO,SAAS,IAAI,CAAA;AACxC,mBAAA,CAAoB,KAAA,EAAO,0BAA0B,IAAI,CAAA;AA+ClD,MAAM,YAAA,GAAe,CAAC,KAAA,KAA6B;AACxD,EAAA,MAAM;AAAA,IACJ,8BAAA;AAAA,IACA,2BAAA;AAAA,IACA,gBAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA;AAAA,IACA,iBAAA;AAAA,IACA,qBAAA;AAAA,IACA,gBAAA;AAAA,IACA,mBAAA;AAAA,IACA;AAAA,GACF,GAAI,KAAA;AACJ,EAAA,MAAM,EAAE,IAAA,EAAK,GAAI,iBAAA,CAAkB,cAAc,CAAA;AACjD,EAAA,MAAM,EAAE,MAAA,EAAQ,OAAA,EAAS,KAAA,KAAU,cAAA,EAAe;AAElD,EAAA,MAAM,MAAA,GAAS,gBAAA;AAAA,IACb,QAAA;AAAA,IACA,CAAA,QAAA,KACE,SACG,qBAAA,CAAsB;AAAA,MACrB,GAAA,EAAK,OAAA;AAAA,MACL,eAAA,EACE;AAAA,KACH,EACA,WAAA,EAAoC,CACpC,QAAQ,CAAC,EAAE,KAAA,EAAO,YAAA,EAAa,KAAM;AACpC,MAAA,IAAI,CAAC,MAAA,EAAQ;AACX,QAAA,OAAO,EAAC;AAAA,MACV;AACA,MAAA,IAAI,aAAa,EAAA,IAAM,CAAC,YAAA,CAAa,EAAA,CAAG,MAAM,CAAA,EAAG;AAC/C,QAAA,O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A,MACA,sBACE,GAAA,CAAC,IAAA,EAAA,EAAK,IAAG,gEAAA,EACN,QAAA,EAAA,CAAA,CAAE,6BAA6B,CAAA,EAClC;AAAA,KAEH,GACH,CAAA,EAEJ;AAAA,GAAA,EAEJ,CAAA;AAEJ;AAEA,YAAA,CAAa,KAAA,GAAQ,KAAA;;;;"}
@@ -32,7 +32,7 @@ function useSelectedSubRoute(subRoutes) {
32
32
  };
33
33
  }
34
34
  function EntityTabs(props) {
35
- const { routes, groupDefinitions, showIcons } = props;
35
+ const { routes, groupDefinitions, defaultContentOrder, showIcons } = props;
36
36
  const { index, route, element } = useSelectedSubRoute(routes);
37
37
  const tabs = useMemo(
38
38
  () => routes.map((t) => {
@@ -57,7 +57,8 @@ function EntityTabs(props) {
57
57
  tabs,
58
58
  selectedIndex: index,
59
59
  showIcons,
60
- groupDefinitions
60
+ groupDefinitions,
61
+ defaultContentOrder
61
62
  }
62
63
  ),
63
64
  /* @__PURE__ */ jsxs(EntityTabsPanel, { children: [
@@ -1 +1 @@
1
- {"version":3,"file":"EntityTabs.esm.js","sources":["../../../../src/alpha/components/EntityTabs/EntityTabs.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { ReactElement, useMemo } from 'react';\nimport { Helmet } from 'react-helmet';\nimport { matchRoutes, useParams, useRoutes } from 'react-router-dom';\nimport { EntityTabsPanel } from './EntityTabsPanel';\nimport { EntityTabsList } from './EntityTabsList';\nimport { EntityContentGroupDefinitions } from '@backstage/plugin-catalog-react/alpha';\n\ntype SubRoute = {\n group?: string;\n path: string;\n title: string;\n icon?: string | ReactElement;\n children: JSX.Element;\n};\n\nexport function useSelectedSubRoute(subRoutes: SubRoute[]): {\n index: number;\n route?: SubRoute;\n element?: JSX.Element;\n} {\n const params = useParams();\n\n const routes = subRoutes.map(({ path, children }) => ({\n caseSensitive: false,\n path: `${path}/*`,\n element: children,\n }));\n\n // TODO: remove once react-router updated\n const sortedRoutes = routes.sort((a, b) =>\n // remove \"/*\" symbols from path end before comparing\n b.path.replace(/\\/\\*$/, '').localeCompare(a.path.replace(/\\/\\*$/, '')),\n );\n\n const element = useRoutes(sortedRoutes) ?? subRoutes[0]?.children;\n\n // TODO(Rugvip): Once we only support v6 stable we can always prefix\n // This avoids having a double / prefix for react-router v6 beta, which in turn breaks\n // the tab highlighting when using relative paths for the tabs.\n let currentRoute = params['*'] ?? '';\n if (!currentRoute.startsWith('/')) {\n currentRoute = `/${currentRoute}`;\n }\n\n const [matchedRoute] = matchRoutes(sortedRoutes, currentRoute) ?? [];\n const foundIndex = matchedRoute\n ? subRoutes.findIndex(t => `${t.path}/*` === matchedRoute.route.path)\n : 0;\n\n return {\n index: foundIndex === -1 ? 0 : foundIndex,\n element,\n route: subRoutes[foundIndex] ?? subRoutes[0],\n };\n}\n\ntype EntityTabsProps = {\n routes: SubRoute[];\n groupDefinitions: EntityContentGroupDefinitions;\n showIcons?: boolean;\n};\n\nexport function EntityTabs(props: EntityTabsProps) {\n const { routes, groupDefinitions, showIcons } = props;\n\n const { index, route, element } = useSelectedSubRoute(routes);\n\n const tabs = useMemo(\n () =>\n routes.map(t => {\n const { path, title, group, icon } = t;\n let to = path;\n // Remove trailing /*\n to = to.replace(/\\/\\*$/, '');\n // And remove leading / for relative navigation\n to = to.replace(/^\\//, '');\n return {\n group,\n id: path,\n path: to,\n label: title,\n icon,\n };\n }),\n [routes],\n );\n\n return (\n <>\n <EntityTabsList\n tabs={tabs}\n selectedIndex={index}\n showIcons={showIcons}\n groupDefinitions={groupDefinitions}\n />\n <EntityTabsPanel>\n <Hel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EACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"EntityTabs.esm.js","sources":["../../../../src/alpha/components/EntityTabs/EntityTabs.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { ReactElement, useMemo } from 'react';\nimport { Helmet } from 'react-helmet';\nimport { matchRoutes, useParams, useRoutes } from 'react-router-dom';\nimport { EntityTabsPanel } from './EntityTabsPanel';\nimport { EntityTabsList } from './EntityTabsList';\nimport { EntityContentGroupDefinitions } from '@backstage/plugin-catalog-react/alpha';\n\ntype SubRoute = {\n group?: string;\n path: string;\n title: string;\n icon?: string | ReactElement;\n children: JSX.Element;\n};\n\nexport function useSelectedSubRoute(subRoutes: SubRoute[]): {\n index: number;\n route?: SubRoute;\n element?: JSX.Element;\n} {\n const params = useParams();\n\n const routes = subRoutes.map(({ path, children }) => ({\n caseSensitive: false,\n path: `${path}/*`,\n element: children,\n }));\n\n // TODO: remove once react-router updated\n const sortedRoutes = routes.sort((a, b) =>\n // remove \"/*\" symbols from path end before comparing\n b.path.replace(/\\/\\*$/, '').localeCompare(a.path.replace(/\\/\\*$/, '')),\n );\n\n const element = useRoutes(sortedRoutes) ?? subRoutes[0]?.children;\n\n // TODO(Rugvip): Once we only support v6 stable we can always prefix\n // This avoids having a double / prefix for react-router v6 beta, which in turn breaks\n // the tab highlighting when using relative paths for the tabs.\n let currentRoute = params['*'] ?? '';\n if (!currentRoute.startsWith('/')) {\n currentRoute = `/${currentRoute}`;\n }\n\n const [matchedRoute] = matchRoutes(sortedRoutes, currentRoute) ?? [];\n const foundIndex = matchedRoute\n ? subRoutes.findIndex(t => `${t.path}/*` === matchedRoute.route.path)\n : 0;\n\n return {\n index: foundIndex === -1 ? 0 : foundIndex,\n element,\n route: subRoutes[foundIndex] ?? subRoutes[0],\n };\n}\n\ntype EntityTabsProps = {\n routes: SubRoute[];\n groupDefinitions: EntityContentGroupDefinitions;\n defaultContentOrder?: 'title' | 'natural';\n showIcons?: boolean;\n};\n\nexport function EntityTabs(props: EntityTabsProps) {\n const { routes, groupDefinitions, defaultContentOrder, showIcons } = props;\n\n const { index, route, element } = useSelectedSubRoute(routes);\n\n const tabs = useMemo(\n () =>\n routes.map(t => {\n const { path, title, group, icon } = t;\n let to = path;\n // Remove trailing /*\n to = to.replace(/\\/\\*$/, '');\n // And remove leading / for relative navigation\n to = to.replace(/^\\//, '');\n return {\n group,\n id: path,\n path: to,\n label: title,\n icon,\n };\n }),\n [routes],\n );\n\n return (\n <>\n <EntityTabsList\n tabs={tabs}\n selectedIndex={index}\n showIcons={showIcons}\n groupDefinitions={groupDefinitions}\n defaultContentOrder={defaultContentOrder}\n />\n <EntityTabsPanel>\n <Helmet title={route?.title} />\n {element}\n </EntityTabsPanel>\n </>\n );\n}\n"],"names":[],"mappings":";;;;;;;AA8BO,SAAS,oBAAoB,SAAA,EAIlC;AACA,EAAA,MAAM,SAAS,SAAA,EAAU;AAEzB,EAAA,MAAM,SAAS,SAAA,CAAU,GAAA,CAAI,CAAC,EAAE,IAAA,EAAM,UAAS,MAAO;AAAA,IACpD,aAAA,EAAe,KAAA;AAAA,IACf,IAAA,EAAM,GAAG,IAAI,CAAA,EAAA,CAAA;AAAA,IACb,OAAA,EAAS;AAAA,GACX,CAAE,CAAA;AAGF,EAAA,MAAM,eAAe,MAAA,CAAO,IAAA;AAAA,IAAK,CAAC,CAAA,EAAG,CAAA;AAAA;AAAA,MAEnC,CAAA,CAAE,IAAA,CAAK,OAAA,CAAQ,OAAA,EAAS,EAAE,CAAA,CAAE,aAAA,CAAc,CAAA,CAAE,IAAA,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A,CAAG,OAAA,CAAQ,OAAA,EAAS,EAAE,CAAA;AAE3B,MAAA,EAAA,GAAK,EAAA,CAAG,OAAA,CAAQ,KAAA,EAAO,EAAE,CAAA;AACzB,MAAA,OAAO;AAAA,QACL,KAAA;AAAA,QACA,EAAA,EAAI,IAAA;AAAA,QACJ,IAAA,EAAM,EAAA;AAAA,QACN,KAAA,EAAO,KAAA;AAAA,QACP;AAAA,OACF;AAAA,IACF,CAAC,CAAA;AAAA,IACH,CAAC,MAAM;AAAA,GACT;AAEA,EAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,cAAA;AAAA,MAAA;AAAA,QACC,IAAA;AAAA,QACA,aAAA,EAAe,KAAA;AAAA,QACf,SAAA;AAAA,QACA,gBAAA;AAAA,QACA;AAAA;AAAA,KACF;AAAA,yBACC,eAAA,EAAA,EACC,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,MAAA,EAAA,EAAO,KAAA,EAAO,KAAA,EAAO,KAAA,EAAO,CAAA;AAAA,MAC5B;AAAA,KAAA,EACH;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
@@ -34,24 +34,84 @@ const useStyles = makeStyles(
34
34
  }),
35
35
  { name: "BackstageHeaderTabs" }
36
36
  );
37
+ function resolveGroupId(tabGroup, groupDefinitions, aliasToGroup) {
38
+ if (!tabGroup) {
39
+ return void 0;
40
+ }
41
+ if (groupDefinitions[tabGroup]) {
42
+ return tabGroup;
43
+ }
44
+ return aliasToGroup[tabGroup];
45
+ }
37
46
  function EntityTabsList(props) {
38
47
  const styles = useStyles();
39
48
  const { t } = useTranslationRef(catalogTranslationRef);
40
- const { tabs: items, selectedIndex = 0, showIcons, groupDefinitions } = props;
41
- const groups = useMemo(
42
- () => items.reduce((result, tab) => {
43
- const group = tab.group ? groupDefinitions[tab.group] : void 0;
44
- const groupOrId = group && tab.group ? tab.group : tab.id;
49
+ const {
50
+ tabs: items,
51
+ selectedIndex = 0,
52
+ showIcons,
53
+ groupDefinitions,
54
+ defaultContentOrder = "title"
55
+ } = props;
56
+ const aliasToGroup = useMemo(
57
+ () => Object.entries(groupDefinitions).reduce((map, [groupId, def]) => {
58
+ for (const alias of def.aliases ?? []) {
59
+ map[alias] = groupId;
60
+ }
61
+ return map;
62
+ }, {}),
63
+ [groupDefinitions]
64
+ );
65
+ const groups = useMemo(() => {
66
+ const byKey = items.reduce((result, tab) => {
67
+ const resolvedGroupId = resolveGroupId(
68
+ tab.group,
69
+ groupDefinitions,
70
+ aliasToGroup
71
+ );
72
+ const group = resolvedGroupId ? groupDefinitions[resolvedGroupId] : void 0;
73
+ const groupOrId = group && resolvedGroupId ? resolvedGroupId : tab.id;
45
74
  result[groupOrId] = result[groupOrId] ?? {
46
75
  group,
47
76
  items: []
48
77
  };
49
78
  result[groupOrId].items.push(tab);
50
79
  return result;
51
- }, {}),
52
- [items, groupDefinitions]
53
- );
80
+ }, {});
81
+ const groupOrder = Object.keys(groupDefinitions);
82
+ const sorted = Object.entries(byKey).sort(([a], [b]) => {
83
+ const ai = groupOrder.indexOf(a);
84
+ const bi = groupOrder.indexOf(b);
85
+ if (ai !== -1 && bi !== -1) {
86
+ return ai - bi;
87
+ }
88
+ if (ai !== -1) {
89
+ return -1;
90
+ }
91
+ if (bi !== -1) {
92
+ return 1;
93
+ }
94
+ return 0;
95
+ });
96
+ for (const [id, tabGroup] of sorted) {
97
+ const groupDef = groupDefinitions[id];
98
+ if (groupDef) {
99
+ const order = groupDef.contentOrder ?? defaultContentOrder;
100
+ if (order === "title") {
101
+ tabGroup.items.sort(
102
+ (a, b) => a.label.localeCompare(b.label, void 0, { sensitivity: "base" })
103
+ );
104
+ }
105
+ }
106
+ }
107
+ return sorted;
108
+ }, [items, groupDefinitions, aliasToGroup, defaultContentOrder]);
54
109
  const selectedItem = items[selectedIndex];
110
+ const selectedGroup = resolveGroupId(
111
+ selectedItem?.group,
112
+ groupDefinitions,
113
+ aliasToGroup
114
+ );
55
115
  return /* @__PURE__ */ jsx(Box, { className: styles.tabsWrapper, children: /* @__PURE__ */ jsx(
56
116
  Tabs,
57
117
  {
@@ -61,8 +121,8 @@ function EntityTabsList(props) {
61
121
  variant: "scrollable",
62
122
  scrollButtons: "auto",
63
123
  "aria-label": t("entityTabs.tabsAriaLabel"),
64
- value: selectedItem?.group ?? selectedItem?.id,
65
- children: Object.entries(groups).map(([id, tabGroup]) => /* @__PURE__ */ jsx(
124
+ value: selectedGroup ?? selectedItem?.id,
125
+ children: groups.map(([id, tabGroup]) => /* @__PURE__ */ jsx(
66
126
  EntityTabsGroup,
67
127
  {
68
128
  "data-testid": `header-tab-${id}`,
@@ -1 +1 @@
1
- {"version":3,"file":"EntityTabsList.esm.js","sources":["../../../../src/alpha/components/EntityTabs/EntityTabsList.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ReactElement, useMemo } from 'react';\nimport Box from '@material-ui/core/Box';\nimport Tabs from '@material-ui/core/Tabs';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { EntityContentGroupDefinitions } from '@backstage/plugin-catalog-react/alpha';\n\nimport { EntityTabsGroup } from './EntityTabsGroup';\nimport { catalogTranslationRef } from '../../translation';\n\n/** @public */\nexport type HeaderTabsClassKey =\n | 'tabsWrapper'\n | 'defaultTab'\n | 'selected'\n | 'tabRoot';\n\nconst useStyles = makeStyles(\n theme => ({\n tabsWrapper: {\n gridArea: 'pageSubheader',\n backgroundColor: theme.palette.background.paper,\n paddingLeft: theme.spacing(3),\n minWidth: 0,\n },\n defaultTab: {\n ...theme.typography.caption,\n padding: theme.spacing(3, 3),\n textTransform: 'uppercase',\n fontWeight: theme.typography.fontWeightBold,\n color: theme.palette.text.secondary,\n },\n selected: {\n color: theme.palette.text.primary,\n },\n tabRoot: {\n '&:hover': {\n backgroundColor: theme.palette.background.default,\n color: theme.palette.text.primary,\n },\n },\n }),\n { name: 'BackstageHeaderTabs' },\n);\n\ntype Tab = {\n id: string;\n label: string;\n path: string;\n group?: string;\n icon?: string | ReactElement;\n};\n\ntype TabGroup = {\n group?: {\n title: string;\n icon?: string | ReactElement;\n };\n items: Array<Omit<Tab, 'group'>>;\n};\n\ntype EntityTabsListProps = {\n tabs: Tab[];\n groupDefinitions: EntityContentGroupDefinitions;\n showIcons?: boolean;\n selectedIndex?: number;\n};\n\nexport function EntityTabsList(props: EntityTabsListProps) {\n const styles = useStyles();\n const { t } = useTranslationRef(catalogTranslationRef);\n\n const { tabs: items, selectedIndex = 0, showIcons, groupDefinitions } = props;\n\n const groups = useMemo(\n () =>\n items.reduce((result, tab) => {\n const group = tab.group ? groupDefinitions[tab.group] : undefined;\n const groupOrId = group && tab.group ? tab.group : tab.id;\n result[groupOrId] = result[groupOrId] ?? {\n group,\n items: [],\n };\n result[groupOrId].items.push(tab);\n return result;\n }, {} as Record<string, TabGroup>),\n [items, groupDefinitions],\n );\n\n const selectedItem = items[selectedIndex];\n return (\n <Box className={styles.tabsWrapper}>\n <Tabs\n selectionFollowsFocus\n indicatorColor=\"primary\"\n textColor=\"inherit\"\n variant=\"scrollable\"\n scrollButtons=\"auto\"\n aria-label={t('entityTabs.tabsAriaLabel')}\n value={selectedItem?.group ?? selectedItem?.id}\n >\n {Object.entries(groups).map(([id, tabGroup]) => (\n <EntityTabsGroup\n data-testid={`header-tab-${id}`}\n className={styles.defaultTab}\n classes={{ selected: styles.selected, root: styles.tabRoot }}\n key={id}\n label={tabGroup.group?.title}\n icon={tabGroup.group?.icon}\n value={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AA,UACC,aAAA,EAAa,cAAc,EAAE,CAAA,CAAA;AAAA,UAC7B,WAAW,MAAA,CAAO,UAAA;AAAA,UAClB,SAAS,EAAE,QAAA,EAAU,OAAO,QAAA,EAAU,IAAA,EAAM,OAAO,OAAA,EAAQ;AAAA,UAE3D,KAAA,EAAO,SAAS,KAAA,EAAO,KAAA;AAAA,UACvB,IAAA,EAAM,SAAS,KAAA,EAAO,IAAA;AAAA,UACtB,KAAA,EAAO,EAAA;AAAA,UACP,OAAO,QAAA,CAAS,KAAA;AAAA,UAChB,mBAAmB,YAAA,EAAc,EAAA;AAAA,UACjC;AAAA,SAAA;AAAA,QANK;AAAA,OAQR;AAAA;AAAA,GACH,EACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"EntityTabsList.esm.js","sources":["../../../../src/alpha/components/EntityTabs/EntityTabsList.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ReactElement, useMemo } from 'react';\nimport Box from '@material-ui/core/Box';\nimport Tabs from '@material-ui/core/Tabs';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { EntityContentGroupDefinitions } from '@backstage/plugin-catalog-react/alpha';\n\nimport { EntityTabsGroup } from './EntityTabsGroup';\nimport { catalogTranslationRef } from '../../translation';\n\n/** @public */\nexport type HeaderTabsClassKey =\n | 'tabsWrapper'\n | 'defaultTab'\n | 'selected'\n | 'tabRoot';\n\nconst useStyles = makeStyles(\n theme => ({\n tabsWrapper: {\n gridArea: 'pageSubheader',\n backgroundColor: theme.palette.background.paper,\n paddingLeft: theme.spacing(3),\n minWidth: 0,\n },\n defaultTab: {\n ...theme.typography.caption,\n padding: theme.spacing(3, 3),\n textTransform: 'uppercase',\n fontWeight: theme.typography.fontWeightBold,\n color: theme.palette.text.secondary,\n },\n selected: {\n color: theme.palette.text.primary,\n },\n tabRoot: {\n '&:hover': {\n backgroundColor: theme.palette.background.default,\n color: theme.palette.text.primary,\n },\n },\n }),\n { name: 'BackstageHeaderTabs' },\n);\n\ntype Tab = {\n id: string;\n label: string;\n path: string;\n group?: string;\n icon?: string | ReactElement;\n};\n\ntype TabGroup = {\n group?: {\n title: string;\n icon?: string | ReactElement;\n };\n items: Array<Omit<Tab, 'group'>>;\n};\n\ntype EntityTabsListProps = {\n tabs: Tab[];\n groupDefinitions: EntityContentGroupDefinitions;\n defaultContentOrder?: 'title' | 'natural';\n showIcons?: boolean;\n selectedIndex?: number;\n};\n\nfunction resolveGroupId(\n tabGroup: string | undefined,\n groupDefinitions: EntityContentGroupDefinitions,\n aliasToGroup: Record<string, string>,\n): string | undefined {\n if (!tabGroup) {\n return undefined;\n }\n if (groupDefinitions[tabGroup]) {\n return tabGroup;\n }\n return aliasToGroup[tabGroup];\n}\n\nexport function EntityTabsList(props: EntityTabsListProps) {\n const styles = useStyles();\n const { t } = useTranslationRef(catalogTranslationRef);\n\n const {\n tabs: items,\n selectedIndex = 0,\n showIcons,\n groupDefinitions,\n defaultContentOrder = 'title',\n } = props;\n\n const aliasToGroup = useMemo(\n () =>\n Object.entries(groupDefinitions).reduce((map, [groupId, def]) => {\n for (const alias of def.aliases ?? []) {\n map[alias] = groupId;\n }\n return map;\n }, {} as Record<string, string>),\n [groupDefinitions],\n );\n\n const groups = useMemo(() => {\n const byKey = items.reduce((result, tab) => {\n const resolvedGroupId = resolveGroupId(\n tab.group,\n groupDefinitions,\n aliasToGroup,\n );\n const group = resolvedGroupId\n ? groupDefinitions[resolvedGroupId]\n : undefined;\n const groupOrId = group && resolvedGroupId ? resolvedGroupId : tab.id;\n result[groupOrId] = result[groupOrId] ?? {\n group,\n items: [],\n };\n result[groupOrId].items.push(tab);\n return result;\n }, {} as Record<string, TabGroup>);\n\n const groupOrder = Object.keys(groupDefinitions);\n const sorted = Object.entries(byKey).sort(([a], [b]) => {\n const ai = groupOrder.indexOf(a);\n const bi = groupOrder.indexOf(b);\n if (ai !== -1 && bi !== -1) {\n return ai - bi;\n }\n if (ai !== -1) {\n return -1;\n }\n if (bi !== -1) {\n return 1;\n }\n return 0;\n });\n\n for (const [id, tabGroup] of sorted) {\n const groupDef = groupDefinitions[id];\n if (groupDef) {\n const order = groupDef.contentOrder ?? defaultContentOrder;\n if (order === 'title') {\n tabGroup.items.sort((a, b) =>\n a.label.localeCompare(b.label, undefined, { sensitivity: 'base' }),\n );\n }\n }\n }\n\n return sorted;\n }, [items, groupDefinitions, aliasToGroup, defaultContentOrder]);\n\n const selectedItem = items[selectedIndex];\n const selectedGroup = resolveGroupId(\n selectedItem?.group,\n groupDefinitions,\n aliasToGroup,\n );\n return (\n <Box className={styles.tabsWrapper}>\n <Tabs\n selectionFollowsFocus\n indicatorColor=\"primary\"\n textColor=\"inherit\"\n variant=\"scrollable\"\n scrollButtons=\"auto\"\n aria-label={t('entityTabs.tabsAriaLabel')}\n value={selectedGroup ?? selectedItem?.id}\n >\n {groups.map(([id, tabGroup]) => (\n <EntityTabsGroup\n data-testid={`header-tab-${id}`}\n className={styles.defaultTab}\n classes={{ selected: styles.selected, root: styles.tabRoot }}\n key={id}\n label={tabGroup.group?.title}\n icon={tabGroup.group?.icon}\n value={id}\n items={tabGroup.items}\n highlightedButton={selectedItem?.id}\n showIcons={showIcons}\n />\n ))}\n </Tabs>\n </Box>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;AAiCA,MAAM,SAAA,GAAY,UAAA;AAAA,EAChB,CAAA,KAAA,MAAU;AAAA,IACR,WAAA,EAAa;AAAA,MACX,QAAA,EAAU,eAAA;AAAA,MACV,eAAA,EAAiB,K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gB,cAAA;AAAA,IACpB,YAAA,EAAc,KAAA;AAAA,IACd,gBAAA;AAAA,IACA;AAAA,GACF;AACA,EAAA,uBACE,GAAA,CAAC,GAAA,EAAA,EAAI,SAAA,EAAW,MAAA,CAAO,WAAA,EACrB,QAAA,kBAAA,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,qBAAA,EAAqB,IAAA;AAAA,MACrB,cAAA,EAAe,SAAA;AAAA,MACf,SAAA,EAAU,SAAA;AAAA,MACV,OAAA,EAAQ,YAAA;AAAA,MACR,aAAA,EAAc,MAAA;AAAA,MACd,YAAA,EAAY,EAAE,0BAA0B,CAAA;AAAA,MACxC,KAAA,EAAO,iBAAiB,YAAA,EAAc,EAAA;AAAA,MAErC,iBAAO,GAAA,CAAI,CAAC,CAAC,EAAA,EAAI,QAAQ,CAAA,qBACxB,GAAA;AAAA,QAAC,eAAA;AAAA,QAAA;AAAA,UACC,aAAA,EAAa,cAAc,EAAE,CAAA,CAAA;AAAA,UAC7B,WAAW,MAAA,CAAO,UAAA;AAAA,UAClB,SAAS,EAAE,QAAA,EAAU,OAAO,QAAA,EAAU,IAAA,EAAM,OAAO,OAAA,EAAQ;AAAA,UAE3D,KAAA,EAAO,SAAS,KAAA,EAAO,KAAA;AAAA,UACvB,IAAA,EAAM,SAAS,KAAA,EAAO,IAAA;AAAA,UACtB,KAAA,EAAO,EAAA;AAAA,UACP,OAAO,QAAA,CAAS,KAAA;AAAA,UAChB,mBAAmB,YAAA,EAAc,EAAA;AAAA,UACjC;AAAA,SAAA;AAAA,QANK;AAAA,OAQR;AAAA;AAAA,GACH,EACF,CAAA;AAEJ;;;;"}
@@ -75,10 +75,13 @@ const catalogEntityPage = PageBlueprint.makeWithOverrides({
75
75
  z.string(),
76
76
  z.object({
77
77
  title: z.string(),
78
- icon: z.string().optional()
78
+ icon: z.string().optional(),
79
+ aliases: z.array(z.string()).optional(),
80
+ contentOrder: z.enum(["title", "natural"]).optional()
79
81
  })
80
82
  )
81
83
  ).optional(),
84
+ defaultContentOrder: (z) => z.enum(["title", "natural"]).optional().default("title"),
82
85
  showNavItemIcons: (z) => z.boolean().optional().default(false)
83
86
  }
84
87
  },
@@ -125,6 +128,7 @@ const catalogEntityPage = PageBlueprint.makeWithOverrides({
125
128
  header,
126
129
  contextMenuItems: filteredMenuItems,
127
130
  groupDefinitions,
131
+ defaultContentOrder: config.defaultContentOrder,
128
132
  showNavItemIcons: config.showNavItemIcons,
129
133
  children: inputs.contents.map((output) => /* @__PURE__ */ jsx(
130
134
  EntityLayout.Route,
@@ -1 +1 @@
1
- {"version":3,"file":"pages.esm.js","sources":["../../src/alpha/pages.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { convertLegacyRouteRef } from '@backstage/core-compat-api';\nimport {\n coreExtensionData,\n createExtensionInput,\n PageBlueprint,\n} from '@backstage/frontend-plugin-api';\nimport {\n AsyncEntityProvider,\n entityRouteRef,\n} from '@backstage/plugin-catalog-react';\nimport {\n defaultEntityContentGroupDefinitions,\n EntityContentBlueprint,\n EntityContextMenuItemBlueprint,\n EntityHeaderBlueprint,\n EntityContentGroupDefinitions,\n} from '@backstage/plugin-catalog-react/alpha';\nimport CategoryIcon from '@material-ui/icons/Category';\nimport { rootRouteRef } from '../routes';\nimport { useEntityFromUrl } from '../components/CatalogEntityPage/useEntityFromUrl';\nimport { buildFilterFn } from './filter/FilterWrapper';\n\nexport const catalogPage = PageBlueprint.makeWithOverrides({\n inputs: {\n filters: createExtensionInput([coreExtensionData.reactElement]),\n },\n config: {\n schema: {\n pagination: z =>\n z\n .union([\n z.boolean(),\n z.object({\n mode: z.enum(['cursor', 'offset']),\n limit: z.number().optional(),\n offset: z.number().optional(),\n }),\n ])\n .default(true),\n },\n },\n factory(originalFactory, { inputs, config }) {\n return originalFactory({\n path: '/catalog',\n routeRef: rootRouteRef,\n icon: <CategoryIcon />,\n title: 'Catalog',\n loader: async () => {\n const { BaseCatalogPage } = await import('../components/CatalogPage');\n const filters = inputs.filters.map(filter =>\n filter.get(coreExtensionData.reactElement),\n );\n return (\n <BaseCatalogPage\n filters={<>{filters}</>}\n pagination={config.pagination}\n />\n );\n },\n });\n },\n});\n\nexport const catalogEntityPage = PageBlueprint.makeWithOverrides({\n name: 'entity',\n inputs: {\n headers: createExtensionInput([\n EntityHeaderBlueprint.dataRefs.element.optional(),\n EntityHeaderBlueprint.dataRefs.filterFunction.optional(),\n ]),\n contents: createExtensionInput([\n coreExtensionData.reactElement,\n coreExtensionData.routePath,\n coreExtensionData.routeRef.optional(),\n EntityContentBlueprint.dataRefs.title,\n EntityContentBlueprint.dataRefs.filterFunction.optional(),\n EntityContentBlueprint.dataRefs.filterExpression.optional(),\n EntityContentBlueprint.dataRefs.group.optional(),\n EntityContentBlueprint.dataRefs.icon.optional(),\n ]),\n contextMenuItems: createExtensionInput([\n coreExtensionData.reactElement,\n EntityContextMenuItemBlueprint.dataRefs.filterFunction.optional(),\n ]),\n },\n config: {\n schema: {\n groups: z =>\n z\n .array(\n z.record(\n z.string(),\n z.object({\n title: z.string(),\n icon: z.string().optional(),\n }),\n ),\n )\n .optional(),\n showNavItemIcons: z => z.boolean().optional().default(false),\n },\n },\n factory(originalFactory, { config, inputs }) {\n return originalFactory({\n path: '/catalog/:namespace/:kind/:name',\n title: 'Catalog Entity',\n // NOTE: The `convertLegacyRouteRef` call here ensures that this route ref\n // is mutated to support the new frontend system. Removing this conversion\n // is a potentially breaking change since this is a singleton and the\n // route refs from `core-plugin-api` used to not support the new format.\n // This shouldn't be removed until we completely deprecate the\n // `core-compat-api` package.\n routeRef: convertLegacyRouteRef(entityRouteRef), // READ THE ABOVE\n loader: async () => {\n const { EntityLayout } = await import('./components/EntityLayout');\n\n const menuItems = inputs.contextMenuItems.map(item => ({\n element: item.get(coreExtensionData.reactElement),\n filter:\n item.get(EntityContextMenuItemBlueprint.dataRefs.filterFunction) ??\n (() => true),\n }));\n\n // Get available headers, sorted by if they have a filter function or not.\n // TODO(blam): we should really have priority or some specificity here which can be used to sort the headers.\n // That can be done with embedding the priority in the dataRef alongside the filter function.\n const headers = inputs.headers\n .map(header => ({\n element: header.get(EntityHeaderBlueprint.dataRefs.element),\n filter: header.get(EntityHeaderBlueprint.dataRefs.filterFunction),\n }))\n .sort((a, b) => {\n if (a.filter && !b.filter) return -1;\n if (!a.filter && b.filter) return 1;\n return 0;\n });\n\n const groupDefinitions =\n config.groups?.reduce(\n (rest, group) => ({ ...rest, ...group }),\n {} as EntityContentGroupDefinitions,\n ) ?? defaultEntityContentGroupDefinitions;\n\n const Component = () => {\n const entityFromUrl = useEntityFromUrl();\n const { entity } = entityFromUrl;\n const filteredMenuItems = entity\n ? menuItems.filter(i => i.filter(entity)).map(i => i.element)\n : [];\n\n const header = headers.find(\n h => !h.filter || h.filter(entity!),\n )?.element;\n\n return (\n <AsyncEntityProvider {...entityFromUrl}>\n <EntityLayout\n header={header}\n contextMenuItems={filteredMenuItems}\n groupDefinitions={groupDefinitions}\n showNavItemIcons={config.showNavItemIcons}\n >\n {inputs.contents.map(output => (\n <EntityLayout.Route\n group={output.get(EntityContentBlueprint.dataRefs.group)}\n key={output.get(coreExtensionData.routePath)}\n path={output.get(coreExtensionData.routePath)}\n title={output.get(EntityContentBlueprint.dataRefs.title)}\n icon={output.get(EntityContentBlueprint.dataRefs.icon)}\n if={buildFilterFn(\n output.get(\n EntityContentBlueprint.dataRefs.filterFunction,\n ),\n output.get(\n EntityContentBlueprint.dataRefs.filterExpression,\n ),\n )}\n >\n {output.get(coreExtensionData.reactElement)}\n </EntityLayout.Route>\n ))}\n </EntityLayout>\n </AsyncEntityProvider>\n );\n };\n\n return <Component />;\n },\n });\n },\n});\n\nexport default [catalogPage, catalogEntityPage];\n"],"names":[],"mappings":";;;;;;;;;;AAsCO,MAAM,WAAA,GAAc,cAAc,iBAAA,CAAkB;AAAA,EACzD,MAAA,EAAQ;AAAA,IACN,OAAA,EAAS,oBAAA,CAAqB,CAAC,iBAAA,CAAkB,YAAY,CAAC;AAAA,GAChE;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,MAAA,EAAQ;AAAA,MACN,UAAA,EAAY,CAAA,CAAA,KACV,CAAA,CACG,KAAA,CAAM;AAAA,QACL,EAAE,OAAA,EAAQ;AAAA,QACV,EAAE,MAAA,CAAO;AAAA,UACP,MAAM,CAAA,CAAE,IAAA,CAAK,CAAC,QAAA,EAAU,QAAQ,CAAC,CAAA;AAAA,UACjC,KAAA,EAAO,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,UAC3B,MAAA,EAAQ,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA;AAAS,SAC7B;AAAA,OACF,CAAA,CACA,OAAA,CAAQ,IAAI;AAAA;AACnB,GACF;AAAA,EACA,OAAA,CAAQ,eAAA,EAAiB,EAAE,MAAA,EAAQ,QAAO,EAAG;AAC3C,IAAA,OAAO,eAAA,CAAgB;AAAA,MACrB,IAAA,EAAM,UAAA;AAAA,MACN,QAAA,EAAU,YAAA;AAAA,MACV,IAAA,sBAAO,YAAA,EAAA,EAAa,CAAA;AAAA,MACpB,KAAA,EAAO,SAAA;AAAA,MACP,QAAQ,YAAY;AAClB,QAAA,MAAM,EAAE,eAAA,EAAgB,GAAI,MAAM,OAAO,wCAA2B,CAAA;AACpE,QAAA,MAAM,OAAA,GAAU,OAAO,OAAA,CAAQ,GAAA;AAAA,UAAI,CAAA,MAAA,KACjC,MAAA,CAAO,GAAA,CAAI,iBAAA,CAAkB,YAAY;AAAA,SAC3C;AACA,QAAA,uBACE,GAAA;AAAA,UAAC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AAA,CAAkB,SAAS,CAAA;AAAA,kBAC5C,KAAA,EAAO,MAAA,CAAO,GAAA,CAAI,sBAAA,CAAuB,SAAS,KAAK,CAAA;AAAA,kBACvD,IAAA,EAAM,MAAA,CAAO,GAAA,CAAI,sBAAA,CAAuB,SAAS,IAAI,CAAA;AAAA,kBACrD,EAAA,EAAI,aAAA;AAAA,oBACF,MAAA,CAAO,GAAA;AAAA,sBACL,uBAAuB,QAAA,CAAS;AAAA,qBAClC;AAAA,oBACA,MAAA,CAAO,GAAA;AAAA,sBACL,uBAAuB,QAAA,CAAS;AAAA;AAClC,mBACF;AAAA,kBAEC,QAAA,EAAA,MAAA,CAAO,GAAA,CAAI,iBAAA,CAAkB,YAAY;AAAA,iBAAA;AAAA,gBAbrC,MAAA,CAAO,GAAA,CAAI,iBAAA,CAAkB,SAAS;AAAA,eAe9C;AAAA;AAAA,WACH,EACF,CAAA;AAAA,QAEJ,CAAA;AAEA,QAAA,2BAAQ,SAAA,EAAA,EAAU,CAAA;AAAA,MACpB;AAAA,KACD,CAAA;AAAA,EACH;AACF,CAAC;AAED,YAAe,CAAC,aAAa,iBAAiB,CAAA;;;;"}
1
+ {"version":3,"file":"pages.esm.js","sources":["../../src/alpha/pages.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { convertLegacyRouteRef } from '@backstage/core-compat-api';\nimport {\n coreExtensionData,\n createExtensionInput,\n PageBlueprint,\n} from '@backstage/frontend-plugin-api';\nimport {\n AsyncEntityProvider,\n entityRouteRef,\n} from '@backstage/plugin-catalog-react';\nimport {\n defaultEntityContentGroupDefinitions,\n EntityContentBlueprint,\n EntityContextMenuItemBlueprint,\n EntityHeaderBlueprint,\n EntityContentGroupDefinitions,\n} from '@backstage/plugin-catalog-react/alpha';\nimport CategoryIcon from '@material-ui/icons/Category';\nimport { rootRouteRef } from '../routes';\nimport { useEntityFromUrl } from '../components/CatalogEntityPage/useEntityFromUrl';\nimport { buildFilterFn } from './filter/FilterWrapper';\n\nexport const catalogPage = PageBlueprint.makeWithOverrides({\n inputs: {\n filters: createExtensionInput([coreExtensionData.reactElement]),\n },\n config: {\n schema: {\n pagination: z =>\n z\n .union([\n z.boolean(),\n z.object({\n mode: z.enum(['cursor', 'offset']),\n limit: z.number().optional(),\n offset: z.number().optional(),\n }),\n ])\n .default(true),\n },\n },\n factory(originalFactory, { inputs, config }) {\n return originalFactory({\n path: '/catalog',\n routeRef: rootRouteRef,\n icon: <CategoryIcon />,\n title: 'Catalog',\n loader: async () => {\n const { BaseCatalogPage } = await import('../components/CatalogPage');\n const filters = inputs.filters.map(filter =>\n filter.get(coreExtensionData.reactElement),\n );\n return (\n <BaseCatalogPage\n filters={<>{filters}</>}\n pagination={config.pagination}\n />\n );\n },\n });\n },\n});\n\nexport const catalogEntityPage = PageBlueprint.makeWithOverrides({\n name: 'entity',\n inputs: {\n headers: createExtensionInput([\n EntityHeaderBlueprint.dataRefs.element.optional(),\n EntityHeaderBlueprint.dataRefs.filterFunction.optional(),\n ]),\n contents: createExtensionInput([\n coreExtensionData.reactElement,\n coreExtensionData.routePath,\n coreExtensionData.routeRef.optional(),\n EntityContentBlueprint.dataRefs.title,\n EntityContentBlueprint.dataRefs.filterFunction.optional(),\n EntityContentBlueprint.dataRefs.filterExpression.optional(),\n EntityContentBlueprint.dataRefs.group.optional(),\n EntityContentBlueprint.dataRefs.icon.optional(),\n ]),\n contextMenuItems: createExtensionInput([\n coreExtensionData.reactElement,\n EntityContextMenuItemBlueprint.dataRefs.filterFunction.optional(),\n ]),\n },\n config: {\n schema: {\n groups: z =>\n z\n .array(\n z.record(\n z.string(),\n z.object({\n title: z.string(),\n icon: z.string().optional(),\n aliases: z.array(z.string()).optional(),\n contentOrder: z.enum(['title', 'natural']).optional(),\n }),\n ),\n )\n .optional(),\n defaultContentOrder: z =>\n z.enum(['title', 'natural']).optional().default('title'),\n showNavItemIcons: z => z.boolean().optional().default(false),\n },\n },\n factory(originalFactory, { config, inputs }) {\n return originalFactory({\n path: '/catalog/:namespace/:kind/:name',\n title: 'Catalog Entity',\n // NOTE: The `convertLegacyRouteRef` call here ensures that this route ref\n // is mutated to support the new frontend system. Removing this conversion\n // is a potentially breaking change since this is a singleton and the\n // route refs from `core-plugin-api` used to not support the new format.\n // This shouldn't be removed until we completely deprecate the\n // `core-compat-api` package.\n routeRef: convertLegacyRouteRef(entityRouteRef), // READ THE ABOVE\n loader: async () => {\n const { EntityLayout } = await import('./components/EntityLayout');\n\n const menuItems = inputs.contextMenuItems.map(item => ({\n element: item.get(coreExtensionData.reactElement),\n filter:\n item.get(EntityContextMenuItemBlueprint.dataRefs.filterFunction) ??\n (() => true),\n }));\n\n // Get available headers, sorted by if they have a filter function or not.\n // TODO(blam): we should really have priority or some specificity here which can be used to sort the headers.\n // That can be done with embedding the priority in the dataRef alongside the filter function.\n const headers = inputs.headers\n .map(header => ({\n element: header.get(EntityHeaderBlueprint.dataRefs.element),\n filter: header.get(EntityHeaderBlueprint.dataRefs.filterFunction),\n }))\n .sort((a, b) => {\n if (a.filter && !b.filter) return -1;\n if (!a.filter && b.filter) return 1;\n return 0;\n });\n\n const groupDefinitions =\n config.groups?.reduce(\n (rest, group) => ({ ...rest, ...group }),\n {} as EntityContentGroupDefinitions,\n ) ?? defaultEntityContentGroupDefinitions;\n\n const Component = () => {\n const entityFromUrl = useEntityFromUrl();\n const { entity } = entityFromUrl;\n const filteredMenuItems = entity\n ? menuItems.filter(i => i.filter(entity)).map(i => i.element)\n : [];\n\n const header = headers.find(\n h => !h.filter || h.filter(entity!),\n )?.element;\n\n return (\n <AsyncEntityProvider {...entityFromUrl}>\n <EntityLayout\n header={header}\n contextMenuItems={filteredMenuItems}\n groupDefinitions={groupDefinitions}\n defaultContentOrder={config.defaultContentOrder}\n showNavItemIcons={config.showNavItemIcons}\n >\n {inputs.contents.map(output => (\n <EntityLayout.Route\n group={output.get(EntityContentBlueprint.dataRefs.group)}\n key={output.get(coreExtensionData.routePath)}\n path={output.get(coreExtensionData.routePath)}\n title={output.get(EntityContentBlueprint.dataRefs.title)}\n icon={output.get(EntityContentBlueprint.dataRefs.icon)}\n if={buildFilterFn(\n output.get(\n EntityContentBlueprint.dataRefs.filterFunction,\n ),\n output.get(\n EntityContentBlueprint.dataRefs.filterExpression,\n ),\n )}\n >\n {output.get(coreExtensionData.reactElement)}\n </EntityLayout.Route>\n ))}\n </EntityLayout>\n </AsyncEntityProvider>\n );\n };\n\n return <Component />;\n },\n });\n },\n});\n\nexport default [catalogPage, catalogEntityPage];\n"],"names":[],"mappings":";;;;;;;;;;AAsCO,MAAM,WAAA,GAAc,cAAc,iBAAA,CAAkB;AAAA,EACzD,MAAA,EAAQ;AAAA,IACN,OAAA,EAAS,oBAAA,CAAqB,CAAC,iBAAA,CAAkB,YAAY,CAAC;AAAA,GAChE;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,MAAA,EAAQ;AAAA,MACN,UAAA,EAAY,CAAA,CAAA,KACV,CAAA,CACG,KAAA,CAAM;AAAA,QACL,EAAE,OAAA,EAAQ;AAAA,QACV,EAAE,MAAA,CAAO;AAAA,UACP,MAAM,CAAA,CAAE,IAAA,CAAK,CAAC,QAAA,EAAU,QAAQ,CAAC,CAAA;AAAA,UACjC,KAAA,EAAO,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,UAC3B,MAAA,EAAQ,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA;AAAS,SAC7B;AAAA,OACF,CAAA,CACA,OAAA,CAAQ,IAAI;AAAA;AACnB,GACF;AAAA,EACA,OAAA,CAAQ,eA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AAA,EAAA,MAAA,CAAO,GAAA,CAAI,iBAAA,CAAkB,YAAY;AAAA,iBAAA;AAAA,gBAbrC,MAAA,CAAO,GAAA,CAAI,iBAAA,CAAkB,SAAS;AAAA,eAe9C;AAAA;AAAA,WACH,EACF,CAAA;AAAA,QAEJ,CAAA;AAEA,QAAA,2BAAQ,SAAA,EAAA,EAAU,CAAA;AAAA,MACpB;AAAA,KACD,CAAA;AAAA,EACH;AACF,CAAC;AAED,YAAe,CAAC,aAAa,iBAAiB,CAAA;;;;"}
package/dist/alpha.d.ts CHANGED
@@ -625,7 +625,10 @@ declare const _default: _backstage_frontend_plugin_api.OverridableFrontendPlugin
625
625
  groups: Record<string, {
626
626
  title: string;
627
627
  icon?: string | undefined;
628
+ aliases?: string[] | undefined;
629
+ contentOrder?: "title" | "natural" | undefined;
628
630
  }>[] | undefined;
631
+ defaultContentOrder: "title" | "natural";
629
632
  showNavItemIcons: boolean;
630
633
  path: string | undefined;
631
634
  title: string | undefined;
@@ -634,7 +637,10 @@ declare const _default: _backstage_frontend_plugin_api.OverridableFrontendPlugin
634
637
  groups?: Record<string, {
635
638
  title: string;
636
639
  icon?: string | undefined;
640
+ aliases?: string[] | undefined;
641
+ contentOrder?: "title" | "natural" | undefined;
637
642
  }>[] | undefined;
643
+ defaultContentOrder?: "title" | "natural" | undefined;
638
644
  showNavItemIcons?: boolean | undefined;
639
645
  title?: string | undefined;
640
646
  path?: string | undefined;
@@ -1,5 +1,5 @@
1
1
  var name = "@backstage/plugin-catalog";
2
- var version = "1.33.1-next.0";
2
+ var version = "1.34.0-next.1";
3
3
  var description = "The Backstage plugin for browsing the Backstage catalog";
4
4
  var backstage = {
5
5
  role: "frontend-plugin",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog",
3
- "version": "1.33.1-next.0",
3
+ "version": "1.34.0-next.1",
4
4
  "description": "The Backstage plugin for browsing the Backstage catalog",
5
5
  "backstage": {
6
6
  "role": "frontend-plugin",
@@ -70,24 +70,24 @@
70
70
  "test": "backstage-cli package test"
71
71
  },
72
72
  "dependencies": {
73
- "@backstage/catalog-client": "1.13.1-next.0",
73
+ "@backstage/catalog-client": "1.14.0-next.1",
74
74
  "@backstage/catalog-model": "1.7.6",
75
- "@backstage/core-compat-api": "0.5.9-next.0",
75
+ "@backstage/core-compat-api": "0.5.9-next.1",
76
76
  "@backstage/core-components": "0.18.8-next.0",
77
77
  "@backstage/core-plugin-api": "1.12.4-next.0",
78
78
  "@backstage/errors": "1.2.7",
79
79
  "@backstage/frontend-plugin-api": "0.14.2-next.0",
80
- "@backstage/integration-react": "1.2.16-next.0",
80
+ "@backstage/integration-react": "1.2.16-next.1",
81
81
  "@backstage/plugin-catalog-common": "1.1.8",
82
- "@backstage/plugin-catalog-react": "2.0.1-next.0",
82
+ "@backstage/plugin-catalog-react": "2.1.0-next.1",
83
83
  "@backstage/plugin-permission-react": "0.4.41-next.0",
84
- "@backstage/plugin-scaffolder-common": "1.7.7-next.0",
84
+ "@backstage/plugin-scaffolder-common": "2.0.0-next.1",
85
85
  "@backstage/plugin-search-common": "1.2.22",
86
86
  "@backstage/plugin-search-react": "1.10.5-next.0",
87
87
  "@backstage/plugin-techdocs-common": "0.1.1",
88
88
  "@backstage/plugin-techdocs-react": "1.3.9-next.0",
89
89
  "@backstage/types": "1.2.2",
90
- "@backstage/ui": "0.12.1-next.0",
90
+ "@backstage/ui": "0.13.0-next.1",
91
91
  "@backstage/version-bridge": "1.0.12",
92
92
  "@material-ui/core": "^4.12.2",
93
93
  "@material-ui/icons": "^4.9.1",
@@ -103,10 +103,10 @@
103
103
  "zen-observable": "^0.10.0"
104
104
  },
105
105
  "devDependencies": {
106
- "@backstage/cli": "0.35.5-next.0",
106
+ "@backstage/cli": "0.36.0-next.1",
107
107
  "@backstage/core-app-api": "1.19.6-next.0",
108
- "@backstage/dev-utils": "1.1.21-next.0",
109
- "@backstage/frontend-test-utils": "0.5.1-next.0",
108
+ "@backstage/dev-utils": "1.1.21-next.1",
109
+ "@backstage/frontend-test-utils": "0.5.1-next.1",
110
110
  "@backstage/plugin-permission-common": "0.9.6",
111
111
  "@backstage/test-utils": "1.7.16-next.0",
112
112
  "@testing-library/dom": "^10.0.0",