@backstage/plugin-catalog 1.24.1-next.2 → 1.25.0-next.3
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 +29 -0
- package/dist/components/CatalogTable/CursorPaginatedCatalogTable.esm.js +1 -1
- package/dist/components/CatalogTable/CursorPaginatedCatalogTable.esm.js.map +1 -1
- package/dist/components/CatalogTable/OffsetPaginatedCatalogTable.esm.js +3 -2
- package/dist/components/CatalogTable/OffsetPaginatedCatalogTable.esm.js.map +1 -1
- package/dist/components/EntityLayout/EntityLayout.esm.js +64 -8
- package/dist/components/EntityLayout/EntityLayout.esm.js.map +1 -1
- package/dist/index.d.ts +11 -0
- package/package.json +21 -12
- package/alpha/package.json +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @backstage/plugin-catalog
|
|
2
2
|
|
|
3
|
+
## 1.25.0-next.3
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 50df3c8: - Updated EntityLayout component to implement breadcrumb navigation based on the entity relations.
|
|
8
|
+
|
|
9
|
+
- Added parentEntityRelations prop to EntityLayoutProps to specify relation types for parent entities.
|
|
10
|
+
|
|
11
|
+
- 79e9631: Allow `OffsetPaginatedCatalogTable` to configure Table options and `CursorPaginatedCatalogTable` to configure `paginationPosition`.
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
- @backstage/plugin-scaffolder-common@1.5.7-next.0
|
|
17
|
+
- @backstage/core-components@0.16.0-next.2
|
|
18
|
+
- @backstage/plugin-catalog-react@1.14.1-next.3
|
|
19
|
+
- @backstage/core-compat-api@0.3.2-next.2
|
|
20
|
+
- @backstage/catalog-client@1.8.0-next.1
|
|
21
|
+
- @backstage/catalog-model@1.7.0
|
|
22
|
+
- @backstage/core-plugin-api@1.10.0
|
|
23
|
+
- @backstage/errors@1.2.4
|
|
24
|
+
- @backstage/frontend-plugin-api@0.9.1-next.2
|
|
25
|
+
- @backstage/integration-react@1.2.0
|
|
26
|
+
- @backstage/types@1.1.1
|
|
27
|
+
- @backstage/plugin-catalog-common@1.1.0
|
|
28
|
+
- @backstage/plugin-permission-react@0.4.27
|
|
29
|
+
- @backstage/plugin-search-common@1.2.14
|
|
30
|
+
- @backstage/plugin-search-react@1.8.2-next.2
|
|
31
|
+
|
|
3
32
|
## 1.24.1-next.2
|
|
4
33
|
|
|
5
34
|
### Patch Changes
|
|
@@ -11,9 +11,9 @@ function CursorPaginatedCatalogTable(props) {
|
|
|
11
11
|
columns,
|
|
12
12
|
data,
|
|
13
13
|
options: {
|
|
14
|
+
paginationPosition: "both",
|
|
14
15
|
...options,
|
|
15
16
|
// These settings are configured to force server side pagination
|
|
16
|
-
paginationPosition: "both",
|
|
17
17
|
pageSizeOptions: [],
|
|
18
18
|
showFirstLastPageButtons: false,
|
|
19
19
|
pageSize: Number.MAX_SAFE_INTEGER,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CursorPaginatedCatalogTable.esm.js","sources":["../../../src/components/CatalogTable/CursorPaginatedCatalogTable.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';\n\nimport { Table, TableProps } from '@backstage/core-components';\nimport { CatalogTableRow } from './types';\nimport { CatalogTableToolbar } from './CatalogTableToolbar';\n\ntype PaginatedCatalogTableProps = {\n prev?(): void;\n next?(): void;\n} & TableProps<CatalogTableRow>;\n\n/**\n * @internal\n */\n\nexport function CursorPaginatedCatalogTable(props: PaginatedCatalogTableProps) {\n const { columns, data, next, prev, title, isLoading, options, ...restProps } =\n props;\n\n return (\n <Table\n title={isLoading ? '' : title}\n columns={columns}\n data={data}\n options={{\n ...options,\n // These settings are configured to force server side pagination\n
|
|
1
|
+
{"version":3,"file":"CursorPaginatedCatalogTable.esm.js","sources":["../../../src/components/CatalogTable/CursorPaginatedCatalogTable.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';\n\nimport { Table, TableProps } from '@backstage/core-components';\nimport { CatalogTableRow } from './types';\nimport { CatalogTableToolbar } from './CatalogTableToolbar';\n\ntype PaginatedCatalogTableProps = {\n prev?(): void;\n next?(): void;\n} & TableProps<CatalogTableRow>;\n\n/**\n * @internal\n */\n\nexport function CursorPaginatedCatalogTable(props: PaginatedCatalogTableProps) {\n const { columns, data, next, prev, title, isLoading, options, ...restProps } =\n props;\n\n return (\n <Table\n title={isLoading ? '' : title}\n columns={columns}\n data={data}\n options={{\n paginationPosition: 'both',\n ...options,\n // These settings are configured to force server side pagination\n pageSizeOptions: [],\n showFirstLastPageButtons: false,\n pageSize: Number.MAX_SAFE_INTEGER,\n emptyRowsWhenPaging: false,\n }}\n onPageChange={page => {\n if (page > 0) {\n next?.();\n } else {\n prev?.();\n }\n }}\n components={{\n Toolbar: CatalogTableToolbar,\n }}\n /* this will enable the prev button accordingly */\n page={prev ? 1 : 0}\n /* this will enable the next button accordingly */\n totalCount={next ? Number.MAX_VALUE : Number.MAX_SAFE_INTEGER}\n localization={{ pagination: { labelDisplayedRows: '' } }}\n isLoading={isLoading}\n {...restProps}\n />\n );\n}\n"],"names":[],"mappings":";;;;AA+BO,SAAS,4BAA4B,KAAmC,EAAA;AAC7E,EAAM,MAAA,EAAE,OAAS,EAAA,IAAA,EAAM,IAAM,EAAA,IAAA,EAAM,OAAO,SAAW,EAAA,OAAA,EAAS,GAAG,SAAA,EAC/D,GAAA,KAAA;AAEF,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,YAAY,EAAK,GAAA,KAAA;AAAA,MACxB,OAAA;AAAA,MACA,IAAA;AAAA,MACA,OAAS,EAAA;AAAA,QACP,kBAAoB,EAAA,MAAA;AAAA,QACpB,GAAG,OAAA;AAAA;AAAA,QAEH,iBAAiB,EAAC;AAAA,QAClB,wBAA0B,EAAA,KAAA;AAAA,QAC1B,UAAU,MAAO,CAAA,gBAAA;AAAA,QACjB,mBAAqB,EAAA;AAAA,OACvB;AAAA,MACA,cAAc,CAAQ,IAAA,KAAA;AACpB,QAAA,IAAI,OAAO,CAAG,EAAA;AACZ,UAAO,IAAA,IAAA;AAAA,SACF,MAAA;AACL,UAAO,IAAA,IAAA;AAAA;AACT,OACF;AAAA,MACA,UAAY,EAAA;AAAA,QACV,OAAS,EAAA;AAAA,OACX;AAAA,MAEA,IAAA,EAAM,OAAO,CAAI,GAAA,CAAA;AAAA,MAEjB,UAAY,EAAA,IAAA,GAAO,MAAO,CAAA,SAAA,GAAY,MAAO,CAAA,gBAAA;AAAA,MAC7C,cAAc,EAAE,UAAA,EAAY,EAAE,kBAAA,EAAoB,IAAK,EAAA;AAAA,MACvD,SAAA;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;;;;"}
|
|
@@ -3,7 +3,7 @@ import { Table } from '@backstage/core-components';
|
|
|
3
3
|
import { useEntityList, EntityTextFilter } from '@backstage/plugin-catalog-react';
|
|
4
4
|
|
|
5
5
|
function OffsetPaginatedCatalogTable(props) {
|
|
6
|
-
const { columns, data, isLoading } = props;
|
|
6
|
+
const { columns, data, isLoading, options } = props;
|
|
7
7
|
const { updateFilters, setLimit, setOffset, limit, totalItems, offset } = useEntityList();
|
|
8
8
|
const [page, setPage] = React.useState(
|
|
9
9
|
offset && limit ? Math.floor(offset / limit) : 0
|
|
@@ -24,7 +24,8 @@ function OffsetPaginatedCatalogTable(props) {
|
|
|
24
24
|
paginationPosition: "both",
|
|
25
25
|
pageSizeOptions: [5, 10, 20, 50, 100],
|
|
26
26
|
pageSize: limit,
|
|
27
|
-
emptyRowsWhenPaging: false
|
|
27
|
+
emptyRowsWhenPaging: false,
|
|
28
|
+
...options
|
|
28
29
|
},
|
|
29
30
|
onSearchChange: (searchText) => updateFilters({
|
|
30
31
|
text: searchText ? new EntityTextFilter(searchText) : void 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OffsetPaginatedCatalogTable.esm.js","sources":["../../../src/components/CatalogTable/OffsetPaginatedCatalogTable.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, { useEffect } from 'react';\n\nimport { Table, TableProps } from '@backstage/core-components';\nimport { CatalogTableRow } from './types';\nimport {\n EntityTextFilter,\n useEntityList,\n} from '@backstage/plugin-catalog-react';\n\n/**\n * @internal\n */\nexport function OffsetPaginatedCatalogTable(\n props: TableProps<CatalogTableRow>,\n) {\n const { columns, data, isLoading } = props;\n const { updateFilters, setLimit, setOffset, limit, totalItems, offset } =\n useEntityList();\n const [page, setPage] = React.useState(\n offset && limit ? Math.floor(offset / limit) : 0,\n );\n\n useEffect(() => {\n if (totalItems && page * limit >= totalItems) {\n setOffset!(Math.max(0, totalItems - limit));\n } else {\n setOffset!(Math.max(0, page * limit));\n }\n }, [setOffset, page, limit, totalItems]);\n\n return (\n <Table\n columns={columns}\n data={data}\n options={{\n paginationPosition: 'both',\n pageSizeOptions: [5, 10, 20, 50, 100],\n pageSize: limit,\n emptyRowsWhenPaging: false,\n }}\n onSearchChange={(searchText: string) =>\n updateFilters({\n text: searchText ? new EntityTextFilter(searchText) : undefined,\n })\n }\n page={page}\n onPageChange={newPage => {\n setPage(newPage);\n }}\n onRowsPerPageChange={pageSize => {\n setLimit(pageSize);\n }}\n totalCount={totalItems}\n localization={{ pagination: { labelDisplayedRows: '' } }}\n isLoading={isLoading}\n />\n );\n}\n"],"names":[],"mappings":";;;;AA4BO,SAAS,4BACd,KACA,EAAA;AACA,EAAA,MAAM,EAAE,OAAA,EAAS,IAAM,EAAA,SAAA,
|
|
1
|
+
{"version":3,"file":"OffsetPaginatedCatalogTable.esm.js","sources":["../../../src/components/CatalogTable/OffsetPaginatedCatalogTable.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, { useEffect } from 'react';\n\nimport { Table, TableProps } from '@backstage/core-components';\nimport { CatalogTableRow } from './types';\nimport {\n EntityTextFilter,\n useEntityList,\n} from '@backstage/plugin-catalog-react';\n\n/**\n * @internal\n */\nexport function OffsetPaginatedCatalogTable(\n props: TableProps<CatalogTableRow>,\n) {\n const { columns, data, isLoading, options } = props;\n const { updateFilters, setLimit, setOffset, limit, totalItems, offset } =\n useEntityList();\n const [page, setPage] = React.useState(\n offset && limit ? Math.floor(offset / limit) : 0,\n );\n\n useEffect(() => {\n if (totalItems && page * limit >= totalItems) {\n setOffset!(Math.max(0, totalItems - limit));\n } else {\n setOffset!(Math.max(0, page * limit));\n }\n }, [setOffset, page, limit, totalItems]);\n\n return (\n <Table\n columns={columns}\n data={data}\n options={{\n paginationPosition: 'both',\n pageSizeOptions: [5, 10, 20, 50, 100],\n pageSize: limit,\n emptyRowsWhenPaging: false,\n ...options,\n }}\n onSearchChange={(searchText: string) =>\n updateFilters({\n text: searchText ? new EntityTextFilter(searchText) : undefined,\n })\n }\n page={page}\n onPageChange={newPage => {\n setPage(newPage);\n }}\n onRowsPerPageChange={pageSize => {\n setLimit(pageSize);\n }}\n totalCount={totalItems}\n localization={{ pagination: { labelDisplayedRows: '' } }}\n isLoading={isLoading}\n />\n );\n}\n"],"names":[],"mappings":";;;;AA4BO,SAAS,4BACd,KACA,EAAA;AACA,EAAA,MAAM,EAAE,OAAA,EAAS,IAAM,EAAA,SAAA,EAAW,SAAY,GAAA,KAAA;AAC9C,EAAM,MAAA,EAAE,eAAe,QAAU,EAAA,SAAA,EAAW,OAAO,UAAY,EAAA,MAAA,KAC7D,aAAc,EAAA;AAChB,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,KAAM,CAAA,QAAA;AAAA,IAC5B,UAAU,KAAQ,GAAA,IAAA,CAAK,KAAM,CAAA,MAAA,GAAS,KAAK,CAAI,GAAA;AAAA,GACjD;AAEA,EAAA,SAAA,CAAU,MAAM;AACd,IAAI,IAAA,UAAA,IAAc,IAAO,GAAA,KAAA,IAAS,UAAY,EAAA;AAC5C,MAAA,SAAA,CAAW,IAAK,CAAA,GAAA,CAAI,CAAG,EAAA,UAAA,GAAa,KAAK,CAAC,CAAA;AAAA,KACrC,MAAA;AACL,MAAA,SAAA,CAAW,IAAK,CAAA,GAAA,CAAI,CAAG,EAAA,IAAA,GAAO,KAAK,CAAC,CAAA;AAAA;AACtC,KACC,CAAC,SAAA,EAAW,IAAM,EAAA,KAAA,EAAO,UAAU,CAAC,CAAA;AAEvC,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,OAAA;AAAA,MACA,IAAA;AAAA,MACA,OAAS,EAAA;AAAA,QACP,kBAAoB,EAAA,MAAA;AAAA,QACpB,iBAAiB,CAAC,CAAA,EAAG,EAAI,EAAA,EAAA,EAAI,IAAI,GAAG,CAAA;AAAA,QACpC,QAAU,EAAA,KAAA;AAAA,QACV,mBAAqB,EAAA,KAAA;AAAA,QACrB,GAAG;AAAA,OACL;AAAA,MACA,cAAA,EAAgB,CAAC,UAAA,KACf,aAAc,CAAA;AAAA,QACZ,IAAM,EAAA,UAAA,GAAa,IAAI,gBAAA,CAAiB,UAAU,CAAI,GAAA,KAAA;AAAA,OACvD,CAAA;AAAA,MAEH,IAAA;AAAA,MACA,cAAc,CAAW,OAAA,KAAA;AACvB,QAAA,OAAA,CAAQ,OAAO,CAAA;AAAA,OACjB;AAAA,MACA,qBAAqB,CAAY,QAAA,KAAA;AAC/B,QAAA,QAAA,CAAS,QAAQ,CAAA;AAAA,OACnB;AAAA,MACA,UAAY,EAAA,UAAA;AAAA,MACZ,cAAc,EAAE,UAAA,EAAY,EAAE,kBAAA,EAAoB,IAAK,EAAA;AAAA,MACvD;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { DEFAULT_NAMESPACE, RELATION_OWNED_BY } from '@backstage/catalog-model';
|
|
2
|
-
import { Page, Header, Progress, RoutedTabs, Content, WarningPanel, Link, HeaderLabel } from '@backstage/core-components';
|
|
3
|
-
import { attachComponentData, useRouteRefParams, useElementFilter, useRouteRef } from '@backstage/core-plugin-api';
|
|
4
|
-
import {
|
|
2
|
+
import { Page, Header, Breadcrumbs, Progress, RoutedTabs, Content, WarningPanel, Link, HeaderLabel } from '@backstage/core-components';
|
|
3
|
+
import { attachComponentData, useRouteRefParams, useElementFilter, useRouteRef, useApi } from '@backstage/core-plugin-api';
|
|
4
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
5
|
+
import { entityRouteRef, useAsyncEntity, catalogApiRef, EntityRefLink, UnregisterEntityDialog, InspectEntityDialog, EntityDisplayName, FavoriteEntity, getEntityRelations, EntityRefLinks } from '@backstage/plugin-catalog-react';
|
|
5
6
|
import Box from '@material-ui/core/Box';
|
|
7
|
+
import { makeStyles } from '@material-ui/core/styles';
|
|
6
8
|
import Alert from '@material-ui/lab/Alert';
|
|
7
9
|
import React, { useState, useEffect } from 'react';
|
|
8
10
|
import { useLocation, useNavigate } from 'react-router-dom';
|
|
9
|
-
import
|
|
10
|
-
import { rootRouteRef, unregisterRedirectRouteRef } from '../../routes.esm.js';
|
|
11
|
+
import useAsync from 'react-use/esm/useAsync';
|
|
11
12
|
import { catalogTranslationRef } from '../../alpha/translation.esm.js';
|
|
12
|
-
import {
|
|
13
|
+
import { rootRouteRef, unregisterRedirectRouteRef } from '../../routes.esm.js';
|
|
14
|
+
import { EntityContextMenu } from '../EntityContextMenu/EntityContextMenu.esm.js';
|
|
13
15
|
|
|
14
16
|
const dataKey = "plugin.catalog.entityLayoutRoute";
|
|
15
17
|
const Route = () => null;
|
|
@@ -70,13 +72,40 @@ function EntityLabels(props) {
|
|
|
70
72
|
}
|
|
71
73
|
));
|
|
72
74
|
}
|
|
75
|
+
function findParentRelation(entityRelations = [], relationTypes = []) {
|
|
76
|
+
for (const type of relationTypes) {
|
|
77
|
+
const foundRelation = entityRelations.find(
|
|
78
|
+
(relation) => relation.type === type
|
|
79
|
+
);
|
|
80
|
+
if (foundRelation) {
|
|
81
|
+
return foundRelation;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
const useStyles = makeStyles((theme) => ({
|
|
87
|
+
breadcrumbs: {
|
|
88
|
+
color: theme.page.fontColor,
|
|
89
|
+
fontSize: theme.typography.caption.fontSize,
|
|
90
|
+
textTransform: "uppercase",
|
|
91
|
+
marginTop: theme.spacing(1),
|
|
92
|
+
opacity: 0.8,
|
|
93
|
+
"& span ": {
|
|
94
|
+
color: theme.page.fontColor,
|
|
95
|
+
textDecoration: "underline",
|
|
96
|
+
textUnderlineOffset: "3px"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}));
|
|
73
100
|
const EntityLayout = (props) => {
|
|
74
101
|
const {
|
|
75
102
|
UNSTABLE_extraContextMenuItems,
|
|
76
103
|
UNSTABLE_contextMenuOptions,
|
|
77
104
|
children,
|
|
78
|
-
NotFoundComponent
|
|
105
|
+
NotFoundComponent,
|
|
106
|
+
parentEntityRelations
|
|
79
107
|
} = props;
|
|
108
|
+
const classes = useStyles();
|
|
80
109
|
const { kind, namespace, name } = useRouteRefParams(entityRouteRef);
|
|
81
110
|
const { entity, loading, error } = useAsyncEntity();
|
|
82
111
|
const location = useLocation();
|
|
@@ -121,6 +150,20 @@ const EntityLayout = (props) => {
|
|
|
121
150
|
unregisterRedirectRoute ? unregisterRedirectRoute() : catalogRoute()
|
|
122
151
|
);
|
|
123
152
|
};
|
|
153
|
+
const parentEntity = findParentRelation(
|
|
154
|
+
entity?.relations ?? [],
|
|
155
|
+
parentEntityRelations ?? []
|
|
156
|
+
);
|
|
157
|
+
const catalogApi = useApi(catalogApiRef);
|
|
158
|
+
const { value: ancestorEntity } = useAsync(async () => {
|
|
159
|
+
if (parentEntity) {
|
|
160
|
+
return findParentRelation(
|
|
161
|
+
(await catalogApi.getEntityByRef(parentEntity?.targetRef))?.relations,
|
|
162
|
+
parentEntityRelations
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
return null;
|
|
166
|
+
}, [parentEntity]);
|
|
124
167
|
useEffect(() => {
|
|
125
168
|
setConfirmationDialogOpen(false);
|
|
126
169
|
setInspectionDialogOpen(false);
|
|
@@ -130,7 +173,20 @@ const EntityLayout = (props) => {
|
|
|
130
173
|
{
|
|
131
174
|
title: /* @__PURE__ */ React.createElement(EntityLayoutTitle, { title: headerTitle, entity }),
|
|
132
175
|
pageTitleOverride: headerTitle,
|
|
133
|
-
type: headerType
|
|
176
|
+
type: headerType,
|
|
177
|
+
subtitle: parentEntity && /* @__PURE__ */ React.createElement(Breadcrumbs, { separator: ">", className: classes.breadcrumbs }, ancestorEntity && /* @__PURE__ */ React.createElement(
|
|
178
|
+
EntityRefLink,
|
|
179
|
+
{
|
|
180
|
+
entityRef: ancestorEntity.targetRef,
|
|
181
|
+
disableTooltip: true
|
|
182
|
+
}
|
|
183
|
+
), /* @__PURE__ */ React.createElement(
|
|
184
|
+
EntityRefLink,
|
|
185
|
+
{
|
|
186
|
+
entityRef: parentEntity.targetRef,
|
|
187
|
+
disableTooltip: true
|
|
188
|
+
}
|
|
189
|
+
), name)
|
|
134
190
|
},
|
|
135
191
|
entity && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(EntityLabels, { entity }), /* @__PURE__ */ React.createElement(
|
|
136
192
|
EntityContextMenu,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityLayout.esm.js","sources":["../../../src/components/EntityLayout/EntityLayout.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Entity,\n DEFAULT_NAMESPACE,\n RELATION_OWNED_BY,\n} from '@backstage/catalog-model';\nimport {\n Content,\n Header,\n HeaderLabel,\n Link,\n Page,\n Progress,\n RoutedTabs,\n WarningPanel,\n} from '@backstage/core-components';\nimport {\n attachComponentData,\n IconComponent,\n useElementFilter,\n useRouteRef,\n useRouteRefParams,\n} from '@backstage/core-plugin-api';\nimport {\n EntityDisplayName,\n EntityRefLinks,\n entityRouteRef,\n FavoriteEntity,\n getEntityRelations,\n InspectEntityDialog,\n UnregisterEntityDialog,\n useAsyncEntity,\n} from '@backstage/plugin-catalog-react';\nimport Box from '@material-ui/core/Box';\nimport { TabProps } from '@material-ui/core/Tab';\nimport Alert from '@material-ui/lab/Alert';\nimport React, { useEffect, useState } from 'react';\nimport { useLocation, useNavigate } from 'react-router-dom';\nimport { EntityContextMenu } from '../EntityContextMenu/EntityContextMenu';\nimport { rootRouteRef, unregisterRedirectRouteRef } from '../../routes';\nimport { catalogTranslationRef } from '../../alpha/translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\n/** @public */\nexport type EntityLayoutRouteProps = {\n path: string;\n title: string;\n children: JSX.Element;\n if?: (entity: Entity) => boolean;\n tabProps?: TabProps<React.ElementType, { component?: React.ElementType }>;\n};\n\nconst dataKey = 'plugin.catalog.entityLayoutRoute';\n\nconst Route: (props: EntityLayoutRouteProps) => null = () => null;\nattachComponentData(Route, dataKey, true);\nattachComponentData(Route, 'core.gatherMountPoints', true); // This causes all mount points that are discovered within this route to use the path of the route itself\n\nfunction EntityLayoutTitle(props: {\n title: string;\n entity: Entity | undefined;\n}) {\n const { entity, title } = props;\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 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 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 EntityLabels(props: { entity: Entity }) {\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\n// NOTE(freben): Intentionally not exported at this point, since it's part of\n// the unstable extra context menu items concept below\ninterface ExtraContextMenuItem {\n title: string;\n Icon: IconComponent;\n onClick: () => void;\n}\n\ntype VisibleType = 'visible' | 'hidden' | 'disable';\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\ninterface EntityContextMenuOptions {\n disableUnregister: boolean | VisibleType;\n}\n\n/** @public */\nexport interface EntityLayoutProps {\n UNSTABLE_extraContextMenuItems?: ExtraContextMenuItem[];\n UNSTABLE_contextMenuOptions?: EntityContextMenuOptions;\n children?: React.ReactNode;\n NotFoundComponent?: React.ReactNode;\n}\n\n/**\n * EntityLayout is a compound component, which allows you to define a layout for\n * entities using a sub-navigation mechanism.\n *\n * Consists of two parts: EntityLayout and EntityLayout.Route\n *\n * @example\n * ```jsx\n * <EntityLayout>\n * <EntityLayout.Route path=\"/example\" title=\"Example tab\">\n * <div>This is rendered under /example/anything-here route</div>\n * </EntityLayout.Route>\n * </EntityLayout>\n * ```\n *\n * @public\n */\nexport const EntityLayout = (props: EntityLayoutProps) => {\n const {\n UNSTABLE_extraContextMenuItems,\n UNSTABLE_contextMenuOptions,\n children,\n NotFoundComponent,\n } = props;\n const { kind, namespace, name } = useRouteRefParams(entityRouteRef);\n const { entity, loading, error } = useAsyncEntity();\n const location = useLocation();\n const routes = useElementFilter(\n children,\n elements =>\n elements\n .selectByComponentData({\n key: dataKey,\n withStrictError:\n 'Child of EntityLayout must be an EntityLayout.Route',\n })\n .getElements<EntityLayoutRouteProps>() // all nodes, element data, maintain structure or not?\n .flatMap(({ props: elementProps }) => {\n if (!entity) {\n return [];\n } else if (elementProps.if && !elementProps.if(entity)) {\n return [];\n }\n\n return [\n {\n path: elementProps.path,\n title: elementProps.title,\n children: elementProps.children,\n tabProps: elementProps.tabProps,\n },\n ];\n }),\n [entity],\n );\n\n const { headerTitle, headerType } = headerProps(\n kind,\n namespace,\n name,\n entity,\n );\n\n const [confirmationDialogOpen, setConfirmationDialogOpen] = useState(false);\n const [inspectionDialogOpen, setInspectionDialogOpen] = useState(false);\n const navigate = useNavigate();\n const catalogRoute = useRouteRef(rootRouteRef);\n const unregisterRedirectRoute = useRouteRef(unregisterRedirectRouteRef);\n const { t } = useTranslationRef(catalogTranslationRef);\n\n const cleanUpAfterRemoval = async () => {\n setConfirmationDialogOpen(false);\n setInspectionDialogOpen(false);\n navigate(\n unregisterRedirectRoute ? unregisterRedirectRoute() : catalogRoute(),\n );\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 setInspectionDialogOpen(false);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [location.pathname]);\n\n return (\n <Page themeId={entity?.spec?.type?.toString() ?? 'home'}>\n <Header\n title={<EntityLayoutTitle title={headerTitle} entity={entity!} />}\n pageTitleOverride={headerTitle}\n type={headerType}\n >\n {entity && (\n <>\n <EntityLabels entity={entity} />\n <EntityContextMenu\n UNSTABLE_extraContextMenuItems={UNSTABLE_extraContextMenuItems}\n UNSTABLE_contextMenuOptions={UNSTABLE_contextMenuOptions}\n onUnregisterEntity={() => setConfirmationDialogOpen(true)}\n onInspectEntity={() => setInspectionDialogOpen(true)}\n />\n </>\n )}\n </Header>\n\n {loading && <Progress />}\n\n {entity && <RoutedTabs routes={routes} />}\n\n {error && (\n <Content>\n <Alert severity=\"error\">{error.toString()}</Alert>\n </Content>\n )}\n\n {!loading && !error && !entity && (\n <Content>\n {NotFoundComponent ? (\n NotFoundComponent\n ) : (\n <WarningPanel title={t('entityLabels.warningPanelTitle')}>\n There is no {kind} with the requested{' '}\n <Link to=\"https://backstage.io/docs/features/software-catalog/references\">\n kind, namespace, and name\n </Link>\n .\n </WarningPanel>\n )}\n </Content>\n )}\n\n <UnregisterEntityDialog\n open={confirmationDialogOpen}\n entity={entity!}\n onConfirm={cleanUpAfterRemoval}\n onClose={() => setConfirmationDialogOpen(false)}\n />\n <InspectEntityDialog\n open={inspectionDialogOpen}\n entity={entity!}\n onClose={() => setInspectionDialogOpen(false)}\n />\n </Page>\n );\n};\n\nEntityLayout.Route = Route;\n"],"names":[],"mappings":";;;;;;;;;;;;;AAmEA,MAAM,OAAU,GAAA,kCAAA;AAEhB,MAAM,QAAiD,MAAM,IAAA;AAC7D,mBAAoB,CAAA,KAAA,EAAO,SAAS,IAAI,CAAA;AACxC,mBAAoB,CAAA,KAAA,EAAO,0BAA0B,IAAI,CAAA;AAEzD,SAAS,kBAAkB,KAGxB,EAAA;AACD,EAAM,MAAA,EAAE,MAAQ,EAAA,KAAA,EAAU,GAAA,KAAA;AAC1B,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,OAAI,OAAQ,EAAA,aAAA,EAAc,YAAW,QAAS,EAAA,MAAA,EAAO,KAAM,EAAA,QAAA,EAAS,MACnE,EAAA,kB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AA,QAAA,EAAS,OAAS,EAAA,EAAA,KAAA,CAAM,UAAW,CAC5C,CAGD,EAAA,CAAC,OAAW,IAAA,CAAC,SAAS,CAAC,MAAA,wCACrB,OACE,EAAA,IAAA,EAAA,iBAAA,GACC,oCAEC,KAAA,CAAA,aAAA,CAAA,YAAA,EAAA,EAAa,KAAO,EAAA,CAAA,CAAE,gCAAgC,CAAA,EAAA,EAAG,gBAC3C,IAAK,EAAA,qBAAA,EAAoB,GACtC,kBAAA,KAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,EAAA,EAAG,oEAAiE,2BAE1E,CAAA,EAAO,GAET,CAEJ,CAGF,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,sBAAA;AAAA,IAAA;AAAA,MACC,IAAM,EAAA,sBAAA;AAAA,MACN,MAAA;AAAA,MACA,SAAW,EAAA,mBAAA;AAAA,MACX,OAAA,EAAS,MAAM,yBAAA,CAA0B,KAAK;AAAA;AAAA,GAEhD,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,mBAAA;AAAA,IAAA;AAAA,MACC,IAAM,EAAA,oBAAA;AAAA,MACN,MAAA;AAAA,MACA,OAAA,EAAS,MAAM,uBAAA,CAAwB,KAAK;AAAA;AAAA,GAEhD,CAAA;AAEJ;AAEA,YAAA,CAAa,KAAQ,GAAA,KAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"EntityLayout.esm.js","sources":["../../../src/components/EntityLayout/EntityLayout.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n DEFAULT_NAMESPACE,\n Entity,\n EntityRelation,\n RELATION_OWNED_BY,\n} from '@backstage/catalog-model';\nimport {\n Breadcrumbs,\n Content,\n Header,\n HeaderLabel,\n Link,\n Page,\n Progress,\n RoutedTabs,\n WarningPanel,\n} from '@backstage/core-components';\nimport {\n attachComponentData,\n IconComponent,\n useApi,\n useElementFilter,\n useRouteRef,\n useRouteRefParams,\n} from '@backstage/core-plugin-api';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport {\n catalogApiRef,\n EntityDisplayName,\n EntityRefLink,\n EntityRefLinks,\n entityRouteRef,\n FavoriteEntity,\n getEntityRelations,\n InspectEntityDialog,\n UnregisterEntityDialog,\n useAsyncEntity,\n} from '@backstage/plugin-catalog-react';\nimport Box from '@material-ui/core/Box';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { TabProps } from '@material-ui/core/Tab';\nimport Alert from '@material-ui/lab/Alert';\nimport React, { useEffect, useState } from 'react';\nimport { useLocation, useNavigate } from 'react-router-dom';\nimport useAsync from 'react-use/esm/useAsync';\nimport { catalogTranslationRef } from '../../alpha/translation';\nimport { rootRouteRef, unregisterRedirectRouteRef } from '../../routes';\nimport { EntityContextMenu } from '../EntityContextMenu/EntityContextMenu';\n\n/** @public */\nexport type EntityLayoutRouteProps = {\n path: string;\n title: string;\n children: JSX.Element;\n if?: (entity: Entity) => boolean;\n tabProps?: TabProps<React.ElementType, { component?: React.ElementType }>;\n};\n\nconst dataKey = 'plugin.catalog.entityLayoutRoute';\n\nconst Route: (props: EntityLayoutRouteProps) => null = () => null;\nattachComponentData(Route, dataKey, true);\nattachComponentData(Route, 'core.gatherMountPoints', true); // This causes all mount points that are discovered within this route to use the path of the route itself\n\nfunction EntityLayoutTitle(props: {\n title: string;\n entity: Entity | undefined;\n}) {\n const { entity, title } = props;\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 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 EntityLabels(props: { entity: Entity }) {\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\n// NOTE(freben): Intentionally not exported at this point, since it's part of\n// the unstable extra context menu items concept below\ninterface ExtraContextMenuItem {\n title: string;\n Icon: IconComponent;\n onClick: () => void;\n}\n\ntype VisibleType = 'visible' | 'hidden' | 'disable';\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\ninterface EntityContextMenuOptions {\n disableUnregister: boolean | VisibleType;\n}\n\n/** @public */\nexport interface EntityLayoutProps {\n UNSTABLE_extraContextMenuItems?: ExtraContextMenuItem[];\n UNSTABLE_contextMenuOptions?: EntityContextMenuOptions;\n children?: React.ReactNode;\n NotFoundComponent?: React.ReactNode;\n /**\n * An array of relation types used to determine the parent entities in the hierarchy.\n * These relations are prioritized in the order provided, allowing for flexible\n * navigation through entity relationships.\n *\n * For example, use relation types like `[\"partOf\", \"memberOf\", \"ownedBy\"]` to define how the entity is related to\n * its parents in the Entity Catalog.\n *\n * It adds breadcrumbs in the Entity page to enhance user navigation and context awareness.\n */\n parentEntityRelations?: string[];\n}\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\n/**\n * EntityLayout is a compound component, which allows you to define a layout for\n * entities using a sub-navigation mechanism.\n *\n * Consists of two parts: EntityLayout and EntityLayout.Route\n *\n * @example\n * ```jsx\n * <EntityLayout>\n * <EntityLayout.Route path=\"/example\" title=\"Example tab\">\n * <div>This is rendered under /example/anything-here route</div>\n * </EntityLayout.Route>\n * </EntityLayout>\n * ```\n *\n * @public\n */\nexport const EntityLayout = (props: EntityLayoutProps) => {\n const {\n UNSTABLE_extraContextMenuItems,\n UNSTABLE_contextMenuOptions,\n children,\n NotFoundComponent,\n parentEntityRelations,\n } = props;\n const classes = useStyles();\n const { kind, namespace, name } = useRouteRefParams(entityRouteRef);\n const { entity, loading, error } = useAsyncEntity();\n const location = useLocation();\n const routes = useElementFilter(\n children,\n elements =>\n elements\n .selectByComponentData({\n key: dataKey,\n withStrictError:\n 'Child of EntityLayout must be an EntityLayout.Route',\n })\n .getElements<EntityLayoutRouteProps>() // all nodes, element data, maintain structure or not?\n .flatMap(({ props: elementProps }) => {\n if (!entity) {\n return [];\n } else if (elementProps.if && !elementProps.if(entity)) {\n return [];\n }\n\n return [\n {\n path: elementProps.path,\n title: elementProps.title,\n children: elementProps.children,\n tabProps: elementProps.tabProps,\n },\n ];\n }),\n [entity],\n );\n\n const { headerTitle, headerType } = headerProps(\n kind,\n namespace,\n name,\n entity,\n );\n\n const [confirmationDialogOpen, setConfirmationDialogOpen] = useState(false);\n const [inspectionDialogOpen, setInspectionDialogOpen] = useState(false);\n const navigate = useNavigate();\n const catalogRoute = useRouteRef(rootRouteRef);\n const unregisterRedirectRoute = useRouteRef(unregisterRedirectRouteRef);\n const { t } = useTranslationRef(catalogTranslationRef);\n\n const cleanUpAfterRemoval = async () => {\n setConfirmationDialogOpen(false);\n setInspectionDialogOpen(false);\n navigate(\n unregisterRedirectRoute ? unregisterRedirectRoute() : catalogRoute(),\n );\n };\n\n const parentEntity = findParentRelation(\n entity?.relations ?? [],\n parentEntityRelations ?? [],\n );\n\n const catalogApi = useApi(catalogApiRef);\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]);\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 setInspectionDialogOpen(false);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [location.pathname]);\n\n return (\n <Page themeId={entity?.spec?.type?.toString() ?? 'home'}>\n <Header\n title={<EntityLayoutTitle title={headerTitle} entity={entity!} />}\n pageTitleOverride={headerTitle}\n type={headerType}\n subtitle={\n parentEntity && (\n <Breadcrumbs separator=\">\" className={classes.breadcrumbs}>\n {ancestorEntity && (\n <EntityRefLink\n entityRef={ancestorEntity.targetRef}\n disableTooltip\n />\n )}\n <EntityRefLink\n entityRef={parentEntity.targetRef}\n disableTooltip\n />\n {name}\n </Breadcrumbs>\n )\n }\n >\n {entity && (\n <>\n <EntityLabels entity={entity} />\n <EntityContextMenu\n UNSTABLE_extraContextMenuItems={UNSTABLE_extraContextMenuItems}\n UNSTABLE_contextMenuOptions={UNSTABLE_contextMenuOptions}\n onUnregisterEntity={() => setConfirmationDialogOpen(true)}\n onInspectEntity={() => setInspectionDialogOpen(true)}\n />\n </>\n )}\n </Header>\n\n {loading && <Progress />}\n\n {entity && <RoutedTabs routes={routes} />}\n\n {error && (\n <Content>\n <Alert severity=\"error\">{error.toString()}</Alert>\n </Content>\n )}\n\n {!loading && !error && !entity && (\n <Content>\n {NotFoundComponent ? (\n NotFoundComponent\n ) : (\n <WarningPanel title={t('entityLabels.warningPanelTitle')}>\n There is no {kind} with the requested{' '}\n <Link to=\"https://backstage.io/docs/features/software-catalog/references\">\n kind, namespace, and name\n </Link>\n .\n </WarningPanel>\n )}\n </Content>\n )}\n\n <UnregisterEntityDialog\n open={confirmationDialogOpen}\n entity={entity!}\n onConfirm={cleanUpAfterRemoval}\n onClose={() => setConfirmationDialogOpen(false)}\n />\n <InspectEntityDialog\n open={inspectionDialogOpen}\n entity={entity!}\n onClose={() => setInspectionDialogOpen(false)}\n />\n </Page>\n );\n};\n\nEntityLayout.Route = Route;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AA0EA,MAAM,OAAU,GAAA,kCAAA;AAEhB,MAAM,QAAiD,MAAM,IAAA;AAC7D,mBAAoB,CAAA,KAAA,EAAO,SAAS,IAAI,CAAA;AACxC,mBAAoB,CAAA,KAAA,EAAO,0BAA0B,IAAI,CAAA;AAEzD,SAAS,kBAAkB,KAGxB,EAAA;AACD,EAAM,MAAA,EAAE,MAAQ,EAAA,KAAA,EAAU,GAAA,KAAA;AAC1B,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,OAAI,OAAQ,EAAA,aAAA,EA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EAAA,oBAAA;AAAA,MACN,MAAA;AAAA,MACA,OAAA,EAAS,MAAM,uBAAA,CAAwB,KAAK;AAAA;AAAA,GAEhD,CAAA;AAEJ;AAEA,YAAA,CAAa,KAAQ,GAAA,KAAA;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -299,6 +299,17 @@ interface EntityLayoutProps {
|
|
|
299
299
|
UNSTABLE_contextMenuOptions?: EntityContextMenuOptions;
|
|
300
300
|
children?: React__default.ReactNode;
|
|
301
301
|
NotFoundComponent?: React__default.ReactNode;
|
|
302
|
+
/**
|
|
303
|
+
* An array of relation types used to determine the parent entities in the hierarchy.
|
|
304
|
+
* These relations are prioritized in the order provided, allowing for flexible
|
|
305
|
+
* navigation through entity relationships.
|
|
306
|
+
*
|
|
307
|
+
* For example, use relation types like `["partOf", "memberOf", "ownedBy"]` to define how the entity is related to
|
|
308
|
+
* its parents in the Entity Catalog.
|
|
309
|
+
*
|
|
310
|
+
* It adds breadcrumbs in the Entity page to enhance user navigation and context awareness.
|
|
311
|
+
*/
|
|
312
|
+
parentEntityRelations?: string[];
|
|
302
313
|
}
|
|
303
314
|
/**
|
|
304
315
|
* EntityLayout is a compound component, which allows you to define a layout for
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-catalog",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.25.0-next.3",
|
|
4
4
|
"description": "The Backstage plugin for browsing the Backstage catalog",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "frontend-plugin",
|
|
@@ -43,10 +43,19 @@
|
|
|
43
43
|
},
|
|
44
44
|
"main": "./dist/index.esm.js",
|
|
45
45
|
"types": "./dist/index.d.ts",
|
|
46
|
+
"typesVersions": {
|
|
47
|
+
"*": {
|
|
48
|
+
"index": [
|
|
49
|
+
"dist/index.d.ts"
|
|
50
|
+
],
|
|
51
|
+
"alpha": [
|
|
52
|
+
"dist/alpha.d.ts"
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
},
|
|
46
56
|
"files": [
|
|
47
57
|
"dist",
|
|
48
|
-
"config.d.ts"
|
|
49
|
-
"alpha"
|
|
58
|
+
"config.d.ts"
|
|
50
59
|
],
|
|
51
60
|
"scripts": {
|
|
52
61
|
"build": "backstage-cli package build",
|
|
@@ -60,18 +69,18 @@
|
|
|
60
69
|
"dependencies": {
|
|
61
70
|
"@backstage/catalog-client": "1.8.0-next.1",
|
|
62
71
|
"@backstage/catalog-model": "1.7.0",
|
|
63
|
-
"@backstage/core-compat-api": "0.3.2-next.
|
|
64
|
-
"@backstage/core-components": "0.16.0-next.
|
|
72
|
+
"@backstage/core-compat-api": "0.3.2-next.2",
|
|
73
|
+
"@backstage/core-components": "0.16.0-next.2",
|
|
65
74
|
"@backstage/core-plugin-api": "1.10.0",
|
|
66
75
|
"@backstage/errors": "1.2.4",
|
|
67
|
-
"@backstage/frontend-plugin-api": "0.9.1-next.
|
|
76
|
+
"@backstage/frontend-plugin-api": "0.9.1-next.2",
|
|
68
77
|
"@backstage/integration-react": "1.2.0",
|
|
69
78
|
"@backstage/plugin-catalog-common": "1.1.0",
|
|
70
|
-
"@backstage/plugin-catalog-react": "1.14.1-next.
|
|
79
|
+
"@backstage/plugin-catalog-react": "1.14.1-next.3",
|
|
71
80
|
"@backstage/plugin-permission-react": "0.4.27",
|
|
72
|
-
"@backstage/plugin-scaffolder-common": "1.5.
|
|
81
|
+
"@backstage/plugin-scaffolder-common": "1.5.7-next.0",
|
|
73
82
|
"@backstage/plugin-search-common": "1.2.14",
|
|
74
|
-
"@backstage/plugin-search-react": "1.8.2-next.
|
|
83
|
+
"@backstage/plugin-search-react": "1.8.2-next.2",
|
|
75
84
|
"@backstage/types": "1.1.1",
|
|
76
85
|
"@material-ui/core": "^4.12.2",
|
|
77
86
|
"@material-ui/icons": "^4.9.1",
|
|
@@ -86,10 +95,10 @@
|
|
|
86
95
|
"zen-observable": "^0.10.0"
|
|
87
96
|
},
|
|
88
97
|
"devDependencies": {
|
|
89
|
-
"@backstage/cli": "0.29.0-next.
|
|
98
|
+
"@backstage/cli": "0.29.0-next.3",
|
|
90
99
|
"@backstage/core-app-api": "1.15.1",
|
|
91
|
-
"@backstage/dev-utils": "1.1.3-next.
|
|
92
|
-
"@backstage/frontend-test-utils": "0.2.2-next.
|
|
100
|
+
"@backstage/dev-utils": "1.1.3-next.3",
|
|
101
|
+
"@backstage/frontend-test-utils": "0.2.2-next.2",
|
|
93
102
|
"@backstage/plugin-permission-common": "0.8.1",
|
|
94
103
|
"@backstage/test-utils": "1.7.1-next.0",
|
|
95
104
|
"@testing-library/dom": "^10.0.0",
|