@rh-support/cases 2.1.42 → 2.1.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -16,5 +16,3 @@ export default function CasesApp(routeProps: RouteComponentProps<ICasesRouteURLP
16
16
  return (<Cases routeProps={routeProps} basePath="/cases" />);
17
17
  }
18
18
  ```
19
-
20
- .
@@ -97,7 +97,7 @@ export function AccountsFilter(props) {
97
97
  if (!canReadBookmarkAccounts) {
98
98
  return null;
99
99
  }
100
- return (React.createElement("div", null,
100
+ return (React.createElement("div", { "data-tracking-id": "case-list-accounts-filter" },
101
101
  React.createElement("label", { htmlFor: "case-list-accounts-filter" },
102
102
  React.createElement(Trans, null, "Accounts")),
103
103
  React.createElement(AccountSelectorInternal, { label: t('i18nAccounts', 'Accounts'), selectedAccounts: selectedAccounts, multiple: true, suggestBookmarkAccounts: false, placeholder: getDropdownBtnPlaceholder(t('Search for an account'), (selectedAccounts || []).map((i) => i.name), ''), onSelect: onAccountsFilterChange })));
@@ -1 +1 @@
1
- {"version":3,"file":"CreatorSsoNameFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/CreatorSsoNameFilter.tsx"],"names":[],"mappings":"AAiCA,eAAO,MAAM,WAAW,0BAIvB,CAAC;AAYF,eAAO,MAAM,eAAe;;;;;;;GAA6E,CAAC;AAE1G,eAAO,MAAM,kBAAkB,iEAyC9B,CAAC;AAEF,wBAAgB,oBAAoB,gBA0OnC"}
1
+ {"version":3,"file":"CreatorSsoNameFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/CreatorSsoNameFilter.tsx"],"names":[],"mappings":"AAkCA,eAAO,MAAM,WAAW,0BAIvB,CAAC;AAYF,eAAO,MAAM,eAAe;;;;;;;GAA6E,CAAC;AAE1G,eAAO,MAAM,kBAAkB,iEAyC9B,CAAC;AAEF,wBAAgB,oBAAoB,gBA0OnC"}
@@ -13,7 +13,8 @@ import TimesCircleIcon from '@patternfly/react-icons/dist/js/icons/times-circle-
13
13
  import { LoadingIndicator, useFetch, useSelectKeyboardNavigator } from '@rh-support/components';
14
14
  import { GlobalMetadataStateContext } from '@rh-support/react-context';
15
15
  import { getDropdownBtnPlaceholder } from '@rh-support/utils';
16
- import { isEmpty, isNull } from 'lodash';
16
+ import isEmpty from 'lodash/isEmpty';
17
+ import isNull from 'lodash/isNull';
17
18
  import isUndefined from 'lodash/isUndefined';
18
19
  import uniqBy from 'lodash/uniqBy';
19
20
  import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
@@ -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;AAwB3E,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAWxD,OAAO,EAAE,iBAAiB,EAAyB,MAAM,0BAA0B,CAAC;AAEpF,OAAO,EAEH,eAAe,EACf,SAAS,EAIZ,MAAM,0BAA0B,CAAC;AA2BlC,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,eAyjB1C"}
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;AAwB3E,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAYxD,OAAO,EAAE,iBAAiB,EAAyB,MAAM,0BAA0B,CAAC;AAEpF,OAAO,EAEH,eAAe,EACf,SAAS,EAIZ,MAAM,0BAA0B,CAAC;AA2BlC,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,eA0jB1C"}
@@ -4,10 +4,11 @@ import { Table, TableVariant, Tbody, Td, Th, Thead, Tr, Visibility } from '@patt
4
4
  import { TableColumnSelector, TableComponent, TablePagination } from '@rh-support/components';
5
5
  import { GlobalMetadataDispatchContext, GlobalMetadataStateContext, updateUserPreferences, useGlobalStateContext, UserPreferencesKeys, } from '@rh-support/react-context';
6
6
  import { formatDate, scrollIntoView, toNewCaseTypeSwitcher } from '@rh-support/utils';
7
- import { isEqual, isUndefined } from 'lodash';
8
7
  import find from 'lodash/find';
9
8
  import flatMap from 'lodash/flatMap';
10
9
  import includes from 'lodash/includes';
10
+ import isEqual from 'lodash/isEqual';
11
+ import isUndefined from 'lodash/isUndefined';
11
12
  import React, { useContext, useEffect, useRef, useState } from 'react';
12
13
  import { Trans, useTranslation } from 'react-i18next';
13
14
  import { Link } from 'react-router-dom';
@@ -342,7 +343,7 @@ export function CaseListTable(props) {
342
343
  React.createElement("div", { className: "case-list-table-toolbar pf-v5-l-flex", ref: tableToolbarRef },
343
344
  React.createElement("div", { className: "toolbar-actions pf-v5-l-flex pf-m-space-items-sm" },
344
345
  React.createElement(TableColumnSelector, { onColumnSelectorChange: onColumnSelectorChange }),
345
- React.createElement(ExportCaseListCSV, { currentFilteredCaseList: props.caseList, isExportCsvDisabled: props.isSolrDown }),
346
+ React.createElement(ExportCaseListCSV, { currentFilteredCaseList: props.caseList, isExportCsvDisabled: props.isSolrDown, selectedCases: selectedCases }),
346
347
  React.createElement(CloseCaseBtn, { selectedCases: selectedCases, caseList: caseListData, onCasesCloseSuccess: onCasesCloseSuccess })),
347
348
  React.createElement("span", { className: "toolbar-pagination" },
348
349
  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() }))),
@@ -392,6 +393,6 @@ export function CaseListTable(props) {
392
393
  React.createElement(Td, { className: !isColumnVisible('type') ? Visibility.hidden : '', "data-label": "Support type" }, row.case_type),
393
394
  React.createElement(Td, { className: !isColumnVisible('closedDate') ? Visibility.hidden : '', "data-label": "Closed date" }, row.case_closedDate ? formatDate(row.case_closedDate) : ''),
394
395
  React.createElement(Td, { className: !isColumnVisible('folderName') ? Visibility.hidden : '', "data-label": "Group" }, row.case_folderName ? row.case_folderName : ''))))))),
395
- caseListData.length > 9 && (React.createElement("footer", { className: "toolbar-pagination" },
396
+ caseListData.length > 9 && (React.createElement("footer", { className: "toolbar-pagination", "data-tracking-id": "case-list-table-pagination" },
396
397
  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() }))))));
397
398
  }
@@ -10,6 +10,8 @@ interface IProps {
10
10
  loggedInUserRights: IApiResponseDetails<UserAuth>;
11
11
  loggedInUsersAccount: IApiResponseDetails<Partial<IAccount>>;
12
12
  filterState: ICaseListFilterState;
13
+ selectedCases: string[];
14
+ filteredCaseCount: number;
13
15
  }
14
16
  export default function DownloadCSVFileModal(props: IProps): JSX.Element;
15
17
  export {};
@@ -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;AAkBlE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AASxD,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;CACrC;AAYD,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,KAAK,EAAE,MAAM,eA8ZzD"}
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;AAkBlE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AASxD,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,eAuazD"}
@@ -22,14 +22,22 @@ import { getCaseListFromSolr } from '../../../utils/caseListUtils';
22
22
  import { createQueryForCSVDownload } from '../../../utils/caseSearchUtils';
23
23
  const csvHeadersSolr = [
24
24
  { label: 'Case number', key: SolrKeys.caseNumber },
25
+ {
26
+ label: 'Case link',
27
+ key: 'case_link',
28
+ },
25
29
  { label: 'Summary', key: SolrKeys.caseSummary },
26
30
  ];
27
31
  const csvHeadersSFDC = [
28
32
  { label: 'Case number', key: SFDCKeys.caseNumber },
33
+ {
34
+ label: 'Case link',
35
+ key: 'case_link',
36
+ },
29
37
  { label: 'Summary', key: SFDCKeys.caseSummary },
30
38
  ];
31
39
  export default function DownloadCSVFileModal(props) {
32
- const { onClose, onModalshow, isDisabled, loggedInUserRights, loggedInUsersAccount, filterState } = props;
40
+ const { onClose, onModalshow, isDisabled, loggedInUserRights, loggedInUsersAccount, filterState, selectedCases, filteredCaseCount, } = props;
33
41
  const { t } = useTranslation();
34
42
  const { isFetching, request } = useFetch(getCaseListFromSolr, { propgateErrors: true });
35
43
  const [downloadCSVFileName, setDownloadCSVFileName] = useState('CaseList.csv');
@@ -148,6 +156,7 @@ export default function DownloadCSVFileModal(props) {
148
156
  });
149
157
  setGeneratedCsvHeaders(updatedCsvHeaders);
150
158
  }, [loggedInUsersAccount.data.secureSupport, checkboxes, headerDefinitions]);
159
+ const isOrgAdmin = loggedInUserRights.data.isOrgAdmin();
151
160
  const isFetchingCSVData = isFetching || isFetchingSFDC;
152
161
  const partnerSearch = loggedInUserRights.data.hasManagedAccounts();
153
162
  const splitExtensionName = downloadCSVFileName.split('.')[0].replace(/ +/g, ''); // To split and trim value before saving PDF
@@ -165,6 +174,8 @@ export default function DownloadCSVFileModal(props) {
165
174
  const handleCheckboxChange = (key) => {
166
175
  setCheckboxes((prevCheckboxes) => (Object.assign(Object.assign({}, prevCheckboxes), { [key]: !prevCheckboxes[key] })));
167
176
  };
177
+ // Group header for SOLR
178
+ const groupHeaderSOLR = { label: 'Group', key: SolrKeys.groupName };
168
179
  const checkboxValues = Object.values(checkboxes).slice(1); // as we don't want selectAll value
169
180
  const allCheckBoxNotSelected = checkboxValues.includes(false);
170
181
  // For SOLR
@@ -172,10 +183,12 @@ export default function DownloadCSVFileModal(props) {
172
183
  try {
173
184
  setIsSavedClicked(true);
174
185
  if (!isEmpty(splitExtensionName)) {
175
- const res = yield request(createQueryForCSVDownload(filterState, loggedInUserRights.data, loggedInUsersAccount.data), partnerSearch, null, loggedInUsersAccount.data.secureSupport);
186
+ const query = createQueryForCSVDownload(filterState, loggedInUserRights.data, loggedInUsersAccount.data, selectedCases);
187
+ const res = yield request(query, partnerSearch, null, loggedInUsersAccount.data.secureSupport);
188
+ const headers = isOrgAdmin ? [...csvHeadersSolr, groupHeaderSOLR] : generatedCsvHeaders;
176
189
  // To map the values in csv to new support type
177
- const updatedCsvData = res.response.docs.map((row) => (Object.assign(Object.assign({}, row), { case_type: toNewCaseTypeSwitcher(row.case_type) })));
178
- downloadCSV(updatedCsvData, generatedCsvHeaders, splitExtensionName ? `${splitExtensionName}.csv` : 'CaseList.csv');
190
+ 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}` })));
191
+ downloadCSV(updatedCsvData, headers, splitExtensionName ? `${splitExtensionName}.csv` : 'CaseList.csv');
179
192
  onCancel();
