@rh-support/cases 2.6.185 → 2.6.187
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.map +1 -1
- package/lib/esm/components/case-list/CaseList.js +85 -38
- package/lib/esm/components/case-list/CaseListFilterContext.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListFilterContext.js +2 -1
- package/lib/esm/components/case-list/CaseListFilterHelpers.d.ts +3 -2
- package/lib/esm/components/case-list/CaseListFilterHelpers.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListFilterHelpers.js +19 -6
- package/lib/esm/components/case-list/CaseListFilterReducer.d.ts +29 -0
- package/lib/esm/components/case-list/CaseListFilterReducer.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListFilterReducer.js +1 -0
- 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 +5 -0
- 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 +5 -1
- 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 +1 -2
- 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 +3 -0
- package/lib/esm/components/case-list/case-list-filters/GroupsFilter.d.ts +11 -1
- 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 +116 -71
- 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 +1 -29
- 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 +11 -5
- package/lib/esm/components/case-list/case-search/AdvanceSearch.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-search/AdvanceSearch.js +1 -1
- package/lib/esm/components/case-list/case-search/AdvanceSearchToggleButton.d.ts +8 -0
- package/lib/esm/components/case-list/case-search/AdvanceSearchToggleButton.d.ts.map +1 -0
- package/lib/esm/components/case-list/case-search/AdvanceSearchToggleButton.js +8 -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 +51 -20
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAccountSection.d.ts +10 -0
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAccountSection.d.ts.map +1 -0
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAccountSection.js +29 -0
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAuditsSection.d.ts +10 -0
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAuditsSection.d.ts.map +1 -0
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAuditsSection.js +16 -0
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchCaseSection.d.ts +9 -0
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchCaseSection.d.ts.map +1 -0
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchCaseSection.js +21 -0
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchDateRangeField.d.ts +12 -0
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchDateRangeField.d.ts.map +1 -0
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchDateRangeField.js +31 -0
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchFieldBlock.d.ts +10 -0
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchFieldBlock.d.ts.map +1 -0
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchFieldBlock.js +10 -0
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchModal.d.ts +10 -0
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchModal.d.ts.map +1 -0
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchModal.js +92 -0
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchOwnerSection.d.ts +9 -0
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchOwnerSection.d.ts.map +1 -0
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchOwnerSection.js +20 -0
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchProductSection.d.ts +9 -0
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchProductSection.d.ts.map +1 -0
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchProductSection.js +28 -0
- package/lib/esm/components/case-list/case-search/advance-search-modal/ProductVersionDrilldownSelect.d.ts +9 -0
- package/lib/esm/components/case-list/case-search/advance-search-modal/ProductVersionDrilldownSelect.d.ts.map +1 -0
- package/lib/esm/components/case-list/case-search/advance-search-modal/ProductVersionDrilldownSelect.js +241 -0
- package/lib/esm/components/case-list/case-search/advance-search-modal/SelectableLabelFilter.d.ts +11 -0
- package/lib/esm/components/case-list/case-search/advance-search-modal/SelectableLabelFilter.d.ts.map +1 -0
- package/lib/esm/components/case-list/case-search/advance-search-modal/SelectableLabelFilter.js +23 -0
- package/lib/esm/css/caseList.css +13 -1
- package/lib/esm/css/caseSearch.css +114 -0
- package/lib/esm/enums/caseSearch.d.ts +1 -0
- package/lib/esm/enums/caseSearch.d.ts.map +1 -1
- package/lib/esm/enums/caseSearch.js +1 -1
- package/lib/esm/hooks/useFilterStateOnLoad.d.ts +1 -1
- package/lib/esm/hooks/useFilterStateOnLoad.d.ts.map +1 -1
- package/lib/esm/utils/advanceSearchFormMapper.d.ts +11 -0
- package/lib/esm/utils/advanceSearchFormMapper.d.ts.map +1 -0
- package/lib/esm/utils/advanceSearchFormMapper.js +71 -0
- package/lib/esm/utils/advanceSearchUtils.d.ts +24 -0
- package/lib/esm/utils/advanceSearchUtils.d.ts.map +1 -0
- package/lib/esm/utils/advanceSearchUtils.js +149 -0
- package/lib/esm/utils/caseListGraphQLUtils.d.ts.map +1 -1
- package/lib/esm/utils/caseListGraphQLUtils.js +55 -19
- package/lib/esm/utils/caseListMapper.js +4 -4
- package/lib/esm/utils/caseListVariablesBuilder.d.ts +1 -0
- package/lib/esm/utils/caseListVariablesBuilder.d.ts.map +1 -1
- package/lib/esm/utils/caseListVariablesBuilder.js +240 -34
- package/lib/esm/utils/caseSearchUtils.d.ts.map +1 -1
- package/lib/esm/utils/caseSearchUtils.js +5 -2
- package/lib/esm/utils/constants.d.ts +2 -0
- package/lib/esm/utils/constants.d.ts.map +1 -1
- package/lib/esm/utils/constants.js +6 -0
- package/package.json +7 -8
package/lib/esm/components/case-list/case-search/advance-search-modal/SelectableLabelFilter.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Button, Flex, Label } from '@patternfly/react-core';
|
|
2
|
+
import CloseIcon from '@patternfly/react-icons/dist/esm/icons/close-icon';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { AdvanceSearchFieldBlock } from './AdvanceSearchFieldBlock';
|
|
6
|
+
export function SelectableLabelFilter({ label, options, selected, onChange, sectionId }) {
|
|
7
|
+
const { t } = useTranslation();
|
|
8
|
+
const toggleOption = (option) => {
|
|
9
|
+
if (selected.includes(option)) {
|
|
10
|
+
onChange(selected.filter((value) => value !== option));
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
onChange([...selected, option]);
|
|
14
|
+
};
|
|
15
|
+
const clearSelection = () => onChange([]);
|
|
16
|
+
return (React.createElement(AdvanceSearchFieldBlock, { label: React.createElement(React.Fragment, null,
|
|
17
|
+
label,
|
|
18
|
+
selected.length > 0 ? ` (${selected.length})` : ''), headerActions: selected.length > 0 ? (React.createElement(Button, { variant: "plain", onClick: clearSelection, "aria-label": t('Clear {{label}} selection', { label }), icon: React.createElement(CloseIcon, { "aria-hidden": true }), className: "pf-v6-u-p-0" })) : undefined },
|
|
19
|
+
React.createElement(Flex, { flexWrap: { default: 'wrap' }, spaceItems: { default: 'spaceItemsSm' }, rowGap: { default: 'rowGapSm' } }, options.map((option) => {
|
|
20
|
+
const isSelected = selected.includes(option);
|
|
21
|
+
return (React.createElement(Label, { key: option, color: isSelected ? 'blue' : 'grey', variant: isSelected ? 'filled' : 'outline', isCompact: true, onClick: () => toggleOption(option), id: `${sectionId}-${option.replace(/\s+/g, '-')}` }, option));
|
|
22
|
+
}))));
|
|
23
|
+
}
|
package/lib/esm/css/caseList.css
CHANGED
|
@@ -717,8 +717,20 @@ th#product.pf-v6-c-table__th {
|
|
|
717
717
|
.infinite-scroll-retry-btn.pf-v6-c-button.pf-m-secondary {
|
|
718
718
|
border-radius: 999px;
|
|
719
719
|
padding: 8px 24px;
|
|
720
|
-
gap:
|
|
720
|
+
gap: 6px;
|
|
721
721
|
font-size: 14px;
|
|
722
722
|
font-weight: 400;
|
|
723
723
|
line-height: 1.5;
|
|
724
|
+
display: inline-flex;
|
|
725
|
+
align-items: center;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
.infinite-scroll-retry-btn .pf-v6-c-button__icon {
|
|
729
|
+
display: inline-flex;
|
|
730
|
+
align-items: center;
|
|
731
|
+
line-height: 0;
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
.infinite-scroll-retry-btn .pf-v6-c-button__icon svg {
|
|
735
|
+
vertical-align: middle;
|
|
724
736
|
}
|
|
@@ -42,6 +42,102 @@
|
|
|
42
42
|
min-width: 30rem;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
.case-search-form-group,
|
|
46
|
+
.case-search-input-container,
|
|
47
|
+
.cases-main .case-search-top .search-wrapper,
|
|
48
|
+
.cases-main .case-search-top .search-wrapper form,
|
|
49
|
+
.cases-main .case-search-top {
|
|
50
|
+
overflow: visible;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.advance-search-panel-container {
|
|
54
|
+
position: relative;
|
|
55
|
+
flex-shrink: 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.case-search-form-group .advance-search-toggle-btn.pf-v6-c-button {
|
|
59
|
+
border-radius: var(--pf-t--global--border--radius--pill);
|
|
60
|
+
flex-shrink: 0;
|
|
61
|
+
margin-left: 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.advance-search-panel-container:has(.advance-search-modal) {
|
|
65
|
+
z-index: var(--pf-t--global--z-index--xl);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.advance-search-modal-backdrop {
|
|
69
|
+
position: fixed;
|
|
70
|
+
inset: 0;
|
|
71
|
+
z-index: 0;
|
|
72
|
+
background-color: transparent;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.pf-v6-c-modal-box.advance-search-modal {
|
|
76
|
+
position: absolute;
|
|
77
|
+
top: calc(100% + var(--pf-t--global--spacer--sm, 8px));
|
|
78
|
+
right: 0;
|
|
79
|
+
z-index: 1;
|
|
80
|
+
margin: 0;
|
|
81
|
+
width: 360px;
|
|
82
|
+
max-width: min(400px, calc(100vw - var(--pf-t--global--spacer--lg, 24px)));
|
|
83
|
+
max-height: min(70vh, calc(100dvh - var(--pf-t--global--spacer--2xl, 48px)));
|
|
84
|
+
border-radius: 0;
|
|
85
|
+
--pf-v6-c-modal-box--BorderRadius: 0;
|
|
86
|
+
--pf-v6-c-modal-box--Width: 400px;
|
|
87
|
+
display: flex;
|
|
88
|
+
flex-direction: column;
|
|
89
|
+
overflow: hidden;
|
|
90
|
+
min-height: 0;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.pf-v6-c-modal-box.advance-search-modal > .pf-v6-c-modal-box__body {
|
|
94
|
+
flex: 1 1 auto;
|
|
95
|
+
min-height: 0;
|
|
96
|
+
overflow: auto;
|
|
97
|
+
-ms-overflow-style: none;
|
|
98
|
+
scrollbar-width: none;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.pf-v6-c-modal-box.advance-search-modal > .pf-v6-c-modal-box__body::-webkit-scrollbar {
|
|
102
|
+
display: none;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.pf-v6-c-modal-box.advance-search-modal > .pf-v6-c-modal-box__footer {
|
|
106
|
+
flex: 0 0 auto;
|
|
107
|
+
width: 100%;
|
|
108
|
+
background-color: var(--pf-v6-c-modal-box--BackgroundColor);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.advance-search-modal .pf-v6-c-expandable-section__toggle .pf-v6-c-button.pf-m-link {
|
|
112
|
+
--pf-v6-c-button--m-link--Color: var(--pf-t--global--text--color--regular, #151515);
|
|
113
|
+
--pf-v6-c-button--m-link--hover--Color: var(--pf-t--global--text--color--regular, #151515);
|
|
114
|
+
--pf-v6-c-button--m-link--visited--Color: var(--pf-t--global--text--color--regular, #151515);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.advance-search-modal .advance-search-expandable-section {
|
|
118
|
+
--pf-v6-c-expandable-section--Gap: 0;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.advance-search-modal .advance-search-expandable-section .pf-v6-c-expandable-section__toggle {
|
|
122
|
+
padding-inline: var(--pf-t--global--spacer--md);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.advance-search-modal .advance-search-expandable-section .pf-v6-c-expandable-section__content {
|
|
126
|
+
padding-inline: 0;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.advance-search-product-version-search .pf-v6-c-search-input {
|
|
130
|
+
width: 100%;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.advance-search-product-menu-item-badge.pf-v6-c-badge {
|
|
134
|
+
--pf-v6-c-badge--BorderRadius: var(--pf-t--global--border--radius--pill);
|
|
135
|
+
--pf-v6-c-badge--Color: var(--pf-t--global--text--color--on-brand--default);
|
|
136
|
+
--pf-v6-c-badge--BackgroundColor: var(--pf-t--global--color--brand--default);
|
|
137
|
+
font-size: var(--pf-t--global--font--size--body--sm);
|
|
138
|
+
min-width: 1.25rem;
|
|
139
|
+
}
|
|
140
|
+
|
|
45
141
|
.case-search-form-group .filter-save-success-msg {
|
|
46
142
|
color: var(--pf-v5-global--success-color--200);
|
|
47
143
|
padding: 6px 0px;
|
|
@@ -59,3 +155,21 @@
|
|
|
59
155
|
margin-left: 0.5rem;
|
|
60
156
|
}
|
|
61
157
|
}
|
|
158
|
+
|
|
159
|
+
.advance-search-modal .advance-search-dropdown-toggle-content {
|
|
160
|
+
gap: var(--pf-t--global--spacer--sm);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.advance-search-modal .advance-search-dropdown-toggle-badge-wrap {
|
|
164
|
+
flex-shrink: 0;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.advance-search-modal .advance-search-dropdown-toggle-badge.pf-v6-c-badge,
|
|
168
|
+
.advance-search-modal .pf-v6-c-text-input-group .advance-search-dropdown-toggle-badge.pf-v6-c-badge {
|
|
169
|
+
--pf-v6-c-badge--BorderRadius: var(--pf-t--global--border--radius--pill);
|
|
170
|
+
--pf-v6-c-badge--Color: var(--pf-t--global--text--color--on-brand--default);
|
|
171
|
+
--pf-v6-c-badge--BackgroundColor: var(--pf-t--global--color--brand--default);
|
|
172
|
+
font-size: var(--pf-t--global--font--size--body--sm);
|
|
173
|
+
font-weight: var(--pf-t--global--font--weight--body--bold);
|
|
174
|
+
padding-inline: var(--pf-t--global--spacer--sm);
|
|
175
|
+
}
|
|
@@ -33,6 +33,7 @@ export declare const advanceSearchFieldNameToSolrFieldMapping: {
|
|
|
33
33
|
case_description: string;
|
|
34
34
|
case_summary: string;
|
|
35
35
|
case_alternate_id: string;
|
|
36
|
+
case_openshift_cluster_id: string;
|
|
36
37
|
case_closedDate: string;
|
|
37
38
|
case_product: string;
|
|
38
39
|
case_status: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"caseSearch.d.ts","sourceRoot":"","sources":["../../../src/enums/caseSearch.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,4BAA4B,KAAK,CAAC;AAE/C,oBAAY,mBAAmB;IAC3B,KAAK,UAAU;IACf,QAAQ,aAAa;CACxB;AAED,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;CAavC,CAAC;AAEF,eAAO,MAAM,wCAAwC
|
|
1
|
+
{"version":3,"file":"caseSearch.d.ts","sourceRoot":"","sources":["../../../src/enums/caseSearch.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,4BAA4B,KAAK,CAAC;AAE/C,oBAAY,mBAAmB;IAC3B,KAAK,UAAU;IACf,QAAQ,aAAa;CACxB;AAED,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;CAavC,CAAC;AAEF,eAAO,MAAM,wCAAwC;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmBpD,CAAC"}
|
|
@@ -19,4 +19,4 @@ export const fieldNameToSolrFieldMapping = {
|
|
|
19
19
|
[SolrKeys.type]: 'supportType',
|
|
20
20
|
[SolrKeys.isPrivate]: 'private',
|
|
21
21
|
};
|
|
22
|
-
export const advanceSearchFieldNameToSolrFieldMapping = Object.assign(Object.assign({}, fieldNameToSolrFieldMapping), { [SolrKeys.fts]: 'FTS', [SolrKeys.cep]: 'CEP', [SolrKeys.accountName]: 'accountName', [SolrKeys.caseNumber]: 'caseNumber', [SolrKeys.caseOwner]: 'ownerSSO', [SolrKeys.modifiedBy]: 'lastModifiedByName', [SolrKeys.createdBySsoUsername]: 'createdBySSO', [SolrKeys.createdBy]: 'createdByName', [SolrKeys.contactName]: 'contactName', [SolrKeys.caseContactSSO]: 'contactSSO', [SolrKeys.modifiedDate]: 'lastModifiedDate', [SolrKeys.createdDate]: 'createdDate', [SolrKeys.description]: 'description', [SolrKeys.caseSummary]: 'summary', [SolrKeys.alternateId]: 'personalReferenceNumber', [SolrKeys.caseClosedDate]: 'closedDate' });
|
|
22
|
+
export const advanceSearchFieldNameToSolrFieldMapping = Object.assign(Object.assign({}, fieldNameToSolrFieldMapping), { [SolrKeys.fts]: 'FTS', [SolrKeys.cep]: 'CEP', [SolrKeys.accountName]: 'accountName', [SolrKeys.caseNumber]: 'caseNumber', [SolrKeys.caseOwner]: 'ownerSSO', [SolrKeys.modifiedBy]: 'lastModifiedByName', [SolrKeys.createdBySsoUsername]: 'createdBySSO', [SolrKeys.createdBy]: 'createdByName', [SolrKeys.contactName]: 'contactName', [SolrKeys.caseContactSSO]: 'contactSSO', [SolrKeys.modifiedDate]: 'lastModifiedDate', [SolrKeys.createdDate]: 'createdDate', [SolrKeys.description]: 'description', [SolrKeys.caseSummary]: 'summary', [SolrKeys.alternateId]: 'personalReferenceNumber', [SolrKeys.openshiftClusterId]: 'openshiftClusterId', [SolrKeys.caseClosedDate]: 'closedDate' });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CaseSearchQueryType } from '../enums/caseSearch';
|
|
2
2
|
export declare function useFilterStateOnLoad(): {
|
|
3
|
-
set: (queryFromUrl: string, pageSizeFromUrl: number, currentPageFromUrl: number, searchType: CaseSearchQueryType) => {
|
|
3
|
+
set: (queryFromUrl: string, pageSizeFromUrl: number | undefined, currentPageFromUrl: number, searchType: CaseSearchQueryType) => {
|
|
4
4
|
initFilterState: any;
|
|
5
5
|
defaultSearchName: string;
|
|
6
6
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFilterStateOnLoad.d.ts","sourceRoot":"","sources":["../../../src/hooks/useFilterStateOnLoad.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAK1D,wBAAgB,oBAAoB;wBAkBd,MAAM,mBACH,MAAM,
|
|
1
|
+
{"version":3,"file":"useFilterStateOnLoad.d.ts","sourceRoot":"","sources":["../../../src/hooks/useFilterStateOnLoad.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAK1D,wBAAgB,oBAAoB;wBAkBd,MAAM,mBACH,MAAM,GAAG,SAAS,sBACf,MAAM,cACd,mBAAmB;;;;EA+DtC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IAdvanceSearchDateRanges, IAdvanceSearchFormState, ICaseListFilterState, IFilterInfo } from '../components/case-list/CaseListFilterReducer';
|
|
2
|
+
import { CaseSearchQueryType } from '../enums/caseSearch';
|
|
3
|
+
export declare const hasAdvanceSearchActiveState: (filterState: ICaseListFilterState) => boolean;
|
|
4
|
+
export declare const deriveSearchQueryType: (filterState: ICaseListFilterState) => CaseSearchQueryType;
|
|
5
|
+
export declare const toNameOrSsoFilterValues: (value: string) => string[];
|
|
6
|
+
export declare const mapAdvanceSearchFormToFilterInfo: (formState: IAdvanceSearchFormState) => IFilterInfo;
|
|
7
|
+
export declare const mergeAdvanceSearchFormIntoFilterInfo: (formState: IAdvanceSearchFormState, currentFilterInfo?: Partial<IFilterInfo>) => IFilterInfo;
|
|
8
|
+
export declare const buildAdvanceSearchParsedQuery: (formState: IAdvanceSearchFormState, filterInfo: Partial<IFilterInfo>) => string;
|
|
9
|
+
export declare const mapAdvanceSearchFormToDateRanges: (formState: IAdvanceSearchFormState) => IAdvanceSearchDateRanges;
|
|
10
|
+
export declare const createCaseListFilterStateFromAdvanceSearchForm: (formState: IAdvanceSearchFormState, currentFilterState: ICaseListFilterState) => ICaseListFilterState;
|
|
11
|
+
//# sourceMappingURL=advanceSearchFormMapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advanceSearchFormMapper.d.ts","sourceRoot":"","sources":["../../../src/utils/advanceSearchFormMapper.ts"],"names":[],"mappings":"AAIA,OAAO,EAGH,wBAAwB,EACxB,uBAAuB,EACvB,oBAAoB,EACpB,WAAW,EACd,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAK1D,eAAO,MAAM,2BAA2B,GAAI,aAAa,oBAAoB,KAAG,OACwB,CAAC;AAEzG,eAAO,MAAM,qBAAqB,GAAI,aAAa,oBAAoB,KAAG,mBAC6B,CAAC;AAIxG,eAAO,MAAM,uBAAuB,GAAI,OAAO,MAAM,KAAG,MAAM,EAc7D,CAAC;AAEF,eAAO,MAAM,gCAAgC,GAAI,WAAW,uBAAuB,KAAG,WAsBrF,CAAC;AAEF,eAAO,MAAM,oCAAoC,GAC7C,WAAW,uBAAuB,EAClC,oBAAmB,OAAO,CAAC,WAAW,CAAM,KAC7C,WAoBF,CAAC;AAmBF,eAAO,MAAM,6BAA6B,GACtC,WAAW,uBAAuB,EAClC,YAAY,OAAO,CAAC,WAAW,CAAC,KACjC,MASF,CAAC;AAEF,eAAO,MAAM,gCAAgC,GAAI,WAAW,uBAAuB,KAAG,wBAIpF,CAAC;AAEH,eAAO,MAAM,8CAA8C,GACvD,WAAW,uBAAuB,EAClC,oBAAoB,oBAAoB,KACzC,oBA0BF,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { toOldCaseTypeMapper } from '@rh-support/utils';
|
|
2
|
+
import { initialPaginationInfo } from '../components/case-list/CaseListFilterContext';
|
|
3
|
+
import { hasAdvanceSearchDateRanges } from '../components/case-list/CaseListFilterHelpers';
|
|
4
|
+
import { emptyFilters, } from '../components/case-list/CaseListFilterReducer';
|
|
5
|
+
import { CaseSearchQueryType } from '../enums/caseSearch';
|
|
6
|
+
import { SolrKeys, SolrPivotKeys } from '../enums/filters';
|
|
7
|
+
import { isAdvanceSearchFormEmpty } from './advanceSearchUtils';
|
|
8
|
+
import { createUserFriendlyQueryFromFilterStateAdvancedSearch } from './caseSearchUtils';
|
|
9
|
+
export const hasAdvanceSearchActiveState = (filterState) => { var _a, _b; return Boolean((_b = (_a = filterState.filterQueryInfo) === null || _a === void 0 ? void 0 : _a.parsedQuery) === null || _b === void 0 ? void 0 : _b.trim()) || hasAdvanceSearchDateRanges(filterState); };
|
|
10
|
+
export const deriveSearchQueryType = (filterState) => hasAdvanceSearchActiveState(filterState) ? CaseSearchQueryType.ADVANCED : CaseSearchQueryType.BASIC;
|
|
11
|
+
const splitSearchTokens = (value) => value.trim().split(/\s+/).filter(Boolean);
|
|
12
|
+
export const toNameOrSsoFilterValues = (value) => {
|
|
13
|
+
const trimmed = value.trim();
|
|
14
|
+
if (!trimmed) {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
if (trimmed.includes(',')) {
|
|
18
|
+
return trimmed
|
|
19
|
+
.split(',')
|
|
20
|
+
.map((entry) => entry.trim())
|
|
21
|
+
.filter(Boolean);
|
|
22
|
+
}
|
|
23
|
+
return [trimmed];
|
|
24
|
+
};
|
|
25
|
+
export const mapAdvanceSearchFormToFilterInfo = (formState) => {
|
|
26
|
+
const escalation = formState.showEscalatedOnly ? [{ key: 'true', value: 'true' }] : [];
|
|
27
|
+
return Object.assign(Object.assign({}, emptyFilters), { [SolrPivotKeys.product_version]: formState.products.map((product) => (Object.assign(Object.assign({}, product), { [SolrKeys.version]: [...(product[SolrKeys.version] || [])] }))), [SolrKeys.status]: [...formState.statuses], [SolrKeys.severity]: [...formState.severities], [SolrKeys.type]: toOldCaseTypeMapper(formState.supportTypes), [SolrKeys.escalation]: escalation, [SolrKeys.accountNumber]: [...formState.accountNumbers], [SolrKeys.alternateId]: splitSearchTokens(formState.personalReferenceNumber), [SolrKeys.openshiftClusterId]: splitSearchTokens(formState.openshiftClusterId), [SolrKeys.caseContactSSO]: toNameOrSsoFilterValues(formState.ownerNameAndSso), [SolrKeys.caseOwner]: toNameOrSsoFilterValues(formState.assignedToNameAndSso), [SolrKeys.group]: [...formState.groups], [SolrKeys.createdBySsoUsername]: toNameOrSsoFilterValues(formState.createdByNameAndSso), [SolrKeys.modifiedBy]: toNameOrSsoFilterValues(formState.lastModifiedByNameAndSso) });
|
|
28
|
+
};
|
|
29
|
+
export const mergeAdvanceSearchFormIntoFilterInfo = (formState, currentFilterInfo = {}) => {
|
|
30
|
+
const advanceSearchValues = mapAdvanceSearchFormToFilterInfo(formState);
|
|
31
|
+
return Object.assign(Object.assign(Object.assign({}, emptyFilters), currentFilterInfo), { [SolrPivotKeys.product_version]: advanceSearchValues[SolrPivotKeys.product_version], [SolrKeys.status]: advanceSearchValues[SolrKeys.status], [SolrKeys.severity]: advanceSearchValues[SolrKeys.severity], [SolrKeys.type]: advanceSearchValues[SolrKeys.type], [SolrKeys.escalation]: advanceSearchValues[SolrKeys.escalation], [SolrKeys.accountNumber]: advanceSearchValues[SolrKeys.accountNumber], [SolrKeys.alternateId]: advanceSearchValues[SolrKeys.alternateId], [SolrKeys.openshiftClusterId]: advanceSearchValues[SolrKeys.openshiftClusterId], [SolrKeys.caseContactSSO]: advanceSearchValues[SolrKeys.caseContactSSO], [SolrKeys.caseOwner]: advanceSearchValues[SolrKeys.caseOwner], [SolrKeys.group]: advanceSearchValues[SolrKeys.group], [SolrKeys.createdBySsoUsername]: advanceSearchValues[SolrKeys.createdBySsoUsername], [SolrKeys.modifiedBy]: advanceSearchValues[SolrKeys.modifiedBy] });
|
|
32
|
+
};
|
|
33
|
+
const formatDateRangeParsedQuery = (fieldLabel, range) => {
|
|
34
|
+
const { startDate, endDate } = range;
|
|
35
|
+
if (!startDate && !endDate) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
if (startDate && endDate) {
|
|
39
|
+
return `${fieldLabel}: ${startDate} to ${endDate}`;
|
|
40
|
+
}
|
|
41
|
+
if (startDate) {
|
|
42
|
+
return `${fieldLabel}: >= ${startDate}`;
|
|
43
|
+
}
|
|
44
|
+
return `${fieldLabel}: <= ${endDate}`;
|
|
45
|
+
};
|
|
46
|
+
export const buildAdvanceSearchParsedQuery = (formState, filterInfo) => {
|
|
47
|
+
const filterQueryParts = [
|
|
48
|
+
createUserFriendlyQueryFromFilterStateAdvancedSearch(filterInfo, ''),
|
|
49
|
+
formatDateRangeParsedQuery('createdDate', formState.createdDateRange),
|
|
50
|
+
formatDateRangeParsedQuery('lastModifiedDate', formState.lastModifiedDateRange),
|
|
51
|
+
formatDateRangeParsedQuery('closedDate', formState.closedDateRange),
|
|
52
|
+
].filter(Boolean);
|
|
53
|
+
return filterQueryParts.join(' and ');
|
|
54
|
+
};
|
|
55
|
+
export const mapAdvanceSearchFormToDateRanges = (formState) => ({
|
|
56
|
+
createdDateRange: Object.assign({}, formState.createdDateRange),
|
|
57
|
+
lastModifiedDateRange: Object.assign({}, formState.lastModifiedDateRange),
|
|
58
|
+
closedDateRange: Object.assign({}, formState.closedDateRange),
|
|
59
|
+
});
|
|
60
|
+
export const createCaseListFilterStateFromAdvanceSearchForm = (formState, currentFilterState) => {
|
|
61
|
+
var _a;
|
|
62
|
+
const filterInfo = mergeAdvanceSearchFormIntoFilterInfo(formState, currentFilterState.filterInfo);
|
|
63
|
+
const hasActiveAdvanceSearch = !isAdvanceSearchFormEmpty(formState);
|
|
64
|
+
const parsedQuery = hasActiveAdvanceSearch ? buildAdvanceSearchParsedQuery(formState, filterInfo) : '';
|
|
65
|
+
const nextFilterState = Object.assign(Object.assign({}, currentFilterState), { filterInfo, filterQueryInfo: {
|
|
66
|
+
queryString: ((_a = currentFilterState.filterQueryInfo) === null || _a === void 0 ? void 0 : _a.queryString) || '',
|
|
67
|
+
parsedQuery,
|
|
68
|
+
type: hasActiveAdvanceSearch ? CaseSearchQueryType.ADVANCED : CaseSearchQueryType.BASIC,
|
|
69
|
+
}, paginationInfo: Object.assign(Object.assign({}, (currentFilterState.paginationInfo || initialPaginationInfo)), { currentPage: 1 }), advanceSearchDateRanges: hasActiveAdvanceSearch ? mapAdvanceSearchFormToDateRanges(formState) : undefined });
|
|
70
|
+
return Object.assign(Object.assign({}, nextFilterState), { filterQueryInfo: Object.assign(Object.assign({}, nextFilterState.filterQueryInfo), { type: deriveSearchQueryType(nextFilterState) }) });
|
|
71
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { IAdvanceSearchDateRange, IAdvanceSearchFormState, ICaseListFilterState } from '../components/case-list/CaseListFilterReducer';
|
|
2
|
+
/** Matches PatternFly DatePicker yyyy-MM-dd parsing and rejects impossible dates (e.g. 2024-02-31). */
|
|
3
|
+
export declare const parseAdvanceSearchDate: (value: string) => Date | undefined;
|
|
4
|
+
export declare const isValidAdvanceSearchDateInput: (value: string) => boolean;
|
|
5
|
+
export declare const isAdvanceSearchDateRangeValid: (range: IAdvanceSearchDateRange) => boolean;
|
|
6
|
+
export declare const hasInvalidAdvanceSearchDates: (ranges: {
|
|
7
|
+
createdDateRange: IAdvanceSearchDateRange;
|
|
8
|
+
lastModifiedDateRange: IAdvanceSearchDateRange;
|
|
9
|
+
closedDateRange: IAdvanceSearchDateRange;
|
|
10
|
+
}) => boolean;
|
|
11
|
+
export interface IAdvanceSearchDateRangeFieldErrors {
|
|
12
|
+
startDate?: string;
|
|
13
|
+
endDate?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const getAdvanceSearchDateRangeFieldErrors: (range: IAdvanceSearchDateRange, messages: {
|
|
16
|
+
invalidDateFormat: string;
|
|
17
|
+
invalidDateRange: string;
|
|
18
|
+
}) => IAdvanceSearchDateRangeFieldErrors;
|
|
19
|
+
export declare const createInitialAdvanceSearchFormState: () => IAdvanceSearchFormState;
|
|
20
|
+
export declare const mapFilterStateToAdvanceSearchForm: (filterState: ICaseListFilterState) => IAdvanceSearchFormState;
|
|
21
|
+
export declare const isAdvanceSearchFormEmpty: (formState: IAdvanceSearchFormState) => boolean;
|
|
22
|
+
/** Counts total applied advanced-search filter values across all fields. */
|
|
23
|
+
export declare const getAdvanceSearchAppliedFilterCount: (filterState: ICaseListFilterState) => number;
|
|
24
|
+
//# sourceMappingURL=advanceSearchUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advanceSearchUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/advanceSearchUtils.ts"],"names":[],"mappings":"AAGA,OAAO,EACH,uBAAuB,EACvB,uBAAuB,EACvB,oBAAoB,EAEvB,MAAM,+CAA+C,CAAC;AAKvD,uGAAuG;AACvG,eAAO,MAAM,sBAAsB,GAAI,OAAO,MAAM,KAAG,IAAI,GAAG,SAsB7D,CAAC;AAEF,eAAO,MAAM,6BAA6B,GAAI,OAAO,MAAM,KAAG,OACE,CAAC;AAEjE,eAAO,MAAM,6BAA6B,GAAI,OAAO,uBAAuB,KAAG,OAa9E,CAAC;AAEF,eAAO,MAAM,4BAA4B,GAAI,QAAQ;IACjD,gBAAgB,EAAE,uBAAuB,CAAC;IAC1C,qBAAqB,EAAE,uBAAuB,CAAC;IAC/C,eAAe,EAAE,uBAAuB,CAAC;CAC5C,KAAG,OAGsD,CAAC;AAE3D,MAAM,WAAW,kCAAkC;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,oCAAoC,GAC7C,OAAO,uBAAuB,EAC9B,UAAU;IACN,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;CAC5B,KACF,kCAqBF,CAAC;AAOF,eAAO,MAAM,mCAAmC,QAAO,uBAiBrD,CAAC;AAEH,eAAO,MAAM,iCAAiC,GAAI,aAAa,oBAAoB,KAAG,uBA6BrF,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,WAAW,uBAAuB,KAAG,OAG7E,CAAC;AAuBF,4EAA4E;AAC5E,eAAO,MAAM,kCAAkC,GAAI,aAAa,oBAAoB,KAAG,MAyBtF,CAAC"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { toNewCaseTypeMapper } from '@rh-support/utils';
|
|
2
|
+
import isEqual from 'lodash/isEqual';
|
|
3
|
+
import { SolrKeys, SolrPivotKeys } from '../enums/filters';
|
|
4
|
+
const YYYY_MM_DD_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
|
|
5
|
+
/** Matches PatternFly DatePicker yyyy-MM-dd parsing and rejects impossible dates (e.g. 2024-02-31). */
|
|
6
|
+
export const parseAdvanceSearchDate = (value) => {
|
|
7
|
+
const trimmed = value.trim();
|
|
8
|
+
if (!trimmed) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
if (!YYYY_MM_DD_PATTERN.test(trimmed)) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
const [year, month, day] = trimmed.split('-').map(Number);
|
|
15
|
+
const parsedDate = new Date(`${trimmed}T00:00:00`);
|
|
16
|
+
if (Number.isNaN(parsedDate.getTime())) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
if (parsedDate.getFullYear() !== year || parsedDate.getMonth() + 1 !== month || parsedDate.getDate() !== day) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
return parsedDate;
|
|
23
|
+
};
|
|
24
|
+
export const isValidAdvanceSearchDateInput = (value) => !value.trim() || parseAdvanceSearchDate(value) !== undefined;
|
|
25
|
+
export const isAdvanceSearchDateRangeValid = (range) => {
|
|
26
|
+
if (!isValidAdvanceSearchDateInput(range.startDate) || !isValidAdvanceSearchDateInput(range.endDate)) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
const startDate = parseAdvanceSearchDate(range.startDate);
|
|
30
|
+
const endDate = parseAdvanceSearchDate(range.endDate);
|
|
31
|
+
if (startDate && endDate && startDate > endDate) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
};
|
|
36
|
+
export const hasInvalidAdvanceSearchDates = (ranges) => !isAdvanceSearchDateRangeValid(ranges.createdDateRange) ||
|
|
37
|
+
!isAdvanceSearchDateRangeValid(ranges.lastModifiedDateRange) ||
|
|
38
|
+
!isAdvanceSearchDateRangeValid(ranges.closedDateRange);
|
|
39
|
+
export const getAdvanceSearchDateRangeFieldErrors = (range, messages) => {
|
|
40
|
+
const errors = {};
|
|
41
|
+
if (!isValidAdvanceSearchDateInput(range.startDate)) {
|
|
42
|
+
errors.startDate = messages.invalidDateFormat;
|
|
43
|
+
}
|
|
44
|
+
if (!isValidAdvanceSearchDateInput(range.endDate)) {
|
|
45
|
+
errors.endDate = messages.invalidDateFormat;
|
|
46
|
+
}
|
|
47
|
+
if (!errors.startDate && !errors.endDate) {
|
|
48
|
+
const startDate = parseAdvanceSearchDate(range.startDate);
|
|
49
|
+
const endDate = parseAdvanceSearchDate(range.endDate);
|
|
50
|
+
if (startDate && endDate && startDate > endDate) {
|
|
51
|
+
errors.endDate = messages.invalidDateRange;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return errors;
|
|
55
|
+
};
|
|
56
|
+
const emptyDateRange = () => ({
|
|
57
|
+
startDate: '',
|
|
58
|
+
endDate: '',
|
|
59
|
+
});
|
|
60
|
+
export const createInitialAdvanceSearchFormState = () => ({
|
|
61
|
+
statuses: [],
|
|
62
|
+
severities: [],
|
|
63
|
+
supportTypes: [],
|
|
64
|
+
showEscalatedOnly: false,
|
|
65
|
+
accountNumbers: [],
|
|
66
|
+
personalReferenceNumber: '',
|
|
67
|
+
openshiftClusterId: '',
|
|
68
|
+
ownerNameAndSso: '',
|
|
69
|
+
assignedToNameAndSso: '',
|
|
70
|
+
groups: [],
|
|
71
|
+
createdByNameAndSso: '',
|
|
72
|
+
lastModifiedByNameAndSso: '',
|
|
73
|
+
createdDateRange: emptyDateRange(),
|
|
74
|
+
lastModifiedDateRange: emptyDateRange(),
|
|
75
|
+
closedDateRange: emptyDateRange(),
|
|
76
|
+
products: [],
|
|
77
|
+
});
|
|
78
|
+
export const mapFilterStateToAdvanceSearchForm = (filterState) => {
|
|
79
|
+
var _a, _b, _c;
|
|
80
|
+
const { filterInfo } = filterState;
|
|
81
|
+
if (!filterInfo) {
|
|
82
|
+
return createInitialAdvanceSearchFormState();
|
|
83
|
+
}
|
|
84
|
+
const escalationValues = filterInfo[SolrKeys.escalation] || [];
|
|
85
|
+
return {
|
|
86
|
+
statuses: [...(filterInfo[SolrKeys.status] || [])],
|
|
87
|
+
severities: [...(filterInfo[SolrKeys.severity] || [])],
|
|
88
|
+
supportTypes: toNewCaseTypeMapper(filterInfo[SolrKeys.type] || []),
|
|
89
|
+
showEscalatedOnly: escalationValues.some((item) => item.key === 'true'),
|
|
90
|
+
accountNumbers: [...(filterInfo[SolrKeys.accountNumber] || [])],
|
|
91
|
+
personalReferenceNumber: (filterInfo[SolrKeys.alternateId] || []).join(' '),
|
|
92
|
+
openshiftClusterId: (filterInfo[SolrKeys.openshiftClusterId] || []).join(' '),
|
|
93
|
+
ownerNameAndSso: (filterInfo[SolrKeys.caseContactSSO] || []).join(', '),
|
|
94
|
+
assignedToNameAndSso: (filterInfo[SolrKeys.caseOwner] || []).join(', '),
|
|
95
|
+
groups: [...(filterInfo[SolrKeys.group] || [])],
|
|
96
|
+
createdByNameAndSso: (filterInfo[SolrKeys.createdBySsoUsername] || []).join(', '),
|
|
97
|
+
lastModifiedByNameAndSso: (filterInfo[SolrKeys.modifiedBy] || []).join(', '),
|
|
98
|
+
createdDateRange: Object.assign({}, (((_a = filterState.advanceSearchDateRanges) === null || _a === void 0 ? void 0 : _a.createdDateRange) || emptyDateRange())),
|
|
99
|
+
lastModifiedDateRange: Object.assign({}, (((_b = filterState.advanceSearchDateRanges) === null || _b === void 0 ? void 0 : _b.lastModifiedDateRange) || emptyDateRange())),
|
|
100
|
+
closedDateRange: Object.assign({}, (((_c = filterState.advanceSearchDateRanges) === null || _c === void 0 ? void 0 : _c.closedDateRange) || emptyDateRange())),
|
|
101
|
+
products: (filterInfo[SolrPivotKeys.product_version] || []).map((product) => (Object.assign(Object.assign({}, product), { [SolrKeys.version]: [...(product[SolrKeys.version] || [])] }))),
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
export const isAdvanceSearchFormEmpty = (formState) => {
|
|
105
|
+
const initialState = createInitialAdvanceSearchFormState();
|
|
106
|
+
return isEqual(formState, initialState);
|
|
107
|
+
};
|
|
108
|
+
const countDateRangeValues = (range) => {
|
|
109
|
+
if (!range) {
|
|
110
|
+
return 0;
|
|
111
|
+
}
|
|
112
|
+
let count = 0;
|
|
113
|
+
if (range.startDate.trim()) {
|
|
114
|
+
count++;
|
|
115
|
+
}
|
|
116
|
+
if (range.endDate.trim()) {
|
|
117
|
+
count++;
|
|
118
|
+
}
|
|
119
|
+
return count;
|
|
120
|
+
};
|
|
121
|
+
const countProductFilterValues = (products) => products.reduce((total, product) => {
|
|
122
|
+
const versions = product[SolrKeys.version] || [];
|
|
123
|
+
return total + (versions.length > 0 ? versions.length : 1);
|
|
124
|
+
}, 0);
|
|
125
|
+
/** Counts total applied advanced-search filter values across all fields. */
|
|
126
|
+
export const getAdvanceSearchAppliedFilterCount = (filterState) => {
|
|
127
|
+
const { filterInfo, advanceSearchDateRanges } = filterState;
|
|
128
|
+
if (!filterInfo) {
|
|
129
|
+
return 0;
|
|
130
|
+
}
|
|
131
|
+
let count = 0;
|
|
132
|
+
count += (filterInfo[SolrKeys.status] || []).length;
|
|
133
|
+
count += (filterInfo[SolrKeys.severity] || []).length;
|
|
134
|
+
count += (filterInfo[SolrKeys.type] || []).length;
|
|
135
|
+
count += (filterInfo[SolrKeys.escalation] || []).length;
|
|
136
|
+
count += (filterInfo[SolrKeys.accountNumber] || []).length;
|
|
137
|
+
count += (filterInfo[SolrKeys.alternateId] || []).length;
|
|
138
|
+
count += (filterInfo[SolrKeys.openshiftClusterId] || []).length;
|
|
139
|
+
count += (filterInfo[SolrKeys.caseContactSSO] || []).length;
|
|
140
|
+
count += (filterInfo[SolrKeys.caseOwner] || []).length;
|
|
141
|
+
count += (filterInfo[SolrKeys.group] || []).length;
|
|
142
|
+
count += (filterInfo[SolrKeys.createdBySsoUsername] || []).length;
|
|
143
|
+
count += (filterInfo[SolrKeys.modifiedBy] || []).length;
|
|
144
|
+
count += countProductFilterValues(filterInfo[SolrPivotKeys.product_version] || []);
|
|
145
|
+
count += countDateRangeValues(advanceSearchDateRanges === null || advanceSearchDateRanges === void 0 ? void 0 : advanceSearchDateRanges.createdDateRange);
|
|
146
|
+
count += countDateRangeValues(advanceSearchDateRanges === null || advanceSearchDateRanges === void 0 ? void 0 : advanceSearchDateRanges.lastModifiedDateRange);
|
|
147
|
+
count += countDateRangeValues(advanceSearchDateRanges === null || advanceSearchDateRanges === void 0 ? void 0 : advanceSearchDateRanges.closedDateRange);
|
|
148
|
+
return count;
|
|
149
|
+
};
|
|
@@ -1 +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,
|
|
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,EAKH,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;AAwDD,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,CAwFnC;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,CA4C1B"}
|
|
@@ -7,31 +7,64 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { GET_CASES_BY_FILTERS, GET_PRODUCTS, GET_USER_IDS_BY_FEDERATION, } from '@rh-support/utils';
|
|
10
|
+
import { GET_CASES_BY_FILTERS, GET_GROUP_IDS_BY_NAME, GET_PRODUCTS, GET_USER_IDS_BY_FEDERATION, } from '@rh-support/utils';
|
|
11
11
|
import { SolrKeys, SolrPivotKeys } from '../enums/filters';
|
|
12
12
|
import { mapGraphQLResponseToCaseList } from './caseListMapper';
|
|
13
13
|
import { createGraphQLVariablesFromFilterState, getOwnerFederationIdsToResolve, } from './caseListVariablesBuilder';
|
|
14
|
-
|
|
14
|
+
const pageCursors = new Map();
|
|
15
|
+
/**
|
|
16
|
+
* Workaround step 1 for Assigned To (case OwnerId): lookup SalesforceSupportUser and
|
|
17
|
+
* SalesforceSupportGroup IDs by federation ID or name. Pre-resolved here and passed into
|
|
18
|
+
* createGraphQLVariablesFromFilterState as OwnerId — do not use nested Owner filters on the case where clause.
|
|
19
|
+
*/
|
|
20
|
+
function resolveOwnerIds(searchTerms, apolloClient) {
|
|
15
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
var _a, _b, _c;
|
|
17
|
-
if (!
|
|
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);
|
|
22
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
23
|
+
if (!searchTerms.length)
|
|
30
24
|
return [];
|
|
25
|
+
const ownerIds = [];
|
|
26
|
+
for (const searchTerm of searchTerms) {
|
|
27
|
+
try {
|
|
28
|
+
const [userResult, groupResult] = yield Promise.all([
|
|
29
|
+
apolloClient.query({
|
|
30
|
+
query: GET_USER_IDS_BY_FEDERATION,
|
|
31
|
+
variables: {
|
|
32
|
+
searchTerm,
|
|
33
|
+
namePattern: `%${searchTerm}%`,
|
|
34
|
+
},
|
|
35
|
+
fetchPolicy: 'network-only',
|
|
36
|
+
}),
|
|
37
|
+
apolloClient.query({
|
|
38
|
+
query: GET_GROUP_IDS_BY_NAME,
|
|
39
|
+
variables: {
|
|
40
|
+
namePattern: `%${searchTerm}%`,
|
|
41
|
+
},
|
|
42
|
+
fetchPolicy: 'network-only',
|
|
43
|
+
}),
|
|
44
|
+
]);
|
|
45
|
+
const userEdges = ((_d = (_c = (_b = (_a = userResult.data) === null || _a === void 0 ? void 0 : _a.salesforce_support_uiapi) === null || _b === void 0 ? void 0 : _b.query) === null || _c === void 0 ? void 0 : _c.SalesforceSupportUser) === null || _d === void 0 ? void 0 : _d.edges) || [];
|
|
46
|
+
userEdges.forEach((edge) => {
|
|
47
|
+
var _a, _b, _c;
|
|
48
|
+
const federationId = (_b = (_a = edge.node) === null || _a === void 0 ? void 0 : _a.FederationIdentifier) === null || _b === void 0 ? void 0 : _b.value;
|
|
49
|
+
if (((_c = edge.node) === null || _c === void 0 ? void 0 : _c.Id) && federationId) {
|
|
50
|
+
ownerIds.push(edge.node.Id);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
const groupEdges = ((_h = (_g = (_f = (_e = groupResult.data) === null || _e === void 0 ? void 0 : _e.salesforce_support_uiapi) === null || _f === void 0 ? void 0 : _f.query) === null || _g === void 0 ? void 0 : _g.SalesforceSupportGroup) === null || _h === void 0 ? void 0 : _h.edges) || [];
|
|
54
|
+
groupEdges.forEach((edge) => {
|
|
55
|
+
var _a;
|
|
56
|
+
if ((_a = edge.node) === null || _a === void 0 ? void 0 : _a.Id) {
|
|
57
|
+
ownerIds.push(edge.node.Id);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
console.error('[GraphQL] Failed to resolve owner IDs:', error);
|
|
63
|
+
}
|
|
31
64
|
}
|
|
65
|
+
return [...new Set(ownerIds)];
|
|
32
66
|
});
|
|
33
67
|
}
|
|
34
|
-
const pageCursors = new Map();
|
|
35
68
|
export function clearPageCursors() {
|
|
36
69
|
pageCursors.clear();
|
|
37
70
|
}
|
|
@@ -120,10 +153,11 @@ export function getCaseListFromGraphQL(filterState, apolloClient, limitOverride,
|
|
|
120
153
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
121
154
|
try {
|
|
122
155
|
yield resolveVersionProductIds(filterState, apolloClient);
|
|
156
|
+
// Pre-resolve Assigned To owner IDs — users and groups (see resolveOwnerIds / caseListVariablesBuilder comments).
|
|
123
157
|
const federationIdsToResolve = getOwnerFederationIdsToResolve(filterState);
|
|
124
158
|
let resolvedUserIds;
|
|
125
159
|
if (federationIdsToResolve.length) {
|
|
126
|
-
const ownerUserIds = yield
|
|
160
|
+
const ownerUserIds = yield resolveOwnerIds(federationIdsToResolve, apolloClient);
|
|
127
161
|
resolvedUserIds = { ownerUserIds };
|
|
128
162
|
}
|
|
129
163
|
const variables = yield createGraphQLVariablesFromFilterState(filterState, apolloClient, resolvedUserIds);
|
|
@@ -208,13 +242,15 @@ export function loadMoreCases(filterState, apolloClient, afterCursor, signal) {
|
|
|
208
242
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
209
243
|
try {
|
|
210
244
|
yield resolveVersionProductIds(filterState, apolloClient);
|
|
245
|
+
// Pre-resolve Assigned To owner IDs — users and groups (see resolveOwnerIds / caseListVariablesBuilder comments).
|
|
211
246
|
const federationIdsToResolve = getOwnerFederationIdsToResolve(filterState);
|
|
212
247
|
let resolvedUserIds;
|
|
213
248
|
if (federationIdsToResolve.length) {
|
|
214
|
-
const ownerUserIds = yield
|
|
249
|
+
const ownerUserIds = yield resolveOwnerIds(federationIdsToResolve, apolloClient);
|
|
215
250
|
resolvedUserIds = { ownerUserIds };
|
|
216
251
|
}
|
|
217
252
|
const variables = yield createGraphQLVariablesFromFilterState(filterState, apolloClient, resolvedUserIds);
|
|
253
|
+
variables.first = 20;
|
|
218
254
|
variables.after = afterCursor;
|
|
219
255
|
const { data } = yield apolloClient.query({
|
|
220
256
|
query: GET_CASES_BY_FILTERS,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export function mapGraphQLCaseToCaseListItem(node) {
|
|
2
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
|
|
2
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8;
|
|
3
3
|
const isEscalated = ((_a = node.IsEscalated) === null || _a === void 0 ? void 0 : _a.value) === true;
|
|
4
4
|
return {
|
|
5
5
|
id: node.Id || '',
|
|
@@ -25,9 +25,9 @@ export function mapGraphQLCaseToCaseListItem(node) {
|
|
|
25
25
|
case_last_public_update_date: ((_2 = node.LastModifiedDate) === null || _2 === void 0 ? void 0 : _2.value) || '',
|
|
26
26
|
case_customer_escalation: isEscalated,
|
|
27
27
|
case_closedDate: ((_3 = node.ClosedDate) === null || _3 === void 0 ? void 0 : _3.value) || '',
|
|
28
|
-
case_folderName: '',
|
|
29
|
-
case_folderNumber: '',
|
|
30
|
-
case_alternate_id: ((
|
|
28
|
+
case_folderName: ((_5 = (_4 = node.Group__r) === null || _4 === void 0 ? void 0 : _4.Name) === null || _5 === void 0 ? void 0 : _5.value) || '',
|
|
29
|
+
case_folderNumber: ((_6 = node.Group__c) === null || _6 === void 0 ? void 0 : _6.value) || ((_7 = node.Group__r) === null || _7 === void 0 ? void 0 : _7.Id) || '',
|
|
30
|
+
case_alternate_id: ((_8 = node.AlternateCaseId__c) === null || _8 === void 0 ? void 0 : _8.value) || '',
|
|
31
31
|
uri: '',
|
|
32
32
|
};
|
|
33
33
|
}
|
|
@@ -8,6 +8,7 @@ export interface IGraphQLCaseListVariables {
|
|
|
8
8
|
orderBy?: Record<string, unknown>;
|
|
9
9
|
}
|
|
10
10
|
export interface IResolvedUserIds {
|
|
11
|
+
/** Pre-resolved OwnerId values (SalesforceSupportUser or SalesforceSupportGroup). */
|
|
11
12
|
ownerUserIds?: string[];
|
|
12
13
|
}
|
|
13
14
|
export declare function createGraphQLVariablesFromFilterState(filterState: ICaseListFilterState, apolloClient: ApolloClient, resolvedUserIds?: IResolvedUserIds): Promise<IGraphQLCaseListVariables>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"caseListVariablesBuilder.d.ts","sourceRoot":"","sources":["../../../src/utils/caseListVariablesBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"caseListVariablesBuilder.d.ts","sourceRoot":"","sources":["../../../src/utils/caseListVariablesBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAQnD,OAAO,EAEH,oBAAoB,EAEvB,MAAM,+CAA+C,CAAC;AAMvD,wBAAgB,8BAA8B,CAAC,WAAW,EAAE,oBAAoB,GAAG,MAAM,EAAE,CAW1F;AAED,MAAM,WAAW,yBAAyB;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,gBAAgB;IAC7B,qFAAqF;IACrF,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AA0SD,wBAAsB,qCAAqC,CACvD,WAAW,EAAE,oBAAoB,EACjC,YAAY,EAAE,YAAY,EAC1B,eAAe,CAAC,EAAE,gBAAgB,GACnC,OAAO,CAAC,yBAAyB,CAAC,CA4HpC"}
|