@backstage/plugin-catalog 1.21.1-next.0 → 1.21.1-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/alpha/package.json +1 -1
- package/dist/alpha.d.ts +74 -0
- package/dist/components/AboutCard/AboutCard.esm.js +12 -9
- package/dist/components/AboutCard/AboutCard.esm.js.map +1 -1
- package/dist/components/AboutCard/AboutContent.esm.js +49 -32
- package/dist/components/AboutCard/AboutContent.esm.js.map +1 -1
- package/dist/components/CatalogPage/DefaultCatalogPage.esm.js +1 -1
- package/dist/components/CatalogPage/DefaultCatalogPage.esm.js.map +1 -1
- package/dist/components/CatalogSearchResultListItem/CatalogSearchResultListItem.esm.js +16 -1
- package/dist/components/CatalogSearchResultListItem/CatalogSearchResultListItem.esm.js.map +1 -1
- package/dist/components/CatalogTable/CatalogTable.esm.js +7 -4
- package/dist/components/CatalogTable/CatalogTable.esm.js.map +1 -1
- package/dist/components/DependencyOfComponentsCard/DependencyOfComponentsCard.esm.js +8 -2
- package/dist/components/DependencyOfComponentsCard/DependencyOfComponentsCard.esm.js.map +1 -1
- package/dist/components/DependsOnComponentsCard/DependsOnComponentsCard.esm.js +6 -3
- package/dist/components/DependsOnComponentsCard/DependsOnComponentsCard.esm.js.map +1 -1
- package/dist/components/DependsOnResourcesCard/DependsOnResourcesCard.esm.js +6 -3
- package/dist/components/DependsOnResourcesCard/DependsOnResourcesCard.esm.js.map +1 -1
- package/dist/components/EntityContextMenu/EntityContextMenu.esm.js +8 -5
- package/dist/components/EntityContextMenu/EntityContextMenu.esm.js.map +1 -1
- package/dist/components/EntityContextMenu/UnregisterEntity.esm.js +4 -1
- package/dist/components/EntityContextMenu/UnregisterEntity.esm.js.map +1 -1
- package/dist/components/EntityLabelsCard/EntityLabelsCard.esm.js +4 -1
- package/dist/components/EntityLabelsCard/EntityLabelsCard.esm.js.map +1 -1
- package/dist/components/EntityLabelsCard/EntityLabelsEmptyState.esm.js +5 -2
- package/dist/components/EntityLabelsCard/EntityLabelsEmptyState.esm.js.map +1 -1
- package/dist/components/EntityLayout/EntityLayout.esm.js +7 -3
- package/dist/components/EntityLayout/EntityLayout.esm.js.map +1 -1
- package/dist/components/EntityLinksCard/EntityLinksCard.esm.js +4 -1
- package/dist/components/EntityLinksCard/EntityLinksCard.esm.js.map +1 -1
- package/dist/components/EntityLinksCard/EntityLinksEmptyState.esm.js +5 -2
- package/dist/components/EntityLinksCard/EntityLinksEmptyState.esm.js.map +1 -1
- package/dist/components/EntityOrphanWarning/DeleteEntityDialog.esm.js +6 -3
- package/dist/components/EntityOrphanWarning/DeleteEntityDialog.esm.js.map +1 -1
- package/dist/components/EntityOrphanWarning/EntityOrphanWarning.esm.js +4 -1
- package/dist/components/EntityOrphanWarning/EntityOrphanWarning.esm.js.map +1 -1
- package/dist/components/EntityProcessingErrorsPanel/EntityProcessingErrorsPanel.esm.js +4 -1
- package/dist/components/EntityProcessingErrorsPanel/EntityProcessingErrorsPanel.esm.js.map +1 -1
- package/dist/components/EntityRelationWarning/EntityRelationWarning.esm.js +4 -1
- package/dist/components/EntityRelationWarning/EntityRelationWarning.esm.js.map +1 -1
- package/dist/components/HasComponentsCard/HasComponentsCard.esm.js +5 -2
- package/dist/components/HasComponentsCard/HasComponentsCard.esm.js.map +1 -1
- package/dist/components/HasResourcesCard/HasResourcesCard.esm.js +5 -2
- package/dist/components/HasResourcesCard/HasResourcesCard.esm.js.map +1 -1
- package/dist/components/HasSubcomponentsCard/HasSubcomponentsCard.esm.js +5 -2
- package/dist/components/HasSubcomponentsCard/HasSubcomponentsCard.esm.js.map +1 -1
- package/dist/components/HasSystemsCard/HasSystemsCard.esm.js +5 -2
- package/dist/components/HasSystemsCard/HasSystemsCard.esm.js.map +1 -1
- package/dist/components/RelatedEntitiesCard/RelatedEntitiesCard.esm.js +4 -1
- package/dist/components/RelatedEntitiesCard/RelatedEntitiesCard.esm.js.map +1 -1
- package/dist/translation.esm.js +131 -1
- package/dist/translation.esm.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @backstage/plugin-catalog
|
|
2
2
|
|
|
3
|
+
## 1.21.1-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 06c0956: Support i18n for catalog and catalog-react plugins
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/plugin-catalog-react@1.12.2-next.1
|
|
10
|
+
- @backstage/core-compat-api@0.2.7-next.0
|
|
11
|
+
- @backstage/core-components@0.14.9-next.0
|
|
12
|
+
- @backstage/core-plugin-api@1.9.3
|
|
13
|
+
- @backstage/plugin-search-react@1.7.13-next.0
|
|
14
|
+
- @backstage/catalog-client@1.6.5
|
|
15
|
+
- @backstage/catalog-model@1.5.0
|
|
16
|
+
- @backstage/errors@1.2.4
|
|
17
|
+
- @backstage/frontend-plugin-api@0.6.7-next.0
|
|
18
|
+
- @backstage/integration-react@1.1.29-next.0
|
|
19
|
+
- @backstage/types@1.1.1
|
|
20
|
+
- @backstage/plugin-catalog-common@1.0.24
|
|
21
|
+
- @backstage/plugin-permission-react@0.4.23
|
|
22
|
+
- @backstage/plugin-scaffolder-common@1.5.3
|
|
23
|
+
- @backstage/plugin-search-common@1.2.12
|
|
24
|
+
|
|
3
25
|
## 1.21.1-next.0
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
package/alpha/package.json
CHANGED
package/dist/alpha.d.ts
CHANGED
|
@@ -38,8 +38,82 @@ declare function createCatalogFilterExtension<TInputs extends AnyExtensionInputM
|
|
|
38
38
|
|
|
39
39
|
/** @alpha */
|
|
40
40
|
declare const catalogTranslationRef: _backstage_core_plugin_api_alpha.TranslationRef<"catalog", {
|
|
41
|
+
readonly "deleteEntity.description": "This entity is not referenced by any location and is therefore not receiving updates. Click here to delete.";
|
|
42
|
+
readonly "deleteEntity.cancelButtonTitle": "Cancel";
|
|
43
|
+
readonly "deleteEntity.deleteButtonTitle": "Delete";
|
|
44
|
+
readonly "deleteEntity.dialogTitle": "Are you sure you want to delete this entity?";
|
|
41
45
|
readonly "indexPage.title": "{{orgName}} Catalog";
|
|
42
46
|
readonly "indexPage.createButtonTitle": "Create";
|
|
47
|
+
readonly "indexPage.supportButtonContent": "All your software catalog entities";
|
|
48
|
+
readonly "aboutCard.title": "About";
|
|
49
|
+
readonly "aboutCard.refreshButtonTitle": "Schedule entity refresh";
|
|
50
|
+
readonly "aboutCard.editButtonTitle": "Edit Metadata";
|
|
51
|
+
readonly "aboutCard.createSimilarButtonTitle": "Create something similar";
|
|
52
|
+
readonly "aboutCard.refreshScheduledMessage": "Refresh scheduled";
|
|
53
|
+
readonly "aboutCard.launchTemplate": "Launch Template";
|
|
54
|
+
readonly "aboutCard.viewTechdocs": "View TechDocs";
|
|
55
|
+
readonly "aboutCard.viewSource": "View Source";
|
|
56
|
+
readonly "aboutCard.descriptionField.value": "No description";
|
|
57
|
+
readonly "aboutCard.descriptionField.label": "Description";
|
|
58
|
+
readonly "aboutCard.ownerField.value": "No Owner";
|
|
59
|
+
readonly "aboutCard.ownerField.label": "Owner";
|
|
60
|
+
readonly "aboutCard.domainField.value": "No Domain";
|
|
61
|
+
readonly "aboutCard.domainField.label": "Domain";
|
|
62
|
+
readonly "aboutCard.systemField.value": "No System";
|
|
63
|
+
readonly "aboutCard.systemField.label": "System";
|
|
64
|
+
readonly "aboutCard.parentComponentField.value": "No Parent Component";
|
|
65
|
+
readonly "aboutCard.parentComponentField.label": "Parent Component";
|
|
66
|
+
readonly "aboutCard.typeField.label": "Type";
|
|
67
|
+
readonly "aboutCard.lifecycleField.label": "Lifecycle";
|
|
68
|
+
readonly "aboutCard.tagsField.value": "No Tags";
|
|
69
|
+
readonly "aboutCard.tagsField.label": "Tags";
|
|
70
|
+
readonly "aboutCard.targetsField.label": "Targets";
|
|
71
|
+
readonly "searchResultItem.lifecycle": "Lifecycle";
|
|
72
|
+
readonly "searchResultItem.Owner": "Owner";
|
|
73
|
+
readonly "catalogTable.warningPanelTitle": "Could not fetch catalog entities.";
|
|
74
|
+
readonly "catalogTable.viewActionTitle": "View";
|
|
75
|
+
readonly "catalogTable.editActionTitle": "Edit";
|
|
76
|
+
readonly "catalogTable.starActionTitle": "Add to favorites";
|
|
77
|
+
readonly "catalogTable.unStarActionTitle": "Remove from favorites";
|
|
78
|
+
readonly "dependencyOfComponentsCard.title": "Dependency of components";
|
|
79
|
+
readonly "dependencyOfComponentsCard.emptyMessage": "No component depends on this component";
|
|
80
|
+
readonly "dependsOnComponentsCard.title": "Depends on components";
|
|
81
|
+
readonly "dependsOnComponentsCard.emptyMessage": "No component is a dependency of this component";
|
|
82
|
+
readonly "dependsOnResourcesCard.title": "Depends on resources";
|
|
83
|
+
readonly "dependsOnResourcesCard.emptyMessage": "No resource is a dependency of this component";
|
|
84
|
+
readonly "entityContextMenu.copiedMessage": "Copied!";
|
|
85
|
+
readonly "entityContextMenu.moreButtonTitle": "More";
|
|
86
|
+
readonly "entityContextMenu.inspectMenuTitle": "Inspect entity";
|
|
87
|
+
readonly "entityContextMenu.copyURLMenuTitle": "Copy entity URL";
|
|
88
|
+
readonly "entityContextMenu.unregisterMenuTitle": "Unregister entity";
|
|
89
|
+
readonly "entityLabelsCard.title": "Labels";
|
|
90
|
+
readonly "entityLabelsCard.emptyDescription": "No labels defined for this entity. You can add labels to your entity YAML as shown in the highlighted example below:";
|
|
91
|
+
readonly "entityLabelsCard.readMoreButtonTitle": "Read more";
|
|
92
|
+
readonly "entityLabels.warningPanelTitle": "Entity not found";
|
|
93
|
+
readonly "entityLabels.ownerLabel": "Owner";
|
|
94
|
+
readonly "entityLabels.lifecycleLabel": "Lifecycle";
|
|
95
|
+
readonly "entityLinksCard.title": "Links";
|
|
96
|
+
readonly "entityLinksCard.emptyDescription": "No links defined for this entity. You can add links to your entity YAML as shown in the highlighted example below:";
|
|
97
|
+
readonly "entityLinksCard.readMoreButtonTitle": "Read more";
|
|
98
|
+
readonly "entityNotFound.title": "Entity was not found";
|
|
99
|
+
readonly "entityNotFound.description": "Want to help us build this? Check out our Getting Started documentation.";
|
|
100
|
+
readonly "entityNotFound.docButtonTitle": "DOCS";
|
|
101
|
+
readonly entityProcessingErrorsDescription: "The error below originates from";
|
|
102
|
+
readonly entityRelationWarningDescription: "This entity has relations to other entities, which can't be found in the catalog.\n Entities not found are: ";
|
|
103
|
+
readonly "hasComponentsCard.title": "Has components";
|
|
104
|
+
readonly "hasComponentsCard.emptyMessage": "No component is part of this system";
|
|
105
|
+
readonly "hasResourcesCard.title": "Has resources";
|
|
106
|
+
readonly "hasResourcesCard.emptyMessage": "No resource is part of this system";
|
|
107
|
+
readonly "hasSubcomponentsCard.title": "Has subcomponents";
|
|
108
|
+
readonly "hasSubcomponentsCard.emptyMessage": "No subcomponent is part of this component";
|
|
109
|
+
readonly "hasSystemsCard.title": "Has systems";
|
|
110
|
+
readonly "hasSystemsCard.emptyMessage": "No system is part of this domain";
|
|
111
|
+
readonly "relatedEntitiesCard.emptyHelpLinkTitle": "Learn how to change this.";
|
|
112
|
+
readonly "systemDiagramCard.title": "System Diagram";
|
|
113
|
+
readonly "systemDiagramCard.description": "Use pinch & zoo to move around the diagram.";
|
|
114
|
+
readonly "systemDiagramCard.edgeLabels.dependsOn": "depends on";
|
|
115
|
+
readonly "systemDiagramCard.edgeLabels.partOf": "part of";
|
|
116
|
+
readonly "systemDiagramCard.edgeLabels.provides": "provides";
|
|
43
117
|
}>;
|
|
44
118
|
|
|
45
119
|
export { catalogTranslationRef, createCatalogFilterExtension, _default as default };
|
|
@@ -22,6 +22,8 @@ import { catalogEntityRefreshPermission } from '@backstage/plugin-catalog-common
|
|
|
22
22
|
import { useSourceTemplateCompoundEntityRef } from './hooks.esm.js';
|
|
23
23
|
import { taskCreatePermission } from '@backstage/plugin-scaffolder-common/alpha';
|
|
24
24
|
import { usePermission } from '@backstage/plugin-permission-react';
|
|
25
|
+
import { catalogTranslationRef } from '../../translation.esm.js';
|
|
26
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
25
27
|
|
|
26
28
|
const TECHDOCS_ANNOTATION = "backstage.io/techdocs-ref";
|
|
27
29
|
const TECHDOCS_EXTERNAL_ANNOTATION = "backstage.io/techdocs-entity";
|
|
@@ -60,6 +62,7 @@ function AboutCard(props) {
|
|
|
60
62
|
const { allowed: canRefresh } = useEntityPermission(
|
|
61
63
|
catalogEntityRefreshPermission
|
|
62
64
|
);
|
|
65
|
+
const { t } = useTranslationRef(catalogTranslationRef);
|
|
63
66
|
const { allowed: canCreateTemplateTask } = usePermission({
|
|
64
67
|
permission: taskCreatePermission
|
|
65
68
|
});
|
|
@@ -79,13 +82,13 @@ function AboutCard(props) {
|
|
|
79
82
|
}
|
|
80
83
|
}
|
|
81
84
|
const viewInSource = {
|
|
82
|
-
label: "
|
|
85
|
+
label: t("aboutCard.viewSource"),
|
|
83
86
|
disabled: !entitySourceLocation,
|
|
84
87
|
icon: /* @__PURE__ */ React.createElement(ScmIntegrationIcon, { type: entitySourceLocation?.integrationType }),
|
|
85
88
|
href: entitySourceLocation?.locationTargetUrl
|
|
86
89
|
};
|
|
87
90
|
const viewInTechDocs = {
|
|
88
|
-
label: "
|
|
91
|
+
label: t("aboutCard.viewTechdocs"),
|
|
89
92
|
disabled: !(entity.metadata.annotations?.[TECHDOCS_ANNOTATION] || entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION]) || !viewTechdocLink,
|
|
90
93
|
icon: /* @__PURE__ */ React.createElement(DocsIcon, null),
|
|
91
94
|
href: viewTechdocLink && (techdocsRef ? viewTechdocLink({
|
|
@@ -102,7 +105,7 @@ function AboutCard(props) {
|
|
|
102
105
|
if (isTemplateEntityV1beta3(entity)) {
|
|
103
106
|
const Icon = app.getSystemIcon("scaffolder") ?? CreateComponentIcon;
|
|
104
107
|
const launchTemplate = {
|
|
105
|
-
label: "
|
|
108
|
+
label: t("aboutCard.launchTemplate"),
|
|
106
109
|
icon: /* @__PURE__ */ React.createElement(Icon, null),
|
|
107
110
|
disabled: !templateRoute || !canCreateTemplateTask,
|
|
108
111
|
href: templateRoute && templateRoute({
|
|
@@ -130,23 +133,23 @@ function AboutCard(props) {
|
|
|
130
133
|
try {
|
|
131
134
|
await catalogApi.refreshEntity(stringifyEntityRef(entity));
|
|
132
135
|
alertApi.post({
|
|
133
|
-
message: "
|
|
136
|
+
message: t("aboutCard.refreshScheduledMessage"),
|
|
134
137
|
severity: "info",
|
|
135
138
|
display: "transient"
|
|
136
139
|
});
|
|
137
140
|
} catch (e) {
|
|
138
141
|
errorApi.post(e);
|
|
139
142
|
}
|
|
140
|
-
}, [catalogApi, alertApi,
|
|
143
|
+
}, [catalogApi, entity, alertApi, t, errorApi]);
|
|
141
144
|
return /* @__PURE__ */ React.createElement(Card, { className: cardClass }, /* @__PURE__ */ React.createElement(
|
|
142
145
|
CardHeader,
|
|
143
146
|
{
|
|
144
|
-
title: "
|
|
147
|
+
title: t("aboutCard.title"),
|
|
145
148
|
action: /* @__PURE__ */ React.createElement(React.Fragment, null, allowRefresh && canRefresh && /* @__PURE__ */ React.createElement(
|
|
146
149
|
IconButton,
|
|
147
150
|
{
|
|
148
151
|
"aria-label": "Refresh",
|
|
149
|
-
title: "
|
|
152
|
+
title: t("aboutCard.refreshButtonTitle"),
|
|
150
153
|
onClick: refreshEntity
|
|
151
154
|
},
|
|
152
155
|
/* @__PURE__ */ React.createElement(CachedIcon, null)
|
|
@@ -156,7 +159,7 @@ function AboutCard(props) {
|
|
|
156
159
|
component: Link,
|
|
157
160
|
"aria-label": "Edit",
|
|
158
161
|
disabled: !entityMetadataEditUrl,
|
|
159
|
-
title: "
|
|
162
|
+
title: t("aboutCard.editButtonTitle"),
|
|
160
163
|
to: entityMetadataEditUrl ?? "#"
|
|
161
164
|
},
|
|
162
165
|
/* @__PURE__ */ React.createElement(EditIcon, null)
|
|
@@ -164,7 +167,7 @@ function AboutCard(props) {
|
|
|
164
167
|
IconButton,
|
|
165
168
|
{
|
|
166
169
|
component: Link,
|
|
167
|
-
title: "
|
|
170
|
+
title: t("aboutCard.createSimilarButtonTitle"),
|
|
168
171
|
to: templateRoute({
|
|
169
172
|
namespace: sourceTemplateRef.namespace,
|
|
170
173
|
templateName: sourceTemplateRef.name
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AboutCard.esm.js","sources":["../../../src/components/AboutCard/AboutCard.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n ANNOTATION_EDIT_URL,\n ANNOTATION_LOCATION,\n CompoundEntityRef,\n DEFAULT_NAMESPACE,\n stringifyEntityRef,\n parseEntityRef,\n} from '@backstage/catalog-model';\nimport Card from '@material-ui/core/Card';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardHeader from '@material-ui/core/CardHeader';\nimport Divider from '@material-ui/core/Divider';\nimport IconButton from '@material-ui/core/IconButton';\nimport { makeStyles } from '@material-ui/core/styles';\nimport {\n AppIcon,\n HeaderIconLinkRow,\n IconLinkVerticalProps,\n InfoCardVariants,\n Link,\n} from '@backstage/core-components';\nimport React, { useCallback } from 'react';\nimport {\n ScmIntegrationIcon,\n scmIntegrationsApiRef,\n} from '@backstage/integration-react';\nimport {\n alertApiRef,\n errorApiRef,\n useApi,\n useApp,\n useRouteRef,\n} from '@backstage/core-plugin-api';\nimport {\n catalogApiRef,\n getEntitySourceLocation,\n useEntity,\n} from '@backstage/plugin-catalog-react';\nimport { createFromTemplateRouteRef, viewTechDocRouteRef } from '../../routes';\n\nimport { AboutContent } from './AboutContent';\nimport CachedIcon from '@material-ui/icons/Cached';\nimport CreateComponentIcon from '@material-ui/icons/AddCircleOutline';\nimport DocsIcon from '@material-ui/icons/Description';\nimport EditIcon from '@material-ui/icons/Edit';\nimport { isTemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { useEntityPermission } from '@backstage/plugin-catalog-react/alpha';\nimport { catalogEntityRefreshPermission } from '@backstage/plugin-catalog-common/alpha';\nimport { useSourceTemplateCompoundEntityRef } from './hooks';\nimport { taskCreatePermission } from '@backstage/plugin-scaffolder-common/alpha';\nimport { usePermission } from '@backstage/plugin-permission-react';\n\nconst TECHDOCS_ANNOTATION = 'backstage.io/techdocs-ref';\n\nconst TECHDOCS_EXTERNAL_ANNOTATION = 'backstage.io/techdocs-entity';\n\nconst useStyles = makeStyles({\n gridItemCard: {\n display: 'flex',\n flexDirection: 'column',\n height: 'calc(100% - 10px)', // for pages without content header\n marginBottom: '10px',\n },\n fullHeightCard: {\n display: 'flex',\n flexDirection: 'column',\n height: '100%',\n },\n gridItemCardContent: {\n flex: 1,\n },\n fullHeightCardContent: {\n flex: 1,\n },\n});\n\n/**\n * Props for {@link EntityAboutCard}.\n *\n * @public\n */\nexport interface AboutCardProps {\n variant?: InfoCardVariants;\n}\n\n/**\n * Exported publicly via the EntityAboutCard\n *\n * NOTE: We generally do not accept pull requests to extend this class with more\n * props and cusomizability. If you need to tweak it, consider making a bespoke\n * card in your own repository instead, that is perfect for your own needs.\n */\nexport function AboutCard(props: AboutCardProps) {\n const { variant } = props;\n const app = useApp();\n const classes = useStyles();\n const { entity } = useEntity();\n const scmIntegrationsApi = useApi(scmIntegrationsApiRef);\n const catalogApi = useApi(catalogApiRef);\n const alertApi = useApi(alertApiRef);\n const errorApi = useApi(errorApiRef);\n const viewTechdocLink = useRouteRef(viewTechDocRouteRef);\n const templateRoute = useRouteRef(createFromTemplateRouteRef);\n const sourceTemplateRef = useSourceTemplateCompoundEntityRef(entity);\n const { allowed: canRefresh } = useEntityPermission(\n catalogEntityRefreshPermission,\n );\n\n const { allowed: canCreateTemplateTask } = usePermission({\n permission: taskCreatePermission,\n });\n\n const entitySourceLocation = getEntitySourceLocation(\n entity,\n scmIntegrationsApi,\n );\n const entityMetadataEditUrl =\n entity.metadata.annotations?.[ANNOTATION_EDIT_URL];\n\n let techdocsRef: CompoundEntityRef | undefined;\n\n if (entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION]) {\n try {\n techdocsRef = parseEntityRef(\n entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION],\n );\n // not a fan of this but we don't care if the parseEntityRef fails\n } catch {\n techdocsRef = undefined;\n }\n }\n\n const viewInSource: IconLinkVerticalProps = {\n label: 'View Source',\n disabled: !entitySourceLocation,\n icon: <ScmIntegrationIcon type={entitySourceLocation?.integrationType} />,\n href: entitySourceLocation?.locationTargetUrl,\n };\n const viewInTechDocs: IconLinkVerticalProps = {\n label: 'View TechDocs',\n disabled:\n !(\n entity.metadata.annotations?.[TECHDOCS_ANNOTATION] ||\n entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION]\n ) || !viewTechdocLink,\n icon: <DocsIcon />,\n href:\n viewTechdocLink &&\n (techdocsRef\n ? viewTechdocLink({\n namespace: techdocsRef.namespace || DEFAULT_NAMESPACE,\n kind: techdocsRef.kind,\n name: techdocsRef.name,\n })\n : viewTechdocLink({\n namespace: entity.metadata.namespace || DEFAULT_NAMESPACE,\n kind: entity.kind,\n name: entity.metadata.name,\n })),\n };\n\n const subHeaderLinks = [viewInSource, viewInTechDocs];\n\n if (isTemplateEntityV1beta3(entity)) {\n const Icon = app.getSystemIcon('scaffolder') ?? CreateComponentIcon;\n\n const launchTemplate: IconLinkVerticalProps = {\n label: 'Launch Template',\n icon: <Icon />,\n disabled: !templateRoute || !canCreateTemplateTask,\n href:\n templateRoute &&\n templateRoute({\n templateName: entity.metadata.name,\n namespace: entity.metadata.namespace || DEFAULT_NAMESPACE,\n }),\n };\n\n subHeaderLinks.push(launchTemplate);\n }\n\n let cardClass = '';\n if (variant === 'gridItem') {\n cardClass = classes.gridItemCard;\n } else if (variant === 'fullHeight') {\n cardClass = classes.fullHeightCard;\n }\n\n let cardContentClass = '';\n if (variant === 'gridItem') {\n cardContentClass = classes.gridItemCardContent;\n } else if (variant === 'fullHeight') {\n cardContentClass = classes.fullHeightCardContent;\n }\n\n const entityLocation = entity.metadata.annotations?.[ANNOTATION_LOCATION];\n // Limiting the ability to manually refresh to the less expensive locations\n const allowRefresh =\n entityLocation?.startsWith('url:') || entityLocation?.startsWith('file:');\n const refreshEntity = useCallback(async () => {\n try {\n await catalogApi.refreshEntity(stringifyEntityRef(entity));\n alertApi.post({\n message: 'Refresh scheduled',\n severity: 'info',\n display: 'transient',\n });\n } catch (e) {\n errorApi.post(e);\n }\n }, [catalogApi, alertApi, errorApi, entity]);\n\n return (\n <Card className={cardClass}>\n <CardHeader\n title=\"About\"\n action={\n <>\n {allowRefresh && canRefresh && (\n <IconButton\n aria-label=\"Refresh\"\n title=\"Schedule entity refresh\"\n onClick={refreshEntity}\n >\n <CachedIcon />\n </IconButton>\n )}\n <IconButton\n component={Link}\n aria-label=\"Edit\"\n disabled={!entityMetadataEditUrl}\n title=\"Edit Metadata\"\n to={entityMetadataEditUrl ?? '#'}\n >\n <EditIcon />\n </IconButton>\n {sourceTemplateRef && templateRoute && (\n <IconButton\n component={Link}\n title=\"Create something similar\"\n to={templateRoute({\n namespace: sourceTemplateRef.namespace,\n templateName: sourceTemplateRef.name,\n })}\n >\n <AppIcon id=\"scaffolder\" />\n </IconButton>\n )}\n </>\n }\n subheader={<HeaderIconLinkRow links={subHeaderLinks} />}\n />\n <Divider />\n <CardContent className={cardContentClass}>\n <AboutContent entity={entity} />\n </CardContent>\n </Card>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAmEA,MAAM,mBAAsB,GAAA,2BAAA,CAAA;AAE5B,MAAM,4BAA+B,GAAA,8BAAA,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AA,4CAER,UAAW,EAAA,IAAA,CAAA;AAAA,OAGhB,kBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,UAAA;AAAA,QAAA;AAAA,UACC,SAAW,EAAA,IAAA;AAAA,UACX,YAAW,EAAA,MAAA;AAAA,UACX,UAAU,CAAC,qBAAA;AAAA,UACX,KAAM,EAAA,eAAA;AAAA,UACN,IAAI,qBAAyB,IAAA,GAAA;AAAA,SAAA;AAAA,4CAE5B,QAAS,EAAA,IAAA,CAAA;AAAA,OACZ,EACC,qBAAqB,aACpB,oBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,UAAA;AAAA,QAAA;AAAA,UACC,SAAW,EAAA,IAAA;AAAA,UACX,KAAM,EAAA,0BAAA;AAAA,UACN,IAAI,aAAc,CAAA;AAAA,YAChB,WAAW,iBAAkB,CAAA,SAAA;AAAA,YAC7B,cAAc,iBAAkB,CAAA,IAAA;AAAA,WACjC,CAAA;AAAA,SAAA;AAAA,wBAED,KAAA,CAAA,aAAA,CAAC,OAAQ,EAAA,EAAA,EAAA,EAAG,YAAa,EAAA,CAAA;AAAA,OAG/B,CAAA;AAAA,MAEF,SAAW,kBAAA,KAAA,CAAA,aAAA,CAAC,iBAAkB,EAAA,EAAA,KAAA,EAAO,cAAgB,EAAA,CAAA;AAAA,KAAA;AAAA,GAEvD,kBAAA,KAAA,CAAA,aAAA,CAAC,OAAQ,EAAA,IAAA,CAAA,kBACR,KAAA,CAAA,aAAA,CAAA,WAAA,EAAA,EAAY,SAAW,EAAA,gBAAA,EAAA,kBACrB,KAAA,CAAA,aAAA,CAAA,YAAA,EAAA,EAAa,MAAgB,EAAA,CAChC,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"AboutCard.esm.js","sources":["../../../src/components/AboutCard/AboutCard.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n ANNOTATION_EDIT_URL,\n ANNOTATION_LOCATION,\n CompoundEntityRef,\n DEFAULT_NAMESPACE,\n stringifyEntityRef,\n parseEntityRef,\n} from '@backstage/catalog-model';\nimport Card from '@material-ui/core/Card';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardHeader from '@material-ui/core/CardHeader';\nimport Divider from '@material-ui/core/Divider';\nimport IconButton from '@material-ui/core/IconButton';\nimport { makeStyles } from '@material-ui/core/styles';\nimport {\n AppIcon,\n HeaderIconLinkRow,\n IconLinkVerticalProps,\n InfoCardVariants,\n Link,\n} from '@backstage/core-components';\nimport React, { useCallback } from 'react';\nimport {\n ScmIntegrationIcon,\n scmIntegrationsApiRef,\n} from '@backstage/integration-react';\nimport {\n alertApiRef,\n errorApiRef,\n useApi,\n useApp,\n useRouteRef,\n} from '@backstage/core-plugin-api';\nimport {\n catalogApiRef,\n getEntitySourceLocation,\n useEntity,\n} from '@backstage/plugin-catalog-react';\nimport { createFromTemplateRouteRef, viewTechDocRouteRef } from '../../routes';\n\nimport { AboutContent } from './AboutContent';\nimport CachedIcon from '@material-ui/icons/Cached';\nimport CreateComponentIcon from '@material-ui/icons/AddCircleOutline';\nimport DocsIcon from '@material-ui/icons/Description';\nimport EditIcon from '@material-ui/icons/Edit';\nimport { isTemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { useEntityPermission } from '@backstage/plugin-catalog-react/alpha';\nimport { catalogEntityRefreshPermission } from '@backstage/plugin-catalog-common/alpha';\nimport { useSourceTemplateCompoundEntityRef } from './hooks';\nimport { taskCreatePermission } from '@backstage/plugin-scaffolder-common/alpha';\nimport { usePermission } from '@backstage/plugin-permission-react';\nimport { catalogTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\nconst TECHDOCS_ANNOTATION = 'backstage.io/techdocs-ref';\n\nconst TECHDOCS_EXTERNAL_ANNOTATION = 'backstage.io/techdocs-entity';\n\nconst useStyles = makeStyles({\n gridItemCard: {\n display: 'flex',\n flexDirection: 'column',\n height: 'calc(100% - 10px)', // for pages without content header\n marginBottom: '10px',\n },\n fullHeightCard: {\n display: 'flex',\n flexDirection: 'column',\n height: '100%',\n },\n gridItemCardContent: {\n flex: 1,\n },\n fullHeightCardContent: {\n flex: 1,\n },\n});\n\n/**\n * Props for {@link EntityAboutCard}.\n *\n * @public\n */\nexport interface AboutCardProps {\n variant?: InfoCardVariants;\n}\n\n/**\n * Exported publicly via the EntityAboutCard\n *\n * NOTE: We generally do not accept pull requests to extend this class with more\n * props and cusomizability. If you need to tweak it, consider making a bespoke\n * card in your own repository instead, that is perfect for your own needs.\n */\nexport function AboutCard(props: AboutCardProps) {\n const { variant } = props;\n const app = useApp();\n const classes = useStyles();\n const { entity } = useEntity();\n const scmIntegrationsApi = useApi(scmIntegrationsApiRef);\n const catalogApi = useApi(catalogApiRef);\n const alertApi = useApi(alertApiRef);\n const errorApi = useApi(errorApiRef);\n const viewTechdocLink = useRouteRef(viewTechDocRouteRef);\n const templateRoute = useRouteRef(createFromTemplateRouteRef);\n const sourceTemplateRef = useSourceTemplateCompoundEntityRef(entity);\n const { allowed: canRefresh } = useEntityPermission(\n catalogEntityRefreshPermission,\n );\n const { t } = useTranslationRef(catalogTranslationRef);\n\n const { allowed: canCreateTemplateTask } = usePermission({\n permission: taskCreatePermission,\n });\n\n const entitySourceLocation = getEntitySourceLocation(\n entity,\n scmIntegrationsApi,\n );\n const entityMetadataEditUrl =\n entity.metadata.annotations?.[ANNOTATION_EDIT_URL];\n\n let techdocsRef: CompoundEntityRef | undefined;\n\n if (entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION]) {\n try {\n techdocsRef = parseEntityRef(\n entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION],\n );\n // not a fan of this but we don't care if the parseEntityRef fails\n } catch {\n techdocsRef = undefined;\n }\n }\n\n const viewInSource: IconLinkVerticalProps = {\n label: t('aboutCard.viewSource'),\n disabled: !entitySourceLocation,\n icon: <ScmIntegrationIcon type={entitySourceLocation?.integrationType} />,\n href: entitySourceLocation?.locationTargetUrl,\n };\n const viewInTechDocs: IconLinkVerticalProps = {\n label: t('aboutCard.viewTechdocs'),\n disabled:\n !(\n entity.metadata.annotations?.[TECHDOCS_ANNOTATION] ||\n entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION]\n ) || !viewTechdocLink,\n icon: <DocsIcon />,\n href:\n viewTechdocLink &&\n (techdocsRef\n ? viewTechdocLink({\n namespace: techdocsRef.namespace || DEFAULT_NAMESPACE,\n kind: techdocsRef.kind,\n name: techdocsRef.name,\n })\n : viewTechdocLink({\n namespace: entity.metadata.namespace || DEFAULT_NAMESPACE,\n kind: entity.kind,\n name: entity.metadata.name,\n })),\n };\n\n const subHeaderLinks = [viewInSource, viewInTechDocs];\n\n if (isTemplateEntityV1beta3(entity)) {\n const Icon = app.getSystemIcon('scaffolder') ?? CreateComponentIcon;\n\n const launchTemplate: IconLinkVerticalProps = {\n label: t('aboutCard.launchTemplate'),\n icon: <Icon />,\n disabled: !templateRoute || !canCreateTemplateTask,\n href:\n templateRoute &&\n templateRoute({\n templateName: entity.metadata.name,\n namespace: entity.metadata.namespace || DEFAULT_NAMESPACE,\n }),\n };\n\n subHeaderLinks.push(launchTemplate);\n }\n\n let cardClass = '';\n if (variant === 'gridItem') {\n cardClass = classes.gridItemCard;\n } else if (variant === 'fullHeight') {\n cardClass = classes.fullHeightCard;\n }\n\n let cardContentClass = '';\n if (variant === 'gridItem') {\n cardContentClass = classes.gridItemCardContent;\n } else if (variant === 'fullHeight') {\n cardContentClass = classes.fullHeightCardContent;\n }\n\n const entityLocation = entity.metadata.annotations?.[ANNOTATION_LOCATION];\n // Limiting the ability to manually refresh to the less expensive locations\n const allowRefresh =\n entityLocation?.startsWith('url:') || entityLocation?.startsWith('file:');\n const refreshEntity = useCallback(async () => {\n try {\n await catalogApi.refreshEntity(stringifyEntityRef(entity));\n alertApi.post({\n message: t('aboutCard.refreshScheduledMessage'),\n severity: 'info',\n display: 'transient',\n });\n } catch (e) {\n errorApi.post(e);\n }\n }, [catalogApi, entity, alertApi, t, errorApi]);\n\n return (\n <Card className={cardClass}>\n <CardHeader\n title={t('aboutCard.title')}\n action={\n <>\n {allowRefresh && canRefresh && (\n <IconButton\n aria-label=\"Refresh\"\n title={t('aboutCard.refreshButtonTitle')}\n onClick={refreshEntity}\n >\n <CachedIcon />\n </IconButton>\n )}\n <IconButton\n component={Link}\n aria-label=\"Edit\"\n disabled={!entityMetadataEditUrl}\n title={t('aboutCard.editButtonTitle')}\n to={entityMetadataEditUrl ?? '#'}\n >\n <EditIcon />\n </IconButton>\n {sourceTemplateRef && templateRoute && (\n <IconButton\n component={Link}\n title={t('aboutCard.createSimilarButtonTitle')}\n to={templateRoute({\n namespace: sourceTemplateRef.namespace,\n templateName: sourceTemplateRef.name,\n })}\n >\n <AppIcon id=\"scaffolder\" />\n </IconButton>\n )}\n </>\n }\n subheader={<HeaderIconLinkRow links={subHeaderLinks} />}\n />\n <Divider />\n <CardContent className={cardContentClass}>\n <AboutContent entity={entity} />\n </CardContent>\n </Card>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAqEA,MAAM,mBAAsB,GAAA,2BAAA,CAAA;AAE5B,MAAM,4BAA+B,GAAA,8BAAA,CAAA;AAErC,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,YAAc,EAAA;AAAA,IACZ,OAAS,EAAA,MAAA;AAAA,IACT,aAAe,EAAA,QAAA;AAAA,IACf,MAAQ,EAAA,mBAAA;AAAA;AAAA,IACR,YAAc,EAAA,MAAA;AAAA,GAChB;AAAA,EACA,cAA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AAA,OAGhB,kBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,UAAA;AAAA,QAAA;AAAA,UACC,SAAW,EAAA,IAAA;AAAA,UACX,YAAW,EAAA,MAAA;AAAA,UACX,UAAU,CAAC,qBAAA;AAAA,UACX,KAAA,EAAO,EAAE,2BAA2B,CAAA;AAAA,UACpC,IAAI,qBAAyB,IAAA,GAAA;AAAA,SAAA;AAAA,4CAE5B,QAAS,EAAA,IAAA,CAAA;AAAA,OACZ,EACC,qBAAqB,aACpB,oBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,UAAA;AAAA,QAAA;AAAA,UACC,SAAW,EAAA,IAAA;AAAA,UACX,KAAA,EAAO,EAAE,oCAAoC,CAAA;AAAA,UAC7C,IAAI,aAAc,CAAA;AAAA,YAChB,WAAW,iBAAkB,CAAA,SAAA;AAAA,YAC7B,cAAc,iBAAkB,CAAA,IAAA;AAAA,WACjC,CAAA;AAAA,SAAA;AAAA,wBAED,KAAA,CAAA,aAAA,CAAC,OAAQ,EAAA,EAAA,EAAA,EAAG,YAAa,EAAA,CAAA;AAAA,OAG/B,CAAA;AAAA,MAEF,SAAW,kBAAA,KAAA,CAAA,aAAA,CAAC,iBAAkB,EAAA,EAAA,KAAA,EAAO,cAAgB,EAAA,CAAA;AAAA,KAAA;AAAA,GAEvD,kBAAA,KAAA,CAAA,aAAA,CAAC,OAAQ,EAAA,IAAA,CAAA,kBACR,KAAA,CAAA,aAAA,CAAA,WAAA,EAAA,EAAY,SAAW,EAAA,gBAAA,EAAA,kBACrB,KAAA,CAAA,aAAA,CAAA,YAAA,EAAA,EAAa,MAAgB,EAAA,CAChC,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -7,6 +7,8 @@ import { MarkdownContent } from '@backstage/core-components';
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { AboutField } from './AboutField.esm.js';
|
|
9
9
|
import { LinksGridList } from '../EntityLinksCard/LinksGridList.esm.js';
|
|
10
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
11
|
+
import { catalogTranslationRef } from '../../translation.esm.js';
|
|
10
12
|
|
|
11
13
|
const useStyles = makeStyles({
|
|
12
14
|
description: {
|
|
@@ -26,6 +28,7 @@ function getLocationTargetHref(target, type, entitySourceLocation) {
|
|
|
26
28
|
function AboutContent(props) {
|
|
27
29
|
const { entity } = props;
|
|
28
30
|
const classes = useStyles();
|
|
31
|
+
const { t } = useTranslationRef(catalogTranslationRef);
|
|
29
32
|
const isSystem = entity.kind.toLocaleLowerCase("en-US") === "system";
|
|
30
33
|
const isResource = entity.kind.toLocaleLowerCase("en-US") === "resource";
|
|
31
34
|
const isComponent = entity.kind.toLocaleLowerCase("en-US") === "component";
|
|
@@ -53,25 +56,32 @@ function AboutContent(props) {
|
|
|
53
56
|
} catch (e) {
|
|
54
57
|
entitySourceLocation = void 0;
|
|
55
58
|
}
|
|
56
|
-
return /* @__PURE__ */ React.createElement(Grid, { container: true }, /* @__PURE__ */ React.createElement(
|
|
57
|
-
|
|
59
|
+
return /* @__PURE__ */ React.createElement(Grid, { container: true }, /* @__PURE__ */ React.createElement(
|
|
60
|
+
AboutField,
|
|
58
61
|
{
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
62
|
+
label: t("aboutCard.descriptionField.label"),
|
|
63
|
+
gridSizes: { xs: 12 }
|
|
64
|
+
},
|
|
65
|
+
/* @__PURE__ */ React.createElement(
|
|
66
|
+
MarkdownContent,
|
|
67
|
+
{
|
|
68
|
+
className: classes.description,
|
|
69
|
+
content: entity?.metadata?.description || t("aboutCard.descriptionField.value")
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
), /* @__PURE__ */ React.createElement(
|
|
63
73
|
AboutField,
|
|
64
74
|
{
|
|
65
|
-
label: "
|
|
66
|
-
value: "
|
|
75
|
+
label: t("aboutCard.ownerField.label"),
|
|
76
|
+
value: t("aboutCard.ownerField.value"),
|
|
67
77
|
gridSizes: { xs: 12, sm: 6, lg: 4 }
|
|
68
78
|
},
|
|
69
79
|
ownedByRelations.length > 0 && /* @__PURE__ */ React.createElement(EntityRefLinks, { entityRefs: ownedByRelations, defaultKind: "group" })
|
|
70
80
|
), (isSystem || partOfDomainRelations.length > 0) && /* @__PURE__ */ React.createElement(
|
|
71
81
|
AboutField,
|
|
72
82
|
{
|
|
73
|
-
label: "
|
|
74
|
-
value: "
|
|
83
|
+
label: t("aboutCard.domainField.label"),
|
|
84
|
+
value: t("aboutCard.domainField.value"),
|
|
75
85
|
gridSizes: { xs: 12, sm: 6, lg: 4 }
|
|
76
86
|
},
|
|
77
87
|
partOfDomainRelations.length > 0 && /* @__PURE__ */ React.createElement(
|
|
@@ -84,8 +94,8 @@ function AboutContent(props) {
|
|
|
84
94
|
), (isAPI || isComponent || isResource || partOfSystemRelations.length > 0) && /* @__PURE__ */ React.createElement(
|
|
85
95
|
AboutField,
|
|
86
96
|
{
|
|
87
|
-
label: "
|
|
88
|
-
value: "
|
|
97
|
+
label: t("aboutCard.systemField.label"),
|
|
98
|
+
value: t("aboutCard.systemField.value"),
|
|
89
99
|
gridSizes: { xs: 12, sm: 6, lg: 4 }
|
|
90
100
|
},
|
|
91
101
|
partOfSystemRelations.length > 0 && /* @__PURE__ */ React.createElement(
|
|
@@ -98,8 +108,8 @@ function AboutContent(props) {
|
|
|
98
108
|
), isComponent && partOfComponentRelations.length > 0 && /* @__PURE__ */ React.createElement(
|
|
99
109
|
AboutField,
|
|
100
110
|
{
|
|
101
|
-
label: "
|
|
102
|
-
value: "
|
|
111
|
+
label: t("aboutCard.parentComponentField.label"),
|
|
112
|
+
value: t("aboutCard.parentComponentField.value"),
|
|
103
113
|
gridSizes: { xs: 12, sm: 6, lg: 4 }
|
|
104
114
|
},
|
|
105
115
|
/* @__PURE__ */ React.createElement(
|
|
@@ -112,39 +122,46 @@ function AboutContent(props) {
|
|
|
112
122
|
), (isAPI || isComponent || isResource || isTemplate || isGroup || isLocation || typeof entity?.spec?.type === "string") && /* @__PURE__ */ React.createElement(
|
|
113
123
|
AboutField,
|
|
114
124
|
{
|
|
115
|
-
label: "
|
|
125
|
+
label: t("aboutCard.typeField.label"),
|
|
116
126
|
value: entity?.spec?.type,
|
|
117
127
|
gridSizes: { xs: 12, sm: 6, lg: 4 }
|
|
118
128
|
}
|
|
119
129
|
), (isAPI || isComponent || typeof entity?.spec?.lifecycle === "string") && /* @__PURE__ */ React.createElement(
|
|
120
130
|
AboutField,
|
|
121
131
|
{
|
|
122
|
-
label: "
|
|
132
|
+
label: t("aboutCard.lifecycleField.label"),
|
|
123
133
|
value: entity?.spec?.lifecycle,
|
|
124
134
|
gridSizes: { xs: 12, sm: 6, lg: 4 }
|
|
125
135
|
}
|
|
126
136
|
), /* @__PURE__ */ React.createElement(
|
|
127
137
|
AboutField,
|
|
128
138
|
{
|
|
129
|
-
label: "
|
|
130
|
-
value: "
|
|
139
|
+
label: t("aboutCard.tagsField.label"),
|
|
140
|
+
value: t("aboutCard.tagsField.value"),
|
|
131
141
|
gridSizes: { xs: 12, sm: 6, lg: 4 }
|
|
132
142
|
},
|
|
133
|
-
(entity?.metadata?.tags || []).map((
|
|
134
|
-
), isLocation && (entity?.spec?.targets || entity?.spec?.target) && /* @__PURE__ */ React.createElement(
|
|
135
|
-
|
|
143
|
+
(entity?.metadata?.tags || []).map((tag) => /* @__PURE__ */ React.createElement(Chip, { key: tag, size: "small", label: tag }))
|
|
144
|
+
), isLocation && (entity?.spec?.targets || entity?.spec?.target) && /* @__PURE__ */ React.createElement(
|
|
145
|
+
AboutField,
|
|
136
146
|
{
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
)
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
147
|
+
label: t("aboutCard.targetsField.label"),
|
|
148
|
+
gridSizes: { xs: 12 }
|
|
149
|
+
},
|
|
150
|
+
/* @__PURE__ */ React.createElement(
|
|
151
|
+
LinksGridList,
|
|
152
|
+
{
|
|
153
|
+
cols: 1,
|
|
154
|
+
items: (entity.spec.targets || [entity.spec.target]).map((target) => target).map((target) => ({
|
|
155
|
+
text: target,
|
|
156
|
+
href: getLocationTargetHref(
|
|
157
|
+
target,
|
|
158
|
+
entity?.spec?.type || "unknown",
|
|
159
|
+
entitySourceLocation
|
|
160
|
+
)
|
|
161
|
+
}))
|
|
162
|
+
}
|
|
163
|
+
)
|
|
164
|
+
));
|
|
148
165
|
}
|
|
149
166
|
|
|
150
167
|
export { AboutContent };
|
|
@@ -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';\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 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 label=\"Description\" gridSizes={{ xs: 12 }}>\n <MarkdownContent\n className={classes.description}\n content={entity?.metadata?.description || 'No description'}\n />\n </AboutField>\n <AboutField\n label=\"Owner\"\n value=\"No Owner\"\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=\"Domain\"\n value=\"No Domain\"\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=\"System\"\n value=\"No System\"\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=\"Parent Component\"\n value=\"No Parent Component\"\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=\"Type\"\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=\"Lifecycle\"\n value={entity?.spec?.lifecycle as string}\n gridSizes={{ xs: 12, sm: 6, lg: 4 }}\n />\n )}\n <AboutField\n label=\"Tags\"\n value=\"No Tags\"\n gridSizes={{ xs: 12, sm: 6, lg: 4 }}\n >\n {(entity?.metadata?.tags || []).map(t => (\n <Chip key={t} size=\"small\" label={t} />\n ))}\n </AboutField>\n {isLocation && (entity?.spec?.targets || entity?.spec?.target) && (\n <AboutField label=\"Targets\" gridSizes={{ xs: 12 }}>\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?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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 '../../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,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,UACd,IAAM,EAAA,MAAA;AAAA,UACN,IAAM,EAAA,qBAAA;AAAA,YACJ,MAAA;AAAA,YACC,MAAA,EAAQ,MAAM,IAAQ,IAAA,SAAA;AAAA,YACvB,oBAAA;AAAA,WACF;AAAA,SACA,CAAA,CAAA;AAAA,OAAA;AAAA,KACN;AAAA,GAGN,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -23,7 +23,7 @@ function BaseCatalogPage(props) {
|
|
|
23
23
|
title: t("indexPage.createButtonTitle"),
|
|
24
24
|
to: createComponentLink && createComponentLink()
|
|
25
25
|
}
|
|
26
|
-
), /* @__PURE__ */ React.createElement(SupportButton, null, "
|
|
26
|
+
), /* @__PURE__ */ React.createElement(SupportButton, null, t("indexPage.supportButtonContent"))), /* @__PURE__ */ React.createElement(EntityListProvider, { pagination }, /* @__PURE__ */ React.createElement(CatalogFilterLayout, null, /* @__PURE__ */ React.createElement(CatalogFilterLayout.Filters, null, filters), /* @__PURE__ */ React.createElement(CatalogFilterLayout.Content, null, content)))));
|
|
27
27
|
}
|
|
28
28
|
function DefaultCatalogPage(props) {
|
|
29
29
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultCatalogPage.esm.js","sources":["../../../src/components/CatalogPage/DefaultCatalogPage.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 Content,\n ContentHeader,\n CreateButton,\n PageWithHeader,\n SupportButton,\n TableColumn,\n TableProps,\n} from '@backstage/core-components';\nimport { configApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport {\n CatalogFilterLayout,\n EntityListProvider,\n UserListFilterKind,\n EntityOwnerPickerProps,\n} from '@backstage/plugin-catalog-react';\nimport React, { ReactNode } from 'react';\nimport { createComponentRouteRef } from '../../routes';\nimport { CatalogTable, CatalogTableRow } from '../CatalogTable';\nimport { catalogTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\nimport { CatalogTableColumnsFunc } from '../CatalogTable/types';\nimport { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common/alpha';\nimport { usePermission } from '@backstage/plugin-permission-react';\nimport { DefaultFilters } from '@backstage/plugin-catalog-react';\n\n/** @internal */\nexport type BaseCatalogPageProps = {\n filters: ReactNode;\n content?: ReactNode;\n pagination?: boolean | { limit?: number };\n};\n\n/** @internal */\nexport function BaseCatalogPage(props: BaseCatalogPageProps) {\n const { filters, content = <CatalogTable />, pagination } = props;\n const orgName =\n useApi(configApiRef).getOptionalString('organization.name') ?? 'Backstage';\n const createComponentLink = useRouteRef(createComponentRouteRef);\n const { t } = useTranslationRef(catalogTranslationRef);\n const { allowed } = usePermission({\n permission: catalogEntityCreatePermission,\n });\n\n return (\n <PageWithHeader title={t('indexPage.title', { orgName })} themeId=\"home\">\n <Content>\n <ContentHeader title=\"\">\n {allowed && (\n <CreateButton\n title={t('indexPage.createButtonTitle')}\n to={createComponentLink && createComponentLink()}\n />\n )}\n <SupportButton>
|
|
1
|
+
{"version":3,"file":"DefaultCatalogPage.esm.js","sources":["../../../src/components/CatalogPage/DefaultCatalogPage.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 Content,\n ContentHeader,\n CreateButton,\n PageWithHeader,\n SupportButton,\n TableColumn,\n TableProps,\n} from '@backstage/core-components';\nimport { configApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport {\n CatalogFilterLayout,\n EntityListProvider,\n UserListFilterKind,\n EntityOwnerPickerProps,\n} from '@backstage/plugin-catalog-react';\nimport React, { ReactNode } from 'react';\nimport { createComponentRouteRef } from '../../routes';\nimport { CatalogTable, CatalogTableRow } from '../CatalogTable';\nimport { catalogTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\nimport { CatalogTableColumnsFunc } from '../CatalogTable/types';\nimport { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common/alpha';\nimport { usePermission } from '@backstage/plugin-permission-react';\nimport { DefaultFilters } from '@backstage/plugin-catalog-react';\n\n/** @internal */\nexport type BaseCatalogPageProps = {\n filters: ReactNode;\n content?: ReactNode;\n pagination?: boolean | { limit?: number };\n};\n\n/** @internal */\nexport function BaseCatalogPage(props: BaseCatalogPageProps) {\n const { filters, content = <CatalogTable />, pagination } = props;\n const orgName =\n useApi(configApiRef).getOptionalString('organization.name') ?? 'Backstage';\n const createComponentLink = useRouteRef(createComponentRouteRef);\n const { t } = useTranslationRef(catalogTranslationRef);\n const { allowed } = usePermission({\n permission: catalogEntityCreatePermission,\n });\n\n return (\n <PageWithHeader title={t('indexPage.title', { orgName })} themeId=\"home\">\n <Content>\n <ContentHeader title=\"\">\n {allowed && (\n <CreateButton\n title={t('indexPage.createButtonTitle')}\n to={createComponentLink && createComponentLink()}\n />\n )}\n <SupportButton>{t('indexPage.supportButtonContent')}</SupportButton>\n </ContentHeader>\n <EntityListProvider pagination={pagination}>\n <CatalogFilterLayout>\n <CatalogFilterLayout.Filters>{filters}</CatalogFilterLayout.Filters>\n <CatalogFilterLayout.Content>{content}</CatalogFilterLayout.Content>\n </CatalogFilterLayout>\n </EntityListProvider>\n </Content>\n </PageWithHeader>\n );\n}\n\n/**\n * Props for root catalog pages.\n *\n * @public\n */\nexport interface DefaultCatalogPageProps {\n initiallySelectedFilter?: UserListFilterKind;\n columns?: TableColumn<CatalogTableRow>[] | CatalogTableColumnsFunc;\n actions?: TableProps<CatalogTableRow>['actions'];\n initialKind?: string;\n tableOptions?: TableProps<CatalogTableRow>['options'];\n emptyContent?: ReactNode;\n ownerPickerMode?: EntityOwnerPickerProps['mode'];\n pagination?: boolean | { limit?: number };\n filters?: ReactNode;\n initiallySelectedNamespaces?: string[];\n}\n\nexport function DefaultCatalogPage(props: DefaultCatalogPageProps) {\n const {\n columns,\n actions,\n initiallySelectedFilter = 'owned',\n initialKind = 'component',\n tableOptions = {},\n emptyContent,\n pagination,\n ownerPickerMode,\n filters,\n initiallySelectedNamespaces,\n } = props;\n\n return (\n <BaseCatalogPage\n filters={\n filters ?? (\n <DefaultFilters\n initialKind={initialKind}\n initiallySelectedFilter={initiallySelectedFilter}\n ownerPickerMode={ownerPickerMode}\n initiallySelectedNamespaces={initiallySelectedNamespaces}\n />\n )\n }\n content={\n <CatalogTable\n columns={columns}\n actions={actions}\n tableOptions={tableOptions}\n emptyContent={emptyContent}\n />\n }\n pagination={pagination}\n />\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAmDO,SAAS,gBAAgB,KAA6B,EAAA;AAC3D,EAAA,MAAM,EAAE,OAAS,EAAA,OAAA,uCAAW,YAAa,EAAA,IAAA,CAAA,EAAI,YAAe,GAAA,KAAA,CAAA;AAC5D,EAAA,MAAM,UACJ,MAAO,CAAA,YAAY,CAAE,CAAA,iBAAA,CAAkB,mBAAmB,CAAK,IAAA,WAAA,CAAA;AACjE,EAAM,MAAA,mBAAA,GAAsB,YAAY,uBAAuB,CAAA,CAAA;AAC/D,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,qBAAqB,CAAA,CAAA;AACrD,EAAM,MAAA,EAAE,OAAQ,EAAA,GAAI,aAAc,C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,oBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,cAAA;AAAA,QAAA;AAAA,UACC,WAAA;AAAA,UACA,uBAAA;AAAA,UACA,eAAA;AAAA,UACA,2BAAA;AAAA,SAAA;AAAA,OACF;AAAA,MAGJ,OACE,kBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,YAAA;AAAA,QAAA;AAAA,UACC,OAAA;AAAA,UACA,OAAA;AAAA,UACA,YAAA;AAAA,UACA,YAAA;AAAA,SAAA;AAAA,OACF;AAAA,MAEF,UAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
|
|
@@ -7,6 +7,8 @@ import Typography from '@material-ui/core/Typography';
|
|
|
7
7
|
import { makeStyles } from '@material-ui/core/styles';
|
|
8
8
|
import { Link } from '@backstage/core-components';
|
|
9
9
|
import { HighlightedSearchResultText } from '@backstage/plugin-search-react';
|
|
10
|
+
import { catalogTranslationRef } from '../../translation.esm.js';
|
|
11
|
+
import { useTranslationRef } from '@backstage/frontend-plugin-api';
|
|
10
12
|
|
|
11
13
|
const useStyles = makeStyles(
|
|
12
14
|
{
|
|
@@ -28,6 +30,7 @@ function CatalogSearchResultListItem(props) {
|
|
|
28
30
|
const result = props.result;
|
|
29
31
|
const highlight = props.highlight;
|
|
30
32
|
const classes = useStyles();
|
|
33
|
+
const { t } = useTranslationRef(catalogTranslationRef);
|
|
31
34
|
if (!result) return null;
|
|
32
35
|
return /* @__PURE__ */ React.createElement("div", { className: classes.item }, props.icon && /* @__PURE__ */ React.createElement(ListItemIcon, null, typeof props.icon === "function" ? props.icon(result) : props.icon), /* @__PURE__ */ React.createElement("div", { className: classes.flexContainer }, /* @__PURE__ */ React.createElement(
|
|
33
36
|
ListItemText,
|
|
@@ -65,7 +68,19 @@ function CatalogSearchResultListItem(props) {
|
|
|
65
68
|
) : result.text
|
|
66
69
|
)
|
|
67
70
|
}
|
|
68
|
-
), /* @__PURE__ */ React.createElement(Box, null, result.kind && /* @__PURE__ */ React.createElement(Chip, { label: `Kind: ${result.kind}`, size: "small" }), result.type && /* @__PURE__ */ React.createElement(Chip, { label: `Type: ${result.type}`, size: "small" }), result.lifecycle && /* @__PURE__ */ React.createElement(
|
|
71
|
+
), /* @__PURE__ */ React.createElement(Box, null, result.kind && /* @__PURE__ */ React.createElement(Chip, { label: `Kind: ${result.kind}`, size: "small" }), result.type && /* @__PURE__ */ React.createElement(Chip, { label: `Type: ${result.type}`, size: "small" }), result.lifecycle && /* @__PURE__ */ React.createElement(
|
|
72
|
+
Chip,
|
|
73
|
+
{
|
|
74
|
+
label: `${t("searchResultItem.lifecycle")}: ${result.lifecycle}`,
|
|
75
|
+
size: "small"
|
|
76
|
+
}
|
|
77
|
+
), result.owner && /* @__PURE__ */ React.createElement(
|
|
78
|
+
Chip,
|
|
79
|
+
{
|
|
80
|
+
label: `${t("searchResultItem.Owner")}: ${result.owner}`,
|
|
81
|
+
size: "small"
|
|
82
|
+
}
|
|
83
|
+
))));
|
|
69
84
|
}
|
|
70
85
|
|
|
71
86
|
export { CatalogSearchResultListItem };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CatalogSearchResultListItem.esm.js","sources":["../../../src/components/CatalogSearchResultListItem/CatalogSearchResultListItem.tsx"],"sourcesContent":["/*\n * Copyright 2021 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, { ReactNode } from 'react';\nimport Box from '@material-ui/core/Box';\nimport Chip from '@material-ui/core/Chip';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { Link } from '@backstage/core-components';\nimport {\n IndexableDocument,\n ResultHighlight,\n} from '@backstage/plugin-search-common';\nimport { HighlightedSearchResultText } from '@backstage/plugin-search-react';\n\nconst useStyles = makeStyles(\n {\n item: {\n display: 'flex',\n },\n flexContainer: {\n flexWrap: 'wrap',\n },\n itemText: {\n width: '100%',\n wordBreak: 'break-all',\n marginBottom: '1rem',\n },\n },\n { name: 'CatalogSearchResultListItem' },\n);\n\n/**\n * Props for {@link CatalogSearchResultListItem}.\n *\n * @public\n */\nexport interface CatalogSearchResultListItemProps {\n icon?: ReactNode | ((result: IndexableDocument) => ReactNode);\n result?: IndexableDocument;\n highlight?: ResultHighlight;\n rank?: number;\n lineClamp?: number;\n}\n\n/** @public */\nexport function CatalogSearchResultListItem(\n props: CatalogSearchResultListItemProps,\n) {\n const result = props.result as any;\n const highlight = props.highlight as ResultHighlight;\n\n const classes = useStyles();\n\n if (!result) return null;\n\n return (\n <div className={classes.item}>\n {props.icon && (\n <ListItemIcon>\n {typeof props.icon === 'function' ? props.icon(result) : props.icon}\n </ListItemIcon>\n )}\n <div className={classes.flexContainer}>\n <ListItemText\n className={classes.itemText}\n primaryTypographyProps={{ variant: 'h6' }}\n primary={\n <Link noTrack to={result.location}>\n {highlight?.fields.title ? (\n <HighlightedSearchResultText\n text={highlight.fields.title}\n preTag={highlight.preTag}\n postTag={highlight.postTag}\n />\n ) : (\n result.title\n )}\n </Link>\n }\n secondary={\n <Typography\n component=\"span\"\n style={{\n display: '-webkit-box',\n WebkitBoxOrient: 'vertical',\n WebkitLineClamp: props.lineClamp,\n overflow: 'hidden',\n }}\n color=\"textSecondary\"\n variant=\"body2\"\n >\n {highlight?.fields.text ? (\n <HighlightedSearchResultText\n text={highlight.fields.text}\n preTag={highlight.preTag}\n postTag={highlight.postTag}\n />\n ) : (\n result.text\n )}\n </Typography>\n }\n />\n <Box>\n {result.kind && <Chip label={`Kind: ${result.kind}`} size=\"small\" />}\n {result.type && <Chip label={`Type: ${result.type}`} size=\"small\" />}\n {result.lifecycle && (\n <Chip
|
|
1
|
+
{"version":3,"file":"CatalogSearchResultListItem.esm.js","sources":["../../../src/components/CatalogSearchResultListItem/CatalogSearchResultListItem.tsx"],"sourcesContent":["/*\n * Copyright 2021 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, { ReactNode } from 'react';\nimport Box from '@material-ui/core/Box';\nimport Chip from '@material-ui/core/Chip';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { Link } from '@backstage/core-components';\nimport {\n IndexableDocument,\n ResultHighlight,\n} from '@backstage/plugin-search-common';\nimport { HighlightedSearchResultText } from '@backstage/plugin-search-react';\nimport { catalogTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\n\nconst useStyles = makeStyles(\n {\n item: {\n display: 'flex',\n },\n flexContainer: {\n flexWrap: 'wrap',\n },\n itemText: {\n width: '100%',\n wordBreak: 'break-all',\n marginBottom: '1rem',\n },\n },\n { name: 'CatalogSearchResultListItem' },\n);\n\n/**\n * Props for {@link CatalogSearchResultListItem}.\n *\n * @public\n */\nexport interface CatalogSearchResultListItemProps {\n icon?: ReactNode | ((result: IndexableDocument) => ReactNode);\n result?: IndexableDocument;\n highlight?: ResultHighlight;\n rank?: number;\n lineClamp?: number;\n}\n\n/** @public */\nexport function CatalogSearchResultListItem(\n props: CatalogSearchResultListItemProps,\n) {\n const result = props.result as any;\n const highlight = props.highlight as ResultHighlight;\n\n const classes = useStyles();\n const { t } = useTranslationRef(catalogTranslationRef);\n\n if (!result) return null;\n\n return (\n <div className={classes.item}>\n {props.icon && (\n <ListItemIcon>\n {typeof props.icon === 'function' ? props.icon(result) : props.icon}\n </ListItemIcon>\n )}\n <div className={classes.flexContainer}>\n <ListItemText\n className={classes.itemText}\n primaryTypographyProps={{ variant: 'h6' }}\n primary={\n <Link noTrack to={result.location}>\n {highlight?.fields.title ? (\n <HighlightedSearchResultText\n text={highlight.fields.title}\n preTag={highlight.preTag}\n postTag={highlight.postTag}\n />\n ) : (\n result.title\n )}\n </Link>\n }\n secondary={\n <Typography\n component=\"span\"\n style={{\n display: '-webkit-box',\n WebkitBoxOrient: 'vertical',\n WebkitLineClamp: props.lineClamp,\n overflow: 'hidden',\n }}\n color=\"textSecondary\"\n variant=\"body2\"\n >\n {highlight?.fields.text ? (\n <HighlightedSearchResultText\n text={highlight.fields.text}\n preTag={highlight.preTag}\n postTag={highlight.postTag}\n />\n ) : (\n result.text\n )}\n </Typography>\n }\n />\n <Box>\n {result.kind && <Chip label={`Kind: ${result.kind}`} size=\"small\" />}\n {result.type && <Chip label={`Type: ${result.type}`} size=\"small\" />}\n {result.lifecycle && (\n <Chip\n label={`${t('searchResultItem.lifecycle')}: ${result.lifecycle}`}\n size=\"small\"\n />\n )}\n {result.owner && (\n <Chip\n label={`${t('searchResultItem.Owner')}: ${result.owner}`}\n size=\"small\"\n />\n )}\n </Box>\n </div>\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAgCA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB;AAAA,IACE,IAAM,EAAA;AAAA,MACJ,OAAS,EAAA,MAAA;AAAA,KACX;AAAA,IACA,aAAe,EAAA;AAAA,MACb,QAAU,EAAA,MAAA;AAAA,KACZ;AAAA,IACA,QAAU,EAAA;AAAA,MACR,KAAO,EAAA,MAAA;AAAA,MACP,SAAW,EAAA,WAAA;AAAA,MACX,YAAc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