@rh-support/cases 2.7.39 → 2.7.40
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/lib/esm/components/case-list/case-list-filters/CreatorSsoNameFilterChip.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/CreatorSsoNameFilterChip.js +10 -11
- package/lib/esm/components/case-list/case-list-filters/InternalSsoNameFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/InternalSsoNameFilter.js +40 -23
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreatorSsoNameFilterChip.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/CreatorSsoNameFilterChip.tsx"],"names":[],"mappings":"AAKA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAU/D,wBAAgB,wBAAwB,
|
|
1
|
+
{"version":3,"file":"CreatorSsoNameFilterChip.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/CreatorSsoNameFilterChip.tsx"],"names":[],"mappings":"AAKA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAU/D,wBAAgB,wBAAwB,sBAyIvC"}
|
|
@@ -7,10 +7,10 @@ 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 {
|
|
10
|
+
import { useApolloClient } from '@apollo/client/react';
|
|
11
11
|
import { Label, LabelGroup } from '@patternfly/react-core';
|
|
12
|
-
import { useFetch } from '@rh-support/components';
|
|
13
12
|
import { GlobalMetadataStateContext } from '@rh-support/react-context';
|
|
13
|
+
import { fetchContactsByFilterFromGraphQL } from '@rh-support/utils';
|
|
14
14
|
import uniq from 'lodash/uniq';
|
|
15
15
|
import React, { useContext, useEffect, useState } from 'react';
|
|
16
16
|
import { Trans, useTranslation } from 'react-i18next';
|
|
@@ -22,13 +22,13 @@ import { removeFilterItem } from '../CaseListFilterReducer';
|
|
|
22
22
|
import { setChipsNameSsoMap } from '../CaseListReducer';
|
|
23
23
|
export function CreatorSsoNameFilterChip() {
|
|
24
24
|
const { t } = useTranslation();
|
|
25
|
+
const apolloClient = useApolloClient();
|
|
25
26
|
const { filterInfo } = useContext(CaseListFilterStateContext);
|
|
26
27
|
const dispatch = useContext(CaseListFilterDispatchContext);
|
|
27
28
|
const { globalMetadataState: { loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
|
|
28
29
|
const { chipsNameSsoMap } = useCaseListStateContext();
|
|
29
30
|
const CaseListDispatch = useCaseListDispatchContext();
|
|
30
31
|
const own = loggedInUserRights.data.getSSOUsername();
|
|
31
|
-
const { request: getInternalUserContactsList } = useFetch(contacts.getSFDCContacts, { propgateErrors: true });
|
|
32
32
|
const [chips, setChips] = useState([]);
|
|
33
33
|
const deleteChip = (value) => () => {
|
|
34
34
|
removeFilterItem(dispatch, { filterKey: SolrKeys.createdBySsoUsername, value });
|
|
@@ -72,16 +72,15 @@ export function CreatorSsoNameFilterChip() {
|
|
|
72
72
|
// Advance search stores raw name/SSO text in filterInfo. Resolution uses ssoUsernameIn, so a
|
|
73
73
|
// short first name can match another contact's SSO and show the wrong chip label; filtering still
|
|
74
74
|
// works — users should enter full name or SSO when the label matters.
|
|
75
|
-
const getInternalContactNames = (
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
ssoUsernameIn: contacts.join(','),
|
|
75
|
+
const getInternalContactNames = (contactSsoUsernames) => __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
const items = yield fetchContactsByFilterFromGraphQL(apolloClient, {
|
|
77
|
+
ssoUsernames: contactSsoUsernames,
|
|
79
78
|
});
|
|
80
|
-
if (!(
|
|
79
|
+
if (!(items === null || items === void 0 ? void 0 : items.length))
|
|
81
80
|
return;
|
|
82
|
-
setAllChips(
|
|
81
|
+
setAllChips(items);
|
|
83
82
|
const chipsNameSsoPairs = {};
|
|
84
|
-
|
|
83
|
+
items.forEach((item) => {
|
|
85
84
|
chipsNameSsoPairs[item.ssoUsername] = {
|
|
86
85
|
firstName: item.firstName || '',
|
|
87
86
|
lastName: item.lastName || '',
|
|
@@ -102,7 +101,7 @@ export function CreatorSsoNameFilterChip() {
|
|
|
102
101
|
}
|
|
103
102
|
}
|
|
104
103
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
105
|
-
}, [filterInfo, own, chipsNameSsoMap, loggedInUserRights.data, dispatch]);
|
|
104
|
+
}, [filterInfo, own, chipsNameSsoMap, loggedInUserRights.data, dispatch, apolloClient]);
|
|
106
105
|
return (React.createElement("div", { className: "filter-chip" },
|
|
107
106
|
React.createElement("span", { className: "filter-chip__heading" },
|
|
108
107
|
React.createElement(Trans, null, filterNamesMap['usernameFilterTitle'])),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalSsoNameFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/InternalSsoNameFilter.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InternalSsoNameFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/InternalSsoNameFilter.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAUhF,MAAM,CAAC,OAAO,UAAU,qBAAqB,sBA6S5C"}
|
|
@@ -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 {
|
|
10
|
+
import { useApolloClient } from '@apollo/client/react';
|
|
11
11
|
import { Button, Flex, FlexItem, MenuToggle, Select, SelectGroup, SelectList, SelectOption, TextInputGroup, TextInputGroupMain, TextInputGroupUtilities, } from '@patternfly/react-core';
|
|
12
12
|
import TimesCircleIcon from '@patternfly/react-icons/dist/js/icons/times-circle-icon';
|
|
13
|
-
import { LoadingIndicator,
|
|
13
|
+
import { LoadingIndicator, useSelectKeyboardNavigator } from '@rh-support/components';
|
|
14
14
|
import { GlobalMetadataStateContext } from '@rh-support/react-context';
|
|
15
|
-
import { getDropdownBtnPlaceholder } from '@rh-support/utils';
|
|
15
|
+
import { fetchContactsByFilterFromGraphQL, getDropdownBtnPlaceholder } from '@rh-support/utils';
|
|
16
16
|
import isEmpty from 'lodash/isEmpty';
|
|
17
17
|
import isNull from 'lodash/isNull';
|
|
18
18
|
import isUndefined from 'lodash/isUndefined';
|
|
@@ -26,6 +26,7 @@ import { setChipsNameSsoMap } from '../CaseListReducer';
|
|
|
26
26
|
import { getFilterValues, getSelectedListObj } from './CreatorSsoNameFilter';
|
|
27
27
|
export default function InternalSsoNameFilter() {
|
|
28
28
|
const { t } = useTranslation();
|
|
29
|
+
const apolloClient = useApolloClient();
|
|
29
30
|
const { filterInfo } = useContext(CaseListFilterStateContext);
|
|
30
31
|
const dispatch = useContext(CaseListFilterDispatchContext);
|
|
31
32
|
const { globalMetadataState: { loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
|
|
@@ -33,8 +34,7 @@ export default function InternalSsoNameFilter() {
|
|
|
33
34
|
const CaseListDispatch = useCaseListDispatchContext();
|
|
34
35
|
const own = loggedInUserRights.data.getSSOUsername();
|
|
35
36
|
const PER_PAGE = 200;
|
|
36
|
-
const
|
|
37
|
-
const { request: getInternalUserContactsList, isFetching: isFetchingInternalContacts } = useFetch(contacts.getSFDCContacts, { propgateErrors: true });
|
|
37
|
+
const [isFetchingInternalContacts, setIsFetchingInternalContacts] = useState(false);
|
|
38
38
|
const abortControllerRef = useRef(undefined);
|
|
39
39
|
const internalInputRef = useRef();
|
|
40
40
|
const [internalContactList, setInternalContactList] = useState([]);
|
|
@@ -104,20 +104,26 @@ export default function InternalSsoNameFilter() {
|
|
|
104
104
|
if (loggedInUserRights.data.isInternal()) {
|
|
105
105
|
const chipsNameSsoPairs = {};
|
|
106
106
|
items.forEach((item) => {
|
|
107
|
-
|
|
108
|
-
const sso = item.value.value;
|
|
107
|
+
const sso = item.value;
|
|
109
108
|
if (sso !== 'ownedByMe' && sso !== 'createdByMe' && !chipsNameSsoMap[sso]) {
|
|
110
109
|
chipsNameSsoPairs[sso] = {
|
|
111
|
-
firstName:
|
|
112
|
-
lastName:
|
|
113
|
-
firstNameCustom:
|
|
114
|
-
lastNameCustom:
|
|
110
|
+
firstName: item.firstName || '',
|
|
111
|
+
lastName: item.lastName || '',
|
|
112
|
+
firstNameCustom: item.firstNameCustom || '',
|
|
113
|
+
lastNameCustom: item.lastNameCustom || '',
|
|
115
114
|
};
|
|
116
115
|
}
|
|
117
116
|
});
|
|
118
117
|
setChipsNameSsoMap(CaseListDispatch, chipsNameSsoPairs);
|
|
119
118
|
}
|
|
120
119
|
};
|
|
120
|
+
const clearInternalFilter = (event) => {
|
|
121
|
+
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
|
122
|
+
setInternalQuery('');
|
|
123
|
+
setInternalContactList([]);
|
|
124
|
+
setNoResults(false);
|
|
125
|
+
onFilterChangeAsync([]);
|
|
126
|
+
};
|
|
121
127
|
const onSearchAsync = (query) => __awaiter(this, void 0, void 0, function* () {
|
|
122
128
|
if (query == null) {
|
|
123
129
|
return;
|
|
@@ -129,17 +135,28 @@ export default function InternalSsoNameFilter() {
|
|
|
129
135
|
// recreate a new AbortController for each call
|
|
130
136
|
let controller = new AbortController();
|
|
131
137
|
abortControllerRef.current = controller;
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
138
|
+
setIsFetchingInternalContacts(true);
|
|
139
|
+
try {
|
|
140
|
+
const contactResults = yield fetchContactsByFilterFromGraphQL(apolloClient, {
|
|
141
|
+
searchQuery: query,
|
|
142
|
+
signal: controller.signal,
|
|
143
|
+
});
|
|
144
|
+
const contacts = contactResults.filter((c) => !isEmpty(c.ssoUsername));
|
|
145
|
+
setNoResults(isEmpty(contacts));
|
|
146
|
+
setInternalContactList(contacts);
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
if ((error === null || error === void 0 ? void 0 : error.name) === 'AbortError') {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
setNoResults(true);
|
|
153
|
+
setInternalContactList([]);
|
|
154
|
+
}
|
|
155
|
+
finally {
|
|
156
|
+
if (abortControllerRef.current === controller) {
|
|
157
|
+
setIsFetchingInternalContacts(false);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
143
160
|
});
|
|
144
161
|
const onDisplayMoreClick = () => {
|
|
145
162
|
setRenderedList((pre) => internalContactList.slice(0, pre.length + PER_PAGE));
|
|
@@ -200,7 +217,7 @@ export default function InternalSsoNameFilter() {
|
|
|
200
217
|
const internalToggle = (toggleRef) => (React.createElement(MenuToggle, { variant: "typeahead", onClick: onInternalToggle, innerRef: toggleRef, isExpanded: isInternalOpen, isFullWidth: true },
|
|
201
218
|
React.createElement(TextInputGroup, { isPlain: true },
|
|
202
219
|
React.createElement(TextInputGroupMain, { value: internalQuery, onClick: onInternalToggle, onKeyDown: onInputKeyDown, placeholder: getDropdownBtnPlaceholder(t('Search for a name'), selectedInternalContacts.map((i) => i.label), ' ', filteredInternalList.length, t('All selected')), onChange: onInternalQueryChange, isExpanded: isInternalOpen, innerRef: internalInputRef, "aria-controls": "internal-ssousername-filter", role: "combobox" }),
|
|
203
|
-
React.createElement(TextInputGroupUtilities, null, !isEmpty(internalQuery) && (React.createElement(Button, { icon: isFetchingInternalContacts ? (React.createElement(LoadingIndicator, { show: true, size: "sm" })) : (React.createElement(TimesCircleIcon, { "aria-hidden": true })), variant: "plain", onClick:
|
|
220
|
+
React.createElement(TextInputGroupUtilities, null, (!isEmpty(internalQuery) || selectedInternalContacts.length > 0) && (React.createElement(Button, { icon: isFetchingInternalContacts ? (React.createElement(LoadingIndicator, { show: true, size: "sm" })) : (React.createElement(TimesCircleIcon, { "aria-hidden": true })), variant: "plain", onClick: clearInternalFilter, isDisabled: isFetchingInternalContacts, "aria-label": t('Clear') }))))));
|
|
204
221
|
return (React.createElement(Select, { shouldFocusToggleOnSelect: true, shouldPreventScrollOnItemFocus: true, id: "internal-ssousername-filter", "data-tracking-id": "internal-ssousername-filter", isOpen: isInternalOpen, onOpenChange: () => setIsInternalOpen(false), toggle: internalToggle, popperProps: { direction: 'down', enableFlip: false, maxWidth: '30rem' }, isScrollable: true, onSelect: (_e, v) => onSelectInternal(v) },
|
|
205
222
|
React.createElement(SelectList, null, filteredInternalList)));
|
|
206
223
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/cases",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.40",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"@patternfly/patternfly": "6.2.1",
|
|
39
39
|
"@patternfly/react-core": "6.2.1",
|
|
40
40
|
"@patternfly/react-table": "6.2.1",
|
|
41
|
-
"@rh-support/components": "2.6.
|
|
42
|
-
"@rh-support/react-context": "2.6.
|
|
41
|
+
"@rh-support/components": "2.6.36",
|
|
42
|
+
"@rh-support/react-context": "2.6.38",
|
|
43
43
|
"@rh-support/types": "2.0.31",
|
|
44
|
-
"@rh-support/user-permissions": "2.6.
|
|
45
|
-
"@rh-support/utils": "2.6.
|
|
44
|
+
"@rh-support/user-permissions": "2.6.33",
|
|
45
|
+
"@rh-support/utils": "2.6.32",
|
|
46
46
|
"localforage": "^1.10.0",
|
|
47
47
|
"lodash": "^4.17.21",
|
|
48
48
|
"pegjs": "^0.10.0",
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"defaults and supports es6-module",
|
|
95
95
|
"maintained node versions"
|
|
96
96
|
],
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "4042e5686ed54807954b4eccd0f10f82ab6b1861"
|
|
98
98
|
}
|