@backstage/plugin-catalog-react 1.9.0-next.1 → 1.9.0-next.2

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,18 @@
1
1
  # @backstage/plugin-catalog-react
2
2
 
3
+ ## 1.9.0-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#20962](https://github.com/backstage/backstage/pull/20962) [`000dcd01af`](https://github.com/backstage/backstage/commit/000dcd01afaa4a06b67da20c3590a7753af4f532) Thanks [@Rugvip](https://github.com/Rugvip)! - Removed unnecessary `@backstage/integration` dependency, replaced by `@backstage/integration-react`.
8
+
9
+ - [#20842](https://github.com/backstage/backstage/pull/20842) [`6c357184e2`](https://github.com/backstage/backstage/commit/6c357184e27d86796fac6005ec6a597f994aa19d) Thanks [@benjdlambert](https://github.com/benjdlambert)! - Export `MissingAnnotationEmptyState` from `@backstage/plugin-catalog-react`
10
+
11
+ - Updated dependencies
12
+ - @backstage/core-components@0.13.8-next.2
13
+ - @backstage/frontend-plugin-api@0.3.0-next.2
14
+ - @backstage/integration-react@1.1.21-next.1
15
+
3
16
  ## 1.9.0-next.1
4
17
 
5
18
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-react",
3
- "version": "1.9.0-next.1",
3
+ "version": "1.9.0-next.2",
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
@@ -11,7 +11,7 @@ import { LinkProps, InfoCardVariants, TableColumn, TableOptions } from '@backsta
11
11
  import { IconButton, TextFieldProps } from '@material-ui/core';
12
12
  import { Overrides } from '@material-ui/core/styles/overrides';
13
13
  import { StyleRules } from '@material-ui/core/styles/withStyles';
14
- import { ScmIntegrationRegistry } from '@backstage/integration';
14
+ import { scmIntegrationsApiRef } from '@backstage/integration-react';
15
15
 
16
16
  /**
17
17
  * The API reference for the {@link @backstage/catalog-client#CatalogApi}.
@@ -714,6 +714,17 @@ type EntityAutocompletePickerProps<T extends DefaultEntityFilters = DefaultEntit
714
714
  /** @public */
715
715
  declare function EntityAutocompletePicker<T extends DefaultEntityFilters = DefaultEntityFilters, Name extends AllowedEntityFilters<T> = AllowedEntityFilters<T>>(props: EntityAutocompletePickerProps<T, Name>): React.JSX.Element | null;
716
716
 
717
+ /** @public */
718
+ type MissingAnnotationEmptyStateClassKey = 'code';
719
+ /**
720
+ * @public
721
+ * Renders an empty state when an annotation is missing from an entity.
722
+ */
723
+ declare function MissingAnnotationEmptyState(props: {
724
+ annotation: string | string[];
725
+ readMoreUrl?: string;
726
+ }): React.JSX.Element;
727
+
717
728
  /** @public */
718
729
  type EntityLoadingStatus<TEntity extends Entity = Entity> = {
719
730
  entity?: TEntity;
@@ -886,6 +897,6 @@ type EntitySourceLocation = {
886
897
  integrationType?: string;
887
898
  };
888
899
  /** @public */
889
- declare function getEntitySourceLocation(entity: Entity, scmIntegrationsApi: ScmIntegrationRegistry): EntitySourceLocation | undefined;
900
+ declare function getEntitySourceLocation(entity: Entity, scmIntegrationsApi: typeof scmIntegrationsApiRef.T): EntitySourceLocation | undefined;
890
901
 
891
- export { AllowedEntityFilters, AsyncEntityProvider, AsyncEntityProviderProps, BackstageOverrides, CatalogFilterLayout, CatalogReactComponentsNameToClassKey, CatalogReactEntityDisplayNameClassKey, CatalogReactEntityLifecyclePickerClassKey, CatalogReactEntityNamespacePickerClassKey, CatalogReactEntityOwnerPickerClassKey, CatalogReactEntityProcessingStatusPickerClassKey, CatalogReactEntitySearchBarClassKey, CatalogReactEntityTagPickerClassKey, CatalogReactUserListPickerClassKey, DefaultEntityFilters, EntityAutocompletePicker, EntityAutocompletePickerProps, EntityDisplayName, EntityDisplayNameProps, EntityErrorFilter, EntityFilter, EntityKindFilter, EntityKindPicker, EntityKindPickerProps, EntityLifecycleFilter, EntityLifecyclePicker, EntityListContext, EntityListContextProps, EntityListProvider, EntityLoadingStatus, EntityNamespaceFilter, EntityNamespacePicker, EntityOrphanFilter, EntityOwnerFilter, EntityOwnerPicker, EntityOwnerPickerProps, EntityPeekAheadPopover, EntityPeekAheadPopoverProps, EntityPresentationApi, EntityProcessingStatusPicker, EntityProvider, EntityProviderProps, EntityRefLink, EntityRefLinkProps, EntityRefLinks, EntityRefLinksProps, EntityRefPresentation, EntityRefPresentationSnapshot, EntitySearchBar, EntitySourceLocation, EntityTable, EntityTableProps, EntityTagFilter, EntityTagPicker, EntityTagPickerProps, EntityTextFilter, EntityTypeFilter, EntityTypePicker, EntityTypePickerProps, EntityUserFilter, FavoriteEntity, FavoriteEntityProps, InspectEntityDialog, MockEntityListContextProvider, MockStarredEntitiesApi, StarredEntitiesApi, UnregisterEntityDialog, UnregisterEntityDialogProps, UserListFilter, UserListFilterKind, UserListPicker, UserListPickerProps, catalogApiRef, columnFactories, defaultEntityPresentation, entityPresentationApiRef, entityRouteParams, entityRouteRef, getEntityRelations, getEntitySourceLocation, humanizeEntityRef, starredEntitiesApiRef, useAsyncEntity, useEntity, useEntityList, useEntityOwnership, useEntityPresentation, useEntityTypeFilter, useRelatedEntities, useStarredEntities, useStarredEntity };
902
+ export { AllowedEntityFilters, AsyncEntityProvider, AsyncEntityProviderProps, BackstageOverrides, CatalogFilterLayout, CatalogReactComponentsNameToClassKey, CatalogReactEntityDisplayNameClassKey, CatalogReactEntityLifecyclePickerClassKey, CatalogReactEntityNamespacePickerClassKey, CatalogReactEntityOwnerPickerClassKey, CatalogReactEntityProcessingStatusPickerClassKey, CatalogReactEntitySearchBarClassKey, CatalogReactEntityTagPickerClassKey, CatalogReactUserListPickerClassKey, DefaultEntityFilters, EntityAutocompletePicker, EntityAutocompletePickerProps, EntityDisplayName, EntityDisplayNameProps, EntityErrorFilter, EntityFilter, EntityKindFilter, EntityKindPicker, EntityKindPickerProps, EntityLifecycleFilter, EntityLifecyclePicker, EntityListContext, EntityListContextProps, EntityListProvider, EntityLoadingStatus, EntityNamespaceFilter, EntityNamespacePicker, EntityOrphanFilter, EntityOwnerFilter, EntityOwnerPicker, EntityOwnerPickerProps, EntityPeekAheadPopover, EntityPeekAheadPopoverProps, EntityPresentationApi, EntityProcessingStatusPicker, EntityProvider, EntityProviderProps, EntityRefLink, EntityRefLinkProps, EntityRefLinks, EntityRefLinksProps, EntityRefPresentation, EntityRefPresentationSnapshot, EntitySearchBar, EntitySourceLocation, EntityTable, EntityTableProps, EntityTagFilter, EntityTagPicker, EntityTagPickerProps, EntityTextFilter, EntityTypeFilter, EntityTypePicker, EntityTypePickerProps, EntityUserFilter, FavoriteEntity, FavoriteEntityProps, InspectEntityDialog, MissingAnnotationEmptyState, MissingAnnotationEmptyStateClassKey, MockEntityListContextProvider, MockStarredEntitiesApi, StarredEntitiesApi, UnregisterEntityDialog, UnregisterEntityDialogProps, UserListFilter, UserListFilterKind, UserListPicker, UserListPickerProps, catalogApiRef, columnFactories, defaultEntityPresentation, entityPresentationApiRef, entityRouteParams, entityRouteRef, getEntityRelations, getEntitySourceLocation, humanizeEntityRef, starredEntitiesApiRef, useAsyncEntity, useEntity, useEntityList, useEntityOwnership, useEntityPresentation, useEntityTypeFilter, useRelatedEntities, useStarredEntities, useStarredEntity };
package/dist/index.esm.js CHANGED
@@ -15,8 +15,8 @@ import React, { useState, useEffect, useMemo, createContext, useCallback, useCon
15
15
  import ObservableImpl from 'zen-observable';
16
16
  import { Grid, useMediaQuery, useTheme, Button, Drawer, Box, Typography, FormControlLabel, Checkbox, makeStyles, TextField, Tooltip, IconButton, Card, CardContent, Chip, CardActions, Toolbar, FormControl, Input, InputAdornment, withStyles, DialogContentText, ListItemText as ListItemText$1, ListSubheader as ListSubheader$1, ListItem, ListItemIcon, List, Dialog, DialogTitle, DialogContent, Tabs, Tab, DialogActions, Divider, MenuItem, ListItemSecondaryAction } from '@material-ui/core';
17
17
  import FilterListIcon from '@material-ui/icons/FilterList';
18
- import { Select, Link, ResponseErrorPanel, Progress, OverflowTooltip, Table, DependencyGraph, DependencyGraphTypes, CodeSnippet } from '@backstage/core-components';
19
- import { g as getEntityRelations } from './esm/useEntity-de64059a.esm.js';
18
+ import { Select, Link, ResponseErrorPanel, Progress, OverflowTooltip, Table, DependencyGraph, DependencyGraphTypes, CodeSnippet, EmptyState } from '@backstage/core-components';
19
+ import { g as getEntityRelations, u as useEntity } from './esm/useEntity-de64059a.esm.js';
20
20
  export { A as AsyncEntityProvider, E as EntityProvider, g as getEntityRelations, a as useAsyncEntity, u as useEntity } from './esm/useEntity-de64059a.esm.js';
21
21
  import { compact, isEqual, debounce, intersection } from 'lodash';
22
22
  import qs from 'qs';
@@ -52,6 +52,10 @@ import YAML from 'yaml';
52
52
  import Alert$1 from '@material-ui/lab/Alert';
53
53
  import { assertError } from '@backstage/errors';
54
54
  import SettingsIcon from '@material-ui/icons/Settings';
55
+ import Box$1 from '@material-ui/core/Box';
56
+ import Button$1 from '@material-ui/core/Button';
57
+ import { makeStyles as makeStyles$1 } from '@material-ui/core/styles';
58
+ import Typography$1 from '@material-ui/core/Typography';
55
59
 
56
60
  const catalogApiRef = createApiRef({
57
61
  id: "plugin.catalog.service"
@@ -958,7 +962,7 @@ const EntityAutocompletePickerOption = memo((props) => {
958
962
  );
959
963
  });
960
964
 
961
- const useStyles$g = makeStyles(
965
+ const useStyles$h = makeStyles(
962
966
  {
963
967
  input: {}
964
968
  },
@@ -967,7 +971,7 @@ const useStyles$g = makeStyles(
967
971
  }
968
972
  );
969
973
  function EntityAutocompletePickerInput(params) {
970
- const classes = useStyles$g();
974
+ const classes = useStyles$h();
971
975
  return /* @__PURE__ */ React.createElement(
972
976
  TextField,
973
977
  {
@@ -1055,7 +1059,7 @@ function EntityAutocompletePicker(props) {
1055
1059
  )));
1056
1060
  }
1057
1061
 
1058
- const useStyles$f = makeStyles(
1062
+ const useStyles$g = makeStyles(
1059
1063
  {
1060
1064
  input: {}
1061
1065
  },
@@ -1065,7 +1069,7 @@ const useStyles$f = makeStyles(
1065
1069
  );
1066
1070
  const EntityLifecyclePicker = (props) => {
1067
1071
  const { initialFilter = [] } = props;
1068
- const classes = useStyles$f();
1072
+ const classes = useStyles$g();
1069
1073
  return /* @__PURE__ */ React.createElement(
1070
1074
  EntityAutocompletePicker,
1071
1075
  {
@@ -1287,7 +1291,7 @@ function useSelectedOwners({
1287
1291
  };
1288
1292
  }
1289
1293
 
1290
- const useStyles$e = makeStyles(
1294
+ const useStyles$f = makeStyles(
1291
1295
  {
1292
1296
  input: {}
1293
1297
  },
@@ -1299,7 +1303,7 @@ const icon$1 = /* @__PURE__ */ React.createElement(CheckBoxOutlineBlankIcon, { f
1299
1303
  const checkedIcon$1 = /* @__PURE__ */ React.createElement(CheckBoxIcon, { fontSize: "small" });
1300
1304
  const EntityOwnerPicker = (props) => {
1301
1305
  var _a, _b, _c;
1302
- const classes = useStyles$e();
1306
+ const classes = useStyles$f();
1303
1307
  const { mode = "owners-only" } = props || {};
1304
1308
  const {
1305
1309
  updateFilters,
@@ -1420,7 +1424,7 @@ const EntityOwnerPicker = (props) => {
1420
1424
  )));
1421
1425
  };
1422
1426
 
1423
- const useStyles$d = makeStyles(
1427
+ const useStyles$e = makeStyles(
1424
1428
  (theme) => ({
1425
1429
  root: {
1426
1430
  display: "inline-flex",
@@ -1436,7 +1440,7 @@ const useStyles$d = makeStyles(
1436
1440
  );
1437
1441
  const EntityDisplayName = (props) => {
1438
1442
  const { entityRef, noIcon, noTooltip, defaultKind, defaultNamespace } = props;
1439
- const classes = useStyles$d();
1443
+ const classes = useStyles$e();
1440
1444
  const { primaryTitle, secondaryTitle, Icon } = useEntityPresentation(
1441
1445
  entityRef,
1442
1446
  { defaultKind, defaultNamespace }
@@ -1565,7 +1569,7 @@ const UserCardActions = (props) => {
1565
1569
  return email ? /* @__PURE__ */ React.createElement(EmailCardAction, { email }) : null;
1566
1570
  };
1567
1571
 
1568
- const useStyles$c = makeStyles(() => {
1572
+ const useStyles$d = makeStyles(() => {
1569
1573
  return {
1570
1574
  popoverPaper: {
1571
1575
  width: "30em"
@@ -1583,7 +1587,7 @@ const maxTagChips = 4;
1583
1587
  const EntityPeekAheadPopover = (props) => {
1584
1588
  var _a, _b, _c, _d;
1585
1589
  const { entityRef, children, delayTime = 500 } = props;
1586
- const classes = useStyles$c();
1590
+ const classes = useStyles$d();
1587
1591
  const apiHolder = useApiHolder();
1588
1592
  const popupState = usePopupState({
1589
1593
  variant: "popover",
@@ -1652,7 +1656,7 @@ const EntityPeekAheadPopover = (props) => {
1652
1656
  ));
1653
1657
  };
1654
1658
 
1655
- const useStyles$b = makeStyles(
1659
+ const useStyles$c = makeStyles(
1656
1660
  (_theme) => ({
1657
1661
  searchToolbar: {
1658
1662
  paddingLeft: 0,
@@ -1666,7 +1670,7 @@ const useStyles$b = makeStyles(
1666
1670
  );
1667
1671
  const EntitySearchBar = () => {
1668
1672
  var _a, _b;
1669
- const classes = useStyles$b();
1673
+ const classes = useStyles$c();
1670
1674
  const { filters, updateFilters } = useEntityList();
1671
1675
  const [search, setSearch] = useState((_b = (_a = filters.text) == null ? void 0 : _a.value) != null ? _b : "");
1672
1676
  useDebounce(
@@ -1831,7 +1835,7 @@ const componentEntityColumns = [
1831
1835
  columnFactories.createMetadataDescriptionColumn()
1832
1836
  ];
1833
1837
 
1834
- const useStyles$a = makeStyles((theme) => ({
1838
+ const useStyles$b = makeStyles((theme) => ({
1835
1839
  empty: {
1836
1840
  padding: theme.spacing(2),
1837
1841
  display: "flex",
@@ -1847,7 +1851,7 @@ const EntityTable = (props) => {
1847
1851
  columns,
1848
1852
  tableOptions = {}
1849
1853
  } = props;
1850
- const classes = useStyles$a();
1854
+ const classes = useStyles$b();
1851
1855
  const tableStyle = {
1852
1856
  minWidth: "0",
1853
1857
  width: "100%"
@@ -1879,12 +1883,12 @@ EntityTable.columns = columnFactories;
1879
1883
  EntityTable.systemEntityColumns = systemEntityColumns;
1880
1884
  EntityTable.componentEntityColumns = componentEntityColumns;
1881
1885
 
1882
- const useStyles$9 = makeStyles(
1886
+ const useStyles$a = makeStyles(
1883
1887
  { input: {} },
1884
1888
  { name: "CatalogReactEntityTagPicker" }
1885
1889
  );
1886
1890
  const EntityTagPicker = (props) => {
1887
- const classes = useStyles$9();
1891
+ const classes = useStyles$a();
1888
1892
  return /* @__PURE__ */ React.createElement(
1889
1893
  EntityAutocompletePicker,
1890
1894
  {
@@ -1990,7 +1994,7 @@ function EntityKindIcon(props) {
1990
1994
  return /* @__PURE__ */ React.createElement(Icon, { ...otherProps });
1991
1995
  }
1992
1996
 
1993
- const useStyles$8 = makeStyles((theme) => ({
1997
+ const useStyles$9 = makeStyles((theme) => ({
1994
1998
  node: {
1995
1999
  fill: theme.palette.grey[300],
1996
2000
  stroke: theme.palette.grey[300],
@@ -2044,7 +2048,7 @@ function useAncestry(root) {
2044
2048
  };
2045
2049
  }
2046
2050
  function CustomNode({ node }) {
2047
- const classes = useStyles$8();
2051
+ const classes = useStyles$9();
2048
2052
  const navigate = useNavigate();
2049
2053
  const entityRoute = useRouteRef(entityRouteRef);
2050
2054
  const [width, setWidth] = useState(0);
@@ -2139,7 +2143,7 @@ function AncestryPage(props) {
2139
2143
  )));
2140
2144
  }
2141
2145
 
2142
- const useStyles$7 = makeStyles((theme) => ({
2146
+ const useStyles$8 = makeStyles((theme) => ({
2143
2147
  root: {
2144
2148
  display: "flex",
2145
2149
  flexDirection: "column"
@@ -2156,7 +2160,7 @@ const useStyles$7 = makeStyles((theme) => ({
2156
2160
  }
2157
2161
  }));
2158
2162
  function ListItemText(props) {
2159
- const classes = useStyles$7();
2163
+ const classes = useStyles$8();
2160
2164
  return /* @__PURE__ */ React.createElement(
2161
2165
  ListItemText$1,
2162
2166
  {
@@ -2167,7 +2171,7 @@ function ListItemText(props) {
2167
2171
  );
2168
2172
  }
2169
2173
  function ListSubheader(props) {
2170
- const classes = useStyles$7();
2174
+ const classes = useStyles$8();
2171
2175
  return /* @__PURE__ */ React.createElement(ListSubheader$1, { className: classes.monospace }, props.children);
2172
2176
  }
2173
2177
  function Container(props) {
@@ -2194,11 +2198,11 @@ function KeyValueListItem(props) {
2194
2198
  ));
2195
2199
  }
2196
2200
  function HelpIcon(props) {
2197
- const classes = useStyles$7();
2201
+ const classes = useStyles$8();
2198
2202
  return /* @__PURE__ */ React.createElement(Link, { to: props.to, className: classes.helpIcon }, /* @__PURE__ */ React.createElement(HelpOutlineIcon, { fontSize: "inherit" }));
2199
2203
  }
2200
2204
 
2201
- const useStyles$6 = makeStyles({
2205
+ const useStyles$7 = makeStyles({
2202
2206
  root: {
2203
2207
  display: "flex",
2204
2208
  flexDirection: "column"
@@ -2278,7 +2282,7 @@ function Contents$1(props) {
2278
2282
  ));
2279
2283
  }
2280
2284
  function ColocatedPage(props) {
2281
- const classes = useStyles$6();
2285
+ const classes = useStyles$7();
2282
2286
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DialogContentText, { variant: "h2" }, "Colocated"), /* @__PURE__ */ React.createElement(DialogContentText, null, "These are the entities that are colocated with this entity - as in, they originated from the same data source (e.g. came from the same YAML file), or from the same origin (e.g. the originally registered URL)."), /* @__PURE__ */ React.createElement("div", { className: classes.root }, /* @__PURE__ */ React.createElement(Contents$1, { entity: props.entity })));
2283
2287
  }
2284
2288
 
@@ -2299,7 +2303,7 @@ function JsonPage(props) {
2299
2303
  ))));
2300
2304
  }
2301
2305
 
2302
- const useStyles$5 = makeStyles({
2306
+ const useStyles$6 = makeStyles({
2303
2307
  root: {
2304
2308
  display: "flex",
2305
2309
  flexDirection: "column"
@@ -2307,7 +2311,7 @@ const useStyles$5 = makeStyles({
2307
2311
  });
2308
2312
  function OverviewPage(props) {
2309
2313
  var _a, _b, _c;
2310
- const classes = useStyles$5();
2314
+ const classes = useStyles$6();
2311
2315
  const {
2312
2316
  apiVersion,
2313
2317
  kind,
@@ -2368,7 +2372,7 @@ function YamlPage(props) {
2368
2372
  ))));
2369
2373
  }
2370
2374
 
2371
- const useStyles$4 = makeStyles((theme) => ({
2375
+ const useStyles$5 = makeStyles((theme) => ({
2372
2376
  fullHeightDialog: {
2373
2377
  height: "calc(100% - 64px)"
2374
2378
  },
@@ -2389,7 +2393,7 @@ const useStyles$4 = makeStyles((theme) => ({
2389
2393
  }));
2390
2394
  function TabPanel(props) {
2391
2395
  const { children, value, index, ...other } = props;
2392
- const classes = useStyles$4();
2396
+ const classes = useStyles$5();
2393
2397
  return /* @__PURE__ */ React.createElement(
2394
2398
  "div",
2395
2399
  {
@@ -2410,7 +2414,7 @@ function a11yProps(index) {
2410
2414
  };
2411
2415
  }
2412
2416
  function InspectEntityDialog(props) {
2413
- const classes = useStyles$4();
2417
+ const classes = useStyles$5();
2414
2418
  const [activeTab, setActiveTab] = React.useState(0);
2415
2419
  useEffect(() => {
2416
2420
  setActiveTab(0);
@@ -2514,7 +2518,7 @@ function useUnregisterEntityDialogState(entity) {
2514
2518
  };
2515
2519
  }
2516
2520
 
2517
- const useStyles$3 = makeStyles({
2521
+ const useStyles$4 = makeStyles({
2518
2522
  advancedButton: {
2519
2523
  fontSize: "0.7em"
2520
2524
  },
@@ -2530,7 +2534,7 @@ const Contents = ({
2530
2534
  var _a;
2531
2535
  const alertApi = useApi(alertApiRef);
2532
2536
  const configApi = useApi(configApiRef);
2533
- const classes = useStyles$3();
2537
+ const classes = useStyles$4();
2534
2538
  const state = useUnregisterEntityDialogState(entity);
2535
2539
  const [showDelete, setShowDelete] = useState(false);
2536
2540
  const [busy, setBusy] = useState(false);
@@ -2819,7 +2823,7 @@ function useStarredEntitiesCount() {
2819
2823
  return { count, loading, filter };
2820
2824
  }
2821
2825
 
2822
- const useStyles$2 = makeStyles(
2826
+ const useStyles$3 = makeStyles(
2823
2827
  (theme) => ({
2824
2828
  root: {
2825
2829
  backgroundColor: "rgba(0, 0, 0, .11)",
@@ -2878,7 +2882,7 @@ function getFilterGroups(orgName) {
2878
2882
  const UserListPicker = (props) => {
2879
2883
  var _a;
2880
2884
  const { initialFilter, availableFilters } = props;
2881
- const classes = useStyles$2();
2885
+ const classes = useStyles$3();
2882
2886
  const configApi = useApi(configApiRef);
2883
2887
  const orgName = (_a = configApi.getOptionalString("organization.name")) != null ? _a : "Company";
2884
2888
  const {
@@ -2988,7 +2992,7 @@ const UserListPicker = (props) => {
2988
2992
  }))))));
2989
2993
  };
2990
2994
 
2991
- const useStyles$1 = makeStyles(
2995
+ const useStyles$2 = makeStyles(
2992
2996
  {
2993
2997
  input: {}
2994
2998
  },
@@ -2999,7 +3003,7 @@ const useStyles$1 = makeStyles(
2999
3003
  const icon = /* @__PURE__ */ React.createElement(CheckBoxOutlineBlankIcon, { fontSize: "small" });
3000
3004
  const checkedIcon = /* @__PURE__ */ React.createElement(CheckBoxIcon, { fontSize: "small" });
3001
3005
  const EntityProcessingStatusPicker = () => {
3002
- const classes = useStyles$1();
3006
+ const classes = useStyles$2();
3003
3007
  const { updateFilters } = useEntityList();
3004
3008
  const [selectedAdvancedItems, setSelectedAdvancedItems] = useState(
3005
3009
  []
@@ -3056,7 +3060,7 @@ const EntityProcessingStatusPicker = () => {
3056
3060
  )));
3057
3061
  };
3058
3062
 
3059
- const useStyles = makeStyles(
3063
+ const useStyles$1 = makeStyles(
3060
3064
  {
3061
3065
  input: {}
3062
3066
  },
@@ -3065,7 +3069,7 @@ const useStyles = makeStyles(
3065
3069
  }
3066
3070
  );
3067
3071
  const EntityNamespacePicker = () => {
3068
- const classes = useStyles();
3072
+ const classes = useStyles$1();
3069
3073
  return /* @__PURE__ */ React.createElement(
3070
3074
  EntityAutocompletePicker,
3071
3075
  {
@@ -3078,6 +3082,79 @@ const EntityNamespacePicker = () => {
3078
3082
  );
3079
3083
  };
3080
3084
 
3085
+ const useStyles = makeStyles$1(
3086
+ (theme) => ({
3087
+ code: {
3088
+ borderRadius: 6,
3089
+ margin: theme.spacing(2, 0),
3090
+ background: theme.palette.type === "dark" ? "#444" : theme.palette.common.white
3091
+ }
3092
+ }),
3093
+ { name: "BackstageMissingAnnotationEmptyState" }
3094
+ );
3095
+ function generateYamlExample(annotations, entity) {
3096
+ var _a, _b;
3097
+ const kind = (entity == null ? void 0 : entity.kind) || "Component";
3098
+ const name = (entity == null ? void 0 : entity.metadata.name) || "example";
3099
+ const type = ((_a = entity == null ? void 0 : entity.spec) == null ? void 0 : _a.type) || "website";
3100
+ const owner = ((_b = entity == null ? void 0 : entity.spec) == null ? void 0 : _b.owner) || "user:default/guest";
3101
+ const yamlText = `apiVersion: backstage.io/v1alpha1
3102
+ kind: ${kind}
3103
+ metadata:
3104
+ name: ${name}
3105
+ annotations:${annotations.map((ann) => `
3106
+ ${ann}: value`).join("")}
3107
+ spec:
3108
+ type: ${type}
3109
+ owner: ${owner}`;
3110
+ let line = 6;
3111
+ const lineNumbers = [];
3112
+ annotations.forEach(() => {
3113
+ lineNumbers.push(line);
3114
+ line++;
3115
+ });
3116
+ return {
3117
+ yamlText,
3118
+ lineNumbers
3119
+ };
3120
+ }
3121
+ function generateDescription(annotations, entityKind = "Component") {
3122
+ const isSingular = annotations.length <= 1;
3123
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, "The ", isSingular ? "annotation" : "annotations", " ", annotations.map((ann) => /* @__PURE__ */ React.createElement("code", null, ann)).reduce((prev, curr) => /* @__PURE__ */ React.createElement(React.Fragment, null, prev, ", ", curr)), " ", isSingular ? "is" : "are", " missing. You need to add the", " ", isSingular ? "annotation" : "annotations", " to your ", entityKind, " if you want to enable this tool.");
3124
+ }
3125
+ function MissingAnnotationEmptyState(props) {
3126
+ let entity;
3127
+ try {
3128
+ const entityContext = useEntity();
3129
+ entity = entityContext.entity;
3130
+ } catch (err) {
3131
+ }
3132
+ const { annotation, readMoreUrl } = props;
3133
+ const annotations = Array.isArray(annotation) ? annotation : [annotation];
3134
+ const url = readMoreUrl || "https://backstage.io/docs/features/software-catalog/well-known-annotations";
3135
+ const classes = useStyles();
3136
+ const entityKind = (entity == null ? void 0 : entity.kind) || "Component";
3137
+ const { yamlText, lineNumbers } = generateYamlExample(annotations, entity);
3138
+ return /* @__PURE__ */ React.createElement(
3139
+ EmptyState,
3140
+ {
3141
+ missing: "field",
3142
+ title: "Missing Annotation",
3143
+ description: generateDescription(annotations, entityKind),
3144
+ action: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography$1, { variant: "body1" }, "Add the annotation to your ", entityKind, " YAML as shown in the highlighted example below:"), /* @__PURE__ */ React.createElement(Box$1, { className: classes.code }, /* @__PURE__ */ React.createElement(
3145
+ CodeSnippet,
3146
+ {
3147
+ text: yamlText,
3148
+ language: "yaml",
3149
+ showLineNumbers: true,
3150
+ highlightedNumbers: lineNumbers,
3151
+ customStyle: { background: "inherit", fontSize: "115%" }
3152
+ }
3153
+ )), /* @__PURE__ */ React.createElement(Button$1, { color: "primary", component: Link, to: url }, "Read more"))
3154
+ }
3155
+ );
3156
+ }
3157
+
3081
3158
  function MockEntityListContextProvider(props) {
3082
3159
  var _a;
3083
3160
  const { children, value } = props;
@@ -3117,5 +3194,5 @@ function MockEntityListContextProvider(props) {
3117
3194
  return /* @__PURE__ */ React.createElement(EntityListContext.Provider, { value: resolvedValue }, children);
3118
3195
  }
3119
3196
 
3120
- export { CatalogFilterLayout, EntityAutocompletePicker, EntityDisplayName, EntityErrorFilter, EntityKindFilter, EntityKindPicker, EntityLifecycleFilter, EntityLifecyclePicker, EntityListContext, EntityListProvider, EntityNamespaceFilter, EntityNamespacePicker, EntityOrphanFilter, EntityOwnerFilter, EntityOwnerPicker, EntityPeekAheadPopover, EntityProcessingStatusPicker, EntityRefLink, EntityRefLinks, EntitySearchBar, EntityTable, EntityTagFilter, EntityTagPicker, EntityTextFilter, EntityTypeFilter, EntityTypePicker, EntityUserFilter, FavoriteEntity, InspectEntityDialog, MockEntityListContextProvider, MockStarredEntitiesApi, UnregisterEntityDialog, UserListFilter, UserListPicker, catalogApiRef, columnFactories, defaultEntityPresentation, entityPresentationApiRef, entityRouteParams, entityRouteRef, getEntitySourceLocation, humanizeEntityRef, starredEntitiesApiRef, useEntityList, useEntityOwnership, useEntityPresentation, useEntityTypeFilter, useRelatedEntities, useStarredEntities, useStarredEntity };
3197
+ export { CatalogFilterLayout, EntityAutocompletePicker, EntityDisplayName, EntityErrorFilter, EntityKindFilter, EntityKindPicker, EntityLifecycleFilter, EntityLifecyclePicker, EntityListContext, EntityListProvider, EntityNamespaceFilter, EntityNamespacePicker, EntityOrphanFilter, EntityOwnerFilter, EntityOwnerPicker, EntityPeekAheadPopover, EntityProcessingStatusPicker, EntityRefLink, EntityRefLinks, EntitySearchBar, EntityTable, EntityTagFilter, EntityTagPicker, EntityTextFilter, EntityTypeFilter, EntityTypePicker, EntityUserFilter, FavoriteEntity, InspectEntityDialog, MissingAnnotationEmptyState, MockEntityListContextProvider, MockStarredEntitiesApi, UnregisterEntityDialog, UserListFilter, UserListPicker, catalogApiRef, columnFactories, defaultEntityPresentation, entityPresentationApiRef, entityRouteParams, entityRouteRef, getEntitySourceLocation, humanizeEntityRef, starredEntitiesApiRef, useEntityList, useEntityOwnership, useEntityPresentation, useEntityTypeFilter, useRelatedEntities, useStarredEntities, useStarredEntity };
3121
3198
  //# sourceMappingURL=index.esm.js.map