@rh-support/manage 2.5.252 → 2.5.253

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.
@@ -1 +1 @@
1
- {"version":3,"file":"AddMembersModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/Groups/AddMembersModal/AddMembersModal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAM3E,OAAO,KAAgC,MAAM,OAAO,CAAC;AAIrD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAE9E,UAAU,MAAM;IACZ,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,eAAe,EAAE,uBAAuB,EAAE,CAAC;IACpD,QAAQ,CAAC,SAAS,EAAE,MAAM,IAAI,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;CAChC;AAED,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,MAAM,qBAyGrF"}
1
+ {"version":3,"file":"AddMembersModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/Groups/AddMembersModal/AddMembersModal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAM3E,OAAO,KAAgC,MAAM,OAAO,CAAC;AAIrD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAE9E,UAAU,MAAM;IACZ,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,eAAe,EAAE,uBAAuB,EAAE,CAAC;IACpD,QAAQ,CAAC,SAAS,EAAE,MAAM,IAAI,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;CAChC;AAED,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,MAAM,qBAuGrF"}
@@ -27,7 +27,6 @@ export function AddMembersModal({ group, existingMembers, onSuccess, onClose })
27
27
  firstName: m.firstName,
28
28
  lastName: m.lastName,
29
29
  }));
30
- const contactFilter = useCallback((contact) => !contact.isOrgAdmin, []);
31
30
  const onChange = useCallback((contacts) => {
32
31
  if (!(contacts === null || contacts === void 0 ? void 0 : contacts.length))
33
32
  return;
@@ -74,7 +73,7 @@ export function AddMembersModal({ group, existingMembers, onSuccess, onClose })
74
73
  return (React.createElement(Modal, { variant: ModalVariant.medium, isOpen: true, onClose: onClose, "aria-label": t('Add members to group') },
75
74
  React.createElement(ModalHeader, { title: t('Add members to {{groupName}}', { groupName: group.name }) }),
76
75
  React.createElement(ModalBody, null,
77
- React.createElement(CaseContactsSelectorExternal, { id: "add-members-contact-select", selectedAccountNumber: accountNumber, loggedInUserRights: loggedInUserRights.data, contactSsoUsername: contactSsoUsername, contactsToExclude: [...contactsToExclude, ...selectedContacts], contactFilter: contactFilter, selected: selectedContacts, onChange: onChange, onContactEnriched: () => { }, multiple: true, clearButton: true, isDisabled: isSubmitting, placeholder: t('Search by name or SSO username') })),
76
+ React.createElement(CaseContactsSelectorExternal, { id: "add-members-contact-select", selectedAccountNumber: accountNumber, loggedInUserRights: loggedInUserRights.data, contactSsoUsername: contactSsoUsername, contactsToExclude: [...contactsToExclude, ...selectedContacts], contactFilter: (contact) => !contact.isOrgAdmin, selected: selectedContacts, onChange: onChange, onContactEnriched: () => { }, multiple: true, clearButton: true, isDisabled: isSubmitting, placeholder: t('Search by name or SSO username') })),
78
77
  React.createElement(ModalFooter, null,
79
78
  React.createElement(Button, { key: "confirm", variant: "primary", onClick: onSubmit, isDisabled: selectedContacts.length === 0 || isSubmitting || createLoading, isLoading: isSubmitting, spinnerAriaValueText: isSubmitting ? t('Adding members') : undefined }, t('Add')),
80
79
  React.createElement(Button, { key: "cancel", variant: "link", onClick: onClose, isDisabled: isSubmitting }, t('Cancel')))));
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultGroupSwitch.d.ts","sourceRoot":"","sources":["../../../../../src/components/Groups/DefualtGroupSwitch/DefaultGroupSwitch.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAG3E,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAE9E,UAAU,MAAM;IACZ,KAAK,EAAE,UAAU,CAAC;IAClB,IAAI,EAAE,uBAAuB,CAAC;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,CAAC,IAAI,EAAE,uBAAuB,EAAE,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CACzE;AAED,eAAO,MAAM,kBAAkB,GAAI,OAAO,MAAM,sBA2C/C,CAAC"}
1
+ {"version":3,"file":"DefaultGroupSwitch.d.ts","sourceRoot":"","sources":["../../../../../src/components/Groups/DefualtGroupSwitch/DefaultGroupSwitch.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAG3E,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAE9E,UAAU,MAAM;IACZ,KAAK,EAAE,UAAU,CAAC;IAClB,IAAI,EAAE,uBAAuB,CAAC;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,CAAC,IAAI,EAAE,uBAAuB,EAAE,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CACzE;AAED,eAAO,MAAM,kBAAkB,GAAI,OAAO,MAAM,sBA+C/C,CAAC"}
@@ -18,6 +18,10 @@ export const DefaultGroupSwitch = (props) => {
18
18
  const { t } = useTranslation();
19
19
  const { toggleDefault, loading: isFetching } = useToggleDefaultGroup();
20
20
  const handleToggle = (isChecked) => __awaiter(void 0, void 0, void 0, function* () {
21
+ if (!user.contactSfId) {
22
+ ToastNotification.addDangerMessage(t('Cannot update default group: contact information is missing'));
23
+ return;
24
+ }
21
25
  try {
22
26
  onToggle(user, isChecked);
23
27
  const groupId = isChecked ? group.groupNum : null;
@@ -36,6 +40,6 @@ export const DefaultGroupSwitch = (props) => {
36
40
  }
37
41
  });
38
42
  return (React.createElement(React.Fragment, null,
39
- 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, 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: t('On'), id: id, isDisabled: isFetching || !user.contactSfId, isChecked: user.isDefault, onChange: (_event, isChecked) => handleToggle(isChecked) }),
40
44
  React.createElement(LoadingIndicator, { show: isFetching, size: "xs" })));
41
45
  };
@@ -1 +1 @@
1
- {"version":3,"file":"GroupSelect.d.ts","sourceRoot":"","sources":["../../../../../src/components/Groups/GroupSelect/GroupSelect.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAsC3E,OAAO,KAAmD,MAAM,OAAO,CAAC;AAMxE,UAAU,MAAM;IACZ,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,KAAK,IAAI,CAAC;IAC7C,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B;AAKD,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,sBA0mBxC,CAAC"}
1
+ {"version":3,"file":"GroupSelect.d.ts","sourceRoot":"","sources":["../../../../../src/components/Groups/GroupSelect/GroupSelect.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAuC3E,OAAO,KAAmD,MAAM,OAAO,CAAC;AAWxE,UAAU,MAAM;IACZ,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,KAAK,IAAI,CAAC;IAC7C,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B;AAKD,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,sBA6oBxC,CAAC"}
@@ -14,12 +14,13 @@ import TimesIcon from '@patternfly/react-icons/dist/js/icons/times-icon';
14
14
  import { AlertMessage, AlertType, ToastNotification, useConfirmation, usePrevious, useSelectKeyboardNavigator, } from '@rh-support/components';
15
15
  import { fetchCaseGroupsForSSO, setCaseGroups, useGlobalDispatchContext, useGlobalStateContext, } from '@rh-support/react-context';
16
16
  import { ability, resourceActions, resources } from '@rh-support/user-permissions';
17
+ import { GET_CASE_GROUP_MEMBERS } from '@rh-support/utils';
17
18
  import find from 'lodash/find';
18
19
  import isEmpty from 'lodash/isEmpty';
19
20
  import React, { useCallback, useEffect, useRef, useState } from 'react';
20
21
  import { Trans, useTranslation } from 'react-i18next';
21
22
  import { GroupSelectActions } from '../../../constants/GroupSelectActions';
22
- import { useCreateCaseGroup, useDeleteCaseGroup, useRenameCaseGroup } from '../../../hooks/useCaseGroupGraphQL';
23
+ import { useCreateCaseGroup, useCreateCaseGroupMember, useDeleteCaseGroup, useRenameCaseGroup, } from '../../../hooks/useCaseGroupGraphQL';
23
24
  const actions = GroupSelectActions;
24
25
  const unGroupedCaseGroupNumber = '-1';
25
26
  export const GroupSelect = (props) => {
@@ -42,6 +43,7 @@ export const GroupSelect = (props) => {
42
43
  const accountId = (_a = loggedInUsersAccount === null || loggedInUsersAccount === void 0 ? void 0 : loggedInUsersAccount.data) === null || _a === void 0 ? void 0 : _a.salesforceAccountId;
43
44
  // GraphQL hooks for mutations
44
45
  const { createGroup: createGroupMutation, loading: createLoading } = useCreateCaseGroup();
46
+ const { createMember: createMemberMutation } = useCreateCaseGroupMember();
45
47
  const { renameGroup: renameGroupMutation, loading: renameLoading } = useRenameCaseGroup();
46
48
  const { deleteGroup: deleteGroupMutation, loading: deleteLoading } = useDeleteCaseGroup();
47
49
  const hasFetchedFromGraphQL = useRef(false);
@@ -200,6 +202,7 @@ export const GroupSelect = (props) => {
200
202
  ToastNotification.addSuccessMessage(t('Group has been successfully deleted'));
201
203
  });
202
204
  const onAction = () => __awaiter(void 0, void 0, void 0, function* () {
205
+ var _a, _b, _c, _d;
203
206
  const needsUniqueName = action === actions.create || action === actions.rename || action === actions.duplicate;
204
207
  if (needsUniqueName && isUserInputAGroup()) {
205
208
  ToastNotification.addWarningMessage(t('Group already exists'));
@@ -261,10 +264,33 @@ export const GroupSelect = (props) => {
261
264
  break;
262
265
  }
263
266
  try {
267
+ const sourceGroup = getGroup(selectedGroup);
264
268
  const dupResponse = yield createGroupMutation(input, accountId);
265
269
  const dupRecord = dupResponse.redhat_support_uiapi.CaseGroup__cCreate.RedHatSupportRecord;
270
+ const newGroupId = dupRecord.Id;
271
+ if (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.groupNum) {
272
+ const membersResponse = yield apolloClient.query({
273
+ query: GET_CASE_GROUP_MEMBERS,
274
+ variables: { where: { Group__c: { eq: sourceGroup.groupNum } } },
275
+ fetchPolicy: 'network-only',
276
+ });
277
+ const sourceMembers = ((_d = (_c = (_b = (_a = membersResponse.data) === null || _a === void 0 ? void 0 : _a.redhat_support_uiapi) === null || _b === void 0 ? void 0 : _b.query) === null || _c === void 0 ? void 0 : _c.RedHatSupportCaseGroupMember__c) === null || _d === void 0 ? void 0 : _d.edges) ||
278
+ [];
279
+ const contactIds = sourceMembers
280
+ .filter(({ node }) => { var _a; return (_a = node.Contact__c) === null || _a === void 0 ? void 0 : _a.value; })
281
+ .map(({ node }) => node.Contact__c.value);
282
+ if (contactIds.length > 0) {
283
+ const results = yield Promise.allSettled(contactIds.map((contactId) => createMemberMutation(contactId, newGroupId)));
284
+ const failed = results.filter((r) => r.status === 'rejected');
285
+ if (failed.length > 0) {
286
+ ToastNotification.addWarningMessage(t('Group duplicated but {{count}} members could not be copied', {
287
+ count: failed.length,
288
+ }));
289
+ }
290
+ }
291
+ }
266
292
  const dupGroup = {
267
- groupNum: dupRecord.Id,
293
+ groupNum: newGroupId,
268
294
  name: dupRecord.Name.value,
269
295
  isPrivate: false,
270
296
  isDefault: false,
@@ -1 +1 @@
1
- {"version":3,"file":"ManageGroupUsers.d.ts","sourceRoot":"","sources":["../../../../../src/components/Groups/ManageGroupUsers/ManageGroupUsers.tsx"],"names":[],"mappings":"AAMA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAanD,eAAO,MAAM,gBAAgB,yBAgN5B,CAAC"}
1
+ {"version":3,"file":"ManageGroupUsers.d.ts","sourceRoot":"","sources":["../../../../../src/components/Groups/ManageGroupUsers/ManageGroupUsers.tsx"],"names":[],"mappings":"AAMA,OAAO,KAA8B,MAAM,OAAO,CAAC;AA0BnD,eAAO,MAAM,gBAAgB,yBA0Q5B,CAAC"}
@@ -7,21 +7,25 @@ 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 { SearchInput } from '@patternfly/react-core';
11
- import { ErrorBoundary, usePrevious } from '@rh-support/components';
10
+ import { Button, Modal, ModalBody, ModalFooter, ModalHeader, ModalVariant, SearchInput } from '@patternfly/react-core';
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
15
  import React, { useEffect, useState } from 'react';
16
16
  import { Trans, useTranslation } from 'react-i18next';
17
17
  import { useLocation } from 'react-router-dom';
18
- import { useCaseGroupMembers } from '../../../hooks/useCaseGroupGraphQL';
18
+ import { useCaseGroupMembers, useDeleteCaseGroupMember } from '../../../hooks/useCaseGroupGraphQL';
19
19
  import { ManageTable } from '../../ManageTable/ManageTable';
20
20
  import { AddMembersModal } from '../AddMembersModal';
21
21
  import { DefaultGroupSwitch } from '../DefualtGroupSwitch';
22
22
  import { GroupSelect } from '../GroupSelect';
23
23
  // TODO: Uncomment when updateUsers is migrated to GraphQL
24
24
  // import { GroupUserPermissionsSelect } from '../GroupUserPermissionsSelect';
25
+ const RemoveMemberButton = ({ user, onRemove, isDisabled }) => {
26
+ const { t } = useTranslation();
27
+ return (React.createElement(Button, { variant: "link", isDanger: true, onClick: () => onRemove(user), isDisabled: isDisabled }, t('Remove')));
28
+ };
25
29
  export const ManageGroupUsers = () => {
26
30
  const { t } = useTranslation();
27
31
  const location = useLocation();
@@ -31,6 +35,8 @@ export const ManageGroupUsers = () => {
31
35
  const { data: groupUsers, loading: isFetching, fetchMembers, refetch } = useCaseGroupMembers();
32
36
  const canManageCaseGroups = ability.can(resourceActions.CREATE, resources.CASE_GROUPS);
33
37
  const [isAddMembersModalOpen, setIsAddMembersModalOpen] = useState(false);
38
+ const [memberToRemove, setMemberToRemove] = useState(null);
39
+ const { deleteMember, loading: isDeleting } = useDeleteCaseGroupMember();
34
40
  // TODO: Uncomment when updateUsers is migrated to GraphQL
35
41
  // function onPermissionError(error: Error, user: IGroupUser) {
36
42
  // setData([...data]);
@@ -71,6 +77,25 @@ export const ManageGroupUsers = () => {
71
77
  setAllData([]);
72
78
  }
73
79
  });
80
+ const handleRemoveMember = () => __awaiter(void 0, void 0, void 0, function* () {
81
+ if (!(memberToRemove === null || memberToRemove === void 0 ? void 0 : memberToRemove.memberRecordId))
82
+ return;
83
+ try {
84
+ yield deleteMember(memberToRemove.memberRecordId);
85
+ ToastNotification.addSuccessMessage(t('{{name}} has been removed from the group', {
86
+ name: `${memberToRemove.firstName} ${memberToRemove.lastName}`,
87
+ }));
88
+ refetch();
89
+ }
90
+ catch (error) {
91
+ ToastNotification.addDangerMessage(t('Could not remove member from group: {{message}}', {
92
+ message: error instanceof Error ? error.message : String(error),
93
+ }));
94
+ }
95
+ finally {
96
+ setMemberToRemove(null);
97
+ }
98
+ });
74
99
  // TODO: Uncomment when updateUsers is migrated to GraphQL
75
100
  // function onPermissionsChange(user: IGroupUser) {
76
101
  // const initialUsers = initialData.map((value) => (value.ssoUsername === user.ssoUsername ? user : value));
@@ -122,6 +147,11 @@ export const ManageGroupUsers = () => {
122
147
  title: t('Default group'),
123
148
  cell: (user, index) => (React.createElement(DefaultGroupSwitch, { id: `${index}`, onToggle: onDefaultToggle, group: selectedGroup, user: user })),
124
149
  },
150
+ {
151
+ id: 'remove',
152
+ title: '',
153
+ cell: (user) => (React.createElement(RemoveMemberButton, { user: user, onRemove: setMemberToRemove, isDisabled: isDeleting })),
154
+ },
125
155
  ]
126
156
  : []),
127
157
  ];
@@ -163,5 +193,13 @@ export const ManageGroupUsers = () => {
163
193
  React.createElement(SearchInput, { className: "pf-v6-u-flex-grow-1 pf-v6-c-search-input pf-v6-u-background-color-100", id: "account-group-filter", value: userSearch, isDisabled: isFetching || !selectedGroup, onChange: (_, value) => setUserSearch(value), placeholder: t('Search for people in this group'), "aria-label": "Group search input", onClear: () => setUserSearch('') }))),
164
194
  React.createElement(ErrorBoundary, { errorMsgInfo: { message: t('There was an error loading group users list') } },
165
195
  React.createElement(ManageTable, { ariaLabel: t('Table to manage groups'), columns: columns, data: data, sortInfo: { column: 'first-name', direction: 'asc' }, isFetching: isFetching, isError: false, pagination: false })),
196
+ memberToRemove && (React.createElement(Modal, { variant: ModalVariant.small, isOpen: true, onClose: () => setMemberToRemove(null), "aria-label": t('Confirm removal') },
197
+ React.createElement(ModalHeader, { title: t('Remove member') }),
198
+ React.createElement(ModalBody, null, t('Are you sure you want to remove {{name}} from this group?', {
199
+ name: `${memberToRemove.firstName} ${memberToRemove.lastName}`,
200
+ })),
201
+ React.createElement(ModalFooter, null,
202
+ React.createElement(Button, { variant: "danger", onClick: handleRemoveMember, isLoading: isDeleting, isDisabled: isDeleting }, t('Remove')),
203
+ React.createElement(Button, { variant: "link", onClick: () => setMemberToRemove(null), isDisabled: isDeleting }, t('Cancel'))))),
166
204
  canManageCaseGroups && isAddMembersModalOpen && selectedGroup && (React.createElement(AddMembersModal, { group: selectedGroup, existingMembers: initialData, onSuccess: refetch, onClose: () => setIsAddMembersModalOpen(false) }))));
167
205
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ManageCaseLabelsTab.d.ts","sourceRoot":"","sources":["../../../../src/components/ManageCaseLabels/ManageCaseLabelsTab.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAmC5D,wBAAgB,mBAAmB,sBA+SlC"}
1
+ {"version":3,"file":"ManageCaseLabelsTab.d.ts","sourceRoot":"","sources":["../../../../src/components/ManageCaseLabels/ManageCaseLabelsTab.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAoC5D,wBAAgB,mBAAmB,sBAsTlC"}
@@ -13,9 +13,11 @@ import PencilAltIcon from '@patternfly/react-icons/dist/js/icons/pencil-alt-icon
13
13
  import TrashIcon from '@patternfly/react-icons/dist/js/icons/trash-icon';
14
14
  import { ErrorBoundary, ToastNotification, useConfirmation } from '@rh-support/components';
15
15
  import { useGlobalStateContext } from '@rh-support/react-context';
16
+ import { getStringifiedParams } from '@rh-support/utils';
16
17
  import isEmpty from 'lodash/isEmpty';
17
18
  import React, { useEffect, useMemo, useState } from 'react';
18
19
  import { Trans, useTranslation } from 'react-i18next';
20
+ import { useHistory } from 'react-router-dom';
19
21
  import { useCaseLabels, useCreateCaseLabel, useDeleteCaseLabel, useUpdateCaseLabel, } from '../../hooks/useCaseLabelGraphQL';
20
22
  import { ManageTable } from '../ManageTable';
21
23
  import { AddEditCaseLabelModal } from './AddEditCaseLabelModal';
@@ -37,6 +39,7 @@ const isDuplicateCaseLabelGraphQLError = (error) => {
37
39
  export function ManageCaseLabelsTab() {
38
40
  var _a;
39
41
  const { t } = useTranslation();
42
+ const history = useHistory();
40
43
  const confirmation = useConfirmation();
41
44
  const { globalMetadataState: { loggedInUsersAccount }, } = useGlobalStateContext();
42
45
  const accountId = (_a = loggedInUsersAccount === null || loggedInUsersAccount === void 0 ? void 0 : loggedInUsersAccount.data) === null || _a === void 0 ? void 0 : _a.salesforceAccountId;
@@ -154,8 +157,14 @@ export function ManageCaseLabelsTab() {
154
157
  }
155
158
  });
156
159
  const onViewAssignedCases = (label) => {
157
- // Placeholder until case-list filter by label is wired
158
- ToastNotification.addInfoMessage(t(`View cases assigned to "${label.name}" (coming soon)`));
160
+ const query = `caseLabel:("${label.id}") orderBy lastModifiedDate desc`;
161
+ history.push({
162
+ pathname: '/case/list',
163
+ search: getStringifiedParams({
164
+ query: encodeURIComponent(query),
165
+ searchType: 'basic',
166
+ }),
167
+ });
159
168
  };
160
169
  const columns = [
161
170
  {
@@ -1 +1 @@
1
- {"version":3,"file":"PreferencesCaseView.d.ts","sourceRoot":"","sources":["../../../../../src/components/ManagePreferences/sections/PreferencesCaseView.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAO/D,UAAU,MAAM;CAAG;AAEnB,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,qBAqShD"}
1
+ {"version":3,"file":"PreferencesCaseView.d.ts","sourceRoot":"","sources":["../../../../../src/components/ManagePreferences/sections/PreferencesCaseView.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAO/D,UAAU,MAAM;CAAG;AAEnB,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,qBA8RhD"}
@@ -12,7 +12,7 @@ import { Card, CardBody, CardHeader, Popover, PopoverPosition, SelectOption, Spi
12
12
  // Tooltip,
13
13
  } from '@patternfly/react-core';
14
14
  import InfoCircleIcon from '@patternfly/react-icons/dist/js/icons/info-circle-icon';
15
- import { EditorMode, ToastNotification /* , useFetch */ } from '@rh-support/components';
15
+ import { ToastNotification } from '@rh-support/components';
16
16
  import { GlobalMetadataStateContext } from '@rh-support/react-context';
17
17
  import { ability /* , CaseListFields */, resourceActions, resources } from '@rh-support/user-permissions';
18
18
  import debounce from 'lodash/debounce';
@@ -34,7 +34,7 @@ export function PreferencesCaseView(props) {
34
34
  const [commentValidated, setCommentValidated] = useState('default');
35
35
  // const [isHostnamesLoading, setIsHostnamesLoading] = useState(true);
36
36
  const [isCommentSignatureLoading, setIsCommentSignatureLoading] = useState(false);
37
- const commentTypes = [EditorMode.PLAIN, EditorMode.MARKDOWN];
37
+ const commentTypes = ['plaintext', 'markdown'];
38
38
  const defaultCommentTitleID = 'default-comment-preference-select';
39
39
  const defaultCaseViewID = 'default-case-view-select';
40
40
  // const canUseHostName = ability.can(resourceActions.PATCH, resources.CASE_CREATE, CaseListFields.HOSTNAME);
@@ -135,28 +135,21 @@ export function PreferencesCaseView(props) {
135
135
  console.log(error);
136
136
  }
137
137
  });
138
- // To set the case of text in dropdown
139
- const setOptionCase = (option, reverse) => {
140
- if (reverse) {
141
- if (option === 'Plain text') {
142
- return EditorMode.PLAIN;
143
- }
144
- else if (option === 'Markdown') {
145
- return EditorMode.MARKDOWN;
146
- }
147
- }
148
- else {
149
- if (option === EditorMode.PLAIN) {
150
- return 'Plain text';
151
- }
152
- else if (option === EditorMode.MARKDOWN) {
153
- return 'Markdown';
154
- }
155
- }
138
+ const toInternalFormat = (displayName) => {
139
+ if (displayName === 'Plain text')
140
+ return 'plaintext';
141
+ if (displayName === 'Markdown')
142
+ return 'markdown';
143
+ };
144
+ const toDisplayName = (internal) => {
145
+ if (internal === 'plaintext')
146
+ return 'Plain text';
147
+ if (internal === 'markdown')
148
+ return 'Markdown';
156
149
  };
157
150
  const onCommentSelect = (event, selection) => __awaiter(this, void 0, void 0, function* () {
158
151
  try {
159
- const selectedComment = setOptionCase(selection, true);
152
+ const selectedComment = toInternalFormat(selection);
160
153
  yield updateCommentType(selectedComment);
161
154
  setOriginalCommentType(selectedComment);
162
155
  }
@@ -199,7 +192,7 @@ export function PreferencesCaseView(props) {
199
192
  isInternalUserPermission && (React.createElement("div", { className: "form-group" },
200
193
  React.createElement(PreferenceSelect, { onSelect: (event, selection) => onPrefCaseViewSelect(event, selection), selections: caseViewPrefSelection(), id: defaultCaseViewID, label: prefCasePopover }, caseViewTypes.map((option, index) => (React.createElement(SelectOption, Object.assign({ "data-index": index, key: index, value: option.value }, (option.description && { description: option.description })))))))),
201
194
  React.createElement("div", { className: "form-group" },
202
- React.createElement(PreferenceSelect, { onSelect: onCommentSelect, selections: setOptionCase(originalCommentType, false), id: defaultCommentTitleID, label: "Default comment type" }, commentTypes.map((option, index) => (React.createElement(SelectOption, { key: index, value: setOptionCase(option, false) }))))),
195
+ React.createElement(PreferenceSelect, { onSelect: onCommentSelect, selections: toDisplayName(originalCommentType), id: defaultCommentTitleID, label: "Default comment type" }, commentTypes.map((option) => (React.createElement(SelectOption, { key: option, value: toDisplayName(option) }))))),
203
196
  React.createElement("div", { className: "form-group" },
204
197
  React.createElement("label", { htmlFor: "comment-signature-textarea" },
205
198
  React.createElement(Trans, null, "Comment signature")),
@@ -1,4 +1,4 @@
1
- import { type CreateCaseGroupMemberResponse, type CreateCaseGroupResponse, type DeleteCaseGroupResponse, type RenameCaseGroupResponse, type ToggleDefaultGroupResponse } from '@rh-support/utils';
1
+ import { type CreateCaseGroupMemberResponse, type CreateCaseGroupResponse, type DeleteCaseGroupMemberResponse, type DeleteCaseGroupResponse, type RenameCaseGroupResponse, type ToggleDefaultGroupResponse } from '@rh-support/utils';
2
2
  import { type IGroupUserWithContactId } from '../utils/caseGroupMapper';
3
3
  interface UseCaseGroupMembersResult {
4
4
  data: IGroupUserWithContactId[];
@@ -33,5 +33,10 @@ interface UseToggleDefaultGroupResult {
33
33
  loading: boolean;
34
34
  }
35
35
  export declare function useToggleDefaultGroup(): UseToggleDefaultGroupResult;
36
+ interface UseDeleteCaseGroupMemberResult {
37
+ deleteMember: (memberId: string) => Promise<DeleteCaseGroupMemberResponse>;
38
+ loading: boolean;
39
+ }
40
+ export declare function useDeleteCaseGroupMember(): UseDeleteCaseGroupMemberResult;
36
41
  export {};
37
42
  //# sourceMappingURL=useCaseGroupGraphQL.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCaseGroupGraphQL.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCaseGroupGraphQL.ts"],"names":[],"mappings":"AACA,OAAO,EACH,KAAK,6BAA6B,EAClC,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAE5B,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,EAOlC,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,KAAK,uBAAuB,EAAsC,MAAM,0BAA0B,CAAC;AAE5G,UAAU,yBAAyB;IAC/B,IAAI,EAAE,uBAAuB,EAAE,CAAC;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IACzB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C;AAED,wBAAgB,mBAAmB,IAAI,yBAAyB,CA6B/D;AAED,UAAU,wBAAwB;IAC9B,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACnF,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,kBAAkB,IAAI,wBAAwB,CAW7D;AAED,UAAU,8BAA8B;IACpC,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,6BAA6B,CAAC,CAAC;IAC7F,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,wBAAwB,IAAI,8BAA8B,CAgBzE;AAED,UAAU,wBAAwB;IAC9B,WAAW,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAC/E,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,kBAAkB,IAAI,wBAAwB,CAW7D;AAED,UAAU,wBAAwB;IAC9B,WAAW,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAC9D,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,kBAAkB,IAAI,wBAAwB,CAW7D;AAED,UAAU,2BAA2B;IACjC,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAClG,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,qBAAqB,IAAI,2BAA2B,CAcnE"}
1
+ {"version":3,"file":"useCaseGroupGraphQL.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCaseGroupGraphQL.ts"],"names":[],"mappings":"AACA,OAAO,EACH,KAAK,6BAA6B,EAClC,KAAK,uBAAuB,EAC5B,KAAK,6BAA6B,EAClC,KAAK,uBAAuB,EAE5B,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,EAQlC,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,KAAK,uBAAuB,EAAsC,MAAM,0BAA0B,CAAC;AAE5G,UAAU,yBAAyB;IAC/B,IAAI,EAAE,uBAAuB,EAAE,CAAC;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IACzB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C;AAED,wBAAgB,mBAAmB,IAAI,yBAAyB,CA6B/D;AAED,UAAU,wBAAwB;IAC9B,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACnF,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,kBAAkB,IAAI,wBAAwB,CAW7D;AAED,UAAU,8BAA8B;IACpC,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,6BAA6B,CAAC,CAAC;IAC7F,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,wBAAwB,IAAI,8BAA8B,CAgBzE;AAED,UAAU,wBAAwB;IAC9B,WAAW,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAC/E,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,kBAAkB,IAAI,wBAAwB,CAW7D;AAED,UAAU,wBAAwB;IAC9B,WAAW,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAC9D,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,kBAAkB,IAAI,wBAAwB,CAW7D;AAED,UAAU,2BAA2B;IACjC,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAClG,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,qBAAqB,IAAI,2BAA2B,CAcnE;AAED,UAAU,8BAA8B;IACpC,YAAY,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,6BAA6B,CAAC,CAAC;IAC3E,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,wBAAwB,IAAI,8BAA8B,CAWzE"}
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { useMutation, useQuery } from '@apollo/client/react';
11
- import { CREATE_CASE_GROUP, CREATE_CASE_GROUP_MEMBER, DELETE_CASE_GROUP, GET_CASE_GROUP_MEMBERS, RENAME_CASE_GROUP, TOGGLE_DEFAULT_GROUP, } from '@rh-support/utils';
11
+ import { CREATE_CASE_GROUP, CREATE_CASE_GROUP_MEMBER, DELETE_CASE_GROUP, DELETE_CASE_GROUP_MEMBER, GET_CASE_GROUP_MEMBERS, RENAME_CASE_GROUP, TOGGLE_DEFAULT_GROUP, } from '@rh-support/utils';
12
12
  import { useMemo, useState } from 'react';
13
13
  import { mapCaseGroupMemberNodeToIGroupUser } from '../utils/caseGroupMapper';
14
14
  export function useCaseGroupMembers() {
@@ -97,3 +97,13 @@ export function useToggleDefaultGroup() {
97
97
  });
98
98
  return { toggleDefault, loading };
99
99
  }
100
+ export function useDeleteCaseGroupMember() {
101
+ const [mutate, { loading }] = useMutation(DELETE_CASE_GROUP_MEMBER);
102
+ const deleteMember = (memberId) => __awaiter(this, void 0, void 0, function* () {
103
+ const result = yield mutate({
104
+ variables: { id: memberId },
105
+ });
106
+ return result.data;
107
+ });
108
+ return { deleteMember, loading };
109
+ }
@@ -3,6 +3,7 @@ import type { CaseGroupMemberNode, CaseGroupNode } from '@rh-support/utils';
3
3
  /** Extends the hydrajs IGroupUser with the Salesforce Contact record Id needed for mutations like ContactUpdate. */
4
4
  export interface IGroupUserWithContactId extends IGroupUser {
5
5
  contactSfId: string;
6
+ memberRecordId: string;
6
7
  }
7
8
  /**
8
9
  * Maps a Salesforce GraphQL CaseGroupNode to the legacy ICaseGroup shape
@@ -1 +1 @@
1
- {"version":3,"file":"caseGroupMapper.d.ts","sourceRoot":"","sources":["../../../src/utils/caseGroupMapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAC5F,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE5E,oHAAoH;AACpH,MAAM,WAAW,uBAAwB,SAAQ,UAAU;IACvD,WAAW,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,aAAa,EAAE,SAAS,UAAQ,GAAG,UAAU,CAS/F;AAED;;;GAGG;AACH,wBAAgB,kCAAkC,CAC9C,IAAI,EAAE,mBAAmB,EACzB,OAAO,EAAE,MAAM,GAChB,uBAAuB,CA2BzB"}
1
+ {"version":3,"file":"caseGroupMapper.d.ts","sourceRoot":"","sources":["../../../src/utils/caseGroupMapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAC5F,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE5E,oHAAoH;AACpH,MAAM,WAAW,uBAAwB,SAAQ,UAAU;IACvD,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;CAC1B;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,aAAa,EAAE,SAAS,UAAQ,GAAG,UAAU,CAS/F;AAED;;;GAGG;AACH,wBAAgB,kCAAkC,CAC9C,IAAI,EAAE,mBAAmB,EACzB,OAAO,EAAE,MAAM,GAChB,uBAAuB,CA6BzB"}
@@ -31,6 +31,7 @@ export function mapCaseGroupMemberNodeToIGroupUser(node, groupId) {
31
31
  ssoUsername: '',
32
32
  email: '',
33
33
  contactSfId: '',
34
+ memberRecordId: node.Id || '',
34
35
  };
35
36
  }
36
37
  return {
@@ -43,5 +44,6 @@ export function mapCaseGroupMemberNodeToIGroupUser(node, groupId) {
43
44
  ssoUsername: contact.SSOUserName__c.value,
44
45
  email: (_d = contact.Email.displayValue) !== null && _d !== void 0 ? _d : contact.Email.value,
45
46
  contactSfId: contact.Id,
47
+ memberRecordId: node.Id,
46
48
  };
47
49
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/manage",
3
- "version": "2.5.252",
3
+ "version": "2.5.253",
4
4
  "description": "Customer Support Manage App",
5
5
  "author": "Jordan Eudy <jeudy100@gmail.com>",
6
6
  "license": "ISC",
@@ -42,6 +42,7 @@
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@apollo/client": "^4.1.6",
45
+ "@cee-eng/hydrajs": "^4.18.114",
45
46
  "@patternfly/patternfly": "6.2.1",
46
47
  "@patternfly/react-core": "6.2.1",
47
48
  "@patternfly/react-table": "6.2.1",
@@ -77,12 +78,12 @@
77
78
  "@patternfly/patternfly": "6.2.1",
78
79
  "@patternfly/react-core": "6.2.1",
79
80
  "@patternfly/react-table": "6.2.1",
80
- "@rh-support/components": "2.5.203",
81
+ "@rh-support/components": "2.5.204",
81
82
  "@rh-support/configs": "2.0.75",
82
- "@rh-support/react-context": "2.5.298",
83
+ "@rh-support/react-context": "2.5.299",
83
84
  "@rh-support/types": "2.0.26",
84
- "@rh-support/user-permissions": "2.5.150",
85
- "@rh-support/utils": "2.5.132",
85
+ "@rh-support/user-permissions": "2.5.151",
86
+ "@rh-support/utils": "2.5.133",
86
87
  "@types/react-beautiful-dnd": "^13.0.0",
87
88
  "i18next": "^23.15.0",
88
89
  "lodash": ">=4.17.15",
@@ -101,5 +102,5 @@
101
102
  "defaults and supports es6-module",
102
103
  "maintained node versions"
103
104
  ],
104
- "gitHead": "7c3e9bbcdaa616cf2174f44356011417e368911c"
105
+ "gitHead": "f1130350456adacf617ce9d7829c300d8e63bded"
105
106
  }