180
193
  ToastNotification.addSuccessMessage(t('File downloaded successfully!'));
181
194
  setIsSavedClicked(false);
@@ -186,18 +199,21 @@ export default function DownloadCSVFileModal(props) {
186
199
  ToastNotification.addDangerMessage(t('File could not be downloaded. Please try again! '));
187
200
  }
188
201
  });
202
+ // Group header for SFDC
203
+ const groupHeaderSFDC = { label: 'Group', key: SFDCKeys.groupName };
189
204
  // For SFDC
190
205
  const onExportCSVClickSecureSupport = () => __awaiter(this, void 0, void 0, function* () {
191
206
  try {
192
207
  setIsSavedClicked(true);
193
208
  if (!isEmpty(splitExtensionName)) {
194
- const sfdcFilter = createQueryForCSVDownload(filterState, loggedInUserRights.data, loggedInUsersAccount.data);
209
+ const sfdcFilter = createQueryForCSVDownload(filterState, loggedInUserRights.data, loggedInUsersAccount.data, selectedCases);
195
210
  setIsFetchingSFDC(true);
196
211
  const sfdcResponse = yield publicApi.caseList.getCaseListFromSFDC(sfdcFilter, false, true);
197
212
  setIsFetchingSFDC(false);
213
+ const headers = isOrgAdmin ? [...csvHeadersSFDC, groupHeaderSFDC] : csvHeadersSFDC;
198
214
  // To map the values in csv to new support type
199
215
  const updatedCsvData = sfdcResponse.cases.map((row) => (Object.assign(Object.assign({}, row), { caseType: toNewCaseTypeSwitcher(row.caseType) })));
200
- downloadCSV(updatedCsvData, csvHeadersSFDC, splitExtensionName ? `${splitExtensionName}.csv` : 'CaseList.csv');
216
+ downloadCSV(updatedCsvData, headers, splitExtensionName ? `${splitExtensionName}.csv` : 'CaseList.csv');
201
217
  onCancel();
202
218
  ToastNotification.addSuccessMessage(t('File downloaded successfully!'));
203
219
  setIsSavedClicked(false);
@@ -265,18 +281,10 @@ export default function DownloadCSVFileModal(props) {
265
281
  React.createElement(Checkbox, { className: "nested", label: t('Issue summary'), defaultChecked: true, isDisabled: true, id: "controlled-check-3", name: "check3" }),
266
282
  generateCheckboxes(csvHeadersTwo))))));
