@backstage/plugin-catalog-react 0.0.0-nightly-202111922557 → 0.0.0-nightly-202111172277
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 +31 -5
- package/dist/index.cjs.js +30 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +18 -3
- package/dist/index.esm.js +29 -2
- package/dist/index.esm.js.map +1 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,42 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-nightly-
|
|
3
|
+
## 0.0.0-nightly-202111172277
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 3491a36ab9: added useOwnedEntities hook to get the list of entities of the logged-in user
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/core-plugin-api@0.0.0-nightly-202111172277
|
|
10
|
+
- @backstage/catalog-client@0.0.0-nightly-202111172277
|
|
11
|
+
- @backstage/core-components@0.0.0-nightly-202111172277
|
|
12
|
+
|
|
13
|
+
## 0.6.7
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 6156fb8730: `useEntityTypeFilter`: Skip updating selected types if a kind filter change did not change them.
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
- @backstage/core-plugin-api@0.3.1
|
|
20
|
+
- @backstage/core-components@0.8.1
|
|
21
|
+
- @backstage/catalog-model@0.9.8
|
|
22
|
+
|
|
23
|
+
## 0.6.6
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- 4c0f0b2003: Removed dependency on `@backstage/core-app-api`.
|
|
28
|
+
|
|
29
|
+
## 0.6.5
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
|
6
32
|
|
|
7
33
|
- cd450844f6: Moved React dependencies to `peerDependencies` and allow both React v16 and v17 to be used.
|
|
8
34
|
- 69034b4419: Fix typo in catalog-react package.json
|
|
9
35
|
- Updated dependencies
|
|
10
|
-
- @backstage/core-components@0.
|
|
11
|
-
- @backstage/core-plugin-api@0.
|
|
12
|
-
- @backstage/core-app-api@0.
|
|
13
|
-
- @backstage/version-bridge@0.
|
|
36
|
+
- @backstage/core-components@0.8.0
|
|
37
|
+
- @backstage/core-plugin-api@0.3.0
|
|
38
|
+
- @backstage/core-app-api@0.2.0
|
|
39
|
+
- @backstage/version-bridge@0.1.1
|
|
14
40
|
|
|
15
41
|
## 0.6.4
|
|
16
42
|
|
package/dist/index.cjs.js
CHANGED
|
@@ -13,6 +13,7 @@ var versionBridge = require('@backstage/version-bridge');
|
|
|
13
13
|
var reactRouter = require('react-router');
|
|
14
14
|
var reactUse = require('react-use');
|
|
15
15
|
var qs = require('qs');
|
|
16
|
+
var isEqual = require('lodash/isEqual');
|
|
16
17
|
var coreComponents = require('@backstage/core-components');
|
|
17
18
|
var core = require('@material-ui/core');
|
|
18
19
|
var jwtDecoder = require('jwt-decode');
|
|
@@ -33,6 +34,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
33
34
|
var ObservableImpl__default = /*#__PURE__*/_interopDefaultLegacy(ObservableImpl);
|
|
34
35
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
35
36
|
var qs__default = /*#__PURE__*/_interopDefaultLegacy(qs);
|
|
37
|
+
var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
|
|
36
38
|
var jwtDecoder__default = /*#__PURE__*/_interopDefaultLegacy(jwtDecoder);
|
|
37
39
|
var CheckBoxIcon__default = /*#__PURE__*/_interopDefaultLegacy(CheckBoxIcon);
|
|
38
40
|
var CheckBoxOutlineBlankIcon__default = /*#__PURE__*/_interopDefaultLegacy(CheckBoxOutlineBlankIcon);
|
|
@@ -577,7 +579,9 @@ function useEntityTypeFilter() {
|
|
|
577
579
|
const newTypes = Object.entries(countByType).sort(([, count1], [, count2]) => count2 - count1).map(([type]) => type);
|
|
578
580
|
setAvailableTypes(newTypes);
|
|
579
581
|
const stillValidTypes = selectedTypes.filter((value) => newTypes.includes(value));
|
|
580
|
-
|
|
582
|
+
if (!isEqual__default["default"](selectedTypes, stillValidTypes)) {
|
|
583
|
+
setSelectedTypes(stillValidTypes);
|
|
584
|
+
}
|
|
581
585
|
}, [loading, kind, selectedTypes, setSelectedTypes, entities]);
|
|
582
586
|
React.useEffect(() => {
|
|
583
587
|
updateFilters({
|
|
@@ -765,6 +769,30 @@ function useEntityOwnership() {
|
|
|
765
769
|
return React.useMemo(() => ({ loading, isOwnedEntity }), [loading, isOwnedEntity]);
|
|
766
770
|
}
|
|
767
771
|
|
|
772
|
+
function useOwnedEntities(allowedKinds) {
|
|
773
|
+
const identityApi = corePluginApi.useApi(corePluginApi.identityApiRef);
|
|
774
|
+
const catalogApi = corePluginApi.useApi(catalogApiRef);
|
|
775
|
+
const { loading, value: refs } = reactUse.useAsync(async () => {
|
|
776
|
+
const identityRefs = await loadIdentityOwnerRefs(identityApi);
|
|
777
|
+
const catalogRefs = await loadCatalogOwnerRefs(catalogApi, identityRefs);
|
|
778
|
+
const catalogs = await catalogApi.getEntities(allowedKinds ? {
|
|
779
|
+
filter: {
|
|
780
|
+
kind: allowedKinds,
|
|
781
|
+
[`relations.${catalogModel.RELATION_OWNED_BY}`]: [...identityRefs, ...catalogRefs]
|
|
782
|
+
}
|
|
783
|
+
} : {
|
|
784
|
+
filter: {
|
|
785
|
+
[`relations.${catalogModel.RELATION_OWNED_BY}`]: [...identityRefs, ...catalogRefs]
|
|
786
|
+
}
|
|
787
|
+
});
|
|
788
|
+
return catalogs;
|
|
789
|
+
}, []);
|
|
790
|
+
const ownedEntities = React.useMemo(() => {
|
|
791
|
+
return refs;
|
|
792
|
+
}, [refs]);
|
|
793
|
+
return React.useMemo(() => ({ loading, ownedEntities }), [loading, ownedEntities]);
|
|
794
|
+
}
|
|
795
|
+
|
|
768
796
|
const EntityKindPicker = ({
|
|
769
797
|
initialFilter,
|
|
770
798
|
hidden
|
|
@@ -1634,6 +1662,7 @@ exports.useEntityListProvider = useEntityListProvider;
|
|
|
1634
1662
|
exports.useEntityOwnership = useEntityOwnership;
|
|
1635
1663
|
exports.useEntityTypeFilter = useEntityTypeFilter;
|
|
1636
1664
|
exports.useOwnUser = useOwnUser;
|
|
1665
|
+
exports.useOwnedEntities = useOwnedEntities;
|
|
1637
1666
|
exports.useRelatedEntities = useRelatedEntities;
|
|
1638
1667
|
exports.useStarredEntities = useStarredEntities;
|
|
1639
1668
|
exports.useStarredEntity = useStarredEntity;
|