@backstage/plugin-catalog 1.29.0-next.1 → 1.29.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.
Files changed (114) hide show
  1. package/CHANGELOG.md +142 -0
  2. package/README.md +1 -1
  3. package/dist/alpha/DefaultEntityContentLayout.esm.js +15 -3
  4. package/dist/alpha/DefaultEntityContentLayout.esm.js.map +1 -1
  5. package/dist/alpha/components/EntityHeader/EntityHeader.esm.js +57 -42
  6. package/dist/alpha/components/EntityHeader/EntityHeader.esm.js.map +1 -1
  7. package/dist/alpha/components/EntityLabels/EntityLabels.esm.js +25 -22
  8. package/dist/alpha/components/EntityLabels/EntityLabels.esm.js.map +1 -1
  9. package/dist/alpha/components/EntityLayout/EntityLayout.esm.js +24 -9
  10. package/dist/alpha/components/EntityLayout/EntityLayout.esm.js.map +1 -1
  11. package/dist/alpha/components/EntityTabs/EntityTabs.esm.js +9 -2
  12. package/dist/alpha/components/EntityTabs/EntityTabs.esm.js.map +1 -1
  13. package/dist/alpha/components/EntityTabs/EntityTabsGroup.esm.js +69 -53
  14. package/dist/alpha/components/EntityTabs/EntityTabsGroup.esm.js.map +1 -1
  15. package/dist/alpha/components/EntityTabs/EntityTabsList.esm.js +31 -30
  16. package/dist/alpha/components/EntityTabs/EntityTabsList.esm.js.map +1 -1
  17. package/dist/alpha/components/EntityTabs/EntityTabsPanel.esm.js +5 -5
  18. package/dist/alpha/components/EntityTabs/EntityTabsPanel.esm.js.map +1 -1
  19. package/dist/alpha/contextMenuItems.esm.js +106 -0
  20. package/dist/alpha/contextMenuItems.esm.js.map +1 -0
  21. package/dist/alpha/entityCards.esm.js +14 -11
  22. package/dist/alpha/entityCards.esm.js.map +1 -1
  23. package/dist/alpha/entityContents.esm.js +6 -4
  24. package/dist/alpha/entityContents.esm.js.map +1 -1
  25. package/dist/alpha/filter/FilterWrapper.esm.js +1 -0
  26. package/dist/alpha/filter/FilterWrapper.esm.js.map +1 -1
  27. package/dist/alpha/filters.esm.js +10 -10
  28. package/dist/alpha/filters.esm.js.map +1 -1
  29. package/dist/alpha/pages.esm.js +15 -11
  30. package/dist/alpha/pages.esm.js.map +1 -1
  31. package/dist/alpha/plugin.esm.js +2 -0
  32. package/dist/alpha/plugin.esm.js.map +1 -1
  33. package/dist/alpha/searchResultItems.esm.js.map +1 -1
  34. package/dist/alpha.d.ts +58 -44
  35. package/dist/alpha.esm.js +0 -1
  36. package/dist/alpha.esm.js.map +1 -1
  37. package/dist/components/AboutCard/AboutCard.esm.js +50 -41
  38. package/dist/components/AboutCard/AboutCard.esm.js.map +1 -1
  39. package/dist/components/AboutCard/AboutContent.esm.js +106 -96
  40. package/dist/components/AboutCard/AboutContent.esm.js.map +1 -1
  41. package/dist/components/AboutCard/AboutField.esm.js +6 -3
  42. package/dist/components/AboutCard/AboutField.esm.js.map +1 -1
  43. package/dist/components/CatalogEntityPage/CatalogEntityPage.esm.js +2 -2
  44. package/dist/components/CatalogEntityPage/CatalogEntityPage.esm.js.map +1 -1
  45. package/dist/components/CatalogKindHeader/CatalogKindHeader.esm.js +7 -6
  46. package/dist/components/CatalogKindHeader/CatalogKindHeader.esm.js.map +1 -1
  47. package/dist/components/CatalogPage/CatalogPage.esm.js +2 -2
  48. package/dist/components/CatalogPage/CatalogPage.esm.js.map +1 -1
  49. package/dist/components/CatalogPage/DefaultCatalogPage.esm.js +21 -12
  50. package/dist/components/CatalogPage/DefaultCatalogPage.esm.js.map +1 -1
  51. package/dist/components/CatalogSearchResultListItem/CatalogSearchResultListItem.esm.js +57 -46
  52. package/dist/components/CatalogSearchResultListItem/CatalogSearchResultListItem.esm.js.map +1 -1
  53. package/dist/components/CatalogTable/CatalogTable.esm.js +19 -12
  54. package/dist/components/CatalogTable/CatalogTable.esm.js.map +1 -1
  55. package/dist/components/CatalogTable/CatalogTableToolbar.esm.js +5 -2
  56. package/dist/components/CatalogTable/CatalogTableToolbar.esm.js.map +1 -1
  57. package/dist/components/CatalogTable/CursorPaginatedCatalogTable.esm.js +2 -2
  58. package/dist/components/CatalogTable/CursorPaginatedCatalogTable.esm.js.map +1 -1
  59. package/dist/components/CatalogTable/OffsetPaginatedCatalogTable.esm.js +4 -3
  60. package/dist/components/CatalogTable/OffsetPaginatedCatalogTable.esm.js.map +1 -1
  61. package/dist/components/CatalogTable/columns.esm.js +15 -15
  62. package/dist/components/CatalogTable/columns.esm.js.map +1 -1
  63. package/dist/components/DependencyOfComponentsCard/DependencyOfComponentsCard.esm.js +2 -2
  64. package/dist/components/DependencyOfComponentsCard/DependencyOfComponentsCard.esm.js.map +1 -1
  65. package/dist/components/DependsOnComponentsCard/DependsOnComponentsCard.esm.js +2 -2
  66. package/dist/components/DependsOnComponentsCard/DependsOnComponentsCard.esm.js.map +1 -1
  67. package/dist/components/DependsOnResourcesCard/DependsOnResourcesCard.esm.js +2 -2
  68. package/dist/components/DependsOnResourcesCard/DependsOnResourcesCard.esm.js.map +1 -1
  69. package/dist/components/EntityContextMenu/EntityContextMenu.esm.js +91 -59
  70. package/dist/components/EntityContextMenu/EntityContextMenu.esm.js.map +1 -1
  71. package/dist/components/EntityContextMenu/UnregisterEntity.esm.js +10 -8
  72. package/dist/components/EntityContextMenu/UnregisterEntity.esm.js.map +1 -1
  73. package/dist/components/EntityLabelsCard/EntityLabelsCard.esm.js +4 -4
  74. package/dist/components/EntityLabelsCard/EntityLabelsCard.esm.js.map +1 -1
  75. package/dist/components/EntityLabelsCard/EntityLabelsEmptyState.esm.js +24 -20
  76. package/dist/components/EntityLabelsCard/EntityLabelsEmptyState.esm.js.map +1 -1
  77. package/dist/components/EntityLayout/EntityLayout.esm.js +106 -77
  78. package/dist/components/EntityLayout/EntityLayout.esm.js.map +1 -1
  79. package/dist/components/EntityLinksCard/EntityLinksCard.esm.js +3 -3
  80. package/dist/components/EntityLinksCard/EntityLinksCard.esm.js.map +1 -1
  81. package/dist/components/EntityLinksCard/EntityLinksEmptyState.esm.js +24 -20
  82. package/dist/components/EntityLinksCard/EntityLinksEmptyState.esm.js.map +1 -1
  83. package/dist/components/EntityLinksCard/IconLink.esm.js +5 -2
  84. package/dist/components/EntityLinksCard/IconLink.esm.js.map +1 -1
  85. package/dist/components/EntityLinksCard/LinksGridList.esm.js +2 -2
  86. package/dist/components/EntityLinksCard/LinksGridList.esm.js.map +1 -1
  87. package/dist/components/EntityOrphanWarning/DeleteEntityDialog.esm.js +18 -11
  88. package/dist/components/EntityOrphanWarning/DeleteEntityDialog.esm.js.map +1 -1
  89. package/dist/components/EntityOrphanWarning/EntityOrphanWarning.esm.js +14 -10
  90. package/dist/components/EntityOrphanWarning/EntityOrphanWarning.esm.js.map +1 -1
  91. package/dist/components/EntityProcessingErrorsPanel/EntityProcessingErrorsPanel.esm.js +10 -3
  92. package/dist/components/EntityProcessingErrorsPanel/EntityProcessingErrorsPanel.esm.js.map +1 -1
  93. package/dist/components/EntityRelationWarning/EntityRelationWarning.esm.js +7 -3
  94. package/dist/components/EntityRelationWarning/EntityRelationWarning.esm.js.map +1 -1
  95. package/dist/components/EntitySwitch/EntitySwitch.esm.js +4 -4
  96. package/dist/components/EntitySwitch/EntitySwitch.esm.js.map +1 -1
  97. package/dist/components/HasComponentsCard/HasComponentsCard.esm.js +2 -2
  98. package/dist/components/HasComponentsCard/HasComponentsCard.esm.js.map +1 -1
  99. package/dist/components/HasResourcesCard/HasResourcesCard.esm.js +2 -2
  100. package/dist/components/HasResourcesCard/HasResourcesCard.esm.js.map +1 -1
  101. package/dist/components/HasSubcomponentsCard/HasSubcomponentsCard.esm.js +2 -2
  102. package/dist/components/HasSubcomponentsCard/HasSubcomponentsCard.esm.js.map +1 -1
  103. package/dist/components/HasSubdomainsCard/HasSubdomainsCard.esm.js +2 -2
  104. package/dist/components/HasSubdomainsCard/HasSubdomainsCard.esm.js.map +1 -1
  105. package/dist/components/HasSystemsCard/HasSystemsCard.esm.js +2 -2
  106. package/dist/components/HasSystemsCard/HasSystemsCard.esm.js.map +1 -1
  107. package/dist/components/RelatedEntitiesCard/RelatedEntitiesCard.esm.js +8 -5
  108. package/dist/components/RelatedEntitiesCard/RelatedEntitiesCard.esm.js.map +1 -1
  109. package/dist/context/EntityContextMenuContext.esm.js +18 -0
  110. package/dist/context/EntityContextMenuContext.esm.js.map +1 -0
  111. package/dist/index.d.ts +23 -22
  112. package/package.json +26 -25
  113. package/dist/alpha/blueprints/CatalogFilterBlueprint.esm.js +0 -17
  114. package/dist/alpha/blueprints/CatalogFilterBlueprint.esm.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,147 @@
