@backstage/plugin-catalog-react 1.2.4-next.2 → 1.3.0-next.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,39 @@
1
1
  # @backstage/plugin-catalog-react
2
2
 
3
+ ## 1.3.0-next.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 929e1afe1b: Add `initialFilter` prop to EntityLifecyclePicker. This allows you to set an initial lifecycle for the catalog.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @backstage/catalog-model@1.1.6-next.0
13
+ - @backstage/catalog-client@1.3.1-next.0
14
+ - @backstage/plugin-catalog-common@1.0.11-next.0
15
+
16
+ ## 1.2.4
17
+
18
+ ### Patch Changes
19
+
20
+ - 37426f6f5e: Fixed bug in `EntityTagPicker` that filtered on unavailable tags for the selected kind.
21
+ - 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
22
+ - 0e33627996: Remove usage of raw span
23
+ - Updated dependencies
24
+ - @backstage/catalog-model@1.1.5
25
+ - @backstage/catalog-client@1.3.0
26
+ - @backstage/core-components@0.12.3
27
+ - @backstage/core-plugin-api@1.3.0
28
+ - @backstage/plugin-permission-react@0.4.9
29
+ - @backstage/errors@1.1.4
30
+ - @backstage/integration@1.4.2
31
+ - @backstage/theme@0.2.16
32
+ - @backstage/types@1.0.2
33
+ - @backstage/version-bridge@1.0.3
34
+ - @backstage/plugin-catalog-common@1.0.10
35
+ - @backstage/plugin-permission-common@0.7.3
36
+
3
37
  ## 1.2.4-next.2
4
38
 
5
39
  ### 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.3.0-next.0",
4
4
  "main": "../dist/index.esm.js",
5
5
  "types": "../dist/index.alpha.d.ts"
6
6
  }
@@ -212,7 +212,9 @@ export declare class EntityLifecycleFilter implements EntityFilter {
212
212
  }
213
213
 
214
214
  /** @public */
215
- export declare const EntityLifecyclePicker: () => JSX.Element | null;
215
+ export declare const EntityLifecyclePicker: (props: {
216
+ initialFilter?: string[];
217
+ }) => JSX.Element | null;
216
218
 
217
219
  /**
218
220
  * Creates new context for entity listing and filtering.
@@ -212,7 +212,9 @@ export declare class EntityLifecycleFilter implements EntityFilter {
212
212
  }
213
213
 
214
214
  /** @public */
215
- export declare const EntityLifecyclePicker: () => JSX.Element | null;
215
+ export declare const EntityLifecyclePicker: (props: {
216
+ initialFilter?: string[];
217
+ }) => JSX.Element | null;
216
218
 
217
219
  /**
218
220
  * Creates new context for entity listing and filtering.
package/dist/index.d.ts CHANGED
@@ -212,7 +212,9 @@ export declare class EntityLifecycleFilter implements EntityFilter {
212
212
  }
213
213
 
214
214
  /** @public */
215
- export declare const EntityLifecyclePicker: () => JSX.Element | null;
215
+ export declare const EntityLifecyclePicker: (props: {
216
+ initialFilter?: string[];
217
+ }) => JSX.Element | null;
216
218
 
217
219
  /**
218
220
  * Creates new context for entity listing and filtering.
package/dist/index.esm.js CHANGED
@@ -974,8 +974,9 @@ const useStyles$d = makeStyles(
974
974
  );
975
975
  const icon$3 = /* @__PURE__ */ React.createElement(CheckBoxOutlineBlankIcon, { fontSize: "small" });
976
976
  const checkedIcon$3 = /* @__PURE__ */ React.createElement(CheckBoxIcon, { fontSize: "small" });
