@backstage/plugin-catalog-react 1.17.0-next.2 → 1.17.0

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,75 @@
1
1
  # @backstage/plugin-catalog-react
2
2
 
3
+ ## 1.17.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 0f37fa8: `entityRouteParams` now also accepts entity refs, and can help with encoding the resulting parameters.
8
+ - 61d350f: **BREAKING ALPHA**: `CatalogFilterBlueprint`, used in the new frontend system, is now exported under plugin-catalog-react instead of plugin-catalog.
9
+
10
+ ```diff
11
+ + import { CatalogFilterBlueprint } from '@backstage/plugin-catalog-react/alpha';
12
+ - import { CatalogFilterBlueprint } from '@backstage/plugin-catalog/alpha';
13
+ ```
14
+
15
+ - 09afd67: Adds `EntityContextMenuItemBlueprint` to enable extending the entity page's context menu with user defined items.
16
+
17
+ For example:
18
+
19
+ ```ts
20
+ import { EntityContextMenuItemBlueprint } from '@backstage/plugin-catalog-react/alpha';
21
+
22
+ const myCustomHref = EntityContextMenuItemBlueprint.make({
23
+ name: 'test-href',
24
+ params: {
25
+ icon: <span>Example Icon</span>,
26
+ useProps: () => ({
27
+ title: 'Example Href',
28
+ href: '/example-path',
29
+ disabled: false,
30
+ component: 'a',
31
+ }),
32
+ },
33
+ });
34
+
35
+ const myCustomOnClick = EntityContextMenuItemBlueprint.make({
36
+ name: 'test-click',
37
+ params: {
38
+ icon: <span>Test Icon</span>,
39
+ useProps: () => ({
40
+ title: 'Example onClick',
41
+ onClick: () => window.alert('Hello world!'),
42
+ disabled: false,
43
+ }),
44
+ },
45
+ });
46
+ ```
47
+
48
+ ### Patch Changes
49
+
50
+ - a47fd39: Removes instances of default React imports, a necessary update for the upcoming React 19 migration.
51
+
52
+ <https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html>
53
+
54
+ - 3f7e4f1: Added a new `overview` entity content group for the new frontend system.
55
+ - 186d016: Add `operation` to alpha `defaultEntityContentGroups`.
56
+ - 221ddba: Fix offset pagination to reset when updating filters in `useEntityList`
57
+ - Updated dependencies
58
+ - @backstage/frontend-plugin-api@0.10.1
59
+ - @backstage/frontend-test-utils@0.3.1
60
+ - @backstage/integration-react@1.2.6
61
+ - @backstage/core-compat-api@0.4.1
62
+ - @backstage/core-components@0.17.1
63
+ - @backstage/core-plugin-api@1.10.6
64
+ - @backstage/plugin-permission-react@0.4.33
65
+ - @backstage/catalog-client@1.9.1
66
+ - @backstage/catalog-model@1.7.3
67
+ - @backstage/errors@1.2.7
68
+ - @backstage/types@1.2.1
69
+ - @backstage/version-bridge@1.0.11
70
+ - @backstage/plugin-catalog-common@1.1.3
71
+ - @backstage/plugin-permission-common@0.8.4
72
+
3
73
  ## 1.17.0-next.2
4
74
 
5
75
  ### Minor Changes
@@ -8,6 +8,7 @@ const entityFilterExpressionDataRef = createExtensionDataRef().with({
8
8
  id: "catalog.entity-filter-expression"
9
9
  });
