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

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,26 @@
1
1
  # @backstage/plugin-catalog-react
2
2
 
3
+ ## 1.2.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 37426f6f5e: Fixed bug in `EntityTagPicker` that filtered on unavailable tags for the selected kind.
8
+ - 516b2039b6: Add a reusable pop over `EntityPeekAheadPopover` component. It shows more details about the associated entity. See the playbook here https://backstage.io/storybook/?path=/story/catalog-entitypeekaheadpopover--default
9
+ - 0e33627996: Remove usage of raw span
10
+ - Updated dependencies
11
+ - @backstage/catalog-model@1.1.5
12
+ - @backstage/catalog-client@1.3.0
13
+ - @backstage/core-components@0.12.3
14
+ - @backstage/core-plugin-api@1.3.0
15
+ - @backstage/plugin-permission-react@0.4.9
16
+ - @backstage/errors@1.1.4
17
+ - @backstage/integration@1.4.2
18
+ - @backstage/theme@0.2.16
19
+ - @backstage/types@1.0.2
20
+ - @backstage/version-bridge@1.0.3
21
+ - @backstage/plugin-catalog-common@1.0.10
22
+ - @backstage/plugin-permission-common@0.7.3
23
+
3
24
  ## 1.2.4-next.2
4
25
 
5
26
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-react",
3
- "version": "1.2.4-next.2",
3
+ "version": "1.2.4",
4
4
  "main": "../dist/index.esm.js",
5
5
  "types": "../dist/index.alpha.d.ts"
6
6
  }
package/dist/index.esm.js CHANGED
@@ -1133,7 +1133,7 @@ const EntityOwnerPicker = () => {
1133
1133
  )));
1134
1134
  };
1135
1135
 
