@rh-support/cases 2.6.168 → 2.6.170

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.
Files changed (89) hide show
  1. package/lib/esm/components/case-list/CaseList.d.ts +0 -7
  2. package/lib/esm/components/case-list/CaseList.d.ts.map +1 -1
  3. package/lib/esm/components/case-list/CaseList.js +116 -111
  4. package/lib/esm/components/case-list/CaseListContext.d.ts.map +1 -1
  5. package/lib/esm/components/case-list/CaseListContext.js +0 -2
  6. package/lib/esm/components/case-list/CaseListFilterReducer.d.ts +6 -1
  7. package/lib/esm/components/case-list/CaseListFilterReducer.d.ts.map +1 -1
  8. package/lib/esm/components/case-list/CaseListFilterReducer.js +4 -1
  9. package/lib/esm/components/case-list/CaseListReducer.d.ts +2 -8
  10. package/lib/esm/components/case-list/CaseListReducer.d.ts.map +1 -1
  11. package/lib/esm/components/case-list/CaseListReducer.js +1 -13
  12. package/lib/esm/components/case-list/case-list-filters/AccountsFilter.d.ts.map +1 -1
  13. package/lib/esm/components/case-list/case-list-filters/AccountsFilter.js +18 -11
  14. package/lib/esm/components/case-list/case-list-filters/AdditionalFilters.d.ts.map +1 -1
  15. package/lib/esm/components/case-list/case-list-filters/AdditionalFilters.js +28 -3
  16. package/lib/esm/components/case-list/case-list-filters/CaseListFilterChips.d.ts +1 -7
  17. package/lib/esm/components/case-list/case-list-filters/CaseListFilterChips.d.ts.map +1 -1
  18. package/lib/esm/components/case-list/case-list-filters/CaseListFilterChips.js +7 -15
  19. package/lib/esm/components/case-list/case-list-filters/CaseListFilters.d.ts +2 -5
  20. package/lib/esm/components/case-list/case-list-filters/CaseListFilters.d.ts.map +1 -1
  21. package/lib/esm/components/case-list/case-list-filters/CaseListFilters.js +14 -14
  22. package/lib/esm/components/case-list/case-list-filters/ProductFilterChip.d.ts +1 -3
  23. package/lib/esm/components/case-list/case-list-filters/ProductFilterChip.d.ts.map +1 -1
  24. package/lib/esm/components/case-list/case-list-filters/ProductFilterChip.js +2 -2
  25. package/lib/esm/components/case-list/case-list-filters/ProductsFilter.d.ts +5 -4
  26. package/lib/esm/components/case-list/case-list-filters/ProductsFilter.d.ts.map +1 -1
  27. package/lib/esm/components/case-list/case-list-filters/ProductsFilter.js +15 -54
  28. package/lib/esm/components/case-list/case-list-filters/SeverityFilter.d.ts +0 -3
  29. package/lib/esm/components/case-list/case-list-filters/SeverityFilter.d.ts.map +1 -1
  30. package/lib/esm/components/case-list/case-list-filters/SeverityFilter.js +18 -44
  31. package/lib/esm/components/case-list/case-list-filters/StatusFilter.d.ts +0 -3
  32. package/lib/esm/components/case-list/case-list-filters/StatusFilter.d.ts.map +1 -1
  33. package/lib/esm/components/case-list/case-list-filters/StatusFilter.js +14 -44
  34. package/lib/esm/components/case-list/case-list-filters/VersionsFilter.d.ts +1 -3
  35. package/lib/esm/components/case-list/case-list-filters/VersionsFilter.d.ts.map +1 -1
  36. package/lib/esm/components/case-list/case-list-filters/VersionsFilter.js +61 -32
  37. package/lib/esm/components/case-list/case-list-table/CaseListTable.d.ts +0 -1
  38. package/lib/esm/components/case-list/case-list-table/CaseListTable.d.ts.map +1 -1
  39. package/lib/esm/components/case-list/case-list-table/CaseListTable.js +9 -8
  40. package/lib/esm/components/case-list/case-list-table/DownloadCSVFileModal.d.ts +0 -5
  41. package/lib/esm/components/case-list/case-list-table/DownloadCSVFileModal.d.ts.map +1 -1
  42. package/lib/esm/components/case-list/case-list-table/DownloadCSVFileModal.js +38 -68
  43. package/lib/esm/components/case-list/case-list-table/ExportCaseListCSV.d.ts.map +1 -1
  44. package/lib/esm/components/case-list/case-list-table/ExportCaseListCSV.js +5 -15
  45. package/lib/esm/components/case-list/case-list-table/SeverityLabel.js +1 -1
  46. package/lib/esm/components/case-list/case-list-table/TableActionsDropdown.d.ts.map +1 -1
  47. package/lib/esm/components/case-list/case-list-table/TableActionsDropdown.js +2 -3
  48. package/lib/esm/components/case-list/case-search/AdvanceSearch.d.ts.map +1 -1
  49. package/lib/esm/components/case-list/case-search/AdvanceSearch.js +2 -2
  50. package/lib/esm/components/case-list/case-search/BookmarkedSearchesSelector.d.ts.map +1 -1
  51. package/lib/esm/components/case-list/case-search/BookmarkedSearchesSelector.js +1 -0
  52. package/lib/esm/components/case-list/case-search/CaseSearch.d.ts.map +1 -1
  53. package/lib/esm/components/case-list/case-search/CaseSearch.js +6 -6
  54. package/lib/esm/components/case-list/case-search/useAdvanceSearchParser.d.ts.map +1 -1
  55. package/lib/esm/components/case-list/case-search/useAdvanceSearchParser.js +4 -1
  56. package/lib/esm/css/caseList.css +0 -2
  57. package/lib/esm/enums/case.d.ts +2 -1
  58. package/lib/esm/enums/case.d.ts.map +1 -1
  59. package/lib/esm/enums/case.js +14 -1
  60. package/lib/esm/enums/caseSearch.d.ts +2 -0
  61. package/lib/esm/enums/caseSearch.d.ts.map +1 -1
  62. package/lib/esm/enums/caseSearch.js +1 -0
  63. package/lib/esm/enums/filters.d.ts +3 -1
  64. package/lib/esm/enums/filters.d.ts.map +1 -1
  65. package/lib/esm/enums/filters.js +2 -0
  66. package/lib/esm/hooks/useExportCaseListCSV.d.ts.map +1 -1
  67. package/lib/esm/hooks/useExportCaseListCSV.js +1 -9
  68. package/lib/esm/models/caseList.d.ts +0 -2
  69. package/lib/esm/models/caseList.d.ts.map +1 -1
  70. package/lib/esm/test-utils/mockData.js +1 -1
  71. package/lib/esm/utils/caseListGraphQLUtils.d.ts +16 -0
  72. package/lib/esm/utils/caseListGraphQLUtils.d.ts.map +1 -0
  73. package/lib/esm/utils/caseListGraphQLUtils.js +193 -0
  74. package/lib/esm/utils/caseListMapper.d.ts +6 -0
  75. package/lib/esm/utils/caseListMapper.d.ts.map +1 -0
  76. package/lib/esm/utils/caseListMapper.js +36 -0
  77. package/lib/esm/utils/caseListVariablesBuilder.d.ts +13 -0
  78. package/lib/esm/utils/caseListVariablesBuilder.d.ts.map +1 -0
  79. package/lib/esm/utils/caseListVariablesBuilder.js +160 -0
  80. package/lib/esm/utils/caseSearchUtils.d.ts.map +1 -1
  81. package/lib/esm/utils/caseSearchUtils.js +51 -10
  82. package/lib/esm/utils/constants.d.ts +2 -0
  83. package/lib/esm/utils/constants.d.ts.map +1 -1
  84. package/lib/esm/utils/constants.js +14 -0
  85. package/lib/esm/utils/mockSolrResponse.js +1 -1
  86. package/lib/esm/utils/statusUtils.d.ts +3 -0
  87. package/lib/esm/utils/statusUtils.d.ts.map +1 -0
  88. package/lib/esm/utils/statusUtils.js +22 -0
  89. package/package.json +7 -7
