@rh-support/cases 2.6.218 → 2.6.227

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 (153) hide show
  1. package/lib/esm/components/case/NewCaseButton.js +1 -1
  2. package/lib/esm/components/case-list/CaseList.d.ts +7 -0
  3. package/lib/esm/components/case-list/CaseList.d.ts.map +1 -1
  4. package/lib/esm/components/case-list/CaseList.js +135 -366
  5. package/lib/esm/components/case-list/CaseListContext.d.ts.map +1 -1
  6. package/lib/esm/components/case-list/CaseListContext.js +2 -5
  7. package/lib/esm/components/case-list/CaseListFilterContext.d.ts.map +1 -1
  8. package/lib/esm/components/case-list/CaseListFilterContext.js +1 -2
  9. package/lib/esm/components/case-list/CaseListFilterHelpers.d.ts +2 -3
  10. package/lib/esm/components/case-list/CaseListFilterHelpers.d.ts.map +1 -1
  11. package/lib/esm/components/case-list/CaseListFilterHelpers.js +6 -19
  12. package/lib/esm/components/case-list/CaseListFilterReducer.d.ts +4 -36
  13. package/lib/esm/components/case-list/CaseListFilterReducer.d.ts.map +1 -1
  14. package/lib/esm/components/case-list/CaseListFilterReducer.js +12 -6
  15. package/lib/esm/components/case-list/CaseListReducer.d.ts +10 -22
  16. package/lib/esm/components/case-list/CaseListReducer.d.ts.map +1 -1
  17. package/lib/esm/components/case-list/CaseListReducer.js +7 -25
  18. package/lib/esm/components/case-list/case-list-filters/AccountsFilter.d.ts.map +1 -1
  19. package/lib/esm/components/case-list/case-list-filters/AccountsFilter.js +11 -18
  20. package/lib/esm/components/case-list/case-list-filters/AdditionalFilters.d.ts.map +1 -1
  21. package/lib/esm/components/case-list/case-list-filters/AdditionalFilters.js +2 -6
  22. package/lib/esm/components/case-list/case-list-filters/CaseListFilterChips.d.ts +7 -1
  23. package/lib/esm/components/case-list/case-list-filters/CaseListFilterChips.d.ts.map +1 -1
  24. package/lib/esm/components/case-list/case-list-filters/CaseListFilterChips.js +16 -12
  25. package/lib/esm/components/case-list/case-list-filters/CaseListFilters.d.ts +5 -2
  26. package/lib/esm/components/case-list/case-list-filters/CaseListFilters.d.ts.map +1 -1
  27. package/lib/esm/components/case-list/case-list-filters/CaseListFilters.js +13 -14
  28. package/lib/esm/components/case-list/case-list-filters/CreatorSsoNameFilter.d.ts.map +1 -1
  29. package/lib/esm/components/case-list/case-list-filters/CreatorSsoNameFilter.js +14 -21
  30. package/lib/esm/components/case-list/case-list-filters/CreatorSsoNameFilterChip.d.ts.map +1 -1
  31. package/lib/esm/components/case-list/case-list-filters/CreatorSsoNameFilterChip.js +0 -3
  32. package/lib/esm/components/case-list/case-list-filters/GroupsFilter.d.ts +1 -11
  33. package/lib/esm/components/case-list/case-list-filters/GroupsFilter.d.ts.map +1 -1
  34. package/lib/esm/components/case-list/case-list-filters/GroupsFilter.js +70 -90
  35. package/lib/esm/components/case-list/case-list-filters/ProductFilterChip.d.ts +3 -1
  36. package/lib/esm/components/case-list/case-list-filters/ProductFilterChip.d.ts.map +1 -1
  37. package/lib/esm/components/case-list/case-list-filters/ProductFilterChip.js +2 -2
  38. package/lib/esm/components/case-list/case-list-filters/ProductsFilter.d.ts +4 -5
  39. package/lib/esm/components/case-list/case-list-filters/ProductsFilter.d.ts.map +1 -1
  40. package/lib/esm/components/case-list/case-list-filters/ProductsFilter.js +54 -15
  41. package/lib/esm/components/case-list/case-list-filters/SeverityFilter.d.ts +3 -0
  42. package/lib/esm/components/case-list/case-list-filters/SeverityFilter.d.ts.map +1 -1
  43. package/lib/esm/components/case-list/case-list-filters/SeverityFilter.js +44 -18
  44. package/lib/esm/components/case-list/case-list-filters/StatusFilter.d.ts +3 -0
  45. package/lib/esm/components/case-list/case-list-filters/StatusFilter.d.ts.map +1 -1
  46. package/lib/esm/components/case-list/case-list-filters/StatusFilter.js +44 -14
  47. package/lib/esm/components/case-list/case-list-filters/VersionsFilter.d.ts +3 -1
  48. package/lib/esm/components/case-list/case-list-filters/VersionsFilter.d.ts.map +1 -1
  49. package/lib/esm/components/case-list/case-list-filters/VersionsFilter.js +59 -60
  50. package/lib/esm/components/case-list/case-list-table/CaseListTable.d.ts +3 -8
  51. package/lib/esm/components/case-list/case-list-table/CaseListTable.d.ts.map +1 -1
  52. package/lib/esm/components/case-list/case-list-table/CaseListTable.js +61 -77
  53. package/lib/esm/components/case-list/case-list-table/DownloadCSVFileModal.d.ts +5 -0
  54. package/lib/esm/components/case-list/case-list-table/DownloadCSVFileModal.d.ts.map +1 -1
  55. package/lib/esm/components/case-list/case-list-table/DownloadCSVFileModal.js +70 -42
  56. package/lib/esm/components/case-list/case-list-table/ExportCaseListCSV.d.ts.map +1 -1
  57. package/lib/esm/components/case-list/case-list-table/ExportCaseListCSV.js +15 -5
  58. package/lib/esm/components/case-list/case-list-table/SeverityLabel.js +1 -1
  59. package/lib/esm/components/case-list/case-list-table/TableActionsDropdown.d.ts.map +1 -1
  60. package/lib/esm/components/case-list/case-list-table/TableActionsDropdown.js +3 -2
  61. package/lib/esm/components/case-list/case-search/BookmarkedSearchesSelector.d.ts.map +1 -1
  62. package/lib/esm/components/case-list/case-search/BookmarkedSearchesSelector.js +0 -1
  63. package/lib/esm/components/case-list/case-search/CaseSearch.d.ts.map +1 -1
  64. package/lib/esm/components/case-list/case-search/CaseSearch.js +24 -55
  65. package/lib/esm/components/case-list/case-search/useAdvanceSearchParser.d.ts.map +1 -1
  66. package/lib/esm/components/case-list/case-search/useAdvanceSearchParser.js +1 -2
  67. package/lib/esm/css/caseList.css +22 -111
  68. package/lib/esm/css/caseSearch.css +0 -114
  69. package/lib/esm/enums/case.d.ts +4 -10
  70. package/lib/esm/enums/case.d.ts.map +1 -1
  71. package/lib/esm/enums/case.js +3 -21
  72. package/lib/esm/enums/caseSearch.d.ts +0 -3
  73. package/lib/esm/enums/caseSearch.d.ts.map +1 -1
  74. package/lib/esm/enums/caseSearch.js +1 -2
  75. package/lib/esm/enums/filters.d.ts +1 -3
  76. package/lib/esm/enums/filters.d.ts.map +1 -1
  77. package/lib/esm/enums/filters.js +0 -2
  78. package/lib/esm/hooks/useCloseCase.d.ts.map +1 -1
  79. package/lib/esm/hooks/useCloseCase.js +21 -38
  80. package/lib/esm/hooks/useExportCaseListCSV.d.ts.map +1 -1
  81. package/lib/esm/hooks/useExportCaseListCSV.js +9 -1
  82. package/lib/esm/hooks/useFilterStateOnLoad.d.ts +1 -1
  83. package/lib/esm/hooks/useFilterStateOnLoad.d.ts.map +1 -1
  84. package/lib/esm/hooks/useFilterStateOnLoad.js +5 -7
  85. package/lib/esm/index.js +0 -1
  86. package/lib/esm/test-utils/mockData.js +1 -1
  87. package/lib/esm/utils/caseSearchUtils.d.ts.map +1 -1
  88. package/lib/esm/utils/caseSearchUtils.js +2 -39
  89. package/lib/esm/utils/constants.d.ts +1 -5
  90. package/lib/esm/utils/constants.d.ts.map +1 -1
  91. package/lib/esm/utils/constants.js +2 -10
  92. package/lib/esm/utils/mockSolrResponse.js +1 -1
  93. package/package.json +8 -10
  94. package/lib/esm/components/case-list/case-list-filters/CaseLabelsFilter.d.ts +0 -3
  95. package/lib/esm/components/case-list/case-list-filters/CaseLabelsFilter.d.ts.map +0 -1
  96. package/lib/esm/components/case-list/case-list-filters/CaseLabelsFilter.js +0 -177
  97. package/lib/esm/components/case-list/case-search/AdvanceSearchToggleButton.d.ts +0 -8
  98. package/lib/esm/components/case-list/case-search/AdvanceSearchToggleButton.d.ts.map +0 -1
  99. package/lib/esm/components/case-list/case-search/AdvanceSearchToggleButton.js +0 -8
  100. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAccountSection.d.ts +0 -10
  101. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAccountSection.d.ts.map +0 -1
  102. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAccountSection.js +0 -29
  103. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAuditsSection.d.ts +0 -10
  104. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAuditsSection.d.ts.map +0 -1
  105. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAuditsSection.js +0 -16
  106. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchCaseSection.d.ts +0 -9
  107. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchCaseSection.d.ts.map +0 -1
  108. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchCaseSection.js +0 -21
  109. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchDateRangeField.d.ts +0 -12
  110. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchDateRangeField.d.ts.map +0 -1
  111. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchDateRangeField.js +0 -31
  112. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchFieldBlock.d.ts +0 -10
  113. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchFieldBlock.d.ts.map +0 -1
  114. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchFieldBlock.js +0 -10
  115. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchModal.d.ts +0 -10
  116. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchModal.d.ts.map +0 -1
  117. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchModal.js +0 -92
  118. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchOwnerSection.d.ts +0 -9
  119. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchOwnerSection.d.ts.map +0 -1
  120. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchOwnerSection.js +0 -20
  121. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchProductSection.d.ts +0 -9
  122. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchProductSection.d.ts.map +0 -1
  123. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchProductSection.js +0 -28
  124. package/lib/esm/components/case-list/case-search/advance-search-modal/ProductVersionDrilldownSelect.d.ts +0 -9
  125. package/lib/esm/components/case-list/case-search/advance-search-modal/ProductVersionDrilldownSelect.d.ts.map +0 -1
  126. package/lib/esm/components/case-list/case-search/advance-search-modal/ProductVersionDrilldownSelect.js +0 -241
  127. package/lib/esm/components/case-list/case-search/advance-search-modal/SelectableLabelFilter.d.ts +0 -11
  128. package/lib/esm/components/case-list/case-search/advance-search-modal/SelectableLabelFilter.d.ts.map +0 -1
  129. package/lib/esm/components/case-list/case-search/advance-search-modal/SelectableLabelFilter.js +0 -23
  130. package/lib/esm/hooks/useCaseLabels.d.ts +0 -14
  131. package/lib/esm/hooks/useCaseLabels.d.ts.map +0 -1
  132. package/lib/esm/hooks/useCaseLabels.js +0 -55
  133. package/lib/esm/utils/advanceSearchFormMapper.d.ts +0 -11
  134. package/lib/esm/utils/advanceSearchFormMapper.d.ts.map +0 -1
  135. package/lib/esm/utils/advanceSearchFormMapper.js +0 -71
  136. package/lib/esm/utils/advanceSearchUtils.d.ts +0 -24
  137. package/lib/esm/utils/advanceSearchUtils.d.ts.map +0 -1
  138. package/lib/esm/utils/advanceSearchUtils.js +0 -150
  139. package/lib/esm/utils/caseGroupDefaultFilterUtils.d.ts +0 -12
  140. package/lib/esm/utils/caseGroupDefaultFilterUtils.d.ts.map +0 -1
  141. package/lib/esm/utils/caseGroupDefaultFilterUtils.js +0 -34
  142. package/lib/esm/utils/caseGroupDefaultUtils.d.ts +0 -10
  143. package/lib/esm/utils/caseGroupDefaultUtils.d.ts.map +0 -1
  144. package/lib/esm/utils/caseGroupDefaultUtils.js +0 -20
  145. package/lib/esm/utils/caseListGraphQLUtils.d.ts +0 -28
  146. package/lib/esm/utils/caseListGraphQLUtils.d.ts.map +0 -1
  147. package/lib/esm/utils/caseListGraphQLUtils.js +0 -280
  148. package/lib/esm/utils/caseListMapper.d.ts +0 -6
  149. package/lib/esm/utils/caseListMapper.d.ts.map +0 -1
  150. package/lib/esm/utils/caseListMapper.js +0 -37
  151. package/lib/esm/utils/caseListVariablesBuilder.d.ts +0 -15
  152. package/lib/esm/utils/caseListVariablesBuilder.d.ts.map +0 -1
  153. package/lib/esm/utils/caseListVariablesBuilder.js +0 -517
