@rh-support/cases 1.0.41-beta.47 → 1.0.41-beta.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExportCaseListCSV.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-table/ExportCaseListCSV.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAMzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAgD7D,UAAU,MAAM;IACZ,uBAAuB,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAC1D,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAID,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"ExportCaseListCSV.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-table/ExportCaseListCSV.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAMzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAgD7D,UAAU,MAAM;IACZ,uBAAuB,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAC1D,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAID,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,eAoG9C"}
|
|
@@ -11,7 +11,7 @@ import { publicApi } from '@cee-eng/hydrajs';
|
|
|
11
11
|
import { Button } from '@patternfly/react-core';
|
|
12
12
|
import { ToastNotification, useFetch } from '@rh-support/components';
|
|
13
13
|
import { GlobalMetadataStateContext } from '@rh-support/react-context';
|
|
14
|
-
import { downloadCSV, formatDateTime } from '@rh-support/utils';
|
|
14
|
+
import { downloadCSV, formatDateTime, toNewCaseTypeSwitcher } from '@rh-support/utils';
|
|
15
15
|
import React, { useContext, useState } from 'react';
|
|
16
16
|
import { Trans, useTranslation } from 'react-i18next';
|
|
17
17
|
import { SFDCKeys, SolrKeys } from '../../../enums/filters';
|
|
@@ -34,7 +34,7 @@ const csvHeadersSolr = [
|
|
|
34
34
|
{ label: 'Modified date', key: SolrKeys.modifiedDate, transform: formatDateTime },
|
|
35
35
|
{ label: 'Uri', key: SolrKeys.uri },
|
|
36
36
|
{ label: 'Personal reference number', key: SolrKeys.alternateId },
|
|
37
|
-
{ label: '
|
|
37
|
+
{ label: 'Support type', key: SolrKeys.type },
|
|
38
38
|
{ label: 'Closed date', key: SolrKeys.caseClosedDate, transform: formatDateTime },
|
|
39
39
|
];
|
|
40
40
|
const csvHeadersSFDC = [
|
|
@@ -73,6 +73,7 @@ export function ExportCaseListCSV(props) {
|
|
|
73
73
|
const filterState = useContext(CaseListFilterStateContext);
|
|
74
74
|
const { globalMetadataState: { loggedInUserRights, loggedInUsersAccount }, } = useContext(GlobalMetadataStateContext);
|
|
75
75
|
const isOrgAdmin = loggedInUserRights.data.isOrgAdmin();
|
|
76
|
+
// CSV For Secure Support Users
|
|
76
77
|
const onExportCSVClickSecureSupport = () => __awaiter(this, void 0, void 0, function* () {
|
|
77
78
|
try {
|
|
78
79
|
const sfdcFilter = createQueryForCSVDownload(filterState, loggedInUserRights.data, loggedInUsersAccount.data);
|
|
@@ -80,7 +81,9 @@ export function ExportCaseListCSV(props) {
|
|
|
80
81
|
const sfdcResponse = yield publicApi.caseList.getCaseListFromSFDC(sfdcFilter, false, true);
|
|
81
82
|
setIsFetchingSFDC(false);
|
|
82
83
|
const headers = isOrgAdmin ? [...csvHeadersSFDC, groupHeaderSFDC] : csvHeadersSFDC;
|
|
83
|
-
|
|
84
|
+
// To map the values in csv to new support type
|
|
85
|
+
const updatedCsvData = sfdcResponse.cases.map((row) => (Object.assign(Object.assign({}, row), { caseType: toNewCaseTypeSwitcher(row.caseType) })));
|
|
86
|
+
downloadCSV(updatedCsvData, headers, 'CaseList.csv');
|
|
84
87
|
}
|
|
85
88
|
catch (e) {
|
|
86
89
|
setIsFetchingSFDC(false);
|
|
@@ -88,11 +91,14 @@ export function ExportCaseListCSV(props) {
|
|
|
88
91
|
}
|
|
89
92
|
});
|
|
90
93
|
const partnerSearch = loggedInUserRights.data.hasManagedAccounts();
|
|
94
|
+
// CSV For Normal Users
|
|
91
95
|
const onExportCSVClick = () => __awaiter(this, void 0, void 0, function* () {
|
|
92
96
|
try {
|
|
93
97
|
const res = yield request(createQueryForCSVDownload(filterState, loggedInUserRights.data, loggedInUsersAccount.data), partnerSearch, null, loggedInUsersAccount.data.secureSupport);
|
|
94
98
|
const headers = isOrgAdmin ? [...csvHeadersSolr, groupHeaderSOLR] : csvHeadersSolr;
|
|
95
|
-
|
|
99
|
+
// To map the values in csv to new support type
|
|
100
|
+
const updatedCsvData = res.response.docs.map((row) => (Object.assign(Object.assign({}, row), { case_type: toNewCaseTypeSwitcher(row.case_type) })));
|
|
101
|
+
downloadCSV(updatedCsvData, headers, 'CaseList.csv');
|
|
96
102
|
}
|
|
97
103
|
catch (e) {
|
|
98
104
|
ToastNotification.addDangerMessage(t('Could not export CSV'));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/cases",
|
|
3
|
-
"version": "1.0.41-beta.
|
|
3
|
+
"version": "1.0.41-beta.52",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"lib/**/*"
|
|
27
27
|
],
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@cee-eng/hydrajs": "4.15.
|
|
29
|
+
"@cee-eng/hydrajs": "4.15.71",
|
|
30
30
|
"@patternfly/patternfly": "4.196.7",
|
|
31
31
|
"@patternfly/pfe-collapse": "1.12.3",
|
|
32
32
|
"@patternfly/react-core": "4.264.0",
|
|
@@ -46,16 +46,16 @@
|
|
|
46
46
|
"solr-query-builder": "1.0.1"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@cee-eng/hydrajs": "4.15.
|
|
49
|
+
"@cee-eng/hydrajs": "4.15.71",
|
|
50
50
|
"@patternfly/patternfly": "4.196.7",
|
|
51
51
|
"@patternfly/pfe-collapse": "1.12.3",
|
|
52
52
|
"@patternfly/react-core": "4.264.0",
|
|
53
53
|
"@patternfly/react-table": "4.111.33",
|
|
54
|
-
"@rh-support/components": "1.2.22-beta.
|
|
55
|
-
"@rh-support/react-context": "1.0.30-beta.
|
|
54
|
+
"@rh-support/components": "1.2.22-beta.52",
|
|
55
|
+
"@rh-support/react-context": "1.0.30-beta.52",
|
|
56
56
|
"@rh-support/types": "0.2.1-beta.33",
|
|
57
|
-
"@rh-support/user-permissions": "1.0.12-beta.
|
|
58
|
-
"@rh-support/utils": "1.0.10-beta.
|
|
57
|
+
"@rh-support/user-permissions": "1.0.12-beta.52",
|
|
58
|
+
"@rh-support/utils": "1.0.10-beta.52",
|
|
59
59
|
"i18next": "^19.0.1",
|
|
60
60
|
"localforage": "^1.7.3",
|
|
61
61
|
"lodash": "^4.17.21",
|
|
@@ -99,5 +99,5 @@
|
|
|
99
99
|
"not ie <= 11",
|
|
100
100
|
"not op_mini all"
|
|
101
101
|
],
|
|
102
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "4e640a09555885046a05d3f5a552d0bf90f46d9c"
|
|
103
103
|
}
|