@backstage/plugin-catalog-react 1.9.3 → 1.9.4-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 CHANGED
@@ -1,5 +1,43 @@
1
1
  # @backstage/plugin-catalog-react
2
2
 
3
+ ## 1.9.4-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @backstage/frontend-plugin-api@0.6.0-next.1
9
+ - @backstage/core-components@0.14.0-next.0
10
+ - @backstage/catalog-model@1.4.4-next.0
11
+ - @backstage/catalog-client@1.6.0-next.1
12
+ - @backstage/core-plugin-api@1.8.3-next.0
13
+ - @backstage/integration-react@1.1.24-next.0
14
+ - @backstage/errors@1.2.3
15
+ - @backstage/types@1.1.1
16
+ - @backstage/version-bridge@1.0.7
17
+ - @backstage/plugin-catalog-common@1.0.21-next.0
18
+ - @backstage/plugin-permission-common@0.7.12
19
+ - @backstage/plugin-permission-react@0.4.20-next.0
20
+
21
+ ## 1.9.4-next.0
22
+
23
+ ### Patch Changes
24
+
25
+ - 916da47: Change default icon for unknown entities to nothing instead of the help icon.
26
+ - 71c6d7a: Overflowing labels in OwnerPicker (Catalog) are now truncated. Hovering over them shows the full label
27
+ - Updated dependencies
28
+ - @backstage/frontend-plugin-api@0.5.1-next.0
29
+ - @backstage/catalog-client@1.6.0-next.0
30
+ - @backstage/core-components@0.13.10
31
+ - @backstage/catalog-model@1.4.3
32
+ - @backstage/core-plugin-api@1.8.2
33
+ - @backstage/errors@1.2.3
34
+ - @backstage/integration-react@1.1.23
35
+ - @backstage/types@1.1.1
36
+ - @backstage/version-bridge@1.0.7
37
+ - @backstage/plugin-catalog-common@1.0.20
38
+ - @backstage/plugin-permission-common@0.7.12
39
+ - @backstage/plugin-permission-react@0.4.19
40
+
3
41
  ## 1.9.3
4
42
 
5
43
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-react",
3
- "version": "1.9.3",
3
+ "version": "1.9.4-next.1",
4
4
  "main": "../dist/alpha.esm.js",
5
5
  "module": "../dist/alpha.esm.js",
6
6
  "types": "../dist/alpha.d.ts"
