@backstage/plugin-catalog-react 0.6.13-next.0 → 0.6.13-next.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 +18 -0
- package/dist/index.cjs.js +18 -22
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +18 -22
- package/dist/index.esm.js.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-react
|
|
2
2
|
|
|
3
|
+
## 0.6.13-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f7257dff6f: The `<Link />` component now accepts a `noTrack` prop, which prevents the `click` event from being captured by the Analytics API. This can be used if tracking is explicitly not warranted, or in order to use custom link tracking in specific situations.
|
|
8
|
+
- 300f8cdaee: Fix bug: previously the filter would be set to "all" on page load, even if the
|
|
9
|
+
`initiallySelectedFilter` on the `DefaultCatalogPage` was set to something else,
|
|
10
|
+
or a different query parameter was supplied. Now, the prop and query parameters
|
|
11
|
+
control the filter as expected. Additionally, after this change any filters
|
|
12
|
+
which match 0 items will be disabled, and the filter will be reverted to 'all'
|
|
13
|
+
if they're set on page load.
|
|
14
|
+
- 6acc8f7db7: Add caching to the useEntityPermission hook
|
|
15
|
+
|
|
16
|
+
The hook now caches the authorization decision based on the permission + the entity, and returns the cache match value as the default `allowed` value while loading. This helps avoid flicker in UI elements that would be conditionally rendered based on the `allowed` result of this hook.
|
|
17
|
+
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
- @backstage/core-components@0.8.7-next.1
|
|
20
|
+
|
|
3
21
|
## 0.6.13-next.0
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/index.cjs.js
CHANGED
|
@@ -1520,7 +1520,7 @@ const UserListPicker = ({
|
|
|
1520
1520
|
const classes = useStyles();
|
|
1521
1521
|
const configApi = corePluginApi.useApi(corePluginApi.configApiRef);
|
|
1522
1522
|
const orgName = (_a = configApi.getOptionalString("organization.name")) != null ? _a : "Company";
|
|
1523
|
-
const { filters, updateFilters, backendEntities, queryParameters } = useEntityListProvider();
|
|
1523
|
+
const { filters, updateFilters, backendEntities, queryParameters, loading } = useEntityListProvider();
|
|
1524
1524
|
const userAndGroupFilterIds = ["starred", "all"];
|
|
1525
1525
|
const filterGroups = getFilterGroups(orgName).map((filterGroup) => ({
|
|
1526
1526
|
...filterGroup,
|
|
@@ -1530,28 +1530,23 @@ const UserListPicker = ({
|
|
|
1530
1530
|
const { isOwnedEntity } = useEntityOwnership();
|
|
1531
1531
|
const ownedFilter = React.useMemo(() => new UserListFilter("owned", isOwnedEntity, isStarredEntity), [isOwnedEntity, isStarredEntity]);
|
|
1532
1532
|
const starredFilter = React.useMemo(() => new UserListFilter("starred", isOwnedEntity, isStarredEntity), [isOwnedEntity, isStarredEntity]);
|
|
1533
|
-
const [
|
|
1534
|
-
const
|
|
1535
|
-
const
|
|
1533
|
+
const [selectedUserFilter, setSelectedUserFilter] = React.useState((_b = [queryParameters.user].flat()[0]) != null ? _b : initialFilter);
|
|
1534
|
+
const entitiesWithoutUserFilter = React.useMemo(() => backendEntities.filter(reduceEntityFilters(lodash.compact(Object.values({ ...filters, user: void 0 })))), [filters, backendEntities]);
|
|
1535
|
+
const filterCounts = React.useMemo(() => ({
|
|
1536
|
+
all: entitiesWithoutUserFilter.length,
|
|
1537
|
+
starred: entitiesWithoutUserFilter.filter((entity) => starredFilter.filterEntity(entity)).length,
|
|
1538
|
+
owned: entitiesWithoutUserFilter.filter((entity) => ownedFilter.filterEntity(entity)).length
|
|
1539
|
+
}), [entitiesWithoutUserFilter, starredFilter, ownedFilter]);
|
|
1540
|
+
React.useEffect(() => {
|
|
1541
|
+
if (!loading && !!selectedUserFilter && selectedUserFilter !== "all" && filterCounts[selectedUserFilter] === 0) {
|
|
1542
|
+
setSelectedUserFilter("all");
|
|
1543
|
+
}
|
|
1544
|
+
}, [loading, filterCounts, selectedUserFilter, setSelectedUserFilter]);
|
|
1536
1545
|
React.useEffect(() => {
|
|
1537
1546
|
updateFilters({
|
|
1538
1547
|
user: selectedUserFilter ? new UserListFilter(selectedUserFilter, isOwnedEntity, isStarredEntity) : void 0
|
|
1539
1548
|
});
|
|
1540
1549
|
}, [selectedUserFilter, isOwnedEntity, isStarredEntity, updateFilters]);
|
|
1541
|
-
React.useEffect(() => {
|
|
1542
|
-
const filterFn = reduceEntityFilters(lodash.compact(Object.values({ ...filters, user: void 0 })));
|
|
1543
|
-
setEntitiesWithoutUserFilter(backendEntities.filter(filterFn));
|
|
1544
|
-
}, [filters, backendEntities]);
|
|
1545
|
-
function getFilterCount(id) {
|
|
1546
|
-
switch (id) {
|
|
1547
|
-
case "owned":
|
|
1548
|
-
return totalOwnedUserEntities;
|
|
1549
|
-
case "starred":
|
|
1550
|
-
return entitiesWithoutUserFilter.filter((entity) => starredFilter.filterEntity(entity)).length;
|
|
1551
|
-
default:
|
|
1552
|
-
return entitiesWithoutUserFilter.length;
|
|
1553
|
-
}
|
|
1554
|
-
}
|
|
1555
1550
|
return /* @__PURE__ */ React__default["default"].createElement(core.Card, {
|
|
1556
1551
|
className: classes.root
|
|
1557
1552
|
}, filterGroups.map((group) => /* @__PURE__ */ React__default["default"].createElement(React.Fragment, {
|
|
@@ -1572,15 +1567,16 @@ const UserListPicker = ({
|
|
|
1572
1567
|
divider: true,
|
|
1573
1568
|
onClick: () => setSelectedUserFilter(item.id),
|
|
1574
1569
|
selected: item.id === ((_a2 = filters.user) == null ? void 0 : _a2.value),
|
|
1575
|
-
className: classes.menuItem
|
|
1570
|
+
className: classes.menuItem,
|
|
1571
|
+
disabled: filterCounts[item.id] === 0,
|
|
1572
|
+
"data-testid": `user-picker-${item.id}`
|
|
1576
1573
|
}, item.icon && /* @__PURE__ */ React__default["default"].createElement(core.ListItemIcon, {
|
|
1577
1574
|
className: classes.listIcon
|
|
1578
1575
|
}, /* @__PURE__ */ React__default["default"].createElement(item.icon, {
|
|
1579
1576
|
fontSize: "small"
|
|
1580
1577
|
})), /* @__PURE__ */ React__default["default"].createElement(core.ListItemText, null, /* @__PURE__ */ React__default["default"].createElement(core.Typography, {
|
|
1581
|
-
variant: "body1"
|
|
1582
|
-
|
|
1583
|
-
}, item.label)), /* @__PURE__ */ React__default["default"].createElement(core.ListItemSecondaryAction, null, (_b2 = getFilterCount(item.id)) != null ? _b2 : "-"));
|
|
1578
|
+
variant: "body1"
|
|
1579
|
+
}, item.label)), /* @__PURE__ */ React__default["default"].createElement(core.ListItemSecondaryAction, null, (_b2 = filterCounts[item.id]) != null ? _b2 : "-"));
|
|
1584
1580
|
}))))));
|
|
1585
1581
|
};
|
|
1586
1582
|
|