267
283
  };
268
- const downloadCSVModalDescription = () => {
269
- const numberOfCases = 1 | 2 | 3;
270
- switch (numberOfCases) {
271
- case 1:
272
- return t('Your download will include 100 cases. ');
273
- case 2:
274
- return t('Your download will include 512 cases.');
275
- case 3:
276
- return t('Only the first 1000 cases will be included in your download. Please note this may take a while. ');
277
- default:
278
- return '';
279
- }
284
+ const downloadCSVModalDescription = (numberOfCases) => {
285
+ if (numberOfCases <= 1000)
286
+ return t('Your download will include {{count}} cases.', { count: numberOfCases });
287
+ return t('Only the first 1000 cases will be included in your download. Please note this may take a while.');
280
288
  };
281
289
  // Download CSV modal buttons
282
290
  const modalActions = [
@@ -293,5 +301,5 @@ export default function DownloadCSVFileModal(props) {
293
301
  }
294
302
  // eslint-disable-next-line react-hooks/exhaustive-deps
295
303
  }, [allCheckBoxNotSelected, checkboxes.selectAll]);
296
- return (React.createElement(Modal, { title: t('Download CSV file'), description: downloadCSVModalDescription(), className: "download-csv-modal", variant: ModalVariant.large, isOpen: onModalshow, onClose: onCancel, actions: modalActions }, downloadCSVModalBody()));
304
+ return (React.createElement(Modal, { title: t('Download CSV file'), description: downloadCSVModalDescription(selectedCases.length || filteredCaseCount), className: "download-csv-modal", variant: ModalVariant.large, isOpen: onModalshow, onClose: onCancel, actions: modalActions }, downloadCSVModalBody()));
297
305
  }
