@backstage/plugin-catalog-react 1.10.1-next.1 → 1.11.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,54 @@
1
1
  # @backstage/plugin-catalog-react
2
2
 
3
+ ## 1.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 72b8827: Number of results is now directly added as the field `totalItems` on `useEntityList`.
8
+
9
+ ### Patch Changes
10
+
11
+ - 930b5c1: Added 'root' and 'label' class keys for EntityAutocompletePicker, EntityOwnerPicker and EntityProcessingStatusPicker
12
+ - b2a9926: Adds an argument for which filters should be applied when fetching/counting available values
13
+ - a6e237f: Added `DefaultFilters` component
14
+ - 298953b: Added support for providing an `initiallySelectedNamespaces` which accepts an array of Namespaces to have selected by default
15
+ - Updated dependencies
16
+ - @backstage/core-components@0.14.1
17
+ - @backstage/errors@1.2.4
18
+ - @backstage/integration-react@1.1.25
19
+ - @backstage/plugin-permission-common@0.7.13
20
+ - @backstage/catalog-client@1.6.1
21
+ - @backstage/catalog-model@1.4.5
22
+ - @backstage/core-plugin-api@1.9.1
23
+ - @backstage/frontend-plugin-api@0.6.1
24
+ - @backstage/types@1.1.1
25
+ - @backstage/version-bridge@1.0.7
26
+ - @backstage/plugin-catalog-common@1.0.22
27
+ - @backstage/plugin-permission-react@0.4.21
28
+
29
+ ## 1.11.0-next.2
30
+
31
+ ### Minor Changes
32
+
33
+ - 72b8827: Number of results is now directly added as the field `totalItems` on `useEntityList`.
34
+
35
+ ### Patch Changes
36
+
37
+ - 298953b: Added support for providing an `initiallySelectedNamespaces` which accepts an array of Namespaces to have selected by default
38
+ - Updated dependencies
39
+ - @backstage/core-components@0.14.1-next.2
40
+ - @backstage/catalog-client@1.6.1-next.1
41
+ - @backstage/integration-react@1.1.25-next.2
42
+ - @backstage/frontend-plugin-api@0.6.1-next.2
43
+ - @backstage/catalog-model@1.4.5-next.0
44
+ - @backstage/core-plugin-api@1.9.1-next.1
45
+ - @backstage/errors@1.2.4-next.0
46
+ - @backstage/types@1.1.1
47
+ - @backstage/version-bridge@1.0.7
48
+ - @backstage/plugin-catalog-common@1.0.22-next.1
49
+ - @backstage/plugin-permission-common@0.7.13-next.1
50
+ - @backstage/plugin-permission-react@0.4.21-next.1
51
+
3
52
  ## 1.10.1-next.1
4
53
 
5
54
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-react",
3
- "version": "1.10.1-next.1",
3
+ "version": "1.11.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
@@ -255,6 +255,7 @@ type DefaultFiltersProps = {
255
255
  initialKind?: string;
256
256
  initiallySelectedFilter?: UserListFilterKind;
257
257
  ownerPickerMode?: EntityOwnerPickerProps['mode'];
258
+ initiallySelectedNamespaces?: string[];
258
259
  };
259
260
  /** @public */
260
261
  declare const DefaultFilters: (props: DefaultFiltersProps) => React.JSX.Element;
@@ -521,8 +522,16 @@ declare const EntityProcessingStatusPicker: () => React.JSX.Element;
521
522
 
522
523
  /** @public */
523
524
  type CatalogReactEntityNamespacePickerClassKey = 'input';
525
+ /**
526
+ * Props for {@link EntityNamespacePicker}.
527
+ *
528
+ * @public
529
+ */
530
+ interface EntityNamespacePickerProps {
531
+ initiallySelectedNamespaces?: string[];
532
+ }
524
533
  /** @public */
525
- declare const EntityNamespacePicker: () => React.JSX.Element;
534
+ declare const EntityNamespacePicker: (props: EntityNamespacePickerProps) => React.JSX.Element;
526
535
 
527
536
  /**
528
537
  * Filter entities based on Kind.
@@ -699,6 +708,7 @@ type EntityListContextProps<EntityFilters extends DefaultEntityFilters = Default
699
708
  next?: () => void;
700
709
  prev?: () => void;
701
710
  };
711
+ totalItems?: number;
702
712
  };
703
713
  /**
704
714
  * Creates new context for entity listing and filtering.
@@ -938,4 +948,4 @@ type EntitySourceLocation = {
938
948
  /** @public */
939
949
  declare function getEntitySourceLocation(entity: Entity, scmIntegrationsApi: typeof scmIntegrationsApiRef.T): EntitySourceLocation | undefined;
940
950
 
