@rh-support/cases 2.6.168 → 2.6.170
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 +116 -111
- package/lib/esm/components/case-list/CaseListContext.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListContext.js +0 -2
- package/lib/esm/components/case-list/CaseListFilterReducer.d.ts +6 -1
- package/lib/esm/components/case-list/CaseListFilterReducer.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListFilterReducer.js +4 -1
- package/lib/esm/components/case-list/CaseListReducer.d.ts +2 -8
- package/lib/esm/components/case-list/CaseListReducer.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListReducer.js +1 -13
- 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 +28 -3
- 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 +0 -1
- 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 +9 -8
- 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/AdvanceSearch.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-search/AdvanceSearch.js +2 -2
- package/lib/esm/components/case-list/case-search/BookmarkedSearchesSelector.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-search/BookmarkedSearchesSelector.js +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 +4 -1
- package/lib/esm/css/caseList.css +0 -2
- 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/enums/caseSearch.d.ts +2 -0
- package/lib/esm/enums/caseSearch.d.ts.map +1 -1
- package/lib/esm/enums/caseSearch.js +1 -0
- package/lib/esm/enums/filters.d.ts +3 -1
- package/lib/esm/enums/filters.d.ts.map +1 -1
- package/lib/esm/enums/filters.js +2 -0
- package/lib/esm/hooks/useExportCaseListCSV.d.ts.map +1 -1
- package/lib/esm/hooks/useExportCaseListCSV.js +1 -9
- package/lib/esm/models/caseList.d.ts +0 -2
- package/lib/esm/models/caseList.d.ts.map +1 -1
- package/lib/esm/test-utils/mockData.js +1 -1
- package/lib/esm/utils/caseListGraphQLUtils.d.ts +16 -0
- package/lib/esm/utils/caseListGraphQLUtils.d.ts.map +1 -0
- package/lib/esm/utils/caseListGraphQLUtils.js +193 -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 +13 -0
- package/lib/esm/utils/caseListVariablesBuilder.d.ts.map +1 -0
- package/lib/esm/utils/caseListVariablesBuilder.js +160 -0
- package/lib/esm/utils/caseSearchUtils.d.ts.map +1 -1
- package/lib/esm/utils/caseSearchUtils.js +51 -10
- 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 +14 -0
- 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 +7 -7
|
@@ -7,9 +7,9 @@ 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 {
|
|
10
|
+
import { useApolloClient } from '@apollo/client/react';
|
|
11
11
|
import { AccountSelectorInternal } from '@rh-support/react-context';
|
|
12
|
-
import { getDropdownBtnPlaceholder } from '@rh-support/utils';
|
|
12
|
+
import { getDropdownBtnPlaceholder, SEARCH_ACCOUNTS } from '@rh-support/utils';
|
|
13
13
|
import differenceBy from 'lodash/differenceBy';
|
|
14
14
|
import filter from 'lodash/filter';
|
|
15
15
|
import remove from 'lodash/remove';
|
|
@@ -35,6 +35,7 @@ export function AccountsFilter(props) {
|
|
|
35
35
|
const { canReadBookmarkAccounts } = props;
|
|
36
36
|
const { filterInfo } = useContext(CaseListFilterStateContext);
|
|
37
37
|
const dispatch = useContext(CaseListFilterDispatchContext);
|
|
38
|
+
const apolloClient = useApolloClient();
|
|
38
39
|
const selectedAccounts = useMemo(() => filterInfo[SolrKeys.accountNumber]
|
|
39
40
|
.filter((item) => !Array.isArray(item.key))
|
|
40
41
|
.map((item) => ({
|
|
@@ -67,20 +68,26 @@ export function AccountsFilter(props) {
|
|
|
67
68
|
return;
|
|
68
69
|
function getAccountsWithoutNames() {
|
|
69
70
|
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
var _a, _b, _c, _d;
|
|
70
72
|
const allSelected = [...filterInfo[SolrKeys.accountNumber]];
|
|
71
73
|
const accountsWithoutNames = remove(allSelected, (item) => item.key === item.value);
|
|
72
74
|
if (accountsWithoutNames.length < 1)
|
|
73
75
|
return;
|
|
74
|
-
const
|
|
75
|
-
const params = {
|
|
76
|
-
fields,
|
|
77
|
-
orderBy: 'name',
|
|
78
|
-
orderDirection: 'asc',
|
|
79
|
-
accountNumberIn: accountsWithoutNames.map((item) => item.key).join(','),
|
|
80
|
-
};
|
|
76
|
+
const accountNumbers = accountsWithoutNames.map((item) => item.key);
|
|
81
77
|
try {
|
|
82
|
-
const
|
|
83
|
-
|
|
78
|
+
const { data } = yield apolloClient.query({
|
|
79
|
+
query: SEARCH_ACCOUNTS,
|
|
80
|
+
variables: {
|
|
81
|
+
where: { AccountNumber: { in: accountNumbers } },
|
|
82
|
+
first: accountNumbers.length,
|
|
83
|
+
},
|
|
84
|
+
fetchPolicy: 'network-only',
|
|
85
|
+
});
|
|
86
|
+
const edges = (_d = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.salesforce_support_uiapi) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.SalesforceSupportAccount) === null || _c === void 0 ? void 0 : _c.edges) !== null && _d !== void 0 ? _d : [];
|
|
87
|
+
const keyValueMap = edges.map((edge) => ({
|
|
88
|
+
key: edge.node.AccountNumber.value,
|
|
89
|
+
value: edge.node.Name.value,
|
|
90
|
+
}));
|
|
84
91
|
updateFilter(dispatch, {
|
|
85
92
|
filterKey: SolrKeys.accountNumber,
|
|
86
93
|
values: [...keyValueMap, ...allSelected],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdditionalFilters.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/AdditionalFilters.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAO/D,wBAAgB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"AdditionalFilters.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/AdditionalFilters.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAO/D,wBAAgB,iBAAiB,sBA6FhC"}
|
|
@@ -8,9 +8,10 @@ import { CaseListFilterDispatchContext, CaseListFilterStateContext } from '../Ca
|
|
|
8
8
|
import { updateFilter } from '../CaseListFilterReducer';
|
|
9
9
|
export function AdditionalFilters() {
|
|
10
10
|
const [escalated, setIsEscalated] = useState(false);
|
|
11
|
+
const [isPrivate, setIsPrivate] = useState(false);
|
|
11
12
|
const { t } = useTranslation();
|
|
12
13
|
const dispatch = useContext(CaseListFilterDispatchContext);
|
|
13
|
-
const { filterInfo: { case_customer_escalation }, } = useContext(CaseListFilterStateContext);
|
|
14
|
+
const { filterInfo: { case_customer_escalation, case_private }, } = useContext(CaseListFilterStateContext);
|
|
14
15
|
const onEscalatedChange = (checked) => {
|
|
15
16
|
updateFilter(dispatch, {
|
|
16
17
|
filterKey: SolrKeys.escalation,
|
|
@@ -18,6 +19,16 @@ export function AdditionalFilters() {
|
|
|
18
19
|
});
|
|
19
20
|
setIsEscalated(checked);
|
|
20
21
|
};
|
|
22
|
+
// @ts-ignore - kept for future use when GraphQL supports private cases filter
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
24
|
+
const onisPrivateChange = (checked) => {
|
|
25
|
+
updateFilter(dispatch, {
|
|
26
|
+
filterKey: SolrKeys.isPrivate,
|
|
27
|
+
values: checked ? [{ key: checked.toString(), value: AdditionalFilterLabels[SolrKeys.isPrivate] }] : [],
|
|
28
|
+
});
|
|
29
|
+
setIsPrivate(checked);
|
|
30
|
+
};
|
|
31
|
+
void onisPrivateChange;
|
|
21
32
|
useEffect(() => {
|
|
22
33
|
var _a, _b;
|
|
23
34
|
updateFilter(dispatch, {
|
|
@@ -29,13 +40,27 @@ export function AdditionalFilters() {
|
|
|
29
40
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
30
41
|
}, []);
|
|
31
42
|
useEffect(() => {
|
|
32
|
-
var _a;
|
|
43
|
+
var _a, _b;
|
|
44
|
+
updateFilter(dispatch, {
|
|
45
|
+
filterKey: SolrKeys.isPrivate,
|
|
46
|
+
values: !isEmpty(case_private) && isEqual((_a = case_private[0]) === null || _a === void 0 ? void 0 : _a.key, 'true')
|
|
47
|
+
? [{ key: (_b = case_private[0]) === null || _b === void 0 ? void 0 : _b.key, value: AdditionalFilterLabels[SolrKeys.isPrivate] }]
|
|
48
|
+
: [],
|
|
49
|
+
});
|
|
50
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
51
|
+
}, []);
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
var _a, _b;
|
|
33
54
|
isEmpty(case_customer_escalation) && escalated && setIsEscalated(false);
|
|
34
55
|
if (!isEmpty(case_customer_escalation)) {
|
|
35
56
|
isEqual((_a = case_customer_escalation[0]) === null || _a === void 0 ? void 0 : _a.key, 'true') ? setIsEscalated(true) : setIsEscalated(false);
|
|
36
57
|
}
|
|
58
|
+
isEmpty(case_private) && isPrivate && setIsPrivate(false);
|
|
59
|
+
if (!isEmpty(case_private)) {
|
|
60
|
+
isEqual((_b = case_private[0]) === null || _b === void 0 ? void 0 : _b.key, 'true') ? setIsPrivate(true) : setIsPrivate(false);
|
|
61
|
+
}
|
|
37
62
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
38
|
-
}, [case_customer_escalation]);
|
|
63
|
+
}, [case_customer_escalation, case_private]);
|
|
39
64
|
return (React.createElement(React.Fragment, null,
|
|
40
65
|
React.createElement("div", { className: "additional-filters" },
|
|
41
66
|
React.createElement("h3", null,
|
|
@@ -1,9 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
interface IProps {
|
|
4
|
-
productVersionPivotValues: IProductVersionPivotMap[];
|
|
5
|
-
isSolrSearchDown: boolean;
|
|
6
|
-
}
|
|
7
|
-
export declare function CaseListFilterChips(props: IProps): React.JSX.Element;
|
|
8
|
-
export {};
|
|
2
|
+
export declare function CaseListFilterChips(): React.JSX.Element;
|
|
9
3
|
//# sourceMappingURL=CaseListFilterChips.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseListFilterChips.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/CaseListFilterChips.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAqB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"CaseListFilterChips.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/CaseListFilterChips.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAU1C,wBAAgB,mBAAmB,sBAwHlC"}
|
|
@@ -7,11 +7,10 @@ import { Trans } from 'react-i18next';
|
|
|
7
7
|
import { ProductVersionKey, SolrKeys, SolrPivotKeys } from '../../../enums/filters';
|
|
8
8
|
import { filterNamesMap } from '../../../utils/constants';
|
|
9
9
|
import { CaseListFilterDispatchContext, CaseListFilterStateContext } from '../CaseListFilterContext';
|
|
10
|
-
import { visibleFilterChipsWhenSolrDownSfdcUp } from '../CaseListFilterHelpers';
|
|
11
10
|
import { clearFilters, removeFilterItem } from '../CaseListFilterReducer';
|
|
12
11
|
import { CreatorSsoNameFilterChip } from './CreatorSsoNameFilterChip';
|
|
13
12
|
import { ProductFilterChip } from './ProductFilterChip';
|
|
14
|
-
export function CaseListFilterChips(
|
|
13
|
+
export function CaseListFilterChips() {
|
|
15
14
|
const { filterInfo } = useContext(CaseListFilterStateContext);
|
|
16
15
|
const dispatch = useContext(CaseListFilterDispatchContext);
|
|
17
16
|
const currentFilterLength = flatMap(filterInfo).length;
|
|
@@ -37,15 +36,10 @@ export function CaseListFilterChips(props) {
|
|
|
37
36
|
};
|
|
38
37
|
const getChipGroupForFilter = (filterKey, filterValues, groupName = '') => {
|
|
39
38
|
const caseTypeFilter = filterKey === 'case_type' ? toNewCaseTypeMapper(filterValues) : filterValues;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return (React.createElement("div", { className: "filter-chip", key: `${filterKey}-bookmarks-${groupName}` },
|
|
45
|
-
React.createElement("span", { className: "filter-chip__heading" },
|
|
46
|
-
React.createElement(Trans, null, groupName || filterNamesMap[filterKey] || filterKey)),
|
|
47
|
-
React.createElement(LabelGroup, { numLabels: 7, className: "pf-v6-c-chip-group__simple" }, renderFilterValueChips(filterKey, caseTypeFilter, groupName))));
|
|
48
|
-
}
|
|
39
|
+
return (React.createElement("div", { className: "filter-chip", key: `${filterKey}-bookmarks-${groupName}` },
|
|
40
|
+
React.createElement("span", { className: "filter-chip__heading" },
|
|
41
|
+
React.createElement(Trans, null, groupName || filterNamesMap[filterKey] || filterKey)),
|
|
42
|
+
React.createElement(LabelGroup, { numLabels: 7, className: "pf-v6-c-chip-group__simple" }, renderFilterValueChips(filterKey, caseTypeFilter, groupName))));
|
|
49
43
|
};
|
|
50
44
|
const renderAccountFilterChip = () => {
|
|
51
45
|
const visibleChips = [];
|
|
@@ -86,10 +80,8 @@ export function CaseListFilterChips(props) {
|
|
|
86
80
|
return (React.createElement(React.Fragment, null, isAnyFilterApplied && (React.createElement("div", { className: "filter-chip-wrapper" },
|
|
87
81
|
React.createElement("h2", null, "Filtering by"),
|
|
88
82
|
React.createElement("div", { className: "filter-chips" },
|
|
89
|
-
Array.isArray(filterInfo[ProductVersionKey]) && filterInfo[ProductVersionKey].length > 0 && (React.createElement(ProductFilterChip, { productList:
|
|
90
|
-
|
|
91
|
-
: filterInfo[ProductVersionKey], productVersionPivot: props.productVersionPivotValues })),
|
|
92
|
-
!props.isSolrSearchDown && showUsernameFilter && React.createElement(CreatorSsoNameFilterChip, null),
|
|
83
|
+
Array.isArray(filterInfo[ProductVersionKey]) && filterInfo[ProductVersionKey].length > 0 && (React.createElement(ProductFilterChip, { productList: filterInfo[ProductVersionKey] })),
|
|
84
|
+
showUsernameFilter && React.createElement(CreatorSsoNameFilterChip, null),
|
|
93
85
|
renderChips(),
|
|
94
86
|
currentFilterLength > 1 && (React.createElement(Button, { variant: "link", isInline: true, onClick: clearAllFilters, "data-tracking-id": "case-list-clear-filters", className: "clear-filters" },
|
|
95
87
|
React.createElement(Trans, null, "Clear all filters"))))))));
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { IApiResponseDetails } from '@rh-support/types/shared';
|
|
2
|
-
import {
|
|
2
|
+
import { ITroubleshootProductResponse } from '@rh-support/utils';
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { IFacetFields } from '../../../models/caseList';
|
|
5
4
|
interface IProps {
|
|
6
|
-
filterValues: ISolrResponseToFacetFields<IFacetFields>;
|
|
7
|
-
isSolrSearchDown: boolean;
|
|
8
5
|
allCaseTypes: IApiResponseDetails<string[]>;
|
|
9
6
|
allCaseStatuses: IApiResponseDetails<string[]>;
|
|
10
7
|
allCaseSeverities: IApiResponseDetails<string[]>;
|
|
11
8
|
allProducts: IApiResponseDetails<ITroubleshootProductResponse>;
|
|
12
9
|
}
|
|
13
|
-
export declare const CaseListFilters: ({
|
|
10
|
+
export declare const CaseListFilters: ({ allCaseTypes, allCaseSeverities, allCaseStatuses, allProducts }: IProps) => React.JSX.Element;
|
|
14
11
|
export {};
|
|
15
12
|
//# sourceMappingURL=CaseListFilters.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseListFilters.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/CaseListFilters.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"CaseListFilters.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/CaseListFilters.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,KAAqB,MAAM,OAAO,CAAC;AAY1C,UAAU,MAAM;IACZ,YAAY,EAAE,mBAAmB,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5C,eAAe,EAAE,mBAAmB,CAAC,MAAM,EAAE,CAAC,CAAC;IAC/C,iBAAiB,EAAE,mBAAmB,CAAC,MAAM,EAAE,CAAC,CAAC;IACjD,WAAW,EAAE,mBAAmB,CAAC,4BAA4B,CAAC,CAAC;CAClE;AAED,eAAO,MAAM,eAAe,GAAI,mEAAmE,MAAM,sBAmExG,CAAC"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { AbilityContext, CaseListFields, resourceActions, resources } from '@rh-support/user-permissions';
|
|
2
|
-
import get from 'lodash/get';
|
|
3
2
|
import React, { useContext } from 'react';
|
|
4
|
-
import { SolrKeys } from '../../../enums/filters';
|
|
5
3
|
import { AccountsBookmarkedGroupFilter } from './AccountsBookmarkedGroupFilter';
|
|
6
4
|
import { AccountsFilter } from './AccountsFilter';
|
|
7
5
|
import { AdditionalFilters } from './AdditionalFilters';
|
|
@@ -11,9 +9,7 @@ import { ProductsFilter } from './ProductsFilter';
|
|
|
11
9
|
import { SeverityFilter } from './SeverityFilter';
|
|
12
10
|
import { StatusFilter } from './StatusFilter';
|
|
13
11
|
import { TypeFilter } from './TypeFilter';
|
|
14
|
-
|
|
15
|
-
// it get included in the solr search query fq parameter
|
|
16
|
-
export const CaseListFilters = ({ filterValues, allCaseTypes, allCaseSeverities, allCaseStatuses, allProducts, isSolrSearchDown, }) => {
|
|
12
|
+
export const CaseListFilters = ({ allCaseTypes, allCaseSeverities, allCaseStatuses, allProducts }) => {
|
|
17
13
|
var _a, _b;
|
|
18
14
|
const ability = useContext(AbilityContext);
|
|
19
15
|
const canReadAccountFilter = ability.can(resourceActions.READ, resources.ACCOUNTS_FILTER);
|
|
@@ -25,17 +21,21 @@ export const CaseListFilters = ({ filterValues, allCaseTypes, allCaseSeverities,
|
|
|
25
21
|
const canAccessSeverityFilter = ability.can(resourceActions.PATCH, resources.CASE_LIST, CaseListFields.SEVERITY_FILTER);
|
|
26
22
|
const canAccessAdditionalFilter = ability.can(resourceActions.PATCH, resources.CASE_LIST, CaseListFields.ADDITIONAL_FILTER);
|
|
27
23
|
const canAccessGroupsFilter = ability.can(resourceActions.PATCH, resources.CASE_LIST, CaseListFields.GROUPS_FILTER);
|
|
24
|
+
void canAccessGroupsFilter;
|
|
25
|
+
void GroupsFilter;
|
|
28
26
|
const canAccessCreatorFilter = ability.can(resourceActions.PATCH, resources.CASE_LIST, CaseListFields.CREATOR_FILTER);
|
|
29
27
|
const canAccessTypeFilter = ability.can(resourceActions.PATCH, resources.CASE_LIST, CaseListFields.TYPE_FILTER);
|
|
30
28
|
return (React.createElement(React.Fragment, null,
|
|
31
29
|
React.createElement("div", { className: "filter-group" },
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
30
|
+
canReadAccountFilter && React.createElement(AccountsFilter, { canReadBookmarkAccounts: canReadAccountFilter }),
|
|
31
|
+
(canReadBookmarkAccounts || canAccessManagedAccounts) && (React.createElement(AccountsBookmarkedGroupFilter, { canManageBookmarkAccounts: canManageBookmarkAccounts, canReadBookmarkAccounts: canReadBookmarkAccounts, canAccessManagedAccounts: canAccessManagedAccounts })),
|
|
32
|
+
canAccessProductsFilter && (React.createElement(ProductsFilter, { allProducts: ((_b = (_a = allProducts.data) === null || _a === void 0 ? void 0 : _a.productsResult) === null || _b === void 0 ? void 0 : _b.map((p) => ({
|
|
33
|
+
name: p.product,
|
|
34
|
+
productId: p.productId,
|
|
35
|
+
}))) || [] })),
|
|
36
|
+
canAccessSeverityFilter && React.createElement(SeverityFilter, { allCaseSeverities: allCaseSeverities.data }),
|
|
37
|
+
canAccessStatusFilter && React.createElement(StatusFilter, { allCaseStatuses: allCaseStatuses.data }),
|
|
38
|
+
canAccessTypeFilter && React.createElement(TypeFilter, { allCaseTypes: allCaseTypes.data }),
|
|
39
|
+
canAccessCreatorFilter && React.createElement(CreatorSsoNameFilter, null),
|
|
40
|
+
canAccessAdditionalFilter && React.createElement(AdditionalFilters, null))));
|
|
41
41
|
};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { IProductVersionPivotMap } from '../CaseList';
|
|
3
2
|
import { IProductFilter } from '../CaseListFilterReducer';
|
|
4
3
|
interface IProps {
|
|
5
4
|
productList: IProductFilter[];
|
|
6
|
-
productVersionPivot: IProductVersionPivotMap[];
|
|
7
5
|
}
|
|
8
|
-
export declare function ProductFilterChip({ productList
|
|
6
|
+
export declare function ProductFilterChip({ productList }: IProps): React.JSX.Element;
|
|
9
7
|
export {};
|
|
10
8
|
//# sourceMappingURL=ProductFilterChip.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductFilterChip.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/ProductFilterChip.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAqB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ProductFilterChip.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/ProductFilterChip.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAK1C,OAAO,EAAE,cAAc,EAAgB,MAAM,0BAA0B,CAAC;AAGxE,UAAU,MAAM;IACZ,WAAW,EAAE,cAAc,EAAE,CAAC;CACjC;AAED,wBAAgB,iBAAiB,CAAC,EAAE,WAAW,EAAE,EAAE,MAAM,qBAsExD"}
|
|
@@ -7,7 +7,7 @@ import { filterNamesMap } from '../../../utils/constants';
|
|
|
7
7
|
import { CaseListFilterDispatchContext, CaseListFilterStateContext } from '../CaseListFilterContext';
|
|
8
8
|
import { updateFilter } from '../CaseListFilterReducer';
|
|
9
9
|
import { VersionsFilter } from './VersionsFilter';
|
|
10
|
-
export function ProductFilterChip({ productList
|
|
10
|
+
export function ProductFilterChip({ productList }) {
|
|
11
11
|
const { filterInfo } = useContext(CaseListFilterStateContext);
|
|
12
12
|
const dispatch = useContext(CaseListFilterDispatchContext);
|
|
13
13
|
const canAccessVersionsFilter = ability.can(resourceActions.PATCH, resources.CASE_LIST, CaseListFields.VERSIONS_FILTER);
|
|
@@ -26,7 +26,7 @@ export function ProductFilterChip({ productList, productVersionPivot = [] }) {
|
|
|
26
26
|
return (React.createElement("div", { className: "filter-chip" },
|
|
27
27
|
React.createElement("span", { className: "filter-chip__heading" }, filterNamesMap[SolrKeys.product]),
|
|
28
28
|
canAccessVersionsFilter ? (React.createElement(React.Fragment, null, productList.map((currentProduct, index) => (React.createElement(LabelGroup, { numLabels: 10, key: `${currentProduct.value}-${index}`, categoryName: currentProduct.value },
|
|
29
|
-
React.createElement(VersionsFilter, { productInfo: currentProduct
|
|
29
|
+
React.createElement(VersionsFilter, { productInfo: currentProduct }),
|
|
30
30
|
currentProduct[SolrKeys.version].map((chip) => (React.createElement(Label, { variant: "outline", key: chip.value, onClose: () => deleteVersion(currentProduct, chip) }, chip.value))),
|
|
31
31
|
React.createElement(Button, { icon: React.createElement(TimesCircleIcon, { "aria-hidden": "true" }), className: "pf-v6-c-button__icon", variant: ButtonVariant.plain, "aria-label": "Remove product", onClick: () => deleteProduct(currentProduct) })))))) : (React.createElement(LabelGroup, { numLabels: 10, categoryName: "Product", key: "products" }, productList.map((currentProduct, index) => (React.createElement(Label, { variant: "outline", key: `${currentProduct.value}-${index}`, onClose: () => deleteProduct(currentProduct) }, currentProduct.value)))))));
|
|
32
32
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { IFacetResponse } from '@rh-support/types/shared';
|
|
2
1
|
import React from 'react';
|
|
2
|
+
interface IProductOption {
|
|
3
|
+
name: string;
|
|
4
|
+
productId: string;
|
|
5
|
+
}
|
|
3
6
|
interface IProps {
|
|
4
|
-
|
|
5
|
-
isSolrSearchDown: boolean;
|
|
6
|
-
allProducts: string[];
|
|
7
|
+
allProducts: IProductOption[];
|
|
7
8
|
}
|
|
8
9
|
export declare function ProductsFilter(props: IProps): React.JSX.Element;
|
|
9
10
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductsFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/ProductsFilter.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ProductsFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/ProductsFilter.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAQvE,UAAU,cAAc;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,MAAM;IACZ,WAAW,EAAE,cAAc,EAAE,CAAC;CACjC;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,qBAoL3C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MenuToggle, Select, SelectList, SelectOption, TextInputGroup, TextInputGroupMain, } from '@patternfly/react-core';
|
|
2
|
-
import {
|
|
2
|
+
import { useSelectKeyboardNavigator } from '@rh-support/components';
|
|
3
3
|
import { getDropdownBtnPlaceholder } from '@rh-support/utils';
|
|
4
4
|
import isEmpty from 'lodash/isEmpty';
|
|
5
5
|
import isUndefined from 'lodash/isUndefined';
|
|
@@ -10,11 +10,11 @@ import { filterNamesMap } from '../../../utils/constants';
|
|
|
10
10
|
import { CaseListFilterDispatchContext, CaseListFilterStateContext } from '../CaseListFilterContext';
|
|
11
11
|
import { updateFilter } from '../CaseListFilterReducer';
|
|
12
12
|
export function ProductsFilter(props) {
|
|
13
|
-
var _a
|
|
13
|
+
var _a;
|
|
14
14
|
const { t } = useTranslation();
|
|
15
15
|
const dispatch = useContext(CaseListFilterDispatchContext);
|
|
16
16
|
const { filterInfo } = useContext(CaseListFilterStateContext);
|
|
17
|
-
const { allProducts
|
|
17
|
+
const { allProducts } = props;
|
|
18
18
|
const [isOpen, setIsOpen] = useState(false);
|
|
19
19
|
const [selectedItems, setSelectedItems] = useState({});
|
|
20
20
|
const [activeItem, setActiveItem] = useState(null);
|
|
@@ -23,51 +23,24 @@ export function ProductsFilter(props) {
|
|
|
23
23
|
const selectedProducts = !isUndefined(filterInfo) && !isUndefined(filterInfo[SolrPivotKeys.product_version])
|
|
24
24
|
? filterInfo[SolrPivotKeys.product_version]
|
|
25
25
|
: [];
|
|
26
|
-
const productOptions =
|
|
26
|
+
const productOptions = allProducts.map((product) => ({
|
|
27
27
|
field: SolrKeys.product,
|
|
28
|
-
value: product.
|
|
28
|
+
value: product.name,
|
|
29
|
+
productId: product.productId,
|
|
29
30
|
[SolrKeys.version]: [],
|
|
30
31
|
}));
|
|
31
|
-
const singleSelectOptions = allProducts.length > 0
|
|
32
|
-
? allProducts.map((product) => ({
|
|
33
|
-
value: product,
|
|
34
|
-
label: product,
|
|
35
|
-
}))
|
|
36
|
-
: [{ value: '', label: t('No products available') }];
|
|
37
|
-
const selectedProduct = ((_b = (_a = filterInfo === null || filterInfo === void 0 ? void 0 : filterInfo[SolrPivotKeys.product_version]) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.value) || '';
|
|
38
|
-
const selectedOption = {
|
|
39
|
-
value: selectedProduct,
|
|
40
|
-
label: selectedProduct,
|
|
41
|
-
};
|
|
42
|
-
// Single select mode for when Solr is down
|
|
43
|
-
const onFilterChangeSingleSelect = (selection) => {
|
|
44
|
-
updateFilter(dispatch, {
|
|
45
|
-
filterKey: SolrPivotKeys.product_version,
|
|
46
|
-
values: [{ field: SolrKeys.product, value: selection.value, [SolrKeys.version]: [] }],
|
|
47
|
-
});
|
|
48
|
-
setIsOpen(false);
|
|
49
|
-
};
|
|
50
|
-
const onSingleSelectChange = (option) => {
|
|
51
|
-
// Don't update filter if no products are available
|
|
52
|
-
if (allProducts.length === 0 || option.value === '') {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
updateFilter(dispatch, {
|
|
56
|
-
filterKey: SolrPivotKeys.product_version,
|
|
57
|
-
values: [{ field: SolrKeys.product, value: option.value, [SolrKeys.version]: [] }],
|
|
58
|
-
});
|
|
59
|
-
};
|
|
60
|
-
// Multi-select mode
|
|
61
32
|
const onSelect = (option) => {
|
|
33
|
+
var _a;
|
|
62
34
|
let newSelectedProducts = [];
|
|
63
35
|
if (selectedProducts === null || selectedProducts === void 0 ? void 0 : selectedProducts.some((product) => option.value === product.value)) {
|
|
64
36
|
newSelectedProducts = selectedProducts.filter((product) => option.value !== product.value);
|
|
65
37
|
setSelectedItems((prevData) => (Object.assign(Object.assign({}, prevData), { [option.value]: false })));
|
|
66
38
|
}
|
|
67
39
|
else {
|
|
40
|
+
const productId = option.productId || ((_a = allProducts.find((p) => p.name === option.value)) === null || _a === void 0 ? void 0 : _a.productId) || '';
|
|
68
41
|
newSelectedProducts = [
|
|
69
42
|
...selectedProducts,
|
|
70
|
-
{ field: SolrKeys.product, value: option.value, [SolrKeys.version]: [] },
|
|
43
|
+
{ field: SolrKeys.product, value: option.value, productId, [SolrKeys.version]: [] },
|
|
71
44
|
];
|
|
72
45
|
setSelectedItems((prevData) => (Object.assign(Object.assign({}, prevData), { [option.value]: true })));
|
|
73
46
|
}
|
|
@@ -93,21 +66,12 @@ export function ProductsFilter(props) {
|
|
|
93
66
|
resetIndexOnClose: true,
|
|
94
67
|
isDisabled: false,
|
|
95
68
|
setIsOpen,
|
|
96
|
-
onSelect
|
|
97
|
-
if (isSolrSearchDown) {
|
|
98
|
-
onFilterChangeSingleSelect(item);
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
onSelect(item);
|
|
102
|
-
}
|
|
103
|
-
},
|
|
69
|
+
onSelect,
|
|
104
70
|
});
|
|
105
71
|
const onTextInputChange = (_event, value) => {
|
|
106
72
|
setInputValue(value);
|
|
107
73
|
};
|
|
108
|
-
const placeholder =
|
|
109
|
-
? ((_d = (_c = filterInfo === null || filterInfo === void 0 ? void 0 : filterInfo[SolrPivotKeys.product_version]) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.value) || t('Select a product')
|
|
110
|
-
: getDropdownBtnPlaceholder(t('Select a product'), ((_f = filterInfo === null || filterInfo === void 0 ? void 0 : filterInfo[SolrPivotKeys.product_version]) === null || _f === void 0 ? void 0 : _f.map((i) => i.value)) || [], '', props.filterValues.length, t('All selected'));
|
|
74
|
+
const placeholder = getDropdownBtnPlaceholder(t('Select a product'), ((_a = filterInfo === null || filterInfo === void 0 ? void 0 : filterInfo[SolrPivotKeys.product_version]) === null || _a === void 0 ? void 0 : _a.map((i) => i.value)) || [], '', (allProducts === null || allProducts === void 0 ? void 0 : allProducts.length) || 0, t('All selected'));
|
|
111
75
|
const toggleForMultiSelect = (toggleRef) => (React.createElement(MenuToggle, { variant: "typeahead", onClick: onToggleClick, innerRef: toggleRef, isExpanded: isOpen, isFullWidth: true },
|
|
112
76
|
React.createElement(TextInputGroup, { isPlain: true },
|
|
113
77
|
React.createElement(TextInputGroupMain, Object.assign({ value: inputValue, onClick: onToggleClick, onChange: onTextInputChange, onKeyDown: onInputKeyDown, id: "multi-typeahead-product-filter-input", autoComplete: "off", innerRef: textInputRef, placeholder: placeholder }, (activeItem && { 'aria-activedescendant': activeItem }), { role: "combobox", isExpanded: isOpen, "aria-controls": "select-multi-typeahead-product-listbox" })))));
|
|
@@ -129,9 +93,6 @@ export function ProductsFilter(props) {
|
|
|
129
93
|
}, [inputValue]);
|
|
130
94
|
useEffect(() => {
|
|
131
95
|
var _a;
|
|
132
|
-
if (isSolrSearchDown) {
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
96
|
if (isEmpty(filterInfo === null || filterInfo === void 0 ? void 0 : filterInfo[SolrPivotKeys.product_version])) {
|
|
136
97
|
setSelectedItems({});
|
|
137
98
|
}
|
|
@@ -142,13 +103,13 @@ export function ProductsFilter(props) {
|
|
|
142
103
|
}, {});
|
|
143
104
|
setSelectedItems(selectedProductItems || {});
|
|
144
105
|
}
|
|
145
|
-
}, [filterInfo
|
|
106
|
+
}, [filterInfo]);
|
|
146
107
|
const renderOptions = () => {
|
|
147
108
|
const filteredOptions = getFilteredOptions();
|
|
148
|
-
return filteredOptions.map((option, index) => (React.createElement(SelectOption, { key: `product-option-${index}`, value: option, hasCheckbox:
|
|
109
|
+
return filteredOptions.map((option, index) => (React.createElement(SelectOption, { key: `product-option-${index}`, value: option, hasCheckbox: true, isSelected: selectedItems[option.value], isFocused: focusedItemIndex !== null && focusedItemIndex === index, id: `select-product-${String(option.value).replace(/\s/g, '-')}` }, option.value)));
|
|
149
110
|
};
|
|
150
111
|
return (React.createElement("div", { className: "product-filter" },
|
|
151
112
|
React.createElement("label", { htmlFor: "case-list-products-filter", className: "pf-v6-u-mb-sm products-filter-label" }, t(filterNamesMap[SolrKeys.product])),
|
|
152
|
-
|
|
153
|
-
React.createElement(SelectList, null, renderOptions()))))
|
|
113
|
+
React.createElement(Select, { shouldFocusToggleOnSelect: true, shouldPreventScrollOnItemFocus: true, id: "case-list-products-filter", "data-tracking-id": "products-filter", isOpen: isOpen, selected: selectedItems, onSelect: (_e, v) => onSelect(v), onOpenChange: (nextOpen) => setIsOpen(nextOpen), toggle: toggleForMultiSelect, isScrollable: true, popperProps: { direction: 'down', enableFlip: false, maxWidth: '30rem' } },
|
|
114
|
+
React.createElement(SelectList, null, renderOptions()))));
|
|
154
115
|
}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { IFacetResponse } from '@rh-support/types/shared';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
interface IProps {
|
|
4
|
-
filterValues: IFacetResponse[];
|
|
5
3
|
allCaseSeverities: string[];
|
|
6
|
-
isSolrSearchDown: boolean;
|
|
7
4
|
}
|
|
8
5
|
export declare function SeverityFilter(props: IProps): React.JSX.Element;
|
|
9
6
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SeverityFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/SeverityFilter.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SeverityFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/SeverityFilter.tsx"],"names":[],"mappings":"AAYA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAQ/D,UAAU,MAAM;IACZ,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC/B;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,qBA0I3C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Button, MenuToggle, Select, SelectList, SelectOption, } from '@patternfly/react-core';
|
|
2
|
-
import {
|
|
2
|
+
import { useSelectKeyboardNavigator } from '@rh-support/components';
|
|
3
3
|
import { getDropdownBtnPlaceholder } from '@rh-support/utils';
|
|
4
4
|
import isEmpty from 'lodash/isEmpty';
|
|
5
5
|
import React, { useContext, useEffect, useState } from 'react';
|
|
@@ -9,56 +9,38 @@ import { filterNamesMap } from '../../../utils/constants';
|
|
|
9
9
|
import { CaseListFilterDispatchContext, CaseListFilterStateContext } from '../CaseListFilterContext';
|
|
10
10
|
import { updateFilter } from '../CaseListFilterReducer';
|
|
11
11
|
export function SeverityFilter(props) {
|
|
12
|
-
var _a;
|
|
13
12
|
const { t } = useTranslation();
|
|
14
13
|
const { filterInfo } = useContext(CaseListFilterStateContext);
|
|
15
14
|
const dispatch = useContext(CaseListFilterDispatchContext);
|
|
16
15
|
const [isOpen, setIsOpen] = useState(false);
|
|
17
16
|
const [selectedItems, setSelectedItems] = useState({});
|
|
18
|
-
const list = props.
|
|
19
|
-
|
|
20
|
-
:
|
|
21
|
-
const singleSelectOptions = list.map((item) => ({
|
|
22
|
-
value: item.value,
|
|
23
|
-
label: item.value,
|
|
17
|
+
const list = (props.allCaseSeverities || []).map((severity) => ({
|
|
18
|
+
value: severity,
|
|
19
|
+
key: severity,
|
|
24
20
|
}));
|
|
25
|
-
const selectedSeverity = ((_a = filterInfo[SolrKeys.severity]) === null || _a === void 0 ? void 0 : _a[0]) || '';
|
|
26
|
-
const selectedOption = {
|
|
27
|
-
value: selectedSeverity,
|
|
28
|
-
label: selectedSeverity,
|
|
29
|
-
};
|
|
30
21
|
const onToggleClick = (e) => {
|
|
31
22
|
setIsOpen(!isOpen);
|
|
32
23
|
};
|
|
33
24
|
const onSelect = (option) => {
|
|
34
|
-
if (props.isSolrSearchDown) {
|
|
35
|
-
updateFilter(dispatch, {
|
|
36
|
-
filterKey: SolrKeys.severity,
|
|
37
|
-
values: [option.value],
|
|
38
|
-
});
|
|
39
|
-
setIsOpen(false);
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
25
|
const prevSelectedSeverities = Object.keys(selectedItems).filter((item) => selectedItems[item] && item);
|
|
43
26
|
if (selectedItems[option.value]) {
|
|
44
27
|
setSelectedItems((prevData) => (Object.assign(Object.assign({}, prevData), { [option.value]: false })));
|
|
45
|
-
|
|
46
|
-
|
|
28
|
+
updateFilter(dispatch, {
|
|
29
|
+
filterKey: SolrKeys.severity,
|
|
30
|
+
values: prevSelectedSeverities.filter((item) => item !== option.value),
|
|
31
|
+
});
|
|
47
32
|
}
|
|
48
33
|
else {
|
|
49
34
|
setSelectedItems((prevData) => (Object.assign(Object.assign({}, prevData), { [option.value]: true })));
|
|
50
|
-
|
|
35
|
+
updateFilter(dispatch, {
|
|
36
|
+
filterKey: SolrKeys.severity,
|
|
37
|
+
values: [...prevSelectedSeverities, option.value],
|
|
38
|
+
});
|
|
51
39
|
}
|
|
52
|
-
updateFilter(dispatch, {
|
|
53
|
-
filterKey: SolrKeys.severity,
|
|
54
|
-
values: prevSelectedSeverities,
|
|
55
|
-
});
|
|
56
40
|
};
|
|
57
|
-
// Use the keyboard navigator hook
|
|
58
41
|
const { focusedItemIndex, onInputKeyDown } = useSelectKeyboardNavigator({
|
|
59
42
|
list,
|
|
60
43
|
isOpen,
|
|
61
|
-
resetIndexOnClose: true,
|
|
62
44
|
setIsOpen,
|
|
63
45
|
onSelect,
|
|
64
46
|
});
|
|
@@ -69,25 +51,17 @@ export function SeverityFilter(props) {
|
|
|
69
51
|
values: [],
|
|
70
52
|
});
|
|
71
53
|
};
|
|
72
|
-
const placeholder =
|
|
73
|
-
? t('Select a severity')
|
|
74
|
-
: getDropdownBtnPlaceholder(t('Select a severity'), filterInfo[SolrKeys.severity], ' ', list.length, t('All selected'));
|
|
54
|
+
const placeholder = getDropdownBtnPlaceholder(t('Select a severity'), filterInfo[SolrKeys.severity], ' ', list.length, t('All selected'));
|
|
75
55
|
const toggle = (toggleRef) => (React.createElement(MenuToggle, { variant: "default", onClick: onToggleClick, innerRef: toggleRef, isExpanded: isOpen, isFullWidth: true, onKeyDown: onInputKeyDown },
|
|
76
56
|
placeholder,
|
|
77
57
|
Object.keys(selectedItems).filter((key) => selectedItems[key] === true).length > 0 && (React.createElement(Button, { icon: "", variant: "plain", onClick: onClick, "aria-label": "Clear selection", className: "pf-v6-c-select__toggle-clear" }))));
|
|
78
|
-
const dropdownOptions = list.map((option, index) => !isEmpty(option.value) && (React.createElement(SelectOption, { key: option.key, value: option, hasCheckbox:
|
|
79
|
-
const onSingleSelectChange = (option) => {
|
|
80
|
-
updateFilter(dispatch, {
|
|
81
|
-
filterKey: SolrKeys.severity,
|
|
82
|
-
values: [option.value],
|
|
83
|
-
});
|
|
84
|
-
};
|
|
58
|
+
const dropdownOptions = list.map((option, index) => !isEmpty(option.value) && (React.createElement(SelectOption, { key: option.key, value: option, hasCheckbox: true, isSelected: selectedItems[option.value], isFocused: focusedItemIndex !== null && focusedItemIndex === index, id: `select-severity-${option.value.replace(' ', '-')}` }, option.value)));
|
|
85
59
|
useEffect(() => {
|
|
86
60
|
var _a;
|
|
87
61
|
if (isEmpty(filterInfo[SolrKeys.severity])) {
|
|
88
62
|
setSelectedItems({});
|
|
89
63
|
}
|
|
90
|
-
else
|
|
64
|
+
else {
|
|
91
65
|
const selectedSeverities = (_a = filterInfo[SolrKeys.severity]) === null || _a === void 0 ? void 0 : _a.reduce((selection, severity) => {
|
|
92
66
|
selection[severity] = true;
|
|
93
67
|
return selection;
|
|
@@ -95,9 +69,9 @@ export function SeverityFilter(props) {
|
|
|
95
69
|
setSelectedItems(selectedSeverities);
|
|
96
70
|
}
|
|
97
71
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
98
|
-
}, [filterInfo[SolrKeys.severity]
|
|
72
|
+
}, [filterInfo[SolrKeys.severity]]);
|
|
99
73
|
return (React.createElement("div", { className: "severity-filter" },
|
|
100
74
|
React.createElement("label", { htmlFor: "case-list-severity-filter", className: "pf-v6-u-mb-sm severity-filter-label" }, t(filterNamesMap[SolrKeys.severity])),
|
|
101
|
-
|
|
102
|
-
React.createElement(SelectList, null, dropdownOptions))))
|
|
75
|
+
React.createElement(Select, { shouldFocusToggleOnSelect: true, shouldPreventScrollOnItemFocus: true, id: "case-list-severity-filter", "data-tracking-id": "severity-filter", isOpen: isOpen, selected: selectedItems, onSelect: (_e, v) => onSelect(v), onOpenChange: (nextOpen) => setIsOpen(nextOpen), toggle: toggle, isScrollable: true, popperProps: { direction: 'down', enableFlip: false } },
|
|
76
|
+
React.createElement(SelectList, null, dropdownOptions))));
|
|
103
77
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/StatusFilter.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StatusFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/StatusFilter.tsx"],"names":[],"mappings":"AAWA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAQ/D,UAAU,MAAM;IACZ,eAAe,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,oBAAoB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,qBAqKzC"}
|