@@ -1,9 +1,9 @@
1
- import { Alert, AlertVariant, Bullseye, Button, EmptyState, EmptyStateBody, EmptyStateFooter, EmptyStateVariant, Spinner, } from '@patternfly/react-core';
1
+ import { Bullseye, Button, EmptyState, EmptyStateBody, EmptyStateFooter, EmptyStateVariant, PaginationVariant, Spinner, } from '@patternfly/react-core';
2
2
  import SearchIcon from '@patternfly/react-icons/dist/js/icons/search-icon';
3
3
  import { Table, TableVariant, Tbody, Td, Th, Thead, Tr, Visibility } from '@patternfly/react-table';
4
- import { TableComponent } from '@rh-support/components';
4
+ import { TableComponent, TablePagination } from '@rh-support/components';
5
5
  import { GlobalMetadataDispatchContext, updateUserPreferences, useGlobalStateContext, UserPreferencesKeys, } from '@rh-support/react-context';
6
- import { dtmTrackEventCaseStepEncountered, formatDate, mapSfdcStatusToPortalStatus, toNewCaseTypeSwitcher, } from '@rh-support/utils';
6
+ import { dtmTrackEventCaseStepEncountered, formatDate, scrollIntoView, toNewCaseTypeSwitcher } from '@rh-support/utils';
7
7
  import find from 'lodash/find';