941
- export { AllowedEntityFilters, AsyncEntityProvider, AsyncEntityProviderProps, BackstageOverrides, CatalogFilterLayout, CatalogReactComponentsNameToClassKey, CatalogReactEntityAutocompletePickerClassKey, CatalogReactEntityDisplayNameClassKey, CatalogReactEntityLifecyclePickerClassKey, CatalogReactEntityNamespacePickerClassKey, CatalogReactEntityOwnerPickerClassKey, CatalogReactEntityProcessingStatusPickerClassKey, CatalogReactEntitySearchBarClassKey, CatalogReactEntityTagPickerClassKey, CatalogReactUserListPickerClassKey, DefaultEntityFilters, DefaultFilters, DefaultFiltersProps, 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 };
951
+ export { AllowedEntityFilters, AsyncEntityProvider, AsyncEntityProviderProps, BackstageOverrides, CatalogFilterLayout, CatalogReactComponentsNameToClassKey, CatalogReactEntityAutocompletePickerClassKey, CatalogReactEntityDisplayNameClassKey, CatalogReactEntityLifecyclePickerClassKey, CatalogReactEntityNamespacePickerClassKey, CatalogReactEntityOwnerPickerClassKey, CatalogReactEntityProcessingStatusPickerClassKey, CatalogReactEntitySearchBarClassKey, CatalogReactEntityTagPickerClassKey, CatalogReactUserListPickerClassKey, DefaultEntityFilters, DefaultFilters, DefaultFiltersProps, EntityAutocompletePicker, EntityAutocompletePickerProps, EntityDisplayName, EntityDisplayNameProps, EntityErrorFilter, EntityFilter, EntityKindFilter, EntityKindPicker, EntityKindPickerProps, EntityLifecycleFilter, EntityLifecyclePicker, EntityListContext, EntityListContextProps, EntityListProvider, EntityListProviderProps, EntityLoadingStatus, EntityNamespaceFilter, EntityNamespacePicker, EntityNamespacePickerProps, 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
@@ -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
  );
@@ -1166,7 +1173,8 @@ const useStyles$f = makeStyles(
1166
1173
  name: "CatalogReactEntityNamespacePicker"
1167
1174
  }
1168
1175
  );
1169
- const EntityNamespacePicker = () => {
1176
+ const EntityNamespacePicker = (props) => {
1177
+ const { initiallySelectedNamespaces } = props;
1170
1178
  const classes = useStyles$f();
1171
1179
  return /* @__PURE__ */ React.createElement(
1172
1180
  EntityAutocompletePicker,
@@ -1175,7 +1183,8 @@ const EntityNamespacePicker = () => {
1175
1183
  name: "namespace",
1176
1184
  path: "metadata.namespace",
1177
1185
  Filter: EntityNamespaceFilter,
1178
- InputProps: { className: classes.input }
1186
+ InputProps: { className: classes.input },
1187
+ initialSelectedOptions: initiallySelectedNamespaces
1179
1188
  }
1180
1189
  );
1181
1190
  };
@@ -1998,8 +2007,18 @@ const UserListPicker = (props) => {
1998
2007
  };
1999
2008
 
2000
2009
  const DefaultFilters = (props) => {
2001
- const { initialKind, initiallySelectedFilter, ownerPickerMode } = props;
2002
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(EntityKindPicker, { initialFilter: initialKind }), /* @__PURE__ */ React.createElement(EntityTypePicker, null), /* @__PURE__ */ React.createElement(UserListPicker, { initialFilter: initiallySelectedFilter }), /* @__PURE__ */ React.createElement(EntityOwnerPicker, { mode: ownerPickerMode }), /* @__PURE__ */ React.createElement(EntityLifecyclePicker, null), /* @__PURE__ */ React.createElement(EntityTagPicker, null), /* @__PURE__ */ React.createElement(EntityProcessingStatusPicker, null), /* @__PURE__ */ React.createElement(EntityNamespacePicker, null));
2010
+ const {
2011
+ initialKind,
2012
+ initiallySelectedFilter,
2013
+ ownerPickerMode,
2014
+ initiallySelectedNamespaces
2015
+ } = props;
2016
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(EntityKindPicker, { initialFilter: initialKind }), /* @__PURE__ */ React.createElement(EntityTypePicker, null), /* @__PURE__ */ React.createElement(UserListPicker, { initialFilter: initiallySelectedFilter }), /* @__PURE__ */ React.createElement(EntityOwnerPicker, { mode: ownerPickerMode }), /* @__PURE__ */ React.createElement(EntityLifecyclePicker, null), /* @__PURE__ */ React.createElement(EntityTagPicker, null), /* @__PURE__ */ React.createElement(EntityProcessingStatusPicker, null), /* @__PURE__ */ React.createElement(
2017
+ EntityNamespacePicker,
2018
+ {
2019
+ initiallySelectedNamespaces
2020
+ }
2021
+ ));
2003
2022
  };
2004
2023
 
2005
2024
  const useStyles$a = makeStyles(
@@ -3285,7 +3304,7 @@ function MockEntityListContextProvider(props) {
3285
3304
  );
3286
3305
  const resolvedValue = useMemo(
3287
3306
  () => {
3288
- var _a2, _b, _c, _d, _e;
3307
+ var _a2, _b, _c, _d, _e, _f, _g;
3289
3308
  return {
3290
3309
  entities: (_a2 = value == null ? void 0 : value.entities) != null ? _a2 : defaultValues.entities,
3291
3310
  backendEntities: (_b = value == null ? void 0 : value.backendEntities) != null ? _b : defaultValues.backendEntities,
@@ -3293,7 +3312,8 @@ function MockEntityListContextProvider(props) {
3293
3312
  filters,
3294
3313
  loading: (_d = value == null ? void 0 : value.loading) != null ? _d : false,
3295
3314
  queryParameters: (_e = value == null ? void 0 : value.queryParameters) != null ? _e : defaultValues.queryParameters,
3296
- 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
3297
3317
  };
3298
3318
  },
3299
3319
  [value, defaultValues, filters, updateFilters]