@backstage/plugin-org 0.4.0 → 0.4.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,40 @@
1
1
  # @backstage/plugin-org
2
2
 
3
+ ## 0.4.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @backstage/core-components@0.8.8
9
+ - @backstage/plugin-catalog-react@0.6.14
10
+
11
+ ## 0.4.2-next.0
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+ - @backstage/core-components@0.8.8-next.0
17
+ - @backstage/plugin-catalog-react@0.6.14-next.0
18
+
19
+ ## 0.4.1
20
+
21
+ ### Patch Changes
22
+
23
+ - ef86143c16: Added `relations.memberof` filter to the catalog api call in `MemberListCard` to avoid fetching all the User entity kinds from catalog-backend.
24
+ - 64cbca7839: The description from `metadata.description` will now show as the `subheader` on the UserProfileCard in the same way as the GroupProfileCard
25
+ - Updated dependencies
26
+ - @backstage/core-components@0.8.7
27
+ - @backstage/plugin-catalog-react@0.6.13
28
+
29
+ ## 0.4.1-next.0
30
+
31
+ ### Patch Changes
32
+
33
+ - ef86143c16: Added `relations.memberof` filter to the catalog api call in `MemberListCard` to avoid fetching all the User entity kinds from catalog-backend.
34
+ - Updated dependencies
35
+ - @backstage/core-components@0.8.7-next.0
36
+ - @backstage/plugin-catalog-react@0.6.13-next.0
37
+
3
38
  ## 0.4.0
4
39
 
5
40
  ### Minor Changes
@@ -16,4 +16,4 @@ import '@material-ui/lab/Alert';
16
16
  import '@material-ui/icons/Person';
17
17
  import 'qs';
18
18
  import 'pluralize';
19
- //# sourceMappingURL=index-536f8a7e.esm.js.map
19
+ //# sourceMappingURL=index-51e4b009.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-51e4b009.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
package/dist/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createExternalRouteRef, createPlugin, createComponentExtension, useApi, useRouteRef } from '@backstage/core-plugin-api';
2
- import { RELATION_MEMBER_OF, ENTITY_DEFAULT_NAMESPACE, RELATION_PARENT_OF, RELATION_CHILD_OF } from '@backstage/catalog-model';
2
+ import { stringifyEntityRef, ENTITY_DEFAULT_NAMESPACE, RELATION_PARENT_OF, RELATION_CHILD_OF, RELATION_MEMBER_OF } from '@backstage/catalog-model';
3
3
  import { useEntity, catalogApiRef, entityRouteParams, getEntityRelations, getEntityMetadataEditUrl, EntityRefLinks, isOwnerOf, formatEntityRefTitle } from '@backstage/plugin-catalog-react';
4
4
  import { makeStyles, createStyles, Grid, Box, Typography, List, ListItem, ListItemIcon, Tooltip, ListItemText, IconButton } from '@material-ui/core';
5
5
  import Pagination from '@material-ui/lab/Pagination';
