@rh-support/cases 2.6.233 → 2.6.236
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/NewCaseButton.js +1 -1
- 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 +137 -374
- package/lib/esm/components/case-list/CaseListContext.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListContext.js +2 -5
- package/lib/esm/components/case-list/CaseListFilterContext.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListFilterContext.js +1 -2
- package/lib/esm/components/case-list/CaseListFilterHelpers.d.ts +2 -3
- package/lib/esm/components/case-list/CaseListFilterHelpers.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListFilterHelpers.js +6 -19
- package/lib/esm/components/case-list/CaseListFilterReducer.d.ts +4 -36
- package/lib/esm/components/case-list/CaseListFilterReducer.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListFilterReducer.js +12 -6
- package/lib/esm/components/case-list/CaseListReducer.d.ts +10 -22
- package/lib/esm/components/case-list/CaseListReducer.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListReducer.js +7 -25
- 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 +4 -20
- 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 +16 -12
- 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 +13 -14
- package/lib/esm/components/case-list/case-list-filters/CreatorSsoNameFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/CreatorSsoNameFilter.js +14 -21
- package/lib/esm/components/case-list/case-list-filters/CreatorSsoNameFilterChip.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/CreatorSsoNameFilterChip.js +0 -3
- package/lib/esm/components/case-list/case-list-filters/GroupsFilter.d.ts +1 -11
- package/lib/esm/components/case-list/case-list-filters/GroupsFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/GroupsFilter.js +70 -90
- 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 +49 -23
- 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 +59 -60
- package/lib/esm/components/case-list/case-list-table/CaseListTable.d.ts +3 -10
- 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 +84 -98
- 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 +70 -51
- 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-list-table/table-column-selector/TableColumnSelector.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-table/table-column-selector/TableColumnSelector.js +0 -1
- package/lib/esm/components/case-list/case-search/BookmarkedSearchesSelector.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-search/BookmarkedSearchesSelector.js +2 -15
- package/lib/esm/components/case-list/case-search/CaseSearch.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-search/CaseSearch.js +24 -55
- 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/css/caseList.css +23 -188
- package/lib/esm/css/caseSearch.css +0 -114
- package/lib/esm/enums/case.d.ts +5 -13
- package/lib/esm/enums/case.d.ts.map +1 -1
- package/lib/esm/enums/case.js +3 -23
- package/lib/esm/enums/caseSearch.d.ts +0 -3
- package/lib/esm/enums/caseSearch.d.ts.map +1 -1
- package/lib/esm/enums/caseSearch.js +1 -2
- package/lib/esm/enums/filters.d.ts +1 -5
- package/lib/esm/enums/filters.d.ts.map +1 -1
- package/lib/esm/enums/filters.js +0 -4
- package/lib/esm/hooks/useCloseCase.d.ts.map +1 -1
- package/lib/esm/hooks/useCloseCase.js +21 -38
- package/lib/esm/hooks/useExportCaseListCSV.d.ts.map +1 -1
- package/lib/esm/hooks/useExportCaseListCSV.js +9 -1
- package/lib/esm/hooks/useFilterStateOnLoad.d.ts +1 -1
- package/lib/esm/hooks/useFilterStateOnLoad.d.ts.map +1 -1
- package/lib/esm/hooks/useFilterStateOnLoad.js +5 -7
- package/lib/esm/index.js +0 -1
- package/lib/esm/models/caseList.d.ts +0 -1
- package/lib/esm/models/caseList.d.ts.map +1 -1
- package/lib/esm/test-utils/mockData.d.ts +0 -1
- package/lib/esm/test-utils/mockData.d.ts.map +1 -1
- package/lib/esm/test-utils/mockData.js +1 -2
- package/lib/esm/utils/caseSearchUtils.d.ts.map +1 -1
- package/lib/esm/utils/caseSearchUtils.js +2 -39
- package/lib/esm/utils/constants.d.ts +1 -5
- package/lib/esm/utils/constants.d.ts.map +1 -1
- package/lib/esm/utils/constants.js +2 -10
- package/lib/esm/utils/mockSolrResponse.js +1 -1
- package/package.json +8 -10
- package/lib/esm/components/case-list/case-list-filters/CaseLabelsFilter.d.ts +0 -3
- package/lib/esm/components/case-list/case-list-filters/CaseLabelsFilter.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-list-filters/CaseLabelsFilter.js +0 -178
- package/lib/esm/components/case-list/case-list-table/ArchivedCaseLabel.d.ts +0 -3
- package/lib/esm/components/case-list/case-list-table/ArchivedCaseLabel.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-list-table/ArchivedCaseLabel.js +0 -8
- package/lib/esm/components/case-list/case-list-table/CaseListLabelGroup.d.ts +0 -9
- package/lib/esm/components/case-list/case-list-table/CaseListLabelGroup.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-list-table/CaseListLabelGroup.js +0 -105
- package/lib/esm/components/case-list/case-list-table/CaseListTableRow.d.ts +0 -33
- package/lib/esm/components/case-list/case-list-table/CaseListTableRow.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-list-table/CaseListTableRow.js +0 -51
- package/lib/esm/components/case-list/case-list-table/CaseListTableSkeletonRow.d.ts +0 -9
- package/lib/esm/components/case-list/case-list-table/CaseListTableSkeletonRow.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-list-table/CaseListTableSkeletonRow.js +0 -10
- package/lib/esm/components/case-list/case-search/AdvanceSearchToggleButton.d.ts +0 -8
- package/lib/esm/components/case-list/case-search/AdvanceSearchToggleButton.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/AdvanceSearchToggleButton.js +0 -8
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAccountSection.d.ts +0 -10
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAccountSection.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAccountSection.js +0 -29
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAuditsSection.d.ts +0 -10
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAuditsSection.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAuditsSection.js +0 -16
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchCaseSection.d.ts +0 -9
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchCaseSection.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchCaseSection.js +0 -21
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchDateRangeField.d.ts +0 -12
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchDateRangeField.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchDateRangeField.js +0 -31
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchFieldBlock.d.ts +0 -10
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchFieldBlock.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchFieldBlock.js +0 -10
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchModal.d.ts +0 -10
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchModal.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchModal.js +0 -92
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchOwnerSection.d.ts +0 -9
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchOwnerSection.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchOwnerSection.js +0 -20
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchProductSection.d.ts +0 -9
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchProductSection.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchProductSection.js +0 -28
- package/lib/esm/components/case-list/case-search/advance-search-modal/ProductVersionDrilldownSelect.d.ts +0 -9
- package/lib/esm/components/case-list/case-search/advance-search-modal/ProductVersionDrilldownSelect.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/advance-search-modal/ProductVersionDrilldownSelect.js +0 -241
- package/lib/esm/components/case-list/case-search/advance-search-modal/SelectableLabelFilter.d.ts +0 -11
- package/lib/esm/components/case-list/case-search/advance-search-modal/SelectableLabelFilter.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/advance-search-modal/SelectableLabelFilter.js +0 -23
- package/lib/esm/hooks/useCaseLabels.d.ts +0 -14
- package/lib/esm/hooks/useCaseLabels.d.ts.map +0 -1
- package/lib/esm/hooks/useCaseLabels.js +0 -50
- package/lib/esm/utils/advanceSearchFormMapper.d.ts +0 -11
- package/lib/esm/utils/advanceSearchFormMapper.d.ts.map +0 -1
- package/lib/esm/utils/advanceSearchFormMapper.js +0 -71
- package/lib/esm/utils/advanceSearchUtils.d.ts +0 -24
- package/lib/esm/utils/advanceSearchUtils.d.ts.map +0 -1
- package/lib/esm/utils/advanceSearchUtils.js +0 -150
- package/lib/esm/utils/caseGroupDefaultFilterUtils.d.ts +0 -12
- package/lib/esm/utils/caseGroupDefaultFilterUtils.d.ts.map +0 -1
- package/lib/esm/utils/caseGroupDefaultFilterUtils.js +0 -34
- package/lib/esm/utils/caseGroupDefaultUtils.d.ts +0 -10
- package/lib/esm/utils/caseGroupDefaultUtils.d.ts.map +0 -1
- package/lib/esm/utils/caseGroupDefaultUtils.js +0 -20
- package/lib/esm/utils/caseListGraphQLUtils.d.ts +0 -28
- package/lib/esm/utils/caseListGraphQLUtils.d.ts.map +0 -1
- package/lib/esm/utils/caseListGraphQLUtils.js +0 -304
- 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 -47
- package/lib/esm/utils/caseListVariablesBuilder.d.ts +0 -17
- package/lib/esm/utils/caseListVariablesBuilder.d.ts.map +0 -1
- package/lib/esm/utils/caseListVariablesBuilder.js +0 -535
|
@@ -3,23 +3,16 @@ import { ISolrResponse } from '@rh-support/types/shared';
|
|
|
3
3
|
import { UserAuth } from '@rh-support/user-permissions';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { ICaseListResponse } from '../../../models/caseList';
|
|
6
|
-
import { ISortInfo } from '../CaseListFilterReducer';
|
|
6
|
+
import { IPaginationInfo, ISortInfo } from '../CaseListFilterReducer';
|
|
7
7
|
interface IProps {
|
|
8
8
|
caseList: ISolrResponse<ICaseListResponse>;
|
|
9
9
|
caseGroups: ICaseGroup[];
|
|
10
10
|
loggedInUserRights: UserAuth;
|
|
11
11
|
sortInfo?: ISortInfo;
|
|
12
|
+
paginationInfo?: IPaginationInfo;
|
|
12
13
|
isCaseListPageLoading: boolean;
|
|
13
14
|
hasError: boolean;
|
|
14
|
-
|
|
15
|
-
isLoadingMore: boolean;
|
|
16
|
-
loadMoreError: boolean;
|
|
17
|
-
loadMoreRetryCount: number;
|
|
18
|
-
onRetryLoadMore: () => void;
|
|
19
|
-
onRetryFetch?: () => void;
|
|
20
|
-
caseLabelsFetchError?: Error | null;
|
|
21
|
-
onCasesCloseSuccess?: () => void;
|
|
22
|
-
sentinelRef?: (node?: Element | null) => void;
|
|
15
|
+
isSolrDown?: boolean;
|
|
23
16
|
}
|
|
24
17
|
export declare function CaseListTable(props: IProps): React.JSX.Element;
|
|
25
18
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseListTable.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-table/CaseListTable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;
|
|
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"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
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 {
|
|
4
|
+
import { TableComponent, TablePagination } from '@rh-support/components';
|
|
5
5
|
import { GlobalMetadataDispatchContext, updateUserPreferences, useGlobalStateContext, UserPreferencesKeys, } from '@rh-support/react-context';
|
|
6
|
-
import { formatDate,
|
|
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';
|
|
@@ -12,11 +12,11 @@ import isEqual from 'lodash/isEqual';
|
|
|
12
12
|
import isUndefined from 'lodash/isUndefined';
|
|
13
13
|
import React, { useContext, useEffect, useRef, useState } from 'react';
|
|
14
14
|
import { Trans, useTranslation } from 'react-i18next';
|
|
15
|
+
import { Link } from 'react-router-dom';
|
|
15
16
|
import { CaseListColumnIds } from '../../../enums/case';
|
|
16
17
|
import { CaseListFilterDispatchContext, CaseListFilterStateContext } from '../CaseListFilterContext';
|
|
17
|
-
import { clearFilters, updateSort } from '../CaseListFilterReducer';
|
|
18
|
-
import
|
|
19
|
-
import { CaseListTableSkeletonRow } from './CaseListTableSkeletonRow';
|
|
18
|
+
import { clearFilters, resetFilterToDefaultState, updatePagination, updateSort, } from '../CaseListFilterReducer';
|
|
19
|
+
import SeverityLabel from './SeverityLabel';
|
|
20
20
|
import { TableColumnSelector } from './table-column-selector/TableColumnSelector';
|
|
21
21
|
import { TableActionsDropdown } from './TableActionsDropdown';
|
|
22
22
|
// initially selected columns
|
|
@@ -27,7 +27,6 @@ const initialSelectedColumns = [
|
|
|
27
27
|
CaseListColumnIds.owner,
|
|
28
28
|
CaseListColumnIds.modified,
|
|
29
29
|
CaseListColumnIds.status,
|
|
30
|
-
CaseListColumnIds.caseLabel,
|
|
31
30
|
];
|
|
32
31
|
const EMPTY_STATE_FILTER_APPLIED = 'Try removing filters or modifying your search query to broaden the results.';
|
|
33
32
|
const EMPTY_STATE_NO_FILTERS = 'The table will be populated after creating your first support case.';
|
|
@@ -37,11 +36,10 @@ const EMPTY_STATE_NO_FILTERS_ERROR = (React.createElement(React.Fragment, null,
|
|
|
37
36
|
React.createElement("a", { href: "https://status.redhat.com/", target: "_blank", rel: "noopener noreferrer" }, "status page"),
|
|
38
37
|
"to see if there are any known issues"));
|
|
39
38
|
export function CaseListTable(props) {
|
|
40
|
-
var _a, _b;
|
|
39
|
+
var _a, _b, _c, _d, _e, _f;
|
|
41
40
|
const [selectedColumns, setSelectedColumns] = useState([]);
|
|
42
41
|
const { t } = useTranslation();
|
|
43
42
|
const [selectedCases, setSelectedCases] = useState([]);
|
|
44
|
-
const [isCaseLabelErrorModalDismissed, setIsCaseLabelErrorModalDismissed] = useState(false);
|
|
45
43
|
const caseListData = props.isCaseListPageLoading ? [] : (_b = (_a = props.caseList) === null || _a === void 0 ? void 0 : _a.docs) !== null && _b !== void 0 ? _b : [];
|
|
46
44
|
const isColumnVisible = (columnId) => {
|
|
47
45
|
return includes(selectedColumns, columnId);
|
|
@@ -51,10 +49,10 @@ export function CaseListTable(props) {
|
|
|
51
49
|
const [activeSortIndex, setActiveSortIndex] = useState();
|
|
52
50
|
const [activeSortDirection, setActiveSortDirection] = useState();
|
|
53
51
|
const [sortedCaseListData, setSortedCaseListData] = useState(caseListData);
|
|
54
|
-
const { globalMetadataState: { hydraUserPreferences, loggedInUserRights }, } = useGlobalStateContext();
|
|
52
|
+
const { globalMetadataState: { navBarRef, hydraUserPreferences, loggedInUserRights }, } = useGlobalStateContext();
|
|
55
53
|
const dispatch = useContext(CaseListFilterDispatchContext);
|
|
56
54
|
const dispatchToGlobalMetadataReducer = useContext(GlobalMetadataDispatchContext);
|
|
57
|
-
const { filterInfo, filterQueryInfo
|
|
55
|
+
const { filterInfo, filterQueryInfo } = useContext(CaseListFilterStateContext);
|
|
58
56
|
const currentFilterLength = flatMap(filterInfo).length;
|
|
59
57
|
const showingFilter = currentFilterLength > 0;
|
|
60
58
|
const hasSearchQuery = !((filterQueryInfo === null || filterQueryInfo === void 0 ? void 0 : filterQueryInfo.queryString) === '');
|
|
@@ -137,11 +135,6 @@ export function CaseListTable(props) {
|
|
|
137
135
|
sortable: true,
|
|
138
136
|
show: isColumnVisible(CaseListColumnIds.group),
|
|
139
137
|
},
|
|
140
|
-
{
|
|
141
|
-
id: CaseListColumnIds.caseLabel,
|
|
142
|
-
title: t('Case labels'),
|
|
143
|
-
show: isColumnVisible(CaseListColumnIds.caseLabel),
|
|
144
|
-
},
|
|
145
138
|
];
|
|
146
139
|
const visibleCaseListColumns = columns.filter((column) => visibleColumns.includes(column.id));
|
|
147
140
|
const allRows = caseListData.map((row, index) => row.case_number);
|
|
@@ -162,6 +155,12 @@ export function CaseListTable(props) {
|
|
|
162
155
|
console.error('Could not save selected columns in cache');
|
|
163
156
|
}
|
|
164
157
|
};
|
|
158
|
+
const onPerPageSelect = (paginationInfo) => {
|
|
159
|
+
updatePagination(dispatch, paginationInfo);
|
|
160
|
+
};
|
|
161
|
+
const onSetPage = (paginationInfo) => {
|
|
162
|
+
updatePagination(dispatch, paginationInfo);
|
|
163
|
+
};
|
|
165
164
|
const onRowClick = (ev, row) => {
|
|
166
165
|
// we dont want to call onRowClick if user changes the checkbox value
|
|
167
166
|
if (ev.target.tagName === 'INPUT') {
|
|
@@ -213,18 +212,22 @@ export function CaseListTable(props) {
|
|
|
213
212
|
React.createElement(EmptyState, { variant: EmptyStateVariant.sm },
|
|
214
213
|
React.createElement(Spinner, { size: "xl" }))))));
|
|
215
214
|
const onCasesCloseSuccess = () => {
|
|
216
|
-
|
|
215
|
+
resetFilterToDefaultState(dispatch);
|
|
217
216
|
};
|
|
218
217
|
const getItemCount = () => {
|
|
219
218
|
var _a, _b;
|
|
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
|
-
//
|
|
224
|
-
//
|
|
225
|
-
paginationCount = 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;
|
|
226
225
|
return paginationCount;
|
|
227
226
|
};
|
|
227
|
+
const onBottomPaginationSetPage = (paginationInfo) => {
|
|
228
|
+
onSetPage(paginationInfo);
|
|
229
|
+
scrollIntoView(tableToolbarRef, { navBarRef, timeout: 0, onlyIfNotInViewport: true, offset: 30 });
|
|
230
|
+
};
|
|
228
231
|
const getSortableRowValues = (row) => {
|
|
229
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;
|
|
230
233
|
return [
|
|
@@ -267,32 +270,28 @@ export function CaseListTable(props) {
|
|
|
267
270
|
return (group === null || group === void 0 ? void 0 : group.name) || '';
|
|
268
271
|
};
|
|
269
272
|
const localRows = [
|
|
270
|
-
...caseListData === null || caseListData === void 0 ? void 0 : caseListData.map((row, index) => {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
case_customer_escalation: row.case_customer_escalation,
|
|
293
|
-
case_label: (_a = row.case_label) !== null && _a !== void 0 ? _a : [],
|
|
294
|
-
});
|
|
295
|
-
}),
|
|
273
|
+
...caseListData === null || caseListData === void 0 ? void 0 : caseListData.map((row, index) => ({
|
|
274
|
+
case_number: row.case_number,
|
|
275
|
+
case_summary: row.case_summary,
|
|
276
|
+
case_createdByName: row.case_createdByName,
|
|
277
|
+
case_lastModifiedDate: formatDate(row.case_last_public_update_date)
|
|
278
|
+
? formatDate(row.case_last_public_update_date)
|
|
279
|
+
: '',
|
|
280
|
+
case_severity: row.case_severity ? row.case_severity : '',
|
|
281
|
+
case_status: row.case_status,
|
|
282
|
+
case_createdDate: formatDate(row.case_createdDate),
|
|
283
|
+
case_accountNumber: row.case_accountNumber,
|
|
284
|
+
case_alternate_id: row.case_alternate_id ? row.case_alternate_id : '',
|
|
285
|
+
case_type: toNewCaseTypeSwitcher(row.case_type),
|
|
286
|
+
case_closedDate: formatDate(row.case_closedDate) ? formatDate(row.case_closedDate) : '',
|
|
287
|
+
case_folderName: row.case_folderName || getCaseGroupName(row.case_folderNumber) || '',
|
|
288
|
+
case_contactName: row.case_contactName,
|
|
289
|
+
case_lastModifiedByName: row.case_last_public_update_by ? row.case_last_public_update_by : '',
|
|
290
|
+
case_version: row.case_version,
|
|
291
|
+
id: row.id,
|
|
292
|
+
case_product: row.case_product,
|
|
293
|
+
case_customer_escalation: row.case_customer_escalation,
|
|
294
|
+
})),
|
|
296
295
|
];
|
|
297
296
|
useEffect(() => {
|
|
298
297
|
var _a;
|
|
@@ -344,45 +343,14 @@ export function CaseListTable(props) {
|
|
|
344
343
|
setSortedCaseListData(sortedRows);
|
|
345
344
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
346
345
|
}, [activeSortDirection, activeSortIndex]);
|
|
347
|
-
const showCaseLabelColumn = isColumnVisible(CaseListColumnIds.caseLabel);
|
|
348
|
-
const showCaseLabelLoadError = showCaseLabelColumn && Boolean(props.caseLabelsFetchError) && !isCaseLabelErrorModalDismissed;
|
|
349
|
-
const handleRetryCaseLabels = () => {
|
|
350
|
-
var _a;
|
|
351
|
-
setIsCaseLabelErrorModalDismissed(false);
|
|
352
|
-
(_a = props.onRetryFetch) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
353
|
-
};
|
|
354
|
-
const initialLoadingSkeletonRows = Array.from({ length: 5 }).map((_, index) => (React.createElement(CaseListTableSkeletonRow, { key: `initial-skeleton-${index}`, visibleCaseListColumns: visibleCaseListColumns })));
|
|
355
|
-
const loadingTableContent = showCaseLabelColumn ? React.createElement(React.Fragment, null, initialLoadingSkeletonRows) : loadingRowDefault;
|
|
356
|
-
const showSkeletonLoaderRow = props.hasNextPage || props.isLoadingMore || props.loadMoreError;
|
|
357
|
-
const hasNoCaseListData = (caseListData || []).length < 1;
|
|
358
|
-
const renderCaseListRows = () => (React.createElement(React.Fragment, null, sortedCaseListData === null || sortedCaseListData === void 0 ? void 0 :
|
|
359
|
-
sortedCaseListData.map((row, rowIndex) => (React.createElement(CaseListTableRow, { key: row.case_number, row: row, rowIndex: rowIndex, isColumnVisible: isColumnVisible, isSelected: selectedCases.includes(row.case_number), onRowClick: onRowClick, onRowSelect: onRowSelect }))),
|
|
360
|
-
showSkeletonLoaderRow && (React.createElement(CaseListTableSkeletonRow, { visibleCaseListColumns: visibleCaseListColumns, sentinelRef: props.sentinelRef }))));
|
|
361
|
-
const renderTableBodyContent = () => {
|
|
362
|
-
if (!props.isCaseListPageLoading && hasNoCaseListData) {
|
|
363
|
-
return noResultFoundRow;
|
|
364
|
-
}
|
|
365
|
-
if (props.isCaseListPageLoading) {
|
|
366
|
-
return loadingTableContent;
|
|
367
|
-
}
|
|
368
|
-
return renderCaseListRows();
|
|
369
|
-
};
|
|
370
346
|
return (React.createElement(React.Fragment, null,
|
|
371
|
-
React.createElement(CaseLabelLoadErrorModal, { isOpen: showCaseLabelLoadError, onRetry: handleRetryCaseLabels, onClose: () => setIsCaseLabelErrorModalDismissed(true) }),
|
|
372
347
|
React.createElement(TableComponent, { columns: columns, data: caseListData, selectedColumns: selectedColumns },
|
|
373
348
|
React.createElement("div", { className: "case-list-table-toolbar pf-v6-l-flex", ref: tableToolbarRef },
|
|
374
349
|
React.createElement("div", { className: "toolbar-actions pf-v6-l-flex" },
|
|
375
350
|
React.createElement(TableColumnSelector, { onColumnSelectorChange: onColumnSelectorChange, cachedColumns: selectedColumns }),
|
|
376
351
|
React.createElement(TableActionsDropdown, { caseList: caseListData, selectedCases: selectedCases, onCasesCloseSuccess: onCasesCloseSuccess, currentFilteredCaseList: props.caseList })),
|
|
377
|
-
|
|
378
|
-
React.createElement(
|
|
379
|
-
" ",
|
|
380
|
-
React.createElement(Trans, null, "of"),
|
|
381
|
-
' ',
|
|
382
|
-
React.createElement("strong", null,
|
|
383
|
-
getItemCount(),
|
|
384
|
-
" ",
|
|
385
|
-
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() }))),
|
|
386
354
|
React.createElement("div", { className: "pf-v6-c-scroll-inner-wrapper" },
|
|
387
355
|
React.createElement(Table, { variant: TableVariant.compact, "aria-label": "case-list", className: "case-list-table" },
|
|
388
356
|
React.createElement(Thead, null,
|
|
@@ -399,23 +367,41 @@ export function CaseListTable(props) {
|
|
|
399
367
|
? '0px'
|
|
400
368
|
: undefined,
|
|
401
369
|
}, id: column.id, sort: column.sortable ? onSort(index) : undefined, key: column.id }, column.title))))),
|
|
402
|
-
React.createElement(Tbody, null,
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
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() })))));
|
|
421
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';
|
|
16
|
-
import {
|
|
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, {
|
|
18
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
20
19
|
import { useTranslation } from 'react-i18next';
|
|
21
|
-
import { SolrKeys } from '../../../enums/filters';
|
|
22
|
-
import {
|
|
23
|
-
|
|
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
|
|
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,
|
|
@@ -49,96 +55,89 @@ export default function DownloadCSVFileModal(props) {
|
|
|
49
55
|
type: false,
|
|
50
56
|
caseClosedDate: false,
|
|
51
57
|
group: false,
|
|
52
|
-
caseLabel: false,
|
|
53
58
|
});
|
|
54
59
|
const [isSaveClicked, setIsSavedClicked] = useState(false);
|
|
55
|
-
function getKey(key) {
|
|
56
|
-
return SolrKeys[key];
|
|
60
|
+
function getKey(key, isSecureSupport) {
|
|
61
|
+
return isSecureSupport ? SFDCKeys[key] : SolrKeys[key];
|
|
57
62
|
}
|
|
63
|
+
const isSecureSupportUser = loggedInUsersAccount.data.secureSupport;
|
|
58
64
|
const headerDefinitions = useMemo(() => [
|
|
59
65
|
{
|
|
60
66
|
checkbox: checkboxes.ownerName,
|
|
61
|
-
key: getKey('ownerName'),
|
|
67
|
+
key: getKey('ownerName', isSecureSupportUser),
|
|
62
68
|
label: 'Owner name',
|
|
63
69
|
},
|
|
64
70
|
{
|
|
65
71
|
checkbox: checkboxes.severity,
|
|
66
|
-
key: getKey('severity'),
|
|
72
|
+
key: getKey('severity', isSecureSupportUser),
|
|
67
73
|
label: 'Severity',
|
|
68
74
|
},
|
|
69
75
|
{
|
|
70
76
|
checkbox: checkboxes.createdBy,
|
|
71
|
-
key: getKey('createdBy'),
|
|
77
|
+
key: getKey('createdBy', isSecureSupportUser),
|
|
72
78
|
label: 'Created by',
|
|
73
79
|
},
|
|
74
80
|
{
|
|
75
81
|
checkbox: checkboxes.createdBy,
|
|
76
|
-
key: getKey('createdDate'),
|
|
82
|
+
key: getKey('createdDate', isSecureSupportUser),
|
|
77
83
|
label: 'Created date',
|
|
78
84
|
transform: formatDateTime,
|
|
79
85
|
},
|
|
80
86
|
{
|
|
81
87
|
checkbox: checkboxes.accountNumber,
|
|
82
|
-
key: getKey('accountNumber'),
|
|
88
|
+
key: getKey('accountNumber', isSecureSupportUser),
|
|
83
89
|
label: 'Account number',
|
|
84
90
|
},
|
|
85
91
|
{
|
|
86
92
|
checkbox: checkboxes.type,
|
|
87
|
-
key: getKey('type'),
|
|
93
|
+
key: getKey(isSecureSupportUser ? 'caseType' : 'type', isSecureSupportUser),
|
|
88
94
|
label: 'Support type',
|
|
89
95
|
},
|
|
90
96
|
{
|
|
91
97
|
checkbox: checkboxes.modifiedBy,
|
|
92
|
-
key: getKey('modifiedBy'),
|
|
98
|
+
key: getKey('modifiedBy', isSecureSupportUser),
|
|
93
99
|
label: 'Modified by',
|
|
94
100
|
},
|
|
95
101
|
{
|
|
96
102
|
checkbox: checkboxes.modifiedBy,
|
|
97
|
-
key: getKey('modifiedDate'),
|
|
103
|
+
key: getKey('modifiedDate', isSecureSupportUser),
|
|
98
104
|
label: 'Modified date',
|
|
99
105
|
transform: formatDateTime,
|
|
100
106
|
},
|
|
101
107
|
{
|
|
102
108
|
checkbox: checkboxes.status,
|
|
103
|
-
key: getKey('status'),
|
|
109
|
+
key: getKey('status', isSecureSupportUser),
|
|
104
110
|
label: 'Status',
|
|
105
|
-
transform: mapSfdcStatusToPortalStatus,
|
|
106
111
|
},
|
|
107
112
|
{
|
|
108
113
|
checkbox: checkboxes.productVersion,
|
|
109
|
-
key: getKey('product'),
|
|
114
|
+
key: getKey('product', isSecureSupportUser),
|
|
110
115
|
label: 'Product',
|
|
111
116
|
},
|
|
112
117
|
{
|
|
113
118
|
checkbox: checkboxes.productVersion,
|
|
114
|
-
key: getKey('version'),
|
|
119
|
+
key: getKey('version', isSecureSupportUser),
|
|
115
120
|
label: 'Version',
|
|
116
121
|
},
|
|
117
122
|
{
|
|
118
123
|
checkbox: checkboxes.alternateId,
|
|
119
|
-
key: getKey('alternateId'),
|
|
124
|
+
key: getKey('alternateId', isSecureSupportUser),
|
|
120
125
|
label: 'Alternate ID',
|
|
121
126
|
},
|
|
122
127
|
{
|
|
123
128
|
checkbox: checkboxes.caseClosedDate,
|
|
124
|
-
key: getKey('caseClosedDate'),
|
|
129
|
+
key: getKey('caseClosedDate', isSecureSupportUser),
|
|
125
130
|
label: 'Closed date',
|
|
126
131
|
transform: formatDateTime,
|
|
127
132
|
},
|
|
128
133
|
{
|
|
129
134
|
checkbox: checkboxes.group,
|
|
130
|
-
key: getKey('groupName'),
|
|
135
|
+
key: getKey('groupName', isSecureSupportUser),
|
|
131
136
|
label: 'Group',
|
|
132
137
|
},
|
|
133
|
-
|
|
134
|
-
checkbox: checkboxes.caseLabel,
|
|
135
|
-
key: getKey('caseLabel'),
|
|
136
|
-
label: 'Case labels',
|
|
137
|
-
transform: (labels) => (Array.isArray(labels) ? labels.join(', ') : labels || ''),
|
|
138
|
-
},
|
|
139
|
-
], [checkboxes]);
|
|
138
|
+
], [checkboxes, isSecureSupportUser]);
|
|
140
139
|
const getHeaders = () => {
|
|
141
|
-
const updatedCsvHeaders =
|
|
140
|
+
const updatedCsvHeaders = isSecureSupportUser ? csvHeadersSFDC : csvHeadersSolr;
|
|
142
141
|
headerDefinitions.forEach((headerDefinition) => {
|
|
143
142
|
const { checkbox, key, label, transform } = headerDefinition;
|
|
144
143
|
const index = updatedCsvHeaders.findIndex((header) => header.key === key);
|
|
@@ -155,8 +154,9 @@ export default function DownloadCSVFileModal(props) {
|
|
|
155
154
|
});
|
|
156
155
|
return updatedCsvHeaders;
|
|
157
156
|
};
|
|
158
|
-
const isFetchingCSVData = isFetching;
|
|
159
|
-
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
|
|
160
160
|
const onCancel = () => {
|
|
161
161
|
onClose && onClose();
|
|
162
162
|
setIsSavedClicked(false);
|
|
@@ -173,16 +173,15 @@ export default function DownloadCSVFileModal(props) {
|
|
|
173
173
|
};
|
|
174
174
|
const checkboxValues = Object.values(checkboxes).slice(1); // as we don't want selectAll value
|
|
175
175
|
const allCheckBoxNotSelected = checkboxValues.includes(false);
|
|
176
|
+
// For SOLR
|
|
176
177
|
const onExportCSVClick = () => __awaiter(this, void 0, void 0, function* () {
|
|
177
178
|
try {
|
|
178
179
|
setIsSavedClicked(true);
|
|
179
180
|
if (!isEmpty(splitExtensionName)) {
|
|
180
|
-
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
const
|
|
184
|
-
setIsFetching(false);
|
|
185
|
-
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}` })));
|
|
186
185
|
downloadCSV(updatedCsvData, getHeaders(), splitExtensionName ? `${splitExtensionName}.csv` : 'CaseList.csv');
|
|
187
186
|
onCancel();
|
|
188
187
|
ToastNotification.addSuccessMessage(t('File downloaded successfully!'));
|
|
@@ -190,11 +189,33 @@ export default function DownloadCSVFileModal(props) {
|
|
|
190
189
|
}
|
|
191
190
|
}
|
|
192
191
|
catch (e) {
|
|
193
|
-
setIsFetching(false);
|
|
194
192
|
onCancel();
|
|
195
193
|
ToastNotification.addDangerMessage(t('File could not be downloaded. Please try again! '));
|
|
196
194
|
}
|
|
197
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
|
+
});
|
|
198
219
|
const handleSelectAll = () => {
|
|
199
220
|
const newSelectAllState = !checkboxes.selectAll;
|
|
200
221
|
const updatedCheckboxes = {
|
|
@@ -209,7 +230,6 @@ export default function DownloadCSVFileModal(props) {
|
|
|
209
230
|
type: newSelectAllState,
|
|
210
231
|
caseClosedDate: newSelectAllState,
|
|
211
232
|
group: newSelectAllState,
|
|
212
|
-
caseLabel: newSelectAllState,
|
|
213
233
|
};
|
|
214
234
|
setCheckboxes((prevCheckboxes) => (Object.assign({ selectAll: !prevCheckboxes.selectAll }, updatedCheckboxes)));
|
|
215
235
|
};
|
|
@@ -227,7 +247,6 @@ export default function DownloadCSVFileModal(props) {
|
|
|
227
247
|
{ label: 'Product and version', key: 'productVersion' },
|
|
228
248
|
{ label: 'Personal reference number', key: 'alternateId' },
|
|
229
249
|
{ label: 'Closed date', key: 'caseClosedDate' },
|
|
230
|
-
{ label: 'Case labels', key: 'caseLabel' },
|
|
231
250
|
];
|
|
232
251
|
const generateCheckboxes = (fieldDefinitions) => {
|
|
233
252
|
return fieldDefinitions.map((field) => (React.createElement(Checkbox, { key: field.key, className: "nested", label: t(field.label), isChecked: checkboxes[field.key], onChange: () => {
|
|
@@ -275,6 +294,6 @@ export default function DownloadCSVFileModal(props) {
|
|
|
275
294
|
React.createElement("p", null, downloadCSVModalDescription(selectedCases.length || filteredCaseCount)),
|
|
276
295
|
downloadCSVModalBody()),
|
|
277
296
|
React.createElement(ModalFooter, null,
|
|
278
|
-
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')),
|
|
279
298
|
React.createElement(Button, { key: "back", variant: "secondary", onClick: onCancel, isDisabled: isDisabled || isFetchingCSVData, "data-tracking-id": "download-csv-modal-cancel" }, t('Cancel')))));
|
|
280
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"}
|