8
8
  import flatMap from 'lodash/flatMap';
9
9
  import includes from 'lodash/includes';
@@ -15,7 +15,7 @@ import { Trans, useTranslation } from 'react-i18next';
15
15
  import { Link } from 'react-router-dom';
16
16
  import { CaseListColumnIds } from '../../../enums/case';
17
17
  import { CaseListFilterDispatchContext, CaseListFilterStateContext } from '../CaseListFilterContext';
18
- import { clearFilters, updateSort } from '../CaseListFilterReducer';
18
+ import { clearFilters, resetFilterToDefaultState, updatePagination, updateSort, } from '../CaseListFilterReducer';
19
19
  import SeverityLabel from './SeverityLabel';
20
20
  import { TableColumnSelector } from './table-column-selector/TableColumnSelector';
21
21
  import { TableActionsDropdown } from './TableActionsDropdown';
@@ -36,7 +36,7 @@ const EMPTY_STATE_NO_FILTERS_ERROR = (React.createElement(React.Fragment, null,
36
36
  React.createElement("a", { href: "https://status.redhat.com/", target: "_blank", rel: "noopener noreferrer" }, "status page"),
37
37
  "to see if there are any known issues"));
38
38
  export function CaseListTable(props) {
39
- var _a, _b;
39
+ var _a, _b, _c, _d, _e, _f;
40
40
  const [selectedColumns, setSelectedColumns] = useState([]);
41
41
  const { t } = useTranslation();
42
42
  const [selectedCases, setSelectedCases] = useState([]);
@@ -49,10 +49,10 @@ export function CaseListTable(props) {
49
49
  const [activeSortIndex, setActiveSortIndex] = useState();
50
50
  const [activeSortDirection, setActiveSortDirection] = useState();
51
51
  const [sortedCaseListData, setSortedCaseListData] = useState(caseListData);
52
- const { globalMetadataState: { hydraUserPreferences, loggedInUserRights }, } = useGlobalStateContext();
52
+ const { globalMetadataState: { navBarRef, hydraUserPreferences, loggedInUserRights }, } = useGlobalStateContext();
53
53
  const dispatch = useContext(CaseListFilterDispatchContext);
54
54
  const dispatchToGlobalMetadataReducer = useContext(GlobalMetadataDispatchContext);
55
- const { filterInfo, filterQueryInfo, paginationInfo } = useContext(CaseListFilterStateContext);
55
+ const { filterInfo, filterQueryInfo } = useContext(CaseListFilterStateContext);
56
56
  const currentFilterLength = flatMap(filterInfo).length;
57
57
  const showingFilter = currentFilterLength > 0;
58
58
  const hasSearchQuery = !((filterQueryInfo === null || filterQueryInfo === void 0 ? void 0 : filterQueryInfo.queryString) === '');
@@ -155,6 +155,12 @@ export function CaseListTable(props) {
155
155
  console.error('Could not save selected columns in cache');
156
156
  }
157
157
  };
158
+ const onPerPageSelect = (paginationInfo) => {
159
+ updatePagination(dispatch, paginationInfo);
160
+ };
161
+ const onSetPage = (paginationInfo) => {
162
+ updatePagination(dispatch, paginationInfo);
163
+ };
158
164
  const onRowClick = (ev, row) => {
159
165
  // we dont want to call onRowClick if user changes the checkbox value
160
166
  if (ev.target.tagName === 'INPUT') {
@@ -206,18 +212,22 @@ export function CaseListTable(props) {
206
212
  React.createElement(EmptyState, { variant: EmptyStateVariant.sm },
207
213
  React.createElement(Spinner, { size: "xl" }))))));
208
214
  const onCasesCloseSuccess = () => {
209
- props.onCasesCloseSuccess && props.onCasesCloseSuccess();
215
+ resetFilterToDefaultState(dispatch);
210
216
  };
211
217
  const getItemCount = () => {
212
218
  var _a, _b;
213
219
  if (props.isCaseListPageLoading)
214
220
  return 0;
215
221
  let paginationCount = (_b = (_a = props.caseList) === null || _a === void 0 ? void 0 : _a.numFound) !== null && _b !== void 0 ? _b : 0;
216
- // Salesforce has a limit of 4000 cases per page
217
- // So we need to limit the number of cases returned to 4000
218
- paginationCount = paginationCount > 4000 ? 4000 : paginationCount;
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;
219
225
  return paginationCount;
220
226
  };
227
+ const onBottomPaginationSetPage = (paginationInfo) => {
228
+ onSetPage(paginationInfo);
229
+ scrollIntoView(tableToolbarRef, { navBarRef, timeout: 0, onlyIfNotInViewport: true, offset: 30 });
230
+ };
221
231
  const getSortableRowValues = (row) => {
222
232
  const { case_number, case_summary, case_contactName, case_lastModifiedDate, case_severity, case_status, case_createdDate, case_accountNumber, case_alternate_id, case_type, case_closedDate, case_folderName, case_lastModifiedByName, case_createdByName, case_version, id, case_customer_escalation, case_product, } = row;
223
233
  return [
@@ -268,7 +278,7 @@ export function CaseListTable(props) {
268
278
  ? formatDate(row.case_last_public_update_date)
269
279
  : '',
270
280
  case_severity: row.case_severity ? row.case_severity : '',
271
- case_status: mapSfdcStatusToPortalStatus(row.case_status),
281
+ case_status: row.case_status,
272
282
  case_createdDate: formatDate(row.case_createdDate),
273
283
  case_accountNumber: row.case_accountNumber,
274
284
  case_alternate_id: row.case_alternate_id ? row.case_alternate_id : '',
@@ -339,15 +349,8 @@ export function CaseListTable(props) {
339
349
  React.createElement("div", { className: "toolbar-actions pf-v6-l-flex" },
340
350
  React.createElement(TableColumnSelector, { onColumnSelectorChange: onColumnSelectorChange, cachedColumns: selectedColumns }),
341
351
  React.createElement(TableActionsDropdown, { caseList: caseListData, selectedCases: selectedCases, onCasesCloseSuccess: onCasesCloseSuccess, currentFilteredCaseList: props.caseList })),
342
- !props.isCaseListPageLoading && caseListData.length > 0 && (React.createElement("span", { className: "case-count-indicator" },
343
- React.createElement("strong", null, caseListData.length),
344
- " ",
345
- React.createElement(Trans, null, "of"),
346
- ' ',
347
- React.createElement("strong", null,
348
- getItemCount(),
349
- " ",
350
- React.createElement(Trans, null, "loaded"))))),
352
+ React.createElement("span", { className: "toolbar-pagination" },
353
+ 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() }))),
351
354
  React.createElement("div", { className: "pf-v6-c-scroll-inner-wrapper" },
352
355
  React.createElement(Table, { variant: TableVariant.compact, "aria-label": "case-list", className: "case-list-table" },
353
356
  React.createElement(Thead, null,
@@ -364,60 +367,41 @@ export function CaseListTable(props) {
364
367
  ? '0px'
365
368
  : undefined,
366
369
  }, id: column.id, sort: column.sortable ? onSort(index) : undefined, key: column.id }, column.title))))),
