@rh-support/cases 2.6.170 → 2.6.173
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/lib/esm/components/case-list/CaseList.d.ts +7 -0
- package/lib/esm/components/case-list/CaseList.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseList.js +107 -106
- package/lib/esm/components/case-list/CaseListContext.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListContext.js +2 -0
- package/lib/esm/components/case-list/CaseListFilterReducer.d.ts +1 -5
- package/lib/esm/components/case-list/CaseListFilterReducer.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListFilterReducer.js +1 -2
- package/lib/esm/components/case-list/CaseListReducer.d.ts +8 -2
- package/lib/esm/components/case-list/CaseListReducer.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListReducer.js +13 -1
- package/lib/esm/components/case-list/case-list-filters/AccountsFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/AccountsFilter.js +11 -18
- package/lib/esm/components/case-list/case-list-filters/AdditionalFilters.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/AdditionalFilters.js +2 -4
- package/lib/esm/components/case-list/case-list-filters/CaseListFilterChips.d.ts +7 -1
- package/lib/esm/components/case-list/case-list-filters/CaseListFilterChips.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/CaseListFilterChips.js +15 -7
- package/lib/esm/components/case-list/case-list-filters/CaseListFilters.d.ts +5 -2
- package/lib/esm/components/case-list/case-list-filters/CaseListFilters.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/CaseListFilters.js +14 -14
- package/lib/esm/components/case-list/case-list-filters/ProductFilterChip.d.ts +3 -1
- package/lib/esm/components/case-list/case-list-filters/ProductFilterChip.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/ProductFilterChip.js +2 -2
- package/lib/esm/components/case-list/case-list-filters/ProductsFilter.d.ts +4 -5
- package/lib/esm/components/case-list/case-list-filters/ProductsFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/ProductsFilter.js +54 -15
- package/lib/esm/components/case-list/case-list-filters/SeverityFilter.d.ts +3 -0
- package/lib/esm/components/case-list/case-list-filters/SeverityFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/SeverityFilter.js +44 -18
- package/lib/esm/components/case-list/case-list-filters/StatusFilter.d.ts +3 -0
- package/lib/esm/components/case-list/case-list-filters/StatusFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/StatusFilter.js +44 -14
- package/lib/esm/components/case-list/case-list-filters/VersionsFilter.d.ts +3 -1
- package/lib/esm/components/case-list/case-list-filters/VersionsFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/VersionsFilter.js +32 -61
- package/lib/esm/components/case-list/case-list-table/CaseListTable.d.ts +1 -0
- package/lib/esm/components/case-list/case-list-table/CaseListTable.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-table/CaseListTable.js +6 -5
- package/lib/esm/components/case-list/case-list-table/DownloadCSVFileModal.d.ts +5 -0
- package/lib/esm/components/case-list/case-list-table/DownloadCSVFileModal.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-table/DownloadCSVFileModal.js +68 -38
- package/lib/esm/components/case-list/case-list-table/ExportCaseListCSV.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-table/ExportCaseListCSV.js +15 -5
- package/lib/esm/components/case-list/case-list-table/SeverityLabel.js +1 -1
- package/lib/esm/components/case-list/case-list-table/TableActionsDropdown.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-table/TableActionsDropdown.js +3 -2
- package/lib/esm/components/case-list/case-search/BookmarkedSearchesSelector.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-search/BookmarkedSearchesSelector.js +0 -1
- package/lib/esm/components/case-list/case-search/CaseSearch.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-search/CaseSearch.js +6 -6
- package/lib/esm/components/case-list/case-search/useAdvanceSearchParser.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-search/useAdvanceSearchParser.js +1 -2
- package/lib/esm/enums/case.d.ts +1 -2
- package/lib/esm/enums/case.d.ts.map +1 -1
- package/lib/esm/enums/case.js +1 -14
- package/lib/esm/hooks/useExportCaseListCSV.d.ts.map +1 -1
- package/lib/esm/hooks/useExportCaseListCSV.js +9 -1
- package/lib/esm/test-utils/mockData.js +1 -1
- package/lib/esm/utils/caseSearchUtils.d.ts.map +1 -1
- package/lib/esm/utils/caseSearchUtils.js +1 -26
- package/lib/esm/utils/constants.d.ts +1 -2
- package/lib/esm/utils/constants.d.ts.map +1 -1
- package/lib/esm/utils/constants.js +3 -14
- package/lib/esm/utils/mockSolrResponse.js +1 -1
- package/package.json +6 -6
- package/lib/esm/utils/caseListGraphQLUtils.d.ts +0 -16
- package/lib/esm/utils/caseListGraphQLUtils.d.ts.map +0 -1
- package/lib/esm/utils/caseListGraphQLUtils.js +0 -193
- package/lib/esm/utils/caseListMapper.d.ts +0 -6
- package/lib/esm/utils/caseListMapper.d.ts.map +0 -1
- package/lib/esm/utils/caseListMapper.js +0 -36
- package/lib/esm/utils/caseListVariablesBuilder.d.ts +0 -13
- package/lib/esm/utils/caseListVariablesBuilder.d.ts.map +0 -1
- package/lib/esm/utils/caseListVariablesBuilder.js +0 -160
- package/lib/esm/utils/statusUtils.d.ts +0 -3
- package/lib/esm/utils/statusUtils.d.ts.map +0 -1
- package/lib/esm/utils/statusUtils.js +0 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VersionsFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/VersionsFilter.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"VersionsFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/VersionsFilter.tsx"],"names":[],"mappings":"AAeA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAIhF,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAgB,MAAM,0BAA0B,CAAC;AAoCxE,UAAU,MAAM;IACZ,WAAW,EAAE,cAAc,CAAC;IAC5B,mBAAmB,EAAE,uBAAuB,EAAE,CAAC;CAClD;AAED,wBAAgB,cAAc,CAAC,EAAE,WAAW,EAAE,mBAAmB,EAAE,EAAE,MAAM,qBAkO1E"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { useApolloClient } from '@apollo/client/react';
|
|
2
1
|
import { Button, MenuToggle, Select, SelectList, SelectOption, TextInputGroup, TextInputGroupMain, TextInputGroupUtilities, } from '@patternfly/react-core';
|
|
3
2
|
import TimesIcon from '@patternfly/react-icons/dist/js/icons/times-icon';
|
|
4
3
|
import { useSelectKeyboardNavigator } from '@rh-support/components';
|
|
5
|
-
import { GlobalMetadataStateContext } from '@rh-support/react-context';
|
|
6
|
-
import { GET_PRODUCTS, handleGraphQLVersionsResponse } from '@rh-support/utils';
|
|
7
4
|
import isEmpty from 'lodash/isEmpty';
|
|
8
5
|
import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
9
6
|
import { useTranslation } from 'react-i18next';
|
|
10
7
|
import { SolrKeys, SolrPivotKeys } from '../../../enums/filters';
|
|
11
8
|
import { CaseListFilterDispatchContext, CaseListFilterStateContext } from '../CaseListFilterContext';
|
|
12
9
|
import { updateFilter } from '../CaseListFilterReducer';
|
|
10
|
+
function getVersionValuesForProduct(productPivot = [], productName) {
|
|
11
|
+
return (productPivot.find((item) => item.value === productName) || {}).case_version;
|
|
12
|
+
}
|
|
13
13
|
//split version into parts
|
|
14
14
|
function parseVersionIntoParts(version) {
|
|
15
15
|
//keep unknown version at last
|
|
@@ -33,62 +33,32 @@ function compareVersions(versionA, versionB) {
|
|
|
33
33
|
//one is string and other is number => string takes precendence
|
|
34
34
|
if (typeof a === 'string')
|
|
35
35
|
return -1;
|
|
36
|
-
if (typeof b
|
|
36
|
+
if (typeof b == 'string')
|
|
37
37
|
return 1;
|
|
38
38
|
}
|
|
39
39
|
return 0;
|
|
40
40
|
}
|
|
41
|
-
export function VersionsFilter({ productInfo }) {
|
|
41
|
+
export function VersionsFilter({ productInfo, productVersionPivot }) {
|
|
42
42
|
const { t } = useTranslation();
|
|
43
43
|
const { filterInfo } = useContext(CaseListFilterStateContext);
|
|
44
44
|
const dispatch = useContext(CaseListFilterDispatchContext);
|
|
45
|
-
const apolloClient = useApolloClient();
|
|
46
|
-
const { globalMetadataState: { allProducts }, } = useContext(GlobalMetadataStateContext);
|
|
47
45
|
const [inputValue, setInputValue] = useState('');
|
|
48
46
|
const [activeItem, setActiveItem] = useState(null);
|
|
49
47
|
const [isOpen, setIsOpen] = useState(false);
|
|
50
48
|
const [selectedItems, setSelectedItems] = useState({});
|
|
51
|
-
const [fetchedVersions, setFetchedVersions] = useState([]);
|
|
52
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
53
49
|
const textInputRef = useRef();
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
first: 200,
|
|
65
|
-
orderBy: { Name: { order: 'ASC' } },
|
|
66
|
-
},
|
|
67
|
-
fetchPolicy: 'cache-first',
|
|
68
|
-
})
|
|
69
|
-
.then(({ data }) => {
|
|
70
|
-
var _a, _b, _c, _d;
|
|
71
|
-
const edges = (_d = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.salesforce_support_uiapi) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.SalesforceSupportProduct2) === null || _c === void 0 ? void 0 : _c.edges) !== null && _d !== void 0 ? _d : [];
|
|
72
|
-
const versionData = handleGraphQLVersionsResponse(edges, productObj.name || productInfo.value);
|
|
73
|
-
setFetchedVersions(versionData);
|
|
74
|
-
})
|
|
75
|
-
.catch((err) => {
|
|
76
|
-
console.error('[VersionsFilter] Failed to fetch versions:', err);
|
|
77
|
-
setFetchedVersions([]);
|
|
78
|
-
})
|
|
79
|
-
.finally(() => setIsLoading(false));
|
|
80
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
81
|
-
}, [productInfo.value, allProducts.data]);
|
|
82
|
-
const list = useMemo(() => {
|
|
83
|
-
const sorted = [...fetchedVersions].sort((a, b) => compareVersions(a.name, b.name));
|
|
84
|
-
return sorted.map((version) => ({
|
|
85
|
-
value: version.name,
|
|
86
|
-
key: version.name,
|
|
87
|
-
id: version.id,
|
|
88
|
-
}));
|
|
89
|
-
}, [fetchedVersions]);
|
|
50
|
+
// Memoize versions to prevent unnecessary recalculations
|
|
51
|
+
const versions = useMemo(() => {
|
|
52
|
+
const versionValues = getVersionValuesForProduct(productVersionPivot, productInfo.value);
|
|
53
|
+
return versionValues === null || versionValues === void 0 ? void 0 : versionValues.sort((a, b) => compareVersions(a.value, b.value));
|
|
54
|
+
}, [productVersionPivot, productInfo.value]);
|
|
55
|
+
// Memoize list to prevent unnecessary recreations
|
|
56
|
+
const list = useMemo(() => (versions === null || versions === void 0 ? void 0 : versions.map((version) => ({
|
|
57
|
+
value: version.value,
|
|
58
|
+
key: version.value,
|
|
59
|
+
}))) || [], [versions]);
|
|
90
60
|
const [selectOptions, setSelectOptions] = useState(list);
|
|
91
|
-
const onToggleClick = () => {
|
|
61
|
+
const onToggleClick = (e) => {
|
|
92
62
|
setIsOpen(!isOpen);
|
|
93
63
|
};
|
|
94
64
|
const onSelect = (option) => {
|
|
@@ -102,17 +72,18 @@ export function VersionsFilter({ productInfo }) {
|
|
|
102
72
|
setSelectedItems((prevData) => (Object.assign(Object.assign({}, prevData), { [option.value]: true })));
|
|
103
73
|
prevSelectedVersions.push(option.value);
|
|
104
74
|
}
|
|
105
|
-
const newVersionState = prevSelectedVersions.map((version) => {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
productId: (versionOption === null || versionOption === void 0 ? void 0 : versionOption.id) || '',
|
|
111
|
-
};
|
|
112
|
-
});
|
|
113
|
-
const productNewState = [...((filterInfo === null || filterInfo === void 0 ? void 0 : filterInfo[SolrPivotKeys.product_version]) || [])];
|
|
75
|
+
const newVersionState = prevSelectedVersions.map((version) => ({
|
|
76
|
+
field: SolrKeys.version,
|
|
77
|
+
value: version,
|
|
78
|
+
}));
|
|
79
|
+
const productNewState = [...filterInfo[SolrPivotKeys.product_version]];
|
|
114
80
|
const objIndex = productNewState.findIndex((item) => item.value === productInfo.value);
|
|
115
|
-
|
|
81
|
+
// replace product with updated versions
|
|
82
|
+
productNewState[objIndex] = {
|
|
83
|
+
field: SolrKeys.product,
|
|
84
|
+
value: productInfo.value,
|
|
85
|
+
[SolrKeys.version]: newVersionState,
|
|
86
|
+
};
|
|
116
87
|
updateFilter(dispatch, { filterKey: SolrPivotKeys.product_version, values: productNewState });
|
|
117
88
|
};
|
|
118
89
|
// Use the keyboard navigator hook
|
|
@@ -132,7 +103,7 @@ export function VersionsFilter({ productInfo }) {
|
|
|
132
103
|
var _a;
|
|
133
104
|
setInputValue('');
|
|
134
105
|
setSelectedItems({});
|
|
135
|
-
const productNewState = [...
|
|
106
|
+
const productNewState = [...filterInfo[SolrPivotKeys.product_version]];
|
|
136
107
|
const objIndex = productNewState.findIndex((item) => item.value === productInfo.value);
|
|
137
108
|
productNewState[objIndex] = {
|
|
138
109
|
field: SolrKeys.product,
|
|
@@ -146,7 +117,7 @@ export function VersionsFilter({ productInfo }) {
|
|
|
146
117
|
useEffect(() => {
|
|
147
118
|
if (focusedItemIndex !== null && list[focusedItemIndex]) {
|
|
148
119
|
const focusedItem = list[focusedItemIndex];
|
|
149
|
-
setActiveItem(`select-multi-typeahead-checkbox-${
|
|
120
|
+
setActiveItem(`select-multi-typeahead-checkbox-${focusedItem === null || focusedItem === void 0 ? void 0 : focusedItem.value.replace(' ', '-')}`);
|
|
150
121
|
}
|
|
151
122
|
else {
|
|
152
123
|
setActiveItem(null);
|
|
@@ -160,7 +131,7 @@ export function VersionsFilter({ productInfo }) {
|
|
|
160
131
|
// Memoize dropdownOptions to prevent unnecessary rerenders
|
|
161
132
|
const dropdownOptions = useMemo(() => {
|
|
162
133
|
const optionsToRender = !isEmpty(selectOptions) ? selectOptions : list;
|
|
163
|
-
return optionsToRender.map((option, index) => option.value && (React.createElement(SelectOption, { key: option.key, value: option, hasCheckbox: true, isSelected: selectedItems[
|
|
134
|
+
return optionsToRender.map((option, index) => option.value && (React.createElement(SelectOption, { key: option.key, value: option, hasCheckbox: true, isSelected: selectedItems[option.value], isFocused: focusedItemIndex !== null && focusedItemIndex === index, id: `select-multi-typeahead-${option.value.replace(' ', '-')}` }, option.value)));
|
|
164
135
|
}, [selectOptions, list, selectedItems, focusedItemIndex]);
|
|
165
136
|
// Update selectOptions when input value changes
|
|
166
137
|
useEffect(() => {
|
|
@@ -185,9 +156,9 @@ export function VersionsFilter({ productInfo }) {
|
|
|
185
156
|
setSelectedItems(selectedVersions);
|
|
186
157
|
}, [productInfo.case_version]);
|
|
187
158
|
const titleId = 'case-list-versions-filter';
|
|
188
|
-
return (React.createElement("div", { className: "version-filter-chip" },
|
|
159
|
+
return (React.createElement(React.Fragment, null, (!isEmpty(versions) || true) && (React.createElement("div", { className: "version-filter-chip" },
|
|
189
160
|
React.createElement("label", { hidden: true, htmlFor: titleId }, t('Open versions dropdown')),
|
|
190
161
|
React.createElement("div", { className: "pf-v6-c-select" },
|
|
191
162
|
React.createElement(Select, { shouldFocusToggleOnSelect: true, shouldPreventScrollOnItemFocus: true, "data-tracking-id": "versions-filter", id: titleId, title: t('Version'), isOpen: isOpen, selected: selectedItems, onSelect: (_e, v) => onSelect(v), onOpenChange: (nextOpen) => setIsOpen(nextOpen), popperProps: { direction: 'down', enableFlip: false }, toggle: toggle, isScrollable: true },
|
|
192
|
-
React.createElement(SelectList, null,
|
|
163
|
+
React.createElement(SelectList, null, dropdownOptions)))))));
|
|
193
164
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseListTable.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-table/CaseListTable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAqB3E,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAQxD,OAAO,KAAkD,MAAM,OAAO,CAAC;AAKvE,OAAO,EAAE,iBAAiB,EAAyB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"CaseListTable.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-table/CaseListTable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAqB3E,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAQxD,OAAO,KAAkD,MAAM,OAAO,CAAC;AAKvE,OAAO,EAAE,iBAAiB,EAAyB,MAAM,0BAA0B,CAAC;AAEpF,OAAO,EAEH,eAAe,EACf,SAAS,EAIZ,MAAM,0BAA0B,CAAC;AA4BlC,UAAU,MAAM;IACZ,QAAQ,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAC3C,UAAU,EAAE,UAAU,EAAE,CAAC;IACzB,kBAAkB,EAAE,QAAQ,CAAC;IAC7B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,cAAc,CAAC,EAAE,eAAe,CAAC;IACjC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AAsBD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,qBA6kB1C"}
|
|
@@ -14,7 +14,6 @@ import React, { useContext, useEffect, useRef, useState } from 'react';
|
|
|
14
14
|
import { Trans, useTranslation } from 'react-i18next';
|
|
15
15
|
import { Link } from 'react-router-dom';
|
|
16
16
|
import { CaseListColumnIds } from '../../../enums/case';
|
|
17
|
-
import { mapSfdcStatusToPortalStatus } from '../../../utils/statusUtils';
|
|
18
17
|
import { CaseListFilterDispatchContext, CaseListFilterStateContext } from '../CaseListFilterContext';
|
|
19
18
|
import { clearFilters, resetFilterToDefaultState, updatePagination, updateSort, } from '../CaseListFilterReducer';
|
|
20
19
|
import SeverityLabel from './SeverityLabel';
|
|
@@ -220,7 +219,9 @@ export function CaseListTable(props) {
|
|
|
220
219
|
if (props.isCaseListPageLoading)
|
|
221
220
|
return 0;
|
|
222
221
|
let paginationCount = (_b = (_a = props.caseList) === null || _a === void 0 ? void 0 : _a.numFound) !== null && _b !== void 0 ? _b : 0;
|
|
223
|
-
|
|
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;
|
|
224
225
|
return paginationCount;
|
|
225
226
|
};
|
|
226
227
|
const onBottomPaginationSetPage = (paginationInfo) => {
|
|
@@ -277,7 +278,7 @@ export function CaseListTable(props) {
|
|
|
277
278
|
? formatDate(row.case_last_public_update_date)
|
|
278
279
|
: '',
|
|
279
280
|
case_severity: row.case_severity ? row.case_severity : '',
|
|
280
|
-
case_status:
|
|
281
|
+
case_status: row.case_status,
|
|
281
282
|
case_createdDate: formatDate(row.case_createdDate),
|
|
282
283
|
case_accountNumber: row.case_accountNumber,
|
|
283
284
|
case_alternate_id: row.case_alternate_id ? row.case_alternate_id : '',
|
|
@@ -349,7 +350,7 @@ export function CaseListTable(props) {
|
|
|
349
350
|
React.createElement(TableColumnSelector, { onColumnSelectorChange: onColumnSelectorChange, cachedColumns: selectedColumns }),
|
|
350
351
|
React.createElement(TableActionsDropdown, { caseList: caseListData, selectedCases: selectedCases, onCasesCloseSuccess: onCasesCloseSuccess, currentFilteredCaseList: props.caseList })),
|
|
351
352
|
React.createElement("span", { className: "toolbar-pagination" },
|
|
352
|
-
React.createElement(TablePagination, { perPage: (_c = props.paginationInfo) === null || _c === void 0 ? void 0 : _c.pageSize, currentPage: (_d = props.paginationInfo) === null || _d === void 0 ? void 0 : _d.currentPage, onPerPageSelect: onPerPageSelect, onSetPage: onSetPage, variant: PaginationVariant.top, itemCount: getItemCount()
|
|
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() }))),
|
|
353
354
|
React.createElement("div", { className: "pf-v6-c-scroll-inner-wrapper" },
|
|
354
355
|
React.createElement(Table, { variant: TableVariant.compact, "aria-label": "case-list", className: "case-list-table" },
|
|
355
356
|
React.createElement(Thead, null,
|
|
@@ -402,5 +403,5 @@ export function CaseListTable(props) {
|
|
|
402
403
|
React.createElement(Td, { className: !isColumnVisible('closedDate') ? Visibility.hidden : '', "data-label": "Closed date" }, row.case_closedDate ? formatDate(row.case_closedDate) : ''),
|
|
403
404
|
React.createElement(Td, { className: !isColumnVisible('folderName') ? Visibility.hidden : '', "data-label": "Group" }, row.case_folderName ? row.case_folderName : ''))))))),
|
|
404
405
|
React.createElement("footer", { className: "toolbar-pagination", "data-tracking-id": "case-list-table-pagination" },
|
|
405
|
-
React.createElement(TablePagination, { perPage: (_e = props === null || props === void 0 ? void 0 : props.paginationInfo) === null || _e === void 0 ? void 0 : _e.pageSize, currentPage: (_f = props === null || props === void 0 ? void 0 : props.paginationInfo) === null || _f === void 0 ? void 0 : _f.currentPage, onPerPageSelect: onPerPageSelect, onSetPage: onBottomPaginationSetPage, variant: PaginationVariant.bottom, itemCount: getItemCount()
|
|
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() })))));
|
|
406
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;
|
|
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 {
|
|
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';
|
|
15
|
+
import { ToastNotification, useFetch } from '@rh-support/components';
|
|
16
16
|
import { downloadCSV, formatDateTime, toNewCaseTypeSwitcher } from '@rh-support/utils';
|
|
17
17
|
import { isEmpty } from 'lodash';
|
|
18
18
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
19
19
|
import { useTranslation } from 'react-i18next';
|
|
20
|
-
import { SolrKeys } from '../../../enums/filters';
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
const
|
|
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,12 +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
|
|
35
|
-
const [isFetching, setIsFetching] = useState(false);
|
|
42
|
+
const { isFetching, request } = useFetch(getCaseListFromSolr, { propgateErrors: true });
|
|
36
43
|
const [downloadCSVFileName, setDownloadCSVFileName] = useState('CaseList.csv');
|
|
44
|
+
const [isFetchingSFDC, setIsFetchingSFDC] = useState(false);
|
|
37
45
|
const [checkboxes, setCheckboxes] = useState({
|
|
38
46
|
selectAll: false,
|
|
39
47
|
ownerName: false,
|
|
@@ -49,87 +57,87 @@ export default function DownloadCSVFileModal(props) {
|
|
|
49
57
|
group: false,
|
|
50
58
|
});
|
|
51
59
|
const [isSaveClicked, setIsSavedClicked] = useState(false);
|
|
52
|
-
function getKey(key) {
|
|
53
|
-
return SolrKeys[key];
|
|
60
|
+
function getKey(key, isSecureSupport) {
|
|
61
|
+
return isSecureSupport ? SFDCKeys[key] : SolrKeys[key];
|
|
54
62
|
}
|
|
63
|
+
const isSecureSupportUser = loggedInUsersAccount.data.secureSupport;
|
|
55
64
|
const headerDefinitions = useMemo(() => [
|
|
56
65
|
{
|
|
57
66
|
checkbox: checkboxes.ownerName,
|
|
58
|
-
key: getKey('ownerName'),
|
|
67
|
+
key: getKey('ownerName', isSecureSupportUser),
|
|
59
68
|
label: 'Owner name',
|
|
60
69
|
},
|
|
61
70
|
{
|
|
62
71
|
checkbox: checkboxes.severity,
|
|
63
|
-
key: getKey('severity'),
|
|
72
|
+
key: getKey('severity', isSecureSupportUser),
|
|
64
73
|
label: 'Severity',
|
|
65
74
|
},
|
|
66
75
|
{
|
|
67
76
|
checkbox: checkboxes.createdBy,
|
|
68
|
-
key: getKey('createdBy'),
|
|
77
|
+
key: getKey('createdBy', isSecureSupportUser),
|
|
69
78
|
label: 'Created by',
|
|
70
79
|
},
|
|
71
80
|
{
|
|
72
81
|
checkbox: checkboxes.createdBy,
|
|
73
|
-
key: getKey('createdDate'),
|
|
82
|
+
key: getKey('createdDate', isSecureSupportUser),
|
|
74
83
|
label: 'Created date',
|
|
75
84
|
transform: formatDateTime,
|
|
76
85
|
},
|
|
77
86
|
{
|
|
78
87
|
checkbox: checkboxes.accountNumber,
|
|
79
|
-
key: getKey('accountNumber'),
|
|
88
|
+
key: getKey('accountNumber', isSecureSupportUser),
|
|
80
89
|
label: 'Account number',
|
|
81
90
|
},
|
|
82
91
|
{
|
|
83
92
|
checkbox: checkboxes.type,
|
|
84
|
-
key: getKey('type'),
|
|
93
|
+
key: getKey(isSecureSupportUser ? 'caseType' : 'type', isSecureSupportUser),
|
|
85
94
|
label: 'Support type',
|
|
86
95
|
},
|
|
87
96
|
{
|
|
88
97
|
checkbox: checkboxes.modifiedBy,
|
|
89
|
-
key: getKey('modifiedBy'),
|
|
98
|
+
key: getKey('modifiedBy', isSecureSupportUser),
|
|
90
99
|
label: 'Modified by',
|
|
91
100
|
},
|
|
92
101
|
{
|
|
93
102
|
checkbox: checkboxes.modifiedBy,
|
|
94
|
-
key: getKey('modifiedDate'),
|
|
103
|
+
key: getKey('modifiedDate', isSecureSupportUser),
|
|
95
104
|
label: 'Modified date',
|
|
96
105
|
transform: formatDateTime,
|
|
97
106
|
},
|
|
98
107
|
{
|
|
99
108
|
checkbox: checkboxes.status,
|
|
100
|
-
key: getKey('status'),
|
|
109
|
+
key: getKey('status', isSecureSupportUser),
|
|
101
110
|
label: 'Status',
|
|
102
|
-
transform: mapSfdcStatusToPortalStatus,
|
|
103
111
|
},
|
|
104
112
|
{
|
|
105
113
|
checkbox: checkboxes.productVersion,
|
|
106
|
-
key: getKey('product'),
|
|
114
|
+
key: getKey('product', isSecureSupportUser),
|
|
107
115
|
label: 'Product',
|
|
108
116
|
},
|
|
109
117
|
{
|
|
110
118
|
checkbox: checkboxes.productVersion,
|
|
111
|
-
key: getKey('version'),
|
|
119
|
+
key: getKey('version', isSecureSupportUser),
|
|
112
120
|
label: 'Version',
|
|
113
121
|
},
|
|
114
122
|
{
|
|
115
123
|
checkbox: checkboxes.alternateId,
|
|
116
|
-
key: getKey('alternateId'),
|
|
124
|
+
key: getKey('alternateId', isSecureSupportUser),
|
|
117
125
|
label: 'Alternate ID',
|
|
118
126
|
},
|
|
119
127
|
{
|
|
120
128
|
checkbox: checkboxes.caseClosedDate,
|
|
121
|
-
key: getKey('caseClosedDate'),
|
|
129
|
+
key: getKey('caseClosedDate', isSecureSupportUser),
|
|
122
130
|
label: 'Closed date',
|
|
123
131
|
transform: formatDateTime,
|
|
124
132
|
},
|
|
125
133
|
{
|
|
126
134
|
checkbox: checkboxes.group,
|
|
127
|
-
key: getKey('groupName'),
|
|
135
|
+
key: getKey('groupName', isSecureSupportUser),
|
|
128
136
|
label: 'Group',
|
|
129
137
|
},
|
|
130
|
-
], [checkboxes]);
|
|
138
|
+
], [checkboxes, isSecureSupportUser]);
|
|
131
139
|
const getHeaders = () => {
|
|
132
|
-
const updatedCsvHeaders =
|
|
140
|
+
const updatedCsvHeaders = isSecureSupportUser ? csvHeadersSFDC : csvHeadersSolr;
|
|
133
141
|
headerDefinitions.forEach((headerDefinition) => {
|
|
134
142
|
const { checkbox, key, label, transform } = headerDefinition;
|
|
135
143
|
const index = updatedCsvHeaders.findIndex((header) => header.key === key);
|
|
@@ -146,8 +154,9 @@ export default function DownloadCSVFileModal(props) {
|
|
|
146
154
|
});
|
|
147
155
|
return updatedCsvHeaders;
|
|
148
156
|
};
|
|
149
|
-
const isFetchingCSVData = isFetching;
|
|
150
|
-
const
|
|
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
|
|
151
160
|
const onCancel = () => {
|
|
152
161
|
onClose && onClose();
|
|
153
162
|
setIsSavedClicked(false);
|
|
@@ -164,16 +173,15 @@ export default function DownloadCSVFileModal(props) {
|
|
|
164
173
|
};
|
|
165
174
|
const checkboxValues = Object.values(checkboxes).slice(1); // as we don't want selectAll value
|
|
166
175
|
const allCheckBoxNotSelected = checkboxValues.includes(false);
|
|
176
|
+
// For SOLR
|
|
167
177
|
const onExportCSVClick = () => __awaiter(this, void 0, void 0, function* () {
|
|
168
178
|
try {
|
|
169
179
|
setIsSavedClicked(true);
|
|
170
180
|
if (!isEmpty(splitExtensionName)) {
|
|
171
|
-
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
const
|
|
175
|
-
setIsFetching(false);
|
|
176
|
-
const updatedCsvData = result.caseListResponse.response.docs.map((row) => (Object.assign(Object.assign({}, row), { case_type: toNewCaseTypeSwitcher(row.case_type), case_link: `https://${window.location.host}${window.location.pathname}/#/case/${row.case_number}` })));
|
|
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}` })));
|
|
177
185
|
downloadCSV(updatedCsvData, getHeaders(), splitExtensionName ? `${splitExtensionName}.csv` : 'CaseList.csv');
|
|
178
186
|
onCancel();
|
|
179
187
|
ToastNotification.addSuccessMessage(t('File downloaded successfully!'));
|
|
@@ -181,11 +189,33 @@ export default function DownloadCSVFileModal(props) {
|
|
|
181
189
|
}
|
|
182
190
|
}
|
|
183
191
|
catch (e) {
|
|
184
|
-
setIsFetching(false);
|
|
185
192
|
onCancel();
|
|
186
193
|
ToastNotification.addDangerMessage(t('File could not be downloaded. Please try again! '));
|
|
187
194
|
}
|
|
188
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
|
+
});
|
|
189
219
|
const handleSelectAll = () => {
|
|
190
220
|
const newSelectAllState = !checkboxes.selectAll;
|
|
191
221
|
const updatedCheckboxes = {
|
|
@@ -264,6 +294,6 @@ export default function DownloadCSVFileModal(props) {
|
|
|
264
294
|
React.createElement("p", null, downloadCSVModalDescription(selectedCases.length || filteredCaseCount)),
|
|
265
295
|
downloadCSVModalBody()),
|
|
266
296
|
React.createElement(ModalFooter, null,
|
|
267
|
-
React.createElement(Button, { key: "submit", icon: isFetchingCSVData ? React.createElement(Spinner, { size: "md", "aria-label": "loading" }) : React.createElement(DownloadIcon, null), variant: "primary", "data-tracking-id": "download-csv-modal-submit", onClick: onExportCSVClick, isDisabled: (isSaveClicked && isEmpty(splitExtensionName)) || isDisabled || isFetchingCSVData }, t('Download')),
|
|
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')),
|
|
268
298
|
React.createElement(Button, { key: "back", variant: "secondary", onClick: onCancel, isDisabled: isDisabled || isFetchingCSVData, "data-tracking-id": "download-csv-modal-cancel" }, t('Cancel')))));
|
|
269
299
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExportCaseListCSV.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-table/ExportCaseListCSV.tsx"],"names":[],"mappings":"
|
|
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
|
|
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, "
|
|
31
|
-
|
|
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
|
}
|
|
@@ -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,
|
|
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,
|
|
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,KAAuD,MAAM,OAAO,CAAC;AAkB5E,UAAU,MAAM;IACZ,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACnC;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,
|
|
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"}
|