@backstage/plugin-catalog-react 1.9.0 → 1.9.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 +8 -0
- package/alpha/package.json +1 -1
- package/dist/index.esm.js +30 -39
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-react
|
|
2
2
|
|
|
3
|
+
## 1.9.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ceebf2ca4ba7: Fixed a issue where `CatalogPage` wasn't using the chosen `initiallySelectedFilter` as intended.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/integration-react@1.1.21
|
|
10
|
+
|
|
3
11
|
## 1.9.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
package/alpha/package.json
CHANGED
package/dist/index.esm.js
CHANGED
|
@@ -52,6 +52,7 @@ import YAML from 'yaml';
|
|
|
52
52
|
import Alert$1 from '@material-ui/lab/Alert';
|
|
53
53
|
import { assertError } from '@backstage/errors';
|
|
54
54
|
import SettingsIcon from '@material-ui/icons/Settings';
|
|
55
|
+
import useDeepCompareEffect from 'react-use/lib/useDeepCompareEffect';
|
|
55
56
|
import Box$1 from '@material-ui/core/Box';
|
|
56
57
|
import Button$1 from '@material-ui/core/Button';
|
|
57
58
|
import { makeStyles as makeStyles$1 } from '@material-ui/core/styles';
|
|
@@ -2671,58 +2672,48 @@ function useOwnedEntitiesCount() {
|
|
|
2671
2672
|
// load only on mount
|
|
2672
2673
|
[]
|
|
2673
2674
|
);
|
|
2674
|
-
const
|
|
2675
|
-
const
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
const allFilter = reduceCatalogFilters(compacted);
|
|
2679
|
-
const { ["metadata.name"]: metadata, ...filter2 } = allFilter;
|
|
2680
|
-
const countFilter = getOwnedCountClaims(owners, ownershipEntityRefs);
|
|
2681
|
-
if ((ownershipEntityRefs == null ? void 0 : ownershipEntityRefs.length) === 0 || countFilter === void 0 || Object.keys(filter2).length === 0) {
|
|
2682
|
-
prevRequest.current = void 0;
|
|
2683
|
-
return void 0;
|
|
2684
|
-
}
|
|
2685
|
-
const newRequest = {
|
|
2686
|
-
filter: {
|
|
2687
|
-
...filter2,
|
|
2688
|
-
"relations.ownedBy": countFilter
|
|
2689
|
-
},
|
|
2690
|
-
limit: 0
|
|
2691
|
-
};
|
|
2692
|
-
if (isEqual(newRequest, prevRequest.current)) {
|
|
2693
|
-
return prevRequest.current;
|
|
2694
|
-
}
|
|
2695
|
-
prevRequest.current = newRequest;
|
|
2696
|
-
return newRequest;
|
|
2697
|
-
}, [filters, ownershipEntityRefs]);
|
|
2675
|
+
const { user, owners, ...allFilters } = filters;
|
|
2676
|
+
const { ["metadata.name"]: metadata, ...filter } = reduceCatalogFilters(
|
|
2677
|
+
compact(Object.values(allFilters))
|
|
2678
|
+
);
|
|
2698
2679
|
const [{ value: count, loading: loadingEntityOwnership }, fetchEntities] = useAsyncFn(
|
|
2699
|
-
async (req
|
|
2700
|
-
|
|
2680
|
+
async (req) => {
|
|
2681
|
+
const ownedClaims = getOwnedCountClaims(
|
|
2682
|
+
req.owners,
|
|
2683
|
+
req.ownershipEntityRefs
|
|
2684
|
+
);
|
|
2685
|
+
if (ownedClaims === void 0) {
|
|
2701
2686
|
return 0;
|
|
2702
2687
|
}
|
|
2703
|
-
const { totalItems } = await catalogApi.queryEntities(
|
|
2688
|
+
const { totalItems } = await catalogApi.queryEntities({
|
|
2689
|
+
filter: {
|
|
2690
|
+
...req.filter,
|
|
2691
|
+
"relations.ownedBy": ownedClaims
|
|
2692
|
+
},
|
|
2693
|
+
limit: 0
|
|
2694
|
+
});
|
|
2704
2695
|
return totalItems;
|
|
2705
2696
|
},
|
|
2706
2697
|
[],
|
|
2707
2698
|
{ loading: true }
|
|
2708
2699
|
);
|
|
2709
|
-
|
|
2710
|
-
if (
|
|
2711
|
-
|
|
2712
|
-
return;
|
|
2713
|
-
}
|
|
2714
|
-
fetchEntities(request, ownershipEntityRefs);
|
|
2700
|
+
useDeepCompareEffect(() => {
|
|
2701
|
+
if (Object.keys(filter).length === 0) {
|
|
2702
|
+
return;
|
|
2715
2703
|
}
|
|
2716
|
-
|
|
2704
|
+
if (ownershipEntityRefs === void 0) {
|
|
2705
|
+
return;
|
|
2706
|
+
}
|
|
2707
|
+
fetchEntities({ ownershipEntityRefs, owners, filter });
|
|
2708
|
+
}, [ownershipEntityRefs, owners, filter]);
|
|
2717
2709
|
const loading = loadingEntityRefs || loadingEntityOwnership;
|
|
2718
|
-
const filter = useMemo(
|
|
2719
|
-
() => EntityUserFilter.owned(ownershipEntityRefs != null ? ownershipEntityRefs : []),
|
|
2720
|
-
[ownershipEntityRefs]
|
|
2721
|
-
);
|
|
2722
2710
|
return {
|
|
2723
2711
|
count,
|
|
2724
2712
|
loading,
|
|
2725
|
-
filter
|
|
2713
|
+
filter: useMemo(
|
|
2714
|
+
() => EntityUserFilter.owned(ownershipEntityRefs != null ? ownershipEntityRefs : []),
|
|
2715
|
+
[ownershipEntityRefs]
|
|
2716
|
+
),
|
|
2726
2717
|
ownershipEntityRefs
|
|
2727
2718
|
};
|
|
2728
2719
|
}
|