@backstage/plugin-catalog 1.7.2-next.2 → 1.7.2
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 +20 -0
- package/dist/esm/{index-a35287f3.esm.js → index-05290c15.esm.js} +116 -23
- package/dist/esm/index-05290c15.esm.js.map +1 -0
- package/dist/esm/{index-7c56b986.esm.js → index-07f33109.esm.js} +2 -2
- package/dist/esm/{index-7c56b986.esm.js.map → index-07f33109.esm.js.map} +1 -1
- package/dist/esm/{index-fca8b31f.esm.js → index-2c3b0303.esm.js} +2 -2
- package/dist/esm/index-2c3b0303.esm.js.map +1 -0
- package/dist/esm/index-75a7574f.esm.js +31 -0
- package/dist/esm/index-75a7574f.esm.js.map +1 -0
- package/dist/esm/{index-3255f83f.esm.js → index-eb346a82.esm.js} +2 -2
- package/dist/esm/{index-3255f83f.esm.js.map → index-eb346a82.esm.js.map} +1 -1
- package/dist/index.d.ts +17 -1
- package/dist/index.esm.js +1 -1
- package/package.json +15 -15
- package/dist/esm/index-a35287f3.esm.js.map +0 -1
- package/dist/esm/index-fca8b31f.esm.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @backstage/plugin-catalog
|
|
2
2
|
|
|
3
|
+
## 1.7.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- cebe24ef1d: Add `EntityLabelsCard` to show the labels for an entity.
|
|
8
|
+
- 5353b4df61: There is now tooltip in the entity context menu
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
- @backstage/catalog-model@1.1.5
|
|
11
|
+
- @backstage/catalog-client@1.3.0
|
|
12
|
+
- @backstage/plugin-catalog-react@1.2.4
|
|
13
|
+
- @backstage/core-components@0.12.3
|
|
14
|
+
- @backstage/plugin-search-react@1.4.0
|
|
15
|
+
- @backstage/core-plugin-api@1.3.0
|
|
16
|
+
- @backstage/errors@1.1.4
|
|
17
|
+
- @backstage/integration-react@1.1.9
|
|
18
|
+
- @backstage/theme@0.2.16
|
|
19
|
+
- @backstage/types@1.0.2
|
|
20
|
+
- @backstage/plugin-catalog-common@1.0.10
|
|
21
|
+
- @backstage/plugin-search-common@1.2.1
|
|
22
|
+
|
|
3
23
|
## 1.7.2-next.2
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import ObservableImpl from 'zen-observable';
|
|
2
2
|
import { stringifyEntityRef, RELATION_PART_OF, RELATION_OWNED_BY, getEntitySourceLocation, ANNOTATION_EDIT_URL, DEFAULT_NAMESPACE, ANNOTATION_LOCATION, ANNOTATION_VIEW_URL } from '@backstage/catalog-model';
|
|
3
3
|
import { isArray, isString, capitalize } from 'lodash';
|
|
4
|
-
import { Link, HeaderIconLinkRow, OverflowTooltip, WarningPanel, CodeSnippet, Table, Page, Header, Progress, RoutedTabs, Content, HeaderLabel, ResponseErrorPanel } from '@backstage/core-components';
|
|
4
|
+
import { Link, HeaderIconLinkRow, OverflowTooltip, WarningPanel, CodeSnippet, Table, Page, Header, Progress, RoutedTabs, Content, HeaderLabel, ResponseErrorPanel, InfoCard } from '@backstage/core-components';
|
|
5
5
|
import { createExternalRouteRef, createRouteRef, useElementFilter, useApi, alertApiRef, errorApiRef, useRouteRef, useAnalytics, attachComponentData, useRouteRefParams, useApiHolder, createPlugin, createApiFactory, discoveryApiRef, fetchApiRef, storageApiRef, createRoutableExtension, createComponentExtension } from '@backstage/core-plugin-api';
|
|
6
6
|
import { scmIntegrationsApiRef, ScmIntegrationIcon } from '@backstage/integration-react';
|
|
7
7
|
import { getEntityRelations, EntityRefLinks, useEntity, catalogApiRef, getEntitySourceLocation as getEntitySourceLocation$1, useEntityList, EntityKindFilter, EntityRefLink, humanizeEntityRef, useStarredEntities, useEntityPermission, entityRouteRef, useAsyncEntity, UnregisterEntityDialog, InspectEntityDialog, FavoriteEntity, CatalogFilterLayout, starredEntitiesApiRef } from '@backstage/plugin-catalog-react';
|
|
8
|
-
import { makeStyles, Typography, Grid, Box, useMediaQuery, ImageList, ImageListItem, Chip, Card, CardHeader, IconButton, Divider, CardContent, createStyles, Select, InputBase, MenuItem, ListItem, ListItemIcon, ListItemText, Popover, MenuList, Dialog, DialogTitle, DialogActions, Button } from '@material-ui/core';
|
|
8
|
+
import { makeStyles, Typography, Grid, Box, useMediaQuery, ImageList, ImageListItem, Chip, Card, CardHeader, IconButton, Divider, CardContent, createStyles, Select, InputBase, MenuItem, ListItem, ListItemIcon, ListItemText, Tooltip, Popover, MenuList, Dialog, DialogTitle, DialogActions, Button } from '@material-ui/core';
|
|
9
9
|
import CachedIcon from '@material-ui/icons/Cached';
|
|
10
10
|
import DocsIcon from '@material-ui/icons/Description';
|
|
11
11
|
import EditIcon from '@material-ui/icons/Edit';
|
|
@@ -106,7 +106,7 @@ const rootRouteRef = createRouteRef({
|
|
|
106
106
|
id: "catalog"
|
|
107
107
|
});
|
|
108
108
|
|
|
109
|
-
const useStyles$
|
|
109
|
+
const useStyles$8 = makeStyles((theme) => ({
|
|
110
110
|
value: {
|
|
111
111
|
fontWeight: "bold",
|
|
112
112
|
overflow: "hidden",
|
|
@@ -125,13 +125,13 @@ const useStyles$6 = makeStyles((theme) => ({
|
|
|
125
125
|
}));
|
|
126
126
|
function AboutField(props) {
|
|
127
127
|
const { label, value, gridSizes, children } = props;
|
|
128
|
-
const classes = useStyles$
|
|
128
|
+
const classes = useStyles$8();
|
|
129
129
|
const childElements = useElementFilter(children, (c) => c.getElements());
|
|
130
130
|
const content = childElements.length > 0 ? childElements : /* @__PURE__ */ React.createElement(Typography, { variant: "body2", className: classes.value }, value || `unknown`);
|
|
131
131
|
return /* @__PURE__ */ React.createElement(Grid, { item: true, ...gridSizes }, /* @__PURE__ */ React.createElement(Typography, { variant: "h2", className: classes.label }, label), content);
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
const useStyles$
|
|
134
|
+
const useStyles$7 = makeStyles({
|
|
135
135
|
svgIcon: {
|
|
136
136
|
display: "inline-block",
|
|
137
137
|
"& svg": {
|
|
@@ -143,7 +143,7 @@ const useStyles$5 = makeStyles({
|
|
|
143
143
|
});
|
|
144
144
|
function IconLink(props) {
|
|
145
145
|
const { href, text, Icon } = props;
|
|
146
|
-
const classes = useStyles$
|
|
146
|
+
const classes = useStyles$7();
|
|
147
147
|
return /* @__PURE__ */ React.createElement(Box, { display: "flex" }, /* @__PURE__ */ React.createElement(Box, { mr: 1, className: classes.svgIcon }, /* @__PURE__ */ React.createElement(Typography, { component: "div" }, Icon ? /* @__PURE__ */ React.createElement(Icon, null) : /* @__PURE__ */ React.createElement(LanguageIcon, null))), /* @__PURE__ */ React.createElement(Box, { flexGrow: "1" }, /* @__PURE__ */ React.createElement(Link, { to: href, target: "_blank", rel: "noopener" }, text || href)));
|
|
148
148
|
}
|
|
149
149
|
|
|
@@ -179,7 +179,7 @@ function LinksGridList(props) {
|
|
|
179
179
|
return /* @__PURE__ */ React.createElement(ImageList, { rowHeight: "auto", cols: numOfCols }, items.map(({ text, href, Icon }, i) => /* @__PURE__ */ React.createElement(ImageListItem, { key: i }, /* @__PURE__ */ React.createElement(IconLink, { href, text: text != null ? text : href, Icon }))));
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
const useStyles$
|
|
182
|
+
const useStyles$6 = makeStyles({
|
|
183
183
|
description: {
|
|
184
184
|
wordBreak: "break-word"
|
|
185
185
|
}
|
|
@@ -197,7 +197,7 @@ function getLocationTargetHref(target, type, entitySourceLocation) {
|
|
|
197
197
|
function AboutContent(props) {
|
|
198
198
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
199
199
|
const { entity } = props;
|
|
200
|
-
const classes = useStyles$
|
|
200
|
+
const classes = useStyles$6();
|
|
201
201
|
const isSystem = entity.kind.toLocaleLowerCase("en-US") === "system";
|
|
202
202
|
const isResource = entity.kind.toLocaleLowerCase("en-US") === "resource";
|
|
203
203
|
const isComponent = entity.kind.toLocaleLowerCase("en-US") === "component";
|
|
@@ -316,7 +316,7 @@ function AboutContent(props) {
|
|
|
316
316
|
)));
|
|
317
317
|
}
|
|
318
318
|
|
|
319
|
-
const useStyles$
|
|
319
|
+
const useStyles$5 = makeStyles({
|
|
320
320
|
gridItemCard: {
|
|
321
321
|
display: "flex",
|
|
322
322
|
flexDirection: "column",
|
|
@@ -339,7 +339,7 @@ const useStyles$3 = makeStyles({
|
|
|
339
339
|
function AboutCard(props) {
|
|
340
340
|
var _a, _b, _c;
|
|
341
341
|
const { variant } = props;
|
|
342
|
-
const classes = useStyles$
|
|
342
|
+
const classes = useStyles$5();
|
|
343
343
|
const { entity } = useEntity();
|
|
344
344
|
const scmIntegrationsApi = useApi(scmIntegrationsApiRef);
|
|
345
345
|
const catalogApi = useApi(catalogApiRef);
|
|
@@ -453,7 +453,7 @@ function filterKinds(allKinds, allowedKinds, forcedKinds) {
|
|
|
453
453
|
return kindsMap;
|
|
454
454
|
}
|
|
455
455
|
|
|
456
|
-
const useStyles$
|
|
456
|
+
const useStyles$4 = makeStyles(
|
|
457
457
|
(theme) => createStyles({
|
|
458
458
|
root: {
|
|
459
459
|
...theme.typography.h4
|
|
@@ -463,7 +463,7 @@ const useStyles$2 = makeStyles(
|
|
|
463
463
|
function CatalogKindHeader(props) {
|
|
464
464
|
var _a, _b;
|
|
465
465
|
const { initialFilter = "component", allowedKinds } = props;
|
|
466
|
-
const classes = useStyles$
|
|
466
|
+
const classes = useStyles$4();
|
|
467
467
|
const { allKinds } = useAllKinds();
|
|
468
468
|
const {
|
|
469
469
|
filters,
|
|
@@ -506,7 +506,7 @@ function CatalogKindHeader(props) {
|
|
|
506
506
|
);
|
|
507
507
|
}
|
|
508
508
|
|
|
509
|
-
const useStyles$
|
|
509
|
+
const useStyles$3 = makeStyles({
|
|
510
510
|
flexContainer: {
|
|
511
511
|
flexWrap: "wrap"
|
|
512
512
|
},
|
|
@@ -519,7 +519,7 @@ const useStyles$1 = makeStyles({
|
|
|
519
519
|
function CatalogSearchResultListItem(props) {
|
|
520
520
|
const result = props.result;
|
|
521
521
|
const highlight = props.highlight;
|
|
522
|
-
const classes = useStyles$
|
|
522
|
+
const classes = useStyles$3();
|
|
523
523
|
const analytics = useAnalytics();
|
|
524
524
|
const handleClick = () => {
|
|
525
525
|
analytics.captureEvent("discover", result.title, {
|
|
@@ -883,7 +883,7 @@ function UnregisterEntity(props) {
|
|
|
883
883
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, unregisterButton);
|
|
884
884
|
}
|
|
885
885
|
|
|
886
|
-
const useStyles = makeStyles$1(
|
|
886
|
+
const useStyles$2 = makeStyles$1(
|
|
887
887
|
(theme) => {
|
|
888
888
|
return {
|
|
889
889
|
button: {
|
|
@@ -901,7 +901,7 @@ function EntityContextMenu(props) {
|
|
|
901
901
|
onInspectEntity
|
|
902
902
|
} = props;
|
|
903
903
|
const [anchorEl, setAnchorEl] = useState();
|
|
904
|
-
const classes = useStyles();
|
|
904
|
+
const classes = useStyles$2();
|
|
905
905
|
const unregisterPermission = useEntityPermission(
|
|
906
906
|
catalogEntityDeletePermission
|
|
907
907
|
);
|
|
@@ -931,7 +931,7 @@ function EntityContextMenu(props) {
|
|
|
931
931
|
)),
|
|
932
932
|
/* @__PURE__ */ React.createElement(Divider, { key: "the divider is here!" })
|
|
933
933
|
];
|
|
934
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
934
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Tooltip, { title: "More", arrow: true }, /* @__PURE__ */ React.createElement(
|
|
935
935
|
IconButton,
|
|
936
936
|
{
|
|
937
937
|
"aria-label": "more",
|
|
@@ -945,7 +945,7 @@ function EntityContextMenu(props) {
|
|
|
945
945
|
id: "long-menu"
|
|
946
946
|
},
|
|
947
947
|
/* @__PURE__ */ React.createElement(MoreVert, null)
|
|
948
|
-
), /* @__PURE__ */ React.createElement(
|
|
948
|
+
)), /* @__PURE__ */ React.createElement(
|
|
949
949
|
Popover,
|
|
950
950
|
{
|
|
951
951
|
open: Boolean(anchorEl),
|
|
@@ -1315,6 +1315,91 @@ const FilteredEntityLayout = CatalogFilterLayout;
|
|
|
1315
1315
|
const FilterContainer = CatalogFilterLayout.Filters;
|
|
1316
1316
|
const EntityListContainer = CatalogFilterLayout.Content;
|
|
1317
1317
|
|
|
1318
|
+
const ENTITY_YAML = `metadata:
|
|
1319
|
+
name: example
|
|
1320
|
+
labels:
|
|
1321
|
+
javaVersion: 1.2.3`;
|
|
1322
|
+
const useStyles$1 = makeStyles(
|
|
1323
|
+
(theme) => ({
|
|
1324
|
+
code: {
|
|
1325
|
+
borderRadius: 6,
|
|
1326
|
+
margin: `${theme.spacing(2)}px 0px`,
|
|
1327
|
+
background: theme.palette.type === "dark" ? "#444" : "#fff"
|
|
1328
|
+
}
|
|
1329
|
+
}),
|
|
1330
|
+
{ name: "PluginCatalogEntityLabelsEmptyState" }
|
|
1331
|
+
);
|
|
1332
|
+
function EntityLabelsEmptyState() {
|
|
1333
|
+
const classes = useStyles$1();
|
|
1334
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { variant: "body1" }, "No labels defined for this entity. You can add labels to your entity YAML as shown in the highlighted example below:"), /* @__PURE__ */ React.createElement("div", { className: classes.code }, /* @__PURE__ */ React.createElement(
|
|
1335
|
+
CodeSnippet,
|
|
1336
|
+
{
|
|
1337
|
+
text: ENTITY_YAML,
|
|
1338
|
+
language: "yaml",
|
|
1339
|
+
showLineNumbers: true,
|
|
1340
|
+
highlightedNumbers: [3, 4, 5, 6],
|
|
1341
|
+
customStyle: { background: "inherit", fontSize: "115%" }
|
|
1342
|
+
}
|
|
1343
|
+
)), /* @__PURE__ */ React.createElement(
|
|
1344
|
+
Button,
|
|
1345
|
+
{
|
|
1346
|
+
variant: "contained",
|
|
1347
|
+
color: "primary",
|
|
1348
|
+
target: "_blank",
|
|
1349
|
+
href: "https://backstage.io/docs/features/software-catalog/descriptor-format#labels-optional"
|
|
1350
|
+
},
|
|
1351
|
+
"Read more"
|
|
1352
|
+
));
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
const useStyles = makeStyles((_) => ({
|
|
1356
|
+
key: {
|
|
1357
|
+
fontWeight: "bold"
|
|
1358
|
+
}
|
|
1359
|
+
}));
|
|
1360
|
+
const EntityLabelsCard$1 = (props) => {
|
|
1361
|
+
var _a;
|
|
1362
|
+
const { variant, title } = props;
|
|
1363
|
+
const { entity } = useEntity();
|
|
1364
|
+
const classes = useStyles();
|
|
1365
|
+
const columns = [
|
|
1366
|
+
{
|
|
1367
|
+
render: (row) => {
|
|
1368
|
+
return /* @__PURE__ */ React.createElement(Typography, { className: classes.key, variant: "body2" }, row.key);
|
|
1369
|
+
}
|
|
1370
|
+
},
|
|
1371
|
+
{
|
|
1372
|
+
field: "value"
|
|
1373
|
+
}
|
|
1374
|
+
];
|
|
1375
|
+
const labels = (_a = entity == null ? void 0 : entity.metadata) == null ? void 0 : _a.labels;
|
|
1376
|
+
return /* @__PURE__ */ React.createElement(InfoCard, { title: title || "Labels", variant }, !labels || Object.keys(labels).length === 0 ? /* @__PURE__ */ React.createElement(EntityLabelsEmptyState, null) : /* @__PURE__ */ React.createElement(
|
|
1377
|
+
Table,
|
|
1378
|
+
{
|
|
1379
|
+
columns,
|
|
1380
|
+
data: Object.keys(labels).map((labelKey) => ({
|
|
1381
|
+
key: labelKey,
|
|
1382
|
+
value: labels[labelKey]
|
|
1383
|
+
})),
|
|
1384
|
+
options: {
|
|
1385
|
+
search: false,
|
|
1386
|
+
showTitle: true,
|
|
1387
|
+
loadingType: "linear",
|
|
1388
|
+
header: false,
|
|
1389
|
+
padding: "dense",
|
|
1390
|
+
pageSize: 5,
|
|
1391
|
+
toolbar: false,
|
|
1392
|
+
paging: Object.keys(labels).length > 5
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
));
|
|
1396
|
+
};
|
|
1397
|
+
|
|
1398
|
+
function hasLabels(entity) {
|
|
1399
|
+
var _a, _b;
|
|
1400
|
+
return ((_a = entity == null ? void 0 : entity.metadata) == null ? void 0 : _a.labels) ? Object.keys((_b = entity == null ? void 0 : entity.metadata) == null ? void 0 : _b.labels).some(Boolean) : false;
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1318
1403
|
const catalogPlugin = createPlugin({
|
|
1319
1404
|
id: "catalog",
|
|
1320
1405
|
apis: [
|
|
@@ -1350,7 +1435,7 @@ const catalogPlugin = createPlugin({
|
|
|
1350
1435
|
const CatalogIndexPage = catalogPlugin.provide(
|
|
1351
1436
|
createRoutableExtension({
|
|
1352
1437
|
name: "CatalogIndexPage",
|
|
1353
|
-
component: () => import('./index-
|
|
1438
|
+
component: () => import('./index-eb346a82.esm.js').then((m) => m.CatalogPage),
|
|
1354
1439
|
mountPoint: rootRouteRef
|
|
1355
1440
|
})
|
|
1356
1441
|
);
|
|
@@ -1365,7 +1450,7 @@ const EntityAboutCard = catalogPlugin.provide(
|
|
|
1365
1450
|
createComponentExtension({
|
|
1366
1451
|
name: "EntityAboutCard",
|
|
1367
1452
|
component: {
|
|
1368
|
-
lazy: () => import('./index-
|
|
1453
|
+
lazy: () => import('./index-2c3b0303.esm.js').then((m) => m.AboutCard)
|
|
1369
1454
|
}
|
|
1370
1455
|
})
|
|
1371
1456
|
);
|
|
@@ -1373,7 +1458,15 @@ const EntityLinksCard = catalogPlugin.provide(
|
|
|
1373
1458
|
createComponentExtension({
|
|
1374
1459
|
name: "EntityLinksCard",
|
|
1375
1460
|
component: {
|
|
1376
|
-
lazy: () => import('./index-
|
|
1461
|
+
lazy: () => import('./index-07f33109.esm.js').then((m) => m.EntityLinksCard)
|
|
1462
|
+
}
|
|
1463
|
+
})
|
|
1464
|
+
);
|
|
1465
|
+
const EntityLabelsCard = catalogPlugin.provide(
|
|
1466
|
+
createComponentExtension({
|
|
1467
|
+
name: "EntityLabelsCard",
|
|
1468
|
+
component: {
|
|
1469
|
+
lazy: () => import('./index-75a7574f.esm.js').then((m) => m.EntityLabelsCard)
|
|
1377
1470
|
}
|
|
1378
1471
|
})
|
|
1379
1472
|
);
|
|
@@ -1452,5 +1545,5 @@ const RelatedEntitiesCard = catalogPlugin.provide(
|
|
|
1452
1545
|
})
|
|
1453
1546
|
);
|
|
1454
1547
|
|
|
1455
|
-
export { AboutCard as A,
|
|
1456
|
-
//# sourceMappingURL=index-
|
|
1548
|
+
export { AboutCard as A, isNamespace as B, CatalogTable as C, DefaultStarredEntitiesApi as D, EntityLabelsCard$1 as E, isComponentType as F, FilteredEntityLayout as G, FilterContainer as H, EntityListContainer as I, LinksGridList as L, RelatedEntitiesCard as R, AboutContent as a, AboutField as b, createComponentRouteRef as c, CatalogEntityPage as d, CatalogIndexPage as e, catalogPlugin as f, EntityAboutCard as g, hasLabels as h, EntityDependencyOfComponentsCard as i, EntityDependsOnComponentsCard as j, EntityDependsOnResourcesCard as k, EntityHasComponentsCard as l, EntityHasResourcesCard as m, EntityHasSubcomponentsCard as n, EntityHasSystemsCard as o, EntityLinksCard as p, EntityLabelsCard as q, CatalogKindHeader as r, CatalogSearchResultListItem as s, EntityLayout as t, EntityOrphanWarning as u, isOrphan as v, EntityProcessingErrorsPanel as w, hasCatalogProcessingErrors as x, EntitySwitch as y, isKind as z };
|
|
1549
|
+
//# sourceMappingURL=index-05290c15.esm.js.map
|