@backstage/plugin-catalog-react 1.8.3-next.0 → 1.8.4-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 CHANGED
@@ -1,5 +1,25 @@
1
1
  # @backstage/plugin-catalog-react
2
2
 
3
+ ## 1.8.4-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - bd817209ddd7: Export the `EntityAutocompletePicker` component.
8
+ - 7029ba1ce0af: Added delete alert popup when user delete the entity
9
+ - Updated dependencies
10
+ - @backstage/core-components@0.13.5-next.1
11
+ - @backstage/integration@1.7.0-next.1
12
+ - @backstage/catalog-model@1.4.2-next.0
13
+ - @backstage/core-plugin-api@1.6.0-next.1
14
+ - @backstage/plugin-permission-common@0.7.8-next.0
15
+ - @backstage/plugin-permission-react@0.4.15-next.1
16
+ - @backstage/catalog-client@1.4.4-next.0
17
+ - @backstage/plugin-catalog-common@1.0.16-next.0
18
+ - @backstage/errors@1.2.1
19
+ - @backstage/theme@0.4.1
20
+ - @backstage/types@1.1.0
21
+ - @backstage/version-bridge@1.0.4
22
+
3
23
  ## 1.8.3-next.0
4
24
 
5
25
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-react",
3
- "version": "1.8.3-next.0",
3
+ "version": "1.8.4-next.1",
4
4
  "main": "../dist/alpha.esm.js",
5
5
  "module": "../dist/alpha.esm.js",
6
6
  "types": "../dist/alpha.d.ts"
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ import React, { PropsWithChildren, ReactNode, ComponentProps } from 'react';
7
7
  import * as _backstage_catalog_model from '@backstage/catalog-model';
8
8
  import { Entity, CompoundEntityRef } from '@backstage/catalog-model';
9
9
  import { LinkProps, InfoCardVariants, TableColumn, TableOptions } from '@backstage/core-components';
10
- import { IconButton } from '@material-ui/core';
10
+ import { IconButton, TextFieldProps } from '@material-ui/core';
11
11
  import { Overrides } from '@material-ui/core/styles/overrides';
12
12
  import { StyleRules } from '@material-ui/core/styles/withStyles';
13
13
  import { ScmIntegrationRegistry } from '@backstage/integration';
@@ -346,62 +346,6 @@ type CatalogReactEntityNamespacePickerClassKey = 'input';
346
346
  /** @public */
347
347
  declare const EntityNamespacePicker: () => React.JSX.Element;
348
348
 
349
- /** @public */
350
- type EntityLoadingStatus<TEntity extends Entity = Entity> = {
351
- entity?: TEntity;
352
- loading: boolean;
353
- error?: Error;
354
- refresh?: VoidFunction;
355
- };
356
- /**
357
- * Properties for the AsyncEntityProvider component.
358
- *
359
- * @public
360
- */
361
- interface AsyncEntityProviderProps {
362
- children: ReactNode;
363
- entity?: Entity;
364
- loading: boolean;
365
- error?: Error;
366
- refresh?: VoidFunction;
367
- }
368
- /**
369
- * Provides a loaded entity to be picked up by the `useEntity` hook.
370
- *
371
- * @public
372
- */
373
- declare const AsyncEntityProvider: (props: AsyncEntityProviderProps) => React.JSX.Element;
374
- /**
375
- * Properties for the EntityProvider component.
376
- *
377
- * @public
378
- */
379
- interface EntityProviderProps {
380
- children: ReactNode;
381
- entity?: Entity;
382
- }
383
- /**
384
- * Provides an entity to be picked up by the `useEntity` hook.
385
- *
386
- * @public
387
- */
388
- declare const EntityProvider: (props: EntityProviderProps) => React.JSX.Element;
389
- /**
390
- * Grab the current entity from the context, throws if the entity has not yet been loaded
391
- * or is not available.
392
- *
393
- * @public
394
- */
395
- declare function useEntity<TEntity extends Entity = Entity>(): {
396
- entity: TEntity;
397
- };
398
- /**
399
- * Grab the current entity from the context, provides loading state and errors, and the ability to refresh.
400
- *
401
- * @public
402
- */
403
- declare function useAsyncEntity<TEntity extends Entity = Entity>(): EntityLoadingStatus<TEntity>;
404
-
405
349
  /**
406
350
  * Filter entities based on Kind.
407
351
  * @public
@@ -566,6 +510,83 @@ declare const EntityListProvider: <EntityFilters extends DefaultEntityFilters>(p
566
510
  */
