@rh-support/cases 0.2.30 → 0.2.34
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/CaseList.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseList.js +1 -1
- package/lib/esm/components/case-list/CaseListFilterHelpers.d.ts +6 -1
- package/lib/esm/components/case-list/CaseListFilterHelpers.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListFilterHelpers.js +38 -1
- package/lib/esm/components/case-list/case-list-filters/CaseListFilterChips.d.ts +1 -0
- package/lib/esm/components/case-list/case-list-filters/CaseListFilterChips.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/CaseListFilterChips.js +21 -6
- package/lib/esm/components/case-list/case-list-filters/CaseListFilters.js +2 -2
- package/lib/esm/utils/caseListUtils.d.ts +1 -1
- package/lib/esm/utils/caseListUtils.d.ts.map +1 -1
- package/lib/esm/utils/caseListUtils.js +22 -17
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseList.d.ts","sourceRoot":"","sources":["../../../../src/components/case-list/CaseList.tsx"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAC;AAChC,OAAO,0BAA0B,CAAC;AA4BlC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAKH,0BAA0B,EAI7B,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAAE,mBAAmB,EAAe,MAAM,cAAc,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,IAAI,CAAC;AAK1C,OAAO,EAAgB,WAAW,EAA2B,MAAM,uBAAuB,CAAC;AA4B3F,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,oBAAoB,CAAC,CAAC;CACzD;AAED,MAAM,WAAW,uBAAwB,SAAQ,cAAc;IAC3D,YAAY,EAAE,cAAc,EAAE,CAAC;CAClC;AAED,oBAAY,YAAY,GAAG,0BAA0B,CAAC,WAAW,EAAE,uBAAuB,CAAC,CAAC;AAM5F,MAAM,WAAW,gBAAgB;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAC;CAChC;AAED,MAAM,WAAW,aAAa;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"CaseList.d.ts","sourceRoot":"","sources":["../../../../src/components/case-list/CaseList.tsx"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAC;AAChC,OAAO,0BAA0B,CAAC;AA4BlC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAKH,0BAA0B,EAI7B,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAAE,mBAAmB,EAAe,MAAM,cAAc,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,IAAI,CAAC;AAK1C,OAAO,EAAgB,WAAW,EAA2B,MAAM,uBAAuB,CAAC;AA4B3F,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,oBAAoB,CAAC,CAAC;CACzD;AAED,MAAM,WAAW,uBAAwB,SAAQ,cAAc;IAC3D,YAAY,EAAE,cAAc,EAAE,CAAC;CAClC;AAED,oBAAY,YAAY,GAAG,0BAA0B,CAAC,WAAW,EAAE,uBAAuB,CAAC,CAAC;AAM5F,MAAM,WAAW,gBAAgB;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAC;CAChC;AAED,MAAM,WAAW,aAAa;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,eAycrC"}
|
|
@@ -314,7 +314,7 @@ export function CaseList(props) {
|
|
|
314
314
|
React.createElement(ErrorBoundary, { errorMsgInfo: { message: t('There was an error loading case search input') } },
|
|
315
315
|
React.createElement(CaseSearch, null))),
|
|
316
316
|
isBasicSearchMode && (React.createElement(ErrorBoundary, { errorMsgInfo: { message: t('There was an error loading filter chips') } },
|
|
317
|
-
React.createElement(CaseListFilterChips, { productVersionPivotValues: get(pivotValues, SolrPivotKeys.product_version, []) })))),
|
|
317
|
+
React.createElement(CaseListFilterChips, { productVersionPivotValues: get(pivotValues, SolrPivotKeys.product_version, []), isSolrSearchDown: isSolrSearchDown })))),
|
|
318
318
|
React.createElement("section", { className: "case-search-bottom" },
|
|
319
319
|
isBasicSearchMode && (React.createElement("aside", { className: `case-search-filters ${((_a = filterSectionRef.current) === null || _a === void 0 ? void 0 : _a.expanded) ? '' : 'collapsed'}` },
|
|
320
320
|
React.createElement("h3", { className: "filter-header" }, ((_b = filterSectionRef.current) === null || _b === void 0 ? void 0 : _b.expanded) ? (React.createElement(React.Fragment, null,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SolrKeys, SolrPivotKeys } from '../../enums/filters';
|
|
1
2
|
import { ICaseListFilterState, IFilterInfo } from './CaseListFilterReducer';
|
|
2
3
|
declare const isNoFilterApplied: (filterState: ICaseListFilterState) => boolean;
|
|
3
4
|
declare const isOnlyDefaultFilterApplied: (filterState: ICaseListFilterState) => boolean;
|
|
@@ -5,5 +6,9 @@ declare const isStatusFilterWithSFDCSupportedValues: ({ case_status }: Partial<I
|
|
|
5
6
|
declare const isOnlyGroupFilterApplied: (filterInfo: Partial<IFilterInfo>) => boolean;
|
|
6
7
|
declare const isOnlyStatusFilter: (filterInfo: Partial<IFilterInfo>) => boolean;
|
|
7
8
|
declare const isSearchSupportedBySFDC: (filterState: ICaseListFilterState) => boolean;
|
|
8
|
-
|
|
9
|
+
declare const eligibleSFDCFiltersWithLengthOne: (SolrKeys | SolrPivotKeys)[];
|
|
10
|
+
declare const eligibleSFDCFiltersMultipleValues: SolrKeys[];
|
|
11
|
+
declare const visibleFilterChipsWhenSolrDownSfdcUp: (SolrKeys | SolrPivotKeys)[];
|
|
12
|
+
declare function canDoSfdcSearch(filterState: ICaseListFilterState): boolean;
|
|
13
|
+
export { isNoFilterApplied, isOnlyDefaultFilterApplied, isOnlyGroupFilterApplied, isSearchSupportedBySFDC, isOnlyStatusFilter, isStatusFilterWithSFDCSupportedValues, canDoSfdcSearch, visibleFilterChipsWhenSolrDownSfdcUp, eligibleSFDCFiltersWithLengthOne, eligibleSFDCFiltersMultipleValues, };
|
|
9
14
|
//# sourceMappingURL=CaseListFilterHelpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseListFilterHelpers.d.ts","sourceRoot":"","sources":["../../../../src/components/case-list/CaseListFilterHelpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CaseListFilterHelpers.d.ts","sourceRoot":"","sources":["../../../../src/components/case-list/CaseListFilterHelpers.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAgB,oBAAoB,EAAE,WAAW,EAAqB,MAAM,yBAAyB,CAAC;AAe7G,QAAA,MAAM,iBAAiB,gBAAiB,oBAAoB,YAE3D,CAAC;AAEF,QAAA,MAAM,0BAA0B,gBAAiB,oBAAoB,YAEpE,CAAC;AAEF,QAAA,MAAM,qCAAqC,oBAA0B,QAAQ,WAAW,CAAC,YAGxF,CAAC;AAaF,QAAA,MAAM,wBAAwB,eAAgB,QAAQ,WAAW,CAAC,YAMjE,CAAC;AAEF,QAAA,MAAM,kBAAkB,eAAgB,QAAQ,WAAW,CAAC,YAG3D,CAAC;AAEF,QAAA,MAAM,uBAAuB,gBAAiB,oBAAoB,YAOjE,CAAC;AAEF,QAAA,MAAM,gCAAgC,8BAAsE,CAAC;AAC7G,QAAA,MAAM,iCAAiC,YAAmB,CAAC;AAE3D,QAAA,MAAM,oCAAoC,8BAGzC,CAAC;AAIF,iBAAS,eAAe,CAAC,WAAW,EAAE,oBAAoB,WAiBzD;AAED,OAAO,EACH,iBAAiB,EACjB,0BAA0B,EAC1B,wBAAwB,EACxB,uBAAuB,EACvB,kBAAkB,EAClB,qCAAqC,EACrC,eAAe,EACf,oCAAoC,EACpC,gCAAgC,EAChC,iCAAiC,GACpC,CAAC"}
|
|
@@ -9,9 +9,11 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
+
import every from 'lodash/every';
|
|
12
13
|
import isEqual from 'lodash/isEqual';
|
|
13
14
|
import sortBy from 'lodash/sortBy';
|
|
14
15
|
import { CaseStatus } from '../../enums/case';
|
|
16
|
+
import { SolrKeys, SolrPivotKeys } from '../../enums/filters';
|
|
15
17
|
import { emptyFilters, initialFilterInfo } from './CaseListFilterReducer';
|
|
16
18
|
function sortArrayHashMap(hashMap = {}) {
|
|
17
19
|
const sortedHashMap = Object.keys(hashMap).reduce((acc, currKey) => {
|
|
@@ -34,6 +36,16 @@ const isStatusFilterWithSFDCSupportedValues = ({ case_status = [] }) => {
|
|
|
34
36
|
const statusLength = case_status.length;
|
|
35
37
|
return statusLength !== 2 || (statusLength === 2 && !case_status.includes(CaseStatus.Closed));
|
|
36
38
|
};
|
|
39
|
+
// SFDC on most fields including case_status only accept one value
|
|
40
|
+
// on case type field if 'closed' is selected then, we can have 2 filters selected
|
|
41
|
+
// because closed in SFDC passes as a seperate param
|
|
42
|
+
// if closed not selected then only one filter can be selected
|
|
43
|
+
const isStatusFilterWithSFDCSupported = (filterKey, filterValue) => {
|
|
44
|
+
const statusLength = filterValue.length;
|
|
45
|
+
if (filterKey !== SolrKeys.status || statusLength > 2)
|
|
46
|
+
return false;
|
|
47
|
+
return statusLength === 1 || (statusLength === 2 && filterValue.includes(CaseStatus.Closed));
|
|
48
|
+
};
|
|
37
49
|
const isOnlyGroupFilterApplied = (filterInfo) => {
|
|
38
50
|
const { case_folderNumber = [], case_status } = filterInfo, rest = __rest(filterInfo, ["case_folderNumber", "case_status"]);
|
|
39
51
|
// only group filter with status filter supported by sfdc
|
|
@@ -49,4 +61,29 @@ const isSearchSupportedBySFDC = (filterState) => {
|
|
|
49
61
|
isOnlyGroupFilterApplied(filterState.filterInfo) ||
|
|
50
62
|
isOnlyStatusFilter(filterState.filterInfo));
|
|
51
63
|
};
|
|
52
|
-
|
|
64
|
+
const eligibleSFDCFiltersWithLengthOne = [SolrKeys.status, SolrKeys.severity, SolrPivotKeys.product_version];
|
|
65
|
+
const eligibleSFDCFiltersMultipleValues = [SolrKeys.group];
|
|
66
|
+
const visibleFilterChipsWhenSolrDownSfdcUp = [
|
|
67
|
+
...eligibleSFDCFiltersWithLengthOne,
|
|
68
|
+
...eligibleSFDCFiltersMultipleValues,
|
|
69
|
+
];
|
|
70
|
+
//sfdc call should be called only when user has selected the filters that SFDC supports that are products, severity, state and group
|
|
71
|
+
//products, severity, state only can have one selected value but group can have multiple values
|
|
72
|
+
function canDoSfdcSearch(filterState) {
|
|
73
|
+
if (isNoFilterApplied(filterState) || isOnlyDefaultFilterApplied(filterState))
|
|
74
|
+
return true;
|
|
75
|
+
return every(filterState.filterInfo, (filterValue, filterKey) => {
|
|
76
|
+
if (filterValue.length === 0 ||
|
|
77
|
+
isStatusFilterWithSFDCSupported(filterKey, filterValue) ||
|
|
78
|
+
// @ts-ignore
|
|
79
|
+
(filterValue.length >= 1 && eligibleSFDCFiltersMultipleValues.includes(filterKey)) ||
|
|
80
|
+
// @ts-ignore
|
|
81
|
+
(filterValue.length === 1 && eligibleSFDCFiltersWithLengthOne.includes(filterKey))) {
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
export { isNoFilterApplied, isOnlyDefaultFilterApplied, isOnlyGroupFilterApplied, isSearchSupportedBySFDC, isOnlyStatusFilter, isStatusFilterWithSFDCSupportedValues, canDoSfdcSearch, visibleFilterChipsWhenSolrDownSfdcUp, eligibleSFDCFiltersWithLengthOne, eligibleSFDCFiltersMultipleValues, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseListFilterChips.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/CaseListFilterChips.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"CaseListFilterChips.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/CaseListFilterChips.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAMtD,UAAU,MAAM;IACZ,yBAAyB,EAAE,uBAAuB,EAAE,CAAC;IACrD,gBAAgB,EAAE,OAAO,CAAC;CAC7B;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,eAsIhD"}
|
|
@@ -6,6 +6,7 @@ import { Trans } from 'react-i18next';
|
|
|
6
6
|
import { ProductVersionKey, SolrKeys, SolrPivotKeys } from '../../../enums/filters';
|
|
7
7
|
import { filterNamesMap } from '../../../utils/constants';
|
|
8
8
|
import { CaseListFilterDispatchContext, CaseListFilterStateContext } from '../CaseListFilterContext';
|
|
9
|
+
import { eligibleSFDCFiltersWithLengthOne, visibleFilterChipsWhenSolrDownSfdcUp } from '../CaseListFilterHelpers';
|
|
9
10
|
import { clearFilters, removeFilterItem } from '../CaseListFilterReducer';
|
|
10
11
|
import { CreatorSsoNameFilterChip } from './CreatorSsoNameFilterChip';
|
|
11
12
|
import { ProductFilterChip } from './ProductFilterChip';
|
|
@@ -27,16 +28,28 @@ export function CaseListFilterChips(props) {
|
|
|
27
28
|
clearFilters(dispatch);
|
|
28
29
|
};
|
|
29
30
|
const renderFilterValueChips = (filterKey, filterValues, chipKeySuffix = '') => {
|
|
31
|
+
const singleValueSfdcFilterHasMultipleValues = visibleFilterChipsWhenSolrDownSfdcUp.includes(filterKey) &&
|
|
32
|
+
eligibleSFDCFiltersWithLengthOne.includes(filterKey) &&
|
|
33
|
+
Array.isArray(filterValues) &&
|
|
34
|
+
filterValues[0];
|
|
35
|
+
if (props.isSolrSearchDown && singleValueSfdcFilterHasMultipleValues) {
|
|
36
|
+
filterValues = [filterValues[0]];
|
|
37
|
+
}
|
|
30
38
|
const filterChips = filterValues.map((chip, index) => {
|
|
31
39
|
return (React.createElement(Chip, { key: `${filterKey}-${index}-${chipKeySuffix}`, onClick: deleteChip(filterKey, getChipKey(chip)) }, getChipValue(chip)));
|
|
32
40
|
});
|
|
33
41
|
return filterChips;
|
|
34
42
|
};
|
|
35
43
|
const getChipGroupForFilter = (filterKey, filterValues, groupName = '') => {
|
|
36
|
-
|
|
37
|
-
React.createElement(
|
|
38
|
-
|
|
39
|
-
|
|
44
|
+
if (props.isSolrSearchDown && !visibleFilterChipsWhenSolrDownSfdcUp.includes(filterKey)) {
|
|
45
|
+
return React.createElement(React.Fragment, null);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
return (React.createElement("div", { className: "filter-chip", key: `${filterKey}-bookmarks-${groupName}` },
|
|
49
|
+
React.createElement("span", { className: "filter-chip__heading" },
|
|
50
|
+
React.createElement(Trans, null, groupName || filterNamesMap[filterKey] || filterKey)),
|
|
51
|
+
React.createElement(ChipGroup, { numChips: 7, className: "pf-c-chip-group__simple" }, renderFilterValueChips(filterKey, filterValues, groupName))));
|
|
52
|
+
}
|
|
40
53
|
};
|
|
41
54
|
const renderAccountFilterChip = () => {
|
|
42
55
|
const visibleChips = [];
|
|
@@ -77,8 +90,10 @@ export function CaseListFilterChips(props) {
|
|
|
77
90
|
return (React.createElement(React.Fragment, null, isAnyFilterApplied && (React.createElement("div", { className: "filter-chip-wrapper" },
|
|
78
91
|
React.createElement("h2", null, "Filtering by"),
|
|
79
92
|
React.createElement("div", { className: "filter-chips" },
|
|
80
|
-
Array.isArray(filterInfo[ProductVersionKey]) && filterInfo[ProductVersionKey].length > 0 && (React.createElement(ProductFilterChip, { productList: filterInfo[ProductVersionKey]
|
|
81
|
-
|
|
93
|
+
Array.isArray(filterInfo[ProductVersionKey]) && filterInfo[ProductVersionKey].length > 0 && (React.createElement(ProductFilterChip, { productList: props.isSolrSearchDown && filterInfo[ProductVersionKey].length > 1
|
|
94
|
+
? [filterInfo[ProductVersionKey][0]]
|
|
95
|
+
: filterInfo[ProductVersionKey], productVersionPivot: props.productVersionPivotValues })),
|
|
96
|
+
!props.isSolrSearchDown && showUsernameFilter && React.createElement(CreatorSsoNameFilterChip, null),
|
|
82
97
|
renderChips(),
|
|
83
98
|
currentFilterLength > 1 && (React.createElement(Button, { variant: "link", isInline: true, onClick: clearAllFilters, "data-tracking-id": "case-list-clear-filters", className: "clear-filters" },
|
|
84
99
|
React.createElement(Trans, null, "Clear all filters"))))))));
|
|
@@ -29,12 +29,12 @@ export const CaseListFilters = ({ filterValues, allCaseTypes, allCaseSeverities,
|
|
|
29
29
|
return (React.createElement(React.Fragment, null,
|
|
30
30
|
React.createElement("div", { className: "filter-group" },
|
|
31
31
|
!isSolrSearchDown && canReadBookmarkAccounts && (React.createElement(AccountsFilter, { canReadBookmarkAccounts: canReadBookmarkAccounts })),
|
|
32
|
-
(canReadBookmarkAccounts || canAccessManagedAccounts) && (React.createElement(AccountsFilterWrapper, { canManageBookmarkAccounts: canManageBookmarkAccounts, canReadBookmarkAccounts: canReadBookmarkAccounts, canAccessManagedAccounts: canAccessManagedAccounts })),
|
|
32
|
+
!isSolrSearchDown && (canReadBookmarkAccounts || canAccessManagedAccounts) && (React.createElement(AccountsFilterWrapper, { canManageBookmarkAccounts: canManageBookmarkAccounts, canReadBookmarkAccounts: canReadBookmarkAccounts, canAccessManagedAccounts: canAccessManagedAccounts })),
|
|
33
33
|
canAccessGroupsFilter && React.createElement(GroupsFilter, null),
|
|
34
34
|
canAccessProductsFilter && (React.createElement(ProductsFilter, { filterValues: get(filterValues, SolrKeys.product, []), isSolrSearchDown: isSolrSearchDown, allProducts: ((_a = allProducts.data) === null || _a === void 0 ? void 0 : _a.productsResult.map((p) => p.product)) || [] })),
|
|
35
35
|
canAccessSeverityFilter && (React.createElement(SeverityFilter, { filterValues: get(filterValues, SolrKeys.severity, []), isSolrSearchDown: isSolrSearchDown, allCaseSeverities: allCaseSeverities.data })),
|
|
36
36
|
canAccessStatusFilter && (React.createElement(StatusFilter, { filterValues: get(filterValues, SolrKeys.status, []), allCaseStatuses: allCaseStatuses.data, isSolrSearchDown: isSolrSearchDown })),
|
|
37
|
-
canAccessCreatorFilter && React.createElement(CreatorSsoNameFilter, null),
|
|
37
|
+
!isSolrSearchDown && canAccessCreatorFilter && React.createElement(CreatorSsoNameFilter, null),
|
|
38
38
|
!isSolrSearchDown && canAccessTypeFilter && React.createElement(TypeFilter, { allCaseTypes: allCaseTypes.data }),
|
|
39
39
|
!isSolrSearchDown && canAccessAdditionalFilter && React.createElement(AdditionalFilters, null))));
|
|
40
40
|
};
|
|
@@ -13,7 +13,7 @@ interface ICaseListResponse {
|
|
|
13
13
|
isSolrSearchDownSFDCUp: boolean;
|
|
14
14
|
showErrorMessage: boolean;
|
|
15
15
|
}
|
|
16
|
-
export declare function getCaseList(filterState: ICaseListFilterState, loggedInUser: UserAuth, loggedInUserAccount: Partial<IAccount>, abortSignal: AbortSignal
|
|
16
|
+
export declare function getCaseList(filterState: ICaseListFilterState, loggedInUser: UserAuth, loggedInUserAccount: Partial<IAccount>, abortSignal: AbortSignal): Promise<ICaseListResponse>;
|
|
17
17
|
export declare function getCaseListFromSolr(solrQuery: ISearchSolrQuery, partnerSearch: boolean, abortSignal: AbortSignal, isSecureSupport?: boolean): Promise<ISolrCaseSearchResponse>;
|
|
18
18
|
export {};
|
|
19
19
|
//# sourceMappingURL=caseListUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"caseListUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/caseListUtils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAIxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAC;AACrF,OAAO,EAAuC,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAOlG,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACjC,CAAC,CAAC,EAAE,CAAC,CAAC;IACN,MAAM,EAAE,WAAW,GAAG,UAAU,CAAC;IACjC,CAAC,CAAC,EAAE,KAAK,CAAC;CACb;AAED,UAAU,iBAAiB;IACvB,gBAAgB,EAAE,uBAAuB,CAAC;IAC1C,sBAAsB,EAAE,OAAO,CAAC;IAChC,gBAAgB,EAAE,OAAO,CAAC;CAC7B;AAiBD,wBAAsB,WAAW,CAC7B,WAAW,EAAE,oBAAoB,EACjC,YAAY,EAAE,QAAQ,EACtB,mBAAmB,EAAE,OAAO,CAAC,QAAQ,CAAC,EACtC,WAAW,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"caseListUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/caseListUtils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAIxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAC;AACrF,OAAO,EAAuC,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAOlG,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACjC,CAAC,CAAC,EAAE,CAAC,CAAC;IACN,MAAM,EAAE,WAAW,GAAG,UAAU,CAAC;IACjC,CAAC,CAAC,EAAE,KAAK,CAAC;CACb;AAED,UAAU,iBAAiB;IACvB,gBAAgB,EAAE,uBAAuB,CAAC;IAC1C,sBAAsB,EAAE,OAAO,CAAC;IAChC,gBAAgB,EAAE,OAAO,CAAC;CAC7B;AAiBD,wBAAsB,WAAW,CAC7B,WAAW,EAAE,oBAAoB,EACjC,YAAY,EAAE,QAAQ,EACtB,mBAAmB,EAAE,OAAO,CAAC,QAAQ,CAAC,EACtC,WAAW,EAAE,WAAW,GACzB,OAAO,CAAC,iBAAiB,CAAC,CAwF5B;AAED,wBAAgB,mBAAmB,CAC/B,SAAS,EAAE,gBAAgB,EAC3B,aAAa,EAAE,OAAO,EACtB,WAAW,EAAE,WAAW,EACxB,eAAe,GAAE,OAAe,GACjC,OAAO,CAAC,uBAAuB,CAAC,CASlC"}
|
|
@@ -20,10 +20,10 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
};
|
|
21
21
|
import { publicApi, search } from '@cee-eng/hydrajs';
|
|
22
22
|
import { promiseReflection } from '@rh-support/utils';
|
|
23
|
-
import {
|
|
23
|
+
import { canDoSfdcSearch, isNoFilterApplied } from '../components/case-list/CaseListFilterHelpers';
|
|
24
24
|
import { createSFDCQueryFromFilterState, createSolrQueryFromFilterState, mapSFDCCaseListToSolrCaseList, } from './caseSearchUtils';
|
|
25
25
|
const throwErrorOnAbort = (message) => {
|
|
26
|
-
const isAbortError = message && message.toLowerCase().
|
|
26
|
+
const isAbortError = message && message.toLowerCase().includes('abort');
|
|
27
27
|
if (isAbortError)
|
|
28
28
|
throw new Error(message);
|
|
29
29
|
};
|
|
@@ -36,7 +36,7 @@ const throwErrorOnAbort = (message) => {
|
|
|
36
36
|
// and override the solr result with sfdc.
|
|
37
37
|
// Even though SFDC support most of the filters but another problem with SFDC is it doesnot support multiple values for a praticular filter.
|
|
38
38
|
// if user applies any filter apart from default filter we will always call solr and assume that(not safely) 10 sec scenario is not bound to happen.
|
|
39
|
-
export function getCaseList(filterState, loggedInUser, loggedInUserAccount, abortSignal
|
|
39
|
+
export function getCaseList(filterState, loggedInUser, loggedInUserAccount, abortSignal) {
|
|
40
40
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
41
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
42
|
let isSolrSearchDownSFDCUp = false;
|
|
@@ -44,7 +44,7 @@ export function getCaseList(filterState, loggedInUser, loggedInUserAccount, abor
|
|
|
44
44
|
let caseListResponse;
|
|
45
45
|
const solrFilter = createSolrQueryFromFilterState(filterState, loggedInUser);
|
|
46
46
|
const partnerSearch = loggedInUser.hasManagedAccounts() && ((_b = (_a = filterState.filterInfo) === null || _a === void 0 ? void 0 : _a.case_accountNumber) !== null && _b !== void 0 ? _b : []).length > 0;
|
|
47
|
-
const isSfdcSearchRequired = (
|
|
47
|
+
const isSfdcSearchRequired = canDoSfdcSearch(filterState) && !filterState.filterQueryInfo.queryString;
|
|
48
48
|
let solrPromise = getCaseListFromSolr(solrFilter, partnerSearch, abortSignal, loggedInUserAccount === null || loggedInUserAccount === void 0 ? void 0 : loggedInUserAccount.secureSupport);
|
|
49
49
|
const sfdcAPICall = () => publicApi.caseList.getCaseListFromSFDC(createSFDCQueryFromFilterState(filterState, loggedInUser, loggedInUserAccount, isNoFilterApplied(filterState)), partnerSearch, loggedInUserAccount === null || loggedInUserAccount === void 0 ? void 0 : loggedInUserAccount.secureSupport, abortSignal);
|
|
50
50
|
const sfdcPromise = isSfdcSearchRequired ? sfdcAPICall() : Promise.resolve(undefined);
|
|
@@ -62,20 +62,25 @@ export function getCaseList(filterState, loggedInUser, loggedInUserAccount, abor
|
|
|
62
62
|
showErrorMessage = true;
|
|
63
63
|
}
|
|
64
64
|
else if (!solrFullfilled && sfdcCallNotMade) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
65
|
+
// SFDC call didn't make because we had filters that SFDC doesn't support
|
|
66
|
+
try {
|
|
67
|
+
const sfdcRes = yield promiseReflection(sfdcAPICall());
|
|
68
|
+
sfdcFullfilled = !!(sfdcRes.status === 'fulfilled' && ((_e = sfdcRes.v) === null || _e === void 0 ? void 0 : _e.cases));
|
|
69
|
+
if (sfdcFullfilled) {
|
|
70
|
+
isSolrSearchDownSFDCUp = true;
|
|
71
|
+
const mappedSfdcRes = mapSFDCCaseListToSolrCaseList((_g = (_f = sfdcRes === null || sfdcRes === void 0 ? void 0 : sfdcRes.v) === null || _f === void 0 ? void 0 : _f.cases) !== null && _g !== void 0 ? _g : []);
|
|
72
|
+
caseListResponse = {
|
|
73
|
+
response: {
|
|
74
|
+
docs: mappedSfdcRes,
|
|
75
|
+
numFound: sfdcRes.v.totalCount,
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
}
|
|
76
79
|
}
|
|
77
|
-
|
|
78
|
-
|
|
80
|
+
catch (e) {
|
|
81
|
+
if (!e.message.toLowerCase().includes('abort')) {
|
|
82
|
+
showErrorMessage = true;
|
|
83
|
+
}
|
|
79
84
|
}
|
|
80
85
|
}
|
|
81
86
|
else if (solrFullfilled && sfdcFullfilled) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/cases",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.34",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@patternfly/react-table": "4.26.7",
|
|
55
55
|
"@rh-support/api": "0.3.9",
|
|
56
56
|
"@rh-support/components": "1.1.23",
|
|
57
|
-
"@rh-support/react-context": "0.2.
|
|
57
|
+
"@rh-support/react-context": "0.2.26",
|
|
58
58
|
"@rh-support/types": "0.2.0",
|
|
59
59
|
"@rh-support/user-permissions": "0.2.17",
|
|
60
60
|
"@rh-support/utils": "0.2.15",
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
"not ie <= 11",
|
|
102
102
|
"not op_mini all"
|
|
103
103
|
],
|
|
104
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "aaf1c0772424a3918b78cef3ac74afcce4c6b583"
|
|
105
105
|
}
|