@backstage/plugin-catalog 1.4.0-next.3 → 1.4.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 CHANGED
@@ -1,5 +1,93 @@
1
1
  # @backstage/plugin-catalog
2
2
 
3
+ ## 1.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 97c46f2359: Add `spec.targets` (or `spec.target`) for Location entities at the `CatalogTable`.
8
+ - cf288221d1: Add `Location` target(s) to `AboutCard`.
9
+ - a274fe38b9: Add hidden title column to catalog and API table to enable filtering by title.
10
+
11
+ ### Patch Changes
12
+
13
+ - dcaf1cb418: Previously, the color of the Entity Context Menu (in the Entity Page Header) was hardcoded as `white`.
14
+
15
+ This was an issue for themes that use a header with a white background. By default, the color of the icon is now `theme.page.fontColor`.
16
+
17
+ It can now also be overridden in the theme, which is only necessary if the header title, subtitle and three-dots icon need to have different colors. For example:
18
+
19
+ ```typescript
20
+ export function createThemeOverrides(theme: BackstageTheme): Overrides {
21
+ return {
22
+ PluginCatalogEntityContextMenu: {
23
+ button: {
24
+ color: 'blue',
25
+ },
26
+ },
27
+ ...
28
+ },
29
+ ...
30
+ }
31
+ ```
32
+
33
+ - f1dcc6f3c6: Use entity type predicates from catalog-model
34
+ - 258057a4b9: Adding ability to customize the "unregister entity" menu item in the entity context menu on the entity page with options 'visible','hidden','disabled'.With this three new options, one can hide the "unregister entity" menu item from the list, disable or keep it enabled.
35
+
36
+ The boolean input for "unregister entity" will be deprecated later in favour of the above three options.
37
+
38
+ - 385389d23c: Updated to remove usage of the `bursts` object in the theme palette
39
+ - be26d95141: Added new `EntityProcessingStatusPicker` that will filter for entities with orphans and/or errors.
40
+
41
+ If you are using the default Catalog page this picker will be added automatically. For those who have customized their Catalog page you'll need to add this manually by doing something like this:
42
+
43
+ ```diff
44
+ ...
45
+ import {
46
+ CatalogFilterLayout,
47
+ EntityTypePicker,
48
+ UserListPicker,
49
+ EntityTagPicker
50
+ + EntityProcessingStatusPicker,
51
+ } from '@backstage/plugin-catalog-react';
52
+ ...
53
+ export const CustomCatalogPage = ({
54
+ columns,
55
+ actions,
56
+ initiallySelectedFilter = 'owned',
57
+ }: CatalogPageProps) => {
58
+ return (
59
+ ...
60
+ <EntityListProvider>
61
+ <CatalogFilterLayout>
62
+ <CatalogFilterLayout.Filters>
63
+ <EntityKindPicker initialFilter="component" hidden />
64
+ <EntityTypePicker />
65
+ <UserListPicker initialFilter={initiallySelectedFilter} />
66
+ <EntityTagPicker />
67
+ + <EntityProcessingStatusPicker />
68
+ <CatalogFilterLayout.Filters>
69
+ <CatalogFilterLayout.Content>
70
+ <CatalogTable columns={columns} actions={actions} />
71
+ </CatalogFilterLayout.Content>
72
+ </CatalogFilterLayout>
73
+ </EntityListProvider>
74
+ ...
75
+ };
76
+ ```
77
+
78
+ - Updated dependencies
79
+ - @backstage/core-components@0.10.0
80
+ - @backstage/catalog-model@1.1.0
81
+ - @backstage/plugin-search-react@1.0.0
82
+ - @backstage/plugin-search-common@1.0.0
83
+ - @backstage/core-plugin-api@1.0.4
84
+ - @backstage/catalog-client@1.0.4
85
+ - @backstage/integration-react@1.1.2
86
+ - @backstage/plugin-catalog-react@1.1.2
87
+ - @backstage/theme@0.2.16
88
+ - @backstage/errors@1.1.0
89
+ - @backstage/plugin-catalog-common@1.0.4
90
+
3
91
  ## 1.4.0-next.3
4
92
 
