@backstage/plugin-catalog-react 0.9.0-next.0 → 1.0.1-next.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 +86 -0
- package/alpha/package.json +1 -1
- package/dist/index.alpha.d.ts +15 -34
- package/dist/index.beta.d.ts +15 -34
- package/dist/index.d.ts +15 -34
- package/dist/index.esm.js +66 -31
- package/dist/index.esm.js.map +1 -1
- package/package.json +19 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,91 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-react
|
|
2
2
|
|
|
3
|
+
## 1.0.1-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a496cee4d1: Add support for string refs to the `EntityRefLinks` component
|
|
8
|
+
- d34900af81: Added a new `NextScaffolderRouter` which will eventually replace the exiting router
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
- @backstage/catalog-model@1.0.1-next.0
|
|
11
|
+
- @backstage/integration@1.0.1-next.0
|
|
12
|
+
- @backstage/core-components@0.9.3-next.0
|
|
13
|
+
- @backstage/catalog-client@1.0.1-next.0
|
|
14
|
+
|
|
15
|
+
## 1.0.0
|
|
16
|
+
|
|
17
|
+
### Major Changes
|
|
18
|
+
|
|
19
|
+
- 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).
|
|
20
|
+
|
|
21
|
+
### Minor Changes
|
|
22
|
+
|
|
23
|
+
- f7fb7295e6: **BREAKING**: Removed the deprecated `favoriteEntityTooltip` and `favoriteEntityIcon` functions.
|
|
24
|
+
- 4cd92028b8: **BREAKING**: The following deprecated annotation reading helper functions were removed:
|
|
25
|
+
|
|
26
|
+
- `getEntityMetadataViewUrl`, use `entity.metadata.annotations?.[ANNOTATION_VIEW_URL]` instead.
|
|
27
|
+
- `getEntityMetadataEditUrl`, use `entity.metadata.annotations?.[ANNOTATION_EDIT_URL]` instead.
|
|
28
|
+
|
|
29
|
+
- 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.
|
|
30
|
+
- 0f3520d499: **BREAKING**: Removed the deprecated `formatEntityRefTitle`, use `humanizeEntityRef` instead.
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- a422d7ce5e: chore(deps): bump `@testing-library/react` from 11.2.6 to 12.1.3
|
|
35
|
+
- c689d7a94c: Added `CatalogFilterLayout`, which replaces `FilteredEntityLayout` from `@backstage/plugin-catalog`, as well as `FilterContainer` and `EntityListContainer`. It is used like this:
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
<CatalogFilterLayout>
|
|
39
|
+
<CatalogFilterLayout.Filters>
|
|
40
|
+
{/* filter drawer, for example <EntityTypePicker /> and friends */}
|
|
41
|
+
</CatalogFilterLayout.Filters>
|
|
42
|
+
<CatalogFilterLayout.Content>
|
|
43
|
+
{/* content view, for example a <CatalogTable /> */}
|
|
44
|
+
</CatalogFilterLayout.Content>
|
|
45
|
+
</CatalogFilterLayout>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
- Updated dependencies
|
|
49
|
+
- @backstage/core-components@0.9.2
|
|
50
|
+
- @backstage/core-plugin-api@1.0.0
|
|
51
|
+
- @backstage/version-bridge@1.0.0
|
|
52
|
+
- @backstage/plugin-permission-react@0.3.4
|
|
53
|
+
- @backstage/catalog-model@1.0.0
|
|
54
|
+
- @backstage/integration@1.0.0
|
|
55
|
+
- @backstage/catalog-client@1.0.0
|
|
56
|
+
- @backstage/errors@1.0.0
|
|
57
|
+
- @backstage/types@1.0.0
|
|
58
|
+
- @backstage/plugin-permission-common@0.5.3
|
|
59
|
+
|
|
60
|
+
## 0.9.0
|
|
61
|
+
|
|
62
|
+
### Minor Changes
|
|
63
|
+
|
|
64
|
+
- b0af81726d: **BREAKING**: Removed `reduceCatalogFilters` and `reduceEntityFilters` due to low external utility value.
|
|
65
|
+
- 7ffb2c73c9: **BREAKING**: Removed the deprecated `loadCatalogOwnerRefs` function. Usages of this function can be directly replaced with `ownershipEntityRefs` from `identityApi.getBackstageIdentity()`.
|
|
66
|
+
|
|
67
|
+
This also affects the `useEntityOwnership` hook in that it no longer uses `loadCatalogOwnerRefs`, meaning it will no longer load in additional relations and instead only rely on the `ownershipEntityRefs` from the `IdentityApi`.
|
|
68
|
+
|
|
69
|
+
- dd88d1e3ac: **BREAKING**: Removed `useEntityFromUrl`.
|
|
70
|
+
- 9844d4d2bd: **BREAKING**: Removed `useEntityCompoundName`, use `useRouteRefParams(entityRouteRef)` instead.
|
|
71
|
+
- 2b8c986ce0: **BREAKING**: Removed `useEntityListProvider` use `useEntityList` instead.
|
|
72
|
+
- f3a7a9de6d: **BREAKING**: Removed `useOwnedEntities` and moved its usage internally to the scaffolder-backend where it's used.
|
|
73
|
+
|
|
74
|
+
**BREAKING**: Removed `EntityTypeReturn` type which is now inlined.
|
|
75
|
+
|
|
76
|
+
- cf1ff5b438: **BREAKING**: Removed the `useEntityKinds` hook, use `catalogApi.getEntityFacets({ facets: ['kind'] })` instead.
|
|
77
|
+
- fc6290a76d: **BREAKING**: Removed the deprecated `useOwnUser` hook. Existing usage can be replaced with `identityApi.getBackstageIdentity()`, followed by a call to `catalogClient.getEntityByRef(identity.userEntityRef)`.
|
|
78
|
+
|
|
79
|
+
### Patch Changes
|
|
80
|
+
|
|
81
|
+
- b1aacbf96a: Applied the fix for the `/alpha` entry point resolution that was part of the `v0.70.1` release of Backstage.
|
|
82
|
+
- 2986f8e09d: Fixed EntityOwnerPicker and OwnershipCard url filter issue with more than 21 owners
|
|
83
|
+
- f3a7a9de6d: Internalized usage of `useOwnedEntities` hook.
|
|
84
|
+
- Updated dependencies
|
|
85
|
+
- @backstage/core-components@0.9.1
|
|
86
|
+
- @backstage/catalog-model@0.13.0
|
|
87
|
+
- @backstage/catalog-client@0.9.0
|
|
88
|
+
|
|
3
89
|
## 0.9.0-next.0
|
|
4
90
|
|
|
5
91
|
### 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;
|
|
@@ -282,7 +295,7 @@ export declare type EntityRefLinkProps = {
|
|
|
282
295
|
*
|
|
283
296
|
* @public
|
|
284
297
|
*/
|
|
285
|
-
export declare
|
|
298
|
+
export declare function EntityRefLinks(props: EntityRefLinksProps): JSX.Element;
|
|
286
299
|
|
|
287
300
|
/**
|
|
288
301
|
* Props for {@link EntityRefLink}.
|
|
@@ -290,7 +303,7 @@ export declare const EntityRefLinks: ({ entityRefs, defaultKind, ...linkProps }:
|
|
|
290
303
|
* @public
|
|
291
304
|
*/
|
|
292
305
|
export declare type EntityRefLinksProps = {
|
|
293
|
-
entityRefs: (Entity | CompoundEntityRef)[];
|
|
306
|
+
entityRefs: (string | Entity | CompoundEntityRef)[];
|
|
294
307
|
defaultKind?: string;
|
|
295
308
|
} & Omit<LinkProps, 'to'>;
|
|
296
309
|
|
|
@@ -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;
|
|
@@ -282,7 +295,7 @@ export declare type EntityRefLinkProps = {
|
|
|
282
295
|
*
|
|
283
296
|
* @public
|
|
284
297
|
*/
|
|
285
|
-
export declare
|
|
298
|
+
export declare function EntityRefLinks(props: EntityRefLinksProps): JSX.Element;
|
|
286
299
|
|
|
287
300
|
/**
|
|
288
301
|
* Props for {@link EntityRefLink}.
|
|
@@ -290,7 +303,7 @@ export declare const EntityRefLinks: ({ entityRefs, defaultKind, ...linkProps }:
|
|
|
290
303
|
* @public
|
|
291
304
|
*/
|
|
292
305
|
export declare type EntityRefLinksProps = {
|
|
293
|
-
entityRefs: (Entity | CompoundEntityRef)[];
|
|
306
|
+
entityRefs: (string | Entity | CompoundEntityRef)[];
|
|
294
307
|
defaultKind?: string;
|
|
295
308
|
} & Omit<LinkProps, 'to'>;
|
|
296
309
|
|
|
@@ -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;
|
|
@@ -282,7 +295,7 @@ export declare type EntityRefLinkProps = {
|
|
|
282
295
|
*
|
|
283
296
|
* @public
|
|
284
297
|
*/
|
|
285
|
-
export declare
|
|
298
|
+
export declare function EntityRefLinks(props: EntityRefLinksProps): JSX.Element;
|
|
286
299
|
|
|
287
300
|
/**
|
|
288
301
|
* Props for {@link EntityRefLink}.
|
|
@@ -290,7 +303,7 @@ export declare const EntityRefLinks: ({ entityRefs, defaultKind, ...linkProps }:
|
|
|
290
303
|
* @public
|
|
291
304
|
*/
|
|
292
305
|
export declare type EntityRefLinksProps = {
|
|
293
|
-
entityRefs: (Entity | CompoundEntityRef)[];
|
|
306
|
+
entityRefs: (string | Entity | CompoundEntityRef)[];
|
|
294
307
|
defaultKind?: string;
|
|
295
308
|
} & Omit<LinkProps, 'to'>;
|
|
296
309
|
|
|
@@ -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;
|
|
@@ -336,17 +368,16 @@ const EntityRefLink = forwardRef((props, ref) => {
|
|
|
336
368
|
}, link) : link;
|
|
337
369
|
});
|
|
338
370
|
|
|
339
|
-
|
|
340
|
-
entityRefs,
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
}))));
|
|
371
|
+
function EntityRefLinks(props) {
|
|
372
|
+
const { entityRefs, defaultKind, ...linkProps } = props;
|
|
373
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, entityRefs.map((r, i) => /* @__PURE__ */ React.createElement(React.Fragment, {
|
|
374
|
+
key: i
|
|
375
|
+
}, i > 0 && ", ", /* @__PURE__ */ React.createElement(EntityRefLink, {
|
|
376
|
+
...linkProps,
|
|
377
|
+
entityRef: r,
|
|
378
|
+
defaultKind
|
|
379
|
+
}))));
|
|
380
|
+
}
|
|
350
381
|
|
|
351
382
|
class EntityKindFilter {
|
|
352
383
|
constructor(value) {
|
|
@@ -609,7 +640,11 @@ function useEntityOwnership() {
|
|
|
609
640
|
}
|
|
610
641
|
|
|
611
642
|
function useEntityPermission(permission) {
|
|
612
|
-
const {
|
|
643
|
+
const {
|
|
644
|
+
entity,
|
|
645
|
+
loading: loadingEntity,
|
|
646
|
+
error: entityError
|
|
647
|
+
} = useAsyncEntity();
|
|
613
648
|
const {
|
|
614
649
|
allowed,
|
|
615
650
|
loading: loadingPermission,
|
|
@@ -792,6 +827,7 @@ const EntitySearchBar = () => {
|
|
|
792
827
|
return /* @__PURE__ */ React.createElement(Toolbar, {
|
|
793
828
|
className: classes.searchToolbar
|
|
794
829
|
}, /* @__PURE__ */ React.createElement(FormControl, null, /* @__PURE__ */ React.createElement(Input, {
|
|
830
|
+
"aria-label": "search",
|
|
795
831
|
id: "input-with-icon-adornment",
|
|
796
832
|
className: classes.input,
|
|
797
833
|
placeholder: "Search",
|
|
@@ -1083,11 +1119,10 @@ 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, {
|
|
1125
|
+
"aria-label": "favorite",
|
|
1091
1126
|
color: "inherit",
|
|
1092
1127
|
...props,
|
|
1093
1128
|
onClick: () => toggleStarredEntity()
|
|
@@ -2022,5 +2057,5 @@ const MockEntityListContextProvider = ({
|
|
|
2022
2057
|
}, children);
|
|
2023
2058
|
};
|
|
2024
2059
|
|
|
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,
|
|
2060
|
+
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
2061
|
//# sourceMappingURL=index.esm.js.map
|