@backstage/plugin-catalog-react 1.0.1-next.0 → 1.0.1-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 +17 -0
- package/alpha/package.json +1 -1
- package/dist/index.alpha.d.ts +3 -3
- package/dist/index.beta.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +17 -9
- package/dist/index.esm.js.map +1 -1
- package/package.json +9 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-react
|
|
2
2
|
|
|
3
|
+
## 1.0.1-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 0ffd88a90e: Prevent permissions with types other than `ResourcePermission<'catalog-entity'>` from being used with the `useEntityPermission` hook.
|
|
8
|
+
- 4af82967f4: Decouple tags picker from backend entities
|
|
9
|
+
|
|
10
|
+
`EntityTagPicker` fetches all the tags independently and it doesn't require all the entities to be available client side.
|
|
11
|
+
|
|
12
|
+
- 37b04b5a5e: Removed broken link from Labels section of entity inspector.
|
|
13
|
+
- 4431873583: Update `usePermission` usage.
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
- @backstage/integration@1.1.0-next.1
|
|
16
|
+
- @backstage/plugin-permission-react@0.4.0-next.0
|
|
17
|
+
- @backstage/plugin-permission-common@0.6.0-next.0
|
|
18
|
+
- @backstage/plugin-catalog-common@1.0.1-next.1
|
|
19
|
+
|
|
3
20
|
## 1.0.1-next.0
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/alpha/package.json
CHANGED
package/dist/index.alpha.d.ts
CHANGED
|
@@ -17,10 +17,10 @@ import { IconButton } from '@material-ui/core';
|
|
|
17
17
|
import { LinkProps } from '@backstage/core-components';
|
|
18
18
|
import { Observable } from '@backstage/types';
|
|
19
19
|
import { Overrides } from '@material-ui/core/styles/overrides';
|
|
20
|
-
import { Permission } from '@backstage/plugin-permission-common';
|
|
21
20
|
import { PropsWithChildren } from 'react';
|
|
22
21
|
import { default as React_2 } from 'react';
|
|
23
22
|
import { ReactNode } from 'react';
|
|
23
|
+
import { ResourcePermission } from '@backstage/plugin-permission-common';
|
|
24
24
|
import { RouteRef } from '@backstage/core-plugin-api';
|
|
25
25
|
import { ScmIntegrationRegistry } from '@backstage/integration';
|
|
26
26
|
import { StyleRules } from '@material-ui/core/styles/withStyles';
|
|
@@ -585,14 +585,14 @@ export declare function useEntityOwnership(): {
|
|
|
585
585
|
* A thin wrapper around the
|
|
586
586
|
* {@link @backstage/plugin-permission-react#usePermission} hook which uses the
|
|
587
587
|
* current entity in context to make an authorization request for the given
|
|
588
|
-
*
|
|
588
|
+
* {@link @backstage/plugin-catalog-common#CatalogEntityPermission}.
|
|
589
589
|
*
|
|
590
590
|
* Note: this hook blocks the permission request until the entity has loaded in
|
|
591
591
|
* context. If you have the entityRef and need concurrent requests, use the
|
|
592
592
|
* `usePermission` hook directly.
|
|
593
593
|
* @alpha
|
|
594
594
|
*/
|
|
595
|
-
export declare function useEntityPermission(permission:
|
|
595
|
+
export declare function useEntityPermission(permission: ResourcePermission<'catalog-entity'>): {
|
|
596
596
|
loading: boolean;
|
|
597
597
|
allowed: boolean;
|
|
598
598
|
error?: Error;
|
package/dist/index.beta.d.ts
CHANGED
|
@@ -17,10 +17,10 @@ import { IconButton } from '@material-ui/core';
|
|
|
17
17
|
import { LinkProps } from '@backstage/core-components';
|
|
18
18
|
import { Observable } from '@backstage/types';
|
|
19
19
|
import { Overrides } from '@material-ui/core/styles/overrides';
|
|
20
|
-
import { Permission } from '@backstage/plugin-permission-common';
|
|
21
20
|
import { PropsWithChildren } from 'react';
|
|
22
21
|
import { default as React_2 } from 'react';
|
|
23
22
|
import { ReactNode } from 'react';
|
|
23
|
+
import { ResourcePermission } from '@backstage/plugin-permission-common';
|
|
24
24
|
import { RouteRef } from '@backstage/core-plugin-api';
|
|
25
25
|
import { ScmIntegrationRegistry } from '@backstage/integration';
|
|
26
26
|
import { StyleRules } from '@material-ui/core/styles/withStyles';
|
package/dist/index.d.ts
CHANGED
|
@@ -17,10 +17,10 @@ import { IconButton } from '@material-ui/core';
|
|
|
17
17
|
import { LinkProps } from '@backstage/core-components';
|
|
18
18
|
import { Observable } from '@backstage/types';
|
|
19
19
|
import { Overrides } from '@material-ui/core/styles/overrides';
|
|
20
|
-
import { Permission } from '@backstage/plugin-permission-common';
|
|
21
20
|
import { PropsWithChildren } from 'react';
|
|
22
21
|
import { default as React_2 } from 'react';
|
|
23
22
|
import { ReactNode } from 'react';
|
|
23
|
+
import { ResourcePermission } from '@backstage/plugin-permission-common';
|
|
24
24
|
import { RouteRef } from '@backstage/core-plugin-api';
|
|
25
25
|
import { ScmIntegrationRegistry } from '@backstage/integration';
|
|
26
26
|
import { StyleRules } from '@material-ui/core/styles/withStyles';
|
package/dist/index.esm.js
CHANGED
|
@@ -649,7 +649,10 @@ function useEntityPermission(permission) {
|
|
|
649
649
|
allowed,
|
|
650
650
|
loading: loadingPermission,
|
|
651
651
|
error: permissionError
|
|
652
|
-
} = usePermission(
|
|
652
|
+
} = usePermission({
|
|
653
|
+
permission,
|
|
654
|
+
resourceRef: entity ? stringifyEntityRef(entity) : void 0
|
|
655
|
+
});
|
|
653
656
|
if (loadingEntity || loadingPermission) {
|
|
654
657
|
return { loading: true, allowed: false };
|
|
655
658
|
}
|
|
@@ -1029,7 +1032,17 @@ const checkedIcon = /* @__PURE__ */ React.createElement(CheckBoxIcon, {
|
|
|
1029
1032
|
const EntityTagPicker = () => {
|
|
1030
1033
|
var _a, _b;
|
|
1031
1034
|
const classes = useStyles$7();
|
|
1032
|
-
const { updateFilters,
|
|
1035
|
+
const { updateFilters, filters, queryParameters } = useEntityList();
|
|
1036
|
+
const catalogApi = useApi(catalogApiRef);
|
|
1037
|
+
const { value: availableTags } = useAsync(async () => {
|
|
1038
|
+
var _a2;
|
|
1039
|
+
const facet = "metadata.tags";
|
|
1040
|
+
const { facets } = await catalogApi.getEntityFacets({
|
|
1041
|
+
facets: [facet],
|
|
1042
|
+
filter: (_a2 = filters.kind) == null ? void 0 : _a2.getCatalogFilters()
|
|
1043
|
+
});
|
|
1044
|
+
return facets[facet].map(({ value }) => value);
|
|
1045
|
+
}, [filters.kind]);
|
|
1033
1046
|
const queryParamTags = useMemo(() => [queryParameters.tags].flat().filter(Boolean), [queryParameters]);
|
|
1034
1047
|
const [selectedTags, setSelectedTags] = useState(queryParamTags.length ? queryParamTags : (_b = (_a = filters.tags) == null ? void 0 : _a.values) != null ? _b : []);
|
|
1035
1048
|
useEffect(() => {
|
|
@@ -1042,10 +1055,7 @@ const EntityTagPicker = () => {
|
|
|
1042
1055
|
tags: selectedTags.length ? new EntityTagFilter(selectedTags) : void 0
|
|
1043
1056
|
});
|
|
1044
1057
|
}, [selectedTags, updateFilters]);
|
|
1045
|
-
|
|
1046
|
-
...new Set(backendEntities.flatMap((e) => e.metadata.tags).filter(Boolean))
|
|
1047
|
-
].sort(), [backendEntities]);
|
|
1048
|
-
if (!availableTags.length)
|
|
1058
|
+
if (!(availableTags == null ? void 0 : availableTags.length))
|
|
1049
1059
|
return null;
|
|
1050
1060
|
return /* @__PURE__ */ React.createElement(Box, {
|
|
1051
1061
|
pb: 1,
|
|
@@ -1531,9 +1541,7 @@ function OverviewPage(props) {
|
|
|
1531
1541
|
entry
|
|
1532
1542
|
}))), !!Object.keys(metadata.labels || {}).length && /* @__PURE__ */ React.createElement(List, {
|
|
1533
1543
|
dense: true,
|
|
1534
|
-
subheader: /* @__PURE__ */ React.createElement(ListSubheader, null, "Labels"
|
|
1535
|
-
to: "https://backstage.io/docs/features/software-catalog/well-known-labels"
|
|
1536
|
-
}))
|
|
1544
|
+
subheader: /* @__PURE__ */ React.createElement(ListSubheader, null, "Labels")
|
|
1537
1545
|
}, Object.entries(metadata.labels).map((entry) => /* @__PURE__ */ React.createElement(KeyValueListItem, {
|
|
1538
1546
|
key: entry[0],
|
|
1539
1547
|
indent: true,
|