package/dist/index.esm.js CHANGED
@@ -4,7 +4,7 @@ import { stringifyEntityRef, DEFAULT_NAMESPACE, ANNOTATION_SOURCE_LOCATION, pars
4
4
  import get from 'lodash/get';
5
5
  import React, { useState, useEffect, useMemo, createContext, useCallback, useContext, useRef, memo, forwardRef, useLayoutEffect, Fragment } from 'react';
6
6
  import ObservableImpl from 'zen-observable';
7
- import { Grid, useMediaQuery, useTheme, Button, Drawer, Box, Typography, FormControlLabel, Checkbox, makeStyles, TextField, Tooltip, IconButton, Card, CardContent, Chip, CardActions, Toolbar, FormControl, Input, InputAdornment, withStyles, DialogContentText, ListItemText as ListItemText$1, ListSubheader as ListSubheader$1, ListItem, ListItemIcon, List, ListItemSecondaryAction, Dialog, DialogTitle, DialogContent, Tabs, Tab, DialogActions, Divider, MenuItem } from '@material-ui/core';
7
+ import { Grid, useMediaQuery, useTheme, Button, Drawer, Box, Typography, FormControlLabel, Checkbox, makeStyles, TextField, Tooltip, IconButton, Card, CardContent, Chip, CardActions, Toolbar, FormControl, Input, InputAdornment, withStyles as withStyles$1, DialogContentText, ListItemText as ListItemText$1, ListSubheader as ListSubheader$1, ListItem, ListItemIcon, List, ListItemSecondaryAction, Dialog, DialogTitle, DialogContent, Tabs, Tab, DialogActions, Divider, MenuItem } from '@material-ui/core';
8
8
  import FilterListIcon from '@material-ui/icons/FilterList';
9
9
  import { Select, Link, ResponseErrorPanel, Progress, OverflowTooltip, Table, DependencyGraph, DependencyGraphTypes, CodeSnippet, CopyTextButton, EmptyState } from '@backstage/core-components';
10
10
  import { g as getEntityRelations, u as useEntity } from './esm/useEntity-de64059a.esm.js';
@@ -27,6 +27,7 @@ import classNames from 'classnames';
27
27
  import { useMountEffect, useDebouncedEffect } from '@react-hookz/web';
28
28
  import PersonIcon from '@material-ui/icons/Person';
29
29
  import GroupIcon from '@material-ui/icons/Group';
30
+ import { withStyles, makeStyles as makeStyles$1 } from '@material-ui/core/styles';
30
31
  import { getOrCreateGlobalSingleton } from '@backstage/version-bridge';
31
32
  import HoverPopover from 'material-ui-popup-state/HoverPopover';
32
33
  import { usePopupState, bindHover, bindPopover } from 'material-ui-popup-state/hooks';
@@ -36,7 +37,7 @@ import Clear from '@material-ui/icons/Clear';
36
37
  import Search from '@material-ui/icons/Search';
37
38
  import Star from '@material-ui/icons/Star';
38
39
  import StarBorder from '@material-ui/icons/StarBorder';
39
- import WorkIcon from '@material-ui/icons/Work';
40
+ import SvgIcon from '@material-ui/core/SvgIcon';
40
41
  import HelpOutlineIcon from '@material-ui/icons/HelpOutline';
41
42
  import groupBy from 'lodash/groupBy';
42
43
  import DialogContentText$1 from '@material-ui/core/DialogContentText';
@@ -47,7 +48,6 @@ import SettingsIcon from '@material-ui/icons/Settings';
47
48
  import useDeepCompareEffect from 'react-use/lib/useDeepCompareEffect';
48
49
  import Box$1 from '@material-ui/core/Box';
49
50
  import Button$1 from '@material-ui/core/Button';
50
- import { makeStyles as makeStyles$1 } from '@material-ui/core/styles';
51
51
  import Typography$1 from '@material-ui/core/Typography';
52
52
 
53
53
  const catalogApiRef = createApiRef({
@@ -1339,14 +1339,52 @@ function useSelectedOwners({
1339
1339
 
1340
1340
  const useStyles$f = makeStyles(
1341
1341
  {
1342
- input: {}
1342
+ input: {},
1343
+ fullWidth: { width: "100%" },
1344
+ boxLabel: {
1345
+ width: "100%",
1346
+ textOverflow: "ellipsis",
1347
+ overflow: "hidden"
1348
+ }
1343
1349
  },
1344
1350
  {
1345
1351
  name: "CatalogReactEntityOwnerPicker"
1346
1352
  }
1347
1353
  );
1354
+ const FixedWidthFormControlLabel = withStyles(
1355
+ (_theme) => ({
1356
+ label: {
1357
+ width: "100%"
1358
+ },
1359
+ root: {
1360
+ width: "90%"
1361
+ }
1362
+ }),
1363
+ { name: "FixedWidthFormControlLabel" }
1364
+ )(FormControlLabel);
1348
1365
  const icon$1 = /* @__PURE__ */ React.createElement(CheckBoxOutlineBlankIcon, { fontSize: "small" });
1349
1366
  const checkedIcon$1 = /* @__PURE__ */ React.createElement(CheckBoxIcon, { fontSize: "small" });
1367
+ function RenderOptionLabel(props) {
1368
+ const classes = useStyles$f();
1369
+ const isGroup = props.entity.kind.toLocaleLowerCase("en-US") === "group";
1370
+ const { primaryTitle: title } = useEntityPresentation(props.entity);
1371
+ return /* @__PURE__ */ React.createElement(Box, { className: classes.fullWidth }, /* @__PURE__ */ React.createElement(
1372
+ FixedWidthFormControlLabel,
1373
+ {
1374
+ className: classes.fullWidth,
1375
+ control: /* @__PURE__ */ React.createElement(
1376
+ Checkbox,
1377
+ {
1378
+ icon: icon$1,
1379
+ checkedIcon: checkedIcon$1,
1380
+ checked: props.isSelected
1381
+ }
1382
+ ),
1383
+ onClick: (event) => event.preventDefault(),
1384
+ label: /* @__PURE__ */ React.createElement(Tooltip, { title }, /* @__PURE__ */ React.createElement(Box, { display: "flex", alignItems: "center" }, isGroup ? /* @__PURE__ */ React.createElement(GroupIcon, { fontSize: "small" }) : /* @__PURE__ */ React.createElement(PersonIcon, { fontSize: "small" }), "\xA0", /* @__PURE__ */ React.createElement(Box, { className: classes.boxLabel }, /* @__PURE__ */ React.createElement(Typography, { noWrap: true }, title))))
1385
+ }
1386
+ ));
1387
+ }
1350
1388
  const EntityOwnerPicker = (props) => {
1351
1389
  var _a, _b, _c;
1352
1390
  const classes = useStyles$f();
@@ -1421,25 +1459,7 @@ const EntityOwnerPicker = (props) => {
1421
1459
  },
1422
1460
  filterOptions: (x) => x,
1423
1461
  renderOption: (entity, { selected }) => {
1424
- const isGroup = entity.kind.toLocaleLowerCase("en-US") === "group";
1425
- return /* @__PURE__ */ React.createElement(
1426
- FormControlLabel,
1427
- {
1428
- control: /* @__PURE__ */ React.createElement(
1429
- Checkbox,
1430
- {
1431
- icon: icon$1,
1432
- checkedIcon: checkedIcon$1,
1433
- checked: selected
1434
- }
1435
- ),
1436
- onClick: (event) => event.preventDefault(),
1437
- label: /* @__PURE__ */ React.createElement(Box, { display: "flex", flexWrap: "wrap", alignItems: "center" }, isGroup ? /* @__PURE__ */ React.createElement(GroupIcon, { fontSize: "small" }) : /* @__PURE__ */ React.createElement(PersonIcon, { fontSize: "small" }), "\xA0", humanizeEntity(
1438
- entity,
1439
- humanizeEntityRef(entity, { defaultKind: entity.kind })
1440
- ))
1441
- }
1442
- );
1462
+ return /* @__PURE__ */ React.createElement(RenderOptionLabel, { entity, isSelected: selected });
1443
1463
  },
1444
1464
  size: "small",
1445
1465
  popupIcon: /* @__PURE__ */ React.createElement(ExpandMoreIcon, { "data-testid": "owner-picker-expand" }),
@@ -1986,7 +2006,7 @@ const EntityTypePicker = (props) => {
1986
2006
  ));
1987
2007
  };
1988
2008
 
1989
- const YellowStar = withStyles({
2009
+ const YellowStar = withStyles$1({
1990
2010
  root: {
1991
2011
  color: "#f3ba37"
1992
2012
  }
@@ -2013,7 +2033,7 @@ const FavoriteEntity = (props) => {
2013
2033
  );
2014
2034
  };
2015
2035
 
2016
- const DEFAULT_ICON = WorkIcon;
2036
+ const DEFAULT_ICON = SvgIcon;
2017
2037
  function getKind(kind, entityRef) {
2018
2038
  if (kind) {
2019
2039
  return kind.toLocaleLowerCase("en-US");
@@ -2101,6 +2121,7 @@ function CustomNode({ node }) {
2101
2121
  const entityRoute = useRouteRef(entityRouteRef);
2102
2122
  const [width, setWidth] = useState(0);
2103
2123
  const [height, setHeight] = useState(0);
2124
+ const app = useApp();
2104
2125
  const idRef = useRef(null);
2105
2126
  useLayoutEffect(() => {
2106
2127
  if (idRef.current) {
@@ -2113,9 +2134,12 @@ function CustomNode({ node }) {
2113
2134
  }
2114
2135
  }
2115
2136
  }, [width, height]);
2137
+ const hasKindIcon = app.getSystemIcon(
2138
+ `kind:${node.kind.toLocaleLowerCase("en-US")}`
2139
+ );
2116
2140
  const padding = 10;
2117
2141
  const iconSize = height;
2118
- const paddedIconWidth = iconSize + padding;
2142
+ const paddedIconWidth = hasKindIcon ? iconSize + padding : 0;
2119
2143
  const paddedWidth = paddedIconWidth + width + padding * 2;
2120
2144
  const paddedHeight = height + padding * 2;
2121
2145
  const displayTitle = node.metadata.title || (node.kind && node.metadata.name && node.metadata.namespace ? humanizeEntityRef({
@@ -2143,7 +2167,7 @@ function CustomNode({ node }) {
2143
2167
  height: paddedHeight,
2144
2168
  rx: 10
2145
2169
  }
2146
- ), /* @__PURE__ */ React.createElement(
2170
+ ), hasKindIcon && /* @__PURE__ */ React.createElement(
2147
2171
  EntityKindIcon,
2148
2172
  {
2149
2173
  kind: node.kind,
@@ -2285,7 +2309,7 @@ function useColocated(entity) {
2285
2309
  };
2286
2310
  }
2287
2311
  function EntityList(props) {
2288
- return /* @__PURE__ */ React.createElement(List, { dense: true }, props.header && /* @__PURE__ */ React.createElement(KeyValueListItem, { key: "header", entry: props.header }), props.entities.map((entity) => /* @__PURE__ */ React.createElement(ListItem, { key: stringifyEntityRef(entity) }, /* @__PURE__ */ React.createElement(ListItemIcon, null, /* @__PURE__ */ React.createElement(EntityKindIcon, { kind: entity.kind })), /* @__PURE__ */ React.createElement(ListItemText, { primary: /* @__PURE__ */ React.createElement(EntityRefLink, { entityRef: entity }) }))));
2312
+ return /* @__PURE__ */ React.createElement(List, { dense: true }, props.header && /* @__PURE__ */ React.createElement(KeyValueListItem, { key: "header", entry: props.header }), props.entities.map((entity) => /* @__PURE__ */ React.createElement(ListItem, { key: stringifyEntityRef(entity) }, /* @__PURE__ */ React.createElement(ListItemText, { primary: /* @__PURE__ */ React.createElement(EntityRefLink, { entityRef: entity }) }))));
2289
2313
  }
2290
2314
  function Contents$1(props) {
2291
2315
  const { entity } = props;
@@ -2393,7 +2417,7 @@ function OverviewPage(props) {
2393
2417
  helpLink: "https://backstage.io/docs/features/software-catalog/well-known-relations"
2394
2418
  },
2395
2419
  Object.entries(groupedRelations).map(
2396
- ([type, groupRelations], index) => /* @__PURE__ */ React.createElement("div", { key: index }, /* @__PURE__ */ React.createElement(List, { dense: true, subheader: /* @__PURE__ */ React.createElement(ListSubheader, null, type) }, groupRelations.map((group) => /* @__PURE__ */ React.createElement(ListItem, { key: group.targetRef }, /* @__PURE__ */ React.createElement(ListItemIcon, null, /* @__PURE__ */ React.createElement(EntityKindIcon, { entityRef: group.targetRef })), /* @__PURE__ */ React.createElement(
2420
+ ([type, groupRelations], index) => /* @__PURE__ */ React.createElement("div", { key: index }, /* @__PURE__ */ React.createElement(List, { dense: true, subheader: /* @__PURE__ */ React.createElement(ListSubheader, null, type) }, groupRelations.map((group) => /* @__PURE__ */ React.createElement(ListItem, { key: group.targetRef }, /* @__PURE__ */ React.createElement(
2397
2421
  ListItemText,
2398
2422
  {
2399
2423
  primary: /* @__PURE__ */ React.createElement(EntityRefLink, { entityRef: group.targetRef })