@rh-support/cases 0.2.29 → 0.2.33

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":"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,eAucrC"}
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"}
@@ -151,7 +151,7 @@ export function CaseList(props) {
151
151
  }
152
152
  });
153
153
  }
154
- if (changed) {
154
+ if (changed && location.pathname === '/case/list') {
155
155
  setCaseList(CaseListDispatch, caseListResponse.response);
156
156
  pendoTrackEvent(UpdatedCaseDataEvent);
157
157
  ToastNotification.addSuccessMessage(t('Case data has been updated'));
@@ -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
- export { isNoFilterApplied, isOnlyDefaultFilterApplied, isOnlyGroupFilterApplied, isSearchSupportedBySFDC, isOnlyStatusFilter, isStatusFilterWithSFDCSupportedValues, };
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":"AAIA,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;AAEF,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,OAAO,EACH,iBAAiB,EACjB,0BAA0B,EAC1B,wBAAwB,EACxB,uBAAuB,EACvB,kBAAkB,EAClB,qCAAqC,GACxC,CAAC"}
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;AAEF,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) => {
@@ -49,4 +51,29 @@ const isSearchSupportedBySFDC = (filterState) => {
49
51
  isOnlyGroupFilterApplied(filterState.filterInfo) ||
50
52
  isOnlyStatusFilter(filterState.filterInfo));
51
53
  };
52
- export { isNoFilterApplied, isOnlyDefaultFilterApplied, isOnlyGroupFilterApplied, isSearchSupportedBySFDC, isOnlyStatusFilter, isStatusFilterWithSFDCSupportedValues, };
54
+ const eligibleSFDCFiltersWithLengthOne = [SolrKeys.status, SolrKeys.severity, SolrPivotKeys.product_version];
55
+ const eligibleSFDCFiltersMultipleValues = [SolrKeys.group];
56
+ const visibleFilterChipsWhenSolrDownSfdcUp = [
57
+ ...eligibleSFDCFiltersWithLengthOne,
58
+ ...eligibleSFDCFiltersMultipleValues,
59
+ ];
60
+ //sfdc call should be called only when user has selected the filters that SFDC supports that are products, severity, state and group
61
+ //products, severity, state only can have one selected value but group can have multiple values
62
+ function canDoSfdcSearch(filterState) {
63
+ if (isNoFilterApplied(filterState) || isOnlyDefaultFilterApplied(filterState))
64
+ return true;
65
+ return every(filterState.filterInfo, (filterValue, filterKey) => {
66
+ if (filterValue.length === 0 ||
67
+ isStatusFilterWithSFDCSupportedValues ||
68
+ // @ts-ignore
69
+ (filterValue.length > 1 && eligibleSFDCFiltersMultipleValues.includes(filterKey)) ||
70
+ // @ts-ignore
71
+ (filterValue.length === 1 && eligibleSFDCFiltersWithLengthOne.includes(filterKey))) {
72
+ return true;
73
+ }
74
+ else {
75
+ return false;
76
+ }
77
+ });
78
+ }
79
+ export { isNoFilterApplied, isOnlyDefaultFilterApplied, isOnlyGroupFilterApplied, isSearchSupportedBySFDC, isOnlyStatusFilter, isStatusFilterWithSFDCSupportedValues, canDoSfdcSearch, visibleFilterChipsWhenSolrDownSfdcUp, eligibleSFDCFiltersWithLengthOne, eligibleSFDCFiltersMultipleValues, };
@@ -1,6 +1,7 @@
1
1
  import { IProductVersionPivotMap } from '../CaseList';
2
2
  interface IProps {
3
3
  productVersionPivotValues: IProductVersionPivotMap[];
4
+ isSolrSearchDown: boolean;
4
5
  }
5
6
  export declare function CaseListFilterChips(props: IProps): JSX.Element;
6
7
  export {};
@@ -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;AAKtD,UAAU,MAAM;IACZ,yBAAyB,EAAE,uBAAuB,EAAE,CAAC;CACxD;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,eAqHhD"}
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
- return (React.createElement("div", { className: "filter-chip", key: `${filterKey}-bookmarks-${groupName}` },
37
- React.createElement("span", { className: "filter-chip__heading" },
38
- React.createElement(Trans, null, groupName || filterNamesMap[filterKey] || filterKey)),
39
- React.createElement(ChipGroup, { numChips: 7, className: "pf-c-chip-group__simple" }, renderFilterValueChips(filterKey, filterValues, groupName))));
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], productVersionPivot: props.productVersionPivotValues })),
81
- showUsernameFilter && React.createElement(CreatorSsoNameFilterChip, null),
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, forceSfdcSearch?: boolean): Promise<ICaseListResponse>;
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,EACxB,eAAe,CAAC,EAAE,OAAO,GAC1B,OAAO,CAAC,iBAAiB,CAAC,CAmF5B;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"}
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 { isNoFilterApplied, isSearchSupportedBySFDC } from '../components/case-list/CaseListFilterHelpers';
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().indexOf('abort') > -1;
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, forceSfdcSearch) {
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 = (forceSfdcSearch || isSearchSupportedBySFDC(filterState)) && !filterState.filterQueryInfo.queryString;
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
- const sfdcRes = yield promiseReflection(sfdcAPICall());
66
- sfdcFullfilled = !!(sfdcRes.status === 'fulfilled' && ((_e = sfdcRes.v) === null || _e === void 0 ? void 0 : _e.cases));
67
- if (sfdcFullfilled) {
68
- isSolrSearchDownSFDCUp = true;
69
- 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 : []);
70
- caseListResponse = {
71
- response: {
72
- docs: mappedSfdcRes,
73
- numFound: sfdcRes.v.totalCount,
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
- else {
78
- showErrorMessage = true;
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.29",
3
+ "version": "0.2.33",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -53,8 +53,8 @@
53
53
  "@patternfly/react-core": "4.128.2",
54
54
  "@patternfly/react-table": "4.26.7",
55
55
  "@rh-support/api": "0.3.9",
56
- "@rh-support/components": "1.1.22",
57
- "@rh-support/react-context": "0.2.24",
56
+ "@rh-support/components": "1.1.23",
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": "95f6b6477203d61a26c97454278664b6023eb2cf"
104
+ "gitHead": "9d3cacdac751221c479d7468960a2e2e444da56d"
105
105
  }