@backstage/plugin-catalog-react 1.2.4 → 1.3.0-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,40 @@
1
1
  # @backstage/plugin-catalog-react
2
2
 
3
+ ## 1.3.0-next.1
4
+
5
+ ### Minor Changes
6
+
7
+ - fab93c2fe8: Aligned buttons on "Unregister entity" dialog to keep them on the same line
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @backstage/core-components@0.12.4-next.0
13
+ - @backstage/catalog-client@1.3.1-next.0
14
+ - @backstage/catalog-model@1.1.6-next.0
15
+ - @backstage/core-plugin-api@1.3.0
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.11-next.0
22
+ - @backstage/plugin-permission-common@0.7.3
23
+ - @backstage/plugin-permission-react@0.4.9
24
+
25
+ ## 1.3.0-next.0
26
+
27
+ ### Minor Changes
28
+
29
+ - 929e1afe1b: Add `initialFilter` prop to EntityLifecyclePicker. This allows you to set an initial lifecycle for the catalog.
30
+
31
+ ### Patch Changes
32
+
33
+ - Updated dependencies
34
+ - @backstage/catalog-model@1.1.6-next.0
35
+ - @backstage/catalog-client@1.3.1-next.0
36
+ - @backstage/plugin-catalog-common@1.0.11-next.0
37
+
3
38
  ## 1.2.4
4
39
 
5
40
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-react",
3
- "version": "1.2.4",
3
+ "version": "1.3.0-next.1",
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) {
@@ -2182,11 +2183,15 @@ function useUnregisterEntityDialogState(entity) {
2182
2183
  const useStyles$2 = makeStyles({
2183
2184
  advancedButton: {
2184
2185
  fontSize: "0.7em"
2186
+ },
2187
+ dialogActions: {
2188
+ display: "inline-block"
2185
2189
  }
2186
2190
  });
2187
2191
  const Contents = ({
2188
2192
  entity,
2189
- onConfirm
2193
+ onConfirm,
2194
+ onClose
2190
2195
  }) => {
2191
2196
  var _a;
2192
2197
  const alertApi = useApi(alertApiRef);
@@ -2230,6 +2235,7 @@ const Contents = ({
2230
2235
  },
2231
2236
  [alertApi, onConfirm, state]
2232
2237
  );
2238
+ const DialogActionsPanel = () => /* @__PURE__ */ React.createElement(DialogActions, { className: classes.dialogActions }, /* @__PURE__ */ React.createElement(Button, { onClick: onClose, color: "primary" }, "Cancel"));
2233
2239
  if (state.type === "loading") {
2234
2240
  return /* @__PURE__ */ React.createElement(Progress, null);
2235
2241
  }
@@ -2237,7 +2243,7 @@ const Contents = ({
2237
2243
  return /* @__PURE__ */ React.createElement(ResponseErrorPanel, { error: state.error });
2238
2244
  }
2239
2245
  if (state.type === "bootstrap") {
2240
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Alert$1, { severity: "info" }, 'You cannot unregister this entity, since it originates from a protected Backstage configuration (location "', state.location, '"). If you believe this is in error, please contact the ', appTitle, " ", "integrator."), /* @__PURE__ */ React.createElement(Box, { marginTop: 2 }, !showDelete && /* @__PURE__ */ React.createElement(
2246
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Alert$1, { severity: "info" }, 'You cannot unregister this entity, since it originates from a protected Backstage configuration (location "', state.location, '"). If you believe this is in error, please contact the ', appTitle, " ", "integrator."), /* @__PURE__ */ React.createElement(Box, { marginTop: 2 }, !showDelete && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
2241
2247
  Button,
2242
2248
  {
2243
2249
  variant: "text",
@@ -2247,7 +2253,7 @@ const Contents = ({
2247
2253
  onClick: () => setShowDelete(true)
2248
2254
  },
2249
2255
  "Advanced Options"
2250
- ), showDelete && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DialogContentText, null, "You have the option to delete the entity itself from the catalog. Note that this should only be done if you know that the catalog file has been deleted at, or moved from, its origin location. If that is not the case, the entity will reappear shortly as the next refresh round is performed by the catalog."), /* @__PURE__ */ React.createElement(
2256
+ ), /* @__PURE__ */ React.createElement(DialogActionsPanel, null)), showDelete && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DialogContentText, null, "You have the option to delete the entity itself from the catalog. Note that this should only be done if you know that the catalog file has been deleted at, or moved from, its origin location. If that is not the case, the entity will reappear shortly as the next refresh round is performed by the catalog."), /* @__PURE__ */ React.createElement(
2251
2257
  Button,
2252
2258
  {
2253
2259
  variant: "contained",
@@ -2256,7 +2262,7 @@ const Contents = ({
2256
2262
  onClick: onDelete
2257
2263
  },
2258
2264
  "Delete Entity"
2259
- ))));
2265
+ ), /* @__PURE__ */ React.createElement(DialogActionsPanel, null))));
2260
2266
  }
