@rh-support/manage 2.5.258 → 2.5.259
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.
|
@@ -40,6 +40,6 @@ export const DefaultGroupSwitch = (props) => {
|
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
return (React.createElement(React.Fragment, null,
|
|
43
|
-
React.createElement(Switch, { "aria-label": "Toggle default group", "data-tracking-id": `group-user-toggle-default-${user.isDefault ? 'off' : 'on'}`, label: t('On'), id: id, isDisabled: isFetching || !user.contactSfId, isChecked: user.isDefault, onChange: (_event, isChecked) => handleToggle(isChecked) }),
|
|
43
|
+
React.createElement(Switch, { "aria-label": "Toggle default group", "data-tracking-id": `group-user-toggle-default-${user.isDefault ? 'off' : 'on'}`, label: user.isDefault ? t('On') : t('Off'), id: id, isDisabled: isFetching || !user.contactSfId, isChecked: user.isDefault, onChange: (_event, isChecked) => handleToggle(isChecked) }),
|
|
44
44
|
React.createElement(LoadingIndicator, { show: isFetching, size: "xs" })));
|
|
45
45
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ManageGroupUsers.d.ts","sourceRoot":"","sources":["../../../../../src/components/Groups/ManageGroupUsers/ManageGroupUsers.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ManageGroupUsers.d.ts","sourceRoot":"","sources":["../../../../../src/components/Groups/ManageGroupUsers/ManageGroupUsers.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAsC5D,eAAO,MAAM,gBAAgB,yBAiS5B,CAAC"}
|
|
@@ -7,12 +7,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { Button, Modal, ModalBody, ModalFooter, ModalHeader, ModalVariant, SearchInput } from '@patternfly/react-core';
|
|
10
|
+
import { Button, Modal, ModalBody, ModalFooter, ModalHeader, ModalVariant, SearchInput, Tooltip, } from '@patternfly/react-core';
|
|
11
11
|
import { ErrorBoundary, ToastNotification, usePrevious } from '@rh-support/components';
|
|
12
12
|
import { useGlobalStateContext } from '@rh-support/react-context';
|
|
13
13
|
import { ability, resourceActions, resources } from '@rh-support/user-permissions';
|
|
14
14
|
import isEmpty from 'lodash/isEmpty';
|
|
15
|
-
import React, { useEffect, useState } from 'react';
|
|
15
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
16
16
|
import { Trans, useTranslation } from 'react-i18next';
|
|
17
17
|
import { useLocation } from 'react-router-dom';
|
|
18
18
|
import { useCaseGroupMembers, useDeleteCaseGroupMember } from '../../../hooks/useCaseGroupGraphQL';
|
|
@@ -24,15 +24,42 @@ import { GroupSelect } from '../GroupSelect';
|
|
|
24
24
|
// import { GroupUserPermissionsSelect } from '../GroupUserPermissionsSelect';
|
|
25
25
|
const RemoveMemberButton = ({ user, onRemove, isDisabled }) => {
|
|
26
26
|
const { t } = useTranslation();
|
|
27
|
-
|
|
27
|
+
const button = (React.createElement(Button, { variant: "link", isDanger: true, onClick: () => onRemove(user), isAriaDisabled: user.isOrgAdmin || isDisabled }, t('Remove')));
|
|
28
|
+
if (user.isOrgAdmin) {
|
|
29
|
+
return (React.createElement(Tooltip, { content: t('Organization Administrators cannot be removed because they have access to all groups') }, button));
|
|
30
|
+
}
|
|
31
|
+
return button;
|
|
28
32
|
};
|
|
29
33
|
export const ManageGroupUsers = () => {
|
|
30
34
|
const { t } = useTranslation();
|
|
31
35
|
const location = useLocation();
|
|
32
|
-
const { globalMetadataState: { loggedInUsersAccount }, } = useGlobalStateContext();
|
|
36
|
+
const { globalMetadataState: { loggedInUsersAccount, loggedInUser }, } = useGlobalStateContext();
|
|
33
37
|
const disableGroupSelect = !loggedInUsersAccount || !loggedInUsersAccount.data || !loggedInUsersAccount.data.accountNumber;
|
|
34
38
|
const [selectedGroup, setSelectedGroup] = useState();
|
|
35
39
|
const { data: groupUsers, loading: isFetching, fetchMembers, refetch } = useCaseGroupMembers();
|
|
40
|
+
const membersWithOrgAdmin = useMemo(() => {
|
|
41
|
+
var _a, _b, _c, _d;
|
|
42
|
+
const members = groupUsers || [];
|
|
43
|
+
const user = loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.data;
|
|
44
|
+
if (!(user === null || user === void 0 ? void 0 : user.isOrgAdmin) || !user.ssoUsername || !selectedGroup)
|
|
45
|
+
return members;
|
|
46
|
+
const alreadyPresent = members.some((m) => m.ssoUsername === user.ssoUsername);
|
|
47
|
+
if (alreadyPresent)
|
|
48
|
+
return members;
|
|
49
|
+
const syntheticEntry = {
|
|
50
|
+
firstName: (_a = user.firstName) !== null && _a !== void 0 ? _a : '',
|
|
51
|
+
lastName: (_b = user.lastName) !== null && _b !== void 0 ? _b : '',
|
|
52
|
+
isOrgAdmin: true,
|
|
53
|
+
access: true,
|
|
54
|
+
write: false,
|
|
55
|
+
isDefault: false,
|
|
56
|
+
ssoUsername: user.ssoUsername,
|
|
57
|
+
email: (_c = user.email) !== null && _c !== void 0 ? _c : '',
|
|
58
|
+
contactSfId: (_d = user.id) !== null && _d !== void 0 ? _d : '',
|
|
59
|
+
memberRecordId: '',
|
|
60
|
+
};
|
|
61
|
+
return [...members, syntheticEntry];
|
|
62
|
+
}, [groupUsers, loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.data, selectedGroup]);
|
|
36
63
|
const canManageCaseGroups = ability.can(resourceActions.CREATE, resources.CASE_GROUPS);
|
|
37
64
|
const [isAddMembersModalOpen, setIsAddMembersModalOpen] = useState(false);
|
|
38
65
|
const [memberToRemove, setMemberToRemove] = useState(null);
|
|
@@ -47,9 +74,9 @@ export const ManageGroupUsers = () => {
|
|
|
47
74
|
// ToastNotification.addDangerMessage(message);
|
|
48
75
|
// }
|
|
49
76
|
// set and sort fetched data.
|
|
50
|
-
const [initialData, setInitialData] = useState(
|
|
51
|
-
const [data, setData] = useState(
|
|
52
|
-
useEffect(() => setAllData(
|
|
77
|
+
const [initialData, setInitialData] = useState(membersWithOrgAdmin);
|
|
78
|
+
const [data, setData] = useState(membersWithOrgAdmin);
|
|
79
|
+
useEffect(() => setAllData(membersWithOrgAdmin || []), [membersWithOrgAdmin]);
|
|
53
80
|
function setAllData(users) {
|
|
54
81
|
setInitialData(users);
|
|
55
82
|
setData(users);
|
|
@@ -173,12 +200,12 @@ export const ManageGroupUsers = () => {
|
|
|
173
200
|
else {
|
|
174
201
|
setData(initialData);
|
|
175
202
|
}
|
|
176
|
-
}, [initialData, userSearch, setData, previousUserSearch,
|
|
203
|
+
}, [initialData, userSearch, setData, previousUserSearch, membersWithOrgAdmin]);
|
|
177
204
|
useEffect(() => {
|
|
178
205
|
if (location.pathname !== '/manage/groups') {
|
|
179
206
|
return;
|
|
180
207
|
}
|
|
181
|
-
setAllData(
|
|
208
|
+
setAllData(membersWithOrgAdmin || []);
|
|
182
209
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
183
210
|
}, [location.pathname, loggedInUsersAccount.data]);
|
|
184
211
|
return (React.createElement(React.Fragment, null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/manage",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.259",
|
|
4
4
|
"description": "Customer Support Manage App",
|
|
5
5
|
"author": "Jordan Eudy <jeudy100@gmail.com>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -78,12 +78,12 @@
|
|
|
78
78
|
"@patternfly/patternfly": "6.2.1",
|
|
79
79
|
"@patternfly/react-core": "6.2.1",
|
|
80
80
|
"@patternfly/react-table": "6.2.1",
|
|
81
|
-
"@rh-support/components": "2.5.
|
|
81
|
+
"@rh-support/components": "2.5.210",
|
|
82
82
|
"@rh-support/configs": "2.0.75",
|
|
83
|
-
"@rh-support/react-context": "2.5.
|
|
83
|
+
"@rh-support/react-context": "2.5.305",
|
|
84
84
|
"@rh-support/types": "2.0.26",
|
|
85
|
-
"@rh-support/user-permissions": "2.5.
|
|
86
|
-
"@rh-support/utils": "2.5.
|
|
85
|
+
"@rh-support/user-permissions": "2.5.157",
|
|
86
|
+
"@rh-support/utils": "2.5.138",
|
|
87
87
|
"@types/react-beautiful-dnd": "^13.0.0",
|
|
88
88
|
"i18next": "^23.15.0",
|
|
89
89
|
"lodash": ">=4.17.15",
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"defaults and supports es6-module",
|
|
103
103
|
"maintained node versions"
|
|
104
104
|
],
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "d8c5155f1ffe40e41ea5bb448df3b0418cc0ea0c"
|
|
106
106
|
}
|