@@ -1,43 +1,23 @@
1
1
  import { Button, MenuToggle, Select, SelectList, SelectOption, } from '@patternfly/react-core';
2
- import { SingleSelectDropdown, useSelectKeyboardNavigator } from '@rh-support/components';
2
+ import { useSelectKeyboardNavigator } from '@rh-support/components';
3
3
  import isEmpty from 'lodash/isEmpty';
4
4
  import React, { useContext, useEffect, useState } from 'react';
5
5
  import { useTranslation } from 'react-i18next';
6
6
  import { SolrKeys } from '../../../enums/filters';
7
- import { filterNamesMap } from '../../../utils/constants';
7
+ import { filterNamesMap, PORTAL_DISPLAY_STATUSES } from '../../../utils/constants';
8
8
  import { CaseListFilterDispatchContext, CaseListFilterStateContext } from '../CaseListFilterContext';
9
9
  import { updateFilter } from '../CaseListFilterReducer';
10
10
  export function StatusFilter(props) {
11
- var _a;
12
11
  const dispatch = useContext(CaseListFilterDispatchContext);
13
12
  const { t } = useTranslation();
14
13
  const { filterInfo } = useContext(CaseListFilterStateContext);
15
14
  const [isOpen, setIsOpen] = useState(false);
16
15
  const [selectedItems, setSelectedItems] = useState({});
17
- const list = props.isSolrSearchDown
18
- ? props.allCaseStatuses.map((status) => ({ value: status, key: status }))
19
- : props.filterValues.map((filterValue) => ({ value: filterValue.value, key: filterValue.value }));
20
- const singleSelectOptions = list.map((item) => ({
21
- value: item.value,
22
- label: item.value,
23
- }));
24
- const selectedStatus = ((_a = filterInfo === null || filterInfo === void 0 ? void 0 : filterInfo[SolrKeys.status]) === null || _a === void 0 ? void 0 : _a[0]) || '';
25
- const selectedOption = {
26
- value: selectedStatus,
27
- label: selectedStatus,
28
- };
16
+ const list = PORTAL_DISPLAY_STATUSES.map((status) => ({ value: status, key: status }));
29
17
  const onToggleClick = (e) => {
30
18
  setIsOpen(!isOpen);
31
19
  };
32
20
  const onSelect = (option) => {
33
- if (props.isSolrSearchDown) {
34
- updateFilter(dispatch, {
35
- filterKey: SolrKeys.status,
36
- values: [option.value],
37
- });
38
- setIsOpen(false);
39
- return;
40
- }
41
21
  const prevSelectedStatuses = Object.keys(selectedItems).filter((item) => selectedItems[item] && item);
42
22
  if (selectedItems[option.value]) {
43
23
  setSelectedItems((prevData) => (Object.assign(Object.assign({}, prevData), { [option.value]: false })));
@@ -75,42 +55,32 @@ export function StatusFilter(props) {
75
55
  else if (selectedValues && selectedValues.length === 1) {
76
56
  return selectedValues[0];
77
57
  }
78
- else if (selectedValues && selectedValues.length === 3) {
58
+ else if (selectedValues && totalLength && selectedValues.length === totalLength) {
79
59
  return t('All cases');
80
60
  }
81
61
  else {
82
- if (selectedValues &&
83
- selectedValues.length === 2 &&
84
- selectedValues.every((item) => item.includes('Waiting'))) {
62
+ const hasAllOpenSelected = selectedValues.includes('In Progress') &&
63
+ selectedValues.includes('Waiting on Customer') &&
64
+ !selectedValues.includes('Closed');
65
+ if (hasAllOpenSelected) {
85
66
  return t('All open cases');
86
67
  }
87
- else if (selectedValues && totalLength && selectedValues.length === totalLength) {
88
- return totalLengthString || btnPlaceholder;
89
- }
90
68
  else {
91
69
  return `${selectedValues.length} ${type} selected`;
92
70
  }
93
71
  }
94
72
  };
95
- const placeholder = props.isSolrSearchDown
96
- ? t('Select a status')
97
- : getBtnPlaceholder(t('Select a status'), (filterInfo === null || filterInfo === void 0 ? void 0 : filterInfo[SolrKeys.status]) || [], ' ', list.length, t('All selected'));
73
+ const placeholder = getBtnPlaceholder(t('Select a status'), (filterInfo === null || filterInfo === void 0 ? void 0 : filterInfo[SolrKeys.status]) || [], ' ', list.length, t('All selected'));
98
74
  const toggle = (toggleRef) => (React.createElement(MenuToggle, { variant: "default", onClick: onToggleClick, innerRef: toggleRef, isExpanded: isOpen, isFullWidth: true, onKeyDown: onInputKeyDown },
99
75
  placeholder,
100
76
  Object.keys(selectedItems).filter((key) => selectedItems[key] === true).length > 0 && (React.createElement(Button, { icon: "", variant: "plain", onClick: onClick, "aria-label": "Clear selection", className: "pf-v6-c-select__toggle-clear" }))));
101
- const dropdownOptions = list.map((option, index) => !isEmpty(option.value) && (React.createElement(SelectOption, { key: option.key, value: option, hasCheckbox: !props.isSolrSearchDown, isSelected: selectedItems[option.value], isFocused: focusedItemIndex !== null && focusedItemIndex === index, id: `select-status-${option.value.replace(' ', '-')}` }, option.value)));
102
- const onSingleSelectChange = (option) => {
103
- updateFilter(dispatch, {
104
- filterKey: SolrKeys.status,
105
- values: [option.value],
106
- });
107
- };
77
+ const dropdownOptions = list.map((option, index) => !isEmpty(option.value) && (React.createElement(SelectOption, { key: option.key, value: option, hasCheckbox: true, isSelected: selectedItems[option.value], isFocused: focusedItemIndex !== null && focusedItemIndex === index, id: `select-status-${option.value.replace(' ', '-')}` }, option.value)));
108
78
  useEffect(() => {
109
79
  var _a;
110
80
  if (isEmpty(filterInfo === null || filterInfo === void 0 ? void 0 : filterInfo[SolrKeys.status])) {
111
81
  setSelectedItems({});
112
82
  }
113
- else if (!props.isSolrSearchDown) {
83
+ else {
114
84
  const selectedStatuses = (_a = filterInfo === null || filterInfo === void 0 ? void 0 : filterInfo[SolrKeys.status]) === null || _a === void 0 ? void 0 : _a.reduce((selection, status) => {
115
85
  selection[status] = true;
116
86
  return selection;
@@ -118,10 +88,10 @@ export function StatusFilter(props) {
118
88
  setSelectedItems(selectedStatuses || {});
119
89
  }
120
90
  // eslint-disable-next-line react-hooks/exhaustive-deps
121
- }, [filterInfo === null || filterInfo === void 0 ? void 0 : filterInfo[SolrKeys.status], props.isSolrSearchDown]);
91
+ }, [filterInfo === null || filterInfo === void 0 ? void 0 : filterInfo[SolrKeys.status]]);
122
92
  const titleId = 'case-list-status-filter';
123
93
  return (React.createElement("div", { className: "status-filter" },
124
94
  React.createElement("label", { htmlFor: titleId, className: "pf-v6-u-mb-sm status-filter-label" }, t(filterNamesMap[SolrKeys.status])),
125
- props.isSolrSearchDown ? (React.createElement(SingleSelectDropdown, { id: titleId, selected: selectedOption, options: singleSelectOptions, placeholder: t('Select a status'), onSelect: onSingleSelectChange, dataTrackingId: "status-filter", isScrollable: true })) : (React.createElement(Select, { shouldFocusToggleOnSelect: true, shouldPreventScrollOnItemFocus: true, id: titleId, "data-tracking-id": "status-filter", isOpen: isOpen, selected: selectedItems, onSelect: (_e, v) => onSelect(v), onOpenChange: (nextOpen) => setIsOpen(nextOpen), toggle: toggle, isScrollable: true, popperProps: { direction: 'down', enableFlip: false } },
126
- React.createElement(SelectList, null, dropdownOptions)))));
95
+ React.createElement(Select, { shouldFocusToggleOnSelect: true, shouldPreventScrollOnItemFocus: true, id: titleId, "data-tracking-id": "status-filter", isOpen: isOpen, selected: selectedItems, onSelect: (_e, v) => onSelect(v), onOpenChange: (nextOpen) => setIsOpen(nextOpen), toggle: toggle, isScrollable: true, popperProps: { direction: 'down', enableFlip: false } },
96
+ React.createElement(SelectList, null, dropdownOptions))));
127
97
  }
@@ -1,10 +1,8 @@
1
1
  import React from 'react';
2
- import { IProductVersionPivotMap } from '../CaseList';
3
2
  import { IProductFilter } from '../CaseListFilterReducer';
4
3
  interface IProps {
5
4
  productInfo: IProductFilter;
6
- productVersionPivot: IProductVersionPivotMap[];
7
5
  }
8
- export declare function VersionsFilter({ productInfo, productVersionPivot }: IProps): React.JSX.Element;
6
+ export declare function VersionsFilter({ productInfo }: IProps): React.JSX.Element;
9
7
  export {};
10
8
  //# sourceMappingURL=VersionsFilter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"VersionsFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/VersionsFilter.tsx"],"names":[],"mappings":"AAeA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAIhF,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAgB,MAAM,0BAA0B,CAAC;AAoCxE,UAAU,MAAM;IACZ,WAAW,EAAE,cAAc,CAAC;IAC5B,mBAAmB,EAAE,uBAAuB,EAAE,CAAC;CAClD;AAED,wBAAgB,cAAc,CAAC,EAAE,WAAW,EAAE,mBAAmB,EAAE,EAAE,MAAM,qBAkO1E"}
1
+ {"version":3,"file":"VersionsFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/VersionsFilter.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAKhF,OAAO,EAAE,cAAc,EAAgB,MAAM,0BAA0B,CAAC;AAgCxE,UAAU,MAAM;IACZ,WAAW,EAAE,cAAc,CAAC;CAC/B;AAED,wBAAgB,cAAc,CAAC,EAAE,WAAW,EAAE,EAAE,MAAM,qBAiQrD"}
@@ -1,15 +1,15 @@
1
+ import { useApolloClient } from '@apollo/client/react';
1
2
  import { Button, MenuToggle, Select, SelectList, SelectOption, TextInputGroup, TextInputGroupMain, TextInputGroupUtilities, } from '@patternfly/react-core';
2
3
  import TimesIcon from '@patternfly/react-icons/dist/js/icons/times-icon';
3
4
  import { useSelectKeyboardNavigator } from '@rh-support/components';
5
+ import { GlobalMetadataStateContext } from '@rh-support/react-context';
6
+ import { GET_PRODUCTS, handleGraphQLVersionsResponse } from '@rh-support/utils';
4
7
  import isEmpty from 'lodash/isEmpty';
5
8
  import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
6
9
  import { useTranslation } from 'react-i18next';
7
10
  import { SolrKeys, SolrPivotKeys } from '../../../enums/filters';
8
11
  import { CaseListFilterDispatchContext, CaseListFilterStateContext } from '../CaseListFilterContext';
9
12
  import { updateFilter } from '../CaseListFilterReducer';
10
- function getVersionValuesForProduct(productPivot = [], productName) {
11
- return (productPivot.find((item) => item.value === productName) || {}).case_version;
12
- }
13
13
  //split version into parts
14
14
  function parseVersionIntoParts(version) {
15
15
  //keep unknown version at last
@@ -33,32 +33,62 @@ function compareVersions(versionA, versionB) {
33
33
  //one is string and other is number => string takes precendence
34
34
  if (typeof a === 'string')
35
35
  return -1;
36
- if (typeof b == 'string')
36
+ if (typeof b === 'string')
37
37
  return 1;
38
38
  }
39
39
  return 0;
40
40
  }
41
- export function VersionsFilter({ productInfo, productVersionPivot }) {
41
+ export function VersionsFilter({ productInfo }) {
42
42
  const { t } = useTranslation();
43
43
  const { filterInfo } = useContext(CaseListFilterStateContext);
44
44
  const dispatch = useContext(CaseListFilterDispatchContext);
45
+ const apolloClient = useApolloClient();
46
+ const { globalMetadataState: { allProducts }, } = useContext(GlobalMetadataStateContext);
45
47
  const [inputValue, setInputValue] = useState('');
46
48
  const [activeItem, setActiveItem] = useState(null);
47
49
  const [isOpen, setIsOpen] = useState(false);
48
50
  const [selectedItems, setSelectedItems] = useState({});
51
+ const [fetchedVersions, setFetchedVersions] = useState([]);
52
+ const [isLoading, setIsLoading] = useState(false);
49
53
  const textInputRef = useRef();
50
- // Memoize versions to prevent unnecessary recalculations
51
- const versions = useMemo(() => {
52
- const versionValues = getVersionValuesForProduct(productVersionPivot, productInfo.value);
53
- return versionValues === null || versionValues === void 0 ? void 0 : versionValues.sort((a, b) => compareVersions(a.value, b.value));
54
- }, [productVersionPivot, productInfo.value]);
55
- // Memoize list to prevent unnecessary recreations
56
- const list = useMemo(() => (versions === null || versions === void 0 ? void 0 : versions.map((version) => ({
57
- value: version.value,
58
- key: version.value,
59
- }))) || [], [versions]);
54
+ useEffect(() => {
55
+ const productObj = allProducts.data.productsResult.find((p) => p.name === productInfo.value || p.product === productInfo.value);
56
+ if (!(productObj === null || productObj === void 0 ? void 0 : productObj.productId))
57
+ return;
58
+ setIsLoading(true);
59
+ apolloClient
60
+ .query({
61
+ query: GET_PRODUCTS,
62
+ variables: {
63
+ where: { ParentProduct__c: { eq: productObj.productId }, IsActive: { eq: true } },
64
+ first: 200,
65
+ orderBy: { Name: { order: 'ASC' } },
66
+ },
67
+ fetchPolicy: 'cache-first',
68
+ })
69
+ .then(({ data }) => {
70
+ var _a, _b, _c, _d;
71
+ const edges = (_d = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.salesforce_support_uiapi) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.SalesforceSupportProduct2) === null || _c === void 0 ? void 0 : _c.edges) !== null && _d !== void 0 ? _d : [];
72
+ const versionData = handleGraphQLVersionsResponse(edges, productObj.name || productInfo.value);
73
+ setFetchedVersions(versionData);
74
+ })
75
+ .catch((err) => {
76
+ console.error('[VersionsFilter] Failed to fetch versions:', err);
77
+ setFetchedVersions([]);
78
+ })
79
+ .finally(() => setIsLoading(false));
80
+ // eslint-disable-next-line react-hooks/exhaustive-deps
81
+ }, [productInfo.value, allProducts.data]);
82
+ const list = useMemo(() => {
83
+ const sorted = [...fetchedVersions].sort((a, b) => compareVersions(a.name, b.name));
84
+ return sorted.map((version) => ({
85
+ value: version.name,
86
+ key: version.name,
87
+ id: version.id,
88
+ }));
89
+ }, [fetchedVersions]);
60
90
  const [selectOptions, setSelectOptions] = useState(list);
61
- const onToggleClick = (e) => {
91
+ const onToggleClick = () => {
62
92
  setIsOpen(!isOpen);
63
93
  };
64
94
  const onSelect = (option) => {
@@ -72,18 +102,17 @@ export function VersionsFilter({ productInfo, productVersionPivot }) {
72
102
  setSelectedItems((prevData) => (Object.assign(Object.assign({}, prevData), { [option.value]: true })));
73
103
  prevSelectedVersions.push(option.value);
74
104
  }
75
- const newVersionState = prevSelectedVersions.map((version) => ({
76
- field: SolrKeys.version,
77
- value: version,
78
- }));
79
- const productNewState = [...filterInfo[SolrPivotKeys.product_version]];
105
+ const newVersionState = prevSelectedVersions.map((version) => {
106
+ const versionOption = list.find((item) => item.value === version);
107
+ return {
108
+ field: SolrKeys.version,
109
+ value: version,
110
+ productId: (versionOption === null || versionOption === void 0 ? void 0 : versionOption.id) || '',
111
+ };
112
+ });
113
+ const productNewState = [...((filterInfo === null || filterInfo === void 0 ? void 0 : filterInfo[SolrPivotKeys.product_version]) || [])];
80
114
  const objIndex = productNewState.findIndex((item) => item.value === productInfo.value);
81
- // replace product with updated versions
82
- productNewState[objIndex] = {
83
- field: SolrKeys.product,
84
- value: productInfo.value,
85
- [SolrKeys.version]: newVersionState,
86
- };
115
+ productNewState[objIndex] = Object.assign(Object.assign({}, productNewState[objIndex]), { field: SolrKeys.product, value: productInfo.value, [SolrKeys.version]: newVersionState });
87
116
  updateFilter(dispatch, { filterKey: SolrPivotKeys.product_version, values: productNewState });
88
117
  };
89
118
  // Use the keyboard navigator hook
@@ -103,7 +132,7 @@ export function VersionsFilter({ productInfo, productVersionPivot }) {
103
132
  var _a;
104
133
  setInputValue('');
105
134
  setSelectedItems({});
106
- const productNewState = [...filterInfo[SolrPivotKeys.product_version]];
135
+ const productNewState = [...((filterInfo === null || filterInfo === void 0 ? void 0 : filterInfo[SolrPivotKeys.product_version]) || [])];
107
136
  const objIndex = productNewState.findIndex((item) => item.value === productInfo.value);
108
137
  productNewState[objIndex] = {
109
138
  field: SolrKeys.product,
@@ -117,7 +146,7 @@ export function VersionsFilter({ productInfo, productVersionPivot }) {
117
146
  useEffect(() => {
118
147
  if (focusedItemIndex !== null && list[focusedItemIndex]) {
119
148
  const focusedItem = list[focusedItemIndex];
120
- setActiveItem(`select-multi-typeahead-checkbox-${focusedItem === null || focusedItem === void 0 ? void 0 : focusedItem.value.replace(' ', '-')}`);
149
+ setActiveItem(`select-multi-typeahead-checkbox-${String(focusedItem === null || focusedItem === void 0 ? void 0 : focusedItem.value).replace(' ', '-')}`);
121
150
  }
122
151
  else {
123
152
  setActiveItem(null);
@@ -131,7 +160,7 @@ export function VersionsFilter({ productInfo, productVersionPivot }) {
131
160
  // Memoize dropdownOptions to prevent unnecessary rerenders
132
161
  const dropdownOptions = useMemo(() => {
133
162
  const optionsToRender = !isEmpty(selectOptions) ? selectOptions : list;
134
- return optionsToRender.map((option, index) => option.value && (React.createElement(SelectOption, { key: option.key, value: option, hasCheckbox: true, isSelected: selectedItems[option.value], isFocused: focusedItemIndex !== null && focusedItemIndex === index, id: `select-multi-typeahead-${option.value.replace(' ', '-')}` }, option.value)));
163
+ return optionsToRender.map((option, index) => option.value && (React.createElement(SelectOption, { key: option.key, value: option, hasCheckbox: true, isSelected: selectedItems[String(option.value)], isFocused: focusedItemIndex !== null && focusedItemIndex === index, id: `select-multi-typeahead-${String(option.value).replace(' ', '-')}` }, option.value)));
135
164
  }, [selectOptions, list, selectedItems, focusedItemIndex]);
136
165
  // Update selectOptions when input value changes
137
166
  useEffect(() => {
@@ -156,9 +185,9 @@ export function VersionsFilter({ productInfo, productVersionPivot }) {
156
185
  setSelectedItems(selectedVersions);
157
186
  }, [productInfo.case_version]);
158
187
  const titleId = 'case-list-versions-filter';
159
- return (React.createElement(React.Fragment, null, (!isEmpty(versions) || true) && (React.createElement("div", { className: "version-filter-chip" },
188
+ return (React.createElement("div", { className: "version-filter-chip" },
160
189
  React.createElement("label", { hidden: true, htmlFor: titleId }, t('Open versions dropdown')),
161
190
  React.createElement("div", { className: "pf-v6-c-select" },
162
191
  React.createElement(Select, { shouldFocusToggleOnSelect: true, shouldPreventScrollOnItemFocus: true, "data-tracking-id": "versions-filter", id: titleId, title: t('Version'), isOpen: isOpen, selected: selectedItems, onSelect: (_e, v) => onSelect(v), onOpenChange: (nextOpen) => setIsOpen(nextOpen), popperProps: { direction: 'down', enableFlip: false }, toggle: toggle, isScrollable: true },
163
- React.createElement(SelectList, null, dropdownOptions)))))));
192
+ React.createElement(SelectList, null, isLoading ? React.createElement(SelectOption, { isDisabled: true }, t('Loading...')) : dropdownOptions)))));
164
193
  }
@@ -12,7 +12,6 @@ interface IProps {
12
12
  paginationInfo?: IPaginationInfo;
13
13
  isCaseListPageLoading: boolean;
14
14
  hasError: boolean;
15
- isSolrDown?: boolean;
16
15
  }
17
16
  export declare function CaseListTable(props: IProps): React.JSX.Element;
18
17
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"CaseListTable.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-table/CaseListTable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAqB3E,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAQxD,OAAO,KAAkD,MAAM,OAAO,CAAC;AAKvE,OAAO,EAAE,iBAAiB,EAAyB,MAAM,0BAA0B,CAAC;AAEpF,OAAO,EAEH,eAAe,EACf,SAAS,EAIZ,MAAM,0BAA0B,CAAC;AA4BlC,UAAU,MAAM;IACZ,QAAQ,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAC3C,UAAU,EAAE,UAAU,EAAE,CAAC;IACzB,kBAAkB,EAAE,QAAQ,CAAC;IAC7B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,cAAc,CAAC,EAAE,eAAe,CAAC;IACjC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AAsBD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,qBA2kB1C"}
1
+ {"version":3,"file":"CaseListTable.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-table/CaseListTable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAqB3E,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAQxD,OAAO,KAAkD,MAAM,OAAO,CAAC;AAKvE,OAAO,EAAE,iBAAiB,EAAyB,MAAM,0BAA0B,CAAC;AAGpF,OAAO,EAEH,eAAe,EACf,SAAS,EAIZ,MAAM,0BAA0B,CAAC;AA4BlC,UAAU,MAAM;IACZ,QAAQ,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAC3C,UAAU,EAAE,UAAU,EAAE,CAAC;IACzB,kBAAkB,EAAE,QAAQ,CAAC;IAC7B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,cAAc,CAAC,EAAE,eAAe,CAAC;IACjC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,QAAQ,EAAE,OAAO,CAAC;CACrB;AAsBD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,qBA6kB1C"}
@@ -14,6 +14,7 @@ import React, { useContext, useEffect, useRef, useState } from 'react';
14
14
  import { Trans, useTranslation } from 'react-i18next';
15
15
  import { Link } from 'react-router-dom';
16
16
  import { CaseListColumnIds } from '../../../enums/case';
17
+ import { mapSfdcStatusToPortalStatus } from '../../../utils/statusUtils';
17
18
  import { CaseListFilterDispatchContext, CaseListFilterStateContext } from '../CaseListFilterContext';
18
19
  import { clearFilters, resetFilterToDefaultState, updatePagination, updateSort, } from '../CaseListFilterReducer';
19
20
  import SeverityLabel from './SeverityLabel';
@@ -219,9 +220,7 @@ export function CaseListTable(props) {
219
220
  if (props.isCaseListPageLoading)
220
221
  return 0;
221
222
  let paginationCount = (_b = (_a = props.caseList) === null || _a === void 0 ? void 0 : _a.numFound) !== null && _b !== void 0 ? _b : 0;
222
- // solr return 400 if we fetch the elements after 10000 limit
223
- // so we need to restrict the user from FE too
224
- paginationCount = paginationCount > 10000 ? 10000 : paginationCount;
223
+ paginationCount = paginationCount > 4000 ? 4000 : paginationCount;
225
224
  return paginationCount;
226
225
  };
227
226
  const onBottomPaginationSetPage = (paginationInfo) => {
@@ -274,9 +273,11 @@ export function CaseListTable(props) {
274
273
  case_number: row.case_number,
275
274
  case_summary: row.case_summary,
276
275
  case_createdByName: row.case_createdByName,
277
- case_lastModifiedDate: formatDate(row.case_lastModifiedDate) ? formatDate(row.case_lastModifiedDate) : '',
276
+ case_lastModifiedDate: formatDate(row.case_last_public_update_date)
277
+ ? formatDate(row.case_last_public_update_date)
278
+ : '',
278
279
  case_severity: row.case_severity ? row.case_severity : '',
279
- case_status: row.case_status,
280
+ case_status: mapSfdcStatusToPortalStatus(row.case_status),
280
281
  case_createdDate: formatDate(row.case_createdDate),
281
282
  case_accountNumber: row.case_accountNumber,
282
283
  case_alternate_id: row.case_alternate_id ? row.case_alternate_id : '',
@@ -284,7 +285,7 @@ export function CaseListTable(props) {
284
285
  case_closedDate: formatDate(row.case_closedDate) ? formatDate(row.case_closedDate) : '',
285
286
  case_folderName: row.case_folderName || getCaseGroupName(row.case_folderNumber) || '',
286
287
  case_contactName: row.case_contactName,
287
- case_lastModifiedByName: row.case_lastModifiedByName ? row.case_lastModifiedByName : '',
288
+ case_lastModifiedByName: row.case_last_public_update_by ? row.case_last_public_update_by : '',
288
289
  case_version: row.case_version,
289
290
  id: row.id,
290
291
  case_product: row.case_product,
@@ -348,7 +349,7 @@ export function CaseListTable(props) {
348
349
  React.createElement(TableColumnSelector, { onColumnSelectorChange: onColumnSelectorChange, cachedColumns: selectedColumns }),
349
350
  React.createElement(TableActionsDropdown, { caseList: caseListData, selectedCases: selectedCases, onCasesCloseSuccess: onCasesCloseSuccess, currentFilteredCaseList: props.caseList })),
350
351
  React.createElement("span", { className: "toolbar-pagination" },
351
- React.createElement(TablePagination, { perPage: (_c = props.paginationInfo) === null || _c === void 0 ? void 0 : _c.pageSize, currentPage: (_d = props.paginationInfo) === null || _d === void 0 ? void 0 : _d.currentPage, onPerPageSelect: onPerPageSelect, onSetPage: onSetPage, variant: PaginationVariant.top, itemCount: getItemCount() }))),
352
+ React.createElement(TablePagination, { perPage: (_c = props.paginationInfo) === null || _c === void 0 ? void 0 : _c.pageSize, currentPage: (_d = props.paginationInfo) === null || _d === void 0 ? void 0 : _d.currentPage, onPerPageSelect: onPerPageSelect, onSetPage: onSetPage, variant: PaginationVariant.top, itemCount: getItemCount(), isCompact: true }))),
352
353
  React.createElement("div", { className: "pf-v6-c-scroll-inner-wrapper" },
353
354
  React.createElement(Table, { variant: TableVariant.compact, "aria-label": "case-list", className: "case-list-table" },
354
355
  React.createElement(Thead, null,
@@ -401,5 +402,5 @@ export function CaseListTable(props) {
401
402
  React.createElement(Td, { className: !isColumnVisible('closedDate') ? Visibility.hidden : '', "data-label": "Closed date" }, row.case_closedDate ? formatDate(row.case_closedDate) : ''),
402
403
  React.createElement(Td, { className: !isColumnVisible('folderName') ? Visibility.hidden : '', "data-label": "Group" }, row.case_folderName ? row.case_folderName : ''))))))),
403
404
  React.createElement("footer", { className: "toolbar-pagination", "data-tracking-id": "case-list-table-pagination" },
404
- React.createElement(TablePagination, { perPage: (_e = props === null || props === void 0 ? void 0 : props.paginationInfo) === null || _e === void 0 ? void 0 : _e.pageSize, currentPage: (_f = props === null || props === void 0 ? void 0 : props.paginationInfo) === null || _f === void 0 ? void 0 : _f.currentPage, onPerPageSelect: onPerPageSelect, onSetPage: onBottomPaginationSetPage, variant: PaginationVariant.bottom, itemCount: getItemCount() })))));
405
+ React.createElement(TablePagination, { perPage: (_e = props === null || props === void 0 ? void 0 : props.paginationInfo) === null || _e === void 0 ? void 0 : _e.pageSize, currentPage: (_f = props === null || props === void 0 ? void 0 : props.paginationInfo) === null || _f === void 0 ? void 0 : _f.currentPage, onPerPageSelect: onPerPageSelect, onSetPage: onBottomPaginationSetPage, variant: PaginationVariant.bottom, itemCount: getItemCount(), isCompact: true })))));
405
406
  }
