@rh-support/cases 0.2.32 → 0.2.35-alpha.0

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,eAidrC"}
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"}
@@ -37,7 +37,7 @@ import { CaseSearch } from './case-search/CaseSearch';
37
37
  import { useCaseListDispatchContext, useCaseListStateContext } from './CaseListContext';
38
38
  import { CaseListFilterDispatchContext, CaseListFilterStateContext } from './CaseListFilterContext';
39
39
  import { isNoFilterApplied, isOnlyDefaultFilterApplied } from './CaseListFilterHelpers';
40
- import { initialFilterInfo, updateFilterState } from './CaseListFilterReducer';
40
+ import { updateFilterState } from './CaseListFilterReducer';
41
41
  import { setCaseList, setCurrentQuery, setFilterValuesFromFacetResponse, setIsFetching, setPivotValues, } from './CaseListReducer';
42
42
  export function CaseList(props) {
43
43
  var _a, _b;
@@ -81,11 +81,7 @@ export function CaseList(props) {
81
81
  // recreate a new AbortController for each call
82
82
  let controller = new AbortController();
83
83
  abortControllerRef.current = controller;
84
- const { caseListResponse, isSolrSearchDownSFDCUp, showErrorMessage, resetFilters } = yield getCaseList(currentFilterState, loggedInUserRights.data, loggedInUsersAccount.data, controller.signal);
85
- if (resetFilters) {
86
- updateFilterState(filterDispatch, Object.assign(Object.assign({}, filterState), { filterInfo: Object.assign({}, initialFilterInfo) }));
87
- return;
88
- }
84
+ const { caseListResponse, isSolrSearchDownSFDCUp, showErrorMessage } = yield getCaseList(currentFilterState, loggedInUserRights.data, loggedInUsersAccount.data, controller.signal);
89
85
  showError = showErrorMessage;
90
86
  setSolrSearchDown(isSolrSearchDownSFDCUp);
91
87
  setFilterValuesFromFacetResponse(CaseListDispatch, solrResponseToFacetFields(caseListResponse));
@@ -134,11 +130,7 @@ export function CaseList(props) {
134
130
  };
135
131
  const checkNewCases = () => __awaiter(this, void 0, void 0, function* () {
136
132
  try {
137
- const { caseListResponse, isSolrSearchDownSFDCUp, resetFilters } = yield getCaseList(filterState, loggedInUserRights.data, loggedInUsersAccount.data, null);
138
- if (resetFilters) {
139
- updateFilterState(filterDispatch, Object.assign(Object.assign({}, filterState), { filterInfo: Object.assign({}, initialFilterInfo) }));
140
- return;
141
- }
133
+ const { caseListResponse, isSolrSearchDownSFDCUp } = yield getCaseList(filterState, loggedInUserRights.data, loggedInUsersAccount.data, null);
142
134
  setSolrSearchDown(isSolrSearchDownSFDCUp);
143
135
  let changed = false;
144
136
  if (caseListResponse.response.numFound <= filterState.paginationInfo.pageSize &&
@@ -322,7 +314,7 @@ export function CaseList(props) {
322
314
  React.createElement(ErrorBoundary, { errorMsgInfo: { message: t('There was an error loading case search input') } },
323
315
  React.createElement(CaseSearch, null))),
324
316
  isBasicSearchMode && (React.createElement(ErrorBoundary, { errorMsgInfo: { message: t('There was an error loading filter chips') } },
325
- React.createElement(CaseListFilterChips, { productVersionPivotValues: get(pivotValues, SolrPivotKeys.product_version, []) })))),
317
+ React.createElement(CaseListFilterChips, { productVersionPivotValues: get(pivotValues, SolrPivotKeys.product_version, []), isSolrSearchDown: isSolrSearchDown })))),
326
318
  React.createElement("section", { className: "case-search-bottom" },
327
319
  isBasicSearchMode && (React.createElement("aside", { className: `case-search-filters ${((_a = filterSectionRef.current) === null || _a === void 0 ? void 0 : _a.expanded) ? '' : 'collapsed'}` },
328
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;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
- export { isNoFilterApplied, isOnlyDefaultFilterApplied, isOnlyGroupFilterApplied, isSearchSupportedBySFDC, isOnlyStatusFilter, isStatusFilterWithSFDCSupportedValues, };
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,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"))))))));
@@ -12,9 +12,8 @@ interface ICaseListResponse {
12
12
  caseListResponse: ISolrCaseSearchResponse;
13
13
  isSolrSearchDownSFDCUp: boolean;
14
14
  showErrorMessage: boolean;
15
- resetFilters: boolean;
16
15
  }
17
- 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>;
18
17
  export declare function getCaseListFromSolr(solrQuery: ISearchSolrQuery, partnerSearch: boolean, abortSignal: AbortSignal, isSecureSupport?: boolean): Promise<ISolrCaseSearchResponse>;
19
18
  export {};
20
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;IAC1B,YAAY,EAAE,OAAO,CAAC;CACzB;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,CAyE5B;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,16 +36,15 @@ 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) {
40
- var _a, _b, _c, _d, _e, _f, _g, _h;
39
+ export function getCaseList(filterState, loggedInUser, loggedInUserAccount, abortSignal) {
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;
43
43
  let showErrorMessage = false;
44
- let resetFilters = false;
45
44
  let caseListResponse;
46
45
  const solrFilter = createSolrQueryFromFilterState(filterState, loggedInUser);
47
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;
48
- const isSfdcSearchRequired = (forceSfdcSearch || isSearchSupportedBySFDC(filterState)) && !filterState.filterQueryInfo.queryString;
47
+ const isSfdcSearchRequired = canDoSfdcSearch(filterState) && !filterState.filterQueryInfo.queryString;
49
48
  let solrPromise = getCaseListFromSolr(solrFilter, partnerSearch, abortSignal, loggedInUserAccount === null || loggedInUserAccount === void 0 ? void 0 : loggedInUserAccount.secureSupport);
50
49
  const sfdcAPICall = () => publicApi.caseList.getCaseListFromSFDC(createSFDCQueryFromFilterState(filterState, loggedInUser, loggedInUserAccount, isNoFilterApplied(filterState)), partnerSearch, loggedInUserAccount === null || loggedInUserAccount === void 0 ? void 0 : loggedInUserAccount.secureSupport, abortSignal);
51
50
  const sfdcPromise = isSfdcSearchRequired ? sfdcAPICall() : Promise.resolve(undefined);
@@ -64,11 +63,29 @@ export function getCaseList(filterState, loggedInUser, loggedInUserAccount, abor
64
63
  }
65
64
  else if (!solrFullfilled && sfdcCallNotMade) {
66
65
  // SFDC call didn't make because we had filters that SFDC doesn't support
67
- resetFilters = true;
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
+ }
79
+ }
80
+ catch (e) {
81
+ if (!e.message.toLowerCase().includes('abort')) {
82
+ showErrorMessage = true;
83
+ }
84
+ }
68
85
  }
69
86
  else if (solrFullfilled && sfdcFullfilled) {
70
87
  caseListResponse = Object.assign(Object.assign({}, solrResponse.v), { response: {
71
- docs: mapSFDCCaseListToSolrCaseList((_f = (_e = sfdcResponse === null || sfdcResponse === void 0 ? void 0 : sfdcResponse.v) === null || _e === void 0 ? void 0 : _e.cases) !== null && _f !== void 0 ? _f : []),
88
+ docs: mapSFDCCaseListToSolrCaseList((_j = (_h = sfdcResponse === null || sfdcResponse === void 0 ? void 0 : sfdcResponse.v) === null || _h === void 0 ? void 0 : _h.cases) !== null && _j !== void 0 ? _j : []),
72
89
  numFound: sfdcResponse.v.totalCount,
73
90
  } });
74
91
  }
@@ -76,7 +93,7 @@ export function getCaseList(filterState, loggedInUser, loggedInUserAccount, abor
76
93
  isSolrSearchDownSFDCUp = true;
77
94
  caseListResponse = {
78
95
  response: {
79
- docs: mapSFDCCaseListToSolrCaseList((_h = (_g = sfdcResponse === null || sfdcResponse === void 0 ? void 0 : sfdcResponse.v) === null || _g === void 0 ? void 0 : _g.cases) !== null && _h !== void 0 ? _h : []),
96
+ docs: mapSFDCCaseListToSolrCaseList((_l = (_k = sfdcResponse === null || sfdcResponse === void 0 ? void 0 : sfdcResponse.v) === null || _k === void 0 ? void 0 : _k.cases) !== null && _l !== void 0 ? _l : []),
80
97
  numFound: sfdcResponse.v.totalCount,
81
98
  },
82
99
  };
@@ -88,7 +105,6 @@ export function getCaseList(filterState, loggedInUser, loggedInUserAccount, abor
88
105
  caseListResponse,
89
106
  isSolrSearchDownSFDCUp,
90
107
  showErrorMessage,
91
- resetFilters,
92
108
  };
93
109
  });
94
110
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/cases",
3
- "version": "0.2.32",
3
+ "version": "0.2.35-alpha.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -26,7 +26,7 @@
26
26
  "lib/**/*"
27
27
  ],
28
28
  "peerDependencies": {
29
- "@cee-eng/hydrajs": "4.7.3",
29
+ "@cee-eng/hydrajs": "4.7.20",
30
30
  "@patternfly/patternfly": "4.102.2",
31
31
  "@patternfly/pfe-collapse": "1.1.0",
32
32
  "@patternfly/react-core": "4.128.2",
@@ -47,17 +47,17 @@
47
47
  "solr-query-builder": "1.0.1"
48
48
  },
49
49
  "dependencies": {
50
- "@cee-eng/hydrajs": "4.7.3",
50
+ "@cee-eng/hydrajs": "4.7.20",
51
51
  "@patternfly/patternfly": "4.102.2",
52
52
  "@patternfly/pfe-collapse": "1.1.0",
53
53
  "@patternfly/react-core": "4.128.2",
54
54
  "@patternfly/react-table": "4.26.7",
55
- "@rh-support/api": "0.3.9",
56
- "@rh-support/components": "1.1.23",
57
- "@rh-support/react-context": "0.2.26",
55
+ "@rh-support/api": "0.3.10-alpha.0",
56
+ "@rh-support/components": "1.1.24-alpha.0",
57
+ "@rh-support/react-context": "0.2.27-alpha.0",
58
58
  "@rh-support/types": "0.2.0",
59
- "@rh-support/user-permissions": "0.2.17",
60
- "@rh-support/utils": "0.2.15",
59
+ "@rh-support/user-permissions": "0.2.18-alpha.0",
60
+ "@rh-support/utils": "0.2.16-alpha.0",
61
61
  "i18next": "^19.0.1",
62
62
  "localforage": "^1.7.3",
63
63
  "lodash": "^4.17.15",
@@ -101,5 +101,5 @@
101
101
  "not ie <= 11",
102
102
  "not op_mini all"
103
103
  ],
104
- "gitHead": "89ef7aa11c6152e04055c8869184e1e146ebea99"
104
+ "gitHead": "c270e1594ee0d15480e217813fef7a88192db45d"
105
105
  }