@rh-support/cases 2.6.193 → 2.6.195
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/GroupsFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/GroupsFilter.js +8 -33
- package/lib/esm/utils/caseListVariablesBuilder.d.ts.map +1 -1
- package/lib/esm/utils/caseListVariablesBuilder.js +14 -13
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupsFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/GroupsFilter.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"GroupsFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/GroupsFilter.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAKrD,OAAO,KAA2D,MAAM,OAAO,CAAC;AAShF,MAAM,WAAW,iBAAiB;IAC9B,qFAAqF;IACrF,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1C,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,KAAK,IAAI,CAAC;IAC5D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAID,wBAAgB,YAAY,CAAC,EACzB,cAAc,EAAE,wBAAwB,EACxC,cAAc,EACd,SAAiB,EACjB,QAAmC,EACnC,uBAA+B,EAC/B,WAAW,EAAE,eAAe,GAC/B,GAAE,iBAAsB,qBA+RxB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useApolloClient } from '@apollo/client/react';
|
|
2
1
|
import { Badge, Button, MenuFooter, MenuToggle, Select, SelectList, SelectOption, TextInputGroup, TextInputGroupMain, TextInputGroupUtilities, } from '@patternfly/react-core';
|
|
3
2
|
import TimesIcon from '@patternfly/react-icons/dist/js/icons/times-icon';
|
|
3
|
+
import { GlobalMetadataStateContext } from '@rh-support/react-context';
|
|
4
4
|
import { ability, resourceActions, resources } from '@rh-support/user-permissions';
|
|
5
|
-
import {
|
|
5
|
+
import { getDropdownBtnPlaceholder } from '@rh-support/utils';
|
|
6
6
|
import isEmpty from 'lodash/isEmpty';
|
|
7
7
|
import isUndefined from 'lodash/isUndefined';
|
|
8
8
|
import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
@@ -14,9 +14,8 @@ import { CaseListFilterDispatchContext, CaseListFilterStateContext } from '../Ca
|
|
|
14
14
|
import { updateFilter } from '../CaseListFilterReducer';
|
|
15
15
|
const EMPTY_GROUPS = [];
|
|
16
16
|
export function GroupsFilter({ selectedGroups: controlledSelectedGroups, onGroupsChange, hideLabel = false, idPrefix = 'case-list-group-filter', showSelectionCountBadge = false, placeholder: placeholderProp, } = {}) {
|
|
17
|
-
var _a;
|
|
17
|
+
var _a, _b;
|
|
18
18
|
const { t } = useTranslation();
|
|
19
|
-
const apolloClient = useApolloClient();
|
|
20
19
|
const { filterInfo } = useContext(CaseListFilterStateContext);
|
|
21
20
|
const dispatch = useContext(CaseListFilterDispatchContext);
|
|
22
21
|
const isControlled = typeof onGroupsChange === 'function';
|
|
@@ -25,31 +24,12 @@ export function GroupsFilter({ selectedGroups: controlledSelectedGroups, onGroup
|
|
|
25
24
|
const selectedGroups = isControlled
|
|
26
25
|
? controlledSelectedGroups || EMPTY_GROUPS
|
|
27
26
|
: (_a = filterInfo === null || filterInfo === void 0 ? void 0 : filterInfo[SolrKeys.group]) !== null && _a !== void 0 ? _a : EMPTY_GROUPS;
|
|
27
|
+
const { globalMetadataState: { caseGroups }, } = useContext(GlobalMetadataStateContext);
|
|
28
|
+
const isLoading = caseGroups.isFetching;
|
|
28
29
|
const [inputValue, setInputValue] = useState('');
|
|
29
|
-
const [caseGroups, setCaseGroups] = useState([]);
|
|
30
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
31
30
|
const [focusedItemIndex, setFocusedItemIndex] = useState(null);
|
|
32
31
|
const [activeItem, setActiveItem] = useState(null);
|
|
33
|
-
|
|
34
|
-
setIsLoading(true);
|
|
35
|
-
apolloClient
|
|
36
|
-
.query({
|
|
37
|
-
query: GET_CASE_GROUP,
|
|
38
|
-
fetchPolicy: 'cache-first',
|
|
39
|
-
})
|
|
40
|
-
.then(({ data }) => {
|
|
41
|
-
var _a, _b, _c, _d;
|
|
42
|
-
const edges = (_d = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.redhat_support_uiapi) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.RedHatSupportCaseGroup__c) === null || _c === void 0 ? void 0 : _c.edges) !== null && _d !== void 0 ? _d : [];
|
|
43
|
-
setCaseGroups(handleGraphQLCaseGroupsResponse(edges));
|
|
44
|
-
})
|
|
45
|
-
.catch((err) => {
|
|
46
|
-
console.error('[GroupsFilter] Failed to fetch case groups:', err);
|
|
47
|
-
setCaseGroups([]);
|
|
48
|
-
})
|
|
49
|
-
.finally(() => setIsLoading(false));
|
|
50
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
51
|
-
}, []);
|
|
52
|
-
const list = useMemo(() => caseGroups.map((group) => ({ value: group.name, key: group.groupNum })), [caseGroups]);
|
|
32
|
+
const list = useMemo(() => (caseGroups.data || []).map((group) => ({ value: group.name, key: group.groupNum })), [caseGroups.data]);
|
|
53
33
|
const [selectOptions, setSelectOptions] = useState(list);
|
|
54
34
|
const canViewManageTab = ability.can(resourceActions.READ, resources.MANAGE);
|
|
55
35
|
const canViewCaseGroups = ability.can(resourceActions.READ, resources.CASE_GROUPS) && canViewManageTab;
|
|
@@ -153,7 +133,7 @@ export function GroupsFilter({ selectedGroups: controlledSelectedGroups, onGroup
|
|
|
153
133
|
? isLoading
|
|
154
134
|
? t('Loading...')
|
|
155
135
|
: defaultEmptyPlaceholder
|
|
156
|
-
: getDropdownBtnPlaceholder(isLoading ? t('Loading...') : defaultEmptyPlaceholder, selectedGroups, '', caseGroups.length, t('All selected'));
|
|
136
|
+
: getDropdownBtnPlaceholder(isLoading ? t('Loading...') : defaultEmptyPlaceholder, selectedGroups, '', ((_b = caseGroups.data) === null || _b === void 0 ? void 0 : _b.length) || 0, t('All selected'));
|
|
157
137
|
const hasSelectedGroups = selectedGroups.length > 0;
|
|
158
138
|
const onClick = () => {
|
|
159
139
|
var _a;
|
|
@@ -187,12 +167,7 @@ export function GroupsFilter({ selectedGroups: controlledSelectedGroups, onGroup
|
|
|
187
167
|
setFocusedItemIndex(null);
|
|
188
168
|
setActiveItem(null);
|
|
189
169
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
190
|
-
}, [inputValue]);
|
|
191
|
-
useEffect(() => {
|
|
192
|
-
if (!inputValue) {
|
|
193
|
-
setSelectOptions(list);
|
|
194
|
-
}
|
|
195
|
-
}, [list, inputValue]);
|
|
170
|
+
}, [inputValue, list]);
|
|
196
171
|
useEffect(() => {
|
|
197
172
|
if (isEmpty(selectedGroups)) {
|
|
198
173
|
setSelectedItems({});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"caseListVariablesBuilder.d.ts","sourceRoot":"","sources":["../../../src/utils/caseListVariablesBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"caseListVariablesBuilder.d.ts","sourceRoot":"","sources":["../../../src/utils/caseListVariablesBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AASnD,OAAO,EAEH,oBAAoB,EAEvB,MAAM,+CAA+C,CAAC;AAOvD,wBAAgB,8BAA8B,CAAC,WAAW,EAAE,oBAAoB,GAAG,MAAM,EAAE,CAM1F;AAED,MAAM,WAAW,yBAAyB;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,gBAAgB;IAC7B,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AA0SD,wBAAsB,qCAAqC,CACvD,WAAW,EAAE,oBAAoB,EACjC,YAAY,EAAE,YAAY,EAC1B,eAAe,CAAC,EAAE,gBAAgB,GACnC,OAAO,CAAC,yBAAyB,CAAC,CA8HpC"}
|
|
@@ -7,8 +7,9 @@ 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 { GET_CONTACT_BY_SSO, GET_GROUP_IDS_BY_NAME, GET_USER_IDS_BY_FEDERATION, getTechnicalSupportRecordTypeId, } from '@rh-support/utils';
|
|
10
|
+
import { buildAccessRestrictionExclusionFilter, GET_CONTACT_BY_SSO, GET_GROUP_IDS_BY_NAME, GET_USER_IDS_BY_FEDERATION, getTechnicalSupportRecordTypeId, } from '@rh-support/utils';
|
|
11
11
|
import { CaseListColumnIds, caseListSortColumnIdsToGraphQLMap } from '../enums/case';
|
|
12
|
+
import { CaseSearchQueryType } from '../enums/caseSearch';
|
|
12
13
|
import { SolrKeys, SolrPivotKeys } from '../enums/filters';
|
|
13
14
|
import { parseAdvanceSearchDate } from './advanceSearchUtils';
|
|
14
15
|
import { expandStatusGroupsToApiValues } from './statusUtils';
|
|
@@ -17,10 +18,7 @@ export function getOwnerFederationIdsToResolve(filterState) {
|
|
|
17
18
|
if (!filterInfo)
|
|
18
19
|
return [];
|
|
19
20
|
const ownerSso = filterInfo[SolrKeys.caseOwner];
|
|
20
|
-
|
|
21
|
-
const contactSsoSet = new Set(contactSso || []);
|
|
22
|
-
const filteredOwnerSso = (ownerSso || []).filter((sso) => !contactSsoSet.has(sso));
|
|
23
|
-
return [...new Set(filteredOwnerSso)];
|
|
21
|
+
return [...new Set((ownerSso || []).filter(Boolean))];
|
|
24
22
|
}
|
|
25
23
|
function buildOrderByFromSortInfo(sortInfo) {
|
|
26
24
|
var _a;
|
|
@@ -294,6 +292,7 @@ export function createGraphQLVariablesFromFilterState(filterState, apolloClient,
|
|
|
294
292
|
const first = (paginationInfo === null || paginationInfo === void 0 ? void 0 : paginationInfo.pageSize) || 10;
|
|
295
293
|
const orderBy = buildOrderByFromSortInfo(sortInfo);
|
|
296
294
|
const andConditions = [];
|
|
295
|
+
andConditions.push(buildAccessRestrictionExclusionFilter());
|
|
297
296
|
if (filterInfo) {
|
|
298
297
|
const statusFilter = buildStatusFilter(filterInfo[SolrKeys.status]);
|
|
299
298
|
if (statusFilter)
|
|
@@ -336,16 +335,18 @@ export function createGraphQLVariablesFromFilterState(filterState, apolloClient,
|
|
|
336
335
|
const ownerUserIds = (resolvedUserIds === null || resolvedUserIds === void 0 ? void 0 : resolvedUserIds.ownerUserIds) ||
|
|
337
336
|
(assignedToValues.length ? yield resolveOwnerIdsBySearchTerms(assignedToValues, apolloClient) : []);
|
|
338
337
|
const contactIdFilter = buildIdFilter('ContactId', contactIds, Boolean(contactValues === null || contactValues === void 0 ? void 0 : contactValues.length));
|
|
339
|
-
if (contactIdFilter) {
|
|
340
|
-
andConditions.push(contactIdFilter);
|
|
341
|
-
}
|
|
342
338
|
const ownerIdFilter = buildIdFilter('OwnerId', ownerUserIds, assignedToValues.length > 0);
|
|
343
|
-
if (ownerIdFilter) {
|
|
344
|
-
andConditions.push(ownerIdFilter);
|
|
345
|
-
}
|
|
346
339
|
const createdByFilter = buildRedHatSupportUserReferenceFilter('CreatedBy', createdByValues);
|
|
347
|
-
|
|
348
|
-
|
|
340
|
+
const isAdvancedSearch = (filterQueryInfo === null || filterQueryInfo === void 0 ? void 0 : filterQueryInfo.type) === CaseSearchQueryType.ADVANCED;
|
|
341
|
+
const usernameFilters = [contactIdFilter, ownerIdFilter, createdByFilter].filter(Boolean);
|
|
342
|
+
if (isAdvancedSearch) {
|
|
343
|
+
usernameFilters.forEach((filter) => andConditions.push(filter));
|
|
344
|
+
}
|
|
345
|
+
else if (usernameFilters.length === 1) {
|
|
346
|
+
andConditions.push(usernameFilters[0]);
|
|
347
|
+
}
|
|
348
|
+
else if (usernameFilters.length > 1) {
|
|
349
|
+
andConditions.push({ or: usernameFilters });
|
|
349
350
|
}
|
|
350
351
|
const lastModifiedByFilter = buildRedHatSupportUserReferenceFilter('LastModifiedBy', modifiedByValues);
|
|
351
352
|
if (lastModifiedByFilter) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/cases",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.195",
|
|
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.5.
|
|
42
|
-
"@rh-support/react-context": "2.5.
|
|
41
|
+
"@rh-support/components": "2.5.191",
|
|
42
|
+
"@rh-support/react-context": "2.5.285",
|
|
43
43
|
"@rh-support/types": "2.0.26",
|
|
44
|
-
"@rh-support/user-permissions": "2.5.
|
|
45
|
-
"@rh-support/utils": "2.5.
|
|
44
|
+
"@rh-support/user-permissions": "2.5.137",
|
|
45
|
+
"@rh-support/utils": "2.5.119",
|
|
46
46
|
"localforage": "^1.10.0",
|
|
47
47
|
"lodash": "^4.17.21",
|
|
48
48
|
"pegjs": "^0.10.0",
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
"defaults and supports es6-module",
|
|
93
93
|
"maintained node versions"
|
|
94
94
|
],
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "e737fe04f1e771923e483cd65f7d6f6f87b53356"
|
|
96
96
|
}
|