2261
2267
  if (state.type === "only-delete") {
2262
2268
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DialogContentText, null, "This entity does not seem to originate from a registered location. You therefore only have the option to delete it outright from the catalog."), /* @__PURE__ */ React.createElement(
@@ -2268,7 +2274,7 @@ const Contents = ({
2268
2274
  onClick: onDelete
2269
2275
  },
2270
2276
  "Delete Entity"
2271
- ));
2277
+ ), /* @__PURE__ */ React.createElement(DialogActionsPanel, null));
2272
2278
  }
2273
2279
  if (state.type === "unregister") {
2274
2280
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DialogContentText, null, "This action will unregister the following entities:"), /* @__PURE__ */ React.createElement(DialogContentText, { component: "ul" }, state.colocatedEntities.map((e) => /* @__PURE__ */ React.createElement("li", { key: `${e.kind}:${e.namespace}/${e.name}` }, /* @__PURE__ */ React.createElement(EntityRefLink, { entityRef: e })))), /* @__PURE__ */ React.createElement(DialogContentText, null, "Located at the following location:"), /* @__PURE__ */ React.createElement(DialogContentText, { component: "ul" }, /* @__PURE__ */ React.createElement("li", null, state.location)), /* @__PURE__ */ React.createElement(DialogContentText, null, "To undo, just re-register the entity in ", appTitle, "."), /* @__PURE__ */ React.createElement(Box, { marginTop: 2 }, /* @__PURE__ */ React.createElement(
@@ -2305,7 +2311,7 @@ const Contents = ({
2305
2311
  };
2306
2312
  const UnregisterEntityDialog = (props) => {
2307
2313
  const { open, onConfirm, onClose, entity } = props;
2308
- return /* @__PURE__ */ React.createElement(Dialog, { open, onClose }, /* @__PURE__ */ React.createElement(DialogTitle, { id: "responsive-dialog-title" }, "Are you sure you want to unregister this entity?"), /* @__PURE__ */ React.createElement(DialogContent, null, /* @__PURE__ */ React.createElement(Contents, { entity, onConfirm })), /* @__PURE__ */ React.createElement(DialogActions, null, /* @__PURE__ */ React.createElement(Button, { onClick: onClose, color: "primary" }, "Cancel")));
2314
+ return /* @__PURE__ */ React.createElement(Dialog, { open, onClose }, /* @__PURE__ */ React.createElement(DialogTitle, { id: "responsive-dialog-title" }, "Are you sure you want to unregister this entity?"), /* @__PURE__ */ React.createElement(DialogContent, null, /* @__PURE__ */ React.createElement(Contents, { entity, onConfirm, onClose })));
2309
2315
  };
2310
2316
 
2311
2317
  const useStyles$1 = makeStyles(
@@ -2381,8 +2387,10 @@ const UserListPicker = (props) => {
2381
2387
  const filterGroups = getFilterGroups(orgName).map((filterGroup) => ({
2382
2388
  ...filterGroup,
2383
2389
  items: filterGroup.items.filter(
2384
- ({ id }) => // TODO: avoid hardcoding kinds here
2385
- ["group", "user"].some((kind) => kind === kindParameter) ? userAndGroupFilterIds.includes(id) : !availableFilters || availableFilters.includes(id)
2390
+ ({ id }) => (
2391
+ // TODO: avoid hardcoding kinds here
2392
+ ["group", "user"].some((kind) => kind === kindParameter) ? userAndGroupFilterIds.includes(id) : !availableFilters || availableFilters.includes(id)
2393
+ )
2386
2394
  )
2387
2395
  })).filter(({ items }) => !!items.length);
2388
2396
  const { isStarredEntity } = useStarredEntities();