@backstage/plugin-catalog-react 0.9.0 → 1.0.0
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 +45 -0
- package/alpha/package.json +1 -1
- package/dist/index.alpha.d.ts +13 -32
- package/dist/index.beta.d.ts +13 -32
- package/dist/index.d.ts +13 -32
- package/dist/index.esm.js +54 -20
- package/dist/index.esm.js.map +1 -1
- package/package.json +19 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-react
|
|
2
2
|
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- b58c70c223: This package has been promoted to v1.0! To understand how this change affects the package, please check out our [versioning policy](https://backstage.io/docs/overview/versioning-policy).
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- f7fb7295e6: **BREAKING**: Removed the deprecated `favoriteEntityTooltip` and `favoriteEntityIcon` functions.
|
|
12
|
+
- 4cd92028b8: **BREAKING**: The following deprecated annotation reading helper functions were removed:
|
|
13
|
+
|
|
14
|
+
- `getEntityMetadataViewUrl`, use `entity.metadata.annotations?.[ANNOTATION_VIEW_URL]` instead.
|
|
15
|
+
- `getEntityMetadataEditUrl`, use `entity.metadata.annotations?.[ANNOTATION_EDIT_URL]` instead.
|
|
16
|
+
|
|
17
|
+
- 1f2757bb07: **BREAKING**: The `useEntity` hook no longer returns loading or error states, and will throw an error if the entity is not immediately available. In practice this means that `useEntity` can only be used in contexts where the entity is guaranteed to have been loaded, for example inside an `EntityLayout`. To access the loading state of the entity, use `useAsyncEntity` instead.
|
|
18
|
+
- 0f3520d499: **BREAKING**: Removed the deprecated `formatEntityRefTitle`, use `humanizeEntityRef` instead.
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- a422d7ce5e: chore(deps): bump `@testing-library/react` from 11.2.6 to 12.1.3
|
|
23
|
+
- c689d7a94c: Added `CatalogFilterLayout`, which replaces `FilteredEntityLayout` from `@backstage/plugin-catalog`, as well as `FilterContainer` and `EntityListContainer`. It is used like this:
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
<CatalogFilterLayout>
|
|
27
|
+
<CatalogFilterLayout.Filters>
|
|
28
|
+
{/* filter drawer, for example <EntityTypePicker /> and friends */}
|
|
29
|
+
</CatalogFilterLayout.Filters>
|
|
30
|
+
<CatalogFilterLayout.Content>
|
|
31
|
+
{/* content view, for example a <CatalogTable /> */}
|
|
32
|
+
</CatalogFilterLayout.Content>
|
|
33
|
+
</CatalogFilterLayout>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
- Updated dependencies
|
|
37
|
+
- @backstage/core-components@0.9.2
|
|
38
|
+
- @backstage/core-plugin-api@1.0.0
|
|
39
|
+
- @backstage/version-bridge@1.0.0
|
|
40
|
+
- @backstage/plugin-permission-react@0.3.4
|
|
41
|
+
- @backstage/catalog-model@1.0.0
|
|
42
|
+
- @backstage/integration@1.0.0
|
|
43
|
+
- @backstage/catalog-client@1.0.0
|
|
44
|
+
- @backstage/errors@1.0.0
|
|
45
|
+
- @backstage/types@1.0.0
|
|
46
|
+
- @backstage/plugin-permission-common@0.5.3
|
|
47
|
+
|
|
3
48
|
## 0.9.0
|
|
4
49
|
|
|
5
50
|
### Minor Changes
|
package/alpha/package.json
CHANGED
package/dist/index.alpha.d.ts
CHANGED
|
@@ -62,6 +62,19 @@ export { CatalogApi }
|
|
|
62
62
|
*/
|
|
63
63
|
export declare const catalogApiRef: ApiRef<CatalogApi>;
|
|
64
64
|
|
|
65
|
+
/** @public */
|
|
66
|
+
export declare const CatalogFilterLayout: {
|
|
67
|
+
(props: {
|
|
68
|
+
children: React_2.ReactNode;
|
|
69
|
+
}): JSX.Element;
|
|
70
|
+
Filters: (props: {
|
|
71
|
+
children: React_2.ReactNode;
|
|
72
|
+
}) => JSX.Element;
|
|
73
|
+
Content: (props: {
|
|
74
|
+
children: React_2.ReactNode;
|
|
75
|
+
}) => JSX.Element;
|
|
76
|
+
};
|
|
77
|
+
|
|
65
78
|
/** @public */
|
|
66
79
|
export declare type CatalogReactComponentsNameToClassKey = {
|
|
67
80
|
CatalogReactUserListPicker: CatalogReactUserListPickerClassKey;
|
|
@@ -432,37 +445,11 @@ export declare interface EntityTypePickerProps {
|
|
|
432
445
|
*/
|
|
433
446
|
export declare const FavoriteEntity: (props: FavoriteEntityProps) => JSX.Element;
|
|
434
447
|
|
|
435
|
-
/**
|
|
436
|
-
* @public
|
|
437
|
-
* @deprecated due to low utility value.
|
|
438
|
-
*/
|
|
439
|
-
export declare const favoriteEntityIcon: (isStarred: boolean) => JSX.Element;
|
|
440
|
-
|
|
441
448
|
/** @public */
|
|
442
449
|
export declare type FavoriteEntityProps = ComponentProps<typeof IconButton> & {
|
|
443
450
|
entity: Entity;
|
|
444
451
|
};
|
|
445
452
|
|
|
446
|
-
/**
|
|
447
|
-
* @public
|
|
448
|
-
* @deprecated due to low utility value.
|
|
449
|
-
*/
|
|
450
|
-
export declare const favoriteEntityTooltip: (isStarred: boolean) => "Remove from favorites" | "Add to favorites";
|
|
451
|
-
|
|
452
|
-
/** @public @deprecated please use {@link humanizeEntityRef} instead */
|
|
453
|
-
export declare const formatEntityRefTitle: typeof humanizeEntityRef;
|
|
454
|
-
|
|
455
|
-
/**
|
|
456
|
-
* @public
|
|
457
|
-
* @deprecated use entity.metadata.annotations?.[ANNOTATION_EDIT_URL] instead.
|
|
458
|
-
*/
|
|
459
|
-
export declare function getEntityMetadataEditUrl(entity: Entity): string | undefined;
|
|
460
|
-
|
|
461
|
-
/**
|
|
462
|
-
* @public
|
|
463
|
-
* @deprecated use entity.metadata.annotations?.[ANNOTATION_VIEW_URL] instead. */
|
|
464
|
-
export declare function getEntityMetadataViewUrl(entity: Entity): string | undefined;
|
|
465
|
-
|
|
466
453
|
/**
|
|
467
454
|
* Get the related entity references.
|
|
468
455
|
*
|
|
@@ -571,12 +558,6 @@ export declare function useAsyncEntity<TEntity extends Entity = Entity>(): Entit
|
|
|
571
558
|
*/
|
|
572
559
|
export declare function useEntity<TEntity extends Entity = Entity>(): {
|
|
573
560
|
entity: TEntity;
|
|
574
|
-
/** @deprecated use {@link useAsyncEntity} instead */
|
|
575
|
-
loading: boolean;
|
|
576
|
-
/** @deprecated use {@link useAsyncEntity} instead */
|
|
577
|
-
error?: Error;
|
|
578
|
-
/** @deprecated use {@link useAsyncEntity} instead */
|
|
579
|
-
refresh?: VoidFunction;
|
|
580
561
|
};
|
|
581
562
|
|
|
582
563
|
/**
|
package/dist/index.beta.d.ts
CHANGED
|
@@ -62,6 +62,19 @@ export { CatalogApi }
|
|
|
62
62
|
*/
|
|
63
63
|
export declare const catalogApiRef: ApiRef<CatalogApi>;
|
|
64
64
|
|
|
65
|
+
/** @public */
|
|
66
|
+
export declare const CatalogFilterLayout: {
|
|
67
|
+
(props: {
|
|
68
|
+
children: React_2.ReactNode;
|
|
69
|
+
}): JSX.Element;
|
|
70
|
+
Filters: (props: {
|
|
71
|
+
children: React_2.ReactNode;
|
|
72
|
+
}) => JSX.Element;
|
|
73
|
+
Content: (props: {
|
|
74
|
+
children: React_2.ReactNode;
|
|
75
|
+
}) => JSX.Element;
|
|
76
|
+
};
|
|
77
|
+
|
|
65
78
|
/** @public */
|
|
66
79
|
export declare type CatalogReactComponentsNameToClassKey = {
|
|
67
80
|
CatalogReactUserListPicker: CatalogReactUserListPickerClassKey;
|
|
@@ -432,37 +445,11 @@ export declare interface EntityTypePickerProps {
|
|
|
432
445
|
*/
|
|
433
446
|
export declare const FavoriteEntity: (props: FavoriteEntityProps) => JSX.Element;
|
|
434
447
|
|
|
435
|
-
/**
|
|
436
|
-
* @public
|
|
437
|
-
* @deprecated due to low utility value.
|
|
438
|
-
*/
|
|
439
|
-
export declare const favoriteEntityIcon: (isStarred: boolean) => JSX.Element;
|
|
440
|
-
|
|
441
448
|
/** @public */
|
|
442
449
|
export declare type FavoriteEntityProps = ComponentProps<typeof IconButton> & {
|
|
443
450
|
entity: Entity;
|
|
444
451
|
};
|
|
445
452
|
|
|
446
|
-
/**
|
|
447
|
-
* @public
|
|
448
|
-
* @deprecated due to low utility value.
|
|
449
|
-
*/
|
|
450
|
-
export declare const favoriteEntityTooltip: (isStarred: boolean) => "Remove from favorites" | "Add to favorites";
|
|
451
|
-
|
|
452
|
-
/** @public @deprecated please use {@link humanizeEntityRef} instead */
|
|
453
|
-
export declare const formatEntityRefTitle: typeof humanizeEntityRef;
|
|
454
|
-
|
|
455
|
-
/**
|
|
456
|
-
* @public
|
|
457
|
-
* @deprecated use entity.metadata.annotations?.[ANNOTATION_EDIT_URL] instead.
|
|
458
|
-
*/
|
|
459
|
-
export declare function getEntityMetadataEditUrl(entity: Entity): string | undefined;
|
|
460
|
-
|
|
461
|
-
/**
|
|
462
|
-
* @public
|
|
463
|
-
* @deprecated use entity.metadata.annotations?.[ANNOTATION_VIEW_URL] instead. */
|
|
464
|
-
export declare function getEntityMetadataViewUrl(entity: Entity): string | undefined;
|
|
465
|
-
|
|
466
453
|
/**
|
|
467
454
|
* Get the related entity references.
|
|
468
455
|
*
|
|
@@ -562,12 +549,6 @@ export declare function useAsyncEntity<TEntity extends Entity = Entity>(): Entit
|
|
|
562
549
|
*/
|
|
563
550
|
export declare function useEntity<TEntity extends Entity = Entity>(): {
|
|
564
551
|
entity: TEntity;
|
|
565
|
-
/** @deprecated use {@link useAsyncEntity} instead */
|
|
566
|
-
loading: boolean;
|
|
567
|
-
/** @deprecated use {@link useAsyncEntity} instead */
|
|
568
|
-
error?: Error;
|
|
569
|
-
/** @deprecated use {@link useAsyncEntity} instead */
|
|
570
|
-
refresh?: VoidFunction;
|
|
571
552
|
};
|
|
572
553
|
|
|
573
554
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -62,6 +62,19 @@ export { CatalogApi }
|
|
|
62
62
|
*/
|
|
63
63
|
export declare const catalogApiRef: ApiRef<CatalogApi>;
|
|
64
64
|
|
|
65
|
+
/** @public */
|
|
66
|
+
export declare const CatalogFilterLayout: {
|
|
67
|
+
(props: {
|
|
68
|
+
children: React_2.ReactNode;
|
|
69
|
+
}): JSX.Element;
|
|
70
|
+
Filters: (props: {
|
|
71
|
+
children: React_2.ReactNode;
|
|
72
|
+
}) => JSX.Element;
|
|
73
|
+
Content: (props: {
|
|
74
|
+
children: React_2.ReactNode;
|
|
75
|
+
}) => JSX.Element;
|
|
76
|
+
};
|
|
77
|
+
|
|
65
78
|
/** @public */
|
|
66
79
|
export declare type CatalogReactComponentsNameToClassKey = {
|
|
67
80
|
CatalogReactUserListPicker: CatalogReactUserListPickerClassKey;
|
|
@@ -432,37 +445,11 @@ export declare interface EntityTypePickerProps {
|
|
|
432
445
|
*/
|
|
433
446
|
export declare const FavoriteEntity: (props: FavoriteEntityProps) => JSX.Element;
|
|
434
447
|
|
|
435
|
-
/**
|
|
436
|
-
* @public
|
|
437
|
-
* @deprecated due to low utility value.
|
|
438
|
-
*/
|
|
439
|
-
export declare const favoriteEntityIcon: (isStarred: boolean) => JSX.Element;
|
|
440
|
-
|
|
441
448
|
/** @public */
|
|
442
449
|
export declare type FavoriteEntityProps = ComponentProps<typeof IconButton> & {
|
|
443
450
|
entity: Entity;
|
|
444
451
|
};
|
|
445
452
|
|
|
446
|
-
/**
|
|
447
|
-
* @public
|
|
448
|
-
* @deprecated due to low utility value.
|
|
449
|
-
*/
|
|
450
|
-
export declare const favoriteEntityTooltip: (isStarred: boolean) => "Remove from favorites" | "Add to favorites";
|
|
451
|
-
|
|
452
|
-
/** @public @deprecated please use {@link humanizeEntityRef} instead */
|
|
453
|
-
export declare const formatEntityRefTitle: typeof humanizeEntityRef;
|
|
454
|
-
|
|
455
|
-
/**
|
|
456
|
-
* @public
|
|
457
|
-
* @deprecated use entity.metadata.annotations?.[ANNOTATION_EDIT_URL] instead.
|
|
458
|
-
*/
|
|
459
|
-
export declare function getEntityMetadataEditUrl(entity: Entity): string | undefined;
|
|
460
|
-
|
|
461
|
-
/**
|
|
462
|
-
* @public
|
|
463
|
-
* @deprecated use entity.metadata.annotations?.[ANNOTATION_VIEW_URL] instead. */
|
|
464
|
-
export declare function getEntityMetadataViewUrl(entity: Entity): string | undefined;
|
|
465
|
-
|
|
466
453
|
/**
|
|
467
454
|
* Get the related entity references.
|
|
468
455
|
*
|
|
@@ -562,12 +549,6 @@ export declare function useAsyncEntity<TEntity extends Entity = Entity>(): Entit
|
|
|
562
549
|
*/
|
|
563
550
|
export declare function useEntity<TEntity extends Entity = Entity>(): {
|
|
564
551
|
entity: TEntity;
|
|
565
|
-
/** @deprecated use {@link useAsyncEntity} instead */
|
|
566
|
-
loading: boolean;
|
|
567
|
-
/** @deprecated use {@link useAsyncEntity} instead */
|
|
568
|
-
error?: Error;
|
|
569
|
-
/** @deprecated use {@link useAsyncEntity} instead */
|
|
570
|
-
refresh?: VoidFunction;
|
|
571
552
|
};
|
|
572
553
|
|
|
573
554
|
/**
|
package/dist/index.esm.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export { CATALOG_FILTER_EXISTS } from '@backstage/catalog-client';
|
|
2
2
|
import { createApiRef, useApi, createRouteRef, useRouteRef, identityApiRef, alertApiRef, useApp, configApiRef } from '@backstage/core-plugin-api';
|
|
3
3
|
import ObservableImpl from 'zen-observable';
|
|
4
|
-
import React, {
|
|
4
|
+
import React, { useState, createContext, useMemo, useCallback, useContext, forwardRef, useEffect, useRef, useLayoutEffect, Fragment } from 'react';
|
|
5
|
+
import { Grid, useMediaQuery, useTheme, Button, Drawer, Box, Typography, Tooltip, makeStyles, FormControlLabel, Checkbox, TextField, Toolbar, FormControl, Input, InputAdornment, IconButton, withStyles, DialogContentText, ListItemText as ListItemText$1, ListSubheader as ListSubheader$1, Card, CardContent, ListItem, ListItemIcon, List, Dialog, DialogTitle, DialogContent, Tabs, Tab, DialogActions, Divider, MenuItem, ListItemSecondaryAction } from '@material-ui/core';
|
|
6
|
+
import FilterListIcon from '@material-ui/icons/FilterList';
|
|
5
7
|
import { Alert, Autocomplete } from '@material-ui/lab';
|
|
6
8
|
import { createVersionedContext, createVersionedValueMap, useVersionedContext, getOrCreateGlobalSingleton } from '@backstage/version-bridge';
|
|
7
9
|
import { compact, isEqual, groupBy, chunk } from 'lodash';
|
|
@@ -10,12 +12,11 @@ import { useLocation, useNavigate } from 'react-router';
|
|
|
10
12
|
import useAsyncFn from 'react-use/lib/useAsyncFn';
|
|
11
13
|
import useDebounce from 'react-use/lib/useDebounce';
|
|
12
14
|
import useMountedState from 'react-use/lib/useMountedState';
|
|
13
|
-
import {
|
|
15
|
+
import { parseEntityRef, ANNOTATION_SOURCE_LOCATION, parseLocationRef, RELATION_MEMBER_OF, getCompoundEntityRef, stringifyEntityRef, RELATION_OWNED_BY, DEFAULT_NAMESPACE, RELATION_PART_OF, ANNOTATION_LOCATION, ANNOTATION_ORIGIN_LOCATION } from '@backstage/catalog-model';
|
|
14
16
|
import useAsync from 'react-use/lib/useAsync';
|
|
15
17
|
import isEqual$1 from 'lodash/isEqual';
|
|
16
18
|
import sortBy from 'lodash/sortBy';
|
|
17
19
|
import { Link, OverflowTooltip, Table, Select, Progress, ResponseErrorPanel, DependencyGraph, DependencyGraphTypes, CodeSnippet } from '@backstage/core-components';
|
|
18
|
-
import { Tooltip, makeStyles, Box, Typography, FormControlLabel, Checkbox, TextField, Toolbar, FormControl, Input, InputAdornment, IconButton, withStyles, DialogContentText, ListItemText as ListItemText$1, ListSubheader as ListSubheader$1, Card, CardContent, ListItem, ListItemIcon, List, Dialog, DialogTitle, DialogContent, Tabs, Tab, DialogActions, Button, Divider, MenuItem, ListItemSecondaryAction } from '@material-ui/core';
|
|
19
20
|
import useObservable from 'react-use/lib/useObservable';
|
|
20
21
|
import { usePermission } from '@backstage/plugin-permission-react';
|
|
21
22
|
import CheckBoxIcon from '@material-ui/icons/CheckBox';
|
|
@@ -69,6 +70,48 @@ class MockStarredEntitiesApi {
|
|
|
69
70
|
}
|
|
70
71
|
}
|
|
71
72
|
|
|
73
|
+
const Filters = (props) => {
|
|
74
|
+
const isMidSizeScreen = useMediaQuery((theme2) => theme2.breakpoints.down("md"));
|
|
75
|
+
const theme = useTheme();
|
|
76
|
+
const [filterDrawerOpen, setFilterDrawerOpen] = useState(false);
|
|
77
|
+
return isMidSizeScreen ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Button, {
|
|
78
|
+
style: { marginTop: theme.spacing(1), marginLeft: theme.spacing(1) },
|
|
79
|
+
onClick: () => setFilterDrawerOpen(true),
|
|
80
|
+
startIcon: /* @__PURE__ */ React.createElement(FilterListIcon, null)
|
|
81
|
+
}, "Filters"), /* @__PURE__ */ React.createElement(Drawer, {
|
|
82
|
+
open: filterDrawerOpen,
|
|
83
|
+
onClose: () => setFilterDrawerOpen(false),
|
|
84
|
+
anchor: "left",
|
|
85
|
+
disableAutoFocus: true,
|
|
86
|
+
keepMounted: true,
|
|
87
|
+
variant: "temporary"
|
|
88
|
+
}, /* @__PURE__ */ React.createElement(Box, {
|
|
89
|
+
m: 2
|
|
90
|
+
}, /* @__PURE__ */ React.createElement(Typography, {
|
|
91
|
+
variant: "h6",
|
|
92
|
+
component: "h2",
|
|
93
|
+
style: { marginBottom: theme.spacing(1) }
|
|
94
|
+
}, "Filters"), props.children))) : /* @__PURE__ */ React.createElement(Grid, {
|
|
95
|
+
item: true,
|
|
96
|
+
lg: 2
|
|
97
|
+
}, props.children);
|
|
98
|
+
};
|
|
99
|
+
const Content = (props) => {
|
|
100
|
+
return /* @__PURE__ */ React.createElement(Grid, {
|
|
101
|
+
item: true,
|
|
102
|
+
xs: 12,
|
|
103
|
+
lg: 10
|
|
104
|
+
}, props.children);
|
|
105
|
+
};
|
|
106
|
+
const CatalogFilterLayout = (props) => {
|
|
107
|
+
return /* @__PURE__ */ React.createElement(Grid, {
|
|
108
|
+
container: true,
|
|
109
|
+
style: { position: "relative" }
|
|
110
|
+
}, props.children);
|
|
111
|
+
};
|
|
112
|
+
CatalogFilterLayout.Filters = Filters;
|
|
113
|
+
CatalogFilterLayout.Content = Content;
|
|
114
|
+
|
|
72
115
|
const NewEntityContext = createVersionedContext("entity-context");
|
|
73
116
|
const AsyncEntityProvider = ({
|
|
74
117
|
children,
|
|
@@ -99,10 +142,9 @@ function useEntity() {
|
|
|
99
142
|
throw new Error("EntityContext v1 not available");
|
|
100
143
|
}
|
|
101
144
|
if (!value.entity) {
|
|
102
|
-
|
|
145
|
+
throw new Error("useEntity hook is being called outside of an EntityLayout where the entity has not been loaded. If this is intentional, please use useAsyncEntity instead.");
|
|
103
146
|
}
|
|
104
|
-
|
|
105
|
-
return { entity, loading, error, refresh };
|
|
147
|
+
return { entity: value.entity };
|
|
106
148
|
}
|
|
107
149
|
function useAsyncEntity() {
|
|
108
150
|
const versionedHolder = useVersionedContext("entity-context");
|
|
@@ -129,15 +171,6 @@ function reduceEntityFilters(filters) {
|
|
|
129
171
|
return (entity) => filters.every((filter) => !filter.filterEntity || filter.filterEntity(entity));
|
|
130
172
|
}
|
|
131
173
|
|
|
132
|
-
function getEntityMetadataViewUrl(entity) {
|
|
133
|
-
var _a;
|
|
134
|
-
return (_a = entity.metadata.annotations) == null ? void 0 : _a[ANNOTATION_VIEW_URL];
|
|
135
|
-
}
|
|
136
|
-
function getEntityMetadataEditUrl(entity) {
|
|
137
|
-
var _a;
|
|
138
|
-
return (_a = entity.metadata.annotations) == null ? void 0 : _a[ANNOTATION_EDIT_URL];
|
|
139
|
-
}
|
|
140
|
-
|
|
141
174
|
function getEntityRelations(entity, relationType, filter) {
|
|
142
175
|
var _a;
|
|
143
176
|
let entityNames = ((_a = entity == null ? void 0 : entity.relations) == null ? void 0 : _a.filter((r) => r.type === relationType).map((r) => parseEntityRef(r.targetRef))) || [];
|
|
@@ -278,7 +311,6 @@ function entityRouteParams(entity) {
|
|
|
278
311
|
};
|
|
279
312
|
}
|
|
280
313
|
|
|
281
|
-
const formatEntityRefTitle = humanizeEntityRef;
|
|
282
314
|
function humanizeEntityRef(entityRef, opts) {
|
|
283
315
|
const defaultKind = opts == null ? void 0 : opts.defaultKind;
|
|
284
316
|
let kind;
|
|
@@ -609,7 +641,11 @@ function useEntityOwnership() {
|
|
|
609
641
|
}
|
|
610
642
|
|
|
611
643
|
function useEntityPermission(permission) {
|
|
612
|
-
const {
|
|
644
|
+
const {
|
|
645
|
+
entity,
|
|
646
|
+
loading: loadingEntity,
|
|
647
|
+
error: entityError
|
|
648
|
+
} = useAsyncEntity();
|
|
613
649
|
const {
|
|
614
650
|
allowed,
|
|
615
651
|
loading: loadingPermission,
|
|
@@ -1083,8 +1119,6 @@ const YellowStar = withStyles({
|
|
|
1083
1119
|
color: "#f3ba37"
|
|
1084
1120
|
}
|
|
1085
1121
|
})(Star);
|
|
1086
|
-
const favoriteEntityTooltip = (isStarred) => isStarred ? "Remove from favorites" : "Add to favorites";
|
|
1087
|
-
const favoriteEntityIcon = (isStarred) => isStarred ? /* @__PURE__ */ React.createElement(YellowStar, null) : /* @__PURE__ */ React.createElement(StarBorder, null);
|
|
1088
1122
|
const FavoriteEntity = (props) => {
|
|
1089
1123
|
const { toggleStarredEntity, isStarredEntity } = useStarredEntity(props.entity);
|
|
1090
1124
|
return /* @__PURE__ */ React.createElement(IconButton, {
|
|
@@ -2022,5 +2056,5 @@ const MockEntityListContextProvider = ({
|
|
|
2022
2056
|
}, children);
|
|
2023
2057
|
};
|
|
2024
2058
|
|
|
2025
|
-
export { AsyncEntityProvider, EntityKindFilter, EntityKindPicker, EntityLifecycleFilter, EntityLifecyclePicker, EntityListContext, EntityListProvider, EntityOwnerFilter, EntityOwnerPicker, EntityProvider, EntityRefLink, EntityRefLinks, EntitySearchBar, EntityTable, EntityTagFilter, EntityTagPicker, EntityTextFilter, EntityTypeFilter, EntityTypePicker, FavoriteEntity, InspectEntityDialog, MockEntityListContextProvider, MockStarredEntitiesApi, UnregisterEntityDialog, UserListFilter, UserListPicker, catalogApiRef, columnFactories, entityRouteParams, entityRouteRef,
|
|
2059
|
+
export { AsyncEntityProvider, CatalogFilterLayout, EntityKindFilter, EntityKindPicker, EntityLifecycleFilter, EntityLifecyclePicker, EntityListContext, EntityListProvider, EntityOwnerFilter, EntityOwnerPicker, EntityProvider, EntityRefLink, EntityRefLinks, EntitySearchBar, EntityTable, EntityTagFilter, EntityTagPicker, EntityTextFilter, EntityTypeFilter, EntityTypePicker, FavoriteEntity, InspectEntityDialog, MockEntityListContextProvider, MockStarredEntitiesApi, UnregisterEntityDialog, UserListFilter, UserListPicker, catalogApiRef, columnFactories, entityRouteParams, entityRouteRef, getEntityRelations, getEntitySourceLocation, humanizeEntityRef, isOwnerOf, starredEntitiesApiRef, useAsyncEntity, useEntity, useEntityList, useEntityOwnership, useEntityPermission, useEntityTypeFilter, useRelatedEntities, useStarredEntities, useStarredEntity };
|
|
2026
2060
|
//# sourceMappingURL=index.esm.js.map
|