367
- React.createElement(Tbody, null, !props.isCaseListPageLoading && (caseListData || []).length < 1 ? (noResultFoundRow) : props.isCaseListPageLoading ? (loadingRowDefault) : (React.createElement(React.Fragment, null, sortedCaseListData === null || sortedCaseListData === void 0 ? void 0 :
368
- sortedCaseListData.map((row, rowIndex) => (React.createElement(Tr, { onRowClick: (event) => (onRowClick ? onRowClick(event, row) : ''), key: row === null || row === void 0 ? void 0 : row.case_number },
369
- React.createElement(Td, { className: "pf-v6-u-pl-md", select: {
370
- rowIndex: rowIndex,
371
- onSelect: (_event, _idx) => onRowSelect(_event, row === null || row === void 0 ? void 0 : row.case_number),
372
- isSelected: selectedCases.includes(row === null || row === void 0 ? void 0 : row.case_number),
373
- } }),
374
- React.createElement(Td, { dataLabel: "Case ID", id: row.case_number, scope: "row" },
375
- React.createElement("div", { className: "case-number-section" },
376
- React.createElement(Link, { to: `/case/${row.case_number}`, onClick: () => dtmTrackEventCaseStepEncountered('review', row.case_number, row.case_product, row.case_version) },
377
- React.createElement("span", { className: "case-number" }, row.case_number)),
378
- row.case_customer_escalation ? (React.createElement("div", { className: "escalation-label" },
379
- React.createElement(Trans, null, "Escalated"))) : (''))),
380
- React.createElement(Td, { dataLabel: "Title" }, row.case_summary),
381
- React.createElement(Td, { className: !isColumnVisible('contactName') ? Visibility.hidden : '', dataLabel: "Owner" }, row.case_contactName),
382
- React.createElement(Td, { className: !isColumnVisible('lastModifiedDate') ? Visibility.hidden : '', dataLabel: "Modified by" },
383
- React.createElement("span", { className: "modified-name" }, row.case_lastModifiedByName),
384
- row.case_lastModifiedDate ? formatDate(row.case_lastModifiedDate) : ''),
385
- React.createElement(Td, { className: !isColumnVisible('severity') ? Visibility.hidden : '', dataLabel: "Severity" },
386
- React.createElement(SeverityLabel, { sevValue: row.case_severity })),
387
- React.createElement(Td, { className: !isColumnVisible('status') ? Visibility.hidden : '', dataLabel: "Status" }, row.case_status),
388
- React.createElement(Td, { className: !isColumnVisible('createdDate') ? Visibility.hidden : '', dataLabel: "Created by" },
389
- React.createElement("span", { className: "created-name" }, row.case_createdByName),
390
- row.case_createdDate ? formatDate(row.case_createdDate) : ''),
391
- React.createElement(Td, { className: !isColumnVisible('product') ? Visibility.hidden : '', dataLabel: "Product and Version" },
392
- row.case_product,
393
- React.createElement("span", { style: { display: 'block' } }, row.case_version)),
394
- React.createElement(Td, { className: !isColumnVisible('accountNumber') ? Visibility.hidden : '', dataLabel: "Account number" }, row.case_accountNumber),
395
- React.createElement(Td, { className: !isColumnVisible('alternateCaseId') ? Visibility.hidden : '', "data-label": "Personal reference number" }, row.case_alternate_id ? row.case_alternate_id : ''),
396
- React.createElement(Td, { className: !isColumnVisible('type') ? Visibility.hidden : '', "data-label": "Support type" }, row.case_type),
397
- React.createElement(Td, { className: !isColumnVisible('closedDate') ? Visibility.hidden : '', "data-label": "Closed date" }, row.case_closedDate ? formatDate(row.case_closedDate) : ''),
398
- React.createElement(Td, { className: !isColumnVisible('folderName') ? Visibility.hidden : '', "data-label": "Group" }, row.case_folderName ? row.case_folderName : '')))),
399
- (props.hasNextPage || props.isLoadingMore || props.loadMoreError) && (React.createElement(Tr, { key: "skeleton-loader-row", className: "skeleton-loader-row" },
400
- React.createElement(Td, { className: "pf-v6-u-pl-md" },
401
- React.createElement("div", { ref: props.sentinelRef, className: "skeleton-sentinel" },
402
- React.createElement("span", { className: "skeleton-bar skeleton-bar--checkbox" }))),
403
- visibleCaseListColumns.map((col) => (React.createElement(Td, { key: `skeleton-${col.id}` },
404
- React.createElement("span", { className: "skeleton-bar" }))))))))))),
405
- props.loadMoreError && props.loadMoreRetryCount <= 1 && (React.createElement("div", { className: "infinite-scroll-footer-message" },
406
- React.createElement(Button, { className: "infinite-scroll-retry-btn", variant: "secondary", onClick: props.onRetryLoadMore, icon: React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" },
407
- React.createElement("polyline", { points: "23 4 23 10 17 10" }),
408
- React.createElement("path", { d: "M20.49 15a9 9 0 1 1-2.12-9.36L23 10" })) },
409
- React.createElement(Trans, null, "try loading again")))),
410
- props.loadMoreError && props.loadMoreRetryCount > 1 && (React.createElement("div", { className: "infinite-scroll-footer-message" },
411
- React.createElement(Alert, { className: "infinite-scroll-alert pf-v6-u-font-weight-bold", variant: AlertVariant.danger, isInline: true, isPlain: true, title: React.createElement("span", null,
412
- React.createElement(Trans, null, "We're having trouble loading your cases. Please refresh or"),
413
- ' ',
414
- React.createElement(Button, { variant: "link", isInline: true, onClick: props.onRetryLoadMore },
415
- React.createElement(Trans, null, "try again")),
416
- ".") }))),
417
- !props.hasNextPage &&
418
- !props.isLoadingMore &&
419
- !props.loadMoreError &&
420
- caseListData.length > 0 &&
421
- getItemCount() > ((paginationInfo === null || paginationInfo === void 0 ? void 0 : paginationInfo.pageSize) || 10) && (React.createElement("div", { className: "infinite-scroll-footer-message infinite-scroll-footer-text pf-v6-u-font-weight-bold pf-v6-u-color-200" },
422
- React.createElement(Trans, null, "No more cases to load"))))));
370
+ React.createElement(Tbody, null, !props.isCaseListPageLoading && (caseListData || []).length < 1
371
+ ? noResultFoundRow
372
+ : props.isCaseListPageLoading
373
+ ? loadingRowDefault
374
+ : sortedCaseListData === null || sortedCaseListData === void 0 ? void 0 : sortedCaseListData.map((row, index) => (React.createElement(Tr, { onRowClick: (event) => (onRowClick ? onRowClick(event, row) : ''), key: row === null || row === void 0 ? void 0 : row.case_number },
375
+ React.createElement(Td, { className: "pf-v6-u-pl-md", select: {
376
+ rowIndex: index,
377
+ onSelect: (_event, index) => onRowSelect(_event, row === null || row === void 0 ? void 0 : row.case_number),
378
+ isSelected: selectedCases.includes(row === null || row === void 0 ? void 0 : row.case_number),
379
+ } }),
380
+ React.createElement(Td, { dataLabel: "Case ID", id: row.case_number, scope: "row" },
381
+ React.createElement("div", { className: "case-number-section" },
382
+ React.createElement(Link, { to: `/case/${row.case_number}`, onClick: () => dtmTrackEventCaseStepEncountered('review', row.case_number, row.case_product, row.case_version) },
383
+ React.createElement("span", { className: "case-number" }, row.case_number)),
384
+ row.case_customer_escalation ? (React.createElement("div", { className: "escalation-label" },
385
+ React.createElement(Trans, null, "Escalated"))) : (''))),
386
+ React.createElement(Td, { dataLabel: "Title" }, row.case_summary),
387
+ React.createElement(Td, { className: !isColumnVisible('contactName') ? Visibility.hidden : '', dataLabel: "Owner" }, row.case_contactName),
388
+ React.createElement(Td, { className: !isColumnVisible('lastModifiedDate') ? Visibility.hidden : '', dataLabel: "Modified by" },
389
+ React.createElement("span", { className: "modified-name" }, row.case_lastModifiedByName),
390
+ row.case_lastModifiedDate ? formatDate(row.case_lastModifiedDate) : ''),
391
+ React.createElement(Td, { className: !isColumnVisible('severity') ? Visibility.hidden : '', dataLabel: "Severity" },
392
+ React.createElement(SeverityLabel, { sevValue: row.case_severity })),
393
+ React.createElement(Td, { className: !isColumnVisible('status') ? Visibility.hidden : '', dataLabel: "Status" }, row.case_status),
394
+ React.createElement(Td, { className: !isColumnVisible('createdDate') ? Visibility.hidden : '', dataLabel: "Created by" },
395
+ React.createElement("span", { className: "created-name" }, row.case_createdByName),
396
+ row.case_createdDate ? formatDate(row.case_createdDate) : ''),
397
+ React.createElement(Td, { className: !isColumnVisible('product') ? Visibility.hidden : '', dataLabel: "Product and Version" },
398
+ row.case_product,
399
+ React.createElement("span", { style: { display: 'block' } }, row.case_version)),
400
+ React.createElement(Td, { className: !isColumnVisible('accountNumber') ? Visibility.hidden : '', dataLabel: "Account number" }, row.case_accountNumber),
401
+ React.createElement(Td, { className: !isColumnVisible('alternateCaseId') ? Visibility.hidden : '', "data-label": "Personal reference number" }, row.case_alternate_id ? row.case_alternate_id : ''),
402
+ React.createElement(Td, { className: !isColumnVisible('type') ? Visibility.hidden : '', "data-label": "Support type" }, row.case_type),
403
+ React.createElement(Td, { className: !isColumnVisible('closedDate') ? Visibility.hidden : '', "data-label": "Closed date" }, row.case_closedDate ? formatDate(row.case_closedDate) : ''),
404
+ React.createElement(Td, { className: !isColumnVisible('folderName') ? Visibility.hidden : '', "data-label": "Group" }, row.case_folderName ? row.case_folderName : ''))))))),
405
+ React.createElement("footer", { className: "toolbar-pagination", "data-tracking-id": "case-list-table-pagination" },
406
+ 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() })))));
423
407
  }