567
511
  declare function useEntityList<EntityFilters extends DefaultEntityFilters = DefaultEntityFilters>(): EntityListContextProps<EntityFilters>;
568
512
 
513
+ /** @public */
514
+ type AllowedEntityFilters<T extends DefaultEntityFilters> = {
515
+ [K in keyof T]-?: NonNullable<T[K]> extends EntityFilter & {
516
+ values: string[];
517
+ } ? K : never;
518
+ }[keyof T];
519
+ /** @public */
520
+ type EntityAutocompletePickerProps<T extends DefaultEntityFilters = DefaultEntityFilters, Name extends AllowedEntityFilters<T> = AllowedEntityFilters<T>> = {
521
+ label: string;
522
+ name: Name;
523
+ path: string;
524
+ showCounts?: boolean;
525
+ Filter: {
526
+ new (values: string[]): NonNullable<T[Name]>;
527
+ };
528
+ InputProps?: TextFieldProps;
529
+ initialSelectedOptions?: string[];
530
+ };
531
+ /** @public */
532
+ declare function EntityAutocompletePicker<T extends DefaultEntityFilters = DefaultEntityFilters, Name extends AllowedEntityFilters<T> = AllowedEntityFilters<T>>(props: EntityAutocompletePickerProps<T, Name>): React.JSX.Element | null;
533
+
534
+ /** @public */
535
+ type EntityLoadingStatus<TEntity extends Entity = Entity> = {
536
+ entity?: TEntity;
537
+ loading: boolean;
538
+ error?: Error;
539
+ refresh?: VoidFunction;
540
+ };
541
+ /**
542
+ * Properties for the AsyncEntityProvider component.
543
+ *
544
+ * @public
545
+ */
546
+ interface AsyncEntityProviderProps {
547
+ children: ReactNode;
548
+ entity?: Entity;
549
+ loading: boolean;
550
+ error?: Error;
551
+ refresh?: VoidFunction;
552
+ }
553
+ /**
554
+ * Provides a loaded entity to be picked up by the `useEntity` hook.
555
+ *
556
+ * @public
557
+ */
558
+ declare const AsyncEntityProvider: (props: AsyncEntityProviderProps) => React.JSX.Element;
559
+ /**
560
+ * Properties for the EntityProvider component.
561
+ *
562
+ * @public
563
+ */
564
+ interface EntityProviderProps {
565
+ children: ReactNode;
566
+ entity?: Entity;
567
+ }
568
+ /**
569
+ * Provides an entity to be picked up by the `useEntity` hook.
570
+ *
571
+ * @public
572
+ */
573
+ declare const EntityProvider: (props: EntityProviderProps) => React.JSX.Element;
574
+ /**
575
+ * Grab the current entity from the context, throws if the entity has not yet been loaded
576
+ * or is not available.
577
+ *
578
+ * @public
579
+ */
580
+ declare function useEntity<TEntity extends Entity = Entity>(): {
581
+ entity: TEntity;
582
+ };
583
+ /**
584
+ * Grab the current entity from the context, provides loading state and errors, and the ability to refresh.
585
+ *
586
+ * @public
587
+ */
588
+ declare function useAsyncEntity<TEntity extends Entity = Entity>(): EntityLoadingStatus<TEntity>;
589
+
569
590
  /**
570
591
  * A hook built on top of `useEntityList` for enabling selection of valid `spec.type` values
571
592
  * based on the selected EntityKindFilter.
@@ -683,4 +704,4 @@ type EntitySourceLocation = {
683
704
  /** @public */
684
705
  declare function getEntitySourceLocation(entity: Entity, scmIntegrationsApi: ScmIntegrationRegistry): EntitySourceLocation | undefined;
685
706
 