@@ -3,7 +3,8 @@ import { ICaseListResponse } from '../../../models/caseList';
3
3
  interface IProps {
4
4
  currentFilteredCaseList: ISolrResponse<ICaseListResponse>;
5
5
  isExportCsvDisabled?: boolean;
6
+ selectedCases: string[];
6
7
  }
7
- export declare function ExportCaseListCSV(props: IProps): JSX.Element;
8
+ export declare function ExportCaseListCSV({ currentFilteredCaseList, selectedCases, isExportCsvDisabled }: IProps): JSX.Element;
8
9
  export {};
9
10
  //# sourceMappingURL=ExportCaseListCSV.d.ts.map
@@ -1 +1 @@
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;AAIzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAK7D,UAAU,MAAM;IACZ,uBAAuB,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAC1D,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAID,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,eAmE9C"}
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;AAIzD,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,eAqExG"}
@@ -7,12 +7,12 @@ import { getCaseListFromSolr } from '../../../utils/caseListUtils';
7
7
  import { CaseListFilterStateContext } from '../CaseListFilterContext';
8
8
  import DownloadCSVFileModal from './DownloadCSVFileModal';
9
9
  const MAX_LIMIT = 1000;
10
- export function ExportCaseListCSV(props) {
11
- var _a, _b;
10
+ export function ExportCaseListCSV({ currentFilteredCaseList, selectedCases, isExportCsvDisabled }) {
11
+ var _a;
12
12
  const { t } = useTranslation();
13
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.');
14
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 });
15
- const currentFilteredCaseCount = (_b = (_a = props.currentFilteredCaseList) === null || _a === void 0 ? void 0 : _a.numFound) !== null && _b !== void 0 ? _b : 0;
15
+ const currentFilteredCaseCount = (_a = currentFilteredCaseList === null || currentFilteredCaseList === void 0 ? void 0 : currentFilteredCaseList.numFound) !== null && _a !== void 0 ? _a : 0;
16
16
  const { isFetching } = useFetch(getCaseListFromSolr, { propgateErrors: true });
