@backstage/plugin-catalog 1.24.1-next.2 → 1.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +59 -0
- package/dist/alpha/apis.esm.js +1 -1
- package/dist/alpha/entityContents.esm.js +1 -1
- package/dist/alpha/pages.esm.js +3 -3
- package/dist/alpha/plugin.esm.js +1 -1
- package/dist/components/AboutCard/AboutCard.esm.js +1 -1
- package/dist/components/AboutCard/AboutContent.esm.js +1 -0
- package/dist/components/AboutCard/AboutContent.esm.js.map +1 -1
- package/dist/components/AboutCard/AboutField.esm.js +2 -2
- package/dist/components/AboutCard/AboutField.esm.js.map +1 -1
- package/dist/components/CatalogTable/CatalogTable.esm.js +1 -1
- 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 +9 -7
- package/dist/components/CatalogTable/OffsetPaginatedCatalogTable.esm.js.map +1 -1
- package/dist/components/CatalogTable/columns.esm.js +1 -1
- package/dist/components/DependencyOfComponentsCard/DependencyOfComponentsCard.esm.js +1 -1
- package/dist/components/DependsOnComponentsCard/DependsOnComponentsCard.esm.js +1 -1
- package/dist/components/DependsOnResourcesCard/DependsOnResourcesCard.esm.js +1 -1
- package/dist/components/EntityLayout/EntityLayout.esm.js +64 -8
- package/dist/components/EntityLayout/EntityLayout.esm.js.map +1 -1
- package/dist/components/HasComponentsCard/HasComponentsCard.esm.js +1 -1
- package/dist/components/HasResourcesCard/HasResourcesCard.esm.js +1 -1
- package/dist/components/HasSubdomainsCard/HasSubdomainsCard.esm.js +1 -1
- package/dist/components/HasSystemsCard/HasSystemsCard.esm.js +1 -1
- package/dist/index.d.ts +13 -1
- package/dist/plugin.esm.js +3 -3
- package/package.json +33 -24
- package/alpha/package.json +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,64 @@
|
|
|
1
1
|
# @backstage/plugin-catalog
|
|
2
2
|
|
|
3
|
+
## 1.25.0
|
|
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
|
+
- 2a67594: Fixed an issue causing the `CatalogIndexPage` to not properly filter results when using offset pagination.
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
- @backstage/catalog-client@1.8.0
|
|
18
|
+
- @backstage/types@1.2.0
|
|
19
|
+
- @backstage/plugin-catalog-react@1.14.1
|
|
20
|
+
- @backstage/plugin-scaffolder-common@1.5.7
|
|
21
|
+
- @backstage/core-components@0.16.0
|
|
22
|
+
- @backstage/catalog-model@1.7.1
|
|
23
|
+
- @backstage/core-compat-api@0.3.2
|
|
24
|
+
- @backstage/core-plugin-api@1.10.1
|
|
25
|
+
- @backstage/errors@1.2.5
|
|
26
|
+
- @backstage/frontend-plugin-api@0.9.1
|
|
27
|
+
- @backstage/integration-react@1.2.1
|
|
28
|
+
- @backstage/plugin-catalog-common@1.1.1
|
|
29
|
+
- @backstage/plugin-permission-react@0.4.28
|
|
30
|
+
- @backstage/plugin-search-common@1.2.15
|
|
31
|
+
- @backstage/plugin-search-react@1.8.2
|
|
32
|
+
|
|
33
|
+
## 1.25.0-next.3
|
|
34
|
+
|
|
35
|
+
### Minor Changes
|
|
36
|
+
|
|
37
|
+
- 50df3c8: - Updated EntityLayout component to implement breadcrumb navigation based on the entity relations.
|
|
38
|
+
|
|
39
|
+
- Added parentEntityRelations prop to EntityLayoutProps to specify relation types for parent entities.
|
|
40
|
+
|
|
41
|
+
- 79e9631: Allow `OffsetPaginatedCatalogTable` to configure Table options and `CursorPaginatedCatalogTable` to configure `paginationPosition`.
|
|
42
|
+
|
|
43
|
+
### Patch Changes
|
|
44
|
+
|
|
45
|
+
- Updated dependencies
|
|
46
|
+
- @backstage/plugin-scaffolder-common@1.5.7-next.0
|
|
47
|
+
- @backstage/core-components@0.16.0-next.2
|
|
48
|
+
- @backstage/plugin-catalog-react@1.14.1-next.3
|
|
49
|
+
- @backstage/core-compat-api@0.3.2-next.2
|
|
50
|
+
- @backstage/catalog-client@1.8.0-next.1
|
|
51
|
+
- @backstage/catalog-model@1.7.0
|
|
52
|
+
- @backstage/core-plugin-api@1.10.0
|
|
53
|
+
- @backstage/errors@1.2.4
|
|
54
|
+
- @backstage/frontend-plugin-api@0.9.1-next.2
|
|
55
|
+
- @backstage/integration-react@1.2.0
|
|
56
|
+
- @backstage/types@1.1.1
|
|
57
|
+
- @backstage/plugin-catalog-common@1.1.0
|
|
58
|
+
- @backstage/plugin-permission-react@0.4.27
|
|
59
|
+
- @backstage/plugin-search-common@1.2.14
|
|
60
|
+
- @backstage/plugin-search-react@1.8.2-next.2
|
|
61
|
+
|
|
3
62
|
## 1.24.1-next.2
|
|
4
63
|
|
|
5
64
|
### Patch Changes
|
package/dist/alpha/apis.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createApiFactory,
|
|
1
|
+
import { createApiFactory, fetchApiRef, discoveryApiRef, storageApiRef } from '@backstage/core-plugin-api';
|
|
2
2
|
import { CatalogClient } from '@backstage/catalog-client';
|
|
3
3
|
import { ApiBlueprint } from '@backstage/frontend-plugin-api';
|
|
4
4
|
import { catalogApiRef, starredEntitiesApiRef, entityPresentationApiRef } from '@backstage/plugin-catalog-react';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { coreExtensionData, createExtensionInput } from '@backstage/frontend-plugin-api';
|
|
3
3
|
import { EntityContentBlueprint } from '@backstage/plugin-catalog-react/alpha';
|
|
4
4
|
|
|
5
5
|
const catalogOverviewEntityContent = EntityContentBlueprint.makeWithOverrides({
|
package/dist/alpha/pages.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { PageBlueprint,
|
|
4
|
-
import {
|
|
2
|
+
import { compatWrapper, convertLegacyRouteRef } from '@backstage/core-compat-api';
|
|
3
|
+
import { PageBlueprint, coreExtensionData, createExtensionInput } from '@backstage/frontend-plugin-api';
|
|
4
|
+
import { AsyncEntityProvider, entityRouteRef } from '@backstage/plugin-catalog-react';
|
|
5
5
|
import { EntityContentBlueprint } from '@backstage/plugin-catalog-react/alpha';
|
|
6
6
|
import { rootRouteRef } from '../routes.esm.js';
|
|
7
7
|
import { useEntityFromUrl } from '../components/CatalogEntityPage/useEntityFromUrl.esm.js';
|
package/dist/alpha/plugin.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { convertLegacyRouteRefs } from '@backstage/core-compat-api';
|
|
2
2
|
import { createFrontendPlugin } from '@backstage/frontend-plugin-api';
|
|
3
3
|
import { entityRouteRef } from '@backstage/plugin-catalog-react';
|
|
4
|
-
import {
|
|
4
|
+
import { unregisterRedirectRouteRef, createFromTemplateRouteRef, createComponentRouteRef, viewTechDocRouteRef, rootRouteRef } from '../routes.esm.js';
|
|
5
5
|
import apis from './apis.esm.js';
|
|
6
6
|
import pages from './pages.esm.js';
|
|
7
7
|
import filters from './filters.esm.js';
|
|
@@ -5,7 +5,7 @@ import CardHeader from '@material-ui/core/CardHeader';
|
|
|
5
5
|
import Divider from '@material-ui/core/Divider';
|
|
6
6
|
import IconButton from '@material-ui/core/IconButton';
|
|
7
7
|
import { makeStyles } from '@material-ui/core/styles';
|
|
8
|
-
import { Link, AppIcon
|
|
8
|
+
import { HeaderIconLinkRow, Link, AppIcon } from '@backstage/core-components';
|
|
9
9
|
import React, { useCallback } from 'react';
|
|
10
10
|
import { scmIntegrationsApiRef, ScmIntegrationIcon } from '@backstage/integration-react';
|
|
11
11
|
import { useApp, useApi, alertApiRef, errorApiRef, useRouteRef } from '@backstage/core-plugin-api';
|
|
@@ -74,6 +74,7 @@ function AboutContent(props) {
|
|
|
74
74
|
{
|
|
75
75
|
label: t("aboutCard.ownerField.label"),
|
|
76
76
|
value: t("aboutCard.ownerField.value"),
|
|
77
|
+
className: classes.description,
|
|
77
78
|
gridSizes: { xs: 12, sm: 6, lg: 4 }
|
|
78
79
|
},
|
|
79
80
|
ownedByRelations.length > 0 && /* @__PURE__ */ React.createElement(EntityRefLinks, { entityRefs: ownedByRelations, defaultKind: "group" })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AboutContent.esm.js","sources":["../../../src/components/AboutCard/AboutContent.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 getEntitySourceLocation,\n RELATION_OWNED_BY,\n RELATION_PART_OF,\n} from '@backstage/catalog-model';\nimport {\n EntityRefLinks,\n getEntityRelations,\n} from '@backstage/plugin-catalog-react';\nimport { JsonArray } from '@backstage/types';\nimport Chip from '@material-ui/core/Chip';\nimport Grid from '@material-ui/core/Grid';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { MarkdownContent } from '@backstage/core-components';\nimport React from 'react';\nimport { AboutField } from './AboutField';\nimport { LinksGridList } from '../EntityLinksCard/LinksGridList';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { catalogTranslationRef } from '../../alpha/translation';\n\nconst useStyles = makeStyles({\n description: {\n wordBreak: 'break-word',\n },\n});\n\n/**\n * Props for {@link AboutContent}.\n *\n * @public\n */\nexport interface AboutContentProps {\n entity: Entity;\n}\n\nfunction getLocationTargetHref(\n target: string,\n type: string,\n entitySourceLocation: {\n type: string;\n target: string;\n },\n): string {\n if (type === 'url' || target.includes('://')) {\n return target;\n }\n\n const srcLocationUrl =\n entitySourceLocation.type === 'file'\n ? `file://${entitySourceLocation.target}`\n : entitySourceLocation.target;\n\n if (type === 'file' || entitySourceLocation.type === 'file') {\n return new URL(target, srcLocationUrl).href;\n }\n\n return srcLocationUrl;\n}\n\n/** @public */\nexport function AboutContent(props: AboutContentProps) {\n const { entity } = props;\n const classes = useStyles();\n const { t } = useTranslationRef(catalogTranslationRef);\n\n const isSystem = entity.kind.toLocaleLowerCase('en-US') === 'system';\n const isResource = entity.kind.toLocaleLowerCase('en-US') === 'resource';\n const isComponent = entity.kind.toLocaleLowerCase('en-US') === 'component';\n const isAPI = entity.kind.toLocaleLowerCase('en-US') === 'api';\n const isTemplate = entity.kind.toLocaleLowerCase('en-US') === 'template';\n const isLocation = entity.kind.toLocaleLowerCase('en-US') === 'location';\n const isGroup = entity.kind.toLocaleLowerCase('en-US') === 'group';\n\n const partOfSystemRelations = getEntityRelations(entity, RELATION_PART_OF, {\n kind: 'system',\n });\n const partOfComponentRelations = getEntityRelations(\n entity,\n RELATION_PART_OF,\n {\n kind: 'component',\n },\n );\n const partOfDomainRelations = getEntityRelations(entity, RELATION_PART_OF, {\n kind: 'domain',\n });\n const ownedByRelations = getEntityRelations(entity, RELATION_OWNED_BY);\n\n let entitySourceLocation:\n | {\n type: string;\n target: string;\n }\n | undefined;\n try {\n entitySourceLocation = getEntitySourceLocation(entity);\n } catch (e) {\n entitySourceLocation = undefined;\n }\n\n return (\n <Grid container>\n <AboutField\n label={t('aboutCard.descriptionField.label')}\n gridSizes={{ xs: 12 }}\n >\n <MarkdownContent\n className={classes.description}\n content={\n entity?.metadata?.description ||\n t('aboutCard.descriptionField.value')\n }\n />\n </AboutField>\n <AboutField\n label={t('aboutCard.ownerField.label')}\n value={t('aboutCard.ownerField.value')}\n gridSizes={{ xs: 12, sm: 6, lg: 4 }}\n >\n {ownedByRelations.length > 0 && (\n <EntityRefLinks entityRefs={ownedByRelations} defaultKind=\"group\" />\n )}\n </AboutField>\n {(isSystem || partOfDomainRelations.length > 0) && (\n <AboutField\n label={t('aboutCard.domainField.label')}\n value={t('aboutCard.domainField.value')}\n gridSizes={{ xs: 12, sm: 6, lg: 4 }}\n >\n {partOfDomainRelations.length > 0 && (\n <EntityRefLinks\n entityRefs={partOfDomainRelations}\n defaultKind=\"domain\"\n />\n )}\n </AboutField>\n )}\n {(isAPI ||\n isComponent ||\n isResource ||\n partOfSystemRelations.length > 0) && (\n <AboutField\n label={t('aboutCard.systemField.label')}\n value={t('aboutCard.systemField.value')}\n gridSizes={{ xs: 12, sm: 6, lg: 4 }}\n >\n {partOfSystemRelations.length > 0 && (\n <EntityRefLinks\n entityRefs={partOfSystemRelations}\n defaultKind=\"system\"\n />\n )}\n </AboutField>\n )}\n {isComponent && partOfComponentRelations.length > 0 && (\n <AboutField\n label={t('aboutCard.parentComponentField.label')}\n value={t('aboutCard.parentComponentField.value')}\n gridSizes={{ xs: 12, sm: 6, lg: 4 }}\n >\n <EntityRefLinks\n entityRefs={partOfComponentRelations}\n defaultKind=\"component\"\n />\n </AboutField>\n )}\n {(isAPI ||\n isComponent ||\n isResource ||\n isTemplate ||\n isGroup ||\n isLocation ||\n typeof entity?.spec?.type === 'string') && (\n <AboutField\n label={t('aboutCard.typeField.label')}\n value={entity?.spec?.type as string}\n gridSizes={{ xs: 12, sm: 6, lg: 4 }}\n />\n )}\n {(isAPI ||\n isComponent ||\n typeof entity?.spec?.lifecycle === 'string') && (\n <AboutField\n label={t('aboutCard.lifecycleField.label')}\n value={entity?.spec?.lifecycle as string}\n gridSizes={{ xs: 12, sm: 6, lg: 4 }}\n />\n )}\n <AboutField\n label={t('aboutCard.tagsField.label')}\n value={t('aboutCard.tagsField.value')}\n gridSizes={{ xs: 12, sm: 6, lg: 4 }}\n >\n {(entity?.metadata?.tags || []).map(tag => (\n <Chip key={tag} size=\"small\" label={tag} />\n ))}\n </AboutField>\n {isLocation && (entity?.spec?.targets || entity?.spec?.target) && (\n <AboutField\n label={t('aboutCard.targetsField.label')}\n gridSizes={{ xs: 12 }}\n >\n <LinksGridList\n cols={1}\n items={((entity.spec.targets as JsonArray) || [entity.spec.target])\n .map(target => target as string)\n .map(target => ({\n text: target,\n href: getLocationTargetHref(\n target,\n (entity?.spec?.type || 'unknown') as string,\n entitySourceLocation!,\n ),\n }))}\n />\n </AboutField>\n )}\n </Grid>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAqCA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,WAAa,EAAA;AAAA,IACX,SAAW,EAAA;AAAA;AAEf,CAAC,CAAA;AAWD,SAAS,qBAAA,CACP,MACA,EAAA,IAAA,EACA,oBAIQ,EAAA;AACR,EAAA,IAAI,IAAS,KAAA,KAAA,IAAS,MAAO,CAAA,QAAA,CAAS,KAAK,CAAG,EAAA;AAC5C,IAAO,OAAA,MAAA;AAAA;AAGT,EAAM,MAAA,cAAA,GACJ,qBAAqB,IAAS,KAAA,MAAA,GAC1B,UAAU,oBAAqB,CAAA,MAAM,KACrC,oBAAqB,CAAA,MAAA;AAE3B,EAAA,IAAI,IAAS,KAAA,MAAA,IAAU,oBAAqB,CAAA,IAAA,KAAS,MAAQ,EAAA;AAC3D,IAAA,OAAO,IAAI,GAAA,CAAI,MAAQ,EAAA,cAAc,CAAE,CAAA,IAAA;AAAA;AAGzC,EAAO,OAAA,cAAA;AACT;AAGO,SAAS,aAAa,KAA0B,EAAA;AACrD,EAAM,MAAA,EAAE,QAAW,GAAA,KAAA;AACnB,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA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A,MAAA,CAAO,IAAK,CAAA,OAAA,IAAyB,CAAC,MAAO,CAAA,IAAA,CAAK,MAAM,CAAA,EAC9D,GAAI,CAAA,CAAA,MAAA,KAAU,MAAgB,CAAA,CAC9B,IAAI,CAAW,MAAA,MAAA;AAAA,UACd,IAAM,EAAA,MAAA;AAAA,UACN,IAAM,EAAA,qBAAA;AAAA,YACJ,MAAA;AAAA,YACC,MAAA,EAAQ,MAAM,IAAQ,IAAA,SAAA;AAAA,YACvB;AAAA;AACF,SACA,CAAA;AAAA;AAAA;AACN,GAGN,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"AboutContent.esm.js","sources":["../../../src/components/AboutCard/AboutContent.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 getEntitySourceLocation,\n RELATION_OWNED_BY,\n RELATION_PART_OF,\n} from '@backstage/catalog-model';\nimport {\n EntityRefLinks,\n getEntityRelations,\n} from '@backstage/plugin-catalog-react';\nimport { JsonArray } from '@backstage/types';\nimport Chip from '@material-ui/core/Chip';\nimport Grid from '@material-ui/core/Grid';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { MarkdownContent } from '@backstage/core-components';\nimport React from 'react';\nimport { AboutField } from './AboutField';\nimport { LinksGridList } from '../EntityLinksCard/LinksGridList';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { catalogTranslationRef } from '../../alpha/translation';\n\nconst useStyles = makeStyles({\n description: {\n wordBreak: 'break-word',\n },\n});\n\n/**\n * Props for {@link AboutContent}.\n *\n * @public\n */\nexport interface AboutContentProps {\n entity: Entity;\n}\n\nfunction getLocationTargetHref(\n target: string,\n type: string,\n entitySourceLocation: {\n type: string;\n target: string;\n },\n): string {\n if (type === 'url' || target.includes('://')) {\n return target;\n }\n\n const srcLocationUrl =\n entitySourceLocation.type === 'file'\n ? `file://${entitySourceLocation.target}`\n : entitySourceLocation.target;\n\n if (type === 'file' || entitySourceLocation.type === 'file') {\n return new URL(target, srcLocationUrl).href;\n }\n\n return srcLocationUrl;\n}\n\n/** @public */\nexport function AboutContent(props: AboutContentProps) {\n const { entity } = props;\n const classes = useStyles();\n const { t } = useTranslationRef(catalogTranslationRef);\n\n const isSystem = entity.kind.toLocaleLowerCase('en-US') === 'system';\n const isResource = entity.kind.toLocaleLowerCase('en-US') === 'resource';\n const isComponent = entity.kind.toLocaleLowerCase('en-US') === 'component';\n const isAPI = entity.kind.toLocaleLowerCase('en-US') === 'api';\n const isTemplate = entity.kind.toLocaleLowerCase('en-US') === 'template';\n const isLocation = entity.kind.toLocaleLowerCase('en-US') === 'location';\n const isGroup = entity.kind.toLocaleLowerCase('en-US') === 'group';\n\n const partOfSystemRelations = getEntityRelations(entity, RELATION_PART_OF, {\n kind: 'system',\n });\n const partOfComponentRelations = getEntityRelations(\n entity,\n RELATION_PART_OF,\n {\n kind: 'component',\n },\n );\n const partOfDomainRelations = getEntityRelations(entity, RELATION_PART_OF, {\n kind: 'domain',\n });\n const ownedByRelations = getEntityRelations(entity, RELATION_OWNED_BY);\n\n let entitySourceLocation:\n | {\n type: string;\n target: string;\n }\n | undefined;\n try {\n entitySourceLocation = getEntitySourceLocation(entity);\n } catch (e) {\n entitySourceLocation = undefined;\n }\n\n return (\n <Grid container>\n <AboutField\n label={t('aboutCard.descriptionField.label')}\n gridSizes={{ xs: 12 }}\n >\n <MarkdownContent\n className={classes.description}\n content={\n entity?.metadata?.description ||\n t('aboutCard.descriptionField.value')\n }\n />\n </AboutField>\n <AboutField\n label={t('aboutCard.ownerField.label')}\n value={t('aboutCard.ownerField.value')}\n className={classes.description}\n gridSizes={{ xs: 12, sm: 6, lg: 4 }}\n >\n {ownedByRelations.length > 0 && (\n <EntityRefLinks entityRefs={ownedByRelations} defaultKind=\"group\" />\n )}\n </AboutField>\n {(isSystem || partOfDomainRelations.length > 0) && (\n <AboutField\n label={t('aboutCard.domainField.label')}\n value={t('aboutCard.domainField.value')}\n gridSizes={{ xs: 12, sm: 6, lg: 4 }}\n >\n {partOfDomainRelations.length > 0 && (\n <EntityRefLinks\n entityRefs={partOfDomainRelations}\n defaultKind=\"domain\"\n />\n )}\n </AboutField>\n )}\n {(isAPI ||\n isComponent ||\n isResource ||\n partOfSystemRelations.length > 0) && (\n <AboutField\n label={t('aboutCard.systemField.label')}\n value={t('aboutCard.systemField.value')}\n gridSizes={{ xs: 12, sm: 6, lg: 4 }}\n >\n {partOfSystemRelations.length > 0 && (\n <EntityRefLinks\n entityRefs={partOfSystemRelations}\n defaultKind=\"system\"\n />\n )}\n </AboutField>\n )}\n {isComponent && partOfComponentRelations.length > 0 && (\n <AboutField\n label={t('aboutCard.parentComponentField.label')}\n value={t('aboutCard.parentComponentField.value')}\n gridSizes={{ xs: 12, sm: 6, lg: 4 }}\n >\n <EntityRefLinks\n entityRefs={partOfComponentRelations}\n defaultKind=\"component\"\n />\n </AboutField>\n )}\n {(isAPI ||\n isComponent ||\n isResource ||\n isTemplate ||\n isGroup ||\n isLocation ||\n typeof entity?.spec?.type === 'string') && (\n <AboutField\n label={t('aboutCard.typeField.label')}\n value={entity?.spec?.type as string}\n gridSizes={{ xs: 12, sm: 6, lg: 4 }}\n />\n )}\n {(isAPI ||\n isComponent ||\n typeof entity?.spec?.lifecycle === 'string') && (\n <AboutField\n label={t('aboutCard.lifecycleField.label')}\n value={entity?.spec?.lifecycle as string}\n gridSizes={{ xs: 12, sm: 6, lg: 4 }}\n />\n )}\n <AboutField\n label={t('aboutCard.tagsField.label')}\n value={t('aboutCard.tagsField.value')}\n gridSizes={{ xs: 12, sm: 6, lg: 4 }}\n >\n {(entity?.metadata?.tags || []).map(tag => (\n <Chip key={tag} size=\"small\" label={tag} />\n ))}\n </AboutField>\n {isLocation && (entity?.spec?.targets || entity?.spec?.target) && (\n <AboutField\n label={t('aboutCard.targetsField.label')}\n gridSizes={{ xs: 12 }}\n >\n <LinksGridList\n cols={1}\n items={((entity.spec.targets as JsonArray) || [entity.spec.target])\n .map(target => target as string)\n .map(target => ({\n text: target,\n href: getLocationTargetHref(\n target,\n (entity?.spec?.type || 'unknown') as string,\n entitySourceLocation!,\n ),\n }))}\n />\n </AboutField>\n )}\n </Grid>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAqCA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,WAAa,EAAA;AAAA,IACX,SAAW,EAAA;AAAA;AAEf,CAAC,CAAA;AAWD,SAAS,qBAAA,CACP,MACA,EAAA,IAAA,EACA,oBAIQ,EAAA;AACR,EAAA,IAAI,IAAS,KAAA,KAAA,IAAS,MAAO,CAAA,QAAA,CAAS,KAAK,CAAG,EAAA;AAC5C,IAAO,OAAA,MAAA;AAAA;AAGT,EAAM,MAAA,cAAA,GACJ,qBAAqB,IAAS,KAAA,MAAA,GAC1B,UAAU,oBAAqB,CAAA,MAAM,KACrC,oBAAqB,CAAA,MAAA;AAE3B,EAAA,IAAI,IAAS,KAAA,MAAA,IAAU,oBAAqB,CAAA,IAAA,KAAS,MAAQ,EAAA;AAC3D,IAAA,OAAO,IAAI,GAAA,CAAI,MAAQ,EAAA,cAAc,CAAE,CAAA,IAAA;AAAA;AAGzC,EAAO,OAAA,cAAA;AACT;AAGO,SAAS,aAAa,KAA0B,EAAA;AACrD,EAAM,MAAA,EAAE,QAAW,GAAA,KAAA;AACnB,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,qBAAqB,CAAA;AAErD,EAAA,MAAM,QAAW,GAAA,MAAA,CAAO,IAAK,CAAA,i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AO,CAAA,IAAA,CAAK,MAAM,CAAA,EAC9D,GAAI,CAAA,CAAA,MAAA,KAAU,MAAgB,CAAA,CAC9B,IAAI,CAAW,MAAA,MAAA;AAAA,UACd,IAAM,EAAA,MAAA;AAAA,UACN,IAAM,EAAA,qBAAA;AAAA,YACJ,MAAA;AAAA,YACC,MAAA,EAAQ,MAAM,IAAQ,IAAA,SAAA;AAAA,YACvB;AAAA;AACF,SACA,CAAA;AAAA;AAAA;AACN,GAGN,CAAA;AAEJ;;;;"}
|
|
@@ -22,11 +22,11 @@ const useStyles = makeStyles((theme) => ({
|
|
|
22
22
|
}
|
|
23
23
|
}));
|
|
24
24
|
function AboutField(props) {
|
|
25
|
-
const { label, value, gridSizes, children } = props;
|
|
25
|
+
const { label, value, gridSizes, children, className } = props;
|
|
26
26
|
const classes = useStyles();
|
|
27
27
|
const childElements = useElementFilter(children, (c) => c.getElements());
|
|
28
28
|
const content = childElements.length > 0 ? childElements : /* @__PURE__ */ React.createElement(Typography, { variant: "body2", className: classes.value }, value || `unknown`);
|
|
29
|
-
return /* @__PURE__ */ React.createElement(Grid, { item: true, ...gridSizes }, /* @__PURE__ */ React.createElement(Typography, { variant: "h2", className: classes.label }, label), content);
|
|
29
|
+
return /* @__PURE__ */ React.createElement(Grid, { item: true, ...gridSizes, className }, /* @__PURE__ */ React.createElement(Typography, { variant: "h2", className: classes.label }, label), content);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export { AboutField };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AboutField.esm.js","sources":["../../../src/components/AboutCard/AboutField.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 { useElementFilter } from '@backstage/core-plugin-api';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport React from 'react';\n\nconst useStyles = makeStyles(theme => ({\n value: {\n fontWeight: 'bold',\n overflow: 'hidden',\n lineHeight: '24px',\n wordBreak: 'break-word',\n },\n label: {\n color: theme.palette.text.secondary,\n textTransform: 'uppercase',\n fontSize: '10px',\n fontWeight: 'bold',\n letterSpacing: 0.5,\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n },\n}));\n\n/**\n * Props for {@link AboutField}.\n *\n * @public\n */\nexport interface AboutFieldProps {\n label: string;\n value?: string;\n gridSizes?: Record<string, number>;\n children?: React.ReactNode;\n}\n\n/** @public */\nexport function AboutField(props: AboutFieldProps) {\n const { label, value, gridSizes, children } = props;\n const classes = useStyles();\n\n const childElements = useElementFilter(children, c => c.getElements());\n\n // Content is either children or a string prop `value`\n const content =\n childElements.length > 0 ? (\n childElements\n ) : (\n <Typography variant=\"body2\" className={classes.value}>\n {value || `unknown`}\n </Typography>\n );\n return (\n <Grid item {...gridSizes}>\n <Typography variant=\"h2\" className={classes.label}>\n {label}\n </Typography>\n {content}\n </Grid>\n );\n}\n"],"names":[],"mappings":";;;;;;AAsBA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,KAAO,EAAA;AAAA,IACL,UAAY,EAAA,MAAA;AAAA,IACZ,QAAU,EAAA,QAAA;AAAA,IACV,UAAY,EAAA,MAAA;AAAA,IACZ,SAAW,EAAA;AAAA,GACb;AAAA,EACA,KAAO,EAAA;AAAA,IACL,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA,SAAA;AAAA,IAC1B,aAAe,EAAA,WAAA;AAAA,IACf,QAAU,EAAA,MAAA;AAAA,IACV,UAAY,EAAA,MAAA;AAAA,IACZ,aAAe,EAAA,GAAA;AAAA,IACf,QAAU,EAAA,QAAA;AAAA,IACV,UAAY,EAAA;AAAA;AAEhB,CAAE,CAAA,CAAA;
|
|
1
|
+
{"version":3,"file":"AboutField.esm.js","sources":["../../../src/components/AboutCard/AboutField.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 { useElementFilter } from '@backstage/core-plugin-api';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport React from 'react';\n\nconst useStyles = makeStyles(theme => ({\n value: {\n fontWeight: 'bold',\n overflow: 'hidden',\n lineHeight: '24px',\n wordBreak: 'break-word',\n },\n label: {\n color: theme.palette.text.secondary,\n textTransform: 'uppercase',\n fontSize: '10px',\n fontWeight: 'bold',\n letterSpacing: 0.5,\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n },\n}));\n\n/**\n * Props for {@link AboutField}.\n *\n * @public\n */\nexport interface AboutFieldProps {\n label: string;\n value?: string;\n gridSizes?: Record<string, number>;\n children?: React.ReactNode;\n className?: string;\n}\n\n/** @public */\nexport function AboutField(props: AboutFieldProps) {\n const { label, value, gridSizes, children, className } = props;\n const classes = useStyles();\n\n const childElements = useElementFilter(children, c => c.getElements());\n\n // Content is either children or a string prop `value`\n const content =\n childElements.length > 0 ? (\n childElements\n ) : (\n <Typography variant=\"body2\" className={classes.value}>\n {value || `unknown`}\n </Typography>\n );\n return (\n <Grid item {...gridSizes} className={className}>\n <Typography variant=\"h2\" className={classes.label}>\n {label}\n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AA;AAEJ;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RELATION_PART_OF, RELATION_OWNED_BY, stringifyEntityRef, ANNOTATION_VIEW_URL, ANNOTATION_EDIT_URL } from '@backstage/catalog-model';
|
|
2
|
-
import { WarningPanel, CodeSnippet,
|
|
2
|
+
import { WarningPanel, CodeSnippet, FavoriteToggleIcon, Table } from '@backstage/core-components';
|
|
3
3
|
import { useStarredEntities, useEntityList, getEntityRelations, humanizeEntityRef } from '@backstage/plugin-catalog-react';
|
|
4
4
|
import Typography from '@material-ui/core/Typography';
|
|
5
5
|
import { visuallyHidden } from '@mui/utils';
|
|
@@ -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;;;;"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
2
|
import { Table } from '@backstage/core-components';
|
|
3
|
-
import { useEntityList
|
|
3
|
+
import { useEntityList } from '@backstage/plugin-catalog-react';
|
|
4
|
+
import { CatalogTableToolbar } from './CatalogTableToolbar.esm.js';
|
|
4
5
|
|
|
5
6
|
function OffsetPaginatedCatalogTable(props) {
|
|
6
|
-
const { columns, data, isLoading } = props;
|
|
7
|
-
const {
|
|
7
|
+
const { columns, data, isLoading, options } = props;
|
|
8
|
+
const { setLimit, setOffset, limit, totalItems, offset } = useEntityList();
|
|
8
9
|
const [page, setPage] = React.useState(
|
|
9
10
|
offset && limit ? Math.floor(offset / limit) : 0
|
|
10
11
|
);
|
|
@@ -24,11 +25,12 @@ function OffsetPaginatedCatalogTable(props) {
|
|
|
24
25
|
paginationPosition: "both",
|
|
25
26
|
pageSizeOptions: [5, 10, 20, 50, 100],
|
|
26
27
|
pageSize: limit,
|
|
27
|
-
emptyRowsWhenPaging: false
|
|
28
|
+
emptyRowsWhenPaging: false,
|
|
29
|
+
...options
|
|
30
|
+
},
|
|
31
|
+
components: {
|
|
32
|
+
Toolbar: CatalogTableToolbar
|
|
28
33
|
},
|
|
29
|
-
onSearchChange: (searchText) => updateFilters({
|
|
30
|
-
text: searchText ? new EntityTextFilter(searchText) : void 0
|
|
31
|
-
}),
|
|
32
34
|
page,
|
|
33
35
|
onPageChange: (newPage) => {
|
|
34
36
|
setPage(newPage);
|
|
@@ -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 {
|
|
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 { useEntityList } from '@backstage/plugin-catalog-react';\nimport { CatalogTableToolbar } from './CatalogTableToolbar';\n\n/**\n * @internal\n */\nexport function OffsetPaginatedCatalogTable(\n props: TableProps<CatalogTableRow>,\n) {\n const { columns, data, isLoading, options } = props;\n const { setLimit, setOffset, limit, totalItems, offset } = useEntityList();\n\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 components={{\n Toolbar: CatalogTableToolbar,\n }}\n page={page}\n onPageChange={newPage => {\n setPage(newPage);\n }}\n onRowsPerPageChange={pageSize => {\n setLimit(pageSize);\n }}\n totalCount={totalItems}\n localization={{ pagination: { labelD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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,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { EntityRefLinks, EntityRefLink, humanizeEntityRef } from '@backstage/plugin-catalog-react';
|
|
3
3
|
import Chip from '@material-ui/core/Chip';
|
|
4
4
|
import { OverflowTooltip } from '@backstage/core-components';
|
|
5
5
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RELATION_DEPENDENCY_OF } from '@backstage/catalog-model';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { RelatedEntitiesCard } from '../RelatedEntitiesCard/RelatedEntitiesCard.esm.js';
|
|
4
|
-
import { componentEntityColumns,
|
|
4
|
+
import { componentEntityColumns, asComponentEntities, componentEntityHelpLink } from '../RelatedEntitiesCard/presets.esm.js';
|
|
5
5
|
import { catalogTranslationRef } from '../../alpha/translation.esm.js';
|
|
6
6
|
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RELATION_DEPENDS_ON } from '@backstage/catalog-model';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { RelatedEntitiesCard } from '../RelatedEntitiesCard/RelatedEntitiesCard.esm.js';
|
|
4
|
-
import { componentEntityColumns,
|
|
4
|
+
import { componentEntityColumns, asComponentEntities, componentEntityHelpLink } from '../RelatedEntitiesCard/presets.esm.js';
|
|
5
5
|
import { catalogTranslationRef } from '../../alpha/translation.esm.js';
|
|
6
6
|
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RELATION_DEPENDS_ON } from '@backstage/catalog-model';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { RelatedEntitiesCard } from '../RelatedEntitiesCard/RelatedEntitiesCard.esm.js';
|
|
4
|
-
import { resourceEntityColumns,
|
|
4
|
+
import { resourceEntityColumns, asResourceEntities, componentEntityHelpLink } from '../RelatedEntitiesCard/presets.esm.js';
|
|
5
5
|
import { catalogTranslationRef } from '../../alpha/translation.esm.js';
|
|
6
6
|
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
7
7
|
|
|
@@ -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
|
|
3
|
-
import { attachComponentData, useRouteRefParams, useElementFilter, useRouteRef } from '@backstage/core-plugin-api';
|
|
4
|
-
import {
|
|
2
|
+
import { Page, Header, Breadcrumbs, HeaderLabel, Progress, RoutedTabs, Content, WarningPanel, Link } 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, EntityDisplayName, FavoriteEntity, getEntityRelations, EntityRefLinks, UnregisterEntityDialog, InspectEntityDialog } 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,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,GAAA;AAAA,IAAA;AAAA,MACC,SAAU,EAAA,MAAA;AAAA,MACV,YAAa,EAAA,UAAA;AAAA,MACb,UAAW,EAAA,QAAA;AAAA,MACX,QAAS,EAAA;AAAA,KAAA;AAAA,IAER,yBAAU,KAAA,CAAA,aAAA,CAAA,iBAAA,EAAA,EAAkB,WAAW,MAAQ,EAAA,QAAA,EAAQ,MAAC,CAAK,GAAA;AAAA,GAE/D,EAAA,MAAA,oBAAW,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,EAAe,QAAgB,CAC7C,CAAA;AAEJ;AAEA,SAAS,WACP,CAAA,SAAA,EACA,cACA,EAAA,SAAA,EACA,MAC6C,EAAA;AAC7C,EAAM,MAAA,IAAA,GAAO,SAAa,IAAA,MAAA,EAAQ,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ACA,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,EAAc,YAAW,QAAS,EAAA,MAAA,EAAO,KAAM,EAAA,QAAA,EAAS,MACnE,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,GAAA;AAAA,IAAA;AAAA,MACC,SAAU,EAAA,MAAA;AAAA,MACV,YAAa,EAAA,UAAA;AAAA,MACb,UAAW,EAAA,QAAA;AAAA,MACX,QAAS,EAAA;AAAA,KAAA;AAAA,IAER,yBAAU,KAAA,CAAA,aAAA,CAAA,iBAAA,EAAA,EAAkB,WAAW,MAAQ,EAAA,QAAA,EAAQ,MAAC,CAAK,GAAA;AAAA,GAE/D,EAAA,MAAA,oBAAW,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,EAAe,QAAgB,CAC7C,CAAA;AAEJ;AAEA,SAAS,WACP,CAAA,SAAA,EACA,cACA,EAAA,SAAA,EAC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AAA,CAAA,aAAA,CAAC,KAAM,EAAA,EAAA,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,7 +1,7 @@
|
|
|
1
1
|
import { RELATION_HAS_PART } from '@backstage/catalog-model';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { RelatedEntitiesCard } from '../RelatedEntitiesCard/RelatedEntitiesCard.esm.js';
|
|
4
|
-
import { componentEntityColumns,
|
|
4
|
+
import { componentEntityColumns, asComponentEntities, componentEntityHelpLink } from '../RelatedEntitiesCard/presets.esm.js';
|
|
5
5
|
import { catalogTranslationRef } from '../../alpha/translation.esm.js';
|
|
6
6
|
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RELATION_HAS_PART } from '@backstage/catalog-model';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { RelatedEntitiesCard } from '../RelatedEntitiesCard/RelatedEntitiesCard.esm.js';
|
|
4
|
-
import { resourceEntityColumns,
|
|
4
|
+
import { resourceEntityColumns, resourceEntityHelpLink, asResourceEntities } from '../RelatedEntitiesCard/presets.esm.js';
|
|
5
5
|
import { catalogTranslationRef } from '../../alpha/translation.esm.js';
|
|
6
6
|
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RELATION_HAS_PART } from '@backstage/catalog-model';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { RelatedEntitiesCard } from '../RelatedEntitiesCard/RelatedEntitiesCard.esm.js';
|
|
4
|
-
import {
|
|
4
|
+
import { asComponentEntities, componentEntityColumns } from '../RelatedEntitiesCard/presets.esm.js';
|
|
5
5
|
import { catalogTranslationRef } from '../../alpha/translation.esm.js';
|
|
6
6
|
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RELATION_HAS_PART } from '@backstage/catalog-model';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { RelatedEntitiesCard } from '../RelatedEntitiesCard/RelatedEntitiesCard.esm.js';
|
|
4
|
-
import { systemEntityColumns,
|
|
4
|
+
import { systemEntityColumns, systemEntityHelpLink, asSystemEntities } from '../RelatedEntitiesCard/presets.esm.js';
|
|
5
5
|
import { catalogTranslationRef } from '../../alpha/translation.esm.js';
|
|
6
6
|
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
7
7
|
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Entity, CompoundEntityRef, ComponentEntity, ResourceEntity, SystemEntity } from '@backstage/catalog-model';
|
|
3
3
|
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
4
4
|
import { IconComponent, StorageApi, ApiHolder } from '@backstage/core-plugin-api';
|
|
5
|
-
import {
|
|
5
|
+
import { EntityPresentationApi, CatalogApi, EntityRefPresentationSnapshot, EntityRefPresentation, StarredEntitiesApi, EntityListContextProps, UserListFilterKind, EntityOwnerPickerProps, EntityListPagination } from '@backstage/plugin-catalog-react';
|
|
6
6
|
import { HumanDuration, Observable } from '@backstage/types';
|
|
7
7
|
import { InfoCardVariants, TableColumn, TableProps, TableOptions } from '@backstage/core-components';
|
|
8
8
|
import * as React$1 from 'react';
|
|
@@ -185,6 +185,7 @@ interface AboutFieldProps {
|
|
|
185
185
|
value?: string;
|
|
186
186
|
gridSizes?: Record<string, number>;
|
|
187
187
|
children?: React__default.ReactNode;
|
|
188
|
+
className?: string;
|
|
188
189
|
}
|
|
189
190
|
/** @public */
|
|
190
191
|
declare function AboutField(props: AboutFieldProps): React__default.JSX.Element;
|
|
@@ -299,6 +300,17 @@ interface EntityLayoutProps {
|
|
|
299
300
|
UNSTABLE_contextMenuOptions?: EntityContextMenuOptions;
|
|
300
301
|
children?: React__default.ReactNode;
|
|
301
302
|
NotFoundComponent?: React__default.ReactNode;
|
|
303
|
+
/**
|
|
304
|
+
* An array of relation types used to determine the parent entities in the hierarchy.
|
|
305
|
+
* These relations are prioritized in the order provided, allowing for flexible
|
|
306
|
+
* navigation through entity relationships.
|
|
307
|
+
*
|
|
308
|
+
* For example, use relation types like `["partOf", "memberOf", "ownedBy"]` to define how the entity is related to
|
|
309
|
+
* its parents in the Entity Catalog.
|
|
310
|
+
*
|
|
311
|
+
* It adds breadcrumbs in the Entity page to enhance user navigation and context awareness.
|
|
312
|
+
*/
|
|
313
|
+
parentEntityRelations?: string[];
|
|
302
314
|
}
|
|
303
315
|
/**
|
|
304
316
|
* EntityLayout is a compound component, which allows you to define a layout for
|
package/dist/plugin.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CatalogClient } from '@backstage/catalog-client';
|
|
2
|
-
import { catalogApiRef, starredEntitiesApiRef, entityPresentationApiRef
|
|
3
|
-
import {
|
|
4
|
-
import { createPlugin, createApiFactory,
|
|
2
|
+
import { entityRouteRef, catalogApiRef, starredEntitiesApiRef, entityPresentationApiRef } from '@backstage/plugin-catalog-react';
|
|
3
|
+
import { unregisterRedirectRouteRef, createFromTemplateRouteRef, viewTechDocRouteRef, createComponentRouteRef, rootRouteRef } from './routes.esm.js';
|
|
4
|
+
import { createPlugin, createApiFactory, fetchApiRef, discoveryApiRef, storageApiRef, createRoutableExtension, createComponentExtension } from '@backstage/core-plugin-api';
|
|
5
5
|
import { createSearchResultListItemExtension } from '@backstage/plugin-search-react';
|
|
6
6
|
import { DefaultEntityPresentationApi } from './apis/EntityPresentationApi/DefaultEntityPresentationApi.esm.js';
|
|
7
7
|
import { DefaultStarredEntitiesApi } from './apis/StarredEntitiesApi/DefaultStarredEntitiesApi.esm.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-catalog",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.25.0",
|
|
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",
|
|
@@ -58,21 +67,21 @@
|
|
|
58
67
|
"test": "backstage-cli package test"
|
|
59
68
|
},
|
|
60
69
|
"dependencies": {
|
|
61
|
-
"@backstage/catalog-client": "1.8.0
|
|
62
|
-
"@backstage/catalog-model": "1.7.
|
|
63
|
-
"@backstage/core-compat-api": "0.3.2
|
|
64
|
-
"@backstage/core-components": "0.16.0
|
|
65
|
-
"@backstage/core-plugin-api": "1.10.
|
|
66
|
-
"@backstage/errors": "1.2.
|
|
67
|
-
"@backstage/frontend-plugin-api": "0.9.1
|
|
68
|
-
"@backstage/integration-react": "1.2.
|
|
69
|
-
"@backstage/plugin-catalog-common": "1.1.
|
|
70
|
-
"@backstage/plugin-catalog-react": "1.14.1
|
|
71
|
-
"@backstage/plugin-permission-react": "0.4.
|
|
72
|
-
"@backstage/plugin-scaffolder-common": "1.5.
|
|
73
|
-
"@backstage/plugin-search-common": "1.2.
|
|
74
|
-
"@backstage/plugin-search-react": "1.8.2
|
|
75
|
-
"@backstage/types": "1.
|
|
70
|
+
"@backstage/catalog-client": "^1.8.0",
|
|
71
|
+
"@backstage/catalog-model": "^1.7.1",
|
|
72
|
+
"@backstage/core-compat-api": "^0.3.2",
|
|
73
|
+
"@backstage/core-components": "^0.16.0",
|
|
74
|
+
"@backstage/core-plugin-api": "^1.10.1",
|
|
75
|
+
"@backstage/errors": "^1.2.5",
|
|
76
|
+
"@backstage/frontend-plugin-api": "^0.9.1",
|
|
77
|
+
"@backstage/integration-react": "^1.2.1",
|
|
78
|
+
"@backstage/plugin-catalog-common": "^1.1.1",
|
|
79
|
+
"@backstage/plugin-catalog-react": "^1.14.1",
|
|
80
|
+
"@backstage/plugin-permission-react": "^0.4.28",
|
|
81
|
+
"@backstage/plugin-scaffolder-common": "^1.5.7",
|
|
82
|
+
"@backstage/plugin-search-common": "^1.2.15",
|
|
83
|
+
"@backstage/plugin-search-react": "^1.8.2",
|
|
84
|
+
"@backstage/types": "^1.2.0",
|
|
76
85
|
"@material-ui/core": "^4.12.2",
|
|
77
86
|
"@material-ui/icons": "^4.9.1",
|
|
78
87
|
"@material-ui/lab": "4.0.0-alpha.61",
|
|
@@ -86,12 +95,12 @@
|
|
|
86
95
|
"zen-observable": "^0.10.0"
|
|
87
96
|
},
|
|
88
97
|
"devDependencies": {
|
|
89
|
-
"@backstage/cli": "0.29.0
|
|
90
|
-
"@backstage/core-app-api": "1.15.
|
|
91
|
-
"@backstage/dev-utils": "1.1.3
|
|
92
|
-
"@backstage/frontend-test-utils": "0.2.2
|
|
93
|
-
"@backstage/plugin-permission-common": "0.8.
|
|
94
|
-
"@backstage/test-utils": "1.7.1
|
|
98
|
+
"@backstage/cli": "^0.29.0",
|
|
99
|
+
"@backstage/core-app-api": "^1.15.2",
|
|
100
|
+
"@backstage/dev-utils": "^1.1.3",
|
|
101
|
+
"@backstage/frontend-test-utils": "^0.2.2",
|
|
102
|
+
"@backstage/plugin-permission-common": "^0.8.2",
|
|
103
|
+
"@backstage/test-utils": "^1.7.1",
|
|
95
104
|
"@testing-library/dom": "^10.0.0",
|
|
96
105
|
"@testing-library/jest-dom": "^6.0.0",
|
|
97
106
|
"@testing-library/react": "^16.0.0",
|