@@ -1,10 +1,15 @@
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';
2
5
  import React from 'react';
3
6
  import { ICaseListFilterState } from '../CaseListFilterReducer';
4
7
  interface IProps {
5
8
  isDisabled?: boolean;
6
9
  onModalshow: boolean;
7
10
  onClose: () => void;
11
+ loggedInUserRights: IApiResponseDetails<UserAuth>;
12
+ loggedInUsersAccount: IApiResponseDetails<Partial<IAccount>>;
8
13
  filterState: ICaseListFilterState;
9
14
  selectedCases: string[];
10
15
  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;AAgCrC,OAAO,KAAmD,MAAM,OAAO,CAAC;AAKxE,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,qBAmXzD"}
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"}
@@ -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 { useApolloClient } from '@apollo/client/react';
11
+ import { publicApi } from '@cee-eng/hydrajs';
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 } from '@rh-support/components';
16
- import { GlobalMetadataStateContext } from '@rh-support/react-context';
17
- import { downloadCSV, formatDateTime, mapSfdcStatusToPortalStatus, toNewCaseTypeSwitcher, } from '@rh-support/utils';
15
+ import { ToastNotification, useFetch } from '@rh-support/components';
16
+ import { downloadCSV, formatDateTime, toNewCaseTypeSwitcher } from '@rh-support/utils';
18
17
  import { isEmpty } from 'lodash';
19
- import React, { useContext, useEffect, useMemo, useState } from 'react';
18
+ import React, { useEffect, useMemo, useState } from 'react';
20
19
  import { useTranslation } from 'react-i18next';