@@ -1,15 +1,10 @@
1
1
  import './DownloadCSVFileModal.scss';
2
- import { IAccount } from '@cee-eng/hydrajs/@types/models/account';
3
- import { IApiResponseDetails } from '@rh-support/types/shared';
4
- import { UserAuth } from '@rh-support/user-permissions';
5
2
  import React from 'react';
6
3
  import { ICaseListFilterState } from '../CaseListFilterReducer';
7
4
  interface IProps {
8
5
  isDisabled?: boolean;
9
6
  onModalshow: boolean;
10
7
  onClose: () => void;
11
- loggedInUserRights: IApiResponseDetails<UserAuth>;
12
- loggedInUsersAccount: IApiResponseDetails<Partial<IAccount>>;
13
8
  filterState: ICaseListFilterState;
14
9
  selectedCases: string[];
15
10
  filteredCaseCount: number;
@@ -1 +1 @@
1
- {"version":3,"file":"DownloadCSVFileModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-table/DownloadCSVFileModal.tsx"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,CAAC;AAGrC,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAqBlE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAGxD,OAAO,KAAuC,MAAM,OAAO,CAAC;AAM5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,UAAU,MAAM;IACZ,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,kBAAkB,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAClD,oBAAoB,EAAE,mBAAmB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC7D,WAAW,EAAE,oBAAoB,CAAC;IAClC,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;CAC7B;AAoBD,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,KAAK,EAAE,MAAM,qBA4ZzD"}
1
+ {"version":3,"file":"DownloadCSVFileModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-table/DownloadCSVFileModal.tsx"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,CAAC;AAyBrC,OAAO,KAAuC,MAAM,OAAO,CAAC;AAM5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,UAAU,MAAM;IACZ,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,WAAW,EAAE,oBAAoB,CAAC;IAClC,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;CAC7B;AAWD,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,KAAK,EAAE,MAAM,qBA8WzD"}
@@ -8,19 +8,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import './DownloadCSVFileModal.scss';
11
- import { publicApi } from '@cee-eng/hydrajs';
11
+ import { useApolloClient } from '@apollo/client/react';
12
12
  import { Button, Checkbox, Form, FormGroup, Grid, GridItem, InputGroup, Modal, ModalBody, ModalFooter, ModalHeader, ModalVariant, Spinner, TextInput, ValidatedOptions, } from '@patternfly/react-core';
13
13
  import DownloadIcon from '@patternfly/react-icons/dist/js/icons/download-icon';
14
14
  import TimesCircleIcon from '@patternfly/react-icons/dist/js/icons/times-circle-icon';
15
- import { ToastNotification, useFetch } from '@rh-support/components';
15
+ import { ToastNotification } from '@rh-support/components';
16
16
  import { downloadCSV, formatDateTime, toNewCaseTypeSwitcher } from '@rh-support/utils';
17
17
  import { isEmpty } from 'lodash';
18
18
  import React, { useEffect, useMemo, useState } from 'react';
19
19
  import { useTranslation } from 'react-i18next';
20
- import { SFDCKeys, SolrKeys } from '../../../enums/filters';
21
- import { getCaseListFromSolr } from '../../../utils/caseListUtils';
22
- import { createQueryForCSVDownload } from '../../../utils/caseSearchUtils';
23
- const csvHeadersSolr = [
20
+ import { SolrKeys } from '../../../enums/filters';
21
+ import { getCaseListFromGraphQL } from '../../../utils/caseListGraphQLUtils';
22
+ import { mapSfdcStatusToPortalStatus } from '../../../utils/statusUtils';
23
+ const csvHeaders = [
24
24
  { label: 'Case number', key: SolrKeys.caseNumber },
25
25
  {
26
26
  label: 'Case link',
@@ -28,20 +28,12 @@ const csvHeadersSolr = [
28
28
  },
29
29
  { label: 'Title', key: SolrKeys.caseSummary },
30
30
  ];
31
- const csvHeadersSFDC = [
32
- { label: 'Case number', key: SFDCKeys.caseNumber },
33
- {
34
- label: 'Case link',
35
- key: 'case_link',
36
- },
37
- { label: 'Title', key: SFDCKeys.caseSummary },
38
- ];
39
31
  export default function DownloadCSVFileModal(props) {
40
- const { onClose, onModalshow, isDisabled, loggedInUserRights, loggedInUsersAccount, filterState, selectedCases, filteredCaseCount, } = props;
32
+ const { onClose, onModalshow, isDisabled, filterState, selectedCases, filteredCaseCount } = props;
41
33
  const { t } = useTranslation();
42
- const { isFetching, request } = useFetch(getCaseListFromSolr, { propgateErrors: true });
34
+ const apolloClient = useApolloClient();
35
+ const [isFetching, setIsFetching] = useState(false);
43
36
  const [downloadCSVFileName, setDownloadCSVFileName] = useState('CaseList.csv');
44
- const [isFetchingSFDC, setIsFetchingSFDC] = useState(false);
45
37
  const [checkboxes, setCheckboxes] = useState({
46
38
  selectAll: false,
47
39
  ownerName: false,
@@ -57,87 +49,87 @@ export default function DownloadCSVFileModal(props) {
57
49
  group: false,
58
50
  });
59
51
  const [isSaveClicked, setIsSavedClicked] = useState(false);
60
- function getKey(key, isSecureSupport) {
61
- return isSecureSupport ? SFDCKeys[key] : SolrKeys[key];
52
+ function getKey(key) {
53
+ return SolrKeys[key];
62
54
  }
63
- const isSecureSupportUser = loggedInUsersAccount.data.secureSupport;
64
55
  const headerDefinitions = useMemo(() => [
65
56
  {
66
57
  checkbox: checkboxes.ownerName,
67
- key: getKey('ownerName', isSecureSupportUser),
58
+ key: getKey('ownerName'),
68
59
  label: 'Owner name',
69
60
  },
70
61
  {
71
62
  checkbox: checkboxes.severity,
72
- key: getKey('severity', isSecureSupportUser),
63
+ key: getKey('severity'),
73
64
  label: 'Severity',
74
65
  },
75
66
  {
76
67
  checkbox: checkboxes.createdBy,
77
- key: getKey('createdBy', isSecureSupportUser),
68
+ key: getKey('createdBy'),
78
69
  label: 'Created by',
79
70
  },
80
71
  {
81
72
  checkbox: checkboxes.createdBy,
82
- key: getKey('createdDate', isSecureSupportUser),
73
+ key: getKey('createdDate'),
83
74
  label: 'Created date',
84
75
  transform: formatDateTime,
85
76
  },
86
77
  {
87
78
  checkbox: checkboxes.accountNumber,
88
- key: getKey('accountNumber', isSecureSupportUser),
79
+ key: getKey('accountNumber'),
89
80
  label: 'Account number',
90
81
  },
91
82
  {
92
83
  checkbox: checkboxes.type,
93
- key: getKey(isSecureSupportUser ? 'caseType' : 'type', isSecureSupportUser),
84
+ key: getKey('type'),
94
85
  label: 'Support type',
95
86
  },
96
87
  {
97
88
  checkbox: checkboxes.modifiedBy,
98
- key: getKey('modifiedBy', isSecureSupportUser),
89
+ key: getKey('modifiedBy'),
99
90
  label: 'Modified by',
100
91
  },
101
92
  {
102
93
  checkbox: checkboxes.modifiedBy,
103
- key: getKey('modifiedDate', isSecureSupportUser),
94
+ key: getKey('modifiedDate'),
104
95
  label: 'Modified date',
105
96
  transform: formatDateTime,
106
97
  },
107
98
  {
108
99
  checkbox: checkboxes.status,
109
- key: getKey('status', isSecureSupportUser),
100
+ key: getKey('status'),
110
101
  label: 'Status',
102
+ transform: mapSfdcStatusToPortalStatus,
111
103
  },
112
104
  {
113
105
  checkbox: checkboxes.productVersion,
114
- key: getKey('product', isSecureSupportUser),
106
+ key: getKey('product'),
115
107
  label: 'Product',
116
108
  },
117
109
  {
118
110
  checkbox: checkboxes.productVersion,
119
- key: getKey('version', isSecureSupportUser),
111
+ key: getKey('version'),
120
112
  label: 'Version',
121
113
  },
122
114
  {
123
115
  checkbox: checkboxes.alternateId,
124
- key: getKey('alternateId', isSecureSupportUser),
116
+ key: getKey('alternateId'),
125
117
  label: 'Alternate ID',
126
118
  },
127
119
  {
128
120
  checkbox: checkboxes.caseClosedDate,
129
- key: getKey('caseClosedDate', isSecureSupportUser),
121
+ key: getKey('caseClosedDate'),
130
122
  label: 'Closed date',
131
123
  transform: formatDateTime,
132
124
  },
133
125
  {
134
126
  checkbox: checkboxes.group,
135
- key: getKey('groupName', isSecureSupportUser),
127
+ key: getKey('groupName'),
136
128
  label: 'Group',
137
129
  },
138
- ], [checkboxes, isSecureSupportUser]);
130
+ ], [checkboxes]);
139
131
  const getHeaders = () => {
140
- const updatedCsvHeaders = isSecureSupportUser ? csvHeadersSFDC : csvHeadersSolr;
132
+ const updatedCsvHeaders = [...csvHeaders];
141
133
  headerDefinitions.forEach((headerDefinition) => {
142
134
  const { checkbox, key, label, transform } = headerDefinition;
143
135
  const index = updatedCsvHeaders.findIndex((header) => header.key === key);
@@ -154,9 +146,8 @@ export default function DownloadCSVFileModal(props) {
154
146
  });
155
147
  return updatedCsvHeaders;
156
148
  };
157
- const isFetchingCSVData = isFetching || isFetchingSFDC;
158
- const partnerSearch = loggedInUserRights.data.hasManagedAccounts();
159
- const splitExtensionName = downloadCSVFileName.split('.')[0].replace(/ +/g, ''); // To split and trim value before saving PDF
149
+ const isFetchingCSVData = isFetching;
150
+ const splitExtensionName = downloadCSVFileName.split('.')[0].replace(/ +/g, '');
160
151
  const onCancel = () => {
161
152
  onClose && onClose();
162
153
  setIsSavedClicked(false);
@@ -173,15 +164,16 @@ export default function DownloadCSVFileModal(props) {
173
164
  };
174
165
  const checkboxValues = Object.values(checkboxes).slice(1); // as we don't want selectAll value
175
166
  const allCheckBoxNotSelected = checkboxValues.includes(false);
176
- // For SOLR
177
167
  const onExportCSVClick = () => __awaiter(this, void 0, void 0, function* () {
178
168
  try {
179
169
  setIsSavedClicked(true);
180
170
  if (!isEmpty(splitExtensionName)) {
181
- const query = createQueryForCSVDownload(filterState, loggedInUserRights.data, loggedInUsersAccount.data, selectedCases);
182
- const res = yield request(query, partnerSearch, null, isSecureSupportUser);
183
- // To map the values in csv to new support type
184
- const updatedCsvData = res.response.docs.map((row) => (Object.assign(Object.assign({}, row), { case_type: toNewCaseTypeSwitcher(row.case_type), case_link: `https://${window.location.host}${window.location.pathname}/#/case/${row.case_number}` })));
171
+ setIsFetching(true);
172
+ const hasSelectedCases = selectedCases.length > 0;
173
+ const csvLimit = hasSelectedCases ? selectedCases.length : 1000;
174
+ const result = yield getCaseListFromGraphQL(filterState, apolloClient, csvLimit, undefined, hasSelectedCases ? selectedCases : undefined);
175
+ setIsFetching(false);
176
+ const updatedCsvData = result.caseListResponse.response.docs.map((row) => (Object.assign(Object.assign({}, row), { case_type: toNewCaseTypeSwitcher(row.case_type), case_link: `https://${window.location.host}${window.location.pathname}/#/case/${row.case_number}` })));
185
177
  downloadCSV(updatedCsvData, getHeaders(), splitExtensionName ? `${splitExtensionName}.csv` : 'CaseList.csv');
186
178
  onCancel();
187
179
  ToastNotification.addSuccessMessage(t('File downloaded successfully!'));
@@ -189,33 +181,11 @@ export default function DownloadCSVFileModal(props) {
189
181
  }
190
182
  }
191
183
  catch (e) {
184
+ setIsFetching(false);
192
185
  onCancel();
193
186
  ToastNotification.addDangerMessage(t('File could not be downloaded. Please try again! '));
194
187
  }
195
188
  });
196
- // For SFDC
197
- const onExportCSVClickSecureSupport = () => __awaiter(this, void 0, void 0, function* () {
198
- try {
199
- setIsSavedClicked(true);
200
- if (!isEmpty(splitExtensionName)) {
201
- const sfdcFilter = createQueryForCSVDownload(filterState, loggedInUserRights.data, loggedInUsersAccount.data, selectedCases);
202
- setIsFetchingSFDC(true);
203
- const sfdcResponse = yield publicApi.caseList.getCaseListFromSFDC(sfdcFilter, false, true);
204
- setIsFetchingSFDC(false);
205
- // To map the values in csv to new support type
206
- const updatedCsvData = sfdcResponse.cases.map((row) => (Object.assign(Object.assign({}, row), { caseType: toNewCaseTypeSwitcher(row.caseType), case_link: `https://${window.location.host}${window.location.pathname}/#/case/${row.caseNumber}` })));
207
- downloadCSV(updatedCsvData, getHeaders(), splitExtensionName ? `${splitExtensionName}.csv` : 'CaseList.csv');
208
- onCancel();
209
- ToastNotification.addSuccessMessage(t('File downloaded successfully!'));
210
- setIsSavedClicked(false);
211
- }
212
- }
213
- catch (e) {
214
- setIsFetchingSFDC(false);
215
- onCancel();
216
- ToastNotification.addDangerMessage(t('Could not export CSV'));
217
- }
218
- });
219
189
  const handleSelectAll = () => {
220
190
  const newSelectAllState = !checkboxes.selectAll;
221
191
  const updatedCheckboxes = {
@@ -294,6 +264,6 @@ export default function DownloadCSVFileModal(props) {
294
264
  React.createElement("p", null, downloadCSVModalDescription(selectedCases.length || filteredCaseCount)),
295
265
  downloadCSVModalBody()),
296
266
  React.createElement(ModalFooter, null,
297
- React.createElement(Button, { key: "submit", icon: isFetchingCSVData ? React.createElement(Spinner, { size: "md" }) : React.createElement(DownloadIcon, null), variant: "primary", "data-tracking-id": "download-csv-modal-submit", onClick: isSecureSupportUser ? onExportCSVClickSecureSupport : onExportCSVClick, isDisabled: (isSaveClicked && isEmpty(splitExtensionName)) || isDisabled || isFetchingCSVData }, t('Download')),
267
+ React.createElement(Button, { key: "submit", icon: isFetchingCSVData ? React.createElement(Spinner, { size: "md", "aria-label": "loading" }) : React.createElement(DownloadIcon, null), variant: "primary", "data-tracking-id": "download-csv-modal-submit", onClick: onExportCSVClick, isDisabled: (isSaveClicked && isEmpty(splitExtensionName)) || isDisabled || isFetchingCSVData }, t('Download')),
298
268
  React.createElement(Button, { key: "back", variant: "secondary", onClick: onCancel, isDisabled: isDisabled || isFetchingCSVData, "data-tracking-id": "download-csv-modal-cancel" }, t('Cancel')))));
299
269
  }