@backstage/plugin-catalog-react 1.10.0-next.3 → 1.10.1-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,51 @@
1
1
  # @backstage/plugin-catalog-react
2
2
 
3
+ ## 1.10.1-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 930b5c1: Added 'root' and 'label' class keys for EntityAutocompletePicker, EntityOwnerPicker and EntityProcessingStatusPicker
8
+ - Updated dependencies
9
+ - @backstage/errors@1.2.4-next.0
10
+ - @backstage/core-components@0.14.1-next.0
11
+ - @backstage/integration-react@1.1.25-next.0
12
+ - @backstage/plugin-permission-common@0.7.13-next.0
13
+ - @backstage/catalog-client@1.6.1-next.0
14
+ - @backstage/catalog-model@1.4.5-next.0
15
+ - @backstage/core-plugin-api@1.9.1-next.0
16
+ - @backstage/frontend-plugin-api@0.6.1-next.0
17
+ - @backstage/types@1.1.1
18
+ - @backstage/version-bridge@1.0.7
19
+ - @backstage/plugin-catalog-common@1.0.22-next.0
20
+ - @backstage/plugin-permission-react@0.4.21-next.0
21
+
22
+ ## 1.10.0
23
+
24
+ ### Minor Changes
25
+
26
+ - d208a93: Added support for server side text filtering to paginated entity requests.
27
+ - 3dc64e9: Add support to `configSchema` option on the `createEntityCardExtension` factory function.
28
+
29
+ ### Patch Changes
30
+
31
+ - 916da47: Change default icon for unknown entities to nothing instead of the help icon.
32
+ - 71c6d7a: Overflowing labels in OwnerPicker (Catalog) are now truncated. Hovering over them shows the full label
33
+ - 8fe56a8: Widen `@types/react` dependency range to include version 18.
34
+ - 09cedb9: Updated dependency `@react-hookz/web` to `^24.0.0`.
35
+ - Updated dependencies
36
+ - @backstage/frontend-plugin-api@0.6.0
37
+ - @backstage/core-components@0.14.0
38
+ - @backstage/catalog-model@1.4.4
39
+ - @backstage/core-plugin-api@1.9.0
40
+ - @backstage/catalog-client@1.6.0
41
+ - @backstage/plugin-permission-react@0.4.20
42
+ - @backstage/errors@1.2.3
43
+ - @backstage/integration-react@1.1.24
44
+ - @backstage/types@1.1.1
45
+ - @backstage/version-bridge@1.0.7
46
+ - @backstage/plugin-catalog-common@1.0.21
47
+ - @backstage/plugin-permission-common@0.7.12
48
+
3
49
  ## 1.10.0-next.3
4
50
 
5
51
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-react",
3
- "version": "1.10.0-next.3",
3
+ "version": "1.10.1-next.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
@@ -551,6 +551,10 @@ declare class EntityTextFilter implements EntityFilter {
551
551
  readonly value: string;
552
552
  constructor(value: string);
553
553
  filterEntity(entity: Entity): boolean;
554
+ getFullTextFilters(): {
555
+ term: string;
556
+ fields: string[];
557
+ };
554
558
  private toUpperArray;
555
559
  }
556
560
  /**
@@ -726,6 +730,8 @@ type EntityAutocompletePickerProps<T extends DefaultEntityFilters = DefaultEntit
726
730
  initialSelectedOptions?: string[];
727
731
  };
728
732
  /** @public */
733
+ type CatalogReactEntityAutocompletePickerClassKey = 'root' | 'label';
734
+ /** @public */
729
735
  declare function EntityAutocompletePicker<T extends DefaultEntityFilters = DefaultEntityFilters, Name extends AllowedEntityFilters<T> = AllowedEntityFilters<T>>(props: EntityAutocompletePickerProps<T, Name>): React.JSX.Element | null;
730
736
 
731
737
  /** @public */
@@ -890,6 +896,7 @@ type CatalogReactComponentsNameToClassKey = {
890
896
  CatalogReactEntityTagPicker: CatalogReactEntityTagPickerClassKey;
891
897
  CatalogReactEntityOwnerPicker: CatalogReactEntityOwnerPickerClassKey;
892
898
  CatalogReactEntityProcessingStatusPicker: CatalogReactEntityProcessingStatusPickerClassKey;
899
+ CatalogReactEntityAutocompletePickerClassKey: CatalogReactEntityAutocompletePickerClassKey;
893
900
  };