1
1
  # @backstage/plugin-catalog
2
2
 
3
+ ## 1.29.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 9454ef9: Added support of filtering based on system columns in catalog table
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
+ - 3f7e4f1: Fixed the layout of summary cards in the new frontend system, ensuring that the horizontal scroll grid doesn't grow too large as well as tweaked its scrolling parameters.
51
+ - e655f62: Updated `README.md` to use `yarn start` instead of `yarn dev`.
52
+ - a47fd39: Removes instances of default React imports, a necessary update for the upcoming React 19 migration.
53
+
54
+ <https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html>
55
+
56
+ - 3f7e4f1: The about, links, and labels card now all have the `info` card type by default in the new frontend system.
57
+ - 3f7e4f1: The overview content is now part of the overview group by default in the new frontend system.
58
+ - Updated dependencies
59
+ - @backstage/plugin-catalog-react@1.17.0
60
+ - @backstage/frontend-plugin-api@0.10.1
61
+ - @backstage/integration-react@1.2.6
62
+ - @backstage/core-compat-api@0.4.1
63
+ - @backstage/core-components@0.17.1
64
+ - @backstage/core-plugin-api@1.10.6
65
+ - @backstage/plugin-permission-react@0.4.33
66
+ - @backstage/plugin-search-react@1.8.8
67
+ - @backstage/catalog-client@1.9.1
68
+ - @backstage/catalog-model@1.7.3
69
+ - @backstage/errors@1.2.7
70
+ - @backstage/types@1.2.1
71
+ - @backstage/version-bridge@1.0.11
72
+ - @backstage/plugin-catalog-common@1.1.3
73
+ - @backstage/plugin-scaffolder-common@1.5.10
74
+ - @backstage/plugin-search-common@1.2.17
75
+
76
+ ## 1.29.0-next.2
77
+
78
+ ### Minor Changes
79
+
80
+ - 61d350f: **BREAKING ALPHA**: `CatalogFilterBlueprint`, used in the new frontend system, is now exported under plugin-catalog-react instead of plugin-catalog.
81
+
82
+ ```diff
83
+ + import { CatalogFilterBlueprint } from '@backstage/plugin-catalog-react/alpha';
84
+ - import { CatalogFilterBlueprint } from '@backstage/plugin-catalog/alpha';
85
+ ```
86
+
87
+ - 09afd67: Adds `EntityContextMenuItemBlueprint` to enable extending the entity page's context menu with user defined items.
88
+
89
+ For example:
90
+
91
+ ```ts
92
+ import { EntityContextMenuItemBlueprint } from '@backstage/plugin-catalog-react/alpha';
93
+
94
+ const myCustomHref = EntityContextMenuItemBlueprint.make({
95
+ name: 'test-href',
96
+ params: {
97
+ icon: <span>Example Icon</span>,
98
+ useProps: () => ({
99
+ title: 'Example Href',
100
+ href: '/example-path',
101
+ disabled: false,
102
+ component: 'a',
103
+ }),
104
+ },
105
+ });
106
+
107
+ const myCustomOnClick = EntityContextMenuItemBlueprint.make({
108
+ name: 'test-click',
109
+ params: {
110
+ icon: <span>Test Icon</span>,
111
+ useProps: () => ({
112
+ title: 'Example onClick',
113
+ onClick: () => window.alert('Hello world!'),
114
+ disabled: false,
115
+ }),
116
+ },
117
+ });
118
+ ```
119
+
120
+ ### Patch Changes
121
+
122
+ - e655f62: Updated `README.md` to use `yarn start` instead of `yarn dev`.
123
+ - a47fd39: Removes instances of default React imports, a necessary update for the upcoming React 19 migration.
124
+
125
+ <https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html>
126
+
127
+ - Updated dependencies
128
+ - @backstage/frontend-plugin-api@0.10.1-next.1
129
+ - @backstage/integration-react@1.2.6-next.1
130
+ - @backstage/core-compat-api@0.4.1-next.2
131
+ - @backstage/core-components@0.17.1-next.1
132
+ - @backstage/core-plugin-api@1.10.6-next.0
133
+ - @backstage/plugin-permission-react@0.4.33-next.0
134
+ - @backstage/plugin-catalog-react@1.17.0-next.2
135
+ - @backstage/plugin-search-react@1.8.8-next.1
136
+ - @backstage/catalog-client@1.9.1
137
+ - @backstage/catalog-model@1.7.3
138
+ - @backstage/errors@1.2.7
139
+ - @backstage/types@1.2.1
140
+ - @backstage/version-bridge@1.0.11
141
+ - @backstage/plugin-catalog-common@1.1.3
142
+ - @backstage/plugin-scaffolder-common@1.5.10
143
+ - @backstage/plugin-search-common@1.2.17
144
+
3
145
  ## 1.29.0-next.1
4
146
 
5
147
  ### Patch Changes
package/README.md CHANGED
@@ -93,7 +93,7 @@ To evaluate the catalog and have a greater amount of functionality available,
93
93
  run the entire Backstage example application from the root folder:
94
94
 
95
95
  ```bash
96
- yarn dev
96
+ yarn start
97
97
  ```
98
98
 
99
99
  This will launch both frontend and backend in the same window, populated with
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
2
  import Grid from '@material-ui/core/Grid';
3
3
  import { makeStyles } from '@material-ui/core/styles';
4
4
  import { EntitySwitch } from '../components/EntitySwitch/EntitySwitch.esm.js';
@@ -28,6 +28,7 @@ const useStyles = makeStyles((theme) => ({
28
28
  minWidth: 0
29
29
  },
30
30
  summaryArea: {
31
+ minWidth: 0,
31
32
  margin: theme.spacing(1.5)
32
33
  // To counteract MUI negative grid margin
33
34
  },
@@ -63,7 +64,11 @@ const useStyles = makeStyles((theme) => ({
63
64
  }
64
65
  }
65
66
  }));
66
- const entityWarningContent = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(EntitySwitch, null, /* @__PURE__ */ React.createElement(EntitySwitch.Case, { if: isOrphan }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(EntityOrphanWarning, null)))), /* @__PURE__ */ React.createElement(EntitySwitch, null, /* @__PURE__ */ React.createElement(EntitySwitch.Case, { if: hasRelationWarnings }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(EntityRelationWarning, null)))), /* @__PURE__ */ React.createElement(EntitySwitch, null, /* @__PURE__ */ React.createElement(EntitySwitch.Case, { if: hasCatalogProcessingErrors }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(EntityProcessingErrorsPanel, null)))));
67
+ const entityWarningContent = /* @__PURE__ */ jsxs(Fragment, { children: [
68
+ /* @__PURE__ */ jsx(EntitySwitch, { children: /* @__PURE__ */ jsx(EntitySwitch.Case, { if: isOrphan, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(EntityOrphanWarning, {}) }) }) }),
69
+ /* @__PURE__ */ jsx(EntitySwitch, { children: /* @__PURE__ */ jsx(EntitySwitch.Case, { if: hasRelationWarnings, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(EntityRelationWarning, {}) }) }) }),
70
+ /* @__PURE__ */ jsx(EntitySwitch, { children: /* @__PURE__ */ jsx(EntitySwitch.Case, { if: hasCatalogProcessingErrors, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(EntityProcessingErrorsPanel, {}) }) }) })
71
+ ] });
67
72
  function DefaultEntityContentLayout(props) {
68
73
  const { cards } = props;
69
74
  const infoCards = cards.filter((card) => card.type === "info");
@@ -76,7 +81,14 @@ function DefaultEntityContentLayout(props) {
76
81
  summaryCards: !!summaryCards.length,
77
82
  contentCards: !!contentCards.length
78
83
  });
