@backstage/plugin-catalog-react 1.9.0-next.2 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,55 @@
1
1
  # @backstage/plugin-catalog-react
2
2
 
3
+ ## 1.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 1e5b7d993a: Added an `EntityPresentationApi` and associated `entityPresentationApiRef`. This
8
+ API lets you control how references to entities (e.g. in links, headings,
9
+ iconography etc) are represented in the user interface.
10
+
11
+ Usage of this API is initially added to the `EntityRefLink` and `EntityRefLinks`
12
+ components, so that they can render richer, more correct representation of
13
+ entity refs. There's also a new `EntityDisplayName` component, which works just like
14
+ the `EntityRefLink` but without the link.
15
+
16
+ Along with that change, the `fetchEntities` and `getTitle` props of
17
+ `EntityRefLinksProps` are deprecated and no longer used, since the same need
18
+ instead is fulfilled (and by default always enabled) by the
19
+ `entityPresentationApiRef`.
20
+
21
+ - 1fd53fa0c6: The `UserListPicker` component has undergone improvements to enhance its performance.
22
+
23
+ The previous implementation inferred the number of owned and starred entities based on the entities available in the `EntityListContext`. The updated version no longer relies on the `EntityListContext` for inference, allowing for better decoupling.
24
+
25
+ The component now loads the entities' count asynchronously, resulting in improved performance and responsiveness. For this purpose, some of the exported filters such as `EntityTagFilter`, `EntityOwnerFilter`, `EntityLifecycleFilter` and `EntityNamespaceFilter` have now the `getCatalogFilters` method implemented.
26
+
27
+ ### Patch Changes
28
+
29
+ - 2ad1bacef7: Add EntityRef to Entity Inspector UI
30
+ - 6c2b872153: Add official support for React 18.
31
+ - 69ee8d75f4: Remove `button` prop from used MaterialUI `MenuItem` component fixing incompatibility with MaterialUI v5.
32
+ - 0bf6ebda88: Added new APIs at the `/alpha` subpath for creating entity page cards and content for the new frontend system.
33
+ - 77f009b35d: Internal updates to match changes in the experimental `@backstage/frontend-plugin-api`.
34
+ - 71c97e7d73: The `spec.type` field in entities will now always be rendered as a string.
35
+ - 69c14904b6: Move the `EntityRefLink` icon to the left hand side as per Material-UI guidelines
36
+ - 000dcd01af: Removed unnecessary `@backstage/integration` dependency, replaced by `@backstage/integration-react`.
37
+ - 6c357184e2: Export `MissingAnnotationEmptyState` from `@backstage/plugin-catalog-react`
38
+ - Updated dependencies
39
+ - @backstage/core-components@0.13.8
40
+ - @backstage/frontend-plugin-api@0.3.0
41
+ - @backstage/integration-react@1.1.21
42
+ - @backstage/core-plugin-api@1.8.0
43
+ - @backstage/plugin-permission-react@0.4.17
44
+ - @backstage/version-bridge@1.0.7
45
+ - @backstage/theme@0.4.4
46
+ - @backstage/catalog-client@1.4.6
47
+ - @backstage/plugin-permission-common@0.7.10
48
+ - @backstage/catalog-model@1.4.3
49
+ - @backstage/errors@1.2.3
50
+ - @backstage/types@1.1.1
51
+ - @backstage/plugin-catalog-common@1.0.18
52
+
3
53
  ## 1.9.0-next.2
4
54
 
5
55
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-react",
3
- "version": "1.9.0-next.2",
3
+ "version": "1.9.0",
4
4
  "main": "../dist/alpha.esm.js",
5
5
  "module": "../dist/alpha.esm.js",
6
6
  "types": "../dist/alpha.d.ts"
package/dist/index.d.ts CHANGED
@@ -259,8 +259,8 @@ type CatalogReactEntityDisplayNameClassKey = 'root' | 'icon';
259
259
  */
260
260
  type EntityDisplayNameProps = {
261
261
  entityRef: Entity | CompoundEntityRef | string;
262
- noIcon?: boolean;
263
- noTooltip?: boolean;
262
+ hideIcon?: boolean;
263
+ disableTooltip?: boolean;
264
264
  defaultKind?: string;
265
265
  defaultNamespace?: string;
266
266
  };
@@ -283,6 +283,7 @@ type EntityRefLinkProps = {
283
283
  /** @deprecated This option should no longer be used; presentation is requested through the {@link entityPresentationApiRef} instead */
284
284
  title?: string;
285
285
  children?: React.ReactNode;
286
+ hideIcon?: boolean;
286
287
  } & Omit<LinkProps, 'to'>;
