@backstage/plugin-org 0.6.38-next.1 → 0.6.38
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 +34 -0
- package/dist/alpha.d.ts +5 -5
- package/dist/alpha.esm.js +5 -5
- package/dist/alpha.esm.js.map +1 -1
- package/dist/components/Cards/Group/GroupProfile/GroupProfileCard.esm.js +73 -49
- package/dist/components/Cards/Group/GroupProfile/GroupProfileCard.esm.js.map +1 -1
- package/dist/components/Cards/Group/MembersList/MembersListCard.esm.js +70 -55
- package/dist/components/Cards/Group/MembersList/MembersListCard.esm.js.map +1 -1
- package/dist/components/Cards/Meta/LinksGroup.esm.js +19 -13
- package/dist/components/Cards/Meta/LinksGroup.esm.js.map +1 -1
- package/dist/components/Cards/OwnershipCard/ComponentsGrid.esm.js +26 -24
- package/dist/components/Cards/OwnershipCard/ComponentsGrid.esm.js.map +1 -1
- package/dist/components/Cards/OwnershipCard/OwnershipCard.esm.js +48 -40
- package/dist/components/Cards/OwnershipCard/OwnershipCard.esm.js.map +1 -1
- package/dist/components/Cards/User/UserProfileCard/UserProfileCard.esm.js +34 -18
- package/dist/components/Cards/User/UserProfileCard/UserProfileCard.esm.js.map +1 -1
- package/dist/components/MyGroupsSidebarItem/MyGroupsSidebarItem.esm.js +8 -8
- package/dist/components/MyGroupsSidebarItem/MyGroupsSidebarItem.esm.js.map +1 -1
- package/dist/index.d.ts +10 -11
- package/package.json +20 -20
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @backstage/plugin-org
|
|
2
2
|
|
|
3
|
+
## 0.6.38
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a47fd39: Removes instances of default React imports, a necessary update for the upcoming React 19 migration.
|
|
8
|
+
|
|
9
|
+
<https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html>
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @backstage/plugin-catalog-react@1.17.0
|
|
13
|
+
- @backstage/frontend-plugin-api@0.10.1
|
|
14
|
+
- @backstage/core-compat-api@0.4.1
|
|
15
|
+
- @backstage/core-components@0.17.1
|
|
16
|
+
- @backstage/core-plugin-api@1.10.6
|
|
17
|
+
- @backstage/catalog-model@1.7.3
|
|
18
|
+
- @backstage/plugin-catalog-common@1.1.3
|
|
19
|
+
|
|
20
|
+
## 0.6.38-next.2
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- a47fd39: Removes instances of default React imports, a necessary update for the upcoming React 19 migration.
|
|
25
|
+
|
|
26
|
+
<https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html>
|
|
27
|
+
|
|
28
|
+
- Updated dependencies
|
|
29
|
+
- @backstage/frontend-plugin-api@0.10.1-next.1
|
|
30
|
+
- @backstage/core-compat-api@0.4.1-next.2
|
|
31
|
+
- @backstage/core-components@0.17.1-next.1
|
|
32
|
+
- @backstage/core-plugin-api@1.10.6-next.0
|
|
33
|
+
- @backstage/plugin-catalog-react@1.17.0-next.2
|
|
34
|
+
- @backstage/catalog-model@1.7.3
|
|
35
|
+
- @backstage/plugin-catalog-common@1.1.3
|
|
36
|
+
|
|
3
37
|
## 0.6.38-next.1
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
package/dist/alpha.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _backstage_catalog_model from '@backstage/catalog-model';
|
|
2
|
+
import * as react from 'react';
|
|
2
3
|
import * as _backstage_plugin_catalog_react_alpha from '@backstage/plugin-catalog-react/alpha';
|
|
3
4
|
import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
|
|
4
|
-
import React__default from 'react';
|
|
5
5
|
|
|
6
6
|
/** @alpha */
|
|
7
7
|
declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{}, {
|
|
@@ -18,7 +18,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{}, {
|
|
|
18
18
|
filter?: _backstage_plugin_catalog_react_alpha.EntityPredicate | undefined;
|
|
19
19
|
type?: "content" | "summary" | "info" | undefined;
|
|
20
20
|
};
|
|
21
|
-
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<
|
|
21
|
+
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
22
22
|
optional: true;
|
|
23
23
|
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
24
24
|
optional: true;
|
|
@@ -43,7 +43,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{}, {
|
|
|
43
43
|
filter?: _backstage_plugin_catalog_react_alpha.EntityPredicate | undefined;
|
|
44
44
|
type?: "content" | "summary" | "info" | undefined;
|
|
45
45
|
};
|
|
46
|
-
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<
|
|
46
|
+
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
47
47
|
optional: true;
|
|
48
48
|
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
49
49
|
optional: true;
|
|
@@ -68,7 +68,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{}, {
|
|
|
68
68
|
filter?: _backstage_plugin_catalog_react_alpha.EntityPredicate | undefined;
|
|
69
69
|
type?: "content" | "summary" | "info" | undefined;
|
|
70
70
|
};
|
|
71
|
-
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<
|
|
71
|
+
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
72
72
|
optional: true;
|
|
73
73
|
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
74
74
|
optional: true;
|
|
@@ -93,7 +93,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{}, {
|
|
|
93
93
|
filter?: _backstage_plugin_catalog_react_alpha.EntityPredicate | undefined;
|
|
94
94
|
type?: "content" | "summary" | "info" | undefined;
|
|
95
95
|
};
|
|
96
|
-
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<
|
|
96
|
+
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
97
97
|
optional: true;
|
|
98
98
|
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
99
99
|
optional: true;
|
package/dist/alpha.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
1
2
|
import { compatWrapper, convertLegacyRouteRefs } from '@backstage/core-compat-api';
|
|
2
3
|
import { createFrontendPlugin } from '@backstage/frontend-plugin-api';
|
|
3
|
-
import React from 'react';
|
|
4
4
|
import { catalogIndexRouteRef } from './routes.esm.js';
|
|
5
5
|
import { EntityCardBlueprint } from '@backstage/plugin-catalog-react/alpha';
|
|
6
6
|
|
|
@@ -9,7 +9,7 @@ const EntityGroupProfileCard = EntityCardBlueprint.make({
|
|
|
9
9
|
params: {
|
|
10
10
|
filter: "kind:group",
|
|
11
11
|
loader: async () => import('./components/Cards/Group/GroupProfile/GroupProfileCard.esm.js').then(
|
|
12
|
-
(m) => compatWrapper(/* @__PURE__ */
|
|
12
|
+
(m) => compatWrapper(/* @__PURE__ */ jsx(m.GroupProfileCard, {}))
|
|
13
13
|
)
|
|
14
14
|
}
|
|
15
15
|
});
|
|
@@ -18,7 +18,7 @@ const EntityMembersListCard = EntityCardBlueprint.make({
|
|
|
18
18
|
params: {
|
|
19
19
|
filter: "kind:group",
|
|
20
20
|
loader: async () => import('./components/Cards/Group/MembersList/MembersListCard.esm.js').then(
|
|
21
|
-
(m) => compatWrapper(/* @__PURE__ */
|
|
21
|
+
(m) => compatWrapper(/* @__PURE__ */ jsx(m.MembersListCard, {}))
|
|
22
22
|
)
|
|
23
23
|
}
|
|
24
24
|
});
|
|
@@ -27,7 +27,7 @@ const EntityOwnershipCard = EntityCardBlueprint.make({
|
|
|
27
27
|
params: {
|
|
28
28
|
filter: "kind:group,user",
|
|
29
29
|
loader: async () => import('./components/Cards/OwnershipCard/OwnershipCard.esm.js').then(
|
|
30
|
-
(m) => compatWrapper(/* @__PURE__ */
|
|
30
|
+
(m) => compatWrapper(/* @__PURE__ */ jsx(m.OwnershipCard, {}))
|
|
31
31
|
)
|
|
32
32
|
}
|
|
33
33
|
});
|
|
@@ -36,7 +36,7 @@ const EntityUserProfileCard = EntityCardBlueprint.make({
|
|
|
36
36
|
params: {
|
|
37
37
|
filter: "kind:user",
|
|
38
38
|
loader: async () => import('./components/Cards/User/UserProfileCard/UserProfileCard.esm.js').then(
|
|
39
|
-
(m) => compatWrapper(/* @__PURE__ */
|
|
39
|
+
(m) => compatWrapper(/* @__PURE__ */ jsx(m.UserProfileCard, {}))
|
|
40
40
|
)
|
|
41
41
|
}
|
|
42
42
|
});
|
package/dist/alpha.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alpha.esm.js","sources":["../src/alpha.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 compatWrapper,\n convertLegacyRouteRefs,\n} from '@backstage/core-compat-api';\nimport { createFrontendPlugin } from '@backstage/frontend-plugin-api';\nimport
|
|
1
|
+
{"version":3,"file":"alpha.esm.js","sources":["../src/alpha.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 compatWrapper,\n convertLegacyRouteRefs,\n} from '@backstage/core-compat-api';\nimport { createFrontendPlugin } from '@backstage/frontend-plugin-api';\nimport { catalogIndexRouteRef } from './routes';\nimport { EntityCardBlueprint } from '@backstage/plugin-catalog-react/alpha';\n\n/** @alpha */\nconst EntityGroupProfileCard = EntityCardBlueprint.make({\n name: 'group-profile',\n params: {\n filter: 'kind:group',\n loader: async () =>\n import('./components/Cards/Group/GroupProfile/GroupProfileCard').then(m =>\n compatWrapper(<m.GroupProfileCard />),\n ),\n },\n});\n\n/** @alpha */\nconst EntityMembersListCard = EntityCardBlueprint.make({\n name: 'members-list',\n params: {\n filter: 'kind:group',\n loader: async () =>\n import('./components/Cards/Group/MembersList/MembersListCard').then(m =>\n compatWrapper(<m.MembersListCard />),\n ),\n },\n});\n\n/** @alpha */\nconst EntityOwnershipCard = EntityCardBlueprint.make({\n name: 'ownership',\n params: {\n filter: 'kind:group,user',\n loader: async () =>\n import('./components/Cards/OwnershipCard/OwnershipCard').then(m =>\n compatWrapper(<m.OwnershipCard />),\n ),\n },\n});\n\n/** @alpha */\nconst EntityUserProfileCard = EntityCardBlueprint.make({\n name: 'user-profile',\n params: {\n filter: 'kind:user',\n loader: async () =>\n import('./components/Cards/User/UserProfileCard/UserProfileCard').then(\n m => compatWrapper(<m.UserProfileCard />),\n ),\n },\n});\n\n/** @alpha */\nexport default createFrontendPlugin({\n id: 'org',\n extensions: [\n EntityGroupProfileCard,\n EntityMembersListCard,\n EntityOwnershipCard,\n EntityUserProfileCard,\n ],\n externalRoutes: convertLegacyRouteRefs({\n catalogIndex: catalogIndexRouteRef,\n }),\n});\n"],"names":[],"mappings":";;;;;;AAyBA,MAAM,sBAAA,GAAyB,oBAAoB,IAAK,CAAA;AAAA,EACtD,IAAM,EAAA,eAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA,YAAA;AAAA,IACR,MAAQ,EAAA,YACN,OAAO,+DAAwD,CAAE,CAAA,IAAA;AAAA,MAAK,OACpE,aAAc,iBAAA,GAAA,CAAC,CAAE,CAAA,gBAAA,EAAF,EAAmB,CAAE;AAAA;AACtC;AAEN,CAAC,CAAA;AAGD,MAAM,qBAAA,GAAwB,oBAAoB,IAAK,CAAA;AAAA,EACrD,IAAM,EAAA,cAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA,YAAA;AAAA,IACR,MAAQ,EAAA,YACN,OAAO,6DAAsD,CAAE,CAAA,IAAA;AAAA,MAAK,OAClE,aAAc,iBAAA,GAAA,CAAC,CAAE,CAAA,eAAA,EAAF,EAAkB,CAAE;AAAA;AACrC;AAEN,CAAC,CAAA;AAGD,MAAM,mBAAA,GAAsB,oBAAoB,IAAK,CAAA;AAAA,EACnD,IAAM,EAAA,WAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA,iBAAA;AAAA,IACR,MAAQ,EAAA,YACN,OAAO,uDAAgD,CAAE,CAAA,IAAA;AAAA,MAAK,OAC5D,aAAc,iBAAA,GAAA,CAAC,CAAE,CAAA,aAAA,EAAF,EAAgB,CAAE;AAAA;AACnC;AAEN,CAAC,CAAA;AAGD,MAAM,qBAAA,GAAwB,oBAAoB,IAAK,CAAA;AAAA,EACrD,IAAM,EAAA,cAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA,WAAA;AAAA,IACR,MAAQ,EAAA,YACN,OAAO,gEAAyD,CAAE,CAAA,IAAA;AAAA,MAChE,OAAK,aAAc,iBAAA,GAAA,CAAC,CAAE,CAAA,eAAA,EAAF,EAAkB,CAAE;AAAA;AAC1C;AAEN,CAAC,CAAA;AAGD,YAAe,oBAAqB,CAAA;AAAA,EAClC,EAAI,EAAA,KAAA;AAAA,EACJ,UAAY,EAAA;AAAA,IACV,sBAAA;AAAA,IACA,qBAAA;AAAA,IACA,mBAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA,gBAAgB,sBAAuB,CAAA;AAAA,IACrC,YAAc,EAAA;AAAA,GACf;AACH,CAAC,CAAA;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
1
2
|
import { stringifyEntityRef, RELATION_PARENT_OF, RELATION_CHILD_OF, ANNOTATION_LOCATION, ANNOTATION_EDIT_URL } from '@backstage/catalog-model';
|
|
2
3
|
import { InfoCard, Avatar, Link } from '@backstage/core-components';
|
|
3
4
|
import Box from '@material-ui/core/Box';
|
|
@@ -9,7 +10,7 @@ import ListItemIcon from '@material-ui/core/ListItemIcon';
|
|
|
9
10
|
import ListItemText from '@material-ui/core/ListItemText';
|
|
10
11
|
import Tooltip from '@material-ui/core/Tooltip';
|
|
11
12
|
import { catalogApiRef, useEntity, getEntityRelations, EntityRefLinks } from '@backstage/plugin-catalog-react';
|
|
12
|
-
import
|
|
13
|
+
import { useCallback } from 'react';
|
|
13
14
|
import { useApi, alertApiRef } from '@backstage/core-plugin-api';
|
|
14
15
|
import AccountTreeIcon from '@material-ui/icons/AccountTree';
|
|
15
16
|
import Alert from '@material-ui/lab/Alert';
|
|
@@ -21,7 +22,10 @@ import { LinksGroup } from '../../Meta/LinksGroup.esm.js';
|
|
|
21
22
|
import { useEntityPermission } from '@backstage/plugin-catalog-react/alpha';
|
|
22
23
|
import { catalogEntityRefreshPermission } from '@backstage/plugin-catalog-common/alpha';
|
|
23
24
|
|
|
24
|
-
const CardTitle = (props) => /* @__PURE__ */
|
|
25
|
+
const CardTitle = (props) => /* @__PURE__ */ jsxs(Box, { display: "flex", alignItems: "center", children: [
|
|
26
|
+
/* @__PURE__ */ jsx(GroupIcon, { fontSize: "inherit" }),
|
|
27
|
+
/* @__PURE__ */ jsx(Box, { ml: 1, children: props.title })
|
|
28
|
+
] });
|
|
25
29
|
const GroupProfileCard = (props) => {
|
|
26
30
|
const catalogApi = useApi(catalogApiRef);
|
|
27
31
|
const alertApi = useApi(alertApiRef);
|
|
@@ -38,7 +42,7 @@ const GroupProfileCard = (props) => {
|
|
|
38
42
|
});
|
|
39
43
|
}, [catalogApi, alertApi, group]);
|
|
40
44
|
if (!group) {
|
|
41
|
-
return /* @__PURE__ */
|
|
45
|
+
return /* @__PURE__ */ jsx(Alert, { severity: "error", children: "Group not found" });
|
|
42
46
|
}
|
|
43
47
|
const {
|
|
44
48
|
metadata: { name, description, title, annotations, links },
|
|
@@ -55,63 +59,83 @@ const GroupProfileCard = (props) => {
|
|
|
55
59
|
const entityMetadataEditUrl = group.metadata.annotations?.[ANNOTATION_EDIT_URL];
|
|
56
60
|
const displayName = profile?.displayName ?? title ?? name;
|
|
57
61
|
const emailHref = profile?.email ? `mailto:${profile.email}` : "#";
|
|
58
|
-
const infoCardAction = entityMetadataEditUrl ? /* @__PURE__ */
|
|
62
|
+
const infoCardAction = entityMetadataEditUrl ? /* @__PURE__ */ jsx(
|
|
59
63
|
IconButton,
|
|
60
64
|
{
|
|
61
65
|
"aria-label": "Edit",
|
|
62
66
|
title: "Edit Metadata",
|
|
63
67
|
component: Link,
|
|
64
|
-
to: entityMetadataEditUrl
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
) : /* @__PURE__ */
|
|
68
|
-
return /* @__PURE__ */
|
|
68
|
+
to: entityMetadataEditUrl,
|
|
69
|
+
children: /* @__PURE__ */ jsx(EditIcon, {})
|
|
70
|
+
}
|
|
71
|
+
) : /* @__PURE__ */ jsx(IconButton, { "aria-label": "Edit", disabled: true, title: "Edit Metadata", children: /* @__PURE__ */ jsx(EditIcon, {}) });
|
|
72
|
+
return /* @__PURE__ */ jsx(
|
|
69
73
|
InfoCard,
|
|
70
74
|
{
|
|
71
|
-
title: /* @__PURE__ */
|
|
75
|
+
title: /* @__PURE__ */ jsx(CardTitle, { title: displayName }),
|
|
72
76
|
subheader: description,
|
|
73
77
|
variant: props.variant,
|
|
74
|
-
action: /* @__PURE__ */
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
"aria-label": "Refresh",
|
|
78
|
-
title: "Schedule entity refresh",
|
|
79
|
-
onClick: refreshEntity
|
|
80
|
-
},
|
|
81
|
-
/* @__PURE__ */ React.createElement(CachedIcon, null)
|
|
82
|
-
), infoCardAction)
|
|
83
|
-
},
|
|
84
|
-
/* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3 }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, sm: 2, xl: 1 }, /* @__PURE__ */ React.createElement(Avatar, { displayName, picture: profile?.picture })), /* @__PURE__ */ React.createElement(Grid, { item: true, md: 10, xl: 11 }, /* @__PURE__ */ React.createElement(List, null, profile?.email && /* @__PURE__ */ React.createElement(ListItem, null, /* @__PURE__ */ React.createElement(ListItemIcon, null, /* @__PURE__ */ React.createElement(Tooltip, { title: "Email" }, /* @__PURE__ */ React.createElement(EmailIcon, null))), /* @__PURE__ */ React.createElement(
|
|
85
|
-
ListItemText,
|
|
86
|
-
{
|
|
87
|
-
primary: /* @__PURE__ */ React.createElement(Link, { to: emailHref }, profile.email),
|
|
88
|
-
secondary: "Email"
|
|
89
|
-
}
|
|
90
|
-
)), /* @__PURE__ */ React.createElement(ListItem, null, /* @__PURE__ */ React.createElement(ListItemIcon, null, /* @__PURE__ */ React.createElement(Tooltip, { title: "Parent Group" }, /* @__PURE__ */ React.createElement(AccountTreeIcon, null))), /* @__PURE__ */ React.createElement(
|
|
91
|
-
ListItemText,
|
|
92
|
-
{
|
|
93
|
-
primary: parentRelations.length ? /* @__PURE__ */ React.createElement(
|
|
94
|
-
EntityRefLinks,
|
|
78
|
+
action: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
79
|
+
allowRefresh && canRefresh && /* @__PURE__ */ jsx(
|
|
80
|
+
IconButton,
|
|
95
81
|
{
|
|
96
|
-
|
|
97
|
-
|
|
82
|
+
"aria-label": "Refresh",
|
|
83
|
+
title: "Schedule entity refresh",
|
|
84
|
+
onClick: refreshEntity,
|
|
85
|
+
children: /* @__PURE__ */ jsx(CachedIcon, {})
|
|
98
86
|
}
|
|
99
|
-
)
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
87
|
+
),
|
|
88
|
+
infoCardAction
|
|
89
|
+
] }),
|
|
90
|
+
children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 3, children: [
|
|
91
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, sm: 2, xl: 1, children: /* @__PURE__ */ jsx(Avatar, { displayName, picture: profile?.picture }) }),
|
|
92
|
+
/* @__PURE__ */ jsx(Grid, { item: true, md: 10, xl: 11, children: /* @__PURE__ */ jsxs(List, { children: [
|
|
93
|
+
profile?.email && /* @__PURE__ */ jsxs(ListItem, { children: [
|
|
94
|
+
/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Tooltip, { title: "Email", children: /* @__PURE__ */ jsx(EmailIcon, {}) }) }),
|
|
95
|
+
/* @__PURE__ */ jsx(
|
|
96
|
+
ListItemText,
|
|
97
|
+
{
|
|
98
|
+
primary: /* @__PURE__ */ jsx(Link, { to: emailHref, children: profile.email }),
|
|
99
|
+
secondary: "Email"
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
|
+
] }),
|
|
103
|
+
/* @__PURE__ */ jsxs(ListItem, { children: [
|
|
104
|
+
/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Tooltip, { title: "Parent Group", children: /* @__PURE__ */ jsx(AccountTreeIcon, {}) }) }),
|
|
105
|
+
/* @__PURE__ */ jsx(
|
|
106
|
+
ListItemText,
|
|
107
|
+
{
|
|
108
|
+
primary: parentRelations.length ? /* @__PURE__ */ jsx(
|
|
109
|
+
EntityRefLinks,
|
|
110
|
+
{
|
|
111
|
+
entityRefs: parentRelations,
|
|
112
|
+
defaultKind: "Group"
|
|
113
|
+
}
|
|
114
|
+
) : "N/A",
|
|
115
|
+
secondary: "Parent Group"
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
] }),
|
|
119
|
+
/* @__PURE__ */ jsxs(ListItem, { children: [
|
|
120
|
+
/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Tooltip, { title: "Child Groups", children: /* @__PURE__ */ jsx(GroupIcon, {}) }) }),
|
|
121
|
+
/* @__PURE__ */ jsx(
|
|
122
|
+
ListItemText,
|
|
123
|
+
{
|
|
124
|
+
primary: childRelations.length ? /* @__PURE__ */ jsx(
|
|
125
|
+
EntityRefLinks,
|
|
126
|
+
{
|
|
127
|
+
entityRefs: childRelations,
|
|
128
|
+
defaultKind: "Group"
|
|
129
|
+
}
|
|
130
|
+
) : "N/A",
|
|
131
|
+
secondary: "Child Groups"
|
|
132
|
+
}
|
|
133
|
+
)
|
|
134
|
+
] }),
|
|
135
|
+
props?.showLinks && /* @__PURE__ */ jsx(LinksGroup, { links })
|
|
136
|
+
] }) })
|
|
137
|
+
] })
|
|
138
|
+
}
|
|
115
139
|
);
|
|
116
140
|
};
|
|
117
141
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupProfileCard.esm.js","sources":["../../../../../src/components/Cards/Group/GroupProfile/GroupProfileCard.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 {\n ANNOTATION_EDIT_URL,\n ANNOTATION_LOCATION,\n GroupEntity,\n RELATION_CHILD_OF,\n RELATION_PARENT_OF,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport {\n Avatar,\n InfoCard,\n InfoCardVariants,\n Link,\n} from '@backstage/core-components';\nimport Box from '@material-ui/core/Box';\nimport Grid from '@material-ui/core/Grid';\nimport IconButton from '@material-ui/core/IconButton';\nimport List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport {\n EntityRefLinks,\n catalogApiRef,\n getEntityRelations,\n useEntity,\n} from '@backstage/plugin-catalog-react';\nimport React, { useCallback } from 'react';\nimport { alertApiRef, useApi } from '@backstage/core-plugin-api';\n\nimport AccountTreeIcon from '@material-ui/icons/AccountTree';\nimport Alert from '@material-ui/lab/Alert';\nimport CachedIcon from '@material-ui/icons/Cached';\nimport EditIcon from '@material-ui/icons/Edit';\nimport EmailIcon from '@material-ui/icons/Email';\nimport GroupIcon from '@material-ui/icons/Group';\nimport { LinksGroup } from '../../Meta';\nimport { useEntityPermission } from '@backstage/plugin-catalog-react/alpha';\nimport { catalogEntityRefreshPermission } from '@backstage/plugin-catalog-common/alpha';\n\nconst CardTitle = (props: { title: string }) => (\n <Box display=\"flex\" alignItems=\"center\">\n <GroupIcon fontSize=\"inherit\" />\n <Box ml={1}>{props.title}</Box>\n </Box>\n);\n\n/** @public */\nexport const GroupProfileCard = (props: {\n variant?: InfoCardVariants;\n showLinks?: boolean;\n}) => {\n const catalogApi = useApi(catalogApiRef);\n const alertApi = useApi(alertApiRef);\n const { entity: group } = useEntity<GroupEntity>();\n const { allowed: canRefresh } = useEntityPermission(\n catalogEntityRefreshPermission,\n );\n\n const refreshEntity = useCallback(async () => {\n await catalogApi.refreshEntity(stringifyEntityRef(group));\n alertApi.post({\n message: 'Refresh scheduled',\n severity: 'info',\n display: 'transient',\n });\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, title, annotations, links },\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 ?? title ?? 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={props.variant}\n action={\n <>\n {allowRefresh && canRefresh && (\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 primary={<Link to={emailHref}>{profile.email}</Link>}\n secondary=\"Email\"\n />\n </ListItem>\n )}\n <ListItem>\n <ListItemIcon>\n <Tooltip title=\"Parent Group\">\n <AccountTreeIcon />\n </Tooltip>\n </ListItemIcon>\n <ListItemText\n primary={\n parentRelations.length ? (\n <EntityRefLinks\n entityRefs={parentRelations}\n defaultKind=\"Group\"\n />\n ) : (\n 'N/A'\n )\n }\n secondary=\"Parent Group\"\n />\n </ListItem>\n <ListItem>\n <ListItemIcon>\n <Tooltip title=\"Child Groups\">\n <GroupIcon />\n </Tooltip>\n </ListItemIcon>\n <ListItemText\n primary={\n childRelations.length ? (\n <EntityRefLinks\n entityRefs={childRelations}\n defaultKind=\"Group\"\n />\n ) : (\n 'N/A'\n )\n }\n secondary=\"Child Groups\"\n />\n </ListItem>\n {props?.showLinks && <LinksGroup links={links} />}\n </List>\n </Grid>\n </Grid>\n </InfoCard>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAyDA,MAAM,SAAA,GAAY,CAAC,KACjB,qBAAA,KAAA,CAAA,aAAA,CAAC,OAAI,OAAQ,EAAA,MAAA,EAAO,YAAW,QAC7B,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,aAAU,QAAS,EAAA,SAAA,EAAU,mBAC7B,KAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EA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AAA,aAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,OAAA,EACE,gBAAgB,MACd,mBAAA,KAAA,CAAA,aAAA;AAAA,UAAC,cAAA;AAAA,UAAA;AAAA,YACC,UAAY,EAAA,eAAA;AAAA,YACZ,WAAY,EAAA;AAAA;AAAA,SAGd,GAAA,KAAA;AAAA,QAGJ,SAAU,EAAA;AAAA;AAAA,KAEd,CAAA,kBACC,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,IAAA,sCACE,YACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,OAAQ,EAAA,EAAA,KAAA,EAAM,cACb,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,SAAU,EAAA,IAAA,CACb,CACF,CACA,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,OAAA,EACE,eAAe,MACb,mBAAA,KAAA,CAAA,aAAA;AAAA,UAAC,cAAA;AAAA,UAAA;AAAA,YACC,UAAY,EAAA,cAAA;AAAA,YACZ,WAAY,EAAA;AAAA;AAAA,SAGd,GAAA,KAAA;AAAA,QAGJ,SAAU,EAAA;AAAA;AAAA,KAEd,GACC,KAAO,EAAA,SAAA,wCAAc,UAAW,EAAA,EAAA,KAAA,EAAc,CACjD,CACF,CACF;AAAA,GACF;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"GroupProfileCard.esm.js","sources":["../../../../../src/components/Cards/Group/GroupProfile/GroupProfileCard.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 {\n ANNOTATION_EDIT_URL,\n ANNOTATION_LOCATION,\n GroupEntity,\n RELATION_CHILD_OF,\n RELATION_PARENT_OF,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport {\n Avatar,\n InfoCard,\n InfoCardVariants,\n Link,\n} from '@backstage/core-components';\nimport Box from '@material-ui/core/Box';\nimport Grid from '@material-ui/core/Grid';\nimport IconButton from '@material-ui/core/IconButton';\nimport List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport {\n EntityRefLinks,\n catalogApiRef,\n getEntityRelations,\n useEntity,\n} from '@backstage/plugin-catalog-react';\nimport { useCallback } from 'react';\nimport { alertApiRef, useApi } from '@backstage/core-plugin-api';\n\nimport AccountTreeIcon from '@material-ui/icons/AccountTree';\nimport Alert from '@material-ui/lab/Alert';\nimport CachedIcon from '@material-ui/icons/Cached';\nimport EditIcon from '@material-ui/icons/Edit';\nimport EmailIcon from '@material-ui/icons/Email';\nimport GroupIcon from '@material-ui/icons/Group';\nimport { LinksGroup } from '../../Meta';\nimport { useEntityPermission } from '@backstage/plugin-catalog-react/alpha';\nimport { catalogEntityRefreshPermission } from '@backstage/plugin-catalog-common/alpha';\n\nconst CardTitle = (props: { title: string }) => (\n <Box display=\"flex\" alignItems=\"center\">\n <GroupIcon fontSize=\"inherit\" />\n <Box ml={1}>{props.title}</Box>\n </Box>\n);\n\n/** @public */\nexport const GroupProfileCard = (props: {\n variant?: InfoCardVariants;\n showLinks?: boolean;\n}) => {\n const catalogApi = useApi(catalogApiRef);\n const alertApi = useApi(alertApiRef);\n const { entity: group } = useEntity<GroupEntity>();\n const { allowed: canRefresh } = useEntityPermission(\n catalogEntityRefreshPermission,\n );\n\n const refreshEntity = useCallback(async () => {\n await catalogApi.refreshEntity(stringifyEntityRef(group));\n alertApi.post({\n message: 'Refresh scheduled',\n severity: 'info',\n display: 'transient',\n });\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, title, annotations, links },\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 ?? title ?? 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={props.variant}\n action={\n <>\n {allowRefresh && canRefresh && (\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 primary={<Link to={emailHref}>{profile.email}</Link>}\n secondary=\"Email\"\n />\n </ListItem>\n )}\n <ListItem>\n <ListItemIcon>\n <Tooltip title=\"Parent Group\">\n <AccountTreeIcon />\n </Tooltip>\n </ListItemIcon>\n <ListItemText\n primary={\n parentRelations.length ? (\n <EntityRefLinks\n entityRefs={parentRelations}\n defaultKind=\"Group\"\n />\n ) : (\n 'N/A'\n )\n }\n secondary=\"Parent Group\"\n />\n </ListItem>\n <ListItem>\n <ListItemIcon>\n <Tooltip title=\"Child Groups\">\n <GroupIcon />\n </Tooltip>\n </ListItemIcon>\n <ListItemText\n primary={\n childRelations.length ? (\n <EntityRefLinks\n entityRefs={childRelations}\n defaultKind=\"Group\"\n />\n ) : (\n 'N/A'\n )\n }\n secondary=\"Child Groups\"\n />\n </ListItem>\n {props?.showLinks && <LinksGroup links={links} />}\n </List>\n </Grid>\n </Grid>\n </InfoCard>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAyDA,MAAM,SAAA,GAAY,CAAC,KACjB,qBAAA,IAAA,CAAC,OAAI,OAAQ,EAAA,MAAA,EAAO,YAAW,QAC7B,EAAA,QAAA,EAAA;AAAA,kBAAC,GAAA,CAAA,SAAA,EAAA,EAAU,UAAS,SAAU,EAAA,CAAA;AAAA,kBAC7B,GAAA,CAAA,GAAA,EAAA,EAAI,EAAI,EAAA,CAAA,EAAI,gBAAM,KAAM,EAAA;AAAA,CAC3B,EAAA,CAAA;AAIW,MAAA,gBAAA,GAAmB,CAAC,KAG3B,KAAA;AACJ,EAAM,MAAA,UAAA,GAAa,OAAO,aAAa,CAAA;AACvC,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAA,MAAM,EAAE,MAAA,EAAQ,KAAM,EAAA,GAAI,SAAuB,EAAA;AACjD,EAAM,MAAA,EAAE,OAAS,EAAA,UAAA,EAAe,GAAA,mBAAA;AAAA,IAC9B;AAAA,GACF;AAEA,EAAM,MAAA,aAAA,GAAgB,YAAY,YAAY;AAC5C,IAAA,MAAM,UAAW,CAAA,aAAA,CAAc,kBAAmB,CAAA,KAAK,CAAC,CAAA;AACxD,IAAA,QAAA,CAAS,IAAK,CAAA;AAAA,MACZ,OA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GAAA;AAAA,kBAAC,cAAA;AAAA,kBAAA;AAAA,oBACC,UAAY,EAAA,cAAA;AAAA,oBACZ,WAAY,EAAA;AAAA;AAAA,iBAGd,GAAA,KAAA;AAAA,gBAGJ,SAAU,EAAA;AAAA;AAAA;AACZ,WACF,EAAA,CAAA;AAAA,UACC,KAAO,EAAA,SAAA,oBAAc,GAAA,CAAA,UAAA,EAAA,EAAW,KAAc,EAAA;AAAA,SAAA,EACjD,CACF,EAAA;AAAA,OACF,EAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
1
2
|
import { stringifyEntityRef, DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
|
2
3
|
import { useEntity, catalogApiRef, EntityRefLink } from '@backstage/plugin-catalog-react';
|
|
3
4
|
import Box from '@material-ui/core/Box';
|
|
@@ -6,7 +7,7 @@ import Switch from '@material-ui/core/Switch';
|
|
|
6
7
|
import Typography from '@material-ui/core/Typography';
|
|
7
8
|
import { makeStyles, createStyles } from '@material-ui/core/styles';
|
|
8
9
|
import Pagination from '@material-ui/lab/Pagination';
|
|
9
|
-
import
|
|
10
|
+
import { useState } from 'react';
|
|
10
11
|
import useAsync from 'react-use/esm/useAsync';
|
|
11
12
|
import { Progress, ResponseErrorPanel, InfoCard, Avatar, Link, OverflowTooltip } from '@backstage/core-components';
|
|
12
13
|
import { useApi } from '@backstage/core-plugin-api';
|
|
@@ -38,44 +39,48 @@ const MemberComponent = (props) => {
|
|
|
38
39
|
spec: { profile }
|
|
39
40
|
} = props.member;
|
|
40
41
|
const displayName = profile?.displayName ?? metaName;
|
|
41
|
-
return /* @__PURE__ */
|
|
42
|
+
return /* @__PURE__ */ jsx(Box, { className: classes.card, children: /* @__PURE__ */ jsxs(
|
|
42
43
|
Box,
|
|
43
44
|
{
|
|
44
45
|
display: "flex",
|
|
45
46
|
flexDirection: "column",
|
|
46
47
|
m: 3,
|
|
47
48
|
alignItems: "center",
|
|
48
|
-
justifyContent: "center"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
49
|
+
justifyContent: "center",
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ jsx(
|
|
52
|
+
Avatar,
|
|
53
|
+
{
|
|
54
|
+
displayName,
|
|
55
|
+
picture: profile?.picture,
|
|
56
|
+
classes
|
|
57
|
+
}
|
|
58
|
+
),
|
|
59
|
+
/* @__PURE__ */ jsxs(
|
|
60
|
+
Box,
|
|
61
|
+
{
|
|
62
|
+
pt: 2,
|
|
63
|
+
sx: {
|
|
64
|
+
width: "100%"
|
|
65
|
+
},
|
|
66
|
+
textAlign: "center",
|
|
67
|
+
children: [
|
|
68
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h6", children: /* @__PURE__ */ jsx(
|
|
69
|
+
EntityRefLink,
|
|
70
|
+
{
|
|
71
|
+
"data-testid": "user-link",
|
|
72
|
+
entityRef: props.member,
|
|
73
|
+
title: displayName
|
|
74
|
+
}
|
|
75
|
+
) }),
|
|
76
|
+
profile?.email && /* @__PURE__ */ jsx(Link, { to: `mailto:${profile.email}`, children: /* @__PURE__ */ jsx(OverflowTooltip, { text: profile.email }) }),
|
|
77
|
+
description && /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: /* @__PURE__ */ jsx(OverflowTooltip, { text: description, line: 5 }) })
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
) });
|
|
79
84
|
};
|
|
80
85
|
const useListStyles = makeStyles(
|
|
81
86
|
(theme) => ({
|
|
@@ -112,7 +117,7 @@ const MembersListCard = (props) => {
|
|
|
112
117
|
const catalogApi = useApi(catalogApiRef);
|
|
113
118
|
const displayName = profile?.displayName ?? groupName;
|
|
114
119
|
const groupNamespace = grpNamespace || DEFAULT_NAMESPACE;
|
|
115
|
-
const [page, setPage] =
|
|
120
|
+
const [page, setPage] = useState(1);
|
|
116
121
|
const pageChange = (_, pageIndex) => {
|
|
117
122
|
setPage(pageIndex);
|
|
118
123
|
};
|
|
@@ -157,13 +162,13 @@ const MembersListCard = (props) => {
|
|
|
157
162
|
)
|
|
158
163
|
);
|
|
159
164
|
if (loading) {
|
|
160
|
-
return /* @__PURE__ */
|
|
165
|
+
return /* @__PURE__ */ jsx(Progress, {});
|
|
161
166
|
} else if (error) {
|
|
162
|
-
return /* @__PURE__ */
|
|
167
|
+
return /* @__PURE__ */ jsx(ResponseErrorPanel, { error });
|
|
163
168
|
}
|
|
164
169
|
const nbPages = Math.ceil((members?.length || 0) / pageSize);
|
|
165
170
|
const paginationLabel = nbPages < 2 ? "" : `, page ${page} of ${nbPages}`;
|
|
166
|
-
const pagination = /* @__PURE__ */
|
|
171
|
+
const pagination = /* @__PURE__ */ jsx(
|
|
167
172
|
Pagination,
|
|
168
173
|
{
|
|
169
174
|
count: nbPages,
|
|
@@ -175,32 +180,42 @@ const MembersListCard = (props) => {
|
|
|
175
180
|
);
|
|
176
181
|
let memberList;
|
|
177
182
|
if (members && members.length > 0) {
|
|
178
|
-
memberList = /* @__PURE__ */
|
|
183
|
+
memberList = /* @__PURE__ */ jsx(Box, { className: classes.memberList, children: members.slice(pageSize * (page - 1), pageSize * page).map((member) => /* @__PURE__ */ jsx(MemberComponent, { member }, stringifyEntityRef(member))) });
|
|
179
184
|
} else {
|
|
180
|
-
memberList = /* @__PURE__ */
|
|
185
|
+
memberList = /* @__PURE__ */ jsx(Box, { p: 2, children: /* @__PURE__ */ jsxs(Typography, { children: [
|
|
186
|
+
"This group has no ",
|
|
187
|
+
memberDisplayTitle.toLocaleLowerCase(),
|
|
188
|
+
"."
|
|
189
|
+
] }) });
|
|
181
190
|
}
|
|
182
|
-
return /* @__PURE__ */
|
|
191
|
+
return /* @__PURE__ */ jsx(Grid, { item: true, className: classes.root, children: /* @__PURE__ */ jsxs(
|
|
183
192
|
InfoCard,
|
|
184
193
|
{
|
|
185
194
|
title: `${memberDisplayTitle} (${members?.length || 0}${paginationLabel})`,
|
|
186
195
|
subheader: `of ${displayName}`,
|
|
187
196
|
...nbPages <= 1 ? {} : { actions: pagination },
|
|
188
197
|
className: classes.root,
|
|
189
|
-
cardClassName: classes.cardContent
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
198
|
+
cardClassName: classes.cardContent,
|
|
199
|
+
children: [
|
|
200
|
+
showAggregateMembersToggle && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
201
|
+
"Direct Members",
|
|
202
|
+
/* @__PURE__ */ jsx(
|
|
203
|
+
Switch,
|
|
204
|
+
{
|
|
205
|
+
color: "primary",
|
|
206
|
+
checked: showAggregateMembers,
|
|
207
|
+
onChange: () => {
|
|
208
|
+
setShowAggregateMembers(!showAggregateMembers);
|
|
209
|
+
},
|
|
210
|
+
inputProps: { "aria-label": "Users Type Switch" }
|
|
211
|
+
}
|
|
212
|
+
),
|
|
213
|
+
"Aggregated Members"
|
|
214
|
+
] }),
|
|
215
|
+
showAggregateMembers && loadingDescendantMembers ? /* @__PURE__ */ jsx(Progress, {}) : memberList
|
|
216
|
+
]
|
|
217
|
+
}
|
|
218
|
+
) });
|
|
204
219
|
};
|
|
205
220
|
|
|
206
221
|
export { MembersListCard };
|