@rh-support/cases 2.6.219 → 2.6.227
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +135 -366
- 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 +2 -6
- 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 +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 +59 -60
- package/lib/esm/components/case-list/case-list-table/CaseListTable.d.ts +3 -8
- 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 +55 -88
- 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 +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 +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 +22 -183
- 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 -3
- package/lib/esm/enums/filters.d.ts.map +1 -1
- package/lib/esm/enums/filters.js +0 -2
- 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 -177
- 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-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 -55
- 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 -280
- 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 -44
- package/lib/esm/utils/caseListVariablesBuilder.d.ts +0 -15
- package/lib/esm/utils/caseListVariablesBuilder.d.ts.map +0 -1
- package/lib/esm/utils/caseListVariablesBuilder.js +0 -517
|
@@ -9,272 +9,124 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import '../../css/caseList.css';
|
|
11
11
|
import '../../css/caseSearch.css';
|
|
12
|
-
import { useApolloClient } from '@apollo/client/react';
|
|
13
12
|
import { Alert, AlertActionCloseButton, AlertVariant, Button } from '@patternfly/react-core';
|
|
14
13
|
import OpenDrawerRightIcon from '@patternfly/react-icons/dist/js/icons/open-drawer-right-icon';
|
|
15
|
-
import { ErrorBoundary, ToastNotification, useBreakpoint, useDocumentTitle, useForceUpdate, } from '@rh-support/components';
|
|
14
|
+
import { ErrorBoundary, ToastNotification, useBreakpoint, useDocumentTitle, useForceUpdate, usePrevious, } from '@rh-support/components';
|
|
16
15
|
import { CSSUserModal, fetchAllStatuses, fetchCaseGroupsForAccount, fetchCaseGroupsForSSO, fetchCaseSeverities, fetchCaseTypes, fetchProducts, GlobalMetadataDispatchContext, GlobalMetadataStateContext, setUserPreferences, updateCaseListTraditionalSupportAgreed, updateUserPreferences, useGlobalDispatchContext, UserPreferencesKeys, } from '@rh-support/react-context';
|
|
17
|
-
import { getStringifiedParams, getUrlParsedParams, haventLoadedMetadata, haventLoadedProductsMetadata,
|
|
16
|
+
import { getStringifiedParams, getUrlParsedParams, haventLoadedMetadata, haventLoadedProductsMetadata, solrResponseToFacetFields, solrResponseToPivotFields, } from '@rh-support/utils';
|
|
17
|
+
import get from 'lodash/get';
|
|
18
18
|
import isEmpty from 'lodash/isEmpty';
|
|
19
|
-
import
|
|
19
|
+
import mapValues from 'lodash/mapValues';
|
|
20
20
|
import some from 'lodash/some';
|
|
21
21
|
import React, { useContext, useEffect, useRef, useState } from 'react';
|
|
22
22
|
import { Trans, useTranslation } from 'react-i18next';
|
|
23
|
-
import { useInView } from 'react-intersection-observer';
|
|
24
23
|
import { useLocation } from 'react-router-dom';
|
|
25
24
|
import { CaseSearchQueryType } from '../../enums/caseSearch';
|
|
26
|
-
import {
|
|
25
|
+
import { SolrPivotKeys } from '../../enums/filters';
|
|
27
26
|
import { PageTitle } from '../../enums/pageTitle';
|
|
28
27
|
import { useFilterStateOnLoad } from '../../hooks/useFilterStateOnLoad';
|
|
29
|
-
import {
|
|
30
|
-
import { clearPageCursors, getCaseListFromGraphQL, loadMoreCases, } from '../../utils/caseListGraphQLUtils';
|
|
28
|
+
import { getCaseList } from '../../utils/caseListUtils';
|
|
31
29
|
import { createFilterStateFromUrlQuery, createURLQueryFromFilterState, FILTER_URL_CURRENT_PAGE_SEARCH_PARAM, FILTER_URL_PAGE_SIZE_SEARCH_PARAM, FILTER_URL_QUERY_SEARCH_PARAM, FILTER_URL_QUERY_TYPE, } from '../../utils/caseSearchUtils';
|
|
32
|
-
import { UpdatedCaseDataEvent } from '../../utils/constants';
|
|
33
30
|
import { NewCaseButton } from '../case/NewCaseButton';
|
|
34
31
|
import { CaseListFilterChips } from './case-list-filters/CaseListFilterChips';
|
|
35
32
|
import { CaseListFilters } from './case-list-filters/CaseListFilters';
|
|
36
33
|
import { CaseListTable } from './case-list-table/CaseListTable';
|
|
37
34
|
import { CaseSearch } from './case-search/CaseSearch';
|
|
38
35
|
import { useCaseListDispatchContext, useCaseListStateContext } from './CaseListContext';
|
|
39
|
-
import { CaseListFilterDispatchContext, CaseListFilterStateContext } from './CaseListFilterContext';
|
|
40
|
-
import { isNoFilterApplied, isOnlyDefaultFilterApplied,
|
|
36
|
+
import { CaseListFilterDispatchContext, CaseListFilterStateContext, initialCaseFilterState, } from './CaseListFilterContext';
|
|
37
|
+
import { eligibleSFDCFiltersMultipleValues, isNoFilterApplied, isOnlyDefaultFilterApplied, } from './CaseListFilterHelpers';
|
|
41
38
|
import { updateFilterState } from './CaseListFilterReducer';
|
|
42
|
-
import {
|
|
39
|
+
import { setCaseList, setCurrentQuery, setFilterValuesFromFacetResponse, setIsFetching, setPivotValues, } from './CaseListReducer';
|
|
43
40
|
export function CaseList(props) {
|
|
44
|
-
var _a, _b
|
|
41
|
+
var _a, _b;
|
|
45
42
|
const { t } = useTranslation();
|
|
46
43
|
useDocumentTitle(PageTitle.CASE_LIST);
|
|
47
44
|
const dispatchToGlobalMetadataReducer = useContext(GlobalMetadataDispatchContext);
|
|
48
|
-
const { caseList,
|
|
45
|
+
const { caseList, pivotValues, isFetching, filterValuesFromFacetResponse, currentQuery } = useCaseListStateContext();
|
|
49
46
|
const CaseListDispatch = useCaseListDispatchContext();
|
|
50
47
|
const breakPoint = useBreakpoint();
|
|
51
|
-
const { globalMetadataState, globalMetadataState: { caseGroups,
|
|
48
|
+
const { globalMetadataState, globalMetadataState: { caseGroups, loggedInUserJwtToken, loggedInUserRights, loggedInUsersAccount, userPreferences, managedAccounts, bookmarkedAccounts, allCaseTypes, allCaseSeverities, allCaseStatuses, allProducts, caseListTraditionalSupportAgreed, }, } = useContext(GlobalMetadataStateContext);
|
|
52
49
|
const globalDispatchContext = useGlobalDispatchContext();
|
|
53
|
-
const apolloClient = useApolloClient();
|
|
54
|
-
const includeSecureSupportCases = Boolean(loggedInUsersAccount.data.secureSupport);
|
|
55
50
|
const location = useLocation();
|
|
56
51
|
const searchParams = getUrlParsedParams(location.search);
|
|
57
52
|
const queryFromUrl = searchParams[FILTER_URL_QUERY_SEARCH_PARAM];
|
|
53
|
+
const pageSizeFromUrl = parseInt(searchParams[FILTER_URL_PAGE_SIZE_SEARCH_PARAM]);
|
|
54
|
+
const currentPageFromUrl = parseInt(searchParams[FILTER_URL_CURRENT_PAGE_SEARCH_PARAM]);
|
|
58
55
|
const searchType = searchParams[FILTER_URL_QUERY_TYPE];
|
|
59
56
|
const abortControllerRef = useRef(undefined);
|
|
60
|
-
const lastPushedQueryRef = useRef('');
|
|
61
57
|
const isXLScreen = breakPoint.xl;
|
|
62
58
|
const isFirstMount = useRef(true);
|
|
63
|
-
const userDismissedDefaultGroupRef = useRef(false);
|
|
64
|
-
const prevGroupFilterRef = useRef(undefined);
|
|
65
59
|
const filterSectionRef = useRef(null);
|
|
66
60
|
const filterState = useContext(CaseListFilterStateContext);
|
|
67
61
|
const filterDispatch = useContext(CaseListFilterDispatchContext);
|
|
68
62
|
const forceUpdate = useForceUpdate();
|
|
69
63
|
const isCaseListFilterPanelExanded = userPreferences.data.isCaseListFilterPanelExanded;
|
|
70
64
|
const useFilterStateInit = useFilterStateOnLoad();
|
|
65
|
+
const isBasicSearchMode = filterState.filterQueryInfo.type === CaseSearchQueryType.BASIC ||
|
|
66
|
+
(filterState.filterQueryInfo.type === CaseSearchQueryType.ADVANCED && loggedInUserRights.data.isExternal());
|
|
67
|
+
const prevSearchType = usePrevious(filterState.filterQueryInfo.type);
|
|
68
|
+
let isSearchTypeChanged = filterState.filterQueryInfo.type !== prevSearchType;
|
|
71
69
|
const [hasError, setHasError] = useState(null);
|
|
70
|
+
const [isSolrSearchDown, setSolrSearchDown] = useState(false);
|
|
72
71
|
const [defaultSavedSearchName, setDefaultSavedSearchName] = useState('');
|
|
73
72
|
const [RHCDValue, setRHCDValue] = useState('');
|
|
74
73
|
const [isRHCDAlertShown, setIsRHCDAlertShown] = useState(true);
|
|
75
|
-
const loadMoreLockRef = useRef(false);
|
|
76
|
-
const loadMoreFnRef = useRef(() => { });
|
|
77
|
-
const loadMoreCooldownRef = useRef(false);
|
|
78
|
-
const loadMoreAbortRef = useRef(null);
|
|
79
|
-
const activeFilterStateRef = useRef(filterState);
|
|
80
|
-
const sentinelElRef = useRef(null);
|
|
81
|
-
const prefetchRef = useRef({
|
|
82
|
-
cursor: '',
|
|
83
|
-
data: null,
|
|
84
|
-
loading: false,
|
|
85
|
-
});
|
|
86
|
-
const { ref: inViewRef, inView } = useInView();
|
|
87
|
-
const sentinelRef = React.useCallback((node) => {
|
|
88
|
-
sentinelElRef.current = node || null;
|
|
89
|
-
inViewRef(node);
|
|
90
|
-
}, [inViewRef]);
|
|
91
|
-
function startPrefetch(cursor) {
|
|
92
|
-
if (!cursor || prefetchRef.current.cursor === cursor)
|
|
93
|
-
return;
|
|
94
|
-
prefetchRef.current = { cursor, data: null, loading: true };
|
|
95
|
-
loadMoreCases(activeFilterStateRef.current, apolloClient, cursor, undefined, includeSecureSupportCases)
|
|
96
|
-
.then((result) => {
|
|
97
|
-
if (prefetchRef.current.cursor === cursor) {
|
|
98
|
-
prefetchRef.current = { cursor, data: result, loading: false };
|
|
99
|
-
}
|
|
100
|
-
})
|
|
101
|
-
.catch(() => {
|
|
102
|
-
if (prefetchRef.current.cursor === cursor) {
|
|
103
|
-
prefetchRef.current = { cursor: '', data: null, loading: false };
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
useEffect(() => {
|
|
108
|
-
let ticking = false;
|
|
109
|
-
let triggered = false;
|
|
110
|
-
const onScroll = () => {
|
|
111
|
-
if (ticking)
|
|
112
|
-
return;
|
|
113
|
-
ticking = true;
|
|
114
|
-
requestAnimationFrame(() => {
|
|
115
|
-
ticking = false;
|
|
116
|
-
if (!sentinelElRef.current)
|
|
117
|
-
return;
|
|
118
|
-
const rect = sentinelElRef.current.getBoundingClientRect();
|
|
119
|
-
const isNear = rect.top <= window.innerHeight + 600;
|
|
120
|
-
if (!isNear) {
|
|
121
|
-
triggered = false;
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
if (!triggered && !loadMoreLockRef.current) {
|
|
125
|
-
triggered = true;
|
|
126
|
-
loadMoreFnRef.current();
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
};
|
|
130
|
-
window.addEventListener('scroll', onScroll, true);
|
|
131
|
-
return () => window.removeEventListener('scroll', onScroll, true);
|
|
132
|
-
}, []);
|
|
133
|
-
useEffect(() => {
|
|
134
|
-
if (inView && hasNextPage && !isLoadingMore && !loadMoreError) {
|
|
135
|
-
loadMore();
|
|
136
|
-
}
|
|
137
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
138
|
-
}, [inView]);
|
|
139
|
-
useEffect(() => {
|
|
140
|
-
if (!isLoadingMore)
|
|
141
|
-
return;
|
|
142
|
-
const handleOffline = () => {
|
|
143
|
-
if (loadMoreAbortRef.current) {
|
|
144
|
-
loadMoreAbortRef.current.abort();
|
|
145
|
-
loadMoreAbortRef.current = null;
|
|
146
|
-
}
|
|
147
|
-
loadMoreLockRef.current = false;
|
|
148
|
-
setLoadMoreError(CaseListDispatch, true, loadMoreRetryCount + 1);
|
|
149
|
-
};
|
|
150
|
-
if (!navigator.onLine) {
|
|
151
|
-
handleOffline();
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
window.addEventListener('offline', handleOffline);
|
|
155
|
-
return () => window.removeEventListener('offline', handleOffline);
|
|
156
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
157
|
-
}, [isLoadingMore]);
|
|
158
|
-
useEffect(() => {
|
|
159
|
-
const onClick = (e) => {
|
|
160
|
-
const anchor = e.target.closest('a.btn_slideto[href="#masthead"]');
|
|
161
|
-
if (anchor) {
|
|
162
|
-
e.preventDefault();
|
|
163
|
-
window.scrollTo({ top: 0, behavior: 'smooth' });
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
document.addEventListener('click', onClick, true);
|
|
167
|
-
return () => document.removeEventListener('click', onClick, true);
|
|
168
|
-
}, []);
|
|
169
74
|
function getCases(currentFilterState) {
|
|
170
75
|
return __awaiter(this, void 0, void 0, function* () {
|
|
171
|
-
|
|
76
|
+
let showError;
|
|
172
77
|
try {
|
|
173
|
-
if (abortControllerRef.current) {
|
|
174
|
-
abortControllerRef.current.abort();
|
|
175
|
-
}
|
|
176
|
-
const controller = new AbortController();
|
|
177
|
-
abortControllerRef.current = controller;
|
|
178
78
|
setIsFetching(CaseListDispatch, true);
|
|
179
79
|
setHasError(false);
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
const result = yield getCaseListFromGraphQL(currentFilterState, apolloClient, undefined, controller.signal, undefined, includeSecureSupportCases);
|
|
184
|
-
if (controller.signal.aborted) {
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
setCaseList(CaseListDispatch, result.caseListResponse.response);
|
|
188
|
-
setCursorInfo(CaseListDispatch, result.hasNextPage, result.endCursor);
|
|
189
|
-
setIsFetching(CaseListDispatch, false);
|
|
190
|
-
setTimeout(() => {
|
|
191
|
-
loadMoreCooldownRef.current = false;
|
|
192
|
-
}, 500);
|
|
193
|
-
if (result.hasNextPage && result.endCursor) {
|
|
194
|
-
startPrefetch(result.endCursor);
|
|
195
|
-
}
|
|
196
|
-
if (result.showErrorMessage) {
|
|
197
|
-
setHasError(true);
|
|
198
|
-
ToastNotification.addDangerMessage(t('There was an error loading case data. Please try again.'));
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
catch (err) {
|
|
202
|
-
if ((err === null || err === void 0 ? void 0 : err.name) === 'AbortError' || ((_a = err === null || err === void 0 ? void 0 : err.message) === null || _a === void 0 ? void 0 : _a.includes('aborted'))) {
|
|
203
|
-
return;
|
|
80
|
+
if (abortControllerRef.current !== undefined) {
|
|
81
|
+
// Cancel the previous request
|
|
82
|
+
abortControllerRef.current.abort();
|
|
204
83
|
}
|
|
84
|
+
// recreate a new AbortController for each call
|
|
85
|
+
let controller = new AbortController();
|
|
86
|
+
abortControllerRef.current = controller;
|
|
87
|
+
const { caseListResponse, isSolrSearchDownSFDCUp, showErrorMessage } = yield getCaseList(currentFilterState, loggedInUserRights.data, loggedInUsersAccount.data, controller.signal);
|
|
88
|
+
showError = showErrorMessage;
|
|
89
|
+
setSolrSearchDown(isSolrSearchDownSFDCUp);
|
|
90
|
+
setFilterValuesFromFacetResponse(CaseListDispatch, solrResponseToFacetFields(caseListResponse));
|
|
91
|
+
setPivotValues(CaseListDispatch, solrResponseToPivotFields(caseListResponse));
|
|
92
|
+
setCaseList(CaseListDispatch, caseListResponse.response);
|
|
205
93
|
setIsFetching(CaseListDispatch, false);
|
|
206
|
-
setHasError(true);
|
|
207
|
-
ToastNotification.addXHRErrorMessage(err);
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
function loadMore() {
|
|
212
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
213
|
-
var _a;
|
|
214
|
-
if (loadMoreCooldownRef.current ||
|
|
215
|
-
loadMoreLockRef.current ||
|
|
216
|
-
isLoadingMore ||
|
|
217
|
-
!hasNextPage ||
|
|
218
|
-
!endCursor ||
|
|
219
|
-
loadMoreError)
|
|
220
|
-
return;
|
|
221
|
-
loadMoreLockRef.current = true;
|
|
222
|
-
if (loadMoreAbortRef.current) {
|
|
223
|
-
loadMoreAbortRef.current.abort();
|
|
224
|
-
}
|
|
225
|
-
const controller = new AbortController();
|
|
226
|
-
loadMoreAbortRef.current = controller;
|
|
227
|
-
setIsLoadingMore(CaseListDispatch, true);
|
|
228
|
-
try {
|
|
229
|
-
let result;
|
|
230
|
-
const pf = prefetchRef.current;
|
|
231
|
-
if (pf.cursor === endCursor && pf.data) {
|
|
232
|
-
result = pf.data;
|
|
233
|
-
prefetchRef.current = { cursor: '', data: null, loading: false };
|
|
234
|
-
}
|
|
235
|
-
else {
|
|
236
|
-
prefetchRef.current = { cursor: '', data: null, loading: false };
|
|
237
|
-
result = yield loadMoreCases(activeFilterStateRef.current, apolloClient, endCursor, controller.signal, includeSecureSupportCases);
|
|
238
|
-
}
|
|
239
|
-
if (controller.signal.aborted)
|
|
240
|
-
return;
|
|
241
|
-
setLoadMoreError(CaseListDispatch, false, 0);
|
|
242
|
-
appendCaseList(CaseListDispatch, result.docs, result.hasNextPage, result.endCursor);
|
|
243
|
-
if (result.hasNextPage && result.endCursor) {
|
|
244
|
-
startPrefetch(result.endCursor);
|
|
245
|
-
}
|
|
246
94
|
}
|
|
247
95
|
catch (err) {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
console.error('[CaseList] loadMore error:', err);
|
|
254
|
-
}
|
|
255
|
-
finally {
|
|
256
|
-
if (!controller.signal.aborted) {
|
|
257
|
-
loadMoreLockRef.current = false;
|
|
96
|
+
const isAbortError = err.message && err.message.toLowerCase().indexOf('abort') > -1;
|
|
97
|
+
if (!isAbortError) {
|
|
98
|
+
setIsFetching(CaseListDispatch, false);
|
|
99
|
+
setHasError(true);
|
|
100
|
+
showError && ToastNotification.addXHRErrorMessage(err);
|
|
258
101
|
}
|
|
259
102
|
}
|
|
260
103
|
});
|
|
261
104
|
}
|
|
262
|
-
loadMoreFnRef.current = loadMore;
|
|
263
|
-
function retryLoadMore() {
|
|
264
|
-
if (loadMoreAbortRef.current) {
|
|
265
|
-
loadMoreAbortRef.current.abort();
|
|
266
|
-
loadMoreAbortRef.current = null;
|
|
267
|
-
}
|
|
268
|
-
loadMoreLockRef.current = false;
|
|
269
|
-
setLoadMoreError(CaseListDispatch, false, loadMoreRetryCount);
|
|
270
|
-
setTimeout(() => loadMoreFnRef.current(), 0);
|
|
271
|
-
}
|
|
272
105
|
const toggleFilterSection = (isExpanded) => {
|
|
273
106
|
if (!filterSectionRef.current)
|
|
274
107
|
return;
|
|
275
108
|
filterSectionRef.current.expanded = isExpanded;
|
|
276
109
|
forceUpdate();
|
|
277
110
|
};
|
|
111
|
+
function saveFilterQueryInUserPreferences() {
|
|
112
|
+
if (isNoFilterApplied(filterState))
|
|
113
|
+
return;
|
|
114
|
+
const type = filterState.filterQueryInfo.type;
|
|
115
|
+
const recentSerach = {
|
|
116
|
+
filterState: type === CaseSearchQueryType.BASIC ? filterState.filterInfo : {},
|
|
117
|
+
sortState: filterState.sortInfo,
|
|
118
|
+
queryString: type === CaseSearchQueryType.BASIC
|
|
119
|
+
? filterState.filterQueryInfo.queryString
|
|
120
|
+
: filterState.filterQueryInfo.parsedQuery,
|
|
121
|
+
type,
|
|
122
|
+
};
|
|
123
|
+
try {
|
|
124
|
+
updateUserPreferences(dispatchToGlobalMetadataReducer, loggedInUserRights.data.getSSOUsername(), [{ key: UserPreferencesKeys.mostRecentSearch, value: JSON.stringify(recentSerach) }], 'add');
|
|
125
|
+
}
|
|
126
|
+
catch (e) {
|
|
127
|
+
console.error('Could not save filter query in user preferences');
|
|
128
|
+
}
|
|
129
|
+
}
|
|
278
130
|
const onToggleFilterBtnClick = () => {
|
|
279
131
|
var _a, _b;
|
|
280
132
|
toggleFilterSection(!((_a = filterSectionRef.current) === null || _a === void 0 ? void 0 : _a.expanded));
|
|
@@ -284,7 +136,8 @@ export function CaseList(props) {
|
|
|
284
136
|
};
|
|
285
137
|
const checkNewCases = () => __awaiter(this, void 0, void 0, function* () {
|
|
286
138
|
try {
|
|
287
|
-
const { caseListResponse } = yield
|
|
139
|
+
const { caseListResponse, isSolrSearchDownSFDCUp } = yield getCaseList(filterState, loggedInUserRights.data, loggedInUsersAccount.data, null);
|
|
140
|
+
setSolrSearchDown(isSolrSearchDownSFDCUp);
|
|
288
141
|
let changed = false;
|
|
289
142
|
if (caseListResponse.response.numFound <= filterState.paginationInfo.pageSize &&
|
|
290
143
|
caseListResponse.response.numFound !== caseList.numFound) {
|
|
@@ -306,7 +159,6 @@ export function CaseList(props) {
|
|
|
306
159
|
}
|
|
307
160
|
if (changed && location.pathname === '/case/list') {
|
|
308
161
|
setCaseList(CaseListDispatch, caseListResponse.response);
|
|
309
|
-
pendoTrackEvent(UpdatedCaseDataEvent);
|
|
310
162
|
ToastNotification.addSuccessMessage(t('Case data has been updated'));
|
|
311
163
|
}
|
|
312
164
|
}
|
|
@@ -314,145 +166,79 @@ export function CaseList(props) {
|
|
|
314
166
|
console.log(err);
|
|
315
167
|
}
|
|
316
168
|
});
|
|
317
|
-
const salesforceAccountId = (_a = loggedInUsersAccount.data) === null || _a === void 0 ? void 0 : _a.salesforceAccountId;
|
|
318
|
-
const loggedInContactId = (_b = loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.data) === null || _b === void 0 ? void 0 : _b.id;
|
|
319
|
-
const loggedInIsOrgAdmin = (_c = loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.data) === null || _c === void 0 ? void 0 : _c.isOrgAdmin;
|
|
320
|
-
const defaultCaseGroupId = (_e = (_d = loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.data) === null || _d === void 0 ? void 0 : _d.defaultCaseGroup) !== null && _e !== void 0 ? _e : null;
|
|
321
|
-
const prevDefaultCaseGroupIdRef = useRef(defaultCaseGroupId);
|
|
322
|
-
useEffect(() => {
|
|
323
|
-
var _a;
|
|
324
|
-
if (prevDefaultCaseGroupIdRef.current !== defaultCaseGroupId) {
|
|
325
|
-
userDismissedDefaultGroupRef.current = false;
|
|
326
|
-
}
|
|
327
|
-
prevDefaultCaseGroupIdRef.current = defaultCaseGroupId;
|
|
328
|
-
const currentGroupFilter = ((_a = filterState.filterInfo) === null || _a === void 0 ? void 0 : _a[SolrKeys.group]) || [];
|
|
329
|
-
if (prevGroupFilterRef.current !== undefined &&
|
|
330
|
-
prevGroupFilterRef.current.length > 0 &&
|
|
331
|
-
currentGroupFilter.length === 0) {
|
|
332
|
-
userDismissedDefaultGroupRef.current = true;
|
|
333
|
-
}
|
|
334
|
-
prevGroupFilterRef.current = currentGroupFilter;
|
|
335
|
-
}, [filterState.filterInfo, defaultCaseGroupId]);
|
|
336
169
|
useEffect(() => {
|
|
337
170
|
var _a;
|
|
338
|
-
if (
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
else {
|
|
346
|
-
fetchCaseGroupsForSSO(dispatchToGlobalMetadataReducer, apolloClient, salesforceAccountId, defaultCaseGroupId, loggedInContactId, loggedInIsOrgAdmin);
|
|
171
|
+
if (haventLoadedMetadata(caseGroups, (data) => data === undefined)) {
|
|
172
|
+
if ((_a = loggedInUsersAccount.data) === null || _a === void 0 ? void 0 : _a.isInternal) {
|
|
173
|
+
fetchCaseGroupsForAccount(dispatchToGlobalMetadataReducer, loggedInUsersAccount.data.accountNumber);
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
fetchCaseGroupsForSSO(dispatchToGlobalMetadataReducer, loggedInUserJwtToken.preferred_username);
|
|
177
|
+
}
|
|
347
178
|
}
|
|
348
|
-
}, [
|
|
349
|
-
apolloClient,
|
|
350
|
-
caseGroups,
|
|
351
|
-
dispatchToGlobalMetadataReducer,
|
|
352
|
-
defaultCaseGroupId,
|
|
353
|
-
loggedInContactId,
|
|
354
|
-
loggedInIsOrgAdmin,
|
|
355
|
-
loggedInUser.isFetching,
|
|
356
|
-
(_f = loggedInUsersAccount.data) === null || _f === void 0 ? void 0 : _f.isInternal,
|
|
357
|
-
salesforceAccountId,
|
|
358
|
-
]);
|
|
179
|
+
}, [caseGroups, dispatchToGlobalMetadataReducer, loggedInUserJwtToken, loggedInUsersAccount.data]);
|
|
359
180
|
useEffect(() => {
|
|
360
|
-
if (
|
|
361
|
-
|
|
362
|
-
if (loggedInUser.isFetching || caseGroups.isFetching || caseGroups.data === undefined)
|
|
363
|
-
return;
|
|
364
|
-
if (!shouldApplyDefaultGroupFilter(queryFromUrl, hydraUserPreferences.data))
|
|
365
|
-
return;
|
|
366
|
-
const canAutoSync = isNoFilterApplied(filterState) ||
|
|
367
|
-
isOnlyDefaultFilterApplied(filterState) ||
|
|
368
|
-
isOnlyGroupFilterApplied(filterState.filterInfo);
|
|
369
|
-
if (!canAutoSync)
|
|
370
|
-
return;
|
|
371
|
-
const nextGroupFilter = getDefaultGroupFilterSelection(caseGroups.data, loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.data);
|
|
372
|
-
const currentGroupFilter = filterState.filterInfo[SolrKeys.group] || [];
|
|
373
|
-
if (userDismissedDefaultGroupRef.current && currentGroupFilter.length === 0) {
|
|
374
|
-
return;
|
|
181
|
+
if (haventLoadedMetadata(allCaseTypes)) {
|
|
182
|
+
fetchCaseTypes(dispatchToGlobalMetadataReducer, loggedInUsersAccount.data.secureSupport);
|
|
375
183
|
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
updateFilterState(filterDispatch, Object.assign(Object.assign({}, filterState), { filterInfo: Object.assign(Object.assign({}, filterState.filterInfo), { [SolrKeys.group]: nextGroupFilter }) }));
|
|
379
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
380
|
-
}, [
|
|
381
|
-
defaultCaseGroupId,
|
|
382
|
-
caseGroups.data,
|
|
383
|
-
caseGroups.isFetching,
|
|
384
|
-
loggedInUser.isFetching,
|
|
385
|
-
location.pathname,
|
|
386
|
-
queryFromUrl,
|
|
387
|
-
]);
|
|
388
|
-
useEffect(() => {
|
|
389
|
-
const loadMetadata = () => __awaiter(this, void 0, void 0, function* () {
|
|
390
|
-
if (haventLoadedMetadata(allCaseTypes)) {
|
|
391
|
-
fetchCaseTypes(dispatchToGlobalMetadataReducer, apolloClient);
|
|
392
|
-
}
|
|
184
|
+
// when solr is down, we use hydra metadata api to populated filter dropdowns
|
|
185
|
+
if (isSolrSearchDown) {
|
|
393
186
|
if (haventLoadedMetadata(allCaseSeverities)) {
|
|
394
|
-
fetchCaseSeverities(dispatchToGlobalMetadataReducer,
|
|
187
|
+
fetchCaseSeverities(dispatchToGlobalMetadataReducer, loggedInUsersAccount.data.secureSupport);
|
|
395
188
|
}
|
|
396
189
|
if (haventLoadedMetadata(allCaseStatuses)) {
|
|
397
|
-
fetchAllStatuses(dispatchToGlobalMetadataReducer,
|
|
190
|
+
fetchAllStatuses(dispatchToGlobalMetadataReducer, loggedInUsersAccount.data.secureSupport);
|
|
398
191
|
}
|
|
399
192
|
if (haventLoadedProductsMetadata(allProducts)) {
|
|
400
|
-
fetchProducts(dispatchToGlobalMetadataReducer
|
|
193
|
+
fetchProducts(dispatchToGlobalMetadataReducer);
|
|
401
194
|
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
queryString: type === CaseSearchQueryType.BASIC
|
|
414
|
-
? filterState.filterQueryInfo.queryString
|
|
415
|
-
: filterState.filterQueryInfo.parsedQuery,
|
|
416
|
-
type,
|
|
417
|
-
};
|
|
418
|
-
try {
|
|
419
|
-
updateUserPreferences(dispatchToGlobalMetadataReducer, loggedInUserRights.data.getSSOUsername(), [{ key: UserPreferencesKeys.mostRecentSearch, value: JSON.stringify(recentSearch) }], 'add');
|
|
420
|
-
}
|
|
421
|
-
catch (e) {
|
|
422
|
-
console.error('Could not save filter query in user preferences');
|
|
195
|
+
// on sfdc fields that only one value is allowed, set filter to first item
|
|
196
|
+
const sfdcFilterState = mapValues(filterState.filterInfo, (value, key) => {
|
|
197
|
+
//@ts-ignore
|
|
198
|
+
if (eligibleSFDCFiltersMultipleValues.includes(key))
|
|
199
|
+
return value;
|
|
200
|
+
return value[0] ? [value[0]] : [];
|
|
201
|
+
});
|
|
202
|
+
updateFilterState(filterDispatch, {
|
|
203
|
+
//@ts-ignore
|
|
204
|
+
filterInfo: Object.assign(Object.assign({}, initialCaseFilterState.filterInfo), sfdcFilterState),
|
|
205
|
+
});
|
|
423
206
|
}
|
|
424
|
-
|
|
207
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
208
|
+
}, [
|
|
209
|
+
allCaseTypes,
|
|
210
|
+
allCaseSeverities,
|
|
211
|
+
allCaseStatuses,
|
|
212
|
+
allProducts,
|
|
213
|
+
dispatchToGlobalMetadataReducer,
|
|
214
|
+
loggedInUsersAccount.data.secureSupport,
|
|
215
|
+
isSolrSearchDown,
|
|
216
|
+
]);
|
|
425
217
|
// effect to update url query and call get case api whenever filter state changes
|
|
426
218
|
useEffect(() => {
|
|
427
|
-
var _a, _b, _c
|
|
219
|
+
var _a, _b, _c;
|
|
428
220
|
if (!isFirstMount.current) {
|
|
429
221
|
const urlQuery = (isNoFilterApplied(filterState) || isOnlyDefaultFilterApplied(filterState)) &&
|
|
430
222
|
!((_a = filterState.filterQueryInfo) === null || _a === void 0 ? void 0 : _a.queryString) &&
|
|
431
223
|
!filterState.sortInfo.column
|
|
432
224
|
? ''
|
|
433
225
|
: createURLQueryFromFilterState(filterState);
|
|
434
|
-
const paginationKey = `p${(_b = filterState.paginationInfo) === null || _b === void 0 ? void 0 : _b.currentPage}_s${(_c = filterState.paginationInfo) === null || _c === void 0 ? void 0 : _c.pageSize}`;
|
|
435
|
-
const advanceSearchKey = [
|
|
436
|
-
((_d = filterState.filterQueryInfo) === null || _d === void 0 ? void 0 : _d.parsedQuery) || '',
|
|
437
|
-
JSON.stringify(filterState.advanceSearchDateRanges || null),
|
|
438
|
-
].join('|');
|
|
439
|
-
const fullQueryKey = `${urlQuery}_${paginationKey}_${advanceSearchKey}`;
|
|
440
|
-
if (fullQueryKey === lastPushedQueryRef.current) {
|
|
441
|
-
return;
|
|
442
|
-
}
|
|
443
|
-
if (urlQuery !== lastPushedQueryRef.current) {
|
|
444
|
-
clearPageCursors();
|
|
445
|
-
}
|
|
446
226
|
setCurrentQuery(CaseListDispatch, urlQuery);
|
|
447
|
-
lastPushedQueryRef.current = urlQuery;
|
|
448
227
|
searchParams[FILTER_URL_QUERY_SEARCH_PARAM] = encodeURIComponent(urlQuery);
|
|
228
|
+
searchParams[FILTER_URL_CURRENT_PAGE_SEARCH_PARAM] = (_b = filterState.paginationInfo) === null || _b === void 0 ? void 0 : _b.currentPage.toString();
|
|
229
|
+
searchParams[FILTER_URL_PAGE_SIZE_SEARCH_PARAM] = (_c = filterState.paginationInfo) === null || _c === void 0 ? void 0 : _c.pageSize.toString();
|
|
449
230
|
searchParams[FILTER_URL_QUERY_TYPE] = filterState.filterQueryInfo.type;
|
|
450
|
-
delete searchParams[FILTER_URL_CURRENT_PAGE_SEARCH_PARAM];
|
|
451
|
-
delete searchParams[FILTER_URL_PAGE_SIZE_SEARCH_PARAM];
|
|
452
231
|
props.routeProps.history.push({
|
|
453
232
|
search: getStringifiedParams(searchParams),
|
|
454
233
|
});
|
|
455
234
|
saveFilterQueryInUserPreferences();
|
|
235
|
+
// so that we don't call get cases every time user switches between basic and advanced without any filters applied
|
|
236
|
+
if (isSearchTypeChanged &&
|
|
237
|
+
!filterState.filterQueryInfo.queryString &&
|
|
238
|
+
isNoFilterApplied(filterState) &&
|
|
239
|
+
filterValuesFromFacetResponse // if this is null, it means it is the first page load so get cases anyway
|
|
240
|
+
)
|
|
241
|
+
return;
|
|
456
242
|
getCases(filterState);
|
|
457
243
|
}
|
|
458
244
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -462,46 +248,17 @@ export function CaseList(props) {
|
|
|
462
248
|
if (bookmarkedAccounts.isFetching ||
|
|
463
249
|
managedAccounts.isFetching ||
|
|
464
250
|
caseGroups.isFetching ||
|
|
465
|
-
caseGroups.data === undefined
|
|
466
|
-
caseRecordTypes.isFetching ||
|
|
467
|
-
isEmpty(caseRecordTypes.data))
|
|
251
|
+
caseGroups.data === undefined)
|
|
468
252
|
return;
|
|
469
|
-
const decodedQueryFromUrl = (() => {
|
|
470
|
-
if (!queryFromUrl || queryFromUrl === 'undefined') {
|
|
471
|
-
return '';
|
|
472
|
-
}
|
|
473
|
-
try {
|
|
474
|
-
return decodeURIComponent(queryFromUrl);
|
|
475
|
-
}
|
|
476
|
-
catch (_a) {
|
|
477
|
-
return queryFromUrl;
|
|
478
|
-
}
|
|
479
|
-
})();
|
|
480
253
|
// when user manually changes url and hit enter, new result is fetched without refreshing the page
|
|
481
254
|
if (!isFirstMount.current) {
|
|
482
|
-
if (
|
|
483
|
-
|
|
484
|
-
decodedQueryFromUrl !== lastPushedQueryRef.current) {
|
|
485
|
-
const filterStateFromQueryUrl = createFilterStateFromUrlQuery(decodedQueryFromUrl, globalMetadataState, undefined, 1, searchType);
|
|
255
|
+
if (queryFromUrl !== currentQuery) {
|
|
256
|
+
const filterStateFromQueryUrl = createFilterStateFromUrlQuery(queryFromUrl, globalMetadataState, pageSizeFromUrl, currentPageFromUrl, searchType);
|
|
486
257
|
updateFilterState(filterDispatch, filterStateFromQueryUrl);
|
|
487
258
|
}
|
|
488
259
|
return;
|
|
489
260
|
}
|
|
490
261
|
if (isFirstMount.current) {
|
|
491
|
-
if (searchParams.rhcd) {
|
|
492
|
-
// this is to check if rhcd is passed on first load
|
|
493
|
-
setRHCDValue(searchParams.rhcd);
|
|
494
|
-
}
|
|
495
|
-
const hasExplicitUrlQuery = Boolean(decodedQueryFromUrl.trim());
|
|
496
|
-
if (hasExplicitUrlQuery && decodedQueryFromUrl !== currentQuery) {
|
|
497
|
-
const { initFilterState, defaultSearchName } = useFilterStateInit.set(decodedQueryFromUrl, undefined, 1, searchType);
|
|
498
|
-
setDefaultSavedSearchName(defaultSearchName);
|
|
499
|
-
setCurrentQuery(CaseListDispatch, decodedQueryFromUrl);
|
|
500
|
-
lastPushedQueryRef.current = decodedQueryFromUrl;
|
|
501
|
-
isFirstMount.current = false;
|
|
502
|
-
updateFilterState(filterDispatch, initFilterState);
|
|
503
|
-
return;
|
|
504
|
-
}
|
|
505
262
|
// user came to page from another tab - second time on page as currentQuery is set
|
|
506
263
|
// - keep state and show the result that we already have in state
|
|
507
264
|
// - update url to reflect filter state
|
|
@@ -509,6 +266,8 @@ export function CaseList(props) {
|
|
|
509
266
|
if (currentQuery) {
|
|
510
267
|
const navObj = {
|
|
511
268
|
[FILTER_URL_QUERY_SEARCH_PARAM]: encodeURIComponent(currentQuery),
|
|
269
|
+
[FILTER_URL_PAGE_SIZE_SEARCH_PARAM]: filterState.paginationInfo.pageSize,
|
|
270
|
+
[FILTER_URL_CURRENT_PAGE_SEARCH_PARAM]: filterState.paginationInfo.currentPage,
|
|
512
271
|
[FILTER_URL_QUERY_TYPE]: filterState.filterQueryInfo.type,
|
|
513
272
|
};
|
|
514
273
|
props.routeProps.history.replace({ search: getStringifiedParams(navObj) });
|
|
@@ -516,29 +275,33 @@ export function CaseList(props) {
|
|
|
516
275
|
isFirstMount.current = false;
|
|
517
276
|
return;
|
|
518
277
|
}
|
|
278
|
+
/*** user comes to this point on first time app load landing on case list ***/
|
|
279
|
+
if (searchParams.rhcd) {
|
|
280
|
+
// this is to check if rhcd is passed on first load
|
|
281
|
+
setRHCDValue(searchParams.rhcd);
|
|
282
|
+
}
|
|
519
283
|
// set filter state based on url or default saved search
|
|
520
|
-
|
|
521
|
-
// Always reset to page 1 on fresh load — cursor-based pagination
|
|
522
|
-
// has no stored cursors after refresh, so page > 1 would cause a mismatch
|
|
523
|
-
const { initFilterState, defaultSearchName } = useFilterStateInit.set(decodedQueryFromUrl, undefined, 1, searchType);
|
|
284
|
+
const { initFilterState, defaultSearchName } = useFilterStateInit.set(decodeURIComponent(queryFromUrl), pageSizeFromUrl, currentPageFromUrl, searchType);
|
|
524
285
|
// to set default saved search name
|
|
525
286
|
setDefaultSavedSearchName(defaultSearchName);
|
|
526
287
|
// set default params when they are empty
|
|
527
|
-
if (!
|
|
288
|
+
if (!queryFromUrl) {
|
|
528
289
|
searchParams[FILTER_URL_QUERY_SEARCH_PARAM] = ' orderBy lastModifiedDate desc';
|
|
529
290
|
}
|
|
530
|
-
setCurrentQuery(CaseListDispatch,
|
|
291
|
+
setCurrentQuery(CaseListDispatch, queryFromUrl);
|
|
531
292
|
isFirstMount.current = false;
|
|
532
293
|
// we only update the state without api call as we fetch result in another useEffect that observes the state
|
|
533
294
|
updateFilterState(filterDispatch, initFilterState);
|
|
534
295
|
}
|
|
535
296
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
536
|
-
}, [managedAccounts, bookmarkedAccounts, caseGroups,
|
|
537
|
-
// effect to initially set the filter state to expanded
|
|
297
|
+
}, [managedAccounts, bookmarkedAccounts, caseGroups, queryFromUrl, pageSizeFromUrl, currentPageFromUrl]);
|
|
298
|
+
// effect to initially set the filter state to expanded and when we switch from advanced to basic mode
|
|
538
299
|
useEffect(() => {
|
|
539
|
-
|
|
300
|
+
// currently there is no easy way to set the panel as expanded on initial load
|
|
301
|
+
// also we only use the standalone panel and manually change the panel state on toggle btn click
|
|
302
|
+
isCaseListFilterPanelExanded && isXLScreen && isBasicSearchMode && toggleFilterSection(true);
|
|
540
303
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
541
|
-
}, []);
|
|
304
|
+
}, [isBasicSearchMode]);
|
|
542
305
|
const onConfirmTraditionalSupportAgreement = () => {
|
|
543
306
|
updateCaseListTraditionalSupportAgreed(globalDispatchContext, true);
|
|
544
307
|
};
|
|
@@ -564,6 +327,12 @@ export function CaseList(props) {
|
|
|
564
327
|
return (React.createElement(React.Fragment, null,
|
|
565
328
|
React.createElement(CSSUserModal, { onConfirmTraditionalSupportAgreement: onConfirmTraditionalSupportAgreement, display: !caseListTraditionalSupportAgreed }),
|
|
566
329
|
React.createElement("article", { id: "rh-support-cases", className: "cases-main" },
|
|
330
|
+
isSolrSearchDown && (React.createElement(Alert, { isInline: true, variant: AlertVariant.warning, component: "p", title: React.createElement(Trans, null,
|
|
331
|
+
"Case search is working with limited functionality. Please check",
|
|
332
|
+
' ',
|
|
333
|
+
React.createElement("a", { href: "https://status.redhat.com", target: "_blank", rel: "noreferrer", "data-tracking-id": "caselist-redirect-status-page" }, "status page"),
|
|
334
|
+
' ',
|
|
335
|
+
"for details.") })),
|
|
567
336
|
React.createElement("section", { className: "case-search-top" },
|
|
568
337
|
!isEmpty(RHCDValue) && isRHCDAlertShown && React.createElement("div", { className: "push-bottom" }, displayRHCDAlert()),
|
|
569
338
|
React.createElement("div", { className: "search-wrapper" },
|
|
@@ -571,17 +340,17 @@ export function CaseList(props) {
|
|
|
571
340
|
React.createElement(NewCaseButton, { routeProps: props.routeProps })),
|
|
572
341
|
React.createElement(ErrorBoundary, { errorMsgInfo: { message: t('There was an error loading case search input') } },
|
|
573
342
|
React.createElement(CaseSearch, { defaultSavedSearchName: defaultSavedSearchName }))),
|
|
574
|
-
React.createElement(ErrorBoundary, { errorMsgInfo: { message: t('There was an error loading filter chips') } },
|
|
575
|
-
React.createElement(CaseListFilterChips,
|
|
343
|
+
isBasicSearchMode && (React.createElement(ErrorBoundary, { errorMsgInfo: { message: t('There was an error loading filter chips') } },
|
|
344
|
+
React.createElement(CaseListFilterChips, { productVersionPivotValues: get(pivotValues, SolrPivotKeys.product_version, []), isSolrSearchDown: isSolrSearchDown })))),
|
|
576
345
|
React.createElement("section", { className: "case-search-bottom" },
|
|
577
|
-
React.createElement("aside", { className: `case-search-filters ${((
|
|
578
|
-
React.createElement("h2", { className: "filter-header pf-v6-u-display-flex" }, ((
|
|
346
|
+
isBasicSearchMode && (React.createElement("aside", { className: `case-search-filters ${((_a = filterSectionRef.current) === null || _a === void 0 ? void 0 : _a.expanded) ? '' : 'collapsed'}` },
|
|
347
|
+
React.createElement("h2", { className: "filter-header pf-v6-u-display-flex" }, ((_b = filterSectionRef.current) === null || _b === void 0 ? void 0 : _b.expanded) ? (React.createElement(React.Fragment, null,
|
|
579
348
|
React.createElement(Button, { isInline: true, className: "pf-v6-u-flex-shrink-0 pf-v6-u-flex-none case-search-filter-text-button", variant: "link", title: t('Collapse filter section'), "data-tracking-id": "collapse-case-list-filter", onClick: onToggleFilterBtnClick, iconPosition: "right", icon: React.createElement(OpenDrawerRightIcon, { className: "mirrored" }) },
|
|
580
349
|
React.createElement(Trans, null, "Filters")))) : (React.createElement(Button, { isInline: true, className: "pf-v6-c-button pf-m-link pf-m-inline pf-v6-u-flex-shrink-0 pf-v6-u-flex-none pf-v6-u-display-flex pf-v6-u-align-items-center pf-v6-u-justify-content-center pf-v6-u-px-lg", variant: "link", title: t('Expand filter section'), "data-tracking-id": "expand-case-list-filter", onClick: onToggleFilterBtnClick, iconPosition: "right", icon: React.createElement(OpenDrawerRightIcon, null) }, isXLScreen ? null : React.createElement(Trans, null, "Filters")))),
|
|
581
350
|
React.createElement("div", { className: "filter-wrapper" },
|
|
582
351
|
React.createElement("pfe-collapse-panel", { id: "case-filters-panel", "pfe-animation": "false", ref: filterSectionRef },
|
|
583
352
|
React.createElement(ErrorBoundary, { errorMsgInfo: { message: t('There was an error loading filters') } },
|
|
584
|
-
React.createElement(CaseListFilters, { allCaseTypes: allCaseTypes, allCaseStatuses: allCaseStatuses, allCaseSeverities: allCaseSeverities, allProducts: allProducts }))))),
|
|
353
|
+
React.createElement(CaseListFilters, { filterValues: filterValuesFromFacetResponse, allCaseTypes: allCaseTypes, allCaseStatuses: allCaseStatuses, allCaseSeverities: allCaseSeverities, allProducts: allProducts, isSolrSearchDown: isSolrSearchDown })))))),
|
|
585
354
|
React.createElement("section", { className: "case-search-table pf-v6-u-display-flex pf-v6-u-flex-direction-column" },
|
|
586
|
-
React.createElement(CaseListTable, { caseList: caseList, caseGroups: caseGroups.data || [], loggedInUserRights: loggedInUserRights.data, sortInfo: filterState.sortInfo, isCaseListPageLoading: isFetching, hasError: hasError,
|
|
355
|
+
React.createElement(CaseListTable, { caseList: caseList, caseGroups: caseGroups.data || [], loggedInUserRights: loggedInUserRights.data, sortInfo: filterState.sortInfo, paginationInfo: filterState.paginationInfo, isCaseListPageLoading: isFetching, hasError: hasError, isSolrDown: isSolrSearchDown }))))));
|
|
587
356
|
}
|