@backstage/plugin-catalog-react 1.10.0-next.2 → 1.10.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 +46 -0
- package/alpha/package.json +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.esm.js +40 -17
- package/dist/index.esm.js.map +1 -1
- package/package.json +15 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-react
|
|
2
2
|
|
|
3
|
+
## 1.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- d208a93: Added support for server side text filtering to paginated entity requests.
|
|
8
|
+
- 3dc64e9: Add support to `configSchema` option on the `createEntityCardExtension` factory function.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- 916da47: Change default icon for unknown entities to nothing instead of the help icon.
|
|
13
|
+
- 71c6d7a: Overflowing labels in OwnerPicker (Catalog) are now truncated. Hovering over them shows the full label
|
|
14
|
+
- 8fe56a8: Widen `@types/react` dependency range to include version 18.
|
|
15
|
+
- 09cedb9: Updated dependency `@react-hookz/web` to `^24.0.0`.
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
- @backstage/frontend-plugin-api@0.6.0
|
|
18
|
+
- @backstage/core-components@0.14.0
|
|
19
|
+
- @backstage/catalog-model@1.4.4
|
|
20
|
+
- @backstage/core-plugin-api@1.9.0
|
|
21
|
+
- @backstage/catalog-client@1.6.0
|
|
22
|
+
- @backstage/plugin-permission-react@0.4.20
|
|
23
|
+
- @backstage/errors@1.2.3
|
|
24
|
+
- @backstage/integration-react@1.1.24
|
|
25
|
+
- @backstage/types@1.1.1
|
|
26
|
+
- @backstage/version-bridge@1.0.7
|
|
27
|
+
- @backstage/plugin-catalog-common@1.0.21
|
|
28
|
+
- @backstage/plugin-permission-common@0.7.12
|
|
29
|
+
|
|
30
|
+
## 1.10.0-next.3
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- 09cedb9: Updated dependency `@react-hookz/web` to `^24.0.0`.
|
|
35
|
+
- Updated dependencies
|
|
36
|
+
- @backstage/core-components@0.14.0-next.2
|
|
37
|
+
- @backstage/catalog-client@1.6.0-next.1
|
|
38
|
+
- @backstage/catalog-model@1.4.4-next.0
|
|
39
|
+
- @backstage/core-plugin-api@1.9.0-next.1
|
|
40
|
+
- @backstage/errors@1.2.3
|
|
41
|
+
- @backstage/frontend-plugin-api@0.6.0-next.3
|
|
42
|
+
- @backstage/integration-react@1.1.24-next.2
|
|
43
|
+
- @backstage/types@1.1.1
|
|
44
|
+
- @backstage/version-bridge@1.0.7
|
|
45
|
+
- @backstage/plugin-catalog-common@1.0.21-next.0
|
|
46
|
+
- @backstage/plugin-permission-common@0.7.12
|
|
47
|
+
- @backstage/plugin-permission-react@0.4.20-next.1
|
|
48
|
+
|
|
3
49
|
## 1.10.0-next.2
|
|
4
50
|
|
|
5
51
|
### Minor Changes
|
package/alpha/package.json
CHANGED
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
|
/**
|
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
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
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
|
-
|
|
622
|
+
...backendFilter,
|
|
607
623
|
limit,
|
|
608
624
|
orderFields: [{ field: "metadata.name", order: "asc" }]
|
|
609
625
|
});
|
|
@@ -2742,7 +2758,7 @@ function useOwnedEntitiesCount() {
|
|
|
2742
2758
|
[]
|
|
2743
2759
|
);
|
|
2744
2760
|
const { user, owners, ...allFilters } = filters;
|
|
2745
|
-
const
|
|
2761
|
+
const catalogFilters = reduceCatalogFilters(
|
|
2746
2762
|
compact(Object.values(allFilters))
|
|
2747
2763
|
);
|
|
2748
2764
|
const [{ value: count, loading: loadingEntityOwnership }, fetchEntities] = useAsyncFn(
|
|
@@ -2754,9 +2770,11 @@ function useOwnedEntitiesCount() {
|
|
|
2754
2770
|
if (ownedClaims === void 0) {
|
|
2755
2771
|
return 0;
|
|
2756
2772
|
}
|
|
2773
|
+
const { ["metadata.name"]: metadata, ...filter } = req.filter.filter;
|
|
2757
2774
|
const { totalItems } = await catalogApi.queryEntities({
|
|
2775
|
+
...req.filter,
|
|
2758
2776
|
filter: {
|
|
2759
|
-
...
|
|
2777
|
+
...filter,
|
|
2760
2778
|
"relations.ownedBy": ownedClaims
|
|
2761
2779
|
},
|
|
2762
2780
|
limit: 0
|
|
@@ -2767,14 +2785,18 @@ function useOwnedEntitiesCount() {
|
|
|
2767
2785
|
{ loading: true }
|
|
2768
2786
|
);
|
|
2769
2787
|
useDeepCompareEffect(() => {
|
|
2770
|
-
if (Object.keys(filter).length === 0) {
|
|
2788
|
+
if (Object.keys(catalogFilters.filter).length === 0) {
|
|
2771
2789
|
return;
|
|
2772
2790
|
}
|
|
2773
2791
|
if (ownershipEntityRefs === void 0) {
|
|
2774
2792
|
return;
|
|
2775
2793
|
}
|
|
2776
|
-
fetchEntities({
|
|
2777
|
-
|
|
2794
|
+
fetchEntities({
|
|
2795
|
+
ownershipEntityRefs,
|
|
2796
|
+
owners,
|
|
2797
|
+
filter: catalogFilters
|
|
2798
|
+
});
|
|
2799
|
+
}, [ownershipEntityRefs, owners, catalogFilters]);
|
|
2778
2800
|
const loading = loadingEntityRefs || loadingEntityOwnership;
|
|
2779
2801
|
return {
|
|
2780
2802
|
count,
|
|
@@ -2809,12 +2831,12 @@ function useAllEntitiesCount() {
|
|
|
2809
2831
|
const request = useMemo(() => {
|
|
2810
2832
|
const { user, ...allFilters } = filters;
|
|
2811
2833
|
const compacted = compact(Object.values(allFilters));
|
|
2812
|
-
const
|
|
2834
|
+
const catalogFilters = reduceCatalogFilters(compacted);
|
|
2813
2835
|
const newRequest = {
|
|
2814
|
-
|
|
2836
|
+
...catalogFilters,
|
|
2815
2837
|
limit: 0
|
|
2816
2838
|
};
|
|
2817
|
-
if (Object.keys(filter).length === 0) {
|
|
2839
|
+
if (Object.keys(catalogFilters.filter).length === 0) {
|
|
2818
2840
|
prevRequest.current = void 0;
|
|
2819
2841
|
return prevRequest.current;
|
|
2820
2842
|
}
|
|
@@ -2842,11 +2864,12 @@ function useStarredEntitiesCount() {
|
|
|
2842
2864
|
const request = useMemo(() => {
|
|
2843
2865
|
const { user, ...allFilters } = filters;
|
|
2844
2866
|
const compacted = compact(Object.values(allFilters));
|
|
2845
|
-
const
|
|
2867
|
+
const catalogFilters = reduceCatalogFilters(compacted);
|
|
2846
2868
|
const facet = "metadata.name";
|
|
2847
2869
|
const newRequest = {
|
|
2870
|
+
...catalogFilters,
|
|
2848
2871
|
filter: {
|
|
2849
|
-
...
|
|
2872
|
+
...catalogFilters.filter,
|
|
2850
2873
|
/**
|
|
2851
2874
|
* here we are filtering entities by `name`. Given this filter,
|
|
2852
2875
|
* the response might contain more entities than expected, in case multiple entities
|