287
288
  /**
288
289
  * Shows a clickable link to an entity.
@@ -299,6 +300,7 @@ declare const EntityRefLink: (props: EntityRefLinkProps) => JSX.Element;
299
300
  type EntityRefLinksProps<TRef extends string | CompoundEntityRef | Entity> = {
300
301
  defaultKind?: string;
301
302
  entityRefs: TRef[];
303
+ hideIcons?: boolean;
302
304
  /** @deprecated This option is no longer used; presentation is handled by entityPresentationApiRef instead */
303
305
  fetchEntities?: boolean;
304
306
  /** @deprecated This option is no longer used; presentation is handled by entityPresentationApiRef instead */
package/dist/index.esm.js CHANGED
@@ -13,9 +13,9 @@ import PersonIcon from '@material-ui/icons/Person';
13
13
  import get from 'lodash/get';
14
14
  import React, { useState, useEffect, useMemo, createContext, useCallback, useContext, useRef, memo, forwardRef, useLayoutEffect, Fragment } from 'react';
15
15
  import ObservableImpl from 'zen-observable';
16
- 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, Dialog, DialogTitle, DialogContent, Tabs, Tab, DialogActions, Divider, MenuItem, ListItemSecondaryAction } from '@material-ui/core';
16
+ 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';
17
17
  import FilterListIcon from '@material-ui/icons/FilterList';
18
- import { Select, Link, ResponseErrorPanel, Progress, OverflowTooltip, Table, DependencyGraph, DependencyGraphTypes, CodeSnippet, EmptyState } from '@backstage/core-components';
18
+ import { Select, Link, ResponseErrorPanel, Progress, OverflowTooltip, Table, DependencyGraph, DependencyGraphTypes, CodeSnippet, CopyTextButton, EmptyState } from '@backstage/core-components';
19
19
  import { g as getEntityRelations, u as useEntity } from './esm/useEntity-de64059a.esm.js';
20
20
  export { A as AsyncEntityProvider, E as EntityProvider, g as getEntityRelations, a as useAsyncEntity, u as useEntity } from './esm/useEntity-de64059a.esm.js';
21
21
  import { compact, isEqual, debounce, intersection } from 'lodash';
@@ -1431,7 +1431,7 @@ const useStyles$e = makeStyles(
1431
1431
  alignItems: "center"
1432
1432
  },
1433
1433
  icon: {
1434
- marginLeft: theme.spacing(0.5),
1434
+ marginRight: theme.spacing(0.5),
1435
1435
  color: theme.palette.text.secondary,
1436
1436
  lineHeight: 0
1437
1437
  }
@@ -1439,15 +1439,15 @@ const useStyles$e = makeStyles(
1439
1439
  { name: "CatalogReactEntityDisplayName" }
1440
1440
  );
