@backstage/plugin-catalog-react 0.0.0-nightly-20240311021106 → 0.0.0-nightly-20240312020947

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,6 +1,10 @@
1
1
  # @backstage/plugin-catalog-react
2
2
 
3
- ## 0.0.0-nightly-20240311021106
3
+ ## 0.0.0-nightly-20240312020947
4
+
5
+ ### Minor Changes
6
+
7
+ - 72b8827: Number of results is now directly added as the field `totalItems` on `useEntityList`.
4
8
 
5
9
  ### Patch Changes
6
10
 
@@ -9,18 +13,18 @@
9
13
  - a6e237f: Added `DefaultFilters` component
10
14
  - 298953b: Added support for providing an `initiallySelectedNamespaces` which accepts an array of Namespaces to have selected by default
11
15
  - Updated dependencies
12
- - @backstage/core-components@0.0.0-nightly-20240311021106
13
- - @backstage/errors@0.0.0-nightly-20240311021106
14
- - @backstage/integration-react@0.0.0-nightly-20240311021106
15
- - @backstage/plugin-permission-common@0.0.0-nightly-20240311021106
16
- - @backstage/core-plugin-api@0.0.0-nightly-20240311021106
17
- - @backstage/plugin-permission-react@0.0.0-nightly-20240311021106
18
- - @backstage/frontend-plugin-api@0.0.0-nightly-20240311021106
19
- - @backstage/catalog-client@0.0.0-nightly-20240311021106
20
- - @backstage/catalog-model@0.0.0-nightly-20240311021106
16
+ - @backstage/core-components@0.0.0-nightly-20240312020947
17
+ - @backstage/errors@0.0.0-nightly-20240312020947
18
+ - @backstage/integration-react@0.0.0-nightly-20240312020947
19
+ - @backstage/plugin-permission-common@0.0.0-nightly-20240312020947
20
+ - @backstage/core-plugin-api@0.0.0-nightly-20240312020947
21
+ - @backstage/plugin-permission-react@0.0.0-nightly-20240312020947
22
+ - @backstage/frontend-plugin-api@0.0.0-nightly-20240312020947
23
+ - @backstage/catalog-client@0.0.0-nightly-20240312020947
24
+ - @backstage/catalog-model@0.0.0-nightly-20240312020947
21
25
  - @backstage/types@1.1.1
22
26
  - @backstage/version-bridge@1.0.7
23
- - @backstage/plugin-catalog-common@0.0.0-nightly-20240311021106
27
+ - @backstage/plugin-catalog-common@0.0.0-nightly-20240312020947
24
28
 
25
29
  ## 1.10.1-next.1
26
30
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-react",
3
- "version": "0.0.0-nightly-20240311021106",
3
+ "version": "0.0.0-nightly-20240312020947",
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
@@ -708,6 +708,7 @@ type EntityListContextProps<EntityFilters extends DefaultEntityFilters = Default
708
708
  next?: () => void;
709
709
  prev?: () => void;
710
710
  };
711
+ totalItems?: number;
711
712
  };
712
713
  /**
713
714
  * Creates new context for entity listing and filtering.
package/dist/index.esm.js CHANGED
@@ -608,7 +608,8 @@ const EntityListProvider = (props) => {
608
608
  appliedCursor: cursor,
609
609
  backendEntities: response.items,
610
610
  entities: response.items.filter(entityFilter),
611
- pageInfo: response.pageInfo
611
+ pageInfo: response.pageInfo,
612
+ totalItems: response.totalItems
612
613
  });
613
614
  }
614
615
  } else {
@@ -627,7 +628,8 @@ const EntityListProvider = (props) => {
627
628
  appliedFilters: requestedFilters,
628
629
  backendEntities: response.items,
629
630
  entities: response.items.filter(entityFilter),
630
- pageInfo: response.pageInfo
631
+ pageInfo: response.pageInfo,
632
+ totalItems: response.totalItems
631
633
  });
632
634
  }
633
635
  }
@@ -641,16 +643,20 @@ const EntityListProvider = (props) => {
641
643
  const response = await catalogApi.getEntities({
642
644
  filter: backendFilter
643
645
  });
646
+ const entities = response.items.filter(entityFilter);
644
647
  setOutputState({
645
648
  appliedFilters: requestedFilters,
646
649
  backendEntities: response.items,
647
- entities: response.items.filter(entityFilter)
650
+ entities,
651
+ totalItems: entities.length
648
652
  });
649
653
  } else {
654
+ const entities = outputState.backendEntities.filter(entityFilter);
650
655
  setOutputState({
651
656
  appliedFilters: requestedFilters,
652
657
  backendEntities: outputState.backendEntities,
653
- entities: outputState.backendEntities.filter(entityFilter)
658
+ entities,
659
+ totalItems: entities.length
654
660
  });
655
661
  }
656
662
  }
@@ -708,7 +714,8 @@ const EntityListProvider = (props) => {
708
714
  queryParameters,
709
715
  loading,
710
716
  error,
711
- pageInfo
717
+ pageInfo,
718
+ totalItems: outputState.totalItems
712
719
  }),
713
720
  [outputState, updateFilters, queryParameters, loading, error, pageInfo]
714
721
  );
@@ -3297,7 +3304,7 @@ function MockEntityListContextProvider(props) {
3297
3304
  );
3298
3305
  const resolvedValue = useMemo(
3299
3306
  () => {
3300
- var _a2, _b, _c, _d, _e;
3307
+ var _a2, _b, _c, _d, _e, _f, _g;
3301
3308
  return {
3302
3309
  entities: (_a2 = value == null ? void 0 : value.entities) != null ? _a2 : defaultValues.entities,
3303
3310
  backendEntities: (_b = value == null ? void 0 : value.backendEntities) != null ? _b : defaultValues.backendEntities,
@@ -3305,7 +3312,8 @@ function MockEntityListContextProvider(props) {
3305
3312
  filters,
3306
3313
  loading: (_d = value == null ? void 0 : value.loading) != null ? _d : false,
3307
3314
  queryParameters: (_e = value == null ? void 0 : value.queryParameters) != null ? _e : defaultValues.queryParameters,
3308
- error: value == null ? void 0 : value.error
3315
+ error: value == null ? void 0 : value.error,
3316
+ totalItems: (_g = value == null ? void 0 : value.totalItems) != null ? _g : ((_f = value == null ? void 0 : value.entities) != null ? _f : defaultValues.entities).length
3309
3317
  };
3310
3318
  },
3311
3319
  [value, defaultValues, filters, updateFilters]