79
- return /* @__PURE__ */ React.createElement(React.Fragment, null, entityWarningContent, /* @__PURE__ */ React.createElement("div", { className: classes.root }, infoCards.length > 0 ? /* @__PURE__ */ React.createElement("div", { className: classes.infoArea }, infoCards.map((card) => card.element)) : null, summaryCards.length > 0 ? /* @__PURE__ */ React.createElement("div", { className: classes.summaryArea }, /* @__PURE__ */ React.createElement(HorizontalScrollGrid, null, summaryCards.map((card) => /* @__PURE__ */ React.createElement("div", { className: classes.summaryCard }, card.element)))) : null, contentCards.length > 0 ? /* @__PURE__ */ React.createElement("div", { className: classes.contentArea }, contentCards.map((card) => card.element)) : null));
84
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
85
+ entityWarningContent,
86
+ /* @__PURE__ */ jsxs("div", { className: classes.root, children: [
87
+ infoCards.length > 0 ? /* @__PURE__ */ jsx("div", { className: classes.infoArea, children: infoCards.map((card) => card.element) }) : null,
88
+ summaryCards.length > 0 ? /* @__PURE__ */ jsx("div", { className: classes.summaryArea, children: /* @__PURE__ */ jsx(HorizontalScrollGrid, { scrollStep: 400, scrollSpeed: 100, children: summaryCards.map((card) => /* @__PURE__ */ jsx("div", { className: classes.summaryCard, children: card.element })) }) }) : null,
89
+ contentCards.length > 0 ? /* @__PURE__ */ jsx("div", { className: classes.contentArea, children: contentCards.map((card) => card.element) }) : null
90
+ ] })
91
+ ] });
80
92
  }
81
93
 
