catalog-react: stop using CatalogEntityPermission convenience type
There's currently an issue with importing alpha exports from other packages in the monorepo. This works around the issue for now by skipping the use of the `CatalogEntityPermission` convenience type, using `ResourcePermission<'catalog-entity'>` directly instead. cf. https://github.com/backstage/backstage/pull/10128 Signed-off-by: Mike Lewis <mtlewis@users.noreply.github.com>
This commit is contained in:
committed by
Joe Porpeglia
parent
0ffd88a90e
commit
8cb7acd781
@@ -2,4 +2,4 @@
|
||||
'@backstage/plugin-catalog-react': patch
|
||||
---
|
||||
|
||||
Prevent permissions with types other than `CatalogEntityPermission` from being used with the `useEntityPermission` hook.
|
||||
Prevent permissions with types other than `ResourcePermission<'catalog-entity'>` from being used with the `useEntityPermission` hook.
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
import { ApiRef } from '@backstage/core-plugin-api';
|
||||
import { CATALOG_FILTER_EXISTS } from '@backstage/catalog-client';
|
||||
import { CatalogApi } from '@backstage/catalog-client';
|
||||
import { CatalogEntityPermission } from '@backstage/plugin-catalog-common';
|
||||
import { ComponentEntity } from '@backstage/catalog-model';
|
||||
import { ComponentProps } from 'react';
|
||||
import { CompoundEntityRef } from '@backstage/catalog-model';
|
||||
@@ -20,6 +19,7 @@ import { Overrides } from '@material-ui/core/styles/overrides';
|
||||
import { PropsWithChildren } from 'react';
|
||||
import { default as React_2 } from 'react';
|
||||
import { ReactNode } from 'react';
|
||||
import { ResourcePermission } from '@backstage/plugin-permission-common';
|
||||
import { RouteRef } from '@backstage/core-plugin-api';
|
||||
import { ScmIntegrationRegistry } from '@backstage/integration';
|
||||
import { StyleRules } from '@material-ui/core/styles/withStyles';
|
||||
@@ -489,7 +489,9 @@ export function useEntityOwnership(): {
|
||||
};
|
||||
|
||||
// @alpha
|
||||
export function useEntityPermission(permission: CatalogEntityPermission): {
|
||||
export function useEntityPermission(
|
||||
permission: ResourcePermission<'catalog-entity'>,
|
||||
): {
|
||||
loading: boolean;
|
||||
allowed: boolean;
|
||||
error?: Error;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import { stringifyEntityRef } from '@backstage/catalog-model';
|
||||
import { CatalogEntityPermission } from '@backstage/plugin-catalog-common';
|
||||
import { ResourcePermission } from '@backstage/plugin-permission-common';
|
||||
import { usePermission } from '@backstage/plugin-permission-react';
|
||||
import { useAsyncEntity } from './useEntity';
|
||||
|
||||
@@ -30,7 +30,9 @@ import { useAsyncEntity } from './useEntity';
|
||||
* `usePermission` hook directly.
|
||||
* @alpha
|
||||
*/
|
||||
export function useEntityPermission(permission: CatalogEntityPermission): {
|
||||
export function useEntityPermission(
|
||||
permission: ResourcePermission<'catalog-entity'>,
|
||||
): {
|
||||
loading: boolean;
|
||||
allowed: boolean;
|
||||
error?: Error;
|
||||
|
||||
Reference in New Issue
Block a user