@rh-support/cases 2.6.173 → 2.6.181
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/esm/components/case-list/CaseList.d.ts +0 -7
- package/lib/esm/components/case-list/CaseList.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseList.js +143 -108
- package/lib/esm/components/case-list/CaseListContext.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListContext.js +5 -2
- package/lib/esm/components/case-list/CaseListFilterReducer.d.ts +6 -4
- package/lib/esm/components/case-list/CaseListFilterReducer.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListFilterReducer.js +3 -12
- package/lib/esm/components/case-list/CaseListReducer.d.ts +22 -10
- package/lib/esm/components/case-list/CaseListReducer.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListReducer.js +25 -7
- 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 +18 -11
- 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 -2
- package/lib/esm/components/case-list/case-list-filters/CaseListFilterChips.d.ts +1 -7
- 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 +7 -15
- package/lib/esm/components/case-list/case-list-filters/CaseListFilters.d.ts +2 -5
- package/lib/esm/components/case-list/case-list-filters/CaseListFilters.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/CaseListFilters.js +14 -14
- package/lib/esm/components/case-list/case-list-filters/ProductFilterChip.d.ts +1 -3
- 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 +5 -4
- 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 +15 -54
- package/lib/esm/components/case-list/case-list-filters/SeverityFilter.d.ts +0 -3
- 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 +18 -44
- package/lib/esm/components/case-list/case-list-filters/StatusFilter.d.ts +0 -3
- 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 +14 -44
- package/lib/esm/components/case-list/case-list-filters/VersionsFilter.d.ts +1 -3
- 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 +61 -32
- package/lib/esm/components/case-list/case-list-table/CaseListTable.d.ts +7 -3
- 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 +69 -58
- package/lib/esm/components/case-list/case-list-table/DownloadCSVFileModal.d.ts +0 -5
- 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 +38 -68
- 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 +5 -15
- 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 +2 -3
- package/lib/esm/components/case-list/case-search/BookmarkedSearchesSelector.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-search/BookmarkedSearchesSelector.js +1 -0
- package/lib/esm/components/case-list/case-search/CaseSearch.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-search/CaseSearch.js +6 -6
- package/lib/esm/components/case-list/case-search/useAdvanceSearchParser.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-search/useAdvanceSearchParser.js +2 -1
- package/lib/esm/css/caseList.css +99 -22
- package/lib/esm/enums/case.d.ts +2 -1
- package/lib/esm/enums/case.d.ts.map +1 -1
- package/lib/esm/enums/case.js +14 -1
- package/lib/esm/hooks/useExportCaseListCSV.d.ts.map +1 -1
- package/lib/esm/hooks/useExportCaseListCSV.js +1 -9
- package/lib/esm/test-utils/mockData.js +1 -1
- package/lib/esm/utils/caseListGraphQLUtils.d.ts +28 -0
- package/lib/esm/utils/caseListGraphQLUtils.d.ts.map +1 -0
- package/lib/esm/utils/caseListGraphQLUtils.js +244 -0
- package/lib/esm/utils/caseListMapper.d.ts +6 -0
- package/lib/esm/utils/caseListMapper.d.ts.map +1 -0
- package/lib/esm/utils/caseListMapper.js +36 -0
- package/lib/esm/utils/caseListVariablesBuilder.d.ts +14 -0
- package/lib/esm/utils/caseListVariablesBuilder.d.ts.map +1 -0
- package/lib/esm/utils/caseListVariablesBuilder.js +193 -0
- package/lib/esm/utils/caseSearchUtils.d.ts.map +1 -1
- package/lib/esm/utils/caseSearchUtils.js +26 -1
- package/lib/esm/utils/constants.d.ts +2 -1
- package/lib/esm/utils/constants.d.ts.map +1 -1
- package/lib/esm/utils/constants.js +14 -3
- package/lib/esm/utils/mockSolrResponse.js +1 -1
- package/lib/esm/utils/statusUtils.d.ts +3 -0
- package/lib/esm/utils/statusUtils.d.ts.map +1 -0
- package/lib/esm/utils/statusUtils.js +22 -0
- package/package.json +6 -5
|
@@ -6,7 +6,7 @@ import React, { useCallback, useContext, useEffect, useState } from 'react';
|
|
|
6
6
|
import { Trans, useTranslation } from 'react-i18next';
|
|
7
7
|
import { CaseSearchQueryType } from '../../../enums/caseSearch';
|
|
8
8
|
import { createFilterStateFromAdvancedQuery, createUserFriendlyQueryFromFilterStateAdvancedSearch, } from '../../../utils/caseSearchUtils';
|
|
9
|
-
import { useCaseListStateContext } from '../CaseListContext';
|
|
9
|
+
// import { useCaseListStateContext } from '../CaseListContext';
|
|
10
10
|
import { CaseListFilterDispatchContext, CaseListFilterStateContext, initialPaginationInfo, } from '../CaseListFilterContext';
|
|
11
11
|
import { initialFilterInfo, updateFilterQuery, updateFilterState } from '../CaseListFilterReducer';
|
|
12
12
|
import { AdvanceSearch } from './AdvanceSearch';
|
|
@@ -21,7 +21,7 @@ export function CaseSearch(props) {
|
|
|
21
21
|
const [searchVal, setSearchVal] = useState(filterQueryInfo.queryString);
|
|
22
22
|
const [isAdvancedSearchValid, setIsAdvancedSearchValid] = useState(true);
|
|
23
23
|
const dispatch = useContext(CaseListFilterDispatchContext);
|
|
24
|
-
const { isFetching } = useCaseListStateContext();
|
|
24
|
+
// const { isFetching } = useCaseListStateContext();
|
|
25
25
|
const getType = useCallback(() => (filterQueryInfo === null || filterQueryInfo === void 0 ? void 0 : filterQueryInfo.type) || CaseSearchQueryType.BASIC, [filterQueryInfo === null || filterQueryInfo === void 0 ? void 0 : filterQueryInfo.type]);
|
|
26
26
|
// on queryString and parsedQuery change need to update search
|
|
27
27
|
useEffect(() => {
|
|
@@ -98,16 +98,16 @@ export function CaseSearch(props) {
|
|
|
98
98
|
React.createElement("div", { className: "case-search-input-container" },
|
|
99
99
|
React.createElement(SearchInput, { className: "pf-v6-u-w-100 case-search-input", placeholder: t('Search by keyword or case ID'), value: searchVal === null || searchVal === void 0 ? void 0 : searchVal.trim(), "data-tracking-id": "search-cases-text-input", id: "case-search-basic", "aria-label": t('Search by keyword or case ID'), onChange: (_event, val) => onSearchValChange(val), onClear: clearSearchVal }),
|
|
100
100
|
React.createElement(Button, { variant: "primary", type: "submit", className: "search-btn", "data-tracking-id": "case-list-search-button", isDisabled: isSearchButtonDisabled },
|
|
101
|
-
React.createElement(Trans, null, "Search"))
|
|
102
|
-
canUseAdvancedSearch && (React.createElement(Button, { variant: "link", onClick: () => onSearchTypeChange(CaseSearchQueryType.ADVANCED), isDisabled: isFetching, "data-tracking-id": "case-list-adv-toggle-button", className: "case-search-toggle secondary-button-pill" },
|
|
103
|
-
React.createElement(Trans, null, "Advanced"))))));
|
|
101
|
+
React.createElement(Trans, null, "Search")))));
|
|
104
102
|
};
|
|
103
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
105
104
|
const renderAdvanceSearch = () => {
|
|
106
105
|
return canUseAdvancedSearch ? (React.createElement(React.Fragment, null,
|
|
107
106
|
React.createElement(AdvanceSearch, { isSearchDisabled: isSearchButtonDisabled, onSearchValChange: onSearchValChange, onSearchClear: clearAdvancedSearchVal, onSearchSubmit: onCaseSearchAdvanced, onSearchTypeChange: onSearchTypeChange, onAdvancedSearchValidation: (isValid) => setIsAdvancedSearchValid(isValid) }))) : (renderBasicSearch());
|
|
108
107
|
};
|
|
108
|
+
void renderAdvanceSearch;
|
|
109
109
|
return (React.createElement(React.Fragment, null,
|
|
110
110
|
React.createElement("form", { onSubmit: handleSubmit, onKeyDown: handleSearchInputKeyDown },
|
|
111
|
-
React.createElement("div", { className: "form-group case-search-form-group" },
|
|
111
|
+
React.createElement("div", { className: "form-group case-search-form-group" }, renderBasicSearch())),
|
|
112
112
|
React.createElement(BookmarkedSearchesSelector, { currentCaseSearchString: searchVal === null || searchVal === void 0 ? void 0 : searchVal.trim(), currentSearchType: getType(), isAdvancedSearchValid: isAdvancedSearchValid, defaultSavedSearchName: props.defaultSavedSearchName })));
|
|
113
113
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAdvanceSearchParser.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-search/useAdvanceSearchParser.tsx"],"names":[],"mappings":"AASA,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,EAAE,MAAM,EAAE;;CAAA;
|
|
1
|
+
{"version":3,"file":"useAdvanceSearchParser.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-search/useAdvanceSearchParser.tsx"],"names":[],"mappings":"AASA,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,EAAE,MAAM,EAAE;;CAAA;yBAUzB,MAAM;6BAIF,MAAM;;EA+LzC"}
|
|
@@ -5,7 +5,8 @@ import { useEffect, useRef } from 'react';
|
|
|
5
5
|
import { SolrKeys } from '../../../enums/filters';
|
|
6
6
|
import { useCaseListStateContext } from '../CaseListContext';
|
|
7
7
|
export default function useAdvanceSearchParser({ onInit }) {
|
|
8
|
-
const
|
|
8
|
+
const caseListState = useCaseListStateContext();
|
|
9
|
+
const filterValuesFromFacetResponse = caseListState.filterValuesFromFacetResponse || {};
|
|
9
10
|
const { globalMetadataState: { caseGroups, loggedInUsersAccount, bookmarkedGroupAccounts, allCaseTypes }, } = useGlobalStateContext();
|
|
10
11
|
const parserRef = useRef(null);
|
|
11
12
|
const parse = (stringQuery) => {
|
package/lib/esm/css/caseList.css
CHANGED
|
@@ -186,11 +186,17 @@
|
|
|
186
186
|
.cases-main .case-search-table {
|
|
187
187
|
-ms-flex: 1;
|
|
188
188
|
flex-grow: 1;
|
|
189
|
-
display:
|
|
190
|
-
|
|
189
|
+
display: flex;
|
|
190
|
+
flex-direction: column;
|
|
191
|
+
min-width: 0;
|
|
191
192
|
border-radius: 0 0 16px !important;
|
|
192
193
|
}
|
|
193
194
|
|
|
195
|
+
.cases-main .case-search-table > .pf-v6-c-scroll-inner-wrapper {
|
|
196
|
+
overflow-x: auto;
|
|
197
|
+
flex: 1;
|
|
198
|
+
}
|
|
199
|
+
|
|
194
200
|
.case-search-bottom .case-list-table-toolbar {
|
|
195
201
|
-ms-flex-align: center;
|
|
196
202
|
align-items: center;
|
|
@@ -200,6 +206,10 @@
|
|
|
200
206
|
background-color: var(--pf-t--color--gray--10);
|
|
201
207
|
border-top: 1px solid var(--pf-t--global--border--color--100);
|
|
202
208
|
border-right: 1px solid var(--pf-t--global--border--color--100);
|
|
209
|
+
border-bottom: 1px solid var(--pf-t--global--border--color--100);
|
|
210
|
+
position: sticky;
|
|
211
|
+
top: 0;
|
|
212
|
+
z-index: 100;
|
|
203
213
|
}
|
|
204
214
|
|
|
205
215
|
.case-search-bottom .case-list-table-toolbar .toolbar-actions {
|
|
@@ -219,18 +229,21 @@
|
|
|
219
229
|
color: #06c !important;
|
|
220
230
|
}
|
|
221
231
|
|
|
222
|
-
.case-search-bottom .case-list-table-toolbar .toolbar-pagination button[disabled] {
|
|
223
|
-
color: #999;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
232
|
.case-search-bottom .case-list-table-toolbar button.pf-m-secondary:not([disabled]),
|
|
227
233
|
.case-search-bottom .case-list-table-toolbar button.pf-m-tertiary:not([disabled]),
|
|
228
234
|
.case-search-bottom .case-list-table-toolbar button.pf-m-control:not([disabled]) {
|
|
229
235
|
background-color: #fff;
|
|
230
236
|
}
|
|
231
237
|
|
|
238
|
+
.case-count-indicator {
|
|
239
|
+
font-size: 14px !important;
|
|
240
|
+
line-height: 1.5em;
|
|
241
|
+
white-space: nowrap;
|
|
242
|
+
padding-right: 1rem;
|
|
243
|
+
color: var(--pf-t--global--text--color--regular, #151515);
|
|
244
|
+
}
|
|
245
|
+
|
|
232
246
|
.cases-main .case-search-table .case-list-table {
|
|
233
|
-
border-top: 1px solid var(--pf-t--global--border--color--100);
|
|
234
247
|
border-right: 1px solid var(--pf-t--global--border--color--100);
|
|
235
248
|
border-bottom: 1px solid var(--pf-t--global--border--color--100);
|
|
236
249
|
}
|
|
@@ -277,17 +290,6 @@
|
|
|
277
290
|
text-transform: uppercase;
|
|
278
291
|
}
|
|
279
292
|
|
|
280
|
-
.case-search-bottom .case-search-table footer.toolbar-pagination {
|
|
281
|
-
margin-top: 0 !important;
|
|
282
|
-
border-right: 1px solid var(--pf-t--global--border--color--100);
|
|
283
|
-
border-bottom: 1px solid var(--pf-t--global--border--color--100);
|
|
284
|
-
border-radius: 16px !important;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
.case-search-bottom .case-search-table footer.toolbar-pagination > :first-child {
|
|
288
|
-
padding: 1rem;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
293
|
.case-search-bottom #case-filters-panel {
|
|
292
294
|
-ms-flex: 100%;
|
|
293
295
|
flex-basis: 100%;
|
|
@@ -300,11 +302,13 @@
|
|
|
300
302
|
border-right: 1px solid var(--pf-t--global--border--color--100);
|
|
301
303
|
border-bottom: 1px solid var(--pf-t--global--border--color--100);
|
|
302
304
|
border-radius: 0 0 0 16px;
|
|
305
|
+
align-self: stretch;
|
|
303
306
|
}
|
|
304
307
|
|
|
305
308
|
.case-search-filters .filter-header {
|
|
306
309
|
min-height: 4rem;
|
|
307
310
|
margin: 0;
|
|
311
|
+
padding: 0;
|
|
308
312
|
}
|
|
309
313
|
|
|
310
314
|
.case-search-filters .filter-header .pf-v6-svg {
|
|
@@ -349,6 +353,10 @@
|
|
|
349
353
|
font-size: 1rem;
|
|
350
354
|
font-weight: 600;
|
|
351
355
|
height: 4.3rem;
|
|
356
|
+
position: sticky;
|
|
357
|
+
top: 0;
|
|
358
|
+
z-index: 100;
|
|
359
|
+
background-color: #f2f2f2;
|
|
352
360
|
|
|
353
361
|
.pf-v6-c-button__icon.pf-m-end {
|
|
354
362
|
margin-right: -4px !important;
|
|
@@ -359,6 +367,8 @@
|
|
|
359
367
|
.filter-wrapper {
|
|
360
368
|
padding: 24px;
|
|
361
369
|
background-color: var(--pf-t--color--gray--10);
|
|
370
|
+
position: relative;
|
|
371
|
+
z-index: 0;
|
|
362
372
|
}
|
|
363
373
|
|
|
364
374
|
.filter-wrapper .filter-group > * {
|
|
@@ -413,10 +423,6 @@
|
|
|
413
423
|
.case-search-bottom .case-list-table-toolbar .toolbar-actions > * {
|
|
414
424
|
margin-bottom: 0;
|
|
415
425
|
}
|
|
416
|
-
|
|
417
|
-
.case-search-bottom .case-list-table-toolbar .toolbar-pagination {
|
|
418
|
-
margin-top: 0;
|
|
419
|
-
}
|
|
420
426
|
}
|
|
421
427
|
|
|
422
428
|
@media (min-width: 768px) {
|
|
@@ -645,3 +651,74 @@ th#product.pf-v6-c-table__th {
|
|
|
645
651
|
.case-list-table .pf-v6-c-table__button {
|
|
646
652
|
margin-bottom: 0px !important;
|
|
647
653
|
}
|
|
654
|
+
|
|
655
|
+
.skeleton-loader-row {
|
|
656
|
+
height: 62px;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
.skeleton-loader-row .skeleton-sentinel {
|
|
660
|
+
display: flex;
|
|
661
|
+
align-items: center;
|
|
662
|
+
height: 100%;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
.skeleton-loader-row .skeleton-bar {
|
|
666
|
+
display: block;
|
|
667
|
+
height: 24px;
|
|
668
|
+
border-radius: 4px;
|
|
669
|
+
background-color: #e0e0e0;
|
|
670
|
+
animation: skeleton-pulse 1.5s ease-in-out infinite;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
.skeleton-loader-row .skeleton-bar--checkbox {
|
|
674
|
+
display: inline-block;
|
|
675
|
+
width: 16px;
|
|
676
|
+
height: 16px;
|
|
677
|
+
border-radius: 3px;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
@keyframes skeleton-pulse {
|
|
681
|
+
0% {
|
|
682
|
+
opacity: 1;
|
|
683
|
+
}
|
|
684
|
+
50% {
|
|
685
|
+
opacity: 0.4;
|
|
686
|
+
}
|
|
687
|
+
100% {
|
|
688
|
+
opacity: 1;
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
.infinite-scroll-footer-message {
|
|
693
|
+
display: flex;
|
|
694
|
+
justify-content: center;
|
|
695
|
+
align-items: center;
|
|
696
|
+
gap: 8px;
|
|
697
|
+
padding: 12px 0;
|
|
698
|
+
position: sticky;
|
|
699
|
+
left: 0;
|
|
700
|
+
background-color: #fff;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
.infinite-scroll-footer-text,
|
|
704
|
+
.infinite-scroll-alert,
|
|
705
|
+
.infinite-scroll-alert * {
|
|
706
|
+
font-size: 14px !important;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
.infinite-scroll-footer-message .pf-v6-c-alert.pf-m-inline.pf-m-plain {
|
|
710
|
+
padding: 0;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
.infinite-scroll-footer-message .pf-v6-c-button.pf-m-link.pf-m-inline {
|
|
714
|
+
text-decoration: none;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
.infinite-scroll-retry-btn.pf-v6-c-button.pf-m-secondary {
|
|
718
|
+
border-radius: 999px;
|
|
719
|
+
padding: 8px 24px;
|
|
720
|
+
gap: 4px;
|
|
721
|
+
font-size: 14px;
|
|
722
|
+
font-weight: 400;
|
|
723
|
+
line-height: 1.5;
|
|
724
|
+
}
|
package/lib/esm/enums/case.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare enum CaseStatus {
|
|
|
9
9
|
export declare enum CaseSeverity {
|
|
10
10
|
Urgent = "1 - Urgent",
|
|
11
11
|
Important = "2 - Important",
|
|
12
|
-
|
|
12
|
+
Medium = "3 - Medium",
|
|
13
13
|
Low = "4 - Low"
|
|
14
14
|
}
|
|
15
15
|
export declare const caseListFields = "case_createdByName,case_createdDate,case_lastModifiedDate,case_lastModifiedByName,id,uri,case_summary,case_status,case_product,case_version,case_accountNumber,case_number,case_contactName,case_owner,case_severity,case_last_public_update_date,case_last_public_update_by,case_customer_escalation,case_folderName,case_closedDate";
|
|
@@ -56,6 +56,7 @@ export declare const caseListSortColumnIdsToSFDCMap: {
|
|
|
56
56
|
type: SFDCKeys;
|
|
57
57
|
closedDate: SFDCKeys;
|
|
58
58
|
};
|
|
59
|
+
export declare const caseListSortColumnIdsToGraphQLMap: Record<string, string>;
|
|
59
60
|
export declare const caseTableColumSortNamesMap: {
|
|
60
61
|
number: string;
|
|
61
62
|
summary: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"case.d.ts","sourceRoot":"","sources":["../../../src/enums/case.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE/C,oBAAY,UAAU;IAClB,iBAAiB,wBAAwB;IACzC,eAAe,uBAAuB;IACtC,IAAI,mBAAmB;IACvB,MAAM,WAAW;IACjB,GAAG,cAAc;CACpB;AAED,oBAAY,YAAY;IACpB,MAAM,eAAe;IACrB,SAAS,kBAAkB;IAC3B,MAAM,eAAe;IACrB,GAAG,YAAY;CAClB;AAED,eAAO,MAAM,cAAc,0UACgT,CAAC;AAE5U,oBAAY,iBAAiB;IACzB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,KAAK,gBAAgB;IACrB,OAAO,gBAAgB;IACvB,MAAM,WAAW;IACjB,QAAQ,qBAAqB;IAC7B,iBAAiB,YAAY;IAC7B,aAAa,kBAAkB;IAC/B,KAAK,eAAe;IACpB,eAAe,oBAAoB;IACnC,IAAI,SAAS;IACb,cAAc,eAAe;CAChC;AAED,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;CAa1C,CAAC;AAEF,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;CAa1C,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;CAatC,CAAC"}
|
|
1
|
+
{"version":3,"file":"case.d.ts","sourceRoot":"","sources":["../../../src/enums/case.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE/C,oBAAY,UAAU;IAClB,iBAAiB,wBAAwB;IACzC,eAAe,uBAAuB;IACtC,IAAI,mBAAmB;IACvB,MAAM,WAAW;IACjB,GAAG,cAAc;CACpB;AAED,oBAAY,YAAY;IACpB,MAAM,eAAe;IACrB,SAAS,kBAAkB;IAC3B,MAAM,eAAe;IACrB,GAAG,YAAY;CAClB;AAED,eAAO,MAAM,cAAc,0UACgT,CAAC;AAE5U,oBAAY,iBAAiB;IACzB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,KAAK,gBAAgB;IACrB,OAAO,gBAAgB;IACvB,MAAM,WAAW;IACjB,QAAQ,qBAAqB;IAC7B,iBAAiB,YAAY;IAC7B,aAAa,kBAAkB;IAC/B,KAAK,eAAe;IACpB,eAAe,oBAAoB;IACnC,IAAI,SAAS;IACb,cAAc,eAAe;CAChC;AAED,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;CAa1C,CAAC;AAEF,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;CAa1C,CAAC;AAGF,eAAO,MAAM,iCAAiC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAWpE,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;CAatC,CAAC"}
|
package/lib/esm/enums/case.js
CHANGED
|
@@ -11,7 +11,7 @@ export var CaseSeverity;
|
|
|
11
11
|
(function (CaseSeverity) {
|
|
12
12
|
CaseSeverity["Urgent"] = "1 - Urgent";
|
|
13
13
|
CaseSeverity["Important"] = "2 - Important";
|
|
14
|
-
CaseSeverity["
|
|
14
|
+
CaseSeverity["Medium"] = "3 - Medium";
|
|
15
15
|
CaseSeverity["Low"] = "4 - Low";
|
|
16
16
|
})(CaseSeverity || (CaseSeverity = {}));
|
|
17
17
|
export const caseListFields = 'case_createdByName,case_createdDate,case_lastModifiedDate,case_lastModifiedByName,id,uri,case_summary,case_status,case_product,case_version,case_accountNumber,case_number,case_contactName,case_owner,case_severity,case_last_public_update_date,case_last_public_update_by,case_customer_escalation,case_folderName,case_closedDate';
|
|
@@ -59,6 +59,19 @@ export const caseListSortColumnIdsToSFDCMap = {
|
|
|
59
59
|
[CaseListColumnIds.type]: SFDCKeys.caseType,
|
|
60
60
|
[CaseListColumnIds.caseClosedDate]: SFDCKeys.caseClosedDate,
|
|
61
61
|
};
|
|
62
|
+
// Maps CaseListColumnIds to GraphQL SalesforceSupportCase_OrderBy field paths
|
|
63
|
+
export const caseListSortColumnIdsToGraphQLMap = {
|
|
64
|
+
[CaseListColumnIds.caseId]: 'CaseNumber',
|
|
65
|
+
[CaseListColumnIds.summary]: 'Subject',
|
|
66
|
+
[CaseListColumnIds.severity]: 'Priority',
|
|
67
|
+
[CaseListColumnIds.owner]: 'OwnerId',
|
|
68
|
+
[CaseListColumnIds.created]: 'CreatedDate',
|
|
69
|
+
[CaseListColumnIds.status]: 'Status',
|
|
70
|
+
[CaseListColumnIds.modified]: 'LastModifiedDate',
|
|
71
|
+
[CaseListColumnIds.accountNumber]: 'Account_Number__c',
|
|
72
|
+
[CaseListColumnIds.type]: 'Type',
|
|
73
|
+
[CaseListColumnIds.caseClosedDate]: 'ClosedDate',
|
|
74
|
+
};
|
|
62
75
|
export const caseTableColumSortNamesMap = {
|
|
63
76
|
[CaseListColumnIds.caseId]: 'Case ID',
|
|
64
77
|
[CaseListColumnIds.summary]: 'Title',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExportCaseListCSV.d.ts","sourceRoot":"","sources":["../../../src/hooks/useExportCaseListCSV.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useExportCaseListCSV.d.ts","sourceRoot":"","sources":["../../../src/hooks/useExportCaseListCSV.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAIzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,eAAO,MAAM,SAAS,OAAO,CAAC;AAC9B,MAAM,WAAW,qBAAqB;IAClC,uBAAuB,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAC1D,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,aAAa,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,qBAAqB;;;;;;EA+BhE"}
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
import { useFetch } from '@rh-support/components';
|
|
2
1
|
import { useState } from 'react';
|
|
3
2
|
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import { getCaseListFromSolr } from '../utils/caseListUtils';
|
|
5
3
|
export const MAX_LIMIT = 1000;
|
|
6
4
|
export function useExportCaseListCSV(props) {
|
|
7
5
|
const { isExportCsvDisabled, selectedCases } = props;
|
|
8
6
|
const { t } = useTranslation();
|
|
9
|
-
// const currentFilteredCaseCount = currentFilteredCaseList?.numFound ?? 0;
|
|
10
|
-
const { isFetching } = useFetch(getCaseListFromSolr, { propgateErrors: true });
|
|
11
7
|
const [openUpdateSeverityModal, setOpenUpdateSeverityModal] = useState(false);
|
|
12
|
-
const isFetchingCSVData = isFetching;
|
|
13
8
|
let showError = selectedCases.length > MAX_LIMIT;
|
|
14
|
-
const isBtnDisabled =
|
|
15
|
-
// To show tooltip if export csv is disabled when SOLR is down
|
|
9
|
+
const isBtnDisabled = showError;
|
|
16
10
|
const getTooltipContent = () => {
|
|
17
11
|
let tooltipText = t('Your download will include the first 1000 cases in your list.');
|
|
18
12
|
if (showError) {
|
|
@@ -23,9 +17,7 @@ export function useExportCaseListCSV(props) {
|
|
|
23
17
|
}
|
|
24
18
|
return tooltipText;
|
|
25
19
|
};
|
|
26
|
-
// To check if export csv button is disabled
|
|
27
20
|
const isExportButtonDisabled = isBtnDisabled || isExportCsvDisabled;
|
|
28
|
-
// To toggle download csv modal
|
|
29
21
|
const toggleDownloadCSVModal = () => {
|
|
30
22
|
setOpenUpdateSeverityModal((openUpdateSeverityModal) => !openUpdateSeverityModal);
|
|
31
23
|
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ApolloClient } from '@apollo/client';
|
|
2
|
+
import { ICaseListItem } from '@rh-support/utils';
|
|
3
|
+
import { ICaseListFilterState } from '../components/case-list/CaseListFilterReducer';
|
|
4
|
+
export interface IGraphQLCaseListResponse {
|
|
5
|
+
caseListResponse: {
|
|
6
|
+
response: {
|
|
7
|
+
docs: ICaseListItem[];
|
|
8
|
+
numFound: number;
|
|
9
|
+
start: number;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
showErrorMessage: boolean;
|
|
13
|
+
hasNextPage: boolean;
|
|
14
|
+
endCursor: string | undefined;
|
|
15
|
+
}
|
|
16
|
+
export declare function clearPageCursors(): void;
|
|
17
|
+
export declare function getCaseListFromGraphQL(filterState: ICaseListFilterState, apolloClient: ApolloClient, limitOverride?: number, signal?: AbortSignal, selectedCaseNumbers?: string[]): Promise<IGraphQLCaseListResponse>;
|
|
18
|
+
export interface ILoadMoreResult {
|
|
19
|
+
docs: ICaseListItem[];
|
|
20
|
+
hasNextPage: boolean;
|
|
21
|
+
endCursor: string | undefined;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Fetches the next page of cases for infinite scroll.
|
|
25
|
+
* Uses the provided `afterCursor` instead of the page-based cursor store.
|
|
26
|
+
*/
|
|
27
|
+
export declare function loadMoreCases(filterState: ICaseListFilterState, apolloClient: ApolloClient, afterCursor: string, signal?: AbortSignal): Promise<ILoadMoreResult>;
|
|
28
|
+
//# sourceMappingURL=caseListGraphQLUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"caseListGraphQLUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/caseListGraphQLUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAIH,aAAa,EAEhB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,oBAAoB,EAAkB,MAAM,+CAA+C,CAAC;AASrG,MAAM,WAAW,wBAAwB;IACrC,gBAAgB,EAAE;QACd,QAAQ,EAAE;YACN,IAAI,EAAE,aAAa,EAAE,CAAC;YACtB,QAAQ,EAAE,MAAM,CAAC;YACjB,KAAK,EAAE,MAAM,CAAC;SACjB,CAAC;KACL,CAAC;IACF,gBAAgB,EAAE,OAAO,CAAC;IAC1B,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC;AAsBD,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC;AAkFD,wBAAsB,sBAAsB,CACxC,WAAW,EAAE,oBAAoB,EACjC,YAAY,EAAE,YAAY,EAC1B,aAAa,CAAC,EAAE,MAAM,EACtB,MAAM,CAAC,EAAE,WAAW,EACpB,mBAAmB,CAAC,EAAE,MAAM,EAAE,GAC/B,OAAO,CAAC,wBAAwB,CAAC,CAuFnC;AAED,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,aAAa,EAAE,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAC/B,WAAW,EAAE,oBAAoB,EACjC,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,WAAW,GACrB,OAAO,CAAC,eAAe,CAAC,CA0C1B"}
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { GET_CASES_BY_FILTERS, GET_PRODUCTS, GET_USER_IDS_BY_FEDERATION, } from '@rh-support/utils';
|
|
11
|
+
import { SolrKeys, SolrPivotKeys } from '../enums/filters';
|
|
12
|
+
import { mapGraphQLResponseToCaseList } from './caseListMapper';
|
|
13
|
+
import { createGraphQLVariablesFromFilterState, getOwnerFederationIdsToResolve, } from './caseListVariablesBuilder';
|
|
14
|
+
function resolveOwnerUserIds(federationIds, apolloClient) {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
var _a, _b, _c;
|
|
17
|
+
if (!federationIds.length)
|
|
18
|
+
return [];
|
|
19
|
+
try {
|
|
20
|
+
const { data } = yield apolloClient.query({
|
|
21
|
+
query: GET_USER_IDS_BY_FEDERATION,
|
|
22
|
+
variables: { federationIds },
|
|
23
|
+
fetchPolicy: 'network-only',
|
|
24
|
+
});
|
|
25
|
+
const edges = ((_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.salesforce_support_uiapi) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.SalesforceSupportUser) === null || _c === void 0 ? void 0 : _c.edges) || [];
|
|
26
|
+
return edges.map((edge) => edge.node.Id);
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
console.error('[GraphQL] Failed to resolve owner user IDs:', error);
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const pageCursors = new Map();
|
|
35
|
+
export function clearPageCursors() {
|
|
36
|
+
pageCursors.clear();
|
|
37
|
+
}
|
|
38
|
+
function getCursorForPage(page) {
|
|
39
|
+
var _a;
|
|
40
|
+
if (page <= 1)
|
|
41
|
+
return undefined;
|
|
42
|
+
return (_a = pageCursors.get(page)) !== null && _a !== void 0 ? _a : undefined;
|
|
43
|
+
}
|
|
44
|
+
function storeEndCursor(currentPage, endCursor) {
|
|
45
|
+
pageCursors.set(currentPage + 1, endCursor);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Resolves missing Product2 IDs for product/version filters loaded from URL.
|
|
49
|
+
* When filters come from the UI, IDs are already set by ProductsFilter/VersionsFilter.
|
|
50
|
+
* When filters come from a URL (which only contains product/version names), this function
|
|
51
|
+
* queries GraphQL to resolve names → IDs so buildProductFilter can construct the where clause.
|
|
52
|
+
* Uses cache-first policy to avoid redundant network calls.
|
|
53
|
+
*/
|
|
54
|
+
function resolveVersionProductIds(filterState, apolloClient) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
57
|
+
const products = (_a = filterState.filterInfo) === null || _a === void 0 ? void 0 : _a[SolrPivotKeys.product_version];
|
|
58
|
+
if (!(products === null || products === void 0 ? void 0 : products.length))
|
|
59
|
+
return;
|
|
60
|
+
for (const product of products) {
|
|
61
|
+
// Resolve parent product ID by name (only needed for URL-based filters)
|
|
62
|
+
if (!product.productId) {
|
|
63
|
+
try {
|
|
64
|
+
const { data: prodData } = yield apolloClient.query({
|
|
65
|
+
query: GET_PRODUCTS,
|
|
66
|
+
variables: {
|
|
67
|
+
where: { Name: { eq: product.value }, IsActive: { eq: true } },
|
|
68
|
+
first: 1,
|
|
69
|
+
},
|
|
70
|
+
fetchPolicy: 'cache-first',
|
|
71
|
+
});
|
|
72
|
+
const parentEdges = (_e = (_d = (_c = (_b = prodData === null || prodData === void 0 ? void 0 : prodData.salesforce_support_uiapi) === null || _b === void 0 ? void 0 : _b.query) === null || _c === void 0 ? void 0 : _c.SalesforceSupportProduct2) === null || _d === void 0 ? void 0 : _d.edges) !== null && _e !== void 0 ? _e : [];
|
|
73
|
+
if (parentEdges.length > 0) {
|
|
74
|
+
product.productId = parentEdges[0].node.Id;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
catch (_k) {
|
|
78
|
+
// continue without parent ID
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const versions = product[SolrKeys.version];
|
|
82
|
+
if (!(versions === null || versions === void 0 ? void 0 : versions.length) || !product.productId)
|
|
83
|
+
continue;
|
|
84
|
+
const hasUnresolvedVersions = versions.some((v) => v.productId === undefined || v.productId === null);
|
|
85
|
+
if (!hasUnresolvedVersions)
|
|
86
|
+
continue;
|
|
87
|
+
// Fetch child products for this parent and match version names to their Product2 IDs
|
|
88
|
+
try {
|
|
89
|
+
const { data } = yield apolloClient.query({
|
|
90
|
+
query: GET_PRODUCTS,
|
|
91
|
+
variables: {
|
|
92
|
+
where: { ParentProduct__c: { eq: product.productId }, IsActive: { eq: true } },
|
|
93
|
+
first: 200,
|
|
94
|
+
orderBy: { Name: { order: 'ASC' } },
|
|
95
|
+
},
|
|
96
|
+
fetchPolicy: 'cache-first',
|
|
97
|
+
});
|
|
98
|
+
const edges = (_j = (_h = (_g = (_f = data === null || data === void 0 ? void 0 : data.salesforce_support_uiapi) === null || _f === void 0 ? void 0 : _f.query) === null || _g === void 0 ? void 0 : _g.SalesforceSupportProduct2) === null || _h === void 0 ? void 0 : _h.edges) !== null && _j !== void 0 ? _j : [];
|
|
99
|
+
const childProducts = edges.map((edge) => ({
|
|
100
|
+
id: edge.node.Id,
|
|
101
|
+
name: edge.node.Name.value,
|
|
102
|
+
}));
|
|
103
|
+
versions.forEach((ver) => {
|
|
104
|
+
if (ver.productId)
|
|
105
|
+
return;
|
|
106
|
+
const match = childProducts.find((cp) => cp.name === ver.value || cp.name.endsWith(ver.value));
|
|
107
|
+
if (match) {
|
|
108
|
+
ver.productId = match.id;
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
console.error('[GraphQL] Failed to resolve version product IDs:', error);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
export function getCaseListFromGraphQL(filterState, apolloClient, limitOverride, signal, selectedCaseNumbers) {
|
|
119
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
120
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
121
|
+
try {
|
|
122
|
+
yield resolveVersionProductIds(filterState, apolloClient);
|
|
123
|
+
const federationIdsToResolve = getOwnerFederationIdsToResolve(filterState);
|
|
124
|
+
let resolvedUserIds;
|
|
125
|
+
if (federationIdsToResolve.length) {
|
|
126
|
+
const ownerUserIds = yield resolveOwnerUserIds(federationIdsToResolve, apolloClient);
|
|
127
|
+
resolvedUserIds = { ownerUserIds };
|
|
128
|
+
}
|
|
129
|
+
const variables = yield createGraphQLVariablesFromFilterState(filterState, apolloClient, resolvedUserIds);
|
|
130
|
+
if (limitOverride) {
|
|
131
|
+
variables.first = limitOverride;
|
|
132
|
+
}
|
|
133
|
+
const currentPage = ((_a = filterState.paginationInfo) === null || _a === void 0 ? void 0 : _a.currentPage) || 1;
|
|
134
|
+
if (selectedCaseNumbers === null || selectedCaseNumbers === void 0 ? void 0 : selectedCaseNumbers.length) {
|
|
135
|
+
const caseNumberFilter = { CaseNumber__c: { in: selectedCaseNumbers } };
|
|
136
|
+
variables.first = selectedCaseNumbers.length;
|
|
137
|
+
if ((_b = variables.where) === null || _b === void 0 ? void 0 : _b.and) {
|
|
138
|
+
variables.where.and.push(caseNumberFilter);
|
|
139
|
+
}
|
|
140
|
+
else if (variables.where) {
|
|
141
|
+
variables.where = { and: [variables.where, caseNumberFilter] };
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
variables.where = caseNumberFilter;
|
|
145
|
+
}
|
|
146
|
+
variables.after = undefined;
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
variables.after = getCursorForPage(currentPage);
|
|
150
|
+
}
|
|
151
|
+
const { data, error } = yield apolloClient.query({
|
|
152
|
+
query: GET_CASES_BY_FILTERS,
|
|
153
|
+
variables,
|
|
154
|
+
fetchPolicy: 'network-only',
|
|
155
|
+
context: signal ? { fetchOptions: { signal } } : undefined,
|
|
156
|
+
});
|
|
157
|
+
const connection = (_d = (_c = data === null || data === void 0 ? void 0 : data.salesforce_support_uiapi) === null || _c === void 0 ? void 0 : _c.query) === null || _d === void 0 ? void 0 : _d.SalesforceSupportCase;
|
|
158
|
+
if (!connection) {
|
|
159
|
+
return {
|
|
160
|
+
caseListResponse: { response: { docs: [], numFound: 0, start: 0 } },
|
|
161
|
+
showErrorMessage: !!error,
|
|
162
|
+
hasNextPage: false,
|
|
163
|
+
endCursor: undefined,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
if ((_e = connection.pageInfo) === null || _e === void 0 ? void 0 : _e.endCursor) {
|
|
167
|
+
storeEndCursor(currentPage, connection.pageInfo.endCursor);
|
|
168
|
+
}
|
|
169
|
+
const docs = mapGraphQLResponseToCaseList(connection.edges || []);
|
|
170
|
+
return {
|
|
171
|
+
caseListResponse: {
|
|
172
|
+
response: {
|
|
173
|
+
docs,
|
|
174
|
+
numFound: connection.totalCount || 0,
|
|
175
|
+
start: 0,
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
showErrorMessage: false,
|
|
179
|
+
hasNextPage: (_g = (_f = connection.pageInfo) === null || _f === void 0 ? void 0 : _f.hasNextPage) !== null && _g !== void 0 ? _g : false,
|
|
180
|
+
endCursor: (_j = (_h = connection.pageInfo) === null || _h === void 0 ? void 0 : _h.endCursor) !== null && _j !== void 0 ? _j : undefined,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
catch (error) {
|
|
184
|
+
if ((error === null || error === void 0 ? void 0 : error.name) === 'AbortError' || ((_k = error === null || error === void 0 ? void 0 : error.message) === null || _k === void 0 ? void 0 : _k.includes('aborted')) || (signal === null || signal === void 0 ? void 0 : signal.aborted)) {
|
|
185
|
+
return {
|
|
186
|
+
caseListResponse: { response: { docs: [], numFound: 0, start: 0 } },
|
|
187
|
+
showErrorMessage: false,
|
|
188
|
+
hasNextPage: false,
|
|
189
|
+
endCursor: undefined,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
console.error('[GraphQL] getCaseListFromGraphQL error:', error);
|
|
193
|
+
return {
|
|
194
|
+
caseListResponse: { response: { docs: [], numFound: 0, start: 0 } },
|
|
195
|
+
showErrorMessage: true,
|
|
196
|
+
hasNextPage: false,
|
|
197
|
+
endCursor: undefined,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Fetches the next page of cases for infinite scroll.
|
|
204
|
+
* Uses the provided `afterCursor` instead of the page-based cursor store.
|
|
205
|
+
*/
|
|
206
|
+
export function loadMoreCases(filterState, apolloClient, afterCursor, signal) {
|
|
207
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
208
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
209
|
+
try {
|
|
210
|
+
yield resolveVersionProductIds(filterState, apolloClient);
|
|
211
|
+
const federationIdsToResolve = getOwnerFederationIdsToResolve(filterState);
|
|
212
|
+
let resolvedUserIds;
|
|
213
|
+
if (federationIdsToResolve.length) {
|
|
214
|
+
const ownerUserIds = yield resolveOwnerUserIds(federationIdsToResolve, apolloClient);
|
|
215
|
+
resolvedUserIds = { ownerUserIds };
|
|
216
|
+
}
|
|
217
|
+
const variables = yield createGraphQLVariablesFromFilterState(filterState, apolloClient, resolvedUserIds);
|
|
218
|
+
variables.after = afterCursor;
|
|
219
|
+
const { data } = yield apolloClient.query({
|
|
220
|
+
query: GET_CASES_BY_FILTERS,
|
|
221
|
+
variables,
|
|
222
|
+
fetchPolicy: 'network-only',
|
|
223
|
+
context: signal ? { fetchOptions: { signal } } : undefined,
|
|
224
|
+
});
|
|
225
|
+
const connection = (_b = (_a = data === null || data === void 0 ? void 0 : data.salesforce_support_uiapi) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.SalesforceSupportCase;
|
|
226
|
+
if (!connection) {
|
|
227
|
+
return { docs: [], hasNextPage: false, endCursor: undefined };
|
|
228
|
+
}
|
|
229
|
+
const docs = mapGraphQLResponseToCaseList(connection.edges || []);
|
|
230
|
+
return {
|
|
231
|
+
docs,
|
|
232
|
+
hasNextPage: (_d = (_c = connection.pageInfo) === null || _c === void 0 ? void 0 : _c.hasNextPage) !== null && _d !== void 0 ? _d : false,
|
|
233
|
+
endCursor: (_f = (_e = connection.pageInfo) === null || _e === void 0 ? void 0 : _e.endCursor) !== null && _f !== void 0 ? _f : undefined,
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
catch (error) {
|
|
237
|
+
if ((error === null || error === void 0 ? void 0 : error.name) === 'AbortError' || ((_g = error === null || error === void 0 ? void 0 : error.message) === null || _g === void 0 ? void 0 : _g.includes('aborted')) || (signal === null || signal === void 0 ? void 0 : signal.aborted)) {
|
|
238
|
+
return { docs: [], hasNextPage: false, endCursor: undefined };
|
|
239
|
+
}
|
|
240
|
+
console.error('[GraphQL] loadMoreCases error:', error);
|
|
241
|
+
throw error;
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ICaseListItem, IGqlCaseNode } from '@rh-support/utils';
|
|
2
|
+
export declare function mapGraphQLCaseToCaseListItem(node: IGqlCaseNode): ICaseListItem;
|
|
3
|
+
export declare function mapGraphQLResponseToCaseList(edges: Array<{
|
|
4
|
+
node: IGqlCaseNode;
|
|
5
|
+
}>): ICaseListItem[];
|
|
6
|
+
//# sourceMappingURL=caseListMapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"caseListMapper.d.ts","sourceRoot":"","sources":["../../../src/utils/caseListMapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEhE,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,YAAY,GAAG,aAAa,CAgC9E;AAED,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,CAAC,GAAG,aAAa,EAAE,CAElG"}
|