82
94
  export { DefaultEntityContentLayout };
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultEntityContentLayout.esm.js","sources":["../../src/alpha/DefaultEntityContentLayout.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 React from 'react';\nimport Grid from '@material-ui/core/Grid';\nimport { makeStyles, Theme } from '@material-ui/core/styles';\nimport { EntityContentLayoutProps } from '@backstage/plugin-catalog-react/alpha';\nimport { EntitySwitch } from '../components/EntitySwitch';\nimport {\n EntityOrphanWarning,\n isOrphan,\n} from '../components/EntityOrphanWarning';\nimport {\n EntityRelationWarning,\n hasRelationWarnings,\n} from '../components/EntityRelationWarning';\nimport {\n EntityProcessingErrorsPanel,\n hasCatalogProcessingErrors,\n} from '../components/EntityProcessingErrorsPanel';\nimport { HorizontalScrollGrid } from '@backstage/core-components';\n\nconst useStyles = makeStyles<\n Theme,\n { infoCards: boolean; summaryCards: boolean; contentCards: boolean }\n>(theme => ({\n root: {\n display: 'flex',\n flexFlow: 'column nowrap',\n gap: theme.spacing(3),\n },\n contentArea: {\n display: 'flex',\n flexFlow: 'column',\n gap: theme.spacing(3),\n alignItems: 'stretch',\n minWidth: 0,\n },\n infoArea: {\n display: 'flex',\n flexFlow: 'column nowrap',\n alignItems: 'stretch',\n gap: theme.spacing(3),\n minWidth: 0,\n },\n summaryArea: {\n margin: theme.spacing(1.5), // To counteract MUI negative grid margin\n },\n summaryCard: {\n flex: '0 0 auto',\n '& + &': {\n marginLeft: theme.spacing(3),\n },\n },\n [theme.breakpoints.up('md')]: {\n root: {\n display: 'grid',\n gap: 0,\n gridTemplateAreas: ({ summaryCards }) => `\n \"${summaryCards ? 'summary' : 'content'} info\"\n \"content info\"\n `,\n gridTemplateColumns: ({ infoCards }) => (infoCards ? '2fr 1fr' : '1fr'),\n alignItems: 'start',\n },\n infoArea: {\n gridArea: 'info',\n position: 'sticky',\n top: theme.spacing(3),\n marginLeft: theme.spacing(3),\n },\n contentArea: {\n gridArea: 'content',\n },\n summaryArea: {\n gridArea: 'summary',\n marginBottom: theme.spacing(3),\n },\n },\n}));\n\nconst entityWarningContent = (\n <>\n <EntitySwitch>\n <EntitySwitch.Case if={isOrphan}>\n <Grid item xs={12}>\n <EntityOrphanWarning />\n </Grid>\n </EntitySwitch.Case>\n </EntitySwitch>\n\n <EntitySwitch>\n <EntitySwitch.Case if={hasRelationWarnings}>\n <Grid item xs={12}>\n <EntityRelationWarning />\n </Grid>\n </EntitySwitch.Case>\n </EntitySwitch>\n\n <EntitySwitch>\n <EntitySwitch.Case if={hasCatalogProcessingErrors}>\n <Grid item xs={12}>\n <EntityProcessingErrorsPanel />\n </Grid>\n </EntitySwitch.Case>\n </EntitySwitch>\n </>\n);\n\nexport function DefaultEntityContentLayout(props: EntityContentLayoutProps) {\n const { cards } = props;\n\n const infoCards = cards.filter(card => card.type === 'info');\n const summaryCards = cards.filter(card => card.type === 'summary');\n const contentCards = cards.filter(\n card => !card.type || card.type === 'content',\n );\n\n const classes = useStyles({\n infoCards: !!infoCards.length,\n summaryCards: !!summaryCards.length,\n contentCards: !!contentCards.length,\n });\n\n return (\n <>\n {entityWarningContent}\n <div className={classes.root}>\n {infoCards.length > 0 ? (\n <div className={classes.infoArea}>\n {infoCards.map(card => card.element)}\n </div>\n ) : null}\n {summaryCards.length > 0 ? (\n <div className={classes.summaryArea}>\n <HorizontalScrollGrid>\n {summaryCards.map(card => (\n <div className={classes.summaryCard}>{card.element}</div>\n ))}\n </HorizontalScrollGrid>\n </div>\n ) : null}\n {contentCards.length > 0 ? (\n <div className={classes.contentArea}>\n {contentCards.map(card => card.element)}\n </div>\n ) : null}\n </div>\n </>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;AAmCA,MAAM,SAAA,GAAY,WAGhB,CAAU,KAAA,MAAA;AAAA,EACV,IAAM,EAAA;AAAA,IACJ,OAAS,EAAA,MAAA;AAAA,IACT,QAAU,EAAA,eAAA;AAAA,IACV,GAAA,EAAK,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA,GACtB;AAAA,EACA,WAAa,EAAA;AAAA,IACX,OAAS,EAAA,MAAA;AAAA,IACT,QAAU,EAAA,QAAA;AAAA,IACV,GAAA,EAAK,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IACpB,UAAY,EAAA,SAAA;AAAA,IACZ,QAAU,EAAA;AAAA,GACZ;AAAA,EACA,QAAU,EAAA;AAAA,IACR,OAAS,EAAA,MAAA;AAAA,IACT,QAAU,EAAA,eAAA;AAAA,IACV,UAAY,EAAA,SAAA;AAAA,IACZ,GAAA,EAAK,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IACpB,QAAU,EAAA;AAAA,GACZ;AAAA,EACA,WAAa,EAAA;AAAA,IACX,MAAA,EAAQ,KAAM,CAAA,OAAA,CAAQ,GAAG;AAAA;AAAA,GAC3B;AAAA,EACA,WAAa,EAAA;AAAA,IACX,IAAM,EAAA,UAAA;AAAA,IACN,OAAS,EAAA;AAAA,MACP,UAAA,EAAY,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA;AAC7B,GACF;AAAA,EACA,CAAC,KAAM,CAAA,WAAA,CAAY,EAAG,CAAA,IAAI,CAAC,GAAG;AAAA,IAC5B,IAAM,EAAA;AAAA,MACJ,OAAS,EAAA,MAAA;AAAA,MACT,GAAK,EAAA,CAAA;AAAA,MACL,iBAAmB,EAAA,C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KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAI,WAAW,OAAQ,CAAA,QAAA,EAAA,EACrB,SAAU,CAAA,GAAA,CAAI,CAAQ,IAAA,KAAA,IAAA,CAAK,OAAO,CACrC,CACE,GAAA,IAAA,EACH,YAAa,CAAA,MAAA,GAAS,CACrB,mBAAA,KAAA,CAAA,aAAA,CAAC,KAAI,EAAA,EAAA,SAAA,EAAW,QAAQ,WACtB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,oBACE,EAAA,IAAA,EAAA,YAAA,CAAa,GAAI,CAAA,CAAA,IAAA,qBACf,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAI,SAAW,EAAA,OAAA,CAAQ,WAAc,EAAA,EAAA,IAAA,CAAK,OAAQ,CACpD,CACH,CACF,IACE,IACH,EAAA,YAAA,CAAa,MAAS,GAAA,CAAA,mBACpB,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAI,SAAW,EAAA,OAAA,CAAQ,WACrB,EAAA,EAAA,YAAA,CAAa,GAAI,CAAA,CAAA,IAAA,KAAQ,IAAK,CAAA,OAAO,CACxC,CAAA,GACE,IACN,CACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"DefaultEntityContentLayout.esm.js","sources":["../../src/alpha/DefaultEntityContentLayout.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 Grid from '@material-ui/core/Grid';\nimport { makeStyles, Theme } from '@material-ui/core/styles';\nimport { EntityContentLayoutProps } from '@backstage/plugin-catalog-react/alpha';\nimport { EntitySwitch } from '../components/EntitySwitch';\nimport {\n EntityOrphanWarning,\n isOrphan,\n} from '../components/EntityOrphanWarning';\nimport {\n EntityRelationWarning,\n hasRelationWarnings,\n} from '../components/EntityRelationWarning';\nimport {\n EntityProcessingErrorsPanel,\n hasCatalogProcessingErrors,\n} from '../components/EntityProcessingErrorsPanel';\nimport { HorizontalScrollGrid } from '@backstage/core-components';\n\nconst useStyles = makeStyles<\n Theme,\n { infoCards: boolean; summaryCards: boolean; contentCards: boolean }\n>(theme => ({\n root: {\n display: 'flex',\n flexFlow: 'column nowrap',\n gap: theme.spacing(3),\n },\n contentArea: {\n display: 'flex',\n flexFlow: 'column',\n gap: theme.spacing(3),\n alignItems: 'stretch',\n minWidth: 0,\n },\n infoArea: {\n display: 'flex',\n flexFlow: 'column nowrap',\n alignItems: 'stretch',\n gap: theme.spacing(3),\n minWidth: 0,\n },\n summaryArea: {\n minWidth: 0,\n margin: theme.spacing(1.5), // To counteract MUI negative grid margin\n },\n summaryCard: {\n flex: '0 0 auto',\n '& + &': {\n marginLeft: theme.spacing(3),\n },\n },\n [theme.breakpoints.up('md')]: {\n root: {\n display: 'grid',\n gap: 0,\n gridTemplateAreas: ({ summaryCards }) => `\n \"${summaryCards ? 'summary' : 'content'} info\"\n \"content info\"\n `,\n gridTemplateColumns: ({ infoCards }) => (infoCards ? '2fr 1fr' : '1fr'),\n alignItems: 'start',\n },\n infoArea: {\n gridArea: 'info',\n position: 'sticky',\n top: theme.spacing(3),\n marginLeft: theme.spacing(3),\n },\n contentArea: {\n gridArea: 'content',\n },\n summaryArea: {\n gridArea: 'summary',\n marginBottom: theme.spacing(3),\n },\n },\n}));\n\nconst entityWarningContent = (\n <>\n <EntitySwitch>\n <EntitySwitch.Case if={isOrphan}>\n <Grid item xs={12}>\n <EntityOrphanWarning />\n </Grid>\n </EntitySwitch.Case>\n </EntitySwitch>\n\n <EntitySwitch>\n <EntitySwitch.Case if={hasRelationWarnings}>\n <Grid item xs={12}>\n <EntityRelationWarning />\n </Grid>\n </EntitySwitch.Case>\n </EntitySwitch>\n\n <EntitySwitch>\n <EntitySwitch.Case if={hasCatalogProcessingErrors}>\n <Grid item xs={12}>\n <EntityProcessingErrorsPanel />\n </Grid>\n </EntitySwitch.Case>\n </EntitySwitch>\n </>\n);\n\nexport function DefaultEntityContentLayout(props: EntityContentLayoutProps) {\n const { cards } = props;\n\n const infoCards = cards.filter(card => card.type === 'info');\n const summaryCards = cards.filter(card => card.type === 'summary');\n const contentCards = cards.filter(\n card => !card.type || card.type === 'content',\n );\n\n const classes = useStyles({\n infoCards: !!infoCards.length,\n summaryCards: !!summaryCards.length,\n contentCards: !!contentCards.length,\n });\n\n return (\n <>\n {entityWarningContent}\n <div className={classes.root}>\n {infoCards.length > 0 ? (\n <div className={classes.infoArea}>\n {infoCards.map(card => card.element)}\n </div>\n ) : null}\n {summaryCards.length > 0 ? (\n <div className={classes.summaryArea}>\n <HorizontalScrollGrid scrollStep={400} scrollSpeed={100}>\n {summaryCards.map(card => (\n <div className={classes.summaryCard}>{card.element}</div>\n ))}\n </HorizontalScrollGrid>\n </div>\n ) : null}\n {contentCards.length > 0 ? (\n <div className={classes.contentArea}>\n {contentCards.map(card => card.element)}\n </div>\n ) : null}\n </div>\n </>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;AAkCA,MAAM,SAAA,GAAY,WAGhB,CAAU,KAAA,MAAA;AAAA,EACV,IAAM,EAAA;AAAA,IACJ,OAAS,EAAA,MAAA;AAAA,IACT,QAAU,EAAA,eAAA;AAAA,IACV,GAAA,EAAK,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA,GACtB;AAAA,EACA,WAAa,EAAA;AAAA,IACX,OAAS,EAAA,MAAA;AAAA,IACT,QAAU,EAAA,QAAA;AAAA,IACV,GAAA,EAAK,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IACpB,UAAY,EAAA,SAAA;AAAA,IACZ,QAAU,EAAA;AAAA,GACZ;AAAA,EACA,QAAU,EAAA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;AAAA,KACN,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
@@ -1,4 +1,5 @@
1
- import React, { useState, useCallback, useEffect } from 'react';
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import { useState, useCallback, useEffect } from 'react';
2
3
  import { useLocation, useNavigate, useSearchParams } from 'react-router-dom';
3
4
  import useAsync from 'react-use/esm/useAsync';
4
5
  import { makeStyles } from '@material-ui/core/styles';
@@ -56,16 +57,19 @@ function EntityHeaderTitle() {
56
57
  const { entity } = useAsyncEntity();
57
58
  const { kind, namespace, name } = useRouteRefParams(entityRouteRef);
58
59
  const { headerTitle: title } = headerProps(kind, namespace, name, entity);
59
- return /* @__PURE__ */ React.createElement(Box, { display: "inline-flex", alignItems: "center", height: "1em", maxWidth: "100%" }, /* @__PURE__ */ React.createElement(
60
- Box,
61
- {
62
- component: "span",
63
- textOverflow: "ellipsis",
64
- whiteSpace: "nowrap",
65
- overflow: "hidden"
66
- },
67
- entity ? /* @__PURE__ */ React.createElement(EntityDisplayName, { entityRef: entity, hideIcon: true }) : title
68
- ), entity && /* @__PURE__ */ React.createElement(FavoriteEntity, { entity }));
60
+ return /* @__PURE__ */ jsxs(Box, { display: "inline-flex", alignItems: "center", height: "1em", maxWidth: "100%", children: [
61
+ /* @__PURE__ */ jsx(
62
+ Box,
63
+ {
64
+ component: "span",
65
+ textOverflow: "ellipsis",
66
+ whiteSpace: "nowrap",
67
+ overflow: "hidden",
68
+ children: entity ? /* @__PURE__ */ jsx(EntityDisplayName, { entityRef: entity, hideIcon: true }) : title
69
+ }
70
+ ),
71
+ entity && /* @__PURE__ */ jsx(FavoriteEntity, { entity })
72
+ ] });
69
73
  }
70
74
  function EntityHeaderSubtitle(props) {
71
75
  const { parentEntityRelations } = props;
@@ -86,12 +90,17 @@ function EntityHeaderSubtitle(props) {
86
90
  }
87
91
  return null;
88
92
  }, [parentEntity, catalogApi]);
89
- return parentEntity ? /* @__PURE__ */ React.createElement(Breadcrumbs, { separator: ">", className: classes.breadcrumbs }, ancestorEntity && /* @__PURE__ */ React.createElement(EntityRefLink, { entityRef: ancestorEntity.targetRef, disableTooltip: true }), /* @__PURE__ */ React.createElement(EntityRefLink, { entityRef: parentEntity.targetRef, disableTooltip: true }), name) : null;
93
+ return parentEntity ? /* @__PURE__ */ jsxs(Breadcrumbs, { separator: ">", className: classes.breadcrumbs, children: [
94
+ ancestorEntity && /* @__PURE__ */ jsx(EntityRefLink, { entityRef: ancestorEntity.targetRef, disableTooltip: true }),
95
+ /* @__PURE__ */ jsx(EntityRefLink, { entityRef: parentEntity.targetRef, disableTooltip: true }),
96
+ name
97
+ ] }) : null;
90
98
  }
91
99
  function EntityHeader(props) {
92
100
  const {
93
101
  UNSTABLE_extraContextMenuItems,
94
102
  UNSTABLE_contextMenuOptions,
103
+ contextMenuItems,
95
104
  parentEntityRelations,
96
105
  title,
97
106
  subtitle
@@ -146,40 +155,46 @@ function EntityHeader(props) {
146
155
  [setSearchParams]
147
156
  );
148
157
  const inspectDialogOpen = typeof selectedInspectEntityDialogTab === "string";
149
- return /* @__PURE__ */ React.createElement(
158
+ return /* @__PURE__ */ jsx(
150
159
  Header,
151
160
  {
152
161
  pageTitleOverride: entityFallbackText,
153
162
  type,
154
- title: title ?? /* @__PURE__ */ React.createElement(EntityHeaderTitle, null),
155
- subtitle: subtitle ?? /* @__PURE__ */ React.createElement(EntityHeaderSubtitle, { parentEntityRelations })
156
- },
157
- entity && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(EntityLabels, { entity }), /* @__PURE__ */ React.createElement(
158
- EntityContextMenu,
159
- {
160
- UNSTABLE_extraContextMenuItems,
161
- UNSTABLE_contextMenuOptions,
162
- onInspectEntity: openInspectEntityDialog,
163
- onUnregisterEntity: openUnregisterEntityDialog
164
- }
165
- ), /* @__PURE__ */ React.createElement(
166
- InspectEntityDialog,
167
- {
168
- entity,
169
- initialTab: selectedInspectEntityDialogTab || void 0,
170
- open: inspectDialogOpen,
171
- onClose: closeInspectEntityDialog,
172
- onSelect: setInspectEntityDialogTab
173
- }
174
- ), /* @__PURE__ */ React.createElement(
175
- UnregisterEntityDialog,
176
- {
177
- entity,
178
- open: confirmationDialogOpen,
179
- onClose: closeUnregisterEntityDialog,
180
- onConfirm: cleanUpAfterUnregisterConfirmation
181
- }
182
- ))
163
+ title: title ?? /* @__PURE__ */ jsx(EntityHeaderTitle, {}),
164
+ subtitle: subtitle ?? /* @__PURE__ */ jsx(EntityHeaderSubtitle, { parentEntityRelations }),
165
+ children: entity && /* @__PURE__ */ jsxs(Fragment, { children: [
166
+ /* @__PURE__ */ jsx(EntityLabels, { entity }),
167
+ /* @__PURE__ */ jsx(
168
+ EntityContextMenu,
169
+ {
170
+ UNSTABLE_extraContextMenuItems,
171
+ UNSTABLE_contextMenuOptions,
172
+ contextMenuItems,
173
+ onInspectEntity: openInspectEntityDialog,
174
+ onUnregisterEntity: openUnregisterEntityDialog
175
+ }
176
+ ),
177
+ /* @__PURE__ */ jsx(
178
+ InspectEntityDialog,
179
+ {
180
+ entity,
181
+ initialTab: selectedInspectEntityDialogTab || void 0,
182
+ open: inspectDialogOpen,
183
+ onClose: closeInspectEntityDialog,
184
+ onSelect: setInspectEntityDialogTab
185
+ }
186
+ ),
187
+ /* @__PURE__ */ jsx(
188
+ UnregisterEntityDialog,
189
+ {
190
+ entity,
191
+ open: confirmationDialogOpen,
192
+ onClose: closeUnregisterEntityDialog,
193
+ onConfirm: cleanUpAfterUnregisterConfirmation
194
+ }
195
+ )
196
+ ] })
197
+ }
183
198
  );
184
199
  }
185
200
 
@@ -1 +1 @@
1
- {"version":3,"file":"EntityHeader.esm.js","sources":["../../../../src/alpha/components/EntityHeader/EntityHeader.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 React, {\n useState,\n useCallback,\n useEffect,\n ComponentProps,\n ReactNode,\n} from 'react';\nimport { useNavigate, useLocation, useSearchParams } from 'react-router-dom';\nimport useAsync from 'react-use/esm/useAsync';\n\nimport { makeStyles } from '@material-ui/core/styles';\nimport Box from '@material-ui/core/Box';\n\nimport { Header, Breadcrumbs } from '@backstage/core-components';\nimport {\n useApi,\n useRouteRef,\n useRouteRefParams,\n} from '@backstage/core-plugin-api';\nimport { IconComponent } from '@backstage/frontend-plugin-api';\n\nimport {\n Entity,\n EntityRelation,\n DEFAULT_NAMESPACE,\n} from '@backstage/catalog-model';\n\nimport {\n useAsyncEntity,\n entityRouteRef,\n catalogApiRef,\n EntityRefLink,\n InspectEntityDialog,\n UnregisterEntityDialog,\n EntityDisplayName,\n FavoriteEntity,\n} from '@backstage/plugin-catalog-react';\n\nimport { EntityLabels } from '../EntityLabels';\nimport { EntityContextMenu } from '../../../components/EntityContextMenu';\nimport { rootRouteRef, unregisterRedirectRouteRef } from '../../../routes';\n\nfunction headerProps(\n paramKind: string | undefined,\n paramNamespace: string | undefined,\n paramName: string | undefined,\n entity: Entity | undefined,\n): { headerTitle: string; headerType: string } {\n const kind = paramKind ?? entity?.kind ?? '';\n const namespace = paramNamespace ?? entity?.metadata.namespace ?? '';\n const name =\n entity?.metadata.title ?? paramName ?? entity?.metadata.name ?? '';\n\n return {\n headerTitle: `${name}${\n namespace && namespace !== DEFAULT_NAMESPACE ? ` in ${namespace}` : ''\n }`,\n headerType: (() => {\n let t = kind.toLocaleLowerCase('en-US');\n if (entity && entity.spec && 'type' in entity.spec) {\n t += ' — ';\n t += (entity.spec as { type: string }).type.toLocaleLowerCase('en-US');\n }\n return t;\n })(),\n };\n}\n\nfunction findParentRelation(\n entityRelations: EntityRelation[] = [],\n relationTypes: string[] = [],\n) {\n for (const type of relationTypes) {\n const foundRelation = entityRelations.find(\n relation => relation.type === type,\n );\n if (foundRelation) {\n return foundRelation; // Return the first found relation and stop\n }\n }\n return null;\n}\n\nconst useStyles = makeStyles(theme => ({\n breadcrumbs: {\n color: theme.page.fontColor,\n fontSize: theme.typography.caption.fontSize,\n textTransform: 'uppercase',\n marginTop: theme.spacing(1),\n opacity: 0.8,\n '& span ': {\n color: theme.page.fontColor,\n textDecoration: 'underline',\n textUnderlineOffset: '3px',\n },\n },\n}));\n\nfunction EntityHeaderTitle() {\n const { entity } = useAsyncEntity();\n const { kind, namespace, name } = useRouteRefParams(entityRouteRef);\n const { headerTitle: title } = headerProps(kind, namespace, name, entity);\n return (\n <Box display=\"inline-flex\" alignItems=\"center\" height=\"1em\" maxWidth=\"100%\">\n <Box\n component=\"span\"\n textOverflow=\"ellipsis\"\n whiteSpace=\"nowrap\"\n overflow=\"hidden\"\n >\n {entity ? <EntityDisplayName entityRef={entity} hideIcon /> : title}\n </Box>\n {entity && <FavoriteEntity entity={entity} />}\n </Box>\n );\n}\n\nfunction EntityHeaderSubtitle(props: { parentEntityRelations?: string[] }) {\n const { parentEntityRelations } = props;\n const classes = useStyles();\n const { entity } = useAsyncEntity();\n const { name } = useRouteRefParams(entityRouteRef);\n const parentEntity = findParentRelation(\n entity?.relations ?? [],\n parentEntityRelations ?? [],\n );\n\n const catalogApi = useApi(catalogApiRef);\n\n const { value: ancestorEntity } = useAsync(async () => {\n if (parentEntity) {\n return findParentRelation(\n (await catalogApi.getEntityByRef(parentEntity?.targetRef))?.relations,\n parentEntityRelations,\n );\n }\n return null;\n }, [parentEntity, catalogApi]);\n\n return parentEntity ? (\n <Breadcrumbs separator=\">\" className={classes.breadcrumbs}>\n {ancestorEntity && (\n <EntityRefLink entityRef={ancestorEntity.targetRef} disableTooltip />\n )}\n <EntityRefLink entityRef={parentEntity.targetRef} disableTooltip />\n {name}\n </Breadcrumbs>\n ) : null;\n}\n\n/** @alpha */\nexport function EntityHeader(props: {\n // NOTE(freben): Intentionally not exported at this point, since it's part of\n // the unstable extra context menu items concept below\n UNSTABLE_extraContextMenuItems?: {\n title: string;\n Icon: IconComponent;\n onClick: () => void;\n }[];\n // NOTE(blam): Intentionally not exported at this point, since it's part of\n // unstable context menu option, eg: disable the unregister entity menu\n UNSTABLE_contextMenuOptions?: {\n disableUnregister: boolean | 'visible' | 'hidden' | 'disable';\n };\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 title?: ReactNode;\n subtitle?: ReactNode;\n}) {\n const {\n UNSTABLE_extraContextMenuItems,\n UNSTABLE_contextMenuOptions,\n parentEntityRelations,\n title,\n subtitle,\n } = props;\n const { entity } = useAsyncEntity();\n const { kind, namespace, name } = useRouteRefParams(entityRouteRef);\n const { headerTitle: entityFallbackText, headerType: type } = headerProps(\n kind,\n namespace,\n name,\n entity,\n );\n\n const location = useLocation();\n const navigate = useNavigate();\n const catalogRoute = useRouteRef(rootRouteRef);\n const unregisterRedirectRoute = useRouteRef(unregisterRedirectRouteRef);\n\n const [confirmationDialogOpen, setConfirmationDialogOpen] = useState(false);\n\n const openUnregisterEntityDialog = useCallback(\n () => setConfirmationDialogOpen(true),\n [setConfirmationDialogOpen],\n );\n\n const closeUnregisterEntityDialog = useCallback(\n () => setConfirmationDialogOpen(false),\n [setConfirmationDialogOpen],\n );\n\n const cleanUpAfterUnregisterConfirmation = useCallback(async () => {\n setConfirmationDialogOpen(false);\n navigate(\n unregisterRedirectRoute ? unregisterRedirectRoute() : catalogRoute(),\n );\n }, [\n navigate,\n catalogRoute,\n unregisterRedirectRoute,\n setConfirmationDialogOpen,\n ]);\n\n // Make sure to close the dialog if the user clicks links in it that navigate\n // to another entity.\n useEffect(() => {\n setConfirmationDialogOpen(false);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [location.pathname]);\n\n const [searchParams, setSearchParams] = useSearchParams();\n const selectedInspectEntityDialogTab = searchParams.get('inspect');\n\n const setInspectEntityDialogTab = useCallback(\n (newTab: string) => setSearchParams(`inspect=${newTab}`),\n [setSearchParams],\n );\n\n const openInspectEntityDialog = useCallback(\n () => setSearchParams('inspect'),\n [setSearchParams],\n );\n\n const closeInspectEntityDialog = useCallback(\n () => setSearchParams(),\n [setSearchParams],\n );\n\n const inspectDialogOpen = typeof selectedInspectEntityDialogTab === 'string';\n\n return (\n <Header\n pageTitleOverride={entityFallbackText}\n type={type}\n title={title ?? <EntityHeaderTitle />}\n subtitle={\n subtitle ?? (\n <EntityHeaderSubtitle parentEntityRelations={parentEntityRelations} />\n )\n }\n >\n {entity && (\n <>\n <EntityLabels entity={entity} />\n <EntityContextMenu\n UNSTABLE_extraContextMenuItems={UNSTABLE_extraContextMenuItems}\n UNSTABLE_contextMenuOptions={UNSTABLE_contextMenuOptions}\n onInspectEntity={openInspectEntityDialog}\n onUnregisterEntity={openUnregisterEntityDialog}\n />\n <InspectEntityDialog\n entity={entity!}\n initialTab={\n (selectedInspectEntityDialogTab as ComponentProps<\n typeof InspectEntityDialog\n >['initialTab']) || undefined\n }\n open={inspectDialogOpen}\n onClose={closeInspectEntityDialog}\n onSelect={setInspectEntityDialogTab}\n />\n <UnregisterEntityDialog\n entity={entity!}\n open={confirmationDialogOpen}\n onClose={closeUnregisterEntityDialog}\n onConfirm={cleanUpAfterUnregisterConfirmation}\n />\n </>\n )}\n </Header>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AA0DA,SAAS,WACP,CAAA,SAAA,EACA,cACA,EAAA,SAAA,EACA,MAC6C,EAAA;AAC7C,EAAM,MAAA,IAAA,GAAO,SAAa,IAAA,MAAA,EAAQ,IAAQ,IAA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kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,sBAAA;AAAA,MAAA;AAAA,QACC,MAAA;AAAA,QACA,IAAM,EAAA,sBAAA;AAAA,QACN,OAAS,EAAA,2BAAA;AAAA,QACT,SAAW,EAAA;AAAA;AAAA,KAEf;AAAA,GAEJ;AAEJ;;;;"}
1
+ {"version":3,"file":"EntityHeader.esm.js","sources":["../../../../src/alpha/components/EntityHeader/EntityHeader.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 {\n useState,\n useCallback,\n useEffect,\n ComponentProps,\n ReactNode,\n} from 'react';\nimport { useNavigate, useLocation, useSearchParams } from 'react-router-dom';\nimport useAsync from 'react-use/esm/useAsync';\n\nimport { makeStyles } from '@material-ui/core/styles';\nimport Box from '@material-ui/core/Box';\n\nimport { Header, Breadcrumbs } from '@backstage/core-components';\nimport {\n useApi,\n useRouteRef,\n useRouteRefParams,\n} from '@backstage/core-plugin-api';\nimport { IconComponent } from '@backstage/frontend-plugin-api';\n\nimport {\n Entity,\n EntityRelation,\n DEFAULT_NAMESPACE,\n} from '@backstage/catalog-model';\n\nimport {\n useAsyncEntity,\n entityRouteRef,\n catalogApiRef,\n EntityRefLink,\n InspectEntityDialog,\n UnregisterEntityDialog,\n EntityDisplayName,\n FavoriteEntity,\n} from '@backstage/plugin-catalog-react';\n\nimport { EntityLabels } from '../EntityLabels';\nimport { EntityContextMenu } from '../../../components/EntityContextMenu';\nimport { rootRouteRef, unregisterRedirectRouteRef } from '../../../routes';\n\nfunction headerProps(\n paramKind: string | undefined,\n paramNamespace: string | undefined,\n paramName: string | undefined,\n entity: Entity | undefined,\n): { headerTitle: string; headerType: string } {\n const kind = paramKind ?? entity?.kind ?? '';\n const namespace = paramNamespace ?? entity?.metadata.namespace ?? '';\n const name =\n entity?.metadata.title ?? paramName ?? entity?.metadata.name ?? '';\n\n return {\n headerTitle: `${name}${\n namespace && namespace !== DEFAULT_NAMESPACE ? ` in ${namespace}` : ''\n }`,\n headerType: (() => {\n let t = kind.toLocaleLowerCase('en-US');\n if (entity && entity.spec && 'type' in entity.spec) {\n t += ' — ';\n t += (entity.spec as { type: string }).type.toLocaleLowerCase('en-US');\n }\n return t;\n })(),\n };\n}\n\nfunction findParentRelation(\n entityRelations: EntityRelation[] = [],\n relationTypes: string[] = [],\n) {\n for (const type of relationTypes) {\n const foundRelation = entityRelations.find(\n relation => relation.type === type,\n );\n if (foundRelation) {\n return foundRelation; // Return the first found relation and stop\n }\n }\n return null;\n}\n\nconst useStyles = makeStyles(theme => ({\n breadcrumbs: {\n color: theme.page.fontColor,\n fontSize: theme.typography.caption.fontSize,\n textTransform: 'uppercase',\n marginTop: theme.spacing(1),\n opacity: 0.8,\n '& span ': {\n color: theme.page.fontColor,\n textDecoration: 'underline',\n textUnderlineOffset: '3px',\n },\n },\n}));\n\nfunction EntityHeaderTitle() {\n const { entity } = useAsyncEntity();\n const { kind, namespace, name } = useRouteRefParams(entityRouteRef);\n const { headerTitle: title } = headerProps(kind, namespace, name, entity);\n return (\n <Box display=\"inline-flex\" alignItems=\"center\" height=\"1em\" maxWidth=\"100%\">\n <Box\n component=\"span\"\n textOverflow=\"ellipsis\"\n whiteSpace=\"nowrap\"\n overflow=\"hidden\"\n >\n {entity ? <EntityDisplayName entityRef={entity} hideIcon /> : title}\n </Box>\n {entity && <FavoriteEntity entity={entity} />}\n </Box>\n );\n}\n\nfunction EntityHeaderSubtitle(props: { parentEntityRelations?: string[] }) {\n const { parentEntityRelations } = props;\n const classes = useStyles();\n const { entity } = useAsyncEntity();\n const { name } = useRouteRefParams(entityRouteRef);\n const parentEntity = findParentRelation(\n entity?.relations ?? [],\n parentEntityRelations ?? [],\n );\n\n const catalogApi = useApi(catalogApiRef);\n\n const { value: ancestorEntity } = useAsync(async () => {\n if (parentEntity) {\n return findParentRelation(\n (await catalogApi.getEntityByRef(parentEntity?.targetRef))?.relations,\n parentEntityRelations,\n );\n }\n return null;\n }, [parentEntity, catalogApi]);\n\n return parentEntity ? (\n <Breadcrumbs separator=\">\" className={classes.breadcrumbs}>\n {ancestorEntity && (\n <EntityRefLink entityRef={ancestorEntity.targetRef} disableTooltip />\n )}\n <EntityRefLink entityRef={parentEntity.targetRef} disableTooltip />\n {name}\n </Breadcrumbs>\n ) : null;\n}\n\n/** @alpha */\nexport function EntityHeader(props: {\n // NOTE(freben): Intentionally not exported at this point, since it's part of\n // the unstable extra context menu items concept below\n UNSTABLE_extraContextMenuItems?: {\n title: string;\n Icon: IconComponent;\n onClick: () => void;\n }[];\n // NOTE(blam): Intentionally not exported at this point, since it's part of\n // unstable context menu option, eg: disable the unregister entity menu\n UNSTABLE_contextMenuOptions?: {\n disableUnregister: boolean | 'visible' | 'hidden' | 'disable';\n };\n contextMenuItems?: React.JSX.Element[];\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 title?: ReactNode;\n subtitle?: ReactNode;\n}) {\n const {\n UNSTABLE_extraContextMenuItems,\n UNSTABLE_contextMenuOptions,\n contextMenuItems,\n parentEntityRelations,\n title,\n subtitle,\n } = props;\n const { entity } = useAsyncEntity();\n const { kind, namespace, name } = useRouteRefParams(entityRouteRef);\n const { headerTitle: entityFallbackText, headerType: type } = headerProps(\n kind,\n namespace,\n name,\n entity,\n );\n\n const location = useLocation();\n const navigate = useNavigate();\n const catalogRoute = useRouteRef(rootRouteRef);\n const unregisterRedirectRoute = useRouteRef(unregisterRedirectRouteRef);\n\n const [confirmationDialogOpen, setConfirmationDialogOpen] = useState(false);\n\n const openUnregisterEntityDialog = useCallback(\n () => setConfirmationDialogOpen(true),\n [setConfirmationDialogOpen],\n );\n\n const closeUnregisterEntityDialog = useCallback(\n () => setConfirmationDialogOpen(false),\n [setConfirmationDialogOpen],\n );\n\n const cleanUpAfterUnregisterConfirmation = useCallback(async () => {\n setConfirmationDialogOpen(false);\n navigate(\n unregisterRedirectRoute ? unregisterRedirectRoute() : catalogRoute(),\n );\n }, [\n navigate,\n catalogRoute,\n unregisterRedirectRoute,\n setConfirmationDialogOpen,\n ]);\n\n // Make sure to close the dialog if the user clicks links in it that navigate\n // to another entity.\n useEffect(() => {\n setConfirmationDialogOpen(false);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [location.pathname]);\n\n const [searchParams, setSearchParams] = useSearchParams();\n const selectedInspectEntityDialogTab = searchParams.get('inspect');\n\n const setInspectEntityDialogTab = useCallback(\n (newTab: string) => setSearchParams(`inspect=${newTab}`),\n [setSearchParams],\n );\n\n const openInspectEntityDialog = useCallback(\n () => setSearchParams('inspect'),\n [setSearchParams],\n );\n\n const closeInspectEntityDialog = useCallback(\n () => setSearchParams(),\n [setSearchParams],\n );\n\n const inspectDialogOpen = typeof selectedInspectEntityDialogTab === 'string';\n\n return (\n <Header\n pageTitleOverride={entityFallbackText}\n type={type}\n title={title ?? <EntityHeaderTitle />}\n subtitle={\n subtitle ?? (\n <EntityHeaderSubtitle parentEntityRelations={parentEntityRelations} />\n )\n }\n >\n {entity && (\n <>\n <EntityLabels entity={entity} />\n <EntityContextMenu\n UNSTABLE_extraContextMenuItems={UNSTABLE_extraContextMenuItems}\n UNSTABLE_contextMenuOptions={UNSTABLE_contextMenuOptions}\n contextMenuItems={contextMenuItems}\n onInspectEntity={openInspectEntityDialog}\n onUnregisterEntity={openUnregisterEntityDialog}\n />\n <InspectEntityDialog\n entity={entity!}\n initialTab={\n (selectedInspectEntityDialogTab as ComponentProps<\n typeof InspectEntityDialog\n >['initialTab']) || undefined\n }\n open={inspectDialogOpen}\n onClose={closeInspectEntityDialog}\n onSelect={setInspectEntityDialogTab}\n />\n <UnregisterEntityDialog\n entity={entity!}\n open={confirmationDialogOpen}\n onClose={closeUnregisterEntityDialog}\n onConfirm={cleanUpAfterUnregisterConfirmation}\n />\n </>\n )}\n </Header>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AA0DA,SAAS,WACP,CAAA,SAAA,EACA,cACA,EAAA,SAAA,EACA,MAC6C,EAAA;AAC7C,EAAM,MAAA,IAAA,GAAO,SAAa,IAAA,MAAA,EAAQ,IAAQ,IAAA,EAAA;AAC1C,EAAA,MAAM,SAAY,GAAA,cAAA,IAAkB,MAAQ,EAAA,QAAA,CAAS,SAAa,IAAA,EAAA;AAClE,EAAA,MAAM,OACJ,MAAQ,EAAA,QAAA,CAAS,SAAS,SAAa,IAAA,MAAA,EAAQ,SAAS,IAAQ,IAAA,EAAA;AAElE,EAAO,OAAA;AAAA,IACL,WAAA,EAAa,CAAG,EAAA,IAAI,CAClB,EAAA,SAAA,IAAa,cAAc,iBAAoB,GAAA,CAAA,IAAA,EAAO,SAAS,CAAA,CAAA,GAAK,EACtE,CAAA,CAAA;AAAA,IACA,aAAa,MAAM;AACjB,MAAI,IAAA,CAAA,GAAI,IAAK,CAAA,iBAAA,CAAkB,OAAO,CAAA;AACtC,MAAA,IAAI,MAAU,IAAA,MAAA,CAAO,IAAQ,IAAA,MAAA,IAAU,OAAO,IAAM,EAAA;AAClD,QAAK,CAAA,IAAA,UAAA;AACL,QAAA,CAAA,IAAM,MAAO,CAAA,IAAA,CAA0B,IAAK,CAAA,iBAAA,CAAkB,OAAO,CAAA;AAAA;AAEvE,MAAO,OAAA,CAAA;AAAA,KACN;AAAA,GACL;AACF;AAEA,SAAS,mBACP,eAAoC,GAAA,E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wBAC9B,GAAA;AAAA,UAAC,iBAAA;AAAA,UAAA;AAAA,YACC,8BAAA;AAAA,YACA,2BAAA;AAAA,YACA,gBAAA;AAAA,YACA,eAAiB,EAAA,uBAAA;AAAA,YACjB,kBAAoB,EAAA;AAAA;AAAA,SACtB;AAAA,wBACA,GAAA;AAAA,UAAC,mBAAA;AAAA,UAAA;AAAA,YACC,MAAA;AAAA,YACA,YACG,8BAEmB,IAAA,KAAA,CAAA;AAAA,YAEtB,IAAM,EAAA,iBAAA;AAAA,YACN,OAAS,EAAA,wBAAA;AAAA,YACT,QAAU,EAAA;AAAA;AAAA,SACZ;AAAA,wBACA,GAAA;AAAA,UAAC,sBAAA;AAAA,UAAA;AAAA,YACC,MAAA;AAAA,YACA,IAAM,EAAA,sBAAA;AAAA,YACN,OAAS,EAAA,2BAAA;AAAA,YACT,SAAW,EAAA;AAAA;AAAA;AACb,OACF,EAAA;AAAA;AAAA,GAEJ;AAEJ;;;;"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
2
  import { HeaderLabel } from '@backstage/core-components';
3
3
  import { RELATION_OWNED_BY } from '@backstage/catalog-model';
4
4
  import { getEntityRelations, EntityRefLinks } from '@backstage/plugin-catalog-react';
@@ -9,27 +9,30 @@ function EntityLabels(props) {
9
9
  const { entity } = props;
10
10
  const ownedByRelations = getEntityRelations(entity, RELATION_OWNED_BY);
11
11
  const { t } = useTranslationRef(catalogTranslationRef);
12
- return /* @__PURE__ */ React.createElement(React.Fragment, null, ownedByRelations.length > 0 && /* @__PURE__ */ React.createElement(
13
- HeaderLabel,
14
- {
15
- label: t("entityLabels.ownerLabel"),
16
- contentTypograpyRootComponent: "p",
17
- value: /* @__PURE__ */ React.createElement(
18
- EntityRefLinks,
19
- {
20
- entityRefs: ownedByRelations,
21
- defaultKind: "Group",
22
- color: "inherit"
23
- }
24
- )
25
- }
26
- ), entity.spec?.lifecycle && /* @__PURE__ */ React.createElement(
27
- HeaderLabel,
28
- {
29
- label: t("entityLabels.lifecycleLabel"),
30
- value: entity.spec.lifecycle?.toString()
31
- }
32
- ));
12
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
13
+ ownedByRelations.length > 0 && /* @__PURE__ */ jsx(
14
+ HeaderLabel,
15
+ {
16
+ label: t("entityLabels.ownerLabel"),
17
+ contentTypograpyRootComponent: "p",
18
+ value: /* @__PURE__ */ jsx(
19
+ EntityRefLinks,
20
+ {
21
+ entityRefs: ownedByRelations,
22
+ defaultKind: "Group",
23
+ color: "inherit"
24
+ }
25
+ )
26
+ }
27
+ ),
28
+ entity.spec?.lifecycle && /* @__PURE__ */ jsx(
29
+ HeaderLabel,
30
+ {
31
+ label: t("entityLabels.lifecycleLabel"),
32
+ value: entity.spec.lifecycle?.toString()
33
+ }
34
+ )
35
+ ] });
33
36
  }
34
37
 
35
38
  export { EntityLabels };
@@ -1 +1 @@
1
- {"version":3,"file":"EntityLabels.esm.js","sources":["../../../../src/alpha/components/EntityLabels/EntityLabels.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 React from 'react';\nimport { HeaderLabel } from '@backstage/core-components';\nimport { Entity, RELATION_OWNED_BY } from '@backstage/catalog-model';\nimport {\n EntityRefLinks,\n getEntityRelations,\n} from '@backstage/plugin-catalog-react';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { catalogTranslationRef } from '../../translation';\n\ntype EntityLabelsProps = {\n entity: Entity;\n};\n\nexport function EntityLabels(props: EntityLabelsProps) {\n const { entity } = props;\n const ownedByRelations = getEntityRelations(entity, RELATION_OWNED_BY);\n const { t } = useTranslationRef(catalogTranslationRef);\n return (\n <>\n {ownedByRelations.length > 0 && (\n <HeaderLabel\n label={t('entityLabels.ownerLabel')}\n contentTypograpyRootComponent=\"p\"\n value={\n <EntityRefLinks\n entityRefs={ownedByRelations}\n defaultKind=\"Group\"\n color=\"inherit\"\n />\n }\n />\n )}\n {entity.spec?.lifecycle && (\n <HeaderLabel\n label={t('entityLabels.lifecycleLabel')}\n value={entity.spec.lifecycle?.toString()}\n />\n )}\n </>\n );\n}\n"],"names":[],"mappings":";;;;;;;AA8BO,SAAS,aAAa,KAA0B,EAAA;AACrD,EAAM,MAAA,EAAE,QAAW,GAAA,KAAA;AACnB,EAAM,MAAA,gBAAA,GAAmB,kBAAmB,CAAA,MAAA,EAAQ,iBAAiB,CAAA;AACrE,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,qBAAqB,CAAA;AACrD,EACE,uBAAA,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EACG,gBAAiB,CAAA,MAAA,GAAS,CACzB,oBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,EAAE,yBAAyB,CAAA;AAAA,MAClC,6BAA8B,EAAA,GAAA;AAAA,MAC9B,KACE,kBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,cAAA;AAAA,QAAA;AAAA,UACC,UAAY,EAAA,gBAAA;AAAA,UACZ,WAAY,EAAA,OAAA;AAAA,UACZ,KAAM,EAAA;AAAA;AAAA;AACR;AAAA,GAEJ,EAED,MAAO,CAAA,IAAA,EAAM,SACZ,oBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,EAAE,6BAA6B,CAAA;AAAA,MACtC,KAAO,EAAA,MAAA,CAAO,IAAK,CAAA,SAAA,EAAW,QAAS;AAAA;AAAA,GAG7C,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"EntityLabels.esm.js","sources":["../../../../src/alpha/components/EntityLabels/EntityLabels.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 { HeaderLabel } from '@backstage/core-components';\nimport { Entity, RELATION_OWNED_BY } from '@backstage/catalog-model';\nimport {\n EntityRefLinks,\n getEntityRelations,\n} from '@backstage/plugin-catalog-react';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { catalogTranslationRef } from '../../translation';\n\ntype EntityLabelsProps = {\n entity: Entity;\n};\n\nexport function EntityLabels(props: EntityLabelsProps) {\n const { entity } = props;\n const ownedByRelations = getEntityRelations(entity, RELATION_OWNED_BY);\n const { t } = useTranslationRef(catalogTranslationRef);\n return (\n <>\n {ownedByRelations.length > 0 && (\n <HeaderLabel\n label={t('entityLabels.ownerLabel')}\n contentTypograpyRootComponent=\"p\"\n value={\n <EntityRefLinks\n entityRefs={ownedByRelations}\n defaultKind=\"Group\"\n color=\"inherit\"\n />\n }\n />\n )}\n {entity.spec?.lifecycle && (\n <HeaderLabel\n label={t('entityLabels.lifecycleLabel')}\n value={entity.spec.lifecycle?.toString()}\n />\n )}\n </>\n );\n}\n"],"names":[],"mappings":";;;;;;;AA6BO,SAAS,aAAa,KAA0B,EAAA;AACrD,EAAM,MAAA,EAAE,QAAW,GAAA,KAAA;AACnB,EAAM,MAAA,gBAAA,GAAmB,kBAAmB,CAAA,MAAA,EAAQ,iBAAiB,CAAA;AACrE,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,qBAAqB,CAAA;AACrD,EAAA,uBAEK,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,IAAA,gBAAA,CAAiB,SAAS,CACzB,oBAAA,GAAA;AAAA,MAAC,WAAA;AAAA,MAAA;AAAA,QACC,KAAA,EAAO,EAAE,yBAAyB,CAAA;AAAA,QAClC,6BAA8B,EAAA,GAAA;AAAA,QAC9B,KACE,kBAAA,GAAA;AAAA,UAAC,cAAA;AAAA,UAAA;AAAA,YACC,UAAY,EAAA,gBAAA;AAAA,YACZ,WAAY,EAAA,OAAA;AAAA,YACZ,KAAM,EAAA;AAAA;AAAA;AACR;AAAA,KAEJ;AAAA,IAED,MAAA,CAAO,MAAM,SACZ,oBAAA,GAAA;AAAA,MAAC,WAAA;AAAA,MAAA;AAAA,QACC,KAAA,EAAO,EAAE,6BAA6B,CAAA;AAAA,QACtC,KAAO,EAAA,MAAA,CAAO,IAAK,CAAA,SAAA,EAAW,QAAS;AAAA;AAAA;AACzC,GAEJ,EAAA,CAAA;AAEJ;;;;"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import Alert from '@material-ui/lab/Alert';
3
3
  import { attachComponentData, useRouteRefParams, useElementFilter } from '@backstage/core-plugin-api';
4
4
  import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
@@ -16,6 +16,7 @@ const EntityLayout = (props) => {
16
16
  const {
17
17
  UNSTABLE_extraContextMenuItems,
18
18
  UNSTABLE_contextMenuOptions,
19
+ contextMenuItems,
19
20
  children,
20
21
  header,
21
22
  NotFoundComponent,
@@ -47,14 +48,28 @@ const EntityLayout = (props) => {
47
48
  [entity]
48
49
  );
49
50
  const { t } = useTranslationRef(catalogTranslationRef);
50
- return /* @__PURE__ */ React.createElement(Page, { themeId: entity?.spec?.type?.toString() ?? "home" }, header ?? /* @__PURE__ */ React.createElement(
51
- EntityHeader,
52
- {
53
- parentEntityRelations,
54
- UNSTABLE_contextMenuOptions,
55
- UNSTABLE_extraContextMenuItems
56
- }
57
- ), loading && /* @__PURE__ */ React.createElement(Progress, null), entity && /* @__PURE__ */ React.createElement(EntityTabs, { routes }), error && /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(Alert, { severity: "error" }, error.toString())), !loading && !error && !entity && /* @__PURE__ */ React.createElement(Content, null, NotFoundComponent ? NotFoundComponent : /* @__PURE__ */ React.createElement(WarningPanel, { title: t("entityLabels.warningPanelTitle") }, "There is no ", kind, " with the requested", " ", /* @__PURE__ */ React.createElement(Link, { to: "https://backstage.io/docs/features/software-catalog/references" }, "kind, namespace, and name"), ".")));
51
+ return /* @__PURE__ */ jsxs(Page, { themeId: entity?.spec?.type?.toString() ?? "home", children: [
52
+ header ?? /* @__PURE__ */ jsx(
53
+ EntityHeader,
54
+ {
55
+ parentEntityRelations,
56
+ UNSTABLE_contextMenuOptions,
57
+ UNSTABLE_extraContextMenuItems,
58
+ contextMenuItems
59
+ }
60
+ ),
61
+ loading && /* @__PURE__ */ jsx(Progress, {}),
62
+ entity && /* @__PURE__ */ jsx(EntityTabs, { routes }),
63
+ error && /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsx(Alert, { severity: "error", children: error.toString() }) }),
64
+ !loading && !error && !entity && /* @__PURE__ */ jsx(Content, { children: NotFoundComponent ? NotFoundComponent : /* @__PURE__ */ jsxs(WarningPanel, { title: t("entityLabels.warningPanelTitle"), children: [
65
+ "There is no ",
66
+ kind,
67
+ " with the requested",
68
+ " ",
69
+ /* @__PURE__ */ jsx(Link, { to: "https://backstage.io/docs/features/software-catalog/references", children: "kind, namespace, and name" }),
70
+ "."
71
+ ] }) })
72
+ ] });
58
73
  };
59
74
  EntityLayout.Route = Route;
60
75