686
- export { AsyncEntityProvider, AsyncEntityProviderProps, BackstageOverrides, CatalogFilterLayout, CatalogReactComponentsNameToClassKey, CatalogReactEntityLifecyclePickerClassKey, CatalogReactEntityNamespacePickerClassKey, CatalogReactEntityOwnerPickerClassKey, CatalogReactEntityProcessingStatusPickerClassKey, CatalogReactEntitySearchBarClassKey, CatalogReactEntityTagPickerClassKey, CatalogReactUserListPickerClassKey, DefaultEntityFilters, EntityErrorFilter, EntityFilter, EntityKindFilter, EntityKindPicker, EntityKindPickerProps, EntityLifecycleFilter, EntityLifecyclePicker, EntityListContext, EntityListContextProps, EntityListProvider, EntityLoadingStatus, EntityNamespaceFilter, EntityNamespacePicker, EntityOrphanFilter, EntityOwnerFilter, EntityOwnerPicker, EntityOwnerPickerProps, EntityPeekAheadPopover, EntityPeekAheadPopoverProps, EntityProcessingStatusPicker, EntityProvider, EntityProviderProps, EntityRefLink, EntityRefLinkProps, EntityRefLinks, EntityRefLinksProps, EntitySearchBar, EntitySourceLocation, EntityTable, EntityTableProps, EntityTagFilter, EntityTagPicker, EntityTagPickerProps, EntityTextFilter, EntityTypeFilter, EntityTypePicker, EntityTypePickerProps, FavoriteEntity, FavoriteEntityProps, InspectEntityDialog, MockEntityListContextProvider, MockStarredEntitiesApi, StarredEntitiesApi, UnregisterEntityDialog, UnregisterEntityDialogProps, UserListFilter, UserListFilterKind, UserListPicker, UserListPickerProps, catalogApiRef, columnFactories, entityRouteParams, entityRouteRef, getEntityRelations, getEntitySourceLocation, humanizeEntityRef, starredEntitiesApiRef, useAsyncEntity, useEntity, useEntityList, useEntityOwnership, useEntityTypeFilter, useRelatedEntities, useStarredEntities, useStarredEntity };
707
+ export { AllowedEntityFilters, AsyncEntityProvider, AsyncEntityProviderProps, BackstageOverrides, CatalogFilterLayout, CatalogReactComponentsNameToClassKey, CatalogReactEntityLifecyclePickerClassKey, CatalogReactEntityNamespacePickerClassKey, CatalogReactEntityOwnerPickerClassKey, CatalogReactEntityProcessingStatusPickerClassKey, CatalogReactEntitySearchBarClassKey, CatalogReactEntityTagPickerClassKey, CatalogReactUserListPickerClassKey, DefaultEntityFilters, EntityAutocompletePicker, EntityAutocompletePickerProps, EntityErrorFilter, EntityFilter, EntityKindFilter, EntityKindPicker, EntityKindPickerProps, EntityLifecycleFilter, EntityLifecyclePicker, EntityListContext, EntityListContextProps, EntityListProvider, EntityLoadingStatus, EntityNamespaceFilter, EntityNamespacePicker, EntityOrphanFilter, EntityOwnerFilter, EntityOwnerPicker, EntityOwnerPickerProps, EntityPeekAheadPopover, EntityPeekAheadPopoverProps, EntityProcessingStatusPicker, EntityProvider, EntityProviderProps, EntityRefLink, EntityRefLinkProps, EntityRefLinks, EntityRefLinksProps, EntitySearchBar, EntitySourceLocation, EntityTable, EntityTableProps, EntityTagFilter, EntityTagPicker, EntityTagPickerProps, EntityTextFilter, EntityTypeFilter, EntityTypePicker, EntityTypePickerProps, FavoriteEntity, FavoriteEntityProps, InspectEntityDialog, MockEntityListContextProvider, MockStarredEntitiesApi, StarredEntitiesApi, UnregisterEntityDialog, UnregisterEntityDialogProps, UserListFilter, UserListFilterKind, UserListPicker, UserListPickerProps, catalogApiRef, columnFactories, entityRouteParams, entityRouteRef, getEntityRelations, getEntitySourceLocation, humanizeEntityRef, starredEntitiesApiRef, useAsyncEntity, useEntity, useEntityList, useEntityOwnership, useEntityTypeFilter, useRelatedEntities, useStarredEntities, useStarredEntity };
package/dist/index.esm.js CHANGED
@@ -2340,11 +2340,18 @@ const Contents = ({
2340
2340
  );
2341
2341
  const onDelete = useCallback(
2342
2342
  async function onDeleteFn() {
2343
+ var _a2;
2343
2344
  if ("deleteEntity" in state) {
2344
2345
  setBusy(true);
2345
2346
  try {
2346
2347
  await state.deleteEntity();
2348
+ const entityName = (_a2 = entity.metadata.title) != null ? _a2 : entity.metadata.name;
2347
2349
  onConfirm();
2350
+ alertApi.post({
2351
+ message: `Removed entity ${entityName}`,
2352
+ severity: "success",
2353
+ display: "transient"
2354
+ });
2348
2355
  } catch (err) {
2349
2356
  assertError(err);
2350
2357
  alertApi.post({ message: err.message });
@@ -2353,7 +2360,7 @@ const Contents = ({
2353
2360
  }
2354
2361
  }
2355
2362
  },
2356
- [alertApi, onConfirm, state]
2363
+ [alertApi, onConfirm, state, entity]
2357
2364
  );
2358
2365
  const DialogActionsPanel = () => /* @__PURE__ */ React.createElement(DialogActions, { className: classes.dialogActions }, /* @__PURE__ */ React.createElement(Button, { onClick: onClose, color: "primary" }, "Cancel"));
2359
2366
  if (state.type === "loading") {
@@ -2731,5 +2738,5 @@ function MockEntityListContextProvider(props) {
2731
2738
  return /* @__PURE__ */ React.createElement(EntityListContext.Provider, { value: resolvedValue }, children);
2732
2739
  }
2733
2740
 
2734
- export { CatalogFilterLayout, EntityErrorFilter, EntityKindFilter, EntityKindPicker, EntityLifecycleFilter, EntityLifecyclePicker, EntityListContext, EntityListProvider, EntityNamespaceFilter, EntityNamespacePicker, EntityOrphanFilter, EntityOwnerFilter, EntityOwnerPicker, EntityPeekAheadPopover, EntityProcessingStatusPicker, EntityRefLink, EntityRefLinks, EntitySearchBar, EntityTable, EntityTagFilter, EntityTagPicker, EntityTextFilter, EntityTypeFilter, EntityTypePicker, FavoriteEntity, InspectEntityDialog, MockEntityListContextProvider, MockStarredEntitiesApi, UnregisterEntityDialog, UserListFilter, UserListPicker, catalogApiRef, columnFactories, entityRouteParams, entityRouteRef, getEntitySourceLocation, humanizeEntityRef, starredEntitiesApiRef, useEntityList, useEntityOwnership, useEntityTypeFilter, useRelatedEntities, useStarredEntities, useStarredEntity };
2741
+ export { CatalogFilterLayout, EntityAutocompletePicker, EntityErrorFilter, EntityKindFilter, EntityKindPicker, EntityLifecycleFilter, EntityLifecyclePicker, EntityListContext, EntityListProvider, EntityNamespaceFilter, EntityNamespacePicker, EntityOrphanFilter, EntityOwnerFilter, EntityOwnerPicker, EntityPeekAheadPopover, EntityProcessingStatusPicker, EntityRefLink, EntityRefLinks, EntitySearchBar, EntityTable, EntityTagFilter, EntityTagPicker, EntityTextFilter, EntityTypeFilter, EntityTypePicker, FavoriteEntity, InspectEntityDialog, MockEntityListContextProvider, MockStarredEntitiesApi, UnregisterEntityDialog, UserListFilter, UserListPicker, catalogApiRef, columnFactories, entityRouteParams, entityRouteRef, getEntitySourceLocation, humanizeEntityRef, starredEntitiesApiRef, useEntityList, useEntityOwnership, useEntityTypeFilter, useRelatedEntities, useStarredEntities, useStarredEntity };
2735
2742
  //# sourceMappingURL=index.esm.js.map