@@ -29,25 +29,25 @@ const orgPlugin = createPlugin({
29
29
  const EntityGroupProfileCard = orgPlugin.provide(createComponentExtension({
30
30
  name: "EntityGroupProfileCard",
31
31
  component: {
32
- lazy: () => import('./esm/index-536f8a7e.esm.js').then((m) => m.GroupProfileCard)
32
+ lazy: () => import('./esm/index-51e4b009.esm.js').then((m) => m.GroupProfileCard)
33
33
  }
34
34
  }));
35
35
  const EntityMembersListCard = orgPlugin.provide(createComponentExtension({
36
36
  name: "EntityMembersListCard",
37
37
  component: {
38
- lazy: () => import('./esm/index-536f8a7e.esm.js').then((m) => m.MembersListCard)
38
+ lazy: () => import('./esm/index-51e4b009.esm.js').then((m) => m.MembersListCard)
39
39
  }
40
40
  }));
41
41
  const EntityOwnershipCard = orgPlugin.provide(createComponentExtension({
42
42
  name: "EntityOwnershipCard",
43
43
  component: {
44
- lazy: () => import('./esm/index-536f8a7e.esm.js').then((m) => m.OwnershipCard)
44
+ lazy: () => import('./esm/index-51e4b009.esm.js').then((m) => m.OwnershipCard)
45
45
  }
46
46
  }));
47
47
  const EntityUserProfileCard = orgPlugin.provide(createComponentExtension({
48
48
  name: "EntityUserProfileCard",
49
49
  component: {
50
- lazy: () => import('./esm/index-536f8a7e.esm.js').then((m) => m.UserProfileCard)
50
+ lazy: () => import('./esm/index-51e4b009.esm.js').then((m) => m.UserProfileCard)
51
51
  }
52
52
  }));
53
53
 
@@ -127,13 +127,18 @@ const MembersListCard = (_props) => {
127
127
  value: members
128
128
  } = useAsync(async () => {
129
129
  const membersList = await catalogApi.getEntities({
130
- filter: { kind: "User" }
131
- });
132
- const groupMembersList = membersList.items.filter((member) => {
133
- var _a2;
134
- return (_a2 = member == null ? void 0 : member.relations) == null ? void 0 : _a2.some((r) => r.type === RELATION_MEMBER_OF && r.target.name.toLocaleLowerCase("en-US") === groupName.toLocaleLowerCase("en-US") && r.target.namespace.toLocaleLowerCase("en-US") === groupNamespace.toLocaleLowerCase("en-US"));
130
+ filter: {
131
+ kind: "User",
132
+ "relations.memberof": [
133
+ stringifyEntityRef({
134
+ kind: "group",
135
+ namespace: groupNamespace.toLocaleLowerCase("en-US"),
136
+ name: groupName.toLocaleLowerCase("en-US")
137
+ })
138
+ ]
139
+ }
135
140
  });
136
- return groupMembersList;
141
+ return membersList.items;
137
142
  }, [catalogApi, groupEntity]);
138
143
  if (loading) {
139
144
  return /* @__PURE__ */ React.createElement(Progress, null);
@@ -267,7 +272,7 @@ const UserProfileCard = ({
267
272
  }, "User not found");
268
273
  }
269
274
  const {
270
- metadata: { name: metaName },
275
+ metadata: { name: metaName, description },
271
276
  spec: { profile }
272
277
  } = user;
273
278
  const displayName = (_a = profile == null ? void 0 : profile.displayName) != null ? _a : metaName;
@@ -279,6 +284,7 @@ const UserProfileCard = ({
279
284
  title: /* @__PURE__ */ React.createElement(CardTitle, {
280
285
  title: displayName
281
286
  }),
287
+ subheader: description,
282
288
  variant
283
289
  }, /* @__PURE__ */ React.createElement(Grid, {
284
290
  container: true,
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../src/routes.ts","../src/plugin.ts","../src/components/Cards/Group/MembersList/MembersListCard.tsx","../src/components/Cards/Group/GroupProfile/GroupProfileCard.tsx","../src/components/Cards/User/UserProfileCard/UserProfileCard.tsx","../src/components/Cards/OwnershipCard/OwnershipCard.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 { createExternalRouteRef } from '@backstage/core-plugin-api';\n\nexport const catalogIndexRouteRef = createExternalRouteRef({\n id: 'catalog-index',\n});\n","/*\n * Copyright 2020 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 */\nimport {\n createComponentExtension,\n createPlugin,\n} from '@backstage/core-plugin-api';\nimport { catalogIndexRouteRef } from './routes';\n\nexport const orgPlugin = createPlugin({\n id: 'org',\n externalRoutes: {\n catalogIndex: catalogIndexRouteRef,\n },\n});\n\nexport const EntityGroupProfileCard = orgPlugin.provide(\n createComponentExtension({\n name: 'EntityGroupProfileCard',\n component: {\n lazy: () => import('./components').then(m => m.GroupProfileCard),\n },\n }),\n);\nexport const EntityMembersListCard = orgPlugin.provide(\n createComponentExtension({\n name: 'EntityMembersListCard',\n component: {\n lazy: () => import('./components').then(m => m.MembersListCard),\n },\n }),\n);\nexport const EntityOwnershipCard = orgPlugin.provide(\n createComponentExtension({\n name: 'EntityOwnershipCard',\n component: {\n lazy: () => import('./components').then(m => m.OwnershipCard),\n },\n }),\n);\nexport const EntityUserProfileCard = orgPlugin.provide(\n createComponentExtension({\n name: 'EntityUserProfileCard',\n component: {\n lazy: () => import('./components').then(m => m.UserProfileCard),\n },\n }),\n);\n","/*\n * Copyright 2020 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 */\nimport {\n ENTITY_DEFAULT_NAMESPACE,\n GroupEntity,\n RELATION_MEMBER_OF,\n UserEntity,\n} from '@backstage/catalog-model';\nimport {\n catalogApiRef,\n entityRouteParams,\n useEntity,\n} from '@backstage/plugin-catalog-react';\nimport {\n Box,\n createStyles,\n Grid,\n makeStyles,\n Theme,\n Typography,\n} from '@material-ui/core';\nimport Pagination from '@material-ui/lab/Pagination';\nimport React from 'react';\nimport { generatePath } from 'react-router-dom';\nimport useAsync from 'react-use/lib/useAsync';\n\nimport {\n Avatar,\n InfoCard,\n Progress,\n ResponseErrorPanel,\n Link,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n card: {\n border: `1px solid ${theme.palette.divider}`,\n boxShadow: theme.shadows[2],\n borderRadius: '4px',\n overflow: 'visible',\n position: 'relative',\n margin: theme.spacing(4, 1, 1),\n flex: '1',\n minWidth: '0px',\n },\n }),\n);\n\nconst MemberComponent = ({ member }: { member: UserEntity }) => {\n const classes = useStyles();\n const {\n metadata: { name: metaName },\n spec: { profile },\n } = member;\n const displayName = profile?.displayName ?? metaName;\n\n return (\n <Grid item container xs={12} sm={6} md={4} xl={2}>\n <Box className={classes.card}>\n <Box\n display=\"flex\"\n flexDirection=\"column\"\n m={3}\n alignItems=\"center\"\n justifyContent=\"center\"\n >\n <Avatar\n displayName={displayName}\n picture={profile?.picture}\n customStyles={{\n position: 'absolute',\n top: '-2rem',\n }}\n />\n <Box pt={2} textAlign=\"center\">\n <Typography variant=\"h5\">\n <Link\n to={generatePath(\n `/catalog/:namespace/user/${metaName}`,\n entityRouteParams(member),\n )}\n >\n {displayName}\n </Link>\n </Typography>\n {profile?.email && (\n <Link to={`mailto:${profile.email}`}>{profile.email}</Link>\n )}\n </Box>\n </Box>\n </Box>\n </Grid>\n );\n};\n\nexport const MembersListCard = (_props: {\n /** @deprecated The entity is now grabbed from context instead */\n entity?: GroupEntity;\n memberDisplayTitle?: string;\n pageSize?: number;\n}) => {\n const { entity: groupEntity } = useEntity<GroupEntity>();\n let { memberDisplayTitle, pageSize } = _props;\n const {\n metadata: { name: groupName, namespace: grpNamespace },\n spec: { profile },\n } = groupEntity;\n const catalogApi = useApi(catalogApiRef);\n\n const displayName = profile?.displayName ?? groupName;\n\n const groupNamespace = grpNamespace || ENTITY_DEFAULT_NAMESPACE;\n\n const [page, setPage] = React.useState(1);\n const pageChange = (_: React.ChangeEvent<unknown>, pageIndex: number) => {\n setPage(pageIndex);\n };\n pageSize = pageSize ? pageSize : 50;\n memberDisplayTitle = memberDisplayTitle ? memberDisplayTitle : 'Members';\n\n const {\n loading,\n error,\n value: members,\n } = useAsync(async () => {\n const membersList = await catalogApi.getEntities({\n filter: { kind: 'User' },\n });\n const groupMembersList = (membersList.items as UserEntity[]).filter(\n member =>\n member?.relations?.some(\n r =>\n r.type === RELATION_MEMBER_OF &&\n r.target.name.toLocaleLowerCase('en-US') ===\n groupName.toLocaleLowerCase('en-US') &&\n r.target.namespace.toLocaleLowerCase('en-US') ===\n groupNamespace.toLocaleLowerCase('en-US'),\n ),\n );\n return groupMembersList;\n }, [catalogApi, groupEntity]);\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n const nbPages = Math.ceil((members?.length || 0) / pageSize);\n const paginationLabel = nbPages < 2 ? '' : `, page ${page} of ${nbPages}`;\n\n const pagination = (\n <Pagination\n count={nbPages}\n page={page}\n onChange={pageChange}\n showFirstButton\n showLastButton\n />\n );\n\n return (\n <Grid item>\n <InfoCard\n title={`${memberDisplayTitle} (${\n members?.length || 0\n }${paginationLabel})`}\n subheader={`of ${displayName}`}\n {...(nbPages <= 1 ? {} : { actions: pagination })}\n >\n <Grid container spacing={3}>\n {members && members.length > 0 ? (\n members\n .slice(pageSize * (page - 1), pageSize * page)\n .map(member => (\n <MemberComponent member={member} key={member.metadata.uid} />\n ))\n ) : (\n <Box p={2}>\n <Typography>\n This group has no {memberDisplayTitle.toLocaleLowerCase()}.\n </Typography>\n </Box>\n )}\n </Grid>\n </InfoCard>\n </Grid>\n );\n};\n","/*\n * Copyright 2020 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 GroupEntity,\n RELATION_CHILD_OF,\n RELATION_PARENT_OF,\n} from '@backstage/catalog-model';\nimport {\n EntityRefLinks,\n getEntityRelations,\n useEntity,\n getEntityMetadataEditUrl,\n} from '@backstage/plugin-catalog-react';\nimport {\n Box,\n Grid,\n List,\n ListItem,\n ListItemIcon,\n ListItemText,\n Tooltip,\n IconButton,\n} from '@material-ui/core';\nimport AccountTreeIcon from '@material-ui/icons/AccountTree';\nimport EmailIcon from '@material-ui/icons/Email';\nimport GroupIcon from '@material-ui/icons/Group';\nimport EditIcon from '@material-ui/icons/Edit';\nimport Alert from '@material-ui/lab/Alert';\nimport React from 'react';\nimport {\n Avatar,\n InfoCard,\n InfoCardVariants,\n Link,\n} from '@backstage/core-components';\n\nconst CardTitle = ({ title }: { title: string }) => (\n <Box display=\"flex\" alignItems=\"center\">\n <GroupIcon fontSize=\"inherit\" />\n <Box ml={1}>{title}</Box>\n </Box>\n);\n\nexport const GroupProfileCard = ({\n variant,\n}: {\n /** @deprecated The entity is now grabbed from context instead */\n entity?: GroupEntity;\n variant?: InfoCardVariants;\n}) => {\n const { entity: group } = useEntity<GroupEntity>();\n if (!group) {\n return <Alert severity=\"error\">Group not found</Alert>;\n }\n\n const {\n metadata: { name, description },\n spec: { profile },\n } = group;\n\n const childRelations = getEntityRelations(group, RELATION_PARENT_OF, {\n kind: 'Group',\n });\n const parentRelations = getEntityRelations(group, RELATION_CHILD_OF, {\n kind: 'group',\n });\n\n const entityMetadataEditUrl = getEntityMetadataEditUrl(group);\n\n const displayName = profile?.displayName ?? name;\n const emailHref = profile?.email ? `mailto:${profile.email}` : '#';\n const infoCardAction = entityMetadataEditUrl ? (\n <IconButton\n aria-label=\"Edit\"\n title=\"Edit Metadata\"\n component={Link}\n to={entityMetadataEditUrl}\n >\n <EditIcon />\n </IconButton>\n ) : (\n <IconButton aria-label=\"Edit\" disabled title=\"Edit Metadata\">\n <EditIcon />\n </IconButton>\n );\n\n return (\n <InfoCard\n title={<CardTitle title={displayName} />}\n subheader={description}\n variant={variant}\n action={infoCardAction}\n >\n <Grid container spacing={3}>\n <Grid item xs={12} sm={2} xl={1}>\n <Avatar displayName={displayName} picture={profile?.picture} />\n </Grid>\n <Grid item md={10} xl={11}>\n <List>\n {profile?.email && (\n <ListItem>\n <ListItemIcon>\n <Tooltip title=\"Email\">\n <EmailIcon />\n </Tooltip>\n </ListItemIcon>\n <ListItemText>\n <Link to={emailHref}>{profile.email}</Link>\n </ListItemText>\n </ListItem>\n )}\n\n {parentRelations.length ? (\n <ListItem>\n <ListItemIcon>\n <Tooltip title=\"Parent Group\">\n <AccountTreeIcon />\n </Tooltip>\n </ListItemIcon>\n <ListItemText>\n <EntityRefLinks\n entityRefs={parentRelations}\n defaultKind=\"Group\"\n />\n </ListItemText>\n </ListItem>\n ) : null}\n\n {childRelations.length ? (\n <ListItem>\n <ListItemIcon>\n <Tooltip title=\"Child Groups\">\n <GroupIcon />\n </Tooltip>\n </ListItemIcon>\n <ListItemText>\n <EntityRefLinks\n entityRefs={childRelations}\n defaultKind=\"Group\"\n />\n </ListItemText>\n </ListItem>\n ) : null}\n </List>\n </Grid>\n </Grid>\n </InfoCard>\n );\n};\n","/*\n * Copyright 2020 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 */\nimport { RELATION_MEMBER_OF, UserEntity } from '@backstage/catalog-model';\nimport {\n EntityRefLinks,\n getEntityRelations,\n useEntity,\n} from '@backstage/plugin-catalog-react';\nimport {\n Box,\n Grid,\n List,\n ListItem,\n ListItemIcon,\n ListItemText,\n Tooltip,\n} from '@material-ui/core';\nimport EmailIcon from '@material-ui/icons/Email';\nimport GroupIcon from '@material-ui/icons/Group';\nimport PersonIcon from '@material-ui/icons/Person';\nimport Alert from '@material-ui/lab/Alert';\nimport React from 'react';\nimport {\n Avatar,\n InfoCard,\n InfoCardVariants,\n Link,\n} from '@backstage/core-components';\n\nconst CardTitle = ({ title }: { title?: string }) =>\n title ? (\n <Box display=\"flex\" alignItems=\"center\">\n <PersonIcon fontSize=\"inherit\" />\n <Box ml={1}>{title}</Box>\n </Box>\n ) : null;\n\nexport const UserProfileCard = ({\n variant,\n}: {\n /** @deprecated The entity is now grabbed from context instead */\n entity?: UserEntity;\n variant?: InfoCardVariants;\n}) => {\n const { entity: user } = useEntity<UserEntity>();\n if (!user) {\n return <Alert severity=\"error\">User not found</Alert>;\n }\n\n const {\n metadata: { name: metaName },\n spec: { profile },\n } = user;\n const displayName = profile?.displayName ?? metaName;\n const emailHref = profile?.email ? `mailto:${profile.email}` : undefined;\n const memberOfRelations = getEntityRelations(user, RELATION_MEMBER_OF, {\n kind: 'Group',\n });\n\n return (\n <InfoCard title={<CardTitle title={displayName} />} variant={variant}>\n <Grid container spacing={3} alignItems=\"flex-start\">\n <Grid item xs={12} sm={2} xl={1}>\n <Avatar displayName={displayName} picture={profile?.picture} />\n </Grid>\n\n <Grid item md={10} xl={11}>\n <List>\n {profile?.email && (\n <ListItem>\n <ListItemIcon>\n <Tooltip title=\"Email\">\n <EmailIcon />\n </Tooltip>\n </ListItemIcon>\n <ListItemText>\n <Link to={emailHref ?? ''}>{profile.email}</Link>\n </ListItemText>\n </ListItem>\n )}\n\n <ListItem>\n <ListItemIcon>\n <Tooltip title=\"Member of\">\n <GroupIcon />\n </Tooltip>\n </ListItemIcon>\n <ListItemText>\n <EntityRefLinks\n entityRefs={memberOfRelations}\n defaultKind=\"Group\"\n />\n </ListItemText>\n </ListItem>\n </List>\n </Grid>\n </Grid>\n </InfoCard>\n );\n};\n","/*\n * Copyright 2020 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 { Entity, UserEntity } from '@backstage/catalog-model';\nimport {\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n ResponseErrorPanel,\n} from '@backstage/core-components';\nimport { useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport {\n catalogApiRef,\n formatEntityRefTitle,\n isOwnerOf,\n useEntity,\n} from '@backstage/plugin-catalog-react';\nimport { BackstageTheme } from '@backstage/theme';\nimport {\n Box,\n createStyles,\n Grid,\n makeStyles,\n Typography,\n} from '@material-ui/core';\nimport qs from 'qs';\nimport React from 'react';\nimport pluralize from 'pluralize';\nimport useAsync from 'react-use/lib/useAsync';\nimport { catalogIndexRouteRef } from '../../../routes';\n\ntype EntityTypeProps = {\n kind: string;\n type: string;\n count: number;\n};\n\nconst useStyles = makeStyles((theme: BackstageTheme) =>\n createStyles({\n card: {\n border: `1px solid ${theme.palette.divider}`,\n boxShadow: theme.shadows[2],\n borderRadius: '4px',\n padding: theme.spacing(2),\n color: '#fff',\n transition: `${theme.transitions.duration.standard}ms`,\n '&:hover': {\n boxShadow: theme.shadows[4],\n },\n },\n bold: {\n fontWeight: theme.typography.fontWeightBold,\n },\n entityTypeBox: {\n background: (props: { type: string }) =>\n theme.getPageTheme({ themeId: props.type }).backgroundImage,\n },\n }),\n);\n\nconst EntityCountTile = ({\n counter,\n type,\n name,\n url,\n}: {\n counter: number;\n type: string;\n name: string;\n url: string;\n}) => {\n const classes = useStyles({ type });\n\n return (\n <Link to={url} variant=\"body2\">\n <Box\n className={`${classes.card} ${classes.entityTypeBox}`}\n display=\"flex\"\n flexDirection=\"column\"\n alignItems=\"center\"\n >\n <Typography className={classes.bold} variant=\"h6\">\n {counter}\n </Typography>\n <Typography className={classes.bold} variant=\"h6\">\n {pluralize(name, counter)}\n </Typography>\n </Box>\n </Link>\n );\n};\n\nconst getQueryParams = (\n owner: Entity,\n selectedEntity: EntityTypeProps,\n): string => {\n const ownerName = formatEntityRefTitle(owner, { defaultKind: 'group' });\n const { kind, type } = selectedEntity;\n const filters = {\n kind,\n type,\n owners: [ownerName],\n user: 'all',\n };\n if (owner.kind === 'User') {\n const user = owner as UserEntity;\n filters.owners = [...filters.owners, ...user.spec.memberOf];\n }\n const queryParams = qs.stringify({\n filters,\n });\n\n return queryParams;\n};\n\nexport const OwnershipCard = ({\n variant,\n entityFilterKind,\n}: {\n /** @deprecated The entity is now grabbed from context instead */\n entity?: Entity;\n variant?: InfoCardVariants;\n entityFilterKind?: string[];\n}) => {\n const { entity } = useEntity();\n const catalogApi = useApi(catalogApiRef);\n const catalogLink = useRouteRef(catalogIndexRouteRef);\n\n const {\n loading,\n error,\n value: componentsWithCounters,\n } = useAsync(async () => {\n const kinds = entityFilterKind ?? ['Component', 'API'];\n const entitiesList = await catalogApi.getEntities({\n filter: {\n kind: kinds,\n },\n fields: [\n 'kind',\n 'metadata.name',\n 'metadata.namespace',\n 'spec.type',\n 'relations',\n ],\n });\n\n const ownedEntitiesList = entitiesList.items.filter(component =>\n isOwnerOf(entity, component),\n );\n\n const counts = ownedEntitiesList.reduce(\n (acc: EntityTypeProps[], ownedEntity) => {\n const match = acc.find(\n x =>\n x.kind === ownedEntity.kind &&\n x.type === (ownedEntity.spec?.type ?? ownedEntity.kind),\n );\n if (match) {\n match.count += 1;\n } else {\n acc.push({\n kind: ownedEntity.kind,\n type: ownedEntity.spec?.type?.toString() ?? ownedEntity.kind,\n count: 1,\n });\n }\n return acc;\n },\n [],\n );\n\n // Return top N (six) entities to be displayed in ownership boxes\n const topN = counts.sort((a, b) => b.count - a.count).slice(0, 6);\n\n return topN.map(topOwnedEntity => ({\n counter: topOwnedEntity.count,\n type: topOwnedEntity.type,\n name: topOwnedEntity.type.toLocaleUpperCase('en-US'),\n queryParams: getQueryParams(entity, topOwnedEntity),\n })) as Array<{\n counter: number;\n type: string;\n name: string;\n queryParams: string;\n }>;\n }, [catalogApi, entity]);\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n return (\n <InfoCard title=\"Ownership\" variant={variant}>\n <Grid container>\n {componentsWithCounters?.map(c => (\n <Grid item xs={6} md={6} lg={4} key={c.name}>\n <EntityCountTile\n counter={c.counter}\n type={c.type}\n name={c.name}\n url={`${catalogLink()}/?${c.queryParams}`}\n />\n </Grid>\n ))}\n </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AAAA,UAClB,MAAM,8BAAY,SAAZ,mBAAkB,SAAlB,mBAAwB,eAAxB,YAAsC,YAAY;AAAA,UACxD,OAAO;AAAA;AAAA;AAGX,aAAO;AAAA,OAET;AAIF,UAAM,OAAO,OAAO,KAAK,CAAC,GAAG,MAAM,EAAE,QAAQ,EAAE,OAAO,MAAM,GAAG;AAE/D,WAAO,KAAK,IAAI;AAAmB,MACjC,SAAS,eAAe;AAAA,MACxB,MAAM,eAAe;AAAA,MACrB,MAAM,eAAe,KAAK,kBAAkB;AAAA,MAC5C,aAAa,eAAe,QAAQ;AAAA;AAAA,KAOrC,CAAC,YAAY;AAEhB,MAAI,SAAS;AACX,+CAAQ,UAAD;AAAA,aACE,OAAO;AAChB,+CAAQ,oBAAD;AAAA,MAAoB;AAAA;AAAA;AAG7B,6CACG,UAAD;AAAA,IAAU,OAAM;AAAA,IAAY;AAAA,yCACzB,MAAD;AAAA,IAAM,WAAS;AAAA,KACZ,iEAAwB,IAAI,2CAC1B,MAAD;AAAA,IAAM,MAAI;AAAA,IAAC,IAAI;AAAA,IAAG,IAAI;AAAA,IAAG,IAAI;AAAA,IAAG,KAAK,EAAE;AAAA,yCACpC,iBAAD;AAAA,IACE,SAAS,EAAE;AAAA,IACX,MAAM,EAAE;AAAA,IACR,MAAM,EAAE;AAAA,IACR,KAAK,GAAG,kBAAkB,EAAE;AAAA;AAAA;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../src/routes.ts","../src/plugin.ts","../src/components/Cards/Group/MembersList/MembersListCard.tsx","../src/components/Cards/Group/GroupProfile/GroupProfileCard.tsx","../src/components/Cards/User/UserProfileCard/UserProfileCard.tsx","../src/components/Cards/OwnershipCard/OwnershipCard.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 { createExternalRouteRef } from '@backstage/core-plugin-api';\n\nexport const catalogIndexRouteRef = createExternalRouteRef({\n id: 'catalog-index',\n});\n","/*\n * Copyright 2020 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 */\nimport {\n createComponentExtension,\n createPlugin,\n} from '@backstage/core-plugin-api';\nimport { catalogIndexRouteRef } from './routes';\n\nexport const orgPlugin = createPlugin({\n id: 'org',\n externalRoutes: {\n catalogIndex: catalogIndexRouteRef,\n },\n});\n\nexport const EntityGroupProfileCard = orgPlugin.provide(\n createComponentExtension({\n name: 'EntityGroupProfileCard',\n component: {\n lazy: () => import('./components').then(m => m.GroupProfileCard),\n },\n }),\n);\nexport const EntityMembersListCard = orgPlugin.provide(\n createComponentExtension({\n name: 'EntityMembersListCard',\n component: {\n lazy: () => import('./components').then(m => m.MembersListCard),\n },\n }),\n);\nexport const EntityOwnershipCard = orgPlugin.provide(\n createComponentExtension({\n name: 'EntityOwnershipCard',\n component: {\n lazy: () => import('./components').then(m => m.OwnershipCard),\n },\n }),\n);\nexport const EntityUserProfileCard = orgPlugin.provide(\n createComponentExtension({\n name: 'EntityUserProfileCard',\n component: {\n lazy: () => import('./components').then(m => m.UserProfileCard),\n },\n }),\n);\n","/*\n * Copyright 2020 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 */\nimport {\n ENTITY_DEFAULT_NAMESPACE,\n GroupEntity,\n UserEntity,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport {\n catalogApiRef,\n entityRouteParams,\n useEntity,\n} from '@backstage/plugin-catalog-react';\nimport {\n Box,\n createStyles,\n Grid,\n makeStyles,\n Theme,\n Typography,\n} from '@material-ui/core';\nimport Pagination from '@material-ui/lab/Pagination';\nimport React from 'react';\nimport { generatePath } from 'react-router-dom';\nimport useAsync from 'react-use/lib/useAsync';\n\nimport {\n Avatar,\n InfoCard,\n Progress,\n ResponseErrorPanel,\n Link,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n card: {\n border: `1px solid ${theme.palette.divider}`,\n boxShadow: theme.shadows[2],\n borderRadius: '4px',\n overflow: 'visible',\n position: 'relative',\n margin: theme.spacing(4, 1, 1),\n flex: '1',\n minWidth: '0px',\n },\n }),\n);\n\nconst MemberComponent = ({ member }: { member: UserEntity }) => {\n const classes = useStyles();\n const {\n metadata: { name: metaName },\n spec: { profile },\n } = member;\n const displayName = profile?.displayName ?? metaName;\n\n return (\n <Grid item container xs={12} sm={6} md={4} xl={2}>\n <Box className={classes.card}>\n <Box\n display=\"flex\"\n flexDirection=\"column\"\n m={3}\n alignItems=\"center\"\n justifyContent=\"center\"\n >\n <Avatar\n displayName={displayName}\n picture={profile?.picture}\n customStyles={{\n position: 'absolute',\n top: '-2rem',\n }}\n />\n <Box pt={2} textAlign=\"center\">\n <Typography variant=\"h5\">\n <Link\n to={generatePath(\n `/catalog/:namespace/user/${metaName}`,\n entityRouteParams(member),\n )}\n >\n {displayName}\n </Link>\n </Typography>\n {profile?.email && (\n <Link to={`mailto:${profile.email}`}>{profile.email}</Link>\n )}\n </Box>\n </Box>\n </Box>\n </Grid>\n );\n};\n\nexport const MembersListCard = (_props: {\n /** @deprecated The entity is now grabbed from context instead */\n entity?: GroupEntity;\n memberDisplayTitle?: string;\n pageSize?: number;\n}) => {\n const { entity: groupEntity } = useEntity<GroupEntity>();\n let { memberDisplayTitle, pageSize } = _props;\n const {\n metadata: { name: groupName, namespace: grpNamespace },\n spec: { profile },\n } = groupEntity;\n const catalogApi = useApi(catalogApiRef);\n\n const displayName = profile?.displayName ?? groupName;\n\n const groupNamespace = grpNamespace || ENTITY_DEFAULT_NAMESPACE;\n\n const [page, setPage] = React.useState(1);\n const pageChange = (_: React.ChangeEvent<unknown>, pageIndex: number) => {\n setPage(pageIndex);\n };\n pageSize = pageSize ? pageSize : 50;\n memberDisplayTitle = memberDisplayTitle ? memberDisplayTitle : 'Members';\n\n const {\n loading,\n error,\n value: members,\n } = useAsync(async () => {\n const membersList = await catalogApi.getEntities({\n filter: {\n kind: 'User',\n 'relations.memberof': [\n stringifyEntityRef({\n kind: 'group',\n namespace: groupNamespace.toLocaleLowerCase('en-US'),\n name: groupName.toLocaleLowerCase('en-US'),\n }),\n ],\n },\n });\n\n return membersList.items as UserEntity[];\n }, [catalogApi, groupEntity]);\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n const nbPages = Math.ceil((members?.length || 0) / pageSize);\n const paginationLabel = nbPages < 2 ? '' : `, page ${page} of ${nbPages}`;\n\n const pagination = (\n <Pagination\n count={nbPages}\n page={page}\n onChange={pageChange}\n showFirstButton\n showLastButton\n />\n );\n\n return (\n <Grid item>\n <InfoCard\n title={`${memberDisplayTitle} (${\n members?.length || 0\n }${paginationLabel})`}\n subheader={`of ${displayName}`}\n {...(nbPages <= 1 ? {} : { actions: pagination })}\n >\n <Grid container spacing={3}>\n {members && members.length > 0 ? (\n members\n .slice(pageSize * (page - 1), pageSize * page)\n .map(member => (\n <MemberComponent member={member} key={member.metadata.uid} />\n ))\n ) : (\n <Box p={2}>\n <Typography>\n This group has no {memberDisplayTitle.toLocaleLowerCase()}.\n </Typography>\n </Box>\n )}\n </Grid>\n </InfoCard>\n </Grid>\n );\n};\n","/*\n * Copyright 2020 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 GroupEntity,\n RELATION_CHILD_OF,\n RELATION_PARENT_OF,\n} from '@backstage/catalog-model';\nimport {\n EntityRefLinks,\n getEntityRelations,\n useEntity,\n getEntityMetadataEditUrl,\n} from '@backstage/plugin-catalog-react';\nimport {\n Box,\n Grid,\n List,\n ListItem,\n ListItemIcon,\n ListItemText,\n Tooltip,\n IconButton,\n} from '@material-ui/core';\nimport AccountTreeIcon from '@material-ui/icons/AccountTree';\nimport EmailIcon from '@material-ui/icons/Email';\nimport GroupIcon from '@material-ui/icons/Group';\nimport EditIcon from '@material-ui/icons/Edit';\nimport Alert from '@material-ui/lab/Alert';\nimport React from 'react';\nimport {\n Avatar,\n InfoCard,\n InfoCardVariants,\n Link,\n} from '@backstage/core-components';\n\nconst CardTitle = ({ title }: { title: string }) => (\n <Box display=\"flex\" alignItems=\"center\">\n <GroupIcon fontSize=\"inherit\" />\n <Box ml={1}>{title}</Box>\n </Box>\n);\n\nexport const GroupProfileCard = ({\n variant,\n}: {\n /** @deprecated The entity is now grabbed from context instead */\n entity?: GroupEntity;\n variant?: InfoCardVariants;\n}) => {\n const { entity: group } = useEntity<GroupEntity>();\n if (!group) {\n return <Alert severity=\"error\">Group not found</Alert>;\n }\n\n const {\n metadata: { name, description },\n spec: { profile },\n } = group;\n\n const childRelations = getEntityRelations(group, RELATION_PARENT_OF, {\n kind: 'Group',\n });\n const parentRelations = getEntityRelations(group, RELATION_CHILD_OF, {\n kind: 'group',\n });\n\n const entityMetadataEditUrl = getEntityMetadataEditUrl(group);\n\n const displayName = profile?.displayName ?? name;\n const emailHref = profile?.email ? `mailto:${profile.email}` : '#';\n const infoCardAction = entityMetadataEditUrl ? (\n <IconButton\n aria-label=\"Edit\"\n title=\"Edit Metadata\"\n component={Link}\n to={entityMetadataEditUrl}\n >\n <EditIcon />\n </IconButton>\n ) : (\n <IconButton aria-label=\"Edit\" disabled title=\"Edit Metadata\">\n <EditIcon />\n </IconButton>\n );\n\n return (\n <InfoCard\n title={<CardTitle title={displayName} />}\n subheader={description}\n variant={variant}\n action={infoCardAction}\n >\n <Grid container spacing={3}>\n <Grid item xs={12} sm={2} xl={1}>\n <Avatar displayName={displayName} picture={profile?.picture} />\n </Grid>\n <Grid item md={10} xl={11}>\n <List>\n {profile?.email && (\n <ListItem>\n <ListItemIcon>\n <Tooltip title=\"Email\">\n <EmailIcon />\n </Tooltip>\n </ListItemIcon>\n <ListItemText>\n <Link to={emailHref}>{profile.email}</Link>\n </ListItemText>\n </ListItem>\n )}\n\n {parentRelations.length ? (\n <ListItem>\n <ListItemIcon>\n <Tooltip title=\"Parent Group\">\n <AccountTreeIcon />\n </Tooltip>\n </ListItemIcon>\n <ListItemText>\n <EntityRefLinks\n entityRefs={parentRelations}\n defaultKind=\"Group\"\n />\n </ListItemText>\n </ListItem>\n ) : null}\n\n {childRelations.length ? (\n <ListItem>\n <ListItemIcon>\n <Tooltip title=\"Child Groups\">\n <GroupIcon />\n </Tooltip>\n </ListItemIcon>\n <ListItemText>\n <EntityRefLinks\n entityRefs={childRelations}\n defaultKind=\"Group\"\n />\n </ListItemText>\n </ListItem>\n ) : null}\n </List>\n </Grid>\n </Grid>\n </InfoCard>\n );\n};\n","/*\n * Copyright 2020 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 */\nimport { RELATION_MEMBER_OF, UserEntity } from '@backstage/catalog-model';\nimport {\n EntityRefLinks,\n getEntityRelations,\n useEntity,\n} from '@backstage/plugin-catalog-react';\nimport {\n Box,\n Grid,\n List,\n ListItem,\n ListItemIcon,\n ListItemText,\n Tooltip,\n} from '@material-ui/core';\nimport EmailIcon from '@material-ui/icons/Email';\nimport GroupIcon from '@material-ui/icons/Group';\nimport PersonIcon from '@material-ui/icons/Person';\nimport Alert from '@material-ui/lab/Alert';\nimport React from 'react';\nimport {\n Avatar,\n InfoCard,\n InfoCardVariants,\n Link,\n} from '@backstage/core-components';\n\nconst CardTitle = ({ title }: { title?: string }) =>\n title ? (\n <Box display=\"flex\" alignItems=\"center\">\n <PersonIcon fontSize=\"inherit\" />\n <Box ml={1}>{title}</Box>\n </Box>\n ) : null;\n\nexport const UserProfileCard = ({\n variant,\n}: {\n /** @deprecated The entity is now grabbed from context instead */\n entity?: UserEntity;\n variant?: InfoCardVariants;\n}) => {\n const { entity: user } = useEntity<UserEntity>();\n if (!user) {\n return <Alert severity=\"error\">User not found</Alert>;\n }\n\n const {\n metadata: { name: metaName, description },\n spec: { profile },\n } = user;\n const displayName = profile?.displayName ?? metaName;\n const emailHref = profile?.email ? `mailto:${profile.email}` : undefined;\n const memberOfRelations = getEntityRelations(user, RELATION_MEMBER_OF, {\n kind: 'Group',\n });\n\n return (\n <InfoCard\n title={<CardTitle title={displayName} />}\n subheader={description}\n variant={variant}\n >\n <Grid container spacing={3} alignItems=\"flex-start\">\n <Grid item xs={12} sm={2} xl={1}>\n <Avatar displayName={displayName} picture={profile?.picture} />\n </Grid>\n\n <Grid item md={10} xl={11}>\n <List>\n {profile?.email && (\n <ListItem>\n <ListItemIcon>\n <Tooltip title=\"Email\">\n <EmailIcon />\n </Tooltip>\n </ListItemIcon>\n <ListItemText>\n <Link to={emailHref ?? ''}>{profile.email}</Link>\n </ListItemText>\n </ListItem>\n )}\n\n <ListItem>\n <ListItemIcon>\n <Tooltip title=\"Member of\">\n <GroupIcon />\n </Tooltip>\n </ListItemIcon>\n <ListItemText>\n <EntityRefLinks\n entityRefs={memberOfRelations}\n defaultKind=\"Group\"\n />\n </ListItemText>\n </ListItem>\n </List>\n </Grid>\n </Grid>\n </InfoCard>\n );\n};\n","/*\n * Copyright 2020 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 { Entity, UserEntity } from '@backstage/catalog-model';\nimport {\n InfoCard,\n InfoCardVariants,\n Link,\n Progress,\n ResponseErrorPanel,\n} from '@backstage/core-components';\nimport { useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport {\n catalogApiRef,\n formatEntityRefTitle,\n isOwnerOf,\n useEntity,\n} from '@backstage/plugin-catalog-react';\nimport { BackstageTheme } from '@backstage/theme';\nimport {\n Box,\n createStyles,\n Grid,\n makeStyles,\n Typography,\n} from '@material-ui/core';\nimport qs from 'qs';\nimport React from 'react';\nimport pluralize from 'pluralize';\nimport useAsync from 'react-use/lib/useAsync';\nimport { catalogIndexRouteRef } from '../../../routes';\n\ntype EntityTypeProps = {\n kind: string;\n type: string;\n count: number;\n};\n\nconst useStyles = makeStyles((theme: BackstageTheme) =>\n createStyles({\n card: {\n border: `1px solid ${theme.palette.divider}`,\n boxShadow: theme.shadows[2],\n borderRadius: '4px',\n padding: theme.spacing(2),\n color: '#fff',\n transition: `${theme.transitions.duration.standard}ms`,\n '&:hover': {\n boxShadow: theme.shadows[4],\n },\n },\n bold: {\n fontWeight: theme.typography.fontWeightBold,\n },\n entityTypeBox: {\n background: (props: { type: string }) =>\n theme.getPageTheme({ themeId: props.type }).backgroundImage,\n },\n }),\n);\n\nconst EntityCountTile = ({\n counter,\n type,\n name,\n url,\n}: {\n counter: number;\n type: string;\n name: string;\n url: string;\n}) => {\n const classes = useStyles({ type });\n\n return (\n <Link to={url} variant=\"body2\">\n <Box\n className={`${classes.card} ${classes.entityTypeBox}`}\n display=\"flex\"\n flexDirection=\"column\"\n alignItems=\"center\"\n >\n <Typography className={classes.bold} variant=\"h6\">\n {counter}\n </Typography>\n <Typography className={classes.bold} variant=\"h6\">\n {pluralize(name, counter)}\n </Typography>\n </Box>\n </Link>\n );\n};\n\nconst getQueryParams = (\n owner: Entity,\n selectedEntity: EntityTypeProps,\n): string => {\n const ownerName = formatEntityRefTitle(owner, { defaultKind: 'group' });\n const { kind, type } = selectedEntity;\n const filters = {\n kind,\n type,\n owners: [ownerName],\n user: 'all',\n };\n if (owner.kind === 'User') {\n const user = owner as UserEntity;\n filters.owners = [...filters.owners, ...user.spec.memberOf];\n }\n const queryParams = qs.stringify({\n filters,\n });\n\n return queryParams;\n};\n\nexport const OwnershipCard = ({\n variant,\n entityFilterKind,\n}: {\n /** @deprecated The entity is now grabbed from context instead */\n entity?: Entity;\n variant?: InfoCardVariants;\n entityFilterKind?: string[];\n}) => {\n const { entity } = useEntity();\n const catalogApi = useApi(catalogApiRef);\n const catalogLink = useRouteRef(catalogIndexRouteRef);\n\n const {\n loading,\n error,\n value: componentsWithCounters,\n } = useAsync(async () => {\n const kinds = entityFilterKind ?? ['Component', 'API'];\n const entitiesList = await catalogApi.getEntities({\n filter: {\n kind: kinds,\n },\n fields: [\n 'kind',\n 'metadata.name',\n 'metadata.namespace',\n 'spec.type',\n 'relations',\n ],\n });\n\n const ownedEntitiesList = entitiesList.items.filter(component =>\n isOwnerOf(entity, component),\n );\n\n const counts = ownedEntitiesList.reduce(\n (acc: EntityTypeProps[], ownedEntity) => {\n const match = acc.find(\n x =>\n x.kind === ownedEntity.kind &&\n x.type === (ownedEntity.spec?.type ?? ownedEntity.kind),\n );\n if (match) {\n match.count += 1;\n } else {\n acc.push({\n kind: ownedEntity.kind,\n type: ownedEntity.spec?.type?.toString() ?? ownedEntity.kind,\n count: 1,\n });\n }\n return acc;\n },\n [],\n );\n\n // Return top N (six) entities to be displayed in ownership boxes\n const topN = counts.sort((a, b) => b.count - a.count).slice(0, 6);\n\n return topN.map(topOwnedEntity => ({\n counter: topOwnedEntity.count,\n type: topOwnedEntity.type,\n name: topOwnedEntity.type.toLocaleUpperCase('en-US'),\n queryParams: getQueryParams(entity, topOwnedEntity),\n })) as Array<{\n counter: number;\n type: string;\n name: string;\n queryParams: string;\n }>;\n }, [catalogApi, entity]);\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n return (\n <InfoCard title=\"Ownership\" variant={variant}>\n <Grid container>\n {componentsWithCounters?.map(c => (\n <Grid item xs={6} md={6} lg={4} key={c.name}>\n <EntityCountTile\n counter={c.counter}\n type={c.type}\n name={c.name}\n url={`${catalogLink()}/?${c.queryParams}`}\n />\n </Grid>\n ))}\n </Grid>\n </InfoCard>\n );\n};\n"],"names":["useStyles","CardTitle"],"mappings":";;;;;;;;;;;;;;;;;;MAkBa,uBAAuB,uBAAuB;AAAA,EACzD,IAAI;AAAA;;MCEO,YAAY,aAAa;AAAA,EACpC,IAAI;AAAA,EACJ,gBAAgB;AAAA,IACd,cAAc;AAAA;AAAA;MAIL,yBAAyB,UAAU,QAC9C,yBAAyB;AAAA,EACvB,MAAM;AAAA,EACN,WAAW;AAAA,IACT,MAAM,MAAM,OAAO,+BAAgB,KAAK,OAAK,EAAE;AAAA;AAAA;MAIxC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I,SAAS;AACX,+CAAQ,UAAD;AAAA,aACE,OAAO;AAChB,+CAAQ,oBAAD;AAAA,MAAoB;AAAA;AAAA;AAG7B,6CACG,UAAD;AAAA,IAAU,OAAM;AAAA,IAAY;AAAA,yCACzB,MAAD;AAAA,IAAM,WAAS;AAAA,KACZ,iEAAwB,IAAI,2CAC1B,MAAD;AAAA,IAAM,MAAI;AAAA,IAAC,IAAI;AAAA,IAAG,IAAI;AAAA,IAAG,IAAI;AAAA,IAAG,KAAK,EAAE;AAAA,yCACpC,iBAAD;AAAA,IACE,SAAS,EAAE;AAAA,IACX,MAAM,EAAE;AAAA,IACR,MAAM,EAAE;AAAA,IACR,KAAK,GAAG,kBAAkB,EAAE;AAAA;AAAA;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@backstage/plugin-org",
3
3
  "description": "A Backstage plugin that helps you create entity pages for your organization",
4
- "version": "0.4.0",
4
+ "version": "0.4.2",
5
5
  "main": "dist/index.esm.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "license": "Apache-2.0",
@@ -22,9 +22,9 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@backstage/catalog-model": "^0.9.10",
25
- "@backstage/core-components": "^0.8.5",
25
+ "@backstage/core-components": "^0.8.8",
26
26
  "@backstage/core-plugin-api": "^0.6.0",
27
- "@backstage/plugin-catalog-react": "^0.6.12",
27
+ "@backstage/plugin-catalog-react": "^0.6.14",
28
28
  "@backstage/theme": "^0.2.14",
29
29
  "@material-ui/core": "^4.12.2",
30
30
  "@material-ui/icons": "^4.9.1",
@@ -39,21 +39,21 @@
39
39
  "react": "^16.13.1 || ^17.0.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@backstage/catalog-client": "^0.5.5",
43
- "@backstage/cli": "^0.12.0",
44
- "@backstage/core-app-api": "^0.5.0",
45
- "@backstage/dev-utils": "^0.2.18",
46
- "@backstage/test-utils": "^0.2.3",
42
+ "@backstage/catalog-client": "^0.6.0",
43
+ "@backstage/cli": "^0.13.2",
44
+ "@backstage/core-app-api": "^0.5.2",
45
+ "@backstage/dev-utils": "^0.2.21",
46
+ "@backstage/test-utils": "^0.2.4",
47
47
  "@testing-library/jest-dom": "^5.10.1",
48
48
  "@testing-library/react": "^11.2.5",
49
49
  "@testing-library/user-event": "^13.1.8",
50
50
  "@types/jest": "^26.0.7",
51
51
  "@types/node": "^14.14.32",
52
- "cross-fetch": "^3.0.6",
52
+ "cross-fetch": "^3.1.5",
53
53
  "msw": "^0.35.0"
54
54
  },
55
55
  "files": [
56
56
  "dist"
57
57
  ],
58
- "gitHead": "600d6e3c854bbfb12a0078ca6f726d1c0d1fea0b"
58
+ "gitHead": "71e8539c91c1ebc558dafcd80fa3a9de20db597f"
59
59
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-536f8a7e.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}