10
10
  const defaultEntityContentGroups = {
11
+ overview: "Overview",
11
12
  documentation: "Documentation",
12
13
  development: "Development",
13
14
  deployment: "Deployment",
@@ -1 +1 @@
1
- {"version":3,"file":"extensionData.esm.js","sources":["../../../src/alpha/blueprints/extensionData.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 { Entity } from '@backstage/catalog-model';\nimport { createExtensionDataRef } from '@backstage/frontend-plugin-api';\n\n/** @internal */\nexport const entityContentTitleDataRef = createExtensionDataRef<string>().with({\n id: 'catalog.entity-content-title',\n});\n\n/** @internal */\nexport const entityFilterFunctionDataRef = createExtensionDataRef<\n (entity: Entity) => boolean\n>().with({ id: 'catalog.entity-filter-function' });\n\n/** @internal */\nexport const entityFilterExpressionDataRef =\n createExtensionDataRef<string>().with({\n id: 'catalog.entity-filter-expression',\n });\n\n/**\n * @alpha\n * Default entity content groups.\n */\nexport const defaultEntityContentGroups = {\n documentation: 'Documentation',\n development: 'Development',\n deployment: 'Deployment',\n operation: 'Operation',\n observability: 'Observability',\n};\n\n/** @internal */\nexport const entityContentGroupDataRef = createExtensionDataRef<string>().with({\n id: 'catalog.entity-content-group',\n});\n\n/**\n * @internal\n * Available entity card types\n */\nexport const entityCardTypes = [\n 'summary',\n 'info',\n 'content',\n] as const satisfies readonly EntityCardType[];\n\n/** @alpha */\nexport type EntityCardType = 'summary' | 'info' | 'content';\n\n/** @internal */\nexport const entityCardTypeDataRef =\n createExtensionDataRef<EntityCardType>().with({\n id: 'catalog.entity-card-type',\n });\n"],"names":[],"mappings":";;AAoBa,MAAA,yBAAA,GAA4B,sBAA+B,EAAA,CAAE,IAAK,CAAA;AAAA,EAC7E,EAAI,EAAA;AACN,CAAC;AAGM,MAAM,8BAA8B,sBAEzC,EAAA,CAAE,KAAK,EAAE,EAAA,EAAI,kCAAkC;AAGpC,MAAA,6BAAA,GACX,sBAA+B,EAAA,CAAE,IAAK,CAAA;AAAA,EACpC,EAAI,EAAA;AACN,CAAC;AAMI,MAAM,0BAA6B,GAAA;AAAA,EACxC,aAAe,EAAA,eAAA;AAAA,EACf,WAAa,EAAA,aAAA;AAAA,EACb,UAAY,EAAA,YAAA;AAAA,EACZ,SAAW,EAAA,WAAA;AAAA,EACX,aAAe,EAAA;AACjB;AAGa,MAAA,yBAAA,GAA4B,sBAA+B,EAAA,CAAE,IAAK,CAAA;AAAA,EAC7E,EAAI,EAAA;AACN,CAAC;AAMM,MAAM,eAAkB,GAAA;AAAA,EAC7B,SAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF;AAMa,MAAA,qBAAA,GACX,sBAAuC,EAAA,CAAE,IAAK,CAAA;AAAA,EAC5C,EAAI,EAAA;AACN,CAAC;;;;"}
1
+ {"version":3,"file":"extensionData.esm.js","sources":["../../../src/alpha/blueprints/extensionData.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 { Entity } from '@backstage/catalog-model';\nimport { createExtensionDataRef } from '@backstage/frontend-plugin-api';\n\n/** @internal */\nexport const entityContentTitleDataRef = createExtensionDataRef<string>().with({\n id: 'catalog.entity-content-title',\n});\n\n/** @internal */\nexport const entityFilterFunctionDataRef = createExtensionDataRef<\n (entity: Entity) => boolean\n>().with({ id: 'catalog.entity-filter-function' });\n\n/** @internal */\nexport const entityFilterExpressionDataRef =\n createExtensionDataRef<string>().with({\n id: 'catalog.entity-filter-expression',\n });\n\n/**\n * @alpha\n * Default entity content groups.\n */\nexport const defaultEntityContentGroups = {\n overview: 'Overview',\n documentation: 'Documentation',\n development: 'Development',\n deployment: 'Deployment',\n operation: 'Operation',\n observability: 'Observability',\n};\n\n/** @internal */\nexport const entityContentGroupDataRef = createExtensionDataRef<string>().with({\n id: 'catalog.entity-content-group',\n});\n\n/**\n * @internal\n * Available entity card types\n */\nexport const entityCardTypes = [\n 'summary',\n 'info',\n 'content',\n] as const satisfies readonly EntityCardType[];\n\n/** @alpha */\nexport type EntityCardType = 'summary' | 'info' | 'content';\n\n/** @internal */\nexport const entityCardTypeDataRef =\n createExtensionDataRef<EntityCardType>().with({\n id: 'catalog.entity-card-type',\n });\n"],"names":[],"mappings":";;AAoBa,MAAA,yBAAA,GAA4B,sBAA+B,EAAA,CAAE,IAAK,CAAA;AAAA,EAC7E,EAAI,EAAA;AACN,CAAC;AAGM,MAAM,8BAA8B,sBAEzC,EAAA,CAAE,KAAK,EAAE,EAAA,EAAI,kCAAkC;AAGpC,MAAA,6BAAA,GACX,sBAA+B,EAAA,CAAE,IAAK,CAAA;AAAA,EACpC,EAAI,EAAA;AACN,CAAC;AAMI,MAAM,0BAA6B,GAAA;AAAA,EACxC,QAAU,EAAA,UAAA;AAAA,EACV,aAAe,EAAA,eAAA;AAAA,EACf,WAAa,EAAA,aAAA;AAAA,EACb,UAAY,EAAA,YAAA;AAAA,EACZ,SAAW,EAAA,WAAA;AAAA,EACX,aAAe,EAAA;AACjB;AAGa,MAAA,yBAAA,GAA4B,sBAA+B,EAAA,CAAE,IAAK,CAAA;AAAA,EAC7E,EAAI,EAAA;AACN,CAAC;AAMM,MAAM,eAAkB,GAAA;AAAA,EAC7B,SAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF;AAMa,MAAA,qBAAA,GACX,sBAAuC,EAAA,CAAE,IAAK,CAAA;AAAA,EAC5C,EAAI,EAAA;AACN,CAAC;;;;"}
package/dist/alpha.d.ts CHANGED
@@ -40,6 +40,7 @@ declare const CatalogFilterBlueprint: _backstage_frontend_plugin_api.ExtensionBl
40
40
  * Default entity content groups.
41
41
  */
42
42
  declare const defaultEntityContentGroups: {
43
+ overview: string;
43
44
  documentation: string;
44
45
  development: string;
45
46
  deployment: string;
@@ -1,9 +1,8 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { parseEntityRef, DEFAULT_NAMESPACE } from '@backstage/catalog-model';
3
2
  import { Link } from '@backstage/core-components';
4
3
  import { useRouteRef } from '@backstage/core-plugin-api';
5
4
  import { forwardRef } from 'react';
6
- import { entityRouteRef } from '../../routes.esm.js';
5
+ import { entityRouteRef, entityRouteParams } from '../../routes.esm.js';
7
6
  import { EntityDisplayName } from '../EntityDisplayName/EntityDisplayName.esm.js';
8
7
 
9
8
  const EntityRefLink = forwardRef(
@@ -34,30 +33,7 @@ const EntityRefLink = forwardRef(
34
33
  );
35
34
  function useEntityRoute(entityRef) {
36
35
  const entityRoute = useRouteRef(entityRouteRef);
37
- let kind;
38
- let namespace;
39
- let name;
40
- if (typeof entityRef === "string") {
41
- const parsed = parseEntityRef(entityRef);
42
- kind = parsed.kind;
43
- namespace = parsed.namespace;
44
- name = parsed.name;
45
- } else if ("metadata" in entityRef) {
46
- kind = entityRef.kind;
47
- namespace = entityRef.metadata.namespace;
48
- name = entityRef.metadata.name;
49
- } else {
50
- kind = entityRef.kind;
51
- namespace = entityRef.namespace;
52
- name = entityRef.name;
53
- }
54
- kind = kind.toLocaleLowerCase("en-US");
55
- namespace = namespace?.toLocaleLowerCase("en-US") ?? DEFAULT_NAMESPACE;
56
- const routeParams = {
57
- kind: encodeURIComponent(kind),
58
- namespace: encodeURIComponent(namespace),
59
- name: encodeURIComponent(name)
60
- };
36
+ const routeParams = entityRouteParams(entityRef, { encodeParams: true });
61
37
  return entityRoute(routeParams);
62
38
  }
63
39
 
@@ -1 +1 @@
1
- {"version":3,"file":"EntityRefLink.esm.js","sources":["../../../src/components/EntityRefLink/EntityRefLink.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 {\n CompoundEntityRef,\n DEFAULT_NAMESPACE,\n Entity,\n parseEntityRef,\n} from '@backstage/catalog-model';\nimport { Link, LinkProps } from '@backstage/core-components';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { ReactNode, forwardRef } from 'react';\nimport { entityRouteRef } from '../../routes';\nimport { EntityDisplayName } from '../EntityDisplayName';\n\n/**\n * Props for {@link EntityRefLink}.\n *\n * @public\n */\nexport type EntityRefLinkProps = {\n entityRef: Entity | CompoundEntityRef | string;\n defaultKind?: string;\n defaultNamespace?: string;\n /** @deprecated This option should no longer be used; presentation is requested through the {@link entityPresentationApiRef} instead */\n title?: string;\n children?: ReactNode;\n hideIcon?: boolean;\n disableTooltip?: boolean;\n} & Omit<LinkProps, 'to'>;\n\n/**\n * Shows a clickable link to an entity.\n *\n * @public\n */\nexport const EntityRefLink = forwardRef<any, EntityRefLinkProps>(\n (props, ref) => {\n const {\n entityRef,\n defaultKind,\n defaultNamespace,\n title,\n children,\n hideIcon,\n disableTooltip,\n ...linkProps\n } = props;\n const entityRoute = useEntityRoute(props.entityRef);\n\n const content = children ?? title ?? (\n <EntityDisplayName\n entityRef={entityRef}\n defaultKind={defaultKind}\n defaultNamespace={defaultNamespace}\n hideIcon={hideIcon}\n disableTooltip={disableTooltip}\n />\n );\n\n return (\n <Link {...linkProps} ref={ref} to={entityRoute}>\n {content}\n </Link>\n );\n },\n) as (props: EntityRefLinkProps) => JSX.Element;\n\n// Hook that computes the route to a given entity / ref. This is a bit\n// contrived, because it tries to retain the casing of the entity name if\n// present, but not of other parts. This is in an attempt to make slightly more\n// nice-looking URLs.\nfunction useEntityRoute(\n entityRef: Entity | CompoundEntityRef | string,\n): string {\n const entityRoute = useRouteRef(entityRouteRef);\n\n let kind;\n let namespace;\n let name;\n\n if (typeof entityRef === 'string') {\n const parsed = parseEntityRef(entityRef);\n kind = parsed.kind;\n namespace = parsed.namespace;\n name = parsed.name;\n } else if ('metadata' in entityRef) {\n kind = entityRef.kind;\n namespace = entityRef.metadata.namespace;\n name = entityRef.metadata.name;\n } else {\n kind = entityRef.kind;\n namespace = entityRef.namespace;\n name = entityRef.name;\n }\n\n kind = kind.toLocaleLowerCase('en-US');\n namespace = namespace?.toLocaleLowerCase('en-US') ?? DEFAULT_NAMESPACE;\n\n const routeParams = {\n kind: encodeURIComponent(kind),\n namespace: encodeURIComponent(namespace),\n name: encodeURIComponent(name),\n };\n\n return entityRoute(routeParams);\n}\n"],"names":[],"mappings":";;;;;;;;AAiDO,MAAM,aAAgB,GAAA,UAAA;AAAA,EAC3B,CAAC,OAAO,GAAQ,KAAA;AACd,IAAM,MAAA;AAAA,MACJ,SAAA;AAAA,MACA,WAAA;AAAA,MACA,gBAAA;AAAA,MACA,KAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,cAAA;AAAA,MACA,GAAG;AAAA,KACD,GAAA,KAAA;AACJ,IAAM,MAAA,WAAA,GAAc,cAAe,CAAA,KAAA,CAAM,SAAS,CAAA;AAElD,IAAM,MAAA,OAAA,GAAU,YAAY,KAC1B,oBAAA,GAAA;AAAA,MAAC,iBAAA;AAAA,MAAA;AAAA,QACC,SAAA;AAAA,QACA,WAAA;AAAA,QACA,gBAAA;AAAA,QACA,QAAA;AAAA,QACA;AAAA;AAAA,KACF;AAGF,IAAA,2BACG,IAAM,EAAA,EAAA,GAAG,WAAW,GAAU,EAAA,EAAA,EAAI,aAChC,QACH,EAAA,OAAA,EAAA,CAAA;AAAA;AAGN;AAMA,SAAS,eACP,SACQ,EAAA;AACR,EAAM,MAAA,WAAA,GAAc,YAAY,cAAc,CAAA;AAE9C,EAAI,IAAA,IAAA;AACJ,EAAI,IAAA,SAAA;AACJ,EAAI,IAAA,IAAA;AAEJ,EAAI,IAAA,OAAO,cAAc,QAAU,EAAA;AACjC,IAAM,MAAA,MAAA,GAAS,eAAe,SAAS,CAAA;AACvC,IAAA,IAAA,GAAO,MAAO,CAAA,IAAA;AACd,IAAA,SAAA,GAAY,MAAO,CAAA,SAAA;AACnB,IAAA,IAAA,GAAO,MAAO,CAAA,IAAA;AAAA,GAChB,MAAA,IAAW,cAAc,SAAW,EAAA;AAClC,IAAA,IAAA,GAAO,SAAU,CAAA,IAAA;AACjB,IAAA,SAAA,GAAY,UAAU,QAAS,CAAA,SAAA;AAC/B,IAAA,IAAA,GAAO,UAAU,QAAS,CAAA,IAAA;AAAA,GACrB,MAAA;AACL,IAAA,IAAA,GAAO,SAAU,CAAA,IAAA;AACjB,IAAA,SAAA,GAAY,SAAU,CAAA,SAAA;AACtB,IAAA,IAAA,GAAO,SAAU,CAAA,IAAA;AAAA;AAGnB,EAAO,IAAA,GAAA,IAAA,CAAK,kBAAkB,OAAO,CAAA;AACrC,EAAY,SAAA,GAAA,SAAA,EAAW,iBAAkB,CAAA,OAAO,CAAK,IAAA,iBAAA;AAErD,EAAA,MAAM,WAAc,GAAA;AAAA,IAClB,IAAA,EAAM,mBAAmB,IAAI,CAAA;AAAA,IAC7B,SAAA,EAAW,mBAAmB,SAAS,CAAA;AAAA,IACvC,IAAA,EAAM,mBAAmB,IAAI;AAAA,GAC/B;AAEA,EAAA,OAAO,YAAY,WAAW,CAAA;AAChC;;;;"}
1
+ {"version":3,"file":"EntityRefLink.esm.js","sources":["../../../src/components/EntityRefLink/EntityRefLink.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 { CompoundEntityRef, Entity } from '@backstage/catalog-model';\nimport { Link, LinkProps } from '@backstage/core-components';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { ReactNode, forwardRef } from 'react';\nimport { entityRouteParams, entityRouteRef } from '../../routes';\nimport { EntityDisplayName } from '../EntityDisplayName';\n\n/**\n * Props for {@link EntityRefLink}.\n *\n * @public\n */\nexport type EntityRefLinkProps = {\n entityRef: Entity | CompoundEntityRef | string;\n defaultKind?: string;\n defaultNamespace?: string;\n /** @deprecated This option should no longer be used; presentation is requested through the {@link entityPresentationApiRef} instead */\n title?: string;\n children?: ReactNode;\n hideIcon?: boolean;\n disableTooltip?: boolean;\n} & Omit<LinkProps, 'to'>;\n\n/**\n * Shows a clickable link to an entity.\n *\n * @public\n */\nexport const EntityRefLink = forwardRef<any, EntityRefLinkProps>(\n (props, ref) => {\n const {\n entityRef,\n defaultKind,\n defaultNamespace,\n title,\n children,\n hideIcon,\n disableTooltip,\n ...linkProps\n } = props;\n const entityRoute = useEntityRoute(props.entityRef);\n\n const content = children ?? title ?? (\n <EntityDisplayName\n entityRef={entityRef}\n defaultKind={defaultKind}\n defaultNamespace={defaultNamespace}\n hideIcon={hideIcon}\n disableTooltip={disableTooltip}\n />\n );\n\n return (\n <Link {...linkProps} ref={ref} to={entityRoute}>\n {content}\n </Link>\n );\n },\n) as (props: EntityRefLinkProps) => JSX.Element;\n\n// Hook that computes the route to a given entity / ref. This is a bit\n// contrived, because it tries to retain the casing of the entity name if\n// present, but not of other parts. This is in an attempt to make slightly more\n// nice-looking URLs.\nfunction useEntityRoute(\n entityRef: Entity | CompoundEntityRef | string,\n): string {\n const entityRoute = useRouteRef(entityRouteRef);\n\n const routeParams = entityRouteParams(entityRef, { encodeParams: true });\n\n return entityRoute(routeParams);\n}\n"],"names":[],"mappings":";;;;;;;AA4CO,MAAM,aAAgB,GAAA,UAAA;AAAA,EAC3B,CAAC,OAAO,GAAQ,KAAA;AACd,IAAM,MAAA;AAAA,MACJ,SAAA;AAAA,MACA,WAAA;AAAA,MACA,gBAAA;AAAA,MACA,KAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,cAAA;AAAA,MACA,GAAG;AAAA,KACD,GAAA,KAAA;AACJ,IAAM,MAAA,WAAA,GAAc,cAAe,CAAA,KAAA,CAAM,SAAS,CAAA;AAElD,IAAM,MAAA,OAAA,GAAU,YAAY,KAC1B,oBAAA,GAAA;AAAA,MAAC,iBAAA;AAAA,MAAA;AAAA,QACC,SAAA;AAAA,QACA,WAAA;AAAA,QACA,gBAAA;AAAA,QACA,QAAA;AAAA,QACA;AAAA;AAAA,KACF;AAGF,IAAA,2BACG,IAAM,EAAA,EAAA,GAAG,WAAW,GAAU,EAAA,EAAA,EAAI,aAChC,QACH,EAAA,OAAA,EAAA,CAAA;AAAA;AAGN;AAMA,SAAS,eACP,SACQ,EAAA;AACR,EAAM,MAAA,WAAA,GAAc,YAAY,cAAc,CAAA;AAE9C,EAAA,MAAM,cAAc,iBAAkB,CAAA,SAAA,EAAW,EAAE,YAAA,EAAc,MAAM,CAAA;AAEvE,EAAA,OAAO,YAAY,WAAW,CAAA;AAChC;;;;"}
package/dist/index.d.ts CHANGED
@@ -945,11 +945,18 @@ declare const entityRouteRef: _backstage_core_plugin_api.RouteRef<{
945
945
  kind: string;
946
946
  namespace: string;
947
947
  }>;
948
+ /**
949
+ * Configurable options for `entityRouteParams`
950
+ * @public
951
+ */
952
+ type EntityRouteParamsOptions = {
953
+ encodeParams?: boolean;
954
+ };
948
955
  /**
949
956
  * Utility function to get suitable route params for entityRoute, given an
950
957
  * @public
951
958
  */
952
- declare function entityRouteParams(entity: Entity): {
959
+ declare function entityRouteParams(entityOrRef: Entity | CompoundEntityRef | string, options?: EntityRouteParamsOptions): {
953
960
  readonly kind: string;
954
961
  readonly namespace: string;
955
962
  readonly name: string;
@@ -1002,4 +1009,4 @@ declare function MockEntityListContextProvider<T extends DefaultEntityFilters =
1002
1009
  value?: Partial<EntityListContextProps<T>>;
1003
1010
  }>): react_jsx_runtime.JSX.Element;
1004
1011
 
1005
- export { type AllowedEntityFilters, AsyncEntityProvider, type AsyncEntityProviderProps, type BackstageOverrides, CatalogAutocomplete, type CatalogAutocompleteProps, CatalogFilterLayout, type CatalogReactComponentsNameToClassKey, type CatalogReactEntityAutocompletePickerClassKey, type CatalogReactEntityDisplayNameClassKey, type CatalogReactEntityLifecyclePickerClassKey, type CatalogReactEntityNamespacePickerClassKey, type CatalogReactEntityOwnerPickerClassKey, type CatalogReactEntityProcessingStatusPickerClassKey, type CatalogReactEntitySearchBarClassKey, type CatalogReactEntityTagPickerClassKey, type CatalogReactUserListPickerClassKey, type DefaultEntityFilters, DefaultFilters, type DefaultFiltersProps, EntityAutocompletePicker, type EntityAutocompletePickerProps, EntityDisplayName, type EntityDisplayNameProps, EntityErrorFilter, type EntityFilter, EntityKindFilter, EntityKindPicker, type EntityKindPickerProps, EntityLifecycleFilter, EntityLifecyclePicker, EntityListContext, type EntityListContextProps, type EntityListPagination, EntityListProvider, type EntityListProviderProps, type EntityLoadingStatus, EntityNamespaceFilter, EntityNamespacePicker, type EntityNamespacePickerProps, EntityOrphanFilter, EntityOwnerFilter, EntityOwnerPicker, type EntityOwnerPickerProps, EntityPeekAheadPopover, type EntityPeekAheadPopoverProps, type EntityPresentationApi, EntityProcessingStatusPicker, EntityProvider, type EntityProviderProps, EntityRefLink, type EntityRefLinkProps, EntityRefLinks, type EntityRefLinksProps, type EntityRefPresentation, type EntityRefPresentationSnapshot, EntitySearchBar, type EntitySourceLocation, EntityTable, type EntityTableProps, EntityTagFilter, EntityTagPicker, type EntityTagPickerProps, EntityTextFilter, EntityTypeFilter, EntityTypePicker, type EntityTypePickerProps, EntityUserFilter, FavoriteEntity, type FavoriteEntityProps, type FixedWidthFormControlLabelClassKey, InspectEntityDialog, MissingAnnotationEmptyState, type MissingAnnotationEmptyStateClassKey, MockEntityListContextProvider, MockStarredEntitiesApi, type PaginationMode, type StarredEntitiesApi, UnregisterEntityDialog, type UnregisterEntityDialogProps, UserListFilter, type UserListFilterKind, UserListPicker, type UserListPickerProps, catalogApiRef, columnFactories, defaultEntityPresentation, entityPresentationApiRef, entityRouteParams, entityRouteRef, getEntityRelations, getEntitySourceLocation, humanizeEntityRef, starredEntitiesApiRef, useAsyncEntity, useEntity, useEntityList, useEntityOwnership, useEntityPresentation, useEntityTypeFilter, useRelatedEntities, useStarredEntities, useStarredEntity };
1012
+ export { type AllowedEntityFilters, AsyncEntityProvider, type AsyncEntityProviderProps, type BackstageOverrides, CatalogAutocomplete, type CatalogAutocompleteProps, CatalogFilterLayout, type CatalogReactComponentsNameToClassKey, type CatalogReactEntityAutocompletePickerClassKey, type CatalogReactEntityDisplayNameClassKey, type CatalogReactEntityLifecyclePickerClassKey, type CatalogReactEntityNamespacePickerClassKey, type CatalogReactEntityOwnerPickerClassKey, type CatalogReactEntityProcessingStatusPickerClassKey, type CatalogReactEntitySearchBarClassKey, type CatalogReactEntityTagPickerClassKey, type CatalogReactUserListPickerClassKey, type DefaultEntityFilters, DefaultFilters, type DefaultFiltersProps, EntityAutocompletePicker, type EntityAutocompletePickerProps, EntityDisplayName, type EntityDisplayNameProps, EntityErrorFilter, type EntityFilter, EntityKindFilter, EntityKindPicker, type EntityKindPickerProps, EntityLifecycleFilter, EntityLifecyclePicker, EntityListContext, type EntityListContextProps, type EntityListPagination, EntityListProvider, type EntityListProviderProps, type EntityLoadingStatus, EntityNamespaceFilter, EntityNamespacePicker, type EntityNamespacePickerProps, EntityOrphanFilter, EntityOwnerFilter, EntityOwnerPicker, type EntityOwnerPickerProps, EntityPeekAheadPopover, type EntityPeekAheadPopoverProps, type EntityPresentationApi, EntityProcessingStatusPicker, EntityProvider, type EntityProviderProps, EntityRefLink, type EntityRefLinkProps, EntityRefLinks, type EntityRefLinksProps, type EntityRefPresentation, type EntityRefPresentationSnapshot, type EntityRouteParamsOptions, EntitySearchBar, type EntitySourceLocation, EntityTable, type EntityTableProps, EntityTagFilter, EntityTagPicker, type EntityTagPickerProps, EntityTextFilter, EntityTypeFilter, EntityTypePicker, type EntityTypePickerProps, EntityUserFilter, FavoriteEntity, type FavoriteEntityProps, type FixedWidthFormControlLabelClassKey, InspectEntityDialog, MissingAnnotationEmptyState, type MissingAnnotationEmptyStateClassKey, MockEntityListContextProvider, MockStarredEntitiesApi, type PaginationMode, type StarredEntitiesApi, UnregisterEntityDialog, type UnregisterEntityDialogProps, UserListFilter, type UserListFilterKind, UserListPicker, type UserListPickerProps, catalogApiRef, columnFactories, defaultEntityPresentation, entityPresentationApiRef, entityRouteParams, entityRouteRef, getEntityRelations, getEntitySourceLocation, humanizeEntityRef, starredEntitiesApiRef, useAsyncEntity, useEntity, useEntityList, useEntityOwnership, useEntityPresentation, useEntityTypeFilter, useRelatedEntities, useStarredEntities, useStarredEntity };
@@ -1,4 +1,4 @@
1
- import { DEFAULT_NAMESPACE } from '@backstage/catalog-model';
1
+ import { parseEntityRef, DEFAULT_NAMESPACE } from '@backstage/catalog-model';
2
2
  import { createRouteRef } from '@backstage/core-plugin-api';
3
3
  import { getOrCreateGlobalSingleton } from '@backstage/version-bridge';
4
4
 
@@ -9,11 +9,36 @@ const entityRouteRef = getOrCreateGlobalSingleton(
9
9
  params: ["namespace", "kind", "name"]
10
10
  })
11
11
  );
12
- function entityRouteParams(entity) {
12
+ function entityRouteParams(entityOrRef, options) {
13
+ let kind;
14
+ let namespace;
15
+ let name;
16
+ if (typeof entityOrRef === "string") {
17
+ const parsed = parseEntityRef(entityOrRef);
18
+ kind = parsed.kind;
19
+ namespace = parsed.namespace;
20
+ name = parsed.name;
21
+ } else if ("metadata" in entityOrRef) {
22
+ kind = entityOrRef.kind;
23
+ namespace = entityOrRef.metadata.namespace;
24
+ name = entityOrRef.metadata.name;
25
+ } else {
26
+ kind = entityOrRef.kind;
27
+ namespace = entityOrRef.namespace;
28
+ name = entityOrRef.name;
29
+ }
30
+ kind = kind.toLocaleLowerCase("en-US");
31
+ namespace = namespace?.toLocaleLowerCase("en-US") ?? DEFAULT_NAMESPACE;
32
+ const { encodeParams = false } = options || {};
33
+ if (encodeParams) {
34
+ kind = encodeURIComponent(kind);
35
+ namespace = encodeURIComponent(namespace);
36
+ name = encodeURIComponent(name);
37
+ }
13
38
  return {
14
- kind: entity.kind.toLocaleLowerCase("en-US"),
15
- namespace: entity.metadata.namespace?.toLocaleLowerCase("en-US") ?? DEFAULT_NAMESPACE,
16
- name: entity.metadata.name
39
+ kind,
40
+ namespace,
41
+ name
17
42
  };
18
43
  }
19
44
 
@@ -1 +1 @@
1
- {"version":3,"file":"routes.esm.js","sources":["../src/routes.ts"],"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 { Entity, DEFAULT_NAMESPACE } from '@backstage/catalog-model';\nimport { createRouteRef } from '@backstage/core-plugin-api';\nimport { getOrCreateGlobalSingleton } from '@backstage/version-bridge';\n\n/**\n * A stable route ref that points to the catalog page for an individual entity.\n *\n * This `RouteRef` can be imported and used directly, and does not need to be referenced\n * via an `ExternalRouteRef`.\n *\n * If you want to replace the `EntityPage` from `@backstage/catalog-plugin` in your app,\n * you need to use the `entityRouteRef` as the mount point instead of your own.\n * @public\n */\nexport const entityRouteRef = getOrCreateGlobalSingleton(\n 'catalog:entity-route-ref',\n () =>\n createRouteRef({\n id: 'catalog:entity',\n params: ['namespace', 'kind', 'name'],\n }),\n);\n\n/**\n * Utility function to get suitable route params for entityRoute, given an\n * @public\n */\nexport function entityRouteParams(entity: Entity) {\n return {\n kind: entity.kind.toLocaleLowerCase('en-US'),\n namespace:\n entity.metadata.namespace?.toLocaleLowerCase('en-US') ??\n DEFAULT_NAMESPACE,\n name: entity.metadata.name,\n } as const;\n}\n"],"names":[],"mappings":";;;;AA8BO,MAAM,cAAiB,GAAA,0BAAA;AAAA,EAC5B,0BAAA;AAAA,EACA,MACE,cAAe,CAAA;AAAA,IACb,EAAI,EAAA,gBAAA;AAAA,IACJ,MAAQ,EAAA,CAAC,WAAa,EAAA,MAAA,EAAQ,MAAM;AAAA,GACrC;AACL;AAMO,SAAS,kBAAkB,MAAgB,EAAA;AAChD,EAAO,OAAA;AAAA,IACL,IAAM,EAAA,MAAA,CAAO,IAAK,CAAA,iBAAA,CAAkB,OAAO,CAAA;AAAA,IAC3C,WACE,MAAO,CAAA,QAAA,CAAS,SAAW,EAAA,iBAAA,CAAkB,OAAO,CACpD,IAAA,iBAAA;AAAA,IACF,IAAA,EAAM,OAAO,QAAS,CAAA;AAAA,GACxB;AACF;;;;"}
1
+ {"version":3,"file":"routes.esm.js","sources":["../src/routes.ts"],"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 {\n Entity,\n DEFAULT_NAMESPACE,\n CompoundEntityRef,\n parseEntityRef,\n} from '@backstage/catalog-model';\nimport { createRouteRef } from '@backstage/core-plugin-api';\nimport { getOrCreateGlobalSingleton } from '@backstage/version-bridge';\n\n/**\n * A stable route ref that points to the catalog page for an individual entity.\n *\n * This `RouteRef` can be imported and used directly, and does not need to be referenced\n * via an `ExternalRouteRef`.\n *\n * If you want to replace the `EntityPage` from `@backstage/catalog-plugin` in your app,\n * you need to use the `entityRouteRef` as the mount point instead of your own.\n * @public\n */\nexport const entityRouteRef = getOrCreateGlobalSingleton(\n 'catalog:entity-route-ref',\n () =>\n createRouteRef({\n id: 'catalog:entity',\n params: ['namespace', 'kind', 'name'],\n }),\n);\n\n/**\n * Configurable options for `entityRouteParams`\n * @public\n */\nexport type EntityRouteParamsOptions = {\n encodeParams?: boolean;\n};\n\n/**\n * Utility function to get suitable route params for entityRoute, given an\n * @public\n */\nexport function entityRouteParams(\n entityOrRef: Entity | CompoundEntityRef | string,\n options?: EntityRouteParamsOptions,\n) {\n let kind;\n let namespace;\n let name;\n\n if (typeof entityOrRef === 'string') {\n const parsed = parseEntityRef(entityOrRef);\n kind = parsed.kind;\n namespace = parsed.namespace;\n name = parsed.name;\n } else if ('metadata' in entityOrRef) {\n kind = entityOrRef.kind;\n namespace = entityOrRef.metadata.namespace;\n name = entityOrRef.metadata.name;\n } else {\n kind = entityOrRef.kind;\n namespace = entityOrRef.namespace;\n name = entityOrRef.name;\n }\n\n kind = kind.toLocaleLowerCase('en-US');\n namespace = namespace?.toLocaleLowerCase('en-US') ?? DEFAULT_NAMESPACE;\n\n const { encodeParams = false } = options || {};\n if (encodeParams) {\n kind = encodeURIComponent(kind);\n namespace = encodeURIComponent(namespace);\n name = encodeURIComponent(name);\n }\n\n return {\n kind,\n namespace,\n name,\n } as const;\n}\n"],"names":[],"mappings":";;;;AAmCO,MAAM,cAAiB,GAAA,0BAAA;AAAA,EAC5B,0BAAA;AAAA,EACA,MACE,cAAe,CAAA;AAAA,IACb,EAAI,EAAA,gBAAA;AAAA,IACJ,MAAQ,EAAA,CAAC,WAAa,EAAA,MAAA,EAAQ,MAAM;AAAA,GACrC;AACL;AAcgB,SAAA,iBAAA,CACd,aACA,OACA,EAAA;AACA,EAAI,IAAA,IAAA;AACJ,EAAI,IAAA,SAAA;AACJ,EAAI,IAAA,IAAA;AAEJ,EAAI,IAAA,OAAO,gBAAgB,QAAU,EAAA;AACnC,IAAM,MAAA,MAAA,GAAS,eAAe,WAAW,CAAA;AACzC,IAAA,IAAA,GAAO,MAAO,CAAA,IAAA;AACd,IAAA,SAAA,GAAY,MAAO,CAAA,SAAA;AACnB,IAAA,IAAA,GAAO,MAAO,CAAA,IAAA;AAAA,GAChB,MAAA,IAAW,cAAc,WAAa,EAAA;AACpC,IAAA,IAAA,GAAO,WAAY,CAAA,IAAA;AACnB,IAAA,SAAA,GAAY,YAAY,QAAS,CAAA,SAAA;AACjC,IAAA,IAAA,GAAO,YAAY,QAAS,CAAA,IAAA;AAAA,GACvB,MAAA;AACL,IAAA,IAAA,GAAO,WAAY,CAAA,IAAA;AACnB,IAAA,SAAA,GAAY,WAAY,CAAA,SAAA;AACxB,IAAA,IAAA,GAAO,WAAY,CAAA,IAAA;AAAA;AAGrB,EAAO,IAAA,GAAA,IAAA,CAAK,kBAAkB,OAAO,CAAA;AACrC,EAAY,SAAA,GAAA,SAAA,EAAW,iBAAkB,CAAA,OAAO,CAAK,IAAA,iBAAA;AAErD,EAAA,MAAM,EAAE,YAAA,GAAe,KAAM,EAAA,GAAI,WAAW,EAAC;AAC7C,EAAA,IAAI,YAAc,EAAA;AAChB,IAAA,IAAA,GAAO,mBAAmB,IAAI,CAAA;AAC9B,IAAA,SAAA,GAAY,mBAAmB,SAAS,CAAA;AACxC,IAAA,IAAA,GAAO,mBAAmB,IAAI,CAAA;AAAA;AAGhC,EAAO,OAAA;AAAA,IACL,IAAA;AAAA,IACA,SAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-react",
3
- "version": "1.17.0-next.2",
3
+ "version": "1.17.0",
4
4
  "description": "A frontend library that helps other Backstage plugins interact with the catalog",
5
5
  "backstage": {
6
6
  "role": "web-library",
@@ -73,20 +73,20 @@
73
73
  "test": "backstage-cli package test"
74
74
  },
75
75
  "dependencies": {
76
- "@backstage/catalog-client": "1.9.1",
77
- "@backstage/catalog-model": "1.7.3",
78
- "@backstage/core-compat-api": "0.4.1-next.2",
79
- "@backstage/core-components": "0.17.1-next.1",
80
- "@backstage/core-plugin-api": "1.10.6-next.0",
81
- "@backstage/errors": "1.2.7",
82
- "@backstage/frontend-plugin-api": "0.10.1-next.1",
83
- "@backstage/frontend-test-utils": "0.3.1-next.1",
84
- "@backstage/integration-react": "1.2.6-next.1",
85
- "@backstage/plugin-catalog-common": "1.1.3",
86
- "@backstage/plugin-permission-common": "0.8.4",
87
- "@backstage/plugin-permission-react": "0.4.33-next.0",
88
- "@backstage/types": "1.2.1",
89
- "@backstage/version-bridge": "1.0.11",
76
+ "@backstage/catalog-client": "^1.9.1",
77
+ "@backstage/catalog-model": "^1.7.3",
78
+ "@backstage/core-compat-api": "^0.4.1",
79
+ "@backstage/core-components": "^0.17.1",
80
+ "@backstage/core-plugin-api": "^1.10.6",
81
+ "@backstage/errors": "^1.2.7",
82
+ "@backstage/frontend-plugin-api": "^0.10.1",
83
+ "@backstage/frontend-test-utils": "^0.3.1",
84
+ "@backstage/integration-react": "^1.2.6",
85
+ "@backstage/plugin-catalog-common": "^1.1.3",
86
+ "@backstage/plugin-permission-common": "^0.8.4",
87
+ "@backstage/plugin-permission-react": "^0.4.33",
88
+ "@backstage/types": "^1.2.1",
89
+ "@backstage/version-bridge": "^1.0.11",
90
90
  "@material-ui/core": "^4.12.2",
91
91
  "@material-ui/icons": "^4.9.1",
92
92
  "@material-ui/lab": "4.0.0-alpha.61",
@@ -100,11 +100,11 @@
100
100
  "zen-observable": "^0.10.0"
101
101
  },
102
102
  "devDependencies": {
103
- "@backstage/cli": "0.32.0-next.2",
104
- "@backstage/core-app-api": "1.16.1-next.0",
105
- "@backstage/plugin-catalog-common": "1.1.3",
106
- "@backstage/plugin-scaffolder-common": "1.5.10",
107
- "@backstage/test-utils": "1.7.7-next.0",
103
+ "@backstage/cli": "^0.32.0",
104
+ "@backstage/core-app-api": "^1.16.1",
105
+ "@backstage/plugin-catalog-common": "^1.1.3",
106
+ "@backstage/plugin-scaffolder-common": "^1.5.10",
107
+ "@backstage/test-utils": "^1.7.7",
108
108
  "@testing-library/dom": "^10.0.0",
109
109
  "@testing-library/jest-dom": "^6.0.0",
110
110
  "@testing-library/react": "^16.0.0",