17
17
  const [openUpdateSeverityModal, setOpenUpdateSeverityModal] = useState(false);
18
18
  const isFetchingCSVData = isFetching;
@@ -23,20 +23,20 @@ export function ExportCaseListCSV(props) {
23
23
  // To show tooltip if export csv is disabled when SOLR is down
24
24
  const getTooltipContent = () => {
25
25
  let tooltipText = t('Export Cases');
26
- if (props.isExportCsvDisabled) {
26
+ if (isExportCsvDisabled) {
27
27
  tooltipText = t('Unable to export while access to search is limited');
28
28
  }
29
29
  return tooltipText;
30
30
  };
31
31
  // To check if export csv button is disabled
32
- const isExportButtonDisabled = isBtnDisabled || props.isExportCsvDisabled;
32
+ const isExportButtonDisabled = isBtnDisabled || isExportCsvDisabled;
33
33
  // To toggle download csv modal
34
34
  const toggleDownloadCSVModal = () => {
35
35
  setOpenUpdateSeverityModal((openUpdateSeverityModal) => !openUpdateSeverityModal);
36
36
  };
37
- return (React.createElement("span", { title: (props.isExportCsvDisabled && getTooltipContent()) || '' },
37
+ return (React.createElement("span", { title: (isExportCsvDisabled && getTooltipContent()) || '' },
38
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
39
  React.createElement(Trans, null, "Exporting CSV"),
40
40
  React.createElement(Spinner, { size: "md", "aria-label": "loading", className: "export-csv-loader pf-v5-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 })));
41
+ React.createElement(DownloadCSVFileModal, { filterState: filterState, loggedInUserRights: loggedInUserRights, loggedInUsersAccount: loggedInUsersAccount, isDisabled: isExportButtonDisabled, onModalshow: openUpdateSeverityModal, onClose: toggleDownloadCSVModal, selectedCases: selectedCases, filteredCaseCount: currentFilteredCaseCount })));
42
42
  }
@@ -194,7 +194,7 @@ export function BookmarkedSearchesSelector(props) {
194
194
  const advancedSearchPhraseIsNotValid = filterState.filterQueryInfo.type === CaseSearchQueryType.ADVANCED && !props.isAdvancedSearchValid;
195
195
  const noFilterOrSearchQueryApplied = !props.currentCaseSearchString && (isOnlyDefaultFilterApplied(filterState) || isNoFilterApplied(filterState));
196
196
  return (React.createElement(React.Fragment, null,
197
- React.createElement("div", { className: "bookmark-search-dropdown-wrapper" },
197
+ React.createElement("div", { className: "bookmark-search-dropdown-wrapper", "data-tracking-id": "bookmark-search-id" },
198
198
  React.createElement(Dropdown, { className: "bookmark-search-dropdown", isOpen: isMenuOpen, dropdownItems: renderListItems, toggle: React.createElement(DropdownToggle, { splitButtonItems: [
199
199
  React.createElement(DropdownToggleAction, { onClick: onSaveForLaterClick, key: "action", isDisabled: !!selectedSearch ||
200
200
  noFilterOrSearchQueryApplied ||
@@ -9,12 +9,12 @@ export declare const FILTER_URL_QUERY_SEARCH_PARAM = "query";
9
9
  export declare const FILTER_URL_CURRENT_PAGE_SEARCH_PARAM = "p";
10
10
  export declare const FILTER_URL_PAGE_SIZE_SEARCH_PARAM = "size";
11
11
  export declare const FILTER_URL_QUERY_TYPE = "searchType";
12
- declare function createSolrQueryFromFilterState(filterState: ICaseListFilterState, loggedInUser: UserAuth): any;
12
+ declare function createSolrQueryFromFilterState(filterState: ICaseListFilterState, loggedInUser: UserAuth, selectedCases?: string[]): any;
13
13
  declare function createUserFriendlyQueryFromFilterState(filterInfo: Partial<IFilterInfo>, filterQuery: string, useKeyForKVPair?: boolean): string;
14
14
  declare function createUserFriendlyQueryFromFilterStateAdvancedSearch(filterInfo: Partial<IFilterInfo>, filterQuery: string): string;
15
15
  declare function createAdvancedSearchQueryFromFilterState(filterInfo: Partial<IFilterInfo>, keyword: string, useKeyForKVPair?: any[]): string;
16
- declare function createQueryForCSVDownload(filterState: ICaseListFilterState, loggedInUserRights: UserAuth, loggedInUsersAccount: any, startValue?: number, limitValue?: number): any;
17
- declare function createSFDCQueryFromFilterState(filterState: ICaseListFilterState, loggedInUser: UserAuth, loggedInUserAccount: Partial<IAccount>): Partial<ISFDCCaseFilter>;
16
+ declare function createQueryForCSVDownload(filterState: ICaseListFilterState, loggedInUserRights: UserAuth, loggedInUsersAccount: any, selectedCases?: string[], startValue?: number, limitValue?: number): any;
17
+ declare function createSFDCQueryFromFilterState(filterState: ICaseListFilterState, loggedInUser: UserAuth, loggedInUserAccount: Partial<IAccount>, selectedCases?: string[]): Partial<ISFDCCaseFilter>;
18
18
  declare function mapSFDCCaseListToSolrCaseList(response?: ISFDCCaseListResponse[]): ISolrCaseListResponse[];
19
19
  declare function createURLQueryFromFilterState(filterState: ICaseListFilterState): string;
20
20
  declare function createFilterStateFromUrlQuery(urlQuery: string, globalMetadataState: IGlobalMetadataState, pageSize?: number, currentPage?: number, searchType?: CaseSearchQueryType): ICaseListFilterState;
@@ -1 +1 @@
1
- {"version":3,"file":"caseSearchUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/caseSearchUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AACrG,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2B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8B,EAC9B,sCAAsC,EACtC,oDAAoD,EACpD,yBAAyB,EACzB,8BAA8B,EAC9B,6BAA6B,EAC7B,6BAA6B,EAC7B,6BAA6B,EAC7B,wCAAwC,EACxC,kCAAkC,GACrC,CAAC"}
@@ -24,7 +24,7 @@ export const FILTER_URL_QUERY_SEARCH_PARAM = 'query';
24
24
  export const FILTER_URL_CURRENT_PAGE_SEARCH_PARAM = 'p';
25
25
  export const FILTER_URL_PAGE_SIZE_SEARCH_PARAM = 'size';
26
26
  export const FILTER_URL_QUERY_TYPE = 'searchType';
27
- function createSolrQueryFromFilterState(filterState, loggedInUser) {
27
+ function createSolrQueryFromFilterState(filterState, loggedInUser, selectedCases = []) {
28
28
  const { paginationInfo: { pageSize, currentPage }, sortInfo: { column, direction }, filterInfo, filterQueryInfo, } = filterState;
29
29
  const rows = pageSize;
30
30
  const queryString = (filterQueryInfo.queryString || '*:*').trim();
@@ -66,6 +66,7 @@ function createSolrQueryFromFilterState(filterState, loggedInUser) {
66
66
  .fq(SolrKeys.accountNumber, filteredAccounts)
67
67
  .fq(SolrKeys.escalation, escalationValue)
68
68
  .fq(SolrKeys.type, filterInfo[SolrKeys.type], [SolrTags.c_type])
69
+ .fq(SolrKeys.caseNumber, selectedCases)
69
70
  .beginOr()
70
71
  .fq(SolrKeys.createdBySsoUsername, filterInfo[SolrKeys.createdBySsoUsername])
71
72
  .fq(SolrKeys.caseContactSSO, filterInfo[SolrKeys.caseContactSSO])
@@ -197,15 +198,16 @@ function getStringOrBooleanValue(val) {
197
198
  return val;
198
199
  return val === 'true' ? true : val === 'false' ? false : `"${val}"`;
199
200
  }
200
- function createQueryForCSVDownload(filterState, loggedInUserRights, loggedInUsersAccount, startValue = 0, limitValue = 1000) {
201
+ function createQueryForCSVDownload(filterState, loggedInUserRights, loggedInUsersAccount, selectedCases = [], startValue = 0, limitValue = 1000) {
202
+ const newSelectedCases = selectedCases.slice(0, limitValue);
201
203
  if (loggedInUsersAccount.secureSupport) {
202
- const sfdcFilter = createSFDCQueryFromFilterState(filterState, loggedInUserRights, loggedInUsersAccount);
204
+ const sfdcFilter = createSFDCQueryFromFilterState(filterState, loggedInUserRights, loggedInUsersAccount, newSelectedCases);
203
205
  sfdcFilter.offset = startValue;
204
206
  sfdcFilter.maxResults = limitValue;
205
207
  return sfdcFilter;
206
208
  }
207
209
  else {
208
- const query = createSolrQueryFromFilterState(filterState, loggedInUserRights);
210
+ const query = createSolrQueryFromFilterState(filterState, loggedInUserRights, newSelectedCases);
209
211
  const { start, rows } = query, solrQuery = __rest(query, ["start", "rows"]);
210
212
  solrQuery.start = startValue;
211
213
  solrQuery.rows = limitValue;
@@ -226,7 +228,7 @@ function objectFlip(obj, camelCaseKey = false) {
226
228
  return ret;
227
229
  }, {});
228
230
  }
229
- function createSFDCQueryFromFilterState(filterState, loggedInUser, loggedInUserAccount) {
231
+ function createSFDCQueryFromFilterState(filterState, loggedInUser, loggedInUserAccount, selectedCases = []) {
230
232
  const { paginationInfo: { pageSize, currentPage }, sortInfo: { column, direction }, filterInfo, filterQueryInfo, } = filterState;
231
233
  const maxResults = pageSize;
232
234
  const offset = (currentPage - 1) * pageSize;
@@ -236,6 +238,8 @@ function createSFDCQueryFromFilterState(filterState, loggedInUser, loggedInUserA
236
238
  const filteredSeverity = filterInfo[SolrKeys.severity];
237
239
  const filteredProduct = filterInfo[ProductVersionKey];
238
240
  const includeClosed = filteredStatus.length === 0 ? true : filteredStatus.includes(CaseStatus.Closed);
241
+ const filteredCaseOwner = filterInfo[SolrKeys.caseOwner];
242
+ const filteredCaseCreatedBySSO = filterInfo[SolrKeys.createdBySsoUsername];
239
243
  // https://projects.engineering.redhat.com/browse/CPCCM-8069?focusedCommentId=2426553&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-2426553
240
244
  // Truth table in Comment here decsribes how combination of statuses work in sfdc.
241
245
  // below we remove the closed status from the selected status array because we have already set the include_closed flag on the line before this comment
@@ -259,6 +263,9 @@ function createSFDCQueryFromFilterState(filterState, loggedInUser, loggedInUserA
259
263
  else if (!isEmpty(queryString)) {
260
264
  sfdcFilter['keyword'] = queryString;
261
265
  }
266
+ if (selectedCases.length > 0) {
267
+ sfdcFilter['caseNumbers'] = [...(sfdcFilter['caseNumbers'] || []), ...selectedCases];
268
+ }
262
269
  if ((filteredStatus || []).length === 1) {
263
270
  sfdcFilter['status'] = filteredStatus[0];
264
271
  }
@@ -274,6 +281,12 @@ function createSFDCQueryFromFilterState(filterState, loggedInUser, loggedInUserA
274
281
  if (filteredAccounts.length === 1 && filteredAccounts[0] !== loggedInUser.getAccountNumber()) {
275
282
  sfdcFilter['accountNumber'] = filteredAccounts[0];
276
283
  }
284
+ if ((filteredCaseOwner || []).length === 1) {
285
+ sfdcFilter['ownerSSOName'] = filteredCaseOwner[0];
286
+ }
287
+ if ((filteredCaseCreatedBySSO || []).length === 1) {
288
+ sfdcFilter['createdBySSOName'] = filteredCaseCreatedBySSO[0];
289
+ }
277
290
  return sfdcFilter;
278
291
  }
279
292
  function mapSFDCCaseListToSolrCaseList(response = []) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/cases",
3
- "version": "2.1.42",
3
+ "version": "2.1.44",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -26,36 +26,34 @@
26
26
  "lib/**/*"
27
27
  ],
28
28
  "peerDependencies": {
29
- "@cee-eng/hydrajs": "4.16.43",
29
+ "@cee-eng/hydrajs": "4.17.1",
30
30
  "@patternfly/patternfly": "5.1.0",
31
31
  "@patternfly/react-core": "5.1.1",
32
32
  "@patternfly/react-table": "5.1.1",
33
- "i18next": "^19.0.1",
34
33
  "localforage": "^1.10.0",
35
34
  "lodash": "^4.17.21",
36
35
  "react": "17.0.2",
37
36
  "react-dom": "17.0.2",
38
- "react-i18next": "^11.2.5",
37
+ "react-i18next": "^12.3.1",
39
38
  "react-router-dom": "^5.1.2",
40
39
  "solr-query-builder": "1.0.1"
41
40
  },
42
41
  "dependencies": {
43
- "@cee-eng/hydrajs": "4.16.43",
42
+ "@cee-eng/hydrajs": "4.17.1",
44
43
  "@patternfly/patternfly": "5.1.0",
45
44
  "@patternfly/react-core": "5.1.1",
46
45
  "@patternfly/react-table": "5.1.1",
47
- "@rh-support/components": "2.1.33",
48
- "@rh-support/react-context": "2.1.36",
46
+ "@rh-support/components": "2.1.35",
47
+ "@rh-support/react-context": "2.1.38",
49
48
  "@rh-support/types": "2.0.2",
50
- "@rh-support/user-permissions": "2.1.23",
51
- "@rh-support/utils": "2.1.16",
52
- "i18next": "^19.0.1",
49
+ "@rh-support/user-permissions": "2.1.25",
50
+ "@rh-support/utils": "2.1.17",
53
51
  "localforage": "^1.10.0",
54
52
  "lodash": "^4.17.21",
55
53
  "pegjs": "^0.10.0",
56
54
  "react": "17.0.2",
57
55
  "react-dom": "17.0.2",
58
- "react-i18next": "^11.2.5",
56
+ "react-i18next": "^12.3.1",
59
57
  "react-router-dom": "^5.1.2",
60
58
  "solr-query-builder": "1.0.1"
61
59
  },
@@ -63,7 +61,6 @@
63
61
  "@testing-library/jest-dom": "^5.16.5",
64
62
  "@testing-library/react": "^12.0.0",
65
63
  "@testing-library/user-event": "^13.1.9",
66
- "@types/i18next": "^12.1.0",
67
64
  "@types/lodash": "^4.14.136",
68
65
  "@types/react": "^17.0.14",
69
66
  "@types/react-dom": "^17.0.9",
@@ -90,5 +87,5 @@
90
87
  "defaults and supports es6-module",
91
88
  "maintained node versions"
92
89
  ],
93
- "gitHead": "9edf1a3bda045f22d2d5187c7a3b154787b9c472"
90
+ "gitHead": "6ccb5b388d58ad076886f1da22615f3225d667f6"
94
91
  }