1136
- const EntityCardActions = ({ entity }) => {
1136
+ const EntityCardActions = (props) => {
1137
1137
  const entityRoute = useRouteRef(entityRouteRef);
1138
1138
  return /* @__PURE__ */ React.createElement(
1139
1139
  IconButton,
@@ -1141,45 +1141,39 @@ const EntityCardActions = ({ entity }) => {
1141
1141
  component: Link,
1142
1142
  "aria-label": "Show",
1143
1143
  title: "Show details",
1144
- to: entityRoute({
1145
- name: entity.metadata.name,
1146
- namespace: entity.metadata.namespace || "default",
1147
- kind: entity.kind.toLocaleLowerCase("en-US")
1148
- })
1144
+ to: entityRoute(getCompoundEntityRef(props.entity))
1149
1145
  },
1150
1146
  /* @__PURE__ */ React.createElement(InfoIcon, null)
1151
1147
  );
1152
1148
  };
1153
1149
 
1154
- const EmailCardAction = ({ email }) => {
1150
+ const EmailCardAction = (props) => {
1155
1151
  return /* @__PURE__ */ React.createElement(
1156
1152
  IconButton,
1157
1153
  {
1158
1154
  component: Link,
1159
1155
  "aria-label": "Email",
1160
- title: `Email ${email}`,
1161
- to: `mailto:${email}`,
1162
- target: "_blank"
1156
+ title: `Email ${props.email}`,
1157
+ to: `mailto:${props.email}`
1163
1158
  },
1164
1159
  /* @__PURE__ */ React.createElement(EmailIcon, null)
1165
1160
  );
1166
1161
  };
1167
1162
 
1168
- const GroupCardActions = ({ entity }) => {
1163
+ const GroupCardActions = (props) => {
1169
1164
  var _a;
1170
- return /* @__PURE__ */ React.createElement(React.Fragment, null, ((_a = entity.spec.profile) == null ? void 0 : _a.email) && /* @__PURE__ */ React.createElement(EmailCardAction, { email: entity.spec.profile.email }));
1165
+ const email = (_a = props.entity.spec.profile) == null ? void 0 : _a.email;
1166
+ return email ? /* @__PURE__ */ React.createElement(EmailCardAction, { email }) : null;
1171
1167
  };
1172
1168
 
1173
- const UserCardActions = ({ entity }) => {
1169
+ const UserCardActions = (props) => {
1174
1170
  var _a;
1175
- return /* @__PURE__ */ React.createElement(React.Fragment, null, ((_a = entity.spec.profile) == null ? void 0 : _a.email) && /* @__PURE__ */ React.createElement(EmailCardAction, { email: entity.spec.profile.email }));
1171
+ const email = (_a = props.entity.spec.profile) == null ? void 0 : _a.email;
1172
+ return email ? /* @__PURE__ */ React.createElement(EmailCardAction, { email }) : null;
1176
1173
  };
1177
1174
 
1178
1175
  const useStyles$b = makeStyles(() => {
1179
1176
  return {
1180
- trigger: {
1181
- display: "inline-block"
1182
- },
1183
1177
  popoverPaper: {
1184
1178
  width: "30em"
1185
1179
  },
@@ -1202,25 +1196,22 @@ const EntityPeekAheadPopover = (props) => {
1202
1196
  variant: "popover",
1203
1197
  popupId: "entity-peek-ahead"
1204
1198
  });
1205
- const compoundEntityRef = parseEntityRef(entityRef);
1206
1199
  const [isHovered, setIsHovered] = useState(false);
1207
- const debouncedHandleMouseEnter = debounce(
1208
- () => setIsHovered(true),
1209
- delayTime
1200
+ const debouncedHandleMouseEnter = useMemo(
1201
+ () => debounce(() => setIsHovered(true), delayTime),
1202
+ [delayTime]
1210
1203
  );
1211
1204
  const [{ loading, error, value: entity }, load] = useAsyncFn(async () => {
1212
1205
  const catalogApi = apiHolder.get(catalogApiRef);
1213
1206
  if (catalogApi) {
1214
- const retrievedEntity = await catalogApi.getEntityByRef(
1215
- compoundEntityRef
1216
- );
1207
+ const retrievedEntity = await catalogApi.getEntityByRef(entityRef);
1217
1208
  if (!retrievedEntity) {
1218
- throw new Error(`${compoundEntityRef.name} was not found`);
1209
+ throw new Error(`${entityRef} not found`);
1219
1210
  }
1220
1211
  return retrievedEntity;
1221
1212
  }
1222
1213
  return void 0;
1223
- }, [apiHolder, compoundEntityRef]);
1214
+ }, [apiHolder, entityRef]);
1224
1215
  const handleOnMouseLeave = () => {
1225
1216
  setIsHovered(false);
1226
1217
  debouncedHandleMouseEnter.cancel();
@@ -1230,7 +1221,15 @@ const EntityPeekAheadPopover = (props) => {
1230
1221
  load();
1231
1222
  }
1232
1223
  }, [popupState.isOpen, load, entity, error, loading]);
1233
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", { onMouseEnter: debouncedHandleMouseEnter }, /* @__PURE__ */ React.createElement("span", { "data-testid": "trigger", ...bindHover(popupState) }, children)), isHovered && /* @__PURE__ */ React.createElement(
1224
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { component: "span", onMouseEnter: debouncedHandleMouseEnter }, /* @__PURE__ */ React.createElement(
1225
+ Typography,
1226
+ {
1227
+ component: "span",
1228
+ "data-testid": "trigger",
1229
+ ...bindHover(popupState)
1230
+ },
1231
+ children
1232
+ )), isHovered && /* @__PURE__ */ React.createElement(
1234
1233
  HoverPopover,
1235
1234
  {
1236
1235
  PaperProps: {
@@ -1247,7 +1246,7 @@ const EntityPeekAheadPopover = (props) => {
1247
1246
  },
1248
1247
  onMouseLeave: handleOnMouseLeave
1249
1248
  },
1250
- /* @__PURE__ */ React.createElement(React.Fragment, null, error && /* @__PURE__ */ React.createElement(ResponseErrorPanel, { error }), /* @__PURE__ */ React.createElement(Card, null, loading && /* @__PURE__ */ React.createElement(Progress, null), /* @__PURE__ */ React.createElement(CardContent, null, entity && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { color: "textSecondary" }, compoundEntityRef.namespace), /* @__PURE__ */ React.createElement(Typography, { variant: "h5", component: "div" }, compoundEntityRef.name), /* @__PURE__ */ React.createElement(Typography, { color: "textSecondary" }, entity.kind), /* @__PURE__ */ React.createElement(
1249
+ /* @__PURE__ */ React.createElement(Card, null, /* @__PURE__ */ React.createElement(CardContent, null, error && /* @__PURE__ */ React.createElement(ResponseErrorPanel, { error }), loading && /* @__PURE__ */ React.createElement(Progress, null), entity && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { color: "textSecondary" }, entity.metadata.namespace), /* @__PURE__ */ React.createElement(Typography, { variant: "h5", component: "div" }, entity.metadata.name), /* @__PURE__ */ React.createElement(Typography, { color: "textSecondary", gutterBottom: true }, entity.kind), entity.metadata.description && /* @__PURE__ */ React.createElement(
1251
1250
  Typography,
1252
1251
  {
1253
1252
  className: classes.descriptionTypography,
@@ -1256,7 +1255,7 @@ const EntityPeekAheadPopover = (props) => {
1256
1255
  entity.metadata.description
1257
1256
  ), /* @__PURE__ */ React.createElement(Typography, null, (_a = entity.spec) == null ? void 0 : _a.type), /* @__PURE__ */ React.createElement(Box, { marginTop: "0.5em" }, (entity.metadata.tags || []).slice(0, maxTagChips).map((tag) => {
1258
1257
  return /* @__PURE__ */ React.createElement(Chip, { key: tag, size: "small", label: tag });
1259
- }), ((_b = entity.metadata.tags) == null ? void 0 : _b.length) && ((_c = entity.metadata.tags) == null ? void 0 : _c.length) > maxTagChips && /* @__PURE__ */ React.createElement(Tooltip, { title: "Drill into the entity to see all of the tags." }, /* @__PURE__ */ React.createElement(Chip, { key: "other-tags", size: "small", label: "..." }))))), !error && /* @__PURE__ */ React.createElement(CardActions, null, entity && /* @__PURE__ */ React.createElement(React.Fragment, null, isUserEntity(entity) && /* @__PURE__ */ React.createElement(UserCardActions, { entity }), isGroupEntity(entity) && /* @__PURE__ */ React.createElement(GroupCardActions, { entity }), /* @__PURE__ */ React.createElement(EntityCardActions, { entity })))))
1258
+ }), ((_b = entity.metadata.tags) == null ? void 0 : _b.length) && ((_c = entity.metadata.tags) == null ? void 0 : _c.length) > maxTagChips && /* @__PURE__ */ React.createElement(Tooltip, { title: "Drill into the entity to see all of the tags." }, /* @__PURE__ */ React.createElement(Chip, { key: "other-tags", size: "small", label: "..." }))))), !error && entity && /* @__PURE__ */ React.createElement(CardActions, null, /* @__PURE__ */ React.createElement(React.Fragment, null, isUserEntity(entity) && /* @__PURE__ */ React.createElement(UserCardActions, { entity }), isGroupEntity(entity) && /* @__PURE__ */ React.createElement(GroupCardActions, { entity }), /* @__PURE__ */ React.createElement(EntityCardActions, { entity }))))
1260
1259
  ));
1261
1260
  };
1262
1261