5
93
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- export { A as AboutCard, b as AboutContent, d as AboutField } from './index-ccd8b12d.esm.js';
1
+ export { A as AboutCard, b as AboutContent, d as AboutField } from './index-b0b0b077.esm.js';
2
2
  import 'zen-observable';
3
3
  import '@backstage/catalog-model';
4
4
  import 'lodash';
@@ -11,6 +11,7 @@ import '@material-ui/icons/Cached';
11
11
  import '@material-ui/icons/Description';
12
12
  import '@material-ui/icons/Edit';
13
13
  import 'react';
14
+ import '@material-ui/icons/Language';
14
15
  import 'react-use/lib/useAsync';
15
16
  import '@backstage/plugin-search-react';
16
17
  import '@material-ui/icons/OpenInNew';
@@ -25,4 +26,4 @@ import '@backstage/plugin-catalog-common';
25
26
  import '@material-ui/icons/Cancel';
26
27
  import '@backstage/errors';
27
28
  import '@backstage/catalog-client';
28
- //# sourceMappingURL=index-2f1bf904.esm.js.map
29
+ //# sourceMappingURL=index-10cb0abb.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-10cb0abb.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -3,7 +3,7 @@ import { useOutlet } from 'react-router';
3
3
  import { PageWithHeader, Content, ContentHeader, CreateButton, SupportButton } from '@backstage/core-components';
4
4
  import { useApi, configApiRef, useRouteRef } from '@backstage/core-plugin-api';
5
5
  import { EntityListProvider, CatalogFilterLayout, EntityTypePicker, UserListPicker, EntityOwnerPicker, EntityLifecyclePicker, EntityTagPicker, EntityProcessingStatusPicker } from '@backstage/plugin-catalog-react';
6
- import { c as createComponentRouteRef, C as CatalogKindHeader, a as CatalogTable } from './index-ccd8b12d.esm.js';
6
+ import { c as createComponentRouteRef, C as CatalogKindHeader, a as CatalogTable } from './index-b0b0b077.esm.js';
7
7
  import 'zen-observable';
8
8
  import '@backstage/catalog-model';
9
9
  import 'lodash';
@@ -12,6 +12,7 @@ import '@material-ui/core';
12
12
  import '@material-ui/icons/Cached';
13
13
  import '@material-ui/icons/Description';
14
14
  import '@material-ui/icons/Edit';
15
+ import '@material-ui/icons/Language';
15
16
  import 'react-use/lib/useAsync';
16
17
  import '@backstage/plugin-search-react';
17
18
  import '@material-ui/icons/OpenInNew';
@@ -64,4 +65,4 @@ function CatalogPage(props) {
64
65
  }
65
66
 
66
67
  export { CatalogPage, DefaultCatalogPage };