977
- const EntityLifecyclePicker = () => {
977
+ const EntityLifecyclePicker = (props) => {
978
978
  var _a, _b;
979
+ const { initialFilter = [] } = props;
979
980
  const classes = useStyles$d();
980
981
  const {
981
982
  updateFilters,
@@ -988,7 +989,7 @@ const EntityLifecyclePicker = () => {
988
989
  [lifecyclesParameter]
989
990
  );
990
991
  const [selectedLifecycles, setSelectedLifecycles] = useState(
991
- queryParamLifecycles.length ? queryParamLifecycles : (_b = (_a = filters.lifecycles) == null ? void 0 : _a.values) != null ? _b : []
992
+ queryParamLifecycles.length ? queryParamLifecycles : (_b = (_a = filters.lifecycles) == null ? void 0 : _a.values) != null ? _b : initialFilter
992
993
  );
993
994
  useEffect(() => {
994
995
  if (queryParamLifecycles.length) {
@@ -1133,7 +1134,7 @@ const EntityOwnerPicker = () => {
1133
1134
  )));
1134
1135
  };
1135
1136
 
1136
- const EntityCardActions = ({ entity }) => {
1137
+ const EntityCardActions = (props) => {
1137
1138
  const entityRoute = useRouteRef(entityRouteRef);
1138
1139
  return /* @__PURE__ */ React.createElement(
1139
1140
  IconButton,
@@ -1141,45 +1142,39 @@ const EntityCardActions = ({ entity }) => {
1141
1142
  component: Link,
1142
1143
  "aria-label": "Show",
1143
1144
  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
- })
1145
+ to: entityRoute(getCompoundEntityRef(props.entity))
1149
1146
  },
1150
1147
  /* @__PURE__ */ React.createElement(InfoIcon, null)
1151
1148
  );
1152
1149
  };
1153
1150
 
1154
- const EmailCardAction = ({ email }) => {
1151
+ const EmailCardAction = (props) => {
1155
1152
  return /* @__PURE__ */ React.createElement(
1156
1153
  IconButton,
1157
1154
  {
1158
1155
  component: Link,
1159
1156
  "aria-label": "Email",
1160
- title: `Email ${email}`,
1161
- to: `mailto:${email}`,
1162
- target: "_blank"
1157
+ title: `Email ${props.email}`,
1158
+ to: `mailto:${props.email}`
1163
1159
  },
1164
1160
  /* @__PURE__ */ React.createElement(EmailIcon, null)
1165
1161
  );
1166
1162
  };
1167
1163
 
1168
- const GroupCardActions = ({ entity }) => {
1164
+ const GroupCardActions = (props) => {
1169
1165
  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 }));
1166
+ const email = (_a = props.entity.spec.profile) == null ? void 0 : _a.email;
1167
+ return email ? /* @__PURE__ */ React.createElement(EmailCardAction, { email }) : null;
1171
1168
  };
1172
1169
 
1173
- const UserCardActions = ({ entity }) => {
1170
+ const UserCardActions = (props) => {
1174
1171
  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 }));
1172
+ const email = (_a = props.entity.spec.profile) == null ? void 0 : _a.email;
1173
+ return email ? /* @__PURE__ */ React.createElement(EmailCardAction, { email }) : null;
1176
1174
  };
1177
1175
 
1178
1176
  const useStyles$b = makeStyles(() => {
1179
1177
  return {
1180
- trigger: {
1181
- display: "inline-block"
1182
- },
1183
1178
  popoverPaper: {
1184
1179
  width: "30em"
1185
1180
  },
@@ -1202,25 +1197,22 @@ const EntityPeekAheadPopover = (props) => {
1202
1197
  variant: "popover",
1203
1198
  popupId: "entity-peek-ahead"
1204
1199
  });
1205
- const compoundEntityRef = parseEntityRef(entityRef);
1206
1200
  const [isHovered, setIsHovered] = useState(false);
1207
- const debouncedHandleMouseEnter = debounce(
1208
- () => setIsHovered(true),
1209
- delayTime
1201
+ const debouncedHandleMouseEnter = useMemo(
1202
+ () => debounce(() => setIsHovered(true), delayTime),
1203
+ [delayTime]
1210
1204
  );
1211
1205
  const [{ loading, error, value: entity }, load] = useAsyncFn(async () => {
1212
1206
  const catalogApi = apiHolder.get(catalogApiRef);
1213
1207
  if (catalogApi) {
1214
- const retrievedEntity = await catalogApi.getEntityByRef(
1215
- compoundEntityRef
1216
- );
1208
+ const retrievedEntity = await catalogApi.getEntityByRef(entityRef);
1217
1209
  if (!retrievedEntity) {
1218
- throw new Error(`${compoundEntityRef.name} was not found`);
1210
+ throw new Error(`${entityRef} not found`);
1219
1211
  }
1220
1212
  return retrievedEntity;
1221
1213
  }
1222
1214
  return void 0;
1223
- }, [apiHolder, compoundEntityRef]);
1215
+ }, [apiHolder, entityRef]);
1224
1216
  const handleOnMouseLeave = () => {
1225
1217
  setIsHovered(false);
1226
1218
  debouncedHandleMouseEnter.cancel();
@@ -1230,7 +1222,15 @@ const EntityPeekAheadPopover = (props) => {
1230
1222
  load();
1231
1223
  }
1232
1224
  }, [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(
1225
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { component: "span", onMouseEnter: debouncedHandleMouseEnter }, /* @__PURE__ */ React.createElement(
1226
+ Typography,
1227
+ {
1228
+ component: "span",
1229
+ "data-testid": "trigger",
1230
+ ...bindHover(popupState)
1231
+ },
1232
+ children
1233
+ )), isHovered && /* @__PURE__ */ React.createElement(
1234
1234
  HoverPopover,
1235
1235
  {
1236
1236
  PaperProps: {
@@ -1247,7 +1247,7 @@ const EntityPeekAheadPopover = (props) => {
1247
1247
  },
1248
1248
  onMouseLeave: handleOnMouseLeave
1249
1249
  },
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(
1250
+ /* @__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
1251
  Typography,
1252
1252
  {
1253
1253
  className: classes.descriptionTypography,
@@ -1256,7 +1256,7 @@ const EntityPeekAheadPopover = (props) => {
1256
1256
  entity.metadata.description
1257
1257
  ), /* @__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
1258
  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 })))))
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 && 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
1260
  ));
1261
1261
  };
1262
1262