1441
1441
  const EntityDisplayName = (props) => {
1442
- const { entityRef, noIcon, noTooltip, defaultKind, defaultNamespace } = props;
1442
+ const { entityRef, hideIcon, disableTooltip, defaultKind, defaultNamespace } = props;
1443
1443
  const classes = useStyles$e();
1444
1444
  const { primaryTitle, secondaryTitle, Icon } = useEntityPresentation(
1445
1445
  entityRef,
1446
1446
  { defaultKind, defaultNamespace }
1447
1447
  );
1448
1448
  let content = /* @__PURE__ */ React.createElement(React.Fragment, null, primaryTitle);
1449
- content = /* @__PURE__ */ React.createElement(Box, { component: "span", className: classes.root }, content, Icon && !noIcon ? /* @__PURE__ */ React.createElement(Box, { component: "span", className: classes.icon }, /* @__PURE__ */ React.createElement(Icon, { fontSize: "inherit" })) : null);
1450
- if (secondaryTitle && !noTooltip) {
1449
+ content = /* @__PURE__ */ React.createElement(Box, { component: "span", className: classes.root }, Icon && !hideIcon ? /* @__PURE__ */ React.createElement(Box, { component: "span", className: classes.icon }, /* @__PURE__ */ React.createElement(Icon, { fontSize: "inherit" })) : null, content);
1450
+ if (secondaryTitle && !disableTooltip) {
1451
1451
  content = /* @__PURE__ */ React.createElement(Tooltip, { enterDelay: 1500, title: secondaryTitle }, content);
1452
1452
  }
1453
1453
  return content;
@@ -1478,6 +1478,7 @@ const EntityRefLink = forwardRef(
1478
1478
  defaultNamespace,
1479
1479
  title,
1480
1480
  children,
1481
+ hideIcon,
1481
1482
  ...linkProps
1482
1483
  } = props;
1483
1484
  const entityRoute = useEntityRoute(props.entityRef);
@@ -1486,7 +1487,8 @@ const EntityRefLink = forwardRef(
1486
1487
  {
1487
1488
  entityRef,
1488
1489
  defaultKind,
1489
- defaultNamespace
1490
+ defaultNamespace,
1491
+ hideIcon
1490
1492
  }
1491
1493
  );
1492
1494
  return /* @__PURE__ */ React.createElement(Link, { ...linkProps, ref, to: entityRoute }, content);
@@ -1523,10 +1525,10 @@ function useEntityRoute(entityRef) {
1523
1525
  }
1524
1526
 
1525
1527
  function EntityRefLinks(props) {
1526
- const { entityRefs, ...linkProps } = props;
1528
+ const { entityRefs, hideIcons, ...linkProps } = props;
1527
1529
  return /* @__PURE__ */ React.createElement(React.Fragment, null, entityRefs.map((r, i) => {
1528
1530
  const entityRefString = typeof r === "string" ? r : stringifyEntityRef(r);
1529
- return /* @__PURE__ */ React.createElement(React.Fragment, { key: `${i}.${entityRefString}` }, i > 0 && ", ", /* @__PURE__ */ React.createElement(EntityRefLink, { ...linkProps, entityRef: r }));
1531
+ return /* @__PURE__ */ React.createElement(React.Fragment, { key: `${i}.${entityRefString}` }, i > 0 && ", ", /* @__PURE__ */ React.createElement(EntityRefLink, { ...linkProps, entityRef: r, hideIcon: hideIcons }));
1530
1532
  }));
1531
1533
  }
1532
1534
 
@@ -2324,13 +2326,14 @@ function OverviewPage(props) {
2324
2326
  sortBy(relations, (r) => r.targetRef),
2325
2327
  "type"
2326
2328
  );
2329
+ const entityRef = stringifyEntityRef(props.entity);
2327
2330
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DialogContentText, { variant: "h2" }, "Overview"), /* @__PURE__ */ React.createElement("div", { className: classes.root }, /* @__PURE__ */ React.createElement(Container, { title: "Identity" }, /* @__PURE__ */ React.createElement(List, { dense: true }, /* @__PURE__ */ React.createElement(ListItem, null, /* @__PURE__ */ React.createElement(ListItemText, { primary: "apiVersion", secondary: apiVersion })), /* @__PURE__ */ React.createElement(ListItem, null, /* @__PURE__ */ React.createElement(ListItemText, { primary: "kind", secondary: kind })), (spec == null ? void 0 : spec.type) && /* @__PURE__ */ React.createElement(ListItem, null, /* @__PURE__ */ React.createElement(
2328
2331
  ListItemText,
2329
2332
  {
2330
2333
  primary: "spec.type",
2331
2334
  secondary: (_a = spec.type) == null ? void 0 : _a.toString()
2332
2335
  }
2333
- )), metadata.uid && /* @__PURE__ */ React.createElement(ListItem, null, /* @__PURE__ */ React.createElement(ListItemText, { primary: "uid", secondary: metadata.uid })), metadata.etag && /* @__PURE__ */ React.createElement(ListItem, null, /* @__PURE__ */ React.createElement(ListItemText, { primary: "etag", secondary: metadata.etag })))), /* @__PURE__ */ React.createElement(Container, { title: "Metadata" }, !!Object.keys(metadata.annotations || {}).length && /* @__PURE__ */ React.createElement(
2336
+ )), metadata.uid && /* @__PURE__ */ React.createElement(ListItem, null, /* @__PURE__ */ React.createElement(ListItemText, { primary: "uid", secondary: metadata.uid }), /* @__PURE__ */ React.createElement(ListItemSecondaryAction, null, /* @__PURE__ */ React.createElement(CopyTextButton, { text: metadata.uid }))), metadata.etag && /* @__PURE__ */ React.createElement(ListItem, null, /* @__PURE__ */ React.createElement(ListItemText, { primary: "etag", secondary: metadata.etag }), /* @__PURE__ */ React.createElement(ListItemSecondaryAction, null, /* @__PURE__ */ React.createElement(CopyTextButton, { text: metadata.etag }))), /* @__PURE__ */ React.createElement(ListItem, null, /* @__PURE__ */ React.createElement(ListItemText, { primary: "entityRef", secondary: entityRef }), /* @__PURE__ */ React.createElement(ListItemSecondaryAction, null, /* @__PURE__ */ React.createElement(CopyTextButton, { text: entityRef }))))), /* @__PURE__ */ React.createElement(Container, { title: "Metadata" }, !!Object.keys(metadata.annotations || {}).length && /* @__PURE__ */ React.createElement(
2334
2337
  List,
2335
2338
  {
2336
2339
  dense: true,
@@ -2975,7 +2978,6 @@ const UserListPicker = (props) => {
2975
2978
  {
2976
2979
  role: "none presentation",
2977
2980
  key: item.id,
2978
- button: true,
2979
2981
  divider: true,
2980
2982
  onClick: () => setSelectedUserFilter(item.id),
2981
2983
  selected: item.id === ((_a2 = filters.user) == null ? void 0 : _a2.value),