@backstage/plugin-org 0.5.0 → 0.5.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,37 @@
|
|
|
1
1
|
# @backstage/plugin-org
|
|
2
2
|
|
|
3
|
+
## 0.5.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2986f8e09d: Fixed EntityOwnerPicker and OwnershipCard url filter issue with more than 21 owners
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/plugin-catalog-react@0.9.0
|
|
10
|
+
- @backstage/core-components@0.9.1
|
|
11
|
+
- @backstage/catalog-model@0.13.0
|
|
12
|
+
|
|
13
|
+
## 0.5.2-next.0
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 2986f8e09d: Fixed EntityOwnerPicker and OwnershipCard url filter issue with more than 21 owners
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
- @backstage/plugin-catalog-react@0.9.0-next.0
|
|
20
|
+
- @backstage/core-components@0.9.1-next.0
|
|
21
|
+
- @backstage/catalog-model@0.13.0-next.0
|
|
22
|
+
|
|
23
|
+
## 0.5.1
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- f41a293231: - **DEPRECATION**: Deprecated `formatEntityRefTitle` in favor of the new `humanizeEntityRef` method instead. Please migrate to using the new method instead.
|
|
28
|
+
- 8f0e8e039b: Removed usage of deprecated `getEntityMetadataViewUrl` and `getEntityMetadataEditUrl` helpers.
|
|
29
|
+
- Updated dependencies
|
|
30
|
+
- @backstage/catalog-model@0.12.0
|
|
31
|
+
- @backstage/core-components@0.9.0
|
|
32
|
+
- @backstage/plugin-catalog-react@0.8.0
|
|
33
|
+
- @backstage/core-plugin-api@0.8.0
|
|
34
|
+
|
|
3
35
|
## 0.5.0
|
|
4
36
|
|
|
5
37
|
### Minor Changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-1fe1f1c2.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
|
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createExternalRouteRef, createPlugin, createComponentExtension, useApi, alertApiRef, useRouteRef } from '@backstage/core-plugin-api';
|
|
2
|
-
import { stringifyEntityRef, DEFAULT_NAMESPACE, RELATION_PARENT_OF, RELATION_CHILD_OF, ANNOTATION_LOCATION, RELATION_MEMBER_OF } from '@backstage/catalog-model';
|
|
3
|
-
import { useEntity, catalogApiRef, entityRouteParams, getEntityRelations,
|
|
2
|
+
import { stringifyEntityRef, DEFAULT_NAMESPACE, RELATION_PARENT_OF, RELATION_CHILD_OF, ANNOTATION_LOCATION, ANNOTATION_EDIT_URL, RELATION_MEMBER_OF } from '@backstage/catalog-model';
|
|
3
|
+
import { useEntity, catalogApiRef, entityRouteParams, getEntityRelations, EntityRefLinks, isOwnerOf, humanizeEntityRef } from '@backstage/plugin-catalog-react';
|
|
4
4
|
import { makeStyles, createStyles, Grid, Box, Typography, IconButton, List, ListItem, ListItemIcon, Tooltip, ListItemText } from '@material-ui/core';
|
|
5
5
|
import Pagination from '@material-ui/lab/Pagination';
|
|
6
6
|
import React, { useCallback } from 'react';
|
|
@@ -30,25 +30,25 @@ const orgPlugin = createPlugin({
|
|
|
30
30
|
const EntityGroupProfileCard = orgPlugin.provide(createComponentExtension({
|
|
31
31
|
name: "EntityGroupProfileCard",
|
|
32
32
|
component: {
|
|
33
|
-
lazy: () => import('./esm/index-
|
|
33
|
+
lazy: () => import('./esm/index-1fe1f1c2.esm.js').then((m) => m.GroupProfileCard)
|
|
34
34
|
}
|
|
35
35
|
}));
|
|
36
36
|
const EntityMembersListCard = orgPlugin.provide(createComponentExtension({
|
|
37
37
|
name: "EntityMembersListCard",
|
|
38
38
|
component: {
|
|
39
|
-
lazy: () => import('./esm/index-
|
|
39
|
+
lazy: () => import('./esm/index-1fe1f1c2.esm.js').then((m) => m.MembersListCard)
|
|
40
40
|
}
|
|
41
41
|
}));
|
|
42
42
|
const EntityOwnershipCard = orgPlugin.provide(createComponentExtension({
|
|
43
43
|
name: "EntityOwnershipCard",
|
|
44
44
|
component: {
|
|
45
|
-
lazy: () => import('./esm/index-
|
|
45
|
+
lazy: () => import('./esm/index-1fe1f1c2.esm.js').then((m) => m.OwnershipCard)
|
|
46
46
|
}
|
|
47
47
|
}));
|
|
48
48
|
const EntityUserProfileCard = orgPlugin.provide(createComponentExtension({
|
|
49
49
|
name: "EntityUserProfileCard",
|
|
50
50
|
component: {
|
|
51
|
-
lazy: () => import('./esm/index-
|
|
51
|
+
lazy: () => import('./esm/index-1fe1f1c2.esm.js').then((m) => m.UserProfileCard)
|
|
52
52
|
}
|
|
53
53
|
}));
|
|
54
54
|
|
|
@@ -185,7 +185,7 @@ const CardTitle$1 = ({ title }) => /* @__PURE__ */ React.createElement(Box, {
|
|
|
185
185
|
const GroupProfileCard = ({
|
|
186
186
|
variant
|
|
187
187
|
}) => {
|
|
188
|
-
var _a;
|
|
188
|
+
var _a, _b;
|
|
189
189
|
const catalogApi = useApi(catalogApiRef);
|
|
190
190
|
const alertApi = useApi(alertApiRef);
|
|
191
191
|
const { entity: group } = useEntity();
|
|
@@ -210,8 +210,8 @@ const GroupProfileCard = ({
|
|
|
210
210
|
});
|
|
211
211
|
const entityLocation = annotations == null ? void 0 : annotations[ANNOTATION_LOCATION];
|
|
212
212
|
const allowRefresh = (entityLocation == null ? void 0 : entityLocation.startsWith("url:")) || (entityLocation == null ? void 0 : entityLocation.startsWith("file:"));
|
|
213
|
-
const entityMetadataEditUrl =
|
|
214
|
-
const displayName = (
|
|
213
|
+
const entityMetadataEditUrl = (_a = group.metadata.annotations) == null ? void 0 : _a[ANNOTATION_EDIT_URL];
|
|
214
|
+
const displayName = (_b = profile == null ? void 0 : profile.displayName) != null ? _b : name;
|
|
215
215
|
const emailHref = (profile == null ? void 0 : profile.email) ? `mailto:${profile.email}` : "#";
|
|
216
216
|
const infoCardAction = entityMetadataEditUrl ? /* @__PURE__ */ React.createElement(IconButton, {
|
|
217
217
|
"aria-label": "Edit",
|
|
@@ -370,7 +370,7 @@ const EntityCountTile = ({
|
|
|
370
370
|
}, pluralize(name, counter))));
|
|
371
371
|
};
|
|
372
372
|
const getQueryParams = (owner, selectedEntity) => {
|
|
373
|
-
const ownerName =
|
|
373
|
+
const ownerName = humanizeEntityRef(owner, { defaultKind: "group" });
|
|
374
374
|
const { kind, type } = selectedEntity;
|
|
375
375
|
const filters = {
|
|
376
376
|
kind,
|
|
@@ -384,6 +384,8 @@ const getQueryParams = (owner, selectedEntity) => {
|
|
|
384
384
|
}
|
|
385
385
|
const queryParams = qs.stringify({
|
|
386
386
|
filters
|
|
387
|
+
}, {
|
|
388
|
+
arrayFormat: "repeat"
|
|
387
389
|
});
|
|
388
390
|
return queryParams;
|
|
389
391
|
};
|
package/dist/index.esm.js.map
CHANGED
|
@@ -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 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 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 || 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 ANNOTATION_LOCATION,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport {\n catalogApiRef,\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 CachedIcon from '@material-ui/icons/Cached';\nimport Alert from '@material-ui/lab/Alert';\nimport React, { useCallback } from 'react';\nimport {\n Avatar,\n InfoCard,\n InfoCardVariants,\n Link,\n} from '@backstage/core-components';\nimport { alertApiRef, useApi } from '@backstage/core-plugin-api';\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 variant?: InfoCardVariants;\n}) => {\n const catalogApi = useApi(catalogApiRef);\n const alertApi = useApi(alertApiRef);\n const { entity: group } = useEntity<GroupEntity>();\n\n const refreshEntity = useCallback(async () => {\n await catalogApi.refreshEntity(stringifyEntityRef(group));\n alertApi.post({ message: 'Refresh scheduled', severity: 'info' });\n }, [catalogApi, alertApi, group]);\n\n if (!group) {\n return <Alert severity=\"error\">Group not found</Alert>;\n }\n\n const {\n metadata: { name, description, annotations },\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 entityLocation = annotations?.[ANNOTATION_LOCATION];\n const allowRefresh =\n entityLocation?.startsWith('url:') || entityLocation?.startsWith('file:');\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={\n <>\n {allowRefresh && (\n <IconButton\n aria-label=\"Refresh\"\n title=\"Schedule entity refresh\"\n onClick={refreshEntity}\n >\n <CachedIcon />\n </IconButton>\n )}\n {infoCardAction}\n </>\n }\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 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 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,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;AAEtD,UAAI,OAAO;AACT,cAAM,SAAS;AAAA,aACV;AACL,YAAI,KAAK;AAAA,UACP,MAAM,YAAY;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 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 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 || 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 ANNOTATION_LOCATION,\n stringifyEntityRef,\n ANNOTATION_EDIT_URL,\n} from '@backstage/catalog-model';\nimport {\n catalogApiRef,\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 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 CachedIcon from '@material-ui/icons/Cached';\nimport Alert from '@material-ui/lab/Alert';\nimport React, { useCallback } from 'react';\nimport {\n Avatar,\n InfoCard,\n InfoCardVariants,\n Link,\n} from '@backstage/core-components';\nimport { alertApiRef, useApi } from '@backstage/core-plugin-api';\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 variant?: InfoCardVariants;\n}) => {\n const catalogApi = useApi(catalogApiRef);\n const alertApi = useApi(alertApiRef);\n const { entity: group } = useEntity<GroupEntity>();\n\n const refreshEntity = useCallback(async () => {\n await catalogApi.refreshEntity(stringifyEntityRef(group));\n alertApi.post({ message: 'Refresh scheduled', severity: 'info' });\n }, [catalogApi, alertApi, group]);\n\n if (!group) {\n return <Alert severity=\"error\">Group not found</Alert>;\n }\n\n const {\n metadata: { name, description, annotations },\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 entityLocation = annotations?.[ANNOTATION_LOCATION];\n const allowRefresh =\n entityLocation?.startsWith('url:') || entityLocation?.startsWith('file:');\n\n const entityMetadataEditUrl =\n group.metadata.annotations?.[ANNOTATION_EDIT_URL];\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={\n <>\n {allowRefresh && (\n <IconButton\n aria-label=\"Refresh\"\n title=\"Schedule entity refresh\"\n onClick={refreshEntity}\n >\n <CachedIcon />\n </IconButton>\n )}\n {infoCardAction}\n </>\n }\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 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 humanizeEntityRef,\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 = humanizeEntityRef(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 {\n filters,\n },\n {\n arrayFormat: 'repeat',\n },\n );\n\n return queryParams;\n};\n\nexport const OwnershipCard = ({\n variant,\n entityFilterKind,\n}: {\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,wBAAwB,UAAU,QAC7C,yBAAyB;AAAA,EACvB,MAAM;AAAA,EACN,WAAW;AAAA,IACT,MAAM,MAAM,OAAO,+BAAgB,KAAK,OAAK,EAAE;AAAA;AAAA;MAIxC,sBAAsB,UAAU,QAC3C,yBAAyB;AAAA,EACvB,MAAM;AAAA,EACN,WAAW;AAAA,IACT,MAAM,MAAM,OAAO,+BAAgB,KAAK,OAAK,EAAE;AAAA;AAAA;MAIxC,wBAAwB,UAAU,QAC7C,yBAAyB;AAAA,EACvB,MAAM;AAAA,EACN,WAAW;AAAA,IACT,MAAM,MAAM,OAAO,+BAAgB,KAAK,OAAK,EAAE;AAAA;AAAA;;ACRrD,MAAMA,cAAY,WAAW,CAAC,UAC5B,aAAa;AAAA,EACX,MAAM;AAAA,IACJ,QAAQ,aAAa,MAAM,QAAQ;AAAA,IACnC,WAAW,MAAM,QAAQ;AAAA,IACzB,cAAc;AAAA,IACd,UAAU;AAAA,IACV,UAAU;AAAA,IACV,QAAQ,MAAM,QAAQ,GAAG,GAAG;AAAA,IAC5B,MAAM;AAAA,IACN,UAAU;AAAA;AAAA;AAKhB,MAAM,kBAAkB,CAAC,EAAE,aAAqC;AA/DhE;AAgEE,QAAM,UAAUA;AA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AAE;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.5.
|
|
4
|
+
"version": "0.5.2",
|
|
5
5
|
"main": "dist/index.esm.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"clean": "backstage-cli package clean"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@backstage/catalog-model": "^0.
|
|
28
|
-
"@backstage/core-components": "^0.
|
|
29
|
-
"@backstage/core-plugin-api": "^0.
|
|
30
|
-
"@backstage/plugin-catalog-react": "^0.
|
|
27
|
+
"@backstage/catalog-model": "^0.13.0",
|
|
28
|
+
"@backstage/core-components": "^0.9.1",
|
|
29
|
+
"@backstage/core-plugin-api": "^0.8.0",
|
|
30
|
+
"@backstage/plugin-catalog-react": "^0.9.0",
|
|
31
31
|
"@backstage/theme": "^0.2.15",
|
|
32
32
|
"@material-ui/core": "^4.12.2",
|
|
33
33
|
"@material-ui/icons": "^4.9.1",
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"react": "^16.13.1 || ^17.0.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@backstage/catalog-client": "^0.
|
|
46
|
-
"@backstage/cli": "^0.
|
|
47
|
-
"@backstage/core-app-api": "^0.
|
|
48
|
-
"@backstage/dev-utils": "^0.2.
|
|
49
|
-
"@backstage/test-utils": "^0.
|
|
45
|
+
"@backstage/catalog-client": "^0.9.0",
|
|
46
|
+
"@backstage/cli": "^0.15.2",
|
|
47
|
+
"@backstage/core-app-api": "^0.6.0",
|
|
48
|
+
"@backstage/dev-utils": "^0.2.25",
|
|
49
|
+
"@backstage/test-utils": "^0.3.0",
|
|
50
50
|
"@testing-library/jest-dom": "^5.10.1",
|
|
51
51
|
"@testing-library/react": "^11.2.5",
|
|
52
52
|
"@testing-library/user-event": "^13.1.8",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"files": [
|
|
59
59
|
"dist"
|
|
60
60
|
],
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "60c4e39d1fcaeb10d6488ada1d907f34dc2a105a"
|
|
62
62
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-e7876693.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
|