67
- //# sourceMappingURL=index-83d1e853.esm.js.map
68
+ //# sourceMappingURL=index-1a954f75.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-83d1e853.esm.js","sources":["../../src/components/CatalogPage/DefaultCatalogPage.tsx","../../src/components/CatalogPage/CatalogPage.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Content,\n ContentHeader,\n CreateButton,\n PageWithHeader,\n SupportButton,\n TableColumn,\n TableProps,\n} from '@backstage/core-components';\nimport { configApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport {\n CatalogFilterLayout,\n EntityLifecyclePicker,\n EntityListProvider,\n EntityProcessingStatusPicker,\n EntityOwnerPicker,\n EntityTagPicker,\n EntityTypePicker,\n UserListFilterKind,\n UserListPicker,\n} from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport { createComponentRouteRef } from '../../routes';\nimport { CatalogTable, CatalogTableRow } from '../CatalogTable';\nimport { CatalogKindHeader } from '../CatalogKindHeader';\n\n/**\n * Props for root catalog pages.\n *\n * @public\n */\nexport interface DefaultCatalogPageProps {\n initiallySelectedFilter?: UserListFilterKind;\n columns?: TableColumn<CatalogTableRow>[];\n actions?: TableProps<CatalogTableRow>['actions'];\n initialKind?: string;\n tableOptions?: TableProps<CatalogTableRow>['options'];\n}\n\nexport function DefaultCatalogPage(props: DefaultCatalogPageProps) {\n const {\n columns,\n actions,\n initiallySelectedFilter = 'owned',\n initialKind = 'component',\n tableOptions = {},\n } = props;\n const orgName =\n useApi(configApiRef).getOptionalString('organization.name') ?? 'Backstage';\n const createComponentLink = useRouteRef(createComponentRouteRef);\n\n return (\n <PageWithHeader title={`${orgName} Catalog`} themeId=\"home\">\n <EntityListProvider>\n <Content>\n <ContentHeader\n titleComponent={<CatalogKindHeader initialFilter={initialKind} />}\n >\n <CreateButton\n title=\"Create Component\"\n to={createComponentLink && createComponentLink()}\n />\n <SupportButton>All your software catalog entities</SupportButton>\n </ContentHeader>\n <CatalogFilterLayout>\n <CatalogFilterLayout.Filters>\n <EntityTypePicker />\n <UserListPicker initialFilter={initiallySelectedFilter} />\n <EntityOwnerPicker />\n <EntityLifecyclePicker />\n <EntityTagPicker />\n <EntityProcessingStatusPicker />\n </CatalogFilterLayout.Filters>\n <CatalogFilterLayout.Content>\n <CatalogTable\n columns={columns}\n actions={actions}\n tableOptions={tableOptions}\n />\n </CatalogFilterLayout.Content>\n </CatalogFilterLayout>\n </Content>\n </EntityListProvider>\n </PageWithHeader>\n );\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { useOutlet } from 'react-router';\nimport {\n DefaultCatalogPage,\n DefaultCatalogPageProps,\n} from './DefaultCatalogPage';\n\nexport function CatalogPage(props: DefaultCatalogPageProps) {\n const outlet = useOutlet();\n\n return outlet || <DefaultCatalogPage {...props} />;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBO,SAAS,kBAAkB,CAAC,KAAK,EAAE;AAC1C,EAAE,IAAI,EAAE,CAAC;AACT,EAAE,MAAM;AACR,IAAI,OAAO;AACX,IAAI,OAAO;AACX,IAAI,uBAAuB,GAAG,OAAO;AACrC,IAAI,WAAW,GAAG,WAAW;AAC7B,IAAI,YAAY,GAAG,EAAE;AACrB,GAAG,GAAG,KAAK,CAAC;AACZ,EAAE,MAAM,OAAO,G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AAI,CAAC,kBAAkB,KAAK,CAAC,aAAa,CAAC,eAAe,EAAE,IAAI,CAAC,kBAAkB,KAAK,CAAC,aAAa,CAAC,4BAA4B,EAAE,IAAI,CAAC,CAAC,kBAAkB,KAAK,CAAC,aAAa,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,kBAAkB,KAAK,CAAC,aAAa,CAAC,YAAY,EAAE;AACrY,IAAI,OAAO;AACX,IAAI,OAAO;AACX,IAAI,YAAY;AAChB,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACV;;AC7CO,SAAS,WAAW,CAAC,KAAK,EAAE;AACnC,EAAE,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;AAC7B,EAAE,OAAO,MAAM,oBAAoB,KAAK,CAAC,aAAa,CAAC,kBAAkB,EAAE;AAC3E,IAAI,GAAG,KAAK;AACZ,GAAG,CAAC,CAAC;AACL;;;;"}
1
+ {"version":3,"file":"index-1a954f75.esm.js","sources":["../../src/components/CatalogPage/DefaultCatalogPage.tsx","../../src/components/CatalogPage/CatalogPage.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Content,\n ContentHeader,\n CreateButton,\n PageWithHeader,\n SupportButton,\n TableColumn,\n TableProps,\n} from '@backstage/core-components';\nimport { configApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport {\n CatalogFilterLayout,\n EntityLifecyclePicker,\n EntityListProvider,\n EntityProcessingStatusPicker,\n EntityOwnerPicker,\n EntityTagPicker,\n EntityTypePicker,\n UserListFilterKind,\n UserListPicker,\n} from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport { createComponentRouteRef } from '../../routes';\nimport { CatalogTable, CatalogTableRow } from '../CatalogTable';\nimport { CatalogKindHeader } from '../CatalogKindHeader';\n\n/**\n * Props for root catalog pages.\n *\n * @public\n */\nexport interface DefaultCatalogPageProps {\n initiallySelectedFilter?: UserListFilterKind;\n columns?: TableColumn<CatalogTableRow>[];\n actions?: TableProps<CatalogTableRow>['actions'];\n initialKind?: string;\n tableOptions?: TableProps<CatalogTableRow>['options'];\n}\n\nexport function DefaultCatalogPage(props: DefaultCatalogPageProps) {\n const {\n columns,\n actions,\n initiallySelectedFilter = 'owned',\n initialKind = 'component',\n tableOptions = {},\n } = props;\n const orgName =\n useApi(configApiRef).getOptionalString('organization.name') ?? 'Backstage';\n const createComponentLink = useRouteRef(createComponentRouteRef);\n\n return (\n <PageWithHeader title={`${orgName} Catalog`} themeId=\"home\">\n <EntityListProvider>\n <Content>\n <ContentHeader\n titleComponent={<CatalogKindHeader initialFilter={initialKind} />}\n >\n <CreateButton\n title=\"Create Component\"\n to={createComponentLink && createComponentLink()}\n />\n <SupportButton>All your software catalog entities</SupportButton>\n </ContentHeader>\n <CatalogFilterLayout>\n <CatalogFilterLayout.Filters>\n <EntityTypePicker />\n <UserListPicker initialFilter={initiallySelectedFilter} />\n <EntityOwnerPicker />\n <EntityLifecyclePicker />\n <EntityTagPicker />\n <EntityProcessingStatusPicker />\n </CatalogFilterLayout.Filters>\n <CatalogFilterLayout.Content>\n <CatalogTable\n columns={columns}\n actions={actions}\n tableOptions={tableOptions}\n />\n </CatalogFilterLayout.Content>\n </CatalogFilterLayout>\n </Content>\n </EntityListProvider>\n </PageWithHeader>\n );\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { useOutlet } from 'react-router';\nimport {\n DefaultCatalogPage,\n DefaultCatalogPageProps,\n} from './DefaultCatalogPage';\n\nexport function CatalogPage(props: DefaultCatalogPageProps) {\n const outlet = useOutlet();\n\n return outlet || <DefaultCatalogPage {...props} />;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBO,SAAS,kBAAkB,CAAC,KAAK,EAAE;AAC1C,EAAE,IAAI,EAAE,CAAC;AACT,EAAE,MAAM;AACR,IAAI,OAAO;AACX,IAAI,OAAO;AACX,IAAI,uBAAuB,GAAG,OAAO;AACrC,IAAI,WAAW,GAAG,WAAW;AAC7B,IAAI,YAAY,GAAG,EAAE;AACrB,GAAG,GAAG,KAAK,CAAC;AACZ,EAAE,MAAM,OAAO,GAAG,CAAC,EAAE,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,KAAK,IAAI,GAAG,EAAE,GAAG,WAAW,CAAC;AAChH,EAAE,MAAM,mBAAmB,GAAG,WAAW,CAAC,uBAAuB,CAAC,CAAC;AACnE,EAAE,uBAAuB,KAAK,CAAC,aAAa,CAAC,cAAc,EAAE;AAC7D,IAAI,KAAK,EAAE,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC;AAC/B,IAAI,OAAO,EAAE,MAAM;AACnB,GAAG,kBAAkB,KAAK,CAAC,aAAa,CAAC,kBAAkB,EAAE,IAAI,kBAAkB,KAAK,CAAC,aAAa,CAAC,OAAO,EAAE,IAAI,kBAAkB,KAAK,CAAC,aAAa,CAAC,aAAa,EAAE;AACzK,IAAI,cAAc,kBAAkB,KAAK,CAAC,aAAa,CAAC,iBAAiB,EAAE;AAC3E,MAAM,aAAa,EAAE,WAAW;AAChC,KAAK,C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 'zen-observable';
2
- import { stringifyEntityRef, RELATION_PART_OF, RELATION_OWNED_BY, ANNOTATION_EDIT_URL, DEFAULT_NAMESPACE, ANNOTATION_LOCATION, ANNOTATION_VIEW_URL } from '@backstage/catalog-model';
2
+ import { stringifyEntityRef, RELATION_PART_OF, RELATION_OWNED_BY, getEntitySourceLocation, ANNOTATION_EDIT_URL, DEFAULT_NAMESPACE, ANNOTATION_LOCATION, ANNOTATION_VIEW_URL } from '@backstage/catalog-model';
3
3
  import { isArray, isString, capitalize as capitalize$1 } from 'lodash';
4
4
  import { Link, HeaderIconLinkRow, OverflowTooltip, WarningPanel, CodeSnippet, Table, Page, Header, Progress, RoutedTabs, Content, HeaderLabel, ResponseErrorPanel } from '@backstage/core-components';
5
5
  import { createExternalRouteRef, createRouteRef, useElementFilter, useApi, alertApiRef, useRouteRef, useAnalytics, attachComponentData, useRouteRefParams, useApiHolder, createPlugin, createApiFactory, discoveryApiRef, fetchApiRef, storageApiRef, createRoutableExtension, createComponentExtension } from '@backstage/core-plugin-api';
6
6
  import { scmIntegrationsApiRef, ScmIntegrationIcon } from '@backstage/integration-react';
7
- import { getEntityRelations, EntityRefLinks, useEntity, catalogApiRef, getEntitySourceLocation, useEntityList, EntityKindFilter, humanizeEntityRef, EntityRefLink, useStarredEntities, useEntityPermission, entityRouteRef, useAsyncEntity, UnregisterEntityDialog, InspectEntityDialog, FavoriteEntity, CatalogFilterLayout, starredEntitiesApiRef } from '@backstage/plugin-catalog-react';
8
- import { makeStyles, Typography, Grid, Chip, Card, CardHeader, IconButton, Divider, CardContent, createStyles, capitalize, Select, InputBase, MenuItem, ListItem, ListItemIcon, ListItemText, Box, Popover, MenuList, Dialog, DialogTitle, DialogActions, Button } from '@material-ui/core';
7
+ import { getEntityRelations, EntityRefLinks, useEntity, catalogApiRef, getEntitySourceLocation as getEntitySourceLocation$1, useEntityList, EntityKindFilter, EntityRefLink, humanizeEntityRef, useStarredEntities, useEntityPermission, entityRouteRef, useAsyncEntity, UnregisterEntityDialog, InspectEntityDialog, FavoriteEntity, CatalogFilterLayout, starredEntitiesApiRef } from '@backstage/plugin-catalog-react';
8
+ import { makeStyles, Typography, Grid, Box, useMediaQuery, ImageList, ImageListItem, Chip, Card, CardHeader, IconButton, Divider, CardContent, createStyles, capitalize, Select, InputBase, MenuItem, ListItem, ListItemIcon, ListItemText, Popover, MenuList, Dialog, DialogTitle, DialogActions, Button } from '@material-ui/core';
9
9
  import CachedIcon from '@material-ui/icons/Cached';
10
10
  import DocsIcon from '@material-ui/icons/Description';
11
11
  import EditIcon from '@material-ui/icons/Edit';
12
12
  import React, { useCallback, useMemo, useState, useEffect } from 'react';
13
+ import LanguageIcon from '@material-ui/icons/Language';
13
14
  import useAsync from 'react-use/lib/useAsync';
14
15
  import { HighlightedSearchResultText } from '@backstage/plugin-search-react';
15
16
  import OpenInNew from '@material-ui/icons/OpenInNew';
@@ -94,7 +95,7 @@ const rootRouteRef = createRouteRef({
94
95
  id: "catalog"
95
96
  });
96
97
 
97
- const useStyles$5 = makeStyles((theme) => ({
98
+ const useStyles$6 = makeStyles((theme) => ({
98
99
  value: {
99
100
  fontWeight: "bold",
100
101
  overflow: "hidden",
@@ -113,7 +114,7 @@ const useStyles$5 = makeStyles((theme) => ({
113
114
  }));
114
115
  function AboutField(props) {
115
116
  const { label, value, gridSizes, children } = props;
116
- const classes = useStyles$5();
117
+ const classes = useStyles$6();
117
118
  const childElements = useElementFilter(children, (c) => c.getElements());
118
119
  const content = childElements.length > 0 ? childElements : /* @__PURE__ */ React.createElement(Typography, {
119
120
  variant: "body2",
@@ -128,13 +129,93 @@ function AboutField(props) {
128
129
  }, label), content);
129
130
  }
130
131
 
132
+ const useStyles$5 = makeStyles({
133
+ svgIcon: {
134
+ display: "inline-block",
135
+ "& svg": {
136
+ display: "inline-block",
137
+ fontSize: "inherit",
138
+ verticalAlign: "baseline"
139
+ }
140
+ }
141
+ });
142
+ function IconLink(props) {
143
+ const { href, text, Icon } = props;
144
+ const classes = useStyles$5();
145
+ return /* @__PURE__ */ React.createElement(Box, {
146
+ display: "flex"
147
+ }, /* @__PURE__ */ React.createElement(Box, {
148
+ mr: 1,
149
+ className: classes.svgIcon
150
+ }, /* @__PURE__ */ React.createElement(Typography, {
151
+ component: "div"
152
+ }, Icon ? /* @__PURE__ */ React.createElement(Icon, null) : /* @__PURE__ */ React.createElement(LanguageIcon, null))), /* @__PURE__ */ React.createElement(Box, {
153
+ flexGrow: "1"
154
+ }, /* @__PURE__ */ React.createElement(Link, {
155
+ to: href,
156
+ target: "_blank",
157
+ rel: "noopener"
158
+ }, text || href)));
159
+ }
160
+
161
+ const colDefaults = {
162
+ xs: 1,
163
+ sm: 1,
164
+ md: 1,
165
+ lg: 2,
166
+ xl: 3
167
+ };
168
+ function useDynamicColumns(cols) {
169
+ var _a, _b;
170
+ const matches = [
171
+ useMediaQuery((theme) => theme.breakpoints.up("xl")) ? "xl" : null,
172
+ useMediaQuery((theme) => theme.breakpoints.up("lg")) ? "lg" : null,
173
+ useMediaQuery((theme) => theme.breakpoints.up("md")) ? "md" : null,
174
+ useMediaQuery((theme) => theme.breakpoints.up("sm")) ? "sm" : null,
175
+ useMediaQuery((theme) => theme.breakpoints.up("xs")) ? "xs" : null
176
+ ];
177
+ let numOfCols = 1;
178
+ if (typeof cols === "number") {
179
+ numOfCols = cols;
180
+ } else {
181
+ const breakpoint = (_a = matches.find((k) => k !== null)) != null ? _a : "xs";
182
+ numOfCols = (_b = cols == null ? void 0 : cols[breakpoint]) != null ? _b : colDefaults[breakpoint];
183
+ }
184
+ return numOfCols;
185
+ }
186
+
187
+ function LinksGridList(props) {
188
+ const { items, cols = void 0 } = props;
189
+ const numOfCols = useDynamicColumns(cols);
190
+ return /* @__PURE__ */ React.createElement(ImageList, {
191
+ rowHeight: "auto",
192
+ cols: numOfCols
193
+ }, items.map(({ text, href, Icon }, i) => /* @__PURE__ */ React.createElement(ImageListItem, {
194
+ key: i
195
+ }, /* @__PURE__ */ React.createElement(IconLink, {
196
+ href,
197
+ text: text != null ? text : href,
198
+ Icon
199
+ }))));
200
+ }
201
+
131
202
  const useStyles$4 = makeStyles({
132
203
  description: {
133
204
  wordBreak: "break-word"
134
205
  }
135
206
  });
207
+ function getLocationTargetHref(target, type, entitySourceLocation) {
208
+ if (type === "url" || target.includes("://")) {
209
+ return target;
210
+ }
211
+ const srcLocationUrl = entitySourceLocation.type === "file" ? `file://${entitySourceLocation.target}` : entitySourceLocation.target;
212
+ if (type === "file" || entitySourceLocation.type === "file") {
213
+ return new URL(target, srcLocationUrl).href;
214
+ }
215
+ return srcLocationUrl;
216
+ }
136
217
  function AboutContent(props) {
137
- var _a, _b, _c, _d, _e, _f;
218
+ var _a, _b, _c, _d, _e, _f, _g, _h;
138
219
  const { entity } = props;
139
220
  const classes = useStyles$4();
140
221
  const isSystem = entity.kind.toLocaleLowerCase("en-US") === "system";
@@ -154,6 +235,12 @@ function AboutContent(props) {
154
235
  kind: "domain"
155
236
  });
156
237
  const ownedByRelations = getEntityRelations(entity, RELATION_OWNED_BY);
238
+ let entitySourceLocation;
239
+ try {
240
+ entitySourceLocation = getEntitySourceLocation(entity);
241
+ } catch (e) {
242
+ entitySourceLocation = void 0;
243
+ }
157
244
  return /* @__PURE__ */ React.createElement(Grid, {
158
245
  container: true
159
246
  }, /* @__PURE__ */ React.createElement(AboutField, {
@@ -207,7 +294,19 @@ function AboutContent(props) {
207
294
  key: t,
208
295
  size: "small",
209
296
  label: t
210
- }))));
297
+ }))), isLocation && (((_g = entity == null ? void 0 : entity.spec) == null ? void 0 : _g.targets) || ((_h = entity == null ? void 0 : entity.spec) == null ? void 0 : _h.target)) && /* @__PURE__ */ React.createElement(AboutField, {
298
+ label: "Targets",
299
+ gridSizes: { xs: 12 }
300
+ }, /* @__PURE__ */ React.createElement(LinksGridList, {
301
+ cols: 1,
302
+ items: (entity.spec.targets || [entity.spec.target]).map((target) => target).map((target) => {
303
+ var _a2;
304
+ return {
305
+ text: target,
306
+ href: getLocationTargetHref(target, ((_a2 = entity == null ? void 0 : entity.spec) == null ? void 0 : _a2.type) || "unknown", entitySourceLocation)
307
+ };
308
+ })
309
+ })));
211
310
  }
212
311
 
213
312
  const useStyles$3 = makeStyles({
@@ -238,7 +337,7 @@ function AboutCard(props) {
238
337
  const catalogApi = useApi(catalogApiRef);
239
338
  const alertApi = useApi(alertApiRef);
240
339
  const viewTechdocLink = useRouteRef(viewTechDocRouteRef);
241
- const entitySourceLocation = getEntitySourceLocation(entity, scmIntegrationsApi);
340
+ const entitySourceLocation = getEntitySourceLocation$1(entity, scmIntegrationsApi);
242
341
  const entityMetadataEditUrl = (_a = entity.metadata.annotations) == null ? void 0 : _a[ANNOTATION_EDIT_URL];
243
342
  const viewInSource = {
244
343
  label: "View Source",
@@ -452,11 +551,25 @@ const columnFactories = Object.freeze({
452
551
  })
453
552
  };
454
553
  },
554
+ createSpecTargetsColumn() {
555
+ return {
556
+ title: "Targets",
557
+ field: "entity.spec.targets",
558
+ render: ({ entity }) => {
559
+ var _a, _b;
560
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, (((_a = entity == null ? void 0 : entity.spec) == null ? void 0 : _a.targets) || ((_b = entity == null ? void 0 : entity.spec) == null ? void 0 : _b.target)) && /* @__PURE__ */ React.createElement(OverflowTooltip, {
561
+ text: (entity.spec.targets || [entity.spec.target]).join(", "),
562
+ placement: "bottom-start"
563
+ }));
564
+ }
565
+ };
566
+ },
455
567
  createSpecTypeColumn() {
456
568
  return {
457
569
  title: "Type",
458
570
  field: "entity.spec.type",
459
- hidden: true
571
+ hidden: true,
572
+ width: "auto"
460
573
  };
461
574
  },
462
575
  createSpecLifecycleColumn() {
@@ -489,7 +602,8 @@ const columnFactories = Object.freeze({
489
602
  size: "small",
490
603
  variant: "outlined",
491
604
  style: { marginBottom: "0px" }
492
- })))
605
+ }))),
606
+ width: "auto"
493
607
  };