21
- import { SolrKeys } from '../../../enums/filters';
22
- import { getCaseListFromGraphQL } from '../../../utils/caseListGraphQLUtils';
23
- const csvHeaders = [
20
+ import { SFDCKeys, SolrKeys } from '../../../enums/filters';
21
+ import { getCaseListFromSolr } from '../../../utils/caseListUtils';
22
+ import { createQueryForCSVDownload } from '../../../utils/caseSearchUtils';
23
+ const csvHeadersSolr = [
24
24
  { label: 'Case number', key: SolrKeys.caseNumber },
25
25
  {
26
26
  label: 'Case link',
@@ -28,14 +28,20 @@ const csvHeaders = [
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
+ ];
31
39
  export default function DownloadCSVFileModal(props) {
32
- const { onClose, onModalshow, isDisabled, filterState, selectedCases, filteredCaseCount } = props;
40
+ const { onClose, onModalshow, isDisabled, loggedInUserRights, loggedInUsersAccount, filterState, selectedCases, filteredCaseCount, } = props;
33
41
  const { t } = useTranslation();
34
- const apolloClient = useApolloClient();
35
- const { globalMetadataState: { loggedInUsersAccount }, } = useContext(GlobalMetadataStateContext);
36
- const includeSecureSupportCases = Boolean(loggedInUsersAccount.data.secureSupport);
37
- const [isFetching, setIsFetching] = useState(false);
42
+ const { isFetching, request } = useFetch(getCaseListFromSolr, { propgateErrors: true });
38
43
  const [downloadCSVFileName, setDownloadCSVFileName] = useState('CaseList.csv');
44
+ const [isFetchingSFDC, setIsFetchingSFDC] = useState(false);
39
45
  const [checkboxes, setCheckboxes] = useState({
40
46
  selectAll: false,
41
47
  ownerName: false,
@@ -51,87 +57,87 @@ export default function DownloadCSVFileModal(props) {
51
57
  group: false,
52
58
  });
53
59
  const [isSaveClicked, setIsSavedClicked] = useState(false);
54
- function getKey(key) {
55
- return SolrKeys[key];
60
+ function getKey(key, isSecureSupport) {
61
+ return isSecureSupport ? SFDCKeys[key] : SolrKeys[key];
56
62
  }
63
+ const isSecureSupportUser = loggedInUsersAccount.data.secureSupport;
57
64
  const headerDefinitions = useMemo(() => [
58
65
  {
59
66
  checkbox: checkboxes.ownerName,
60
- key: getKey('ownerName'),
67
+ key: getKey('ownerName', isSecureSupportUser),
61
68
  label: 'Owner name',
62
69
  },
63
70
  {
64
71
  checkbox: checkboxes.severity,
65
- key: getKey('severity'),
72
+ key: getKey('severity', isSecureSupportUser),
66
73
  label: 'Severity',
67
74
  },
68
75
  {
69
76
  checkbox: checkboxes.createdBy,
70
- key: getKey('createdBy'),
77
+ key: getKey('createdBy', isSecureSupportUser),
71
78
  label: 'Created by',
72
79
  },
73
80
  {
74
81
  checkbox: checkboxes.createdBy,
75
- key: getKey('createdDate'),
82
+ key: getKey('createdDate', isSecureSupportUser),
76
83
  label: 'Created date',
77
84
  transform: formatDateTime,
78
85
  },
79
86
  {
80
87
  checkbox: checkboxes.accountNumber,
81
- key: getKey('accountNumber'),
88
+ key: getKey('accountNumber', isSecureSupportUser),
82
89
  label: 'Account number',
83
90
  },
84
91
  {
85
92
  checkbox: checkboxes.type,
86
- key: getKey('type'),
93
+ key: getKey(isSecureSupportUser ? 'caseType' : 'type', isSecureSupportUser),
87
94
  label: 'Support type',
88
95
  },
89
96
  {
90
97
  checkbox: checkboxes.modifiedBy,
91
- key: getKey('modifiedBy'),
98
+ key: getKey('modifiedBy', isSecureSupportUser),
92
99
  label: 'Modified by',
93
100
  },
94
101
  {
95
102
  checkbox: checkboxes.modifiedBy,
96
- key: getKey('modifiedDate'),
103
+ key: getKey('modifiedDate', isSecureSupportUser),
97
104
  label: 'Modified date',
98
105
  transform: formatDateTime,
99
106
  },
100
107
  {
101
108
  checkbox: checkboxes.status,
102
- key: getKey('status'),
109
+ key: getKey('status', isSecureSupportUser),
103
110
  label: 'Status',
104
- transform: mapSfdcStatusToPortalStatus,
105
111
  },
106
112
  {
107
113
  checkbox: checkboxes.productVersion,
108
- key: getKey('product'),
114
+ key: getKey('product', isSecureSupportUser),
109
115
  label: 'Product',
110
116
  },
111
117
  {
112
118
  checkbox: checkboxes.productVersion,
113
- key: getKey('version'),
119
+ key: getKey('version', isSecureSupportUser),
114
120
  label: 'Version',
115
121
  },
116
122
  {
117
123
  checkbox: checkboxes.alternateId,
118
- key: getKey('alternateId'),
124
+ key: getKey('alternateId', isSecureSupportUser),
119
125
  label: 'Alternate ID',
120
126
  },
121
127
  {
122
128
  checkbox: checkboxes.caseClosedDate,
123
- key: getKey('caseClosedDate'),
129
+ key: getKey('caseClosedDate', isSecureSupportUser),
124
130
  label: 'Closed date',
125
131
  transform: formatDateTime,
126
132
  },
127
133
  {
128
134
  checkbox: checkboxes.group,
129
- key: getKey('groupName'),
135
+ key: getKey('groupName', isSecureSupportUser),
130
136
  label: 'Group',
131
137
  },
132
- ], [checkboxes]);
138
+ ], [checkboxes, isSecureSupportUser]);
133
139
  const getHeaders = () => {
134
- const updatedCsvHeaders = [...csvHeaders];
140
+ const updatedCsvHeaders = isSecureSupportUser ? csvHeadersSFDC : csvHeadersSolr;
135
141
  headerDefinitions.forEach((headerDefinition) => {
136
142
  const { checkbox, key, label, transform } = headerDefinition;
137
143
  const index = updatedCsvHeaders.findIndex((header) => header.key === key);
@@ -148,8 +154,9 @@ export default function DownloadCSVFileModal(props) {
148
154
  });
149
155
  return updatedCsvHeaders;
150
156
  };
151
- const isFetchingCSVData = isFetching;
152
- const splitExtensionName = downloadCSVFileName.split('.')[0].replace(/ +/g, '');
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
153
160
  const onCancel = () => {
154
161
  onClose && onClose();
155
162
  setIsSavedClicked(false);
@@ -166,16 +173,15 @@ export default function DownloadCSVFileModal(props) {
166
173
  };
167
174
  const checkboxValues = Object.values(checkboxes).slice(1); // as we don't want selectAll value
168
175
  const allCheckBoxNotSelected = checkboxValues.includes(false);
176
+ // For SOLR
169
177
  const onExportCSVClick = () => __awaiter(this, void 0, void 0, function* () {
170
178
  try {
171
179
  setIsSavedClicked(true);
172
180
  if (!isEmpty(splitExtensionName)) {
173
- setIsFetching(true);
174
- const hasSelectedCases = selectedCases.length > 0;
175
- const csvLimit = hasSelectedCases ? selectedCases.length : 1000;
176
- const result = yield getCaseListFromGraphQL(filterState, apolloClient, csvLimit, undefined, hasSelectedCases ? selectedCases : undefined, includeSecureSupportCases);
177
- setIsFetching(false);
178
- 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}` })));
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}` })));
179
185
  downloadCSV(updatedCsvData, getHeaders(), splitExtensionName ? `${splitExtensionName}.csv` : 'CaseList.csv');
180
186
  onCancel();
181
187
  ToastNotification.addSuccessMessage(t('File downloaded successfully!'));
@@ -183,11 +189,33 @@ export default function DownloadCSVFileModal(props) {
183
189
  }
184
190
  }
185
191
  catch (e) {
186
- setIsFetching(false);
187
192
  onCancel();
188
193
  ToastNotification.addDangerMessage(t('File could not be downloaded. Please try again! '));
189
194
  }
190
195
  });
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
+ });
191
219
  const handleSelectAll = () => {
192
220
  const newSelectAllState = !checkboxes.selectAll;
193
221
  const updatedCheckboxes = {
@@ -266,6 +294,6 @@ export default function DownloadCSVFileModal(props) {
266
294
  React.createElement("p", null, downloadCSVModalDescription(selectedCases.length || filteredCaseCount)),
267
295
  downloadCSVModalBody()),
268
296
  React.createElement(ModalFooter, null,
269
- 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')),
297
+ 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: isSecureSupportUser ? onExportCSVClickSecureSupport : onExportCSVClick, isDisabled: (isSaveClicked && isEmpty(splitExtensionName)) || isDisabled || isFetchingCSVData }, t('Download')),
270
298
  React.createElement(Button, { key: "back", variant: "secondary", onClick: onCancel, isDisabled: isDisabled || isFetchingCSVData, "data-tracking-id": "download-csv-modal-cancel" }, t('Cancel')))));