894
901
  /** @public */
895
902
  type BackstageOverrides = Overrides & {
@@ -917,4 +924,4 @@ type EntitySourceLocation = {
917
924
  /** @public */
918
925
  declare function getEntitySourceLocation(entity: Entity, scmIntegrationsApi: typeof scmIntegrationsApiRef.T): EntitySourceLocation | undefined;
919
926
 
920
- export { AllowedEntityFilters, AsyncEntityProvider, AsyncEntityProviderProps, BackstageOverrides, CatalogFilterLayout, CatalogReactComponentsNameToClassKey, CatalogReactEntityDisplayNameClassKey, CatalogReactEntityLifecyclePickerClassKey, CatalogReactEntityNamespacePickerClassKey, CatalogReactEntityOwnerPickerClassKey, CatalogReactEntityProcessingStatusPickerClassKey, CatalogReactEntitySearchBarClassKey, CatalogReactEntityTagPickerClassKey, CatalogReactUserListPickerClassKey, DefaultEntityFilters, EntityAutocompletePicker, EntityAutocompletePickerProps, EntityDisplayName, EntityDisplayNameProps, EntityErrorFilter, EntityFilter, EntityKindFilter, EntityKindPicker, EntityKindPickerProps, EntityLifecycleFilter, EntityLifecyclePicker, EntityListContext, EntityListContextProps, EntityListProvider, EntityListProviderProps, EntityLoadingStatus, EntityNamespaceFilter, EntityNamespacePicker, EntityOrphanFilter, EntityOwnerFilter, EntityOwnerPicker, EntityOwnerPickerProps, EntityPeekAheadPopover, EntityPeekAheadPopoverProps, EntityPresentationApi, EntityProcessingStatusPicker, EntityProvider, EntityProviderProps, EntityRefLink, EntityRefLinkProps, EntityRefLinks, EntityRefLinksProps, EntityRefPresentation, EntityRefPresentationSnapshot, EntitySearchBar, EntitySourceLocation, EntityTable, EntityTableProps, EntityTagFilter, EntityTagPicker, EntityTagPickerProps, EntityTextFilter, EntityTypeFilter, EntityTypePicker, EntityTypePickerProps, EntityUserFilter, FavoriteEntity, FavoriteEntityProps, InspectEntityDialog, MissingAnnotationEmptyState, MissingAnnotationEmptyStateClassKey, MockEntityListContextProvider, MockStarredEntitiesApi, StarredEntitiesApi, UnregisterEntityDialog, UnregisterEntityDialogProps, UserListFilter, UserListFilterKind, UserListPicker, UserListPickerProps, catalogApiRef, columnFactories, defaultEntityPresentation, entityPresentationApiRef, entityRouteParams, entityRouteRef, getEntityRelations, getEntitySourceLocation, humanizeEntityRef, starredEntitiesApiRef, useAsyncEntity, useEntity, useEntityList, useEntityOwnership, useEntityPresentation, useEntityTypeFilter, useRelatedEntities, useStarredEntities, useStarredEntity };
927
+ export { AllowedEntityFilters, AsyncEntityProvider, AsyncEntityProviderProps, BackstageOverrides, CatalogFilterLayout, CatalogReactComponentsNameToClassKey, CatalogReactEntityAutocompletePickerClassKey, CatalogReactEntityDisplayNameClassKey, CatalogReactEntityLifecyclePickerClassKey, CatalogReactEntityNamespacePickerClassKey, CatalogReactEntityOwnerPickerClassKey, CatalogReactEntityProcessingStatusPickerClassKey, CatalogReactEntitySearchBarClassKey, CatalogReactEntityTagPickerClassKey, CatalogReactUserListPickerClassKey, DefaultEntityFilters, EntityAutocompletePicker, EntityAutocompletePickerProps, EntityDisplayName, EntityDisplayNameProps, EntityErrorFilter, EntityFilter, EntityKindFilter, EntityKindPicker, EntityKindPickerProps, EntityLifecycleFilter, EntityLifecyclePicker, EntityListContext, EntityListContextProps, EntityListProvider, EntityListProviderProps, EntityLoadingStatus, EntityNamespaceFilter, EntityNamespacePicker, EntityOrphanFilter, EntityOwnerFilter, EntityOwnerPicker, EntityOwnerPickerProps, EntityPeekAheadPopover, EntityPeekAheadPopoverProps, EntityPresentationApi, EntityProcessingStatusPicker, EntityProvider, EntityProviderProps, EntityRefLink, EntityRefLinkProps, EntityRefLinks, EntityRefLinksProps, EntityRefPresentation, EntityRefPresentationSnapshot, EntitySearchBar, EntitySourceLocation, EntityTable, EntityTableProps, EntityTagFilter, EntityTagPicker, EntityTagPickerProps, EntityTextFilter, EntityTypeFilter, EntityTypePicker, EntityTypePickerProps, EntityUserFilter, FavoriteEntity, FavoriteEntityProps, InspectEntityDialog, MissingAnnotationEmptyState, MissingAnnotationEmptyStateClassKey, MockEntityListContextProvider, MockStarredEntitiesApi, StarredEntitiesApi, UnregisterEntityDialog, UnregisterEntityDialogProps, UserListFilter, UserListFilterKind, UserListPicker, UserListPickerProps, catalogApiRef, columnFactories, defaultEntityPresentation, entityPresentationApiRef, entityRouteParams, entityRouteRef, getEntityRelations, getEntitySourceLocation, humanizeEntityRef, starredEntitiesApiRef, useAsyncEntity, useEntity, useEntityList, useEntityOwnership, useEntityPresentation, useEntityTypeFilter, useRelatedEntities, useStarredEntities, useStarredEntity };
package/dist/index.esm.js CHANGED
@@ -267,13 +267,22 @@ const CatalogFilterLayout = (props) => {
267
267
  CatalogFilterLayout.Filters = Filters;
268
268
  CatalogFilterLayout.Content = Content;
269
269
 
270
+ function isEntityTextFilter(t) {
271
+ return !!t.getFullTextFilters;
272
+ }
270
273
  function reduceCatalogFilters(filters) {
271
- return filters.reduce((compoundFilter, filter) => {
272
- return {
273
- ...compoundFilter,
274
- ...filter.getCatalogFilters ? filter.getCatalogFilters() : {}
275
- };
276
- }, {});
274
+ var _a;
275
+ const condensedFilters = filters.reduce(
276
+ (compoundFilter, filter) => {
277
+ return {
278
+ ...compoundFilter,
279
+ ...filter.getCatalogFilters ? filter.getCatalogFilters() : {}
280
+ };
281
+ },
282
+ {}
283
+ );
284
+ const fullTextFilter = (_a = filters.find(isEntityTextFilter)) == null ? void 0 : _a.getFullTextFilters();
285
+ return { filter: condensedFilters, fullTextFilter };
277
286
  }
278
287
  function reduceBackendCatalogFilters(filters) {
279
288
  const backendCatalogFilters = {};
@@ -377,6 +386,13 @@ class EntityTextFilter {
377
386
  }
378
387
  return true;
379
388
  }
389
+ getFullTextFilters() {
390
+ return {
391
+ term: this.value,
392
+ // Update this to be more dynamic based on table columns.
393
+ fields: ["metadata.name", "metadata.title", "spec.profile.displayName"]
394
+ };
395
+ }
380
396
  toUpperArray(value) {
381
397
  return value.flat().filter((m) => Boolean(m)).map((m) => m.toLocaleUpperCase("en-US"));
382
398
  }
@@ -603,7 +619,7 @@ const EntityListProvider = (props) => {
603
619
  );
604
620
  if (!isEqual(previousBackendFilter, backendFilter)) {
605
621
  const response = await catalogApi.queryEntities({
606
- filter: backendFilter,
622
+ ...backendFilter,
607
623
  limit,
608
624
  orderFields: [{ field: "metadata.name", order: "asc" }]
609
625
  });
@@ -1008,7 +1024,7 @@ const EntityAutocompletePickerOption = memo((props) => {
1008
1024
  );
1009
1025
  });
1010
1026
 
1011
- const useStyles$h = makeStyles(
1027
+ const useStyles$i = makeStyles(
1012
1028
  {
1013
1029
  input: {}
1014
1030
  },
@@ -1017,7 +1033,7 @@ const useStyles$h = makeStyles(
1017
1033
  }
1018
1034
  );
1019
1035
  function EntityAutocompletePickerInput(params) {
1020
- const classes = useStyles$h();
1036
+ const classes = useStyles$i();
1021
1037
  return /* @__PURE__ */ React.createElement(
1022
1038
  TextField,
1023
1039
  {
@@ -1028,6 +1044,13 @@ function EntityAutocompletePickerInput(params) {
1028
1044
  );
1029
1045
  }
1030
1046
 
1047
+ const useStyles$h = makeStyles(
1048
+ {
1049
+ root: {},
1050
+ label: {}
1051
+ },
1052
+ { name: "CatalogReactEntityAutocompletePicker" }
1053
+ );
1031
1054
  function EntityAutocompletePicker(props) {
1032
1055
  var _a, _b;
1033
1056
  const {
@@ -1039,6 +1062,7 @@ function EntityAutocompletePicker(props) {
1039
1062
  InputProps,
1040
1063
  initialSelectedOptions = []
1041
1064
  } = props;
1065
+ const classes = useStyles$h();
1042
1066
  const {
1043
1067
  updateFilters,
1044
1068
  filters,
@@ -1081,7 +1105,7 @@ function EntityAutocompletePicker(props) {
1081
1105
  }
1082
1106
  if (availableOptions.length <= 1)
1083
1107
  return null;
1084
- return /* @__PURE__ */ React.createElement(Box, { pb: 1, pt: 1 }, /* @__PURE__ */ React.createElement(Typography, { variant: "button", component: "label" }, label, /* @__PURE__ */ React.createElement(
1108
+ return /* @__PURE__ */ React.createElement(Box, { className: classes.root, pb: 1, pt: 1 }, /* @__PURE__ */ React.createElement(Typography, { className: classes.label, variant: "button", component: "label" }, label, /* @__PURE__ */ React.createElement(
1085
1109
  Autocomplete,
1086
1110
  {
1087
1111
  multiple: true,
@@ -1339,6 +1363,8 @@ function useSelectedOwners({
1339
1363
 
1340
1364
  const useStyles$f = makeStyles(
1341
1365
  {
1366
+ root: {},
1367
+ label: {},
1342
1368
  input: {},
1343
1369
  fullWidth: { width: "100%" },
1344
1370
  boxLabel: {
@@ -1424,7 +1450,7 @@ const EntityOwnerPicker = (props) => {
1424
1450
  )) {
1425
1451
  return null;
1426
1452
  }
1427
- return /* @__PURE__ */ React.createElement(Box, { pb: 1, pt: 1 }, /* @__PURE__ */ React.createElement(Typography, { variant: "button", component: "label" }, "Owner", /* @__PURE__ */ React.createElement(
1453
+ return /* @__PURE__ */ React.createElement(Box, { className: classes.root, pb: 1, pt: 1 }, /* @__PURE__ */ React.createElement(Typography, { className: classes.label, variant: "button", component: "label" }, "Owner", /* @__PURE__ */ React.createElement(
1428
1454
  Autocomplete,
1429
1455
  {
1430
1456
  multiple: true,
@@ -2742,7 +2768,7 @@ function useOwnedEntitiesCount() {
2742
2768
  []
2743
2769
  );
2744
2770
  const { user, owners, ...allFilters } = filters;
2745
- const { ["metadata.name"]: metadata, ...filter } = reduceCatalogFilters(
2771
+ const catalogFilters = reduceCatalogFilters(
2746
2772
  compact(Object.values(allFilters))
2747
2773
  );
2748
2774
  const [{ value: count, loading: loadingEntityOwnership }, fetchEntities] = useAsyncFn(
@@ -2754,9 +2780,11 @@ function useOwnedEntitiesCount() {
2754
2780
  if (ownedClaims === void 0) {
2755
2781
  return 0;
2756
2782
  }
2783
+ const { ["metadata.name"]: metadata, ...filter } = req.filter.filter;
2757
2784
  const { totalItems } = await catalogApi.queryEntities({
2785
+ ...req.filter,
2758
2786
  filter: {
2759
- ...req.filter,
2787
+ ...filter,
2760
2788
  "relations.ownedBy": ownedClaims
2761
2789
  },
2762
2790
  limit: 0
@@ -2767,14 +2795,18 @@ function useOwnedEntitiesCount() {
2767
2795
  { loading: true }
2768
2796
  );
2769
2797
  useDeepCompareEffect(() => {
2770
- if (Object.keys(filter).length === 0) {
2798
+ if (Object.keys(catalogFilters.filter).length === 0) {
2771
2799
  return;
2772
2800
  }
2773
2801
  if (ownershipEntityRefs === void 0) {
2774
2802
  return;
2775
2803
  }
2776
- fetchEntities({ ownershipEntityRefs, owners, filter });
2777
- }, [ownershipEntityRefs, owners, filter]);
2804
+ fetchEntities({
2805
+ ownershipEntityRefs,
2806
+ owners,
2807
+ filter: catalogFilters
2808
+ });
2809
+ }, [ownershipEntityRefs, owners, catalogFilters]);
2778
2810
  const loading = loadingEntityRefs || loadingEntityOwnership;
2779
2811
  return {
2780
2812
  count,
@@ -2809,12 +2841,12 @@ function useAllEntitiesCount() {
2809
2841
  const request = useMemo(() => {
2810
2842
  const { user, ...allFilters } = filters;
2811
2843
  const compacted = compact(Object.values(allFilters));
2812
- const filter = reduceCatalogFilters(compacted);
2844
+ const catalogFilters = reduceCatalogFilters(compacted);
2813
2845
  const newRequest = {
2814
- filter,
2846
+ ...catalogFilters,
2815
2847
  limit: 0
2816
2848
  };
2817
- if (Object.keys(filter).length === 0) {
2849
+ if (Object.keys(catalogFilters.filter).length === 0) {
2818
2850
  prevRequest.current = void 0;
2819
2851
  return prevRequest.current;
2820
2852
  }
@@ -2842,11 +2874,12 @@ function useStarredEntitiesCount() {
2842
2874
  const request = useMemo(() => {
2843
2875
  const { user, ...allFilters } = filters;
2844
2876
  const compacted = compact(Object.values(allFilters));
2845
- const filter2 = reduceCatalogFilters(compacted);
2877
+ const catalogFilters = reduceCatalogFilters(compacted);
2846
2878
  const facet = "metadata.name";
2847
2879
  const newRequest = {
2880
+ ...catalogFilters,
2848
2881
  filter: {
2849
- ...filter2,
2882
+ ...catalogFilters.filter,
2850
2883
  /**
2851
2884
  * here we are filtering entities by `name`. Given this filter,
2852
2885
  * the response might contain more entities than expected, in case multiple entities
@@ -3056,7 +3089,9 @@ const UserListPicker = (props) => {
3056
3089
 
3057
3090
  const useStyles$2 = makeStyles(
3058
3091
  {
3059
- input: {}
3092
+ root: {},
3093
+ input: {},
3094
+ label: {}
3060
3095
  },
3061
3096
  {
3062
3097
  name: "CatalogReactEntityProcessingStatusPickerPicker"
@@ -3081,7 +3116,7 @@ const EntityProcessingStatusPicker = () => {
3081
3116
  });
3082
3117
  }
3083
3118
  const availableAdvancedItems = ["Is Orphan", "Has Error"];
3084
- return /* @__PURE__ */ React.createElement(Box, { pb: 1, pt: 1 }, /* @__PURE__ */ React.createElement(Typography, { variant: "button", component: "label" }, "Processing Status", /* @__PURE__ */ React.createElement(
3119
+ return /* @__PURE__ */ React.createElement(Box, { className: classes.root, pb: 1, pt: 1 }, /* @__PURE__ */ React.createElement(Typography, { className: classes.label, variant: "button", component: "label" }, "Processing Status", /* @__PURE__ */ React.createElement(
3085
3120
  Autocomplete,
3086
3121
  {
3087
3122
  multiple: true,