@backstage/plugin-catalog-react 0.9.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 +74 -0
- package/alpha/package.json +1 -1
- package/dist/index.alpha.d.ts +18 -37
- package/dist/index.beta.d.ts +16 -35
- package/dist/index.d.ts +16 -35
- package/dist/index.esm.js +83 -40
- package/dist/index.esm.js.map +1 -1
- package/package.json +20 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,79 @@
|
|
|
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
|
+
|
|
20
|
+
## 1.0.1-next.0
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- a496cee4d1: Add support for string refs to the `EntityRefLinks` component
|
|
25
|
+
- d34900af81: Added a new `NextScaffolderRouter` which will eventually replace the exiting router
|
|
26
|
+
- Updated dependencies
|
|
27
|
+
- @backstage/catalog-model@1.0.1-next.0
|
|
28
|
+
- @backstage/integration@1.0.1-next.0
|
|
29
|
+
- @backstage/core-components@0.9.3-next.0
|
|
30
|
+
- @backstage/catalog-client@1.0.1-next.0
|
|
31
|
+
|
|
32
|
+
## 1.0.0
|
|
33
|
+
|
|
34
|
+
### Major Changes
|
|
35
|
+
|
|
36
|
+
- 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).
|
|
37
|
+
|
|
38
|
+
### Minor Changes
|
|
39
|
+
|
|
40
|
+
- f7fb7295e6: **BREAKING**: Removed the deprecated `favoriteEntityTooltip` and `favoriteEntityIcon` functions.
|
|
41
|
+
- 4cd92028b8: **BREAKING**: The following deprecated annotation reading helper functions were removed:
|
|
42
|
+
|
|
43
|
+
- `getEntityMetadataViewUrl`, use `entity.metadata.annotations?.[ANNOTATION_VIEW_URL]` instead.
|
|
44
|
+
- `getEntityMetadataEditUrl`, use `entity.metadata.annotations?.[ANNOTATION_EDIT_URL]` instead.
|
|
45
|
+
|
|
46
|
+
- 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.
|
|
47
|
+
- 0f3520d499: **BREAKING**: Removed the deprecated `formatEntityRefTitle`, use `humanizeEntityRef` instead.
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- a422d7ce5e: chore(deps): bump `@testing-library/react` from 11.2.6 to 12.1.3
|
|
52
|
+
- c689d7a94c: Added `CatalogFilterLayout`, which replaces `FilteredEntityLayout` from `@backstage/plugin-catalog`, as well as `FilterContainer` and `EntityListContainer`. It is used like this:
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
<CatalogFilterLayout>
|
|
56
|
+
<CatalogFilterLayout.Filters>
|
|
57
|
+
{/* filter drawer, for example <EntityTypePicker /> and friends */}
|
|
58
|
+
</CatalogFilterLayout.Filters>
|
|
59
|
+
<CatalogFilterLayout.Content>
|
|
60
|
+
{/* content view, for example a <CatalogTable /> */}
|
|
61
|
+
</CatalogFilterLayout.Content>
|
|
62
|
+
</CatalogFilterLayout>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
- Updated dependencies
|
|
66
|
+
- @backstage/core-components@0.9.2
|
|
67
|
+
- @backstage/core-plugin-api@1.0.0
|
|
68
|
+
- @backstage/version-bridge@1.0.0
|
|
69
|
+
- @backstage/plugin-permission-react@0.3.4
|
|
70
|
+
- @backstage/catalog-model@1.0.0
|
|
71
|
+
- @backstage/integration@1.0.0
|
|
72
|
+
- @backstage/catalog-client@1.0.0
|
|
73
|
+
- @backstage/errors@1.0.0
|
|
74
|
+
- @backstage/types@1.0.0
|
|
75
|
+
- @backstage/plugin-permission-common@0.5.3
|
|
76
|
+
|
|
3
77
|
## 0.9.0
|
|
4
78
|
|
|
5
79
|
### Minor 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';
|
|
@@ -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
|
/**
|
|
@@ -604,14 +585,14 @@ export declare function useEntityOwnership(): {
|
|
|
604
585
|
* A thin wrapper around the
|
|
605
586
|
* {@link @backstage/plugin-permission-react#usePermission} hook which uses the
|
|
606
587
|
* current entity in context to make an authorization request for the given
|
|
607
|
-
*
|
|
588
|
+
* {@link @backstage/plugin-catalog-common#CatalogEntityPermission}.
|
|
608
589
|
*
|
|
609
590
|
* Note: this hook blocks the permission request until the entity has loaded in
|
|
610
591
|
* context. If you have the entityRef and need concurrent requests, use the
|
|
611
592
|
* `usePermission` hook directly.
|
|
612
593
|
* @alpha
|
|
613
594
|
*/
|
|
614
|
-
export declare function useEntityPermission(permission:
|
|
595
|
+
export declare function useEntityPermission(permission: ResourcePermission<'catalog-entity'>): {
|
|
615
596
|
loading: boolean;
|
|
616
597
|
allowed: boolean;
|
|
617
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';
|
|
@@ -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
|
@@ -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';
|
|
@@ -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,12 +640,19 @@ 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,
|
|
616
651
|
error: permissionError
|
|
617
|
-
} = usePermission(
|
|
652
|
+
} = usePermission({
|
|
653
|
+
permission,
|
|
654
|
+
resourceRef: entity ? stringifyEntityRef(entity) : void 0
|
|
655
|
+
});
|
|
618
656
|
if (loadingEntity || loadingPermission) {
|
|
619
657
|
return { loading: true, allowed: false };
|
|
620
658
|
}
|
|
@@ -792,6 +830,7 @@ const EntitySearchBar = () => {
|
|
|
792
830
|
return /* @__PURE__ */ React.createElement(Toolbar, {
|
|
793
831
|
className: classes.searchToolbar
|
|
794
832
|
}, /* @__PURE__ */ React.createElement(FormControl, null, /* @__PURE__ */ React.createElement(Input, {
|
|
833
|
+
"aria-label": "search",
|
|
795
834
|
id: "input-with-icon-adornment",
|
|
796
835
|
className: classes.input,
|
|
797
836
|
placeholder: "Search",
|
|
@@ -993,7 +1032,17 @@ const checkedIcon = /* @__PURE__ */ React.createElement(CheckBoxIcon, {
|
|
|
993
1032
|
const EntityTagPicker = () => {
|
|
994
1033
|
var _a, _b;
|
|
995
1034
|
const classes = useStyles$7();
|
|
996
|
-
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]);
|
|
997
1046
|
const queryParamTags = useMemo(() => [queryParameters.tags].flat().filter(Boolean), [queryParameters]);
|
|
998
1047
|
const [selectedTags, setSelectedTags] = useState(queryParamTags.length ? queryParamTags : (_b = (_a = filters.tags) == null ? void 0 : _a.values) != null ? _b : []);
|
|
999
1048
|
useEffect(() => {
|
|
@@ -1006,10 +1055,7 @@ const EntityTagPicker = () => {
|
|
|
1006
1055
|
tags: selectedTags.length ? new EntityTagFilter(selectedTags) : void 0
|
|
1007
1056
|
});
|
|
1008
1057
|
}, [selectedTags, updateFilters]);
|
|
1009
|
-
|
|
1010
|
-
...new Set(backendEntities.flatMap((e) => e.metadata.tags).filter(Boolean))
|
|
1011
|
-
].sort(), [backendEntities]);
|
|
1012
|
-
if (!availableTags.length)
|
|
1058
|
+
if (!(availableTags == null ? void 0 : availableTags.length))
|
|
1013
1059
|
return null;
|
|
1014
1060
|
return /* @__PURE__ */ React.createElement(Box, {
|
|
1015
1061
|
pb: 1,
|
|
@@ -1083,11 +1129,10 @@ const YellowStar = withStyles({
|
|
|
1083
1129
|
color: "#f3ba37"
|
|
1084
1130
|
}
|
|
1085
1131
|
})(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
1132
|
const FavoriteEntity = (props) => {
|
|
1089
1133
|
const { toggleStarredEntity, isStarredEntity } = useStarredEntity(props.entity);
|
|
1090
1134
|
return /* @__PURE__ */ React.createElement(IconButton, {
|
|
1135
|
+
"aria-label": "favorite",
|
|
1091
1136
|
color: "inherit",
|
|
1092
1137
|
...props,
|
|
1093
1138
|
onClick: () => toggleStarredEntity()
|
|
@@ -1496,9 +1541,7 @@ function OverviewPage(props) {
|
|
|
1496
1541
|
entry
|
|
1497
1542
|
}))), !!Object.keys(metadata.labels || {}).length && /* @__PURE__ */ React.createElement(List, {
|
|
1498
1543
|
dense: true,
|
|
1499
|
-
subheader: /* @__PURE__ */ React.createElement(ListSubheader, null, "Labels"
|
|
1500
|
-
to: "https://backstage.io/docs/features/software-catalog/well-known-labels"
|
|
1501
|
-
}))
|
|
1544
|
+
subheader: /* @__PURE__ */ React.createElement(ListSubheader, null, "Labels")
|
|
1502
1545
|
}, Object.entries(metadata.labels).map((entry) => /* @__PURE__ */ React.createElement(KeyValueListItem, {
|
|
1503
1546
|
key: entry[0],
|
|
1504
1547
|
indent: true,
|
|
@@ -2022,5 +2065,5 @@ const MockEntityListContextProvider = ({
|
|
|
2022
2065
|
}, children);
|
|
2023
2066
|
};
|
|
2024
2067
|
|
|
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,
|
|
2068
|
+
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
2069
|
//# sourceMappingURL=index.esm.js.map
|