271
299
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ExportCaseListCSV.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-table/ExportCaseListCSV.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAA+B,MAAM,OAAO,CAAC;AAGpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAI7D,UAAU,MAAM;IACZ,uBAAuB,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAC1D,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,aAAa,EAAE,MAAM,EAAE,CAAC;CAC3B;AAID,wBAAgB,iBAAiB,CAAC,EAAE,uBAAuB,EAAE,aAAa,EAAE,mBAAmB,EAAE,EAAE,MAAM,qBAoDxG"}
1
+ {"version":3,"file":"ExportCaseListCSV.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-table/ExportCaseListCSV.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAA+B,MAAM,OAAO,CAAC;AAGpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAK7D,UAAU,MAAM;IACZ,uBAAuB,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAC1D,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,aAAa,EAAE,MAAM,EAAE,CAAC;CAC3B;AAID,wBAAgB,iBAAiB,CAAC,EAAE,uBAAuB,EAAE,aAAa,EAAE,mBAAmB,EAAE,EAAE,MAAM,qBAqExG"}
@@ -1,6 +1,9 @@
1
- import { Button } from '@patternfly/react-core';
1
+ import { Button, Spinner } from '@patternfly/react-core';
2
+ import { useFetch } from '@rh-support/components';
3
+ import { GlobalMetadataStateContext } from '@rh-support/react-context';
2
4
  import React, { useContext, useState } from 'react';
3
5
  import { Trans, useTranslation } from 'react-i18next';
6
+ import { getCaseListFromSolr } from '../../../utils/caseListUtils';
4
7
  import { CaseListFilterStateContext } from '../CaseListFilterContext';
5
8
  import DownloadCSVFileModal from './DownloadCSVFileModal';
6
9
  const MAX_LIMIT = 1000;