494
608
  },
495
609
  createTitleColumn(options) {
@@ -530,9 +644,13 @@ const CatalogTable = (props) => {
530
644
  case "system":
531
645
  return [columnFactories.createOwnerColumn()];
532
646
  case "group":
533
- case "location":
534
647
  case "template":
535
648
  return [columnFactories.createSpecTypeColumn()];
649
+ case "location":
650
+ return [
651
+ columnFactories.createSpecTypeColumn(),
652
+ columnFactories.createSpecTargetsColumn()
653
+ ];
536
654
  default:
537
655
  return [
538
656
  columnFactories.createSystemColumn(),
@@ -1108,7 +1226,7 @@ const catalogPlugin = createPlugin({
1108
1226
  });
1109
1227
  const CatalogIndexPage = catalogPlugin.provide(createRoutableExtension({
1110
1228
  name: "CatalogIndexPage",
1111
- component: () => import('./index-83d1e853.esm.js').then((m) => m.CatalogPage),
1229
+ component: () => import('./index-1a954f75.esm.js').then((m) => m.CatalogPage),
1112
1230
  mountPoint: rootRouteRef
1113
1231
  }));
1114
1232
  const CatalogEntityPage = catalogPlugin.provide(createRoutableExtension({
@@ -1119,13 +1237,13 @@ const CatalogEntityPage = catalogPlugin.provide(createRoutableExtension({
1119
1237
  const EntityAboutCard = catalogPlugin.provide(createComponentExtension({
1120
1238
  name: "EntityAboutCard",
1121
1239
  component: {
1122
- lazy: () => import('./index-2f1bf904.esm.js').then((m) => m.AboutCard)
1240
+ lazy: () => import('./index-10cb0abb.esm.js').then((m) => m.AboutCard)
1123
1241
  }
1124
1242
  }));
1125
1243
  const EntityLinksCard = catalogPlugin.provide(createComponentExtension({
1126
1244
  name: "EntityLinksCard",
1127
1245
  component: {
1128
- lazy: () => import('./index-896aeac9.esm.js').then((m) => m.EntityLinksCard)
1246
+ lazy: () => import('./index-c6279600.esm.js').then((m) => m.EntityLinksCard)
1129
1247
  }
1130
1248
  }));
1131
1249
  const EntityHasSystemsCard = catalogPlugin.provide(createComponentExtension({
@@ -1177,5 +1295,5 @@ const RelatedEntitiesCard = catalogPlugin.provide(createComponentExtension({
1177
1295
  }
1178
1296
  }));
1179
1297
 
1180
- export { AboutCard as A, EntityListContainer as B, CatalogKindHeader as C, DefaultStarredEntitiesApi as D, EntityAboutCard as E, FilteredEntityLayout as F, RelatedEntitiesCard as R, CatalogTable as a, AboutContent as b, createComponentRouteRef as c, AboutField as d, CatalogEntityPage as e, CatalogIndexPage as f, catalogPlugin as g, EntityDependencyOfComponentsCard as h, EntityDependsOnComponentsCard as i, EntityDependsOnResourcesCard as j, EntityHasComponentsCard as k, EntityHasResourcesCard as l, EntityHasSubcomponentsCard as m, EntityHasSystemsCard as n, EntityLinksCard as o, CatalogSearchResultListItem as p, EntityLayout as q, EntityOrphanWarning as r, isOrphan as s, EntityProcessingErrorsPanel as t, hasCatalogProcessingErrors as u, EntitySwitch as v, isKind as w, isNamespace as x, isComponentType as y, FilterContainer as z };
1181
- //# sourceMappingURL=index-ccd8b12d.esm.js.map
1298
+ export { AboutCard as A, EntityListContainer as B, CatalogKindHeader as C, DefaultStarredEntitiesApi as D, EntityAboutCard as E, FilteredEntityLayout as F, LinksGridList as L, RelatedEntitiesCard as R, CatalogTable as a, AboutContent as b, createComponentRouteRef as c, AboutField as d, CatalogEntityPage as e, CatalogIndexPage as f, catalogPlugin as g, EntityDependencyOfComponentsCard as h, EntityDependsOnComponentsCard as i, EntityDependsOnResourcesCard as j, EntityHasComponentsCard as k, EntityHasResourcesCard as l, EntityHasSubcomponentsCard as m, EntityHasSystemsCard as n, EntityLinksCard as o, CatalogSearchResultListItem as p, EntityLayout as q, EntityOrphanWarning as r, isOrphan as s, EntityProcessingErrorsPanel as t, hasCatalogProcessingErrors as u, EntitySwitch as v, isKind as w, isNamespace as x, isComponentType as y, FilterContainer as z };
1299
+ //# sourceMappingURL=index-b0b0b077.esm.js.map