@@ -10,10 +13,14 @@ export function ExportCaseListCSV({ currentFilteredCaseList, selectedCases, isEx
10
13
  const btnToolTip = t('Export the current list of cases to CSV. Please note that exporting a large number of cases may take a while.');
11
14
  const maxLengthTooltip = t('Export the current list of cases to CSV. Please note that only the top {{limit}} cases will be exported and that it may take awhile.', { limit: MAX_LIMIT });
12
15
  const currentFilteredCaseCount = (_a = currentFilteredCaseList === null || currentFilteredCaseList === void 0 ? void 0 : currentFilteredCaseList.numFound) !== null && _a !== void 0 ? _a : 0;
16
+ const { isFetching } = useFetch(getCaseListFromSolr, { propgateErrors: true });
13
17
  const [openUpdateSeverityModal, setOpenUpdateSeverityModal] = useState(false);
14
- const isBtnDisabled = currentFilteredCaseCount === 0;
18
+ const isFetchingCSVData = isFetching;
19
+ const isBtnDisabled = isFetchingCSVData || currentFilteredCaseCount === 0;
15
20
  let btnTitle = currentFilteredCaseCount >= MAX_LIMIT ? maxLengthTooltip : btnToolTip;
16
21
  const filterState = useContext(CaseListFilterStateContext);
22
+ const { globalMetadataState: { loggedInUserRights, loggedInUsersAccount }, } = useContext(GlobalMetadataStateContext);
23
+ // To show tooltip if export csv is disabled when SOLR is down
17
24
  const getTooltipContent = () => {
18
25
  let tooltipText = t('Export Cases');
19
26
  if (isExportCsvDisabled) {
@@ -21,12 +28,15 @@ export function ExportCaseListCSV({ currentFilteredCaseList, selectedCases, isEx
21
28
  }
22
29
  return tooltipText;
23
30
  };
31
+ // To check if export csv button is disabled
24
32
  const isExportButtonDisabled = isBtnDisabled || isExportCsvDisabled;
33
+ // To toggle download csv modal
25
34
  const toggleDownloadCSVModal = () => {
26
35
  setOpenUpdateSeverityModal((openUpdateSeverityModal) => !openUpdateSeverityModal);
27
36
  };
28
37
  return (React.createElement("span", { title: (isExportCsvDisabled && getTooltipContent()) || '' },
29
- React.createElement(Button, { variant: "tertiary", onClick: toggleDownloadCSVModal, title: btnTitle, "data-tracking-id": "case-list-toolbar-export-csv", isDisabled: isExportButtonDisabled },
30
- React.createElement(Trans, null, "Export CSV")),
31
- React.createElement(DownloadCSVFileModal, { filterState: filterState, isDisabled: isExportButtonDisabled, onModalshow: openUpdateSeverityModal, onClose: toggleDownloadCSVModal, selectedCases: selectedCases, filteredCaseCount: currentFilteredCaseCount })));
38
+ React.createElement(Button, { variant: "tertiary", onClick: toggleDownloadCSVModal, title: btnTitle, "data-tracking-id": "case-list-toolbar-export-csv", isDisabled: isExportButtonDisabled }, isFetchingCSVData ? (React.createElement(React.Fragment, null,
39
+ React.createElement(Trans, null, "Exporting CSV"),
40
+ React.createElement(Spinner, { size: "md", "aria-label": "loading", className: "export-csv-loader pf-v6-u-ml-xs" }))) : (React.createElement(Trans, null, "Export CSV"))),
41
+ React.createElement(DownloadCSVFileModal, { filterState: filterState, loggedInUserRights: loggedInUserRights, loggedInUsersAccount: loggedInUsersAccount, isDisabled: isExportButtonDisabled, onModalshow: openUpdateSeverityModal, onClose: toggleDownloadCSVModal, selectedCases: selectedCases, filteredCaseCount: currentFilteredCaseCount })));
32
42
  }
@@ -12,7 +12,7 @@ export default function SeverityLabel({ sevValue }) {
12
12
  return 'danger';
13
13
  case '2 (High)':
14
14
  return 'warning';
15
- case '3 (Medium)':
15
+ case '3 (Normal)':
16
16
  return 'info';
17
17
  case '4 (Low)':
18
18
  return 'custom';
@@ -1 +1 @@
1
- {"version":3,"file":"TableActionsDropdown.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-table/TableActionsDropdown.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAE,kBAAkB,EAAgB,MAAM,6BAA6B,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAwB,MAAM,qCAAqC,CAAC;AASlG,UAAU,MAAO,SAAQ,kBAAkB,EAAE,qBAAqB;CAAG;AAErE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,qBAoHjD"}
1
+ {"version":3,"file":"TableActionsDropdown.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-table/TableActionsDropdown.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAE,kBAAkB,EAAgB,MAAM,6BAA6B,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAwB,MAAM,qCAAqC,CAAC;AASlG,UAAU,MAAO,SAAQ,kBAAkB,EAAE,qBAAqB;CAAG;AAErE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,qBA0HjD"}
@@ -3,7 +3,7 @@ import ExclamationCircleIcon from '@patternfly/react-icons/dist/js/icons/exclama
3
3
  import InfoCircleIcon from '@patternfly/react-icons/dist/js/icons/info-circle-icon';
4
4
  import WarningTriangleIcon from '@patternfly/react-icons/dist/js/icons/warning-triangle-icon';
5
5
  import { SingleSelectDropdown } from '@rh-support/components';
6
- import { CloseCaseModal } from '@rh-support/react-context';
6
+ import { CloseCaseModal, GlobalMetadataStateContext } from '@rh-support/react-context';
7
7
  import React, { useContext } from 'react';
8
8
  import { useTranslation } from 'react-i18next';
9
9
  import { useCloseCase } from '../../../hooks/useCloseCase';
@@ -22,6 +22,7 @@ export function TableActionsDropdown(props) {
22
22
  const currentFilteredCaseCount = (_a = currentFilteredCaseList === null || currentFilteredCaseList === void 0 ? void 0 : currentFilteredCaseList.numFound) !== null && _a !== void 0 ? _a : 0;
23
23
  const filterState = useContext(CaseListFilterStateContext);
24
24
  const { isExportButtonDisabled, openUpdateSeverityModal, showError: showExportCSVError, getTooltipContent: getExportCSVTooltipContent, toggleDownloadCSVModal, } = useExportCaseListCSV(props);
25
+ const { globalMetadataState: { loggedInUserRights, loggedInUsersAccount }, } = useContext(GlobalMetadataStateContext);
25
26
  const { isModalOpen, isPostingComment, showError, showWarning, getTooltipContent, onCancel, onConfirm, onBtnClick, } = useCloseCase(props);
26
27
  let closeCaseIconStatus = 'danger';
27
28
  if (showWarning) {
@@ -69,6 +70,6 @@ export function TableActionsDropdown(props) {
69
70
  };
70
71
  return (React.createElement(React.Fragment, null,
71
72
  isModalOpen && React.createElement(CloseCaseModal, { onClose: onCancel, onConfirm: onConfirm, isUpdating: !!isPostingComment }),
72
- React.createElement(DownloadCSVFileModal, { filterState: filterState, isDisabled: isExportButtonDisabled, onModalshow: openUpdateSeverityModal, onClose: toggleDownloadCSVModal, selectedCases: selectedCases, filteredCaseCount: currentFilteredCaseCount }),
73
+ React.createElement(DownloadCSVFileModal, { filterState: filterState, loggedInUserRights: loggedInUserRights, loggedInUsersAccount: loggedInUsersAccount, isDisabled: isExportButtonDisabled, onModalshow: openUpdateSeverityModal, onClose: toggleDownloadCSVModal, selectedCases: selectedCases, filteredCaseCount: currentFilteredCaseCount }),
73
74
  React.createElement(SingleSelectDropdown, { hideToggleIcons: true, selected: { value: null, label: '' }, onSelect: onSelect, options: toolbarDropdownItems, id: "table-actions-dropdown", placeholder: t('Actions'), badge: React.createElement(Badge, null, selectedCases.length) })));
74
75
  }
@@ -1 +1 @@
1
- {"version":3,"file":"BookmarkedSearchesSelector.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-search/BookmarkedSearchesSelector.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAGvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAahE,UAAU,MAAM;IACZ,uBAAuB,EAAE,MAAM,CAAC;IAChC,iBAAiB,EAAE,mBAAmB,CAAC;IACvC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,sBAAsB,EAAE,MAAM,CAAC;CAClC;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,qBA0TvD"}
1
+ {"version":3,"file":"BookmarkedSearchesSelector.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-search/BookmarkedSearchesSelector.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAGvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAahE,UAAU,MAAM;IACZ,uBAAuB,EAAE,MAAM,CAAC;IAChC,iBAAiB,EAAE,mBAAmB,CAAC;IACvC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,sBAAsB,EAAE,MAAM,CAAC;CAClC;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,qBAyTvD"}
@@ -163,7 +163,6 @@ export function BookmarkedSearchesSelector(props) {
163
163
  !isEmpty(props.defaultSavedSearchName) && setSelectedSearch(props.defaultSavedSearchName);
164
164
  }, [props.defaultSavedSearchName]);
165
165
  const renderSavedSearchItems = Object.keys(bookmarkedSearches)
166
- .filter((key) => { var _a; return ((_a = bookmarkedSearches[key]) === null || _a === void 0 ? void 0 : _a.type) !== 'advanced'; })
167
166
  .sort()
168
167
  .map((bookmarkedSearch) => {
169
168
  var _a;
@@ -1 +1 @@
1
- {"version":3,"file":"CaseSearch.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-search/CaseSearch.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAgE,MAAM,OAAO,CAAC;AA8BrF,UAAU,MAAM;IACZ,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACnC;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,qBA4OvC"}
1
+ {"version":3,"file":"CaseSearch.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-search/CaseSearch.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAkB5E,UAAU,MAAM;IACZ,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACnC;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,qBA6LvC"}