@rh-support/cases 2.6.219 → 2.6.227
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/esm/components/case/NewCaseButton.js +1 -1
- package/lib/esm/components/case-list/CaseList.d.ts +7 -0
- package/lib/esm/components/case-list/CaseList.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseList.js +135 -366
- package/lib/esm/components/case-list/CaseListContext.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListContext.js +2 -5
- package/lib/esm/components/case-list/CaseListFilterContext.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListFilterContext.js +1 -2
- package/lib/esm/components/case-list/CaseListFilterHelpers.d.ts +2 -3
- package/lib/esm/components/case-list/CaseListFilterHelpers.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListFilterHelpers.js +6 -19
- package/lib/esm/components/case-list/CaseListFilterReducer.d.ts +4 -36
- package/lib/esm/components/case-list/CaseListFilterReducer.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListFilterReducer.js +12 -6
- package/lib/esm/components/case-list/CaseListReducer.d.ts +10 -22
- package/lib/esm/components/case-list/CaseListReducer.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListReducer.js +7 -25
- package/lib/esm/components/case-list/case-list-filters/AccountsFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/AccountsFilter.js +11 -18
- package/lib/esm/components/case-list/case-list-filters/AdditionalFilters.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/AdditionalFilters.js +2 -6
- package/lib/esm/components/case-list/case-list-filters/CaseListFilterChips.d.ts +7 -1
- package/lib/esm/components/case-list/case-list-filters/CaseListFilterChips.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/CaseListFilterChips.js +16 -12
- package/lib/esm/components/case-list/case-list-filters/CaseListFilters.d.ts +5 -2
- package/lib/esm/components/case-list/case-list-filters/CaseListFilters.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/CaseListFilters.js +13 -14
- package/lib/esm/components/case-list/case-list-filters/CreatorSsoNameFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/CreatorSsoNameFilter.js +14 -21
- package/lib/esm/components/case-list/case-list-filters/CreatorSsoNameFilterChip.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/CreatorSsoNameFilterChip.js +0 -3
- package/lib/esm/components/case-list/case-list-filters/GroupsFilter.d.ts +1 -11
- package/lib/esm/components/case-list/case-list-filters/GroupsFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/GroupsFilter.js +70 -90
- package/lib/esm/components/case-list/case-list-filters/ProductFilterChip.d.ts +3 -1
- package/lib/esm/components/case-list/case-list-filters/ProductFilterChip.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/ProductFilterChip.js +2 -2
- package/lib/esm/components/case-list/case-list-filters/ProductsFilter.d.ts +4 -5
- package/lib/esm/components/case-list/case-list-filters/ProductsFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/ProductsFilter.js +54 -15
- package/lib/esm/components/case-list/case-list-filters/SeverityFilter.d.ts +3 -0
- package/lib/esm/components/case-list/case-list-filters/SeverityFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/SeverityFilter.js +44 -18
- package/lib/esm/components/case-list/case-list-filters/StatusFilter.d.ts +3 -0
- package/lib/esm/components/case-list/case-list-filters/StatusFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/StatusFilter.js +44 -14
- package/lib/esm/components/case-list/case-list-filters/VersionsFilter.d.ts +3 -1
- package/lib/esm/components/case-list/case-list-filters/VersionsFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/VersionsFilter.js +59 -60
- package/lib/esm/components/case-list/case-list-table/CaseListTable.d.ts +3 -8
- package/lib/esm/components/case-list/case-list-table/CaseListTable.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-table/CaseListTable.js +55 -88
- package/lib/esm/components/case-list/case-list-table/DownloadCSVFileModal.d.ts +5 -0
- package/lib/esm/components/case-list/case-list-table/DownloadCSVFileModal.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-table/DownloadCSVFileModal.js +70 -51
- package/lib/esm/components/case-list/case-list-table/ExportCaseListCSV.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-table/ExportCaseListCSV.js +15 -5
- package/lib/esm/components/case-list/case-list-table/SeverityLabel.js +1 -1
- package/lib/esm/components/case-list/case-list-table/TableActionsDropdown.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-table/TableActionsDropdown.js +3 -2
- package/lib/esm/components/case-list/case-list-table/table-column-selector/TableColumnSelector.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-table/table-column-selector/TableColumnSelector.js +0 -1
- package/lib/esm/components/case-list/case-search/BookmarkedSearchesSelector.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-search/BookmarkedSearchesSelector.js +0 -1
- package/lib/esm/components/case-list/case-search/CaseSearch.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-search/CaseSearch.js +24 -55
- package/lib/esm/components/case-list/case-search/useAdvanceSearchParser.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-search/useAdvanceSearchParser.js +1 -2
- package/lib/esm/css/caseList.css +22 -183
- package/lib/esm/css/caseSearch.css +0 -114
- package/lib/esm/enums/case.d.ts +5 -13
- package/lib/esm/enums/case.d.ts.map +1 -1
- package/lib/esm/enums/case.js +3 -23
- package/lib/esm/enums/caseSearch.d.ts +0 -3
- package/lib/esm/enums/caseSearch.d.ts.map +1 -1
- package/lib/esm/enums/caseSearch.js +1 -2
- package/lib/esm/enums/filters.d.ts +1 -3
- package/lib/esm/enums/filters.d.ts.map +1 -1
- package/lib/esm/enums/filters.js +0 -2
- package/lib/esm/hooks/useCloseCase.d.ts.map +1 -1
- package/lib/esm/hooks/useCloseCase.js +21 -38
- package/lib/esm/hooks/useExportCaseListCSV.d.ts.map +1 -1
- package/lib/esm/hooks/useExportCaseListCSV.js +9 -1
- package/lib/esm/hooks/useFilterStateOnLoad.d.ts +1 -1
- package/lib/esm/hooks/useFilterStateOnLoad.d.ts.map +1 -1
- package/lib/esm/hooks/useFilterStateOnLoad.js +5 -7
- package/lib/esm/index.js +0 -1
- package/lib/esm/models/caseList.d.ts +0 -1
- package/lib/esm/models/caseList.d.ts.map +1 -1
- package/lib/esm/test-utils/mockData.d.ts +0 -1
- package/lib/esm/test-utils/mockData.d.ts.map +1 -1
- package/lib/esm/test-utils/mockData.js +1 -2
- package/lib/esm/utils/caseSearchUtils.d.ts.map +1 -1
- package/lib/esm/utils/caseSearchUtils.js +2 -39
- package/lib/esm/utils/constants.d.ts +1 -5
- package/lib/esm/utils/constants.d.ts.map +1 -1
- package/lib/esm/utils/constants.js +2 -10
- package/lib/esm/utils/mockSolrResponse.js +1 -1
- package/package.json +8 -10
- package/lib/esm/components/case-list/case-list-filters/CaseLabelsFilter.d.ts +0 -3
- package/lib/esm/components/case-list/case-list-filters/CaseLabelsFilter.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-list-filters/CaseLabelsFilter.js +0 -177
- package/lib/esm/components/case-list/case-list-table/CaseListLabelGroup.d.ts +0 -9
- package/lib/esm/components/case-list/case-list-table/CaseListLabelGroup.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-list-table/CaseListLabelGroup.js +0 -105
- package/lib/esm/components/case-list/case-search/AdvanceSearchToggleButton.d.ts +0 -8
- package/lib/esm/components/case-list/case-search/AdvanceSearchToggleButton.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/AdvanceSearchToggleButton.js +0 -8
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAccountSection.d.ts +0 -10
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAccountSection.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAccountSection.js +0 -29
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAuditsSection.d.ts +0 -10
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAuditsSection.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAuditsSection.js +0 -16
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchCaseSection.d.ts +0 -9
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchCaseSection.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchCaseSection.js +0 -21
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchDateRangeField.d.ts +0 -12
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchDateRangeField.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchDateRangeField.js +0 -31
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchFieldBlock.d.ts +0 -10
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchFieldBlock.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchFieldBlock.js +0 -10
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchModal.d.ts +0 -10
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchModal.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchModal.js +0 -92
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchOwnerSection.d.ts +0 -9
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchOwnerSection.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchOwnerSection.js +0 -20
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchProductSection.d.ts +0 -9
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchProductSection.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchProductSection.js +0 -28
- package/lib/esm/components/case-list/case-search/advance-search-modal/ProductVersionDrilldownSelect.d.ts +0 -9
- package/lib/esm/components/case-list/case-search/advance-search-modal/ProductVersionDrilldownSelect.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/advance-search-modal/ProductVersionDrilldownSelect.js +0 -241
- package/lib/esm/components/case-list/case-search/advance-search-modal/SelectableLabelFilter.d.ts +0 -11
- package/lib/esm/components/case-list/case-search/advance-search-modal/SelectableLabelFilter.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-search/advance-search-modal/SelectableLabelFilter.js +0 -23
- package/lib/esm/hooks/useCaseLabels.d.ts +0 -14
- package/lib/esm/hooks/useCaseLabels.d.ts.map +0 -1
- package/lib/esm/hooks/useCaseLabels.js +0 -55
- package/lib/esm/utils/advanceSearchFormMapper.d.ts +0 -11
- package/lib/esm/utils/advanceSearchFormMapper.d.ts.map +0 -1
- package/lib/esm/utils/advanceSearchFormMapper.js +0 -71
- package/lib/esm/utils/advanceSearchUtils.d.ts +0 -24
- package/lib/esm/utils/advanceSearchUtils.d.ts.map +0 -1
- package/lib/esm/utils/advanceSearchUtils.js +0 -150
- package/lib/esm/utils/caseGroupDefaultFilterUtils.d.ts +0 -12
- package/lib/esm/utils/caseGroupDefaultFilterUtils.d.ts.map +0 -1
- package/lib/esm/utils/caseGroupDefaultFilterUtils.js +0 -34
- package/lib/esm/utils/caseGroupDefaultUtils.d.ts +0 -10
- package/lib/esm/utils/caseGroupDefaultUtils.d.ts.map +0 -1
- package/lib/esm/utils/caseGroupDefaultUtils.js +0 -20
- package/lib/esm/utils/caseListGraphQLUtils.d.ts +0 -28
- package/lib/esm/utils/caseListGraphQLUtils.d.ts.map +0 -1
- package/lib/esm/utils/caseListGraphQLUtils.js +0 -280
- package/lib/esm/utils/caseListMapper.d.ts +0 -6
- package/lib/esm/utils/caseListMapper.d.ts.map +0 -1
- package/lib/esm/utils/caseListMapper.js +0 -44
- package/lib/esm/utils/caseListVariablesBuilder.d.ts +0 -15
- package/lib/esm/utils/caseListVariablesBuilder.d.ts.map +0 -1
- package/lib/esm/utils/caseListVariablesBuilder.js +0 -517
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { AbilityContext, CaseListFields, resourceActions, resources } from '@rh-support/user-permissions';
|
|
2
|
+
import get from 'lodash/get';
|
|
2
3
|
import React, { useContext } from 'react';
|
|
4
|
+
import { SolrKeys } from '../../../enums/filters';
|
|
3
5
|
import { AccountsBookmarkedGroupFilter } from './AccountsBookmarkedGroupFilter';
|
|
4
6
|
import { AccountsFilter } from './AccountsFilter';
|
|
5
7
|
import { AdditionalFilters } from './AdditionalFilters';
|
|
6
|
-
import { CaseLabelsFilter } from './CaseLabelsFilter';
|
|
7
8
|
import { CreatorSsoNameFilter } from './CreatorSsoNameFilter';
|
|
8
9
|
import { GroupsFilter } from './GroupsFilter';
|
|
9
10
|
import { ProductsFilter } from './ProductsFilter';
|
|
10
11
|
import { SeverityFilter } from './SeverityFilter';
|
|
11
12
|
import { StatusFilter } from './StatusFilter';
|
|
12
13
|
import { TypeFilter } from './TypeFilter';
|
|
13
|
-
|
|
14
|
+
// Adding a new filter here? Make sure you add in caseSearchUtils also so that
|
|
15
|
+
// it get included in the solr search query fq parameter
|
|
16
|
+
export const CaseListFilters = ({ filterValues, allCaseTypes, allCaseSeverities, allCaseStatuses, allProducts, isSolrSearchDown, }) => {
|
|
14
17
|
var _a, _b;
|
|
15
18
|
const ability = useContext(AbilityContext);
|
|
16
19
|
const canReadAccountFilter = ability.can(resourceActions.READ, resources.ACCOUNTS_FILTER);
|
|
@@ -26,17 +29,13 @@ export const CaseListFilters = ({ allCaseTypes, allCaseSeverities, allCaseStatus
|
|
|
26
29
|
const canAccessTypeFilter = ability.can(resourceActions.PATCH, resources.CASE_LIST, CaseListFields.TYPE_FILTER);
|
|
27
30
|
return (React.createElement(React.Fragment, null,
|
|
28
31
|
React.createElement("div", { className: "filter-group" },
|
|
29
|
-
canReadAccountFilter && React.createElement(AccountsFilter, { canReadBookmarkAccounts: canReadAccountFilter }),
|
|
30
|
-
(canReadBookmarkAccounts || canAccessManagedAccounts) && (React.createElement(AccountsBookmarkedGroupFilter, { canManageBookmarkAccounts: canManageBookmarkAccounts, canReadBookmarkAccounts: canReadBookmarkAccounts, canAccessManagedAccounts: canAccessManagedAccounts })),
|
|
32
|
+
!isSolrSearchDown && canReadAccountFilter && (React.createElement(AccountsFilter, { canReadBookmarkAccounts: canReadAccountFilter })),
|
|
33
|
+
!isSolrSearchDown && (canReadBookmarkAccounts || canAccessManagedAccounts) && (React.createElement(AccountsBookmarkedGroupFilter, { canManageBookmarkAccounts: canManageBookmarkAccounts, canReadBookmarkAccounts: canReadBookmarkAccounts, canAccessManagedAccounts: canAccessManagedAccounts })),
|
|
31
34
|
canAccessGroupsFilter && React.createElement(GroupsFilter, null),
|
|
32
|
-
React.createElement(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
canAccessStatusFilter && React.createElement(StatusFilter, { allCaseStatuses: allCaseStatuses.data }),
|
|
39
|
-
canAccessTypeFilter && React.createElement(TypeFilter, { allCaseTypes: allCaseTypes.data }),
|
|
40
|
-
canAccessCreatorFilter && React.createElement(CreatorSsoNameFilter, null),
|
|
41
|
-
canAccessAdditionalFilter && React.createElement(AdditionalFilters, null))));
|
|
35
|
+
canAccessProductsFilter && (React.createElement(ProductsFilter, { filterValues: get(filterValues, SolrKeys.product, []), isSolrSearchDown: isSolrSearchDown, allProducts: ((_b = (_a = allProducts.data) === null || _a === void 0 ? void 0 : _a.productsResult) === null || _b === void 0 ? void 0 : _b.map((p) => p.product)) || [] })),
|
|
36
|
+
canAccessSeverityFilter && (React.createElement(SeverityFilter, { filterValues: get(filterValues, SolrKeys.severity, []), isSolrSearchDown: isSolrSearchDown, allCaseSeverities: allCaseSeverities.data })),
|
|
37
|
+
canAccessStatusFilter && (React.createElement(StatusFilter, { filterValues: get(filterValues, SolrKeys.status, []), allCaseStatuses: allCaseStatuses.data, isSolrSearchDown: isSolrSearchDown })),
|
|
38
|
+
!isSolrSearchDown && canAccessTypeFilter && React.createElement(TypeFilter, { allCaseTypes: allCaseTypes.data }),
|
|
39
|
+
!isSolrSearchDown && canAccessCreatorFilter && React.createElement(CreatorSsoNameFilter, null),
|
|
40
|
+
!isSolrSearchDown && canAccessAdditionalFilter && React.createElement(AdditionalFilters, null))));
|
|
42
41
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreatorSsoNameFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/CreatorSsoNameFilter.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAYhF,eAAO,MAAM,WAAW,GAAI,YAAO,WAIlC,CAAC;AAYF,eAAO,MAAM,eAAe,GAAI,gBAAW,EAAE,QAAG;;;;;;;GAAyD,CAAC;AAE1G,eAAO,MAAM,kBAAkB,GAAI,iBAAY,EAAE,eAAU,EAAE,QAAG,EAAE,MAAC,UAyClE,CAAC;AAEF,wBAAgB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"CreatorSsoNameFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/CreatorSsoNameFilter.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAYhF,eAAO,MAAM,WAAW,GAAI,YAAO,WAIlC,CAAC;AAYF,eAAO,MAAM,eAAe,GAAI,gBAAW,EAAE,QAAG;;;;;;;GAAyD,CAAC;AAE1G,eAAO,MAAM,kBAAkB,GAAI,iBAAY,EAAE,eAAU,EAAE,QAAG,EAAE,MAAC,UAyClE,CAAC;AAEF,wBAAgB,oBAAoB,sBA8PnC"}
|
|
@@ -7,12 +7,12 @@ 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 { accounts } from '@cee-eng/hydrajs';
|
|
11
11
|
import { Button, MenuToggle, Select, SelectGroup, SelectList, SelectOption, TextInputGroup, TextInputGroupMain, TextInputGroupUtilities, Truncate, } from '@patternfly/react-core';
|
|
12
12
|
import TimesCircleIcon from '@patternfly/react-icons/dist/js/icons/times-circle-icon';
|
|
13
|
-
import { LoadingIndicator, useSelectKeyboardNavigator } from '@rh-support/components';
|
|
13
|
+
import { LoadingIndicator, useFetch, useSelectKeyboardNavigator } from '@rh-support/components';
|
|
14
14
|
import { GlobalMetadataStateContext } from '@rh-support/react-context';
|
|
15
|
-
import {
|
|
15
|
+
import { getDropdownBtnPlaceholder } from '@rh-support/utils';
|
|
16
16
|
import isEmpty from 'lodash/isEmpty';
|
|
17
17
|
import isNull from 'lodash/isNull';
|
|
18
18
|
import isUndefined from 'lodash/isUndefined';
|
|
@@ -84,14 +84,13 @@ export const getSelectedListObj = (contactsList, filterInfo, own, t) => {
|
|
|
84
84
|
};
|
|
85
85
|
export function CreatorSsoNameFilter() {
|
|
86
86
|
const { t } = useTranslation();
|
|
87
|
-
const apolloClient = useApolloClient();
|
|
88
87
|
const { filterInfo } = useContext(CaseListFilterStateContext);
|
|
89
88
|
const dispatch = useContext(CaseListFilterDispatchContext);
|
|
90
89
|
const { globalMetadataState: { loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
|
|
91
90
|
const CaseListDispatch = useCaseListDispatchContext();
|
|
92
91
|
const own = loggedInUserRights.data.getSSOUsername();
|
|
93
92
|
const isExternalNonOrgAdmin = !loggedInUserRights.data.isInternal() && loggedInUserRights.data.isCustomerNonOrgAdmin();
|
|
94
|
-
const
|
|
93
|
+
const { request: getExternalUserContactsList, isFetching: isFetchingExternalContacts } = useFetch(accounts.getAccountContacts, { propgateErrors: true });
|
|
95
94
|
const externalInputRef = useRef();
|
|
96
95
|
const [externalContactList, setExternalContactList] = useState([]);
|
|
97
96
|
const [isExternalOpen, setIsExternalOpen] = useState(false);
|
|
@@ -164,25 +163,19 @@ export function CreatorSsoNameFilter() {
|
|
|
164
163
|
if (loggedInUserRights.data.isInternal())
|
|
165
164
|
return;
|
|
166
165
|
const fetchStrataAccountUsers = () => __awaiter(this, void 0, void 0, function* () {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
setChipsNameSsoMap(CaseListDispatch, chipsNameSsoPairs);
|
|
177
|
-
setExternalContactList(externalContacts);
|
|
178
|
-
}
|
|
179
|
-
finally {
|
|
180
|
-
setIsFetchingExternalContacts(false);
|
|
181
|
-
}
|
|
166
|
+
const externalContacts = isExternalNonOrgAdmin
|
|
167
|
+
? []
|
|
168
|
+
: yield getExternalUserContactsList(loggedInUserRights.data.getAccountNumber());
|
|
169
|
+
const chipsNameSsoPairs = externalContacts.reduce((result, item) => {
|
|
170
|
+
result[item.ssoUsername] = { firstName: item.firstName || '', lastName: item.lastName || '' };
|
|
171
|
+
return result;
|
|
172
|
+
}, {});
|
|
173
|
+
setChipsNameSsoMap(CaseListDispatch, chipsNameSsoPairs);
|
|
174
|
+
setExternalContactList(externalContacts);
|
|
182
175
|
});
|
|
183
176
|
fetchStrataAccountUsers();
|
|
184
177
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
185
|
-
}, [dispatch, isExternalNonOrgAdmin, loggedInUserRights.data
|
|
178
|
+
}, [dispatch, isExternalNonOrgAdmin, loggedInUserRights.data]);
|
|
186
179
|
const filteredExternalList = useMemo(() => {
|
|
187
180
|
return [
|
|
188
181
|
...(noResults && !isExternalNonOrgAdmin
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreatorSsoNameFilterChip.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/CreatorSsoNameFilterChip.tsx"],"names":[],"mappings":"AAKA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAU/D,wBAAgB,wBAAwB,
|
|
1
|
+
{"version":3,"file":"CreatorSsoNameFilterChip.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/CreatorSsoNameFilterChip.tsx"],"names":[],"mappings":"AAKA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAU/D,wBAAgB,wBAAwB,sBAuIvC"}
|
|
@@ -69,9 +69,6 @@ export function CreatorSsoNameFilterChip() {
|
|
|
69
69
|
}, []);
|
|
70
70
|
setChips(valueLabelArray);
|
|
71
71
|
};
|
|
72
|
-
// Advance search stores raw name/SSO text in filterInfo. Resolution uses ssoUsernameIn, so a
|
|
73
|
-
// short first name can match another contact's SSO and show the wrong chip label; filtering still
|
|
74
|
-
// works — users should enter full name or SSO when the label matters.
|
|
75
72
|
const getInternalContactNames = (contacts) => __awaiter(this, void 0, void 0, function* () {
|
|
76
73
|
const res = yield getInternalUserContactsList({
|
|
77
74
|
internal: false,
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
import { IKeyValue } from '@rh-support/types/shared';
|
|
2
1
|
import React from 'react';
|
|
3
|
-
export
|
|
4
|
-
/** When set with onGroupsChange, the filter is controlled (e.g. advanced search). */
|
|
5
|
-
selectedGroups?: Array<IKeyValue<string>>;
|
|
6
|
-
onGroupsChange?: (groups: Array<IKeyValue<string>>) => void;
|
|
7
|
-
hideLabel?: boolean;
|
|
8
|
-
idPrefix?: string;
|
|
9
|
-
showSelectionCountBadge?: boolean;
|
|
10
|
-
placeholder?: string;
|
|
11
|
-
}
|
|
12
|
-
export declare function GroupsFilter({ selectedGroups: controlledSelectedGroups, onGroupsChange, hideLabel, idPrefix, showSelectionCountBadge, placeholder: placeholderProp, }?: GroupsFilterProps): React.JSX.Element;
|
|
2
|
+
export declare function GroupsFilter(): React.JSX.Element;
|
|
13
3
|
//# sourceMappingURL=GroupsFilter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupsFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/GroupsFilter.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GroupsFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/GroupsFilter.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAShF,wBAAgB,YAAY,sBA+P3B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Button, MenuFooter, MenuToggle, Select, SelectList, SelectOption, TextInputGroup, TextInputGroupMain, TextInputGroupUtilities, } from '@patternfly/react-core';
|
|
2
2
|
import TimesIcon from '@patternfly/react-icons/dist/js/icons/times-icon';
|
|
3
3
|
import { GlobalMetadataStateContext } from '@rh-support/react-context';
|
|
4
4
|
import { ability, resourceActions, resources } from '@rh-support/user-permissions';
|
|
@@ -12,105 +12,83 @@ import { SolrKeys } from '../../../enums/filters';
|
|
|
12
12
|
import { filterNamesMap } from '../../../utils/constants';
|
|
13
13
|
import { CaseListFilterDispatchContext, CaseListFilterStateContext } from '../CaseListFilterContext';
|
|
14
14
|
import { updateFilter } from '../CaseListFilterReducer';
|
|
15
|
-
|
|
16
|
-
export function GroupsFilter({ selectedGroups: controlledSelectedGroups, onGroupsChange, hideLabel = false, idPrefix = 'case-list-group-filter', showSelectionCountBadge = false, placeholder: placeholderProp, } = {}) {
|
|
17
|
-
var _a, _b;
|
|
15
|
+
export function GroupsFilter() {
|
|
18
16
|
const { t } = useTranslation();
|
|
17
|
+
const { globalMetadataState: { caseGroups }, } = useContext(GlobalMetadataStateContext);
|
|
19
18
|
const { filterInfo } = useContext(CaseListFilterStateContext);
|
|
20
19
|
const dispatch = useContext(CaseListFilterDispatchContext);
|
|
21
|
-
const isControlled = typeof onGroupsChange === 'function';
|
|
22
|
-
// Prefer the filterInfo array reference in basic/uncontrolled mode so empty selection
|
|
23
|
-
// does not create a new [] each render and re-fire the selectedItems sync effect.
|
|
24
|
-
const selectedGroups = isControlled
|
|
25
|
-
? controlledSelectedGroups || EMPTY_GROUPS
|
|
26
|
-
: (_a = filterInfo === null || filterInfo === void 0 ? void 0 : filterInfo[SolrKeys.group]) !== null && _a !== void 0 ? _a : EMPTY_GROUPS;
|
|
27
|
-
const { globalMetadataState: { caseGroups }, } = useContext(GlobalMetadataStateContext);
|
|
28
|
-
const isLoading = caseGroups.isFetching;
|
|
29
20
|
const [inputValue, setInputValue] = useState('');
|
|
30
21
|
const [focusedItemIndex, setFocusedItemIndex] = useState(null);
|
|
31
22
|
const [activeItem, setActiveItem] = useState(null);
|
|
32
|
-
const list =
|
|
23
|
+
const list = [
|
|
24
|
+
...(caseGroups.data ? caseGroups === null || caseGroups === void 0 ? void 0 : caseGroups.data.map((group) => ({ value: group.name, key: group.groupNum })) : []),
|
|
25
|
+
];
|
|
33
26
|
const [selectOptions, setSelectOptions] = useState(list);
|
|
34
27
|
const canViewManageTab = ability.can(resourceActions.READ, resources.MANAGE);
|
|
35
28
|
const canViewCaseGroups = ability.can(resourceActions.READ, resources.CASE_GROUPS) && canViewManageTab;
|
|
36
29
|
const [isOpen, setIsOpen] = useState(false);
|
|
37
30
|
const [selectedItems, setSelectedItems] = useState({});
|
|
38
31
|
const textInputRef = useRef();
|
|
39
|
-
const
|
|
40
|
-
if (isControlled) {
|
|
41
|
-
onGroupsChange(updatedFilterValues);
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
updateFilter(dispatch, {
|
|
45
|
-
filterKey: SolrKeys.group,
|
|
46
|
-
values: updatedFilterValues,
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
const onToggleClick = () => {
|
|
32
|
+
const onToggleClick = (e) => {
|
|
50
33
|
setIsOpen(!isOpen);
|
|
51
34
|
};
|
|
52
35
|
const onSelect = (option) => {
|
|
53
|
-
const optionValue = typeof option === 'string' ? option : option === null || option === void 0 ? void 0 : option.value;
|
|
54
|
-
if (!optionValue || optionValue === 'no results') {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
36
|
const prevSelectedGroups = Object.keys(selectedItems).filter((item) => selectedItems[item] && item);
|
|
58
|
-
if (selectedItems[
|
|
59
|
-
setSelectedItems((prevData) => (Object.assign(Object.assign({}, prevData), { [
|
|
60
|
-
const indexOfGroup = prevSelectedGroups.indexOf(
|
|
37
|
+
if (selectedItems[option.value]) {
|
|
38
|
+
setSelectedItems((prevData) => (Object.assign(Object.assign({}, prevData), { [option.value]: !prevData[option.value] })));
|
|
39
|
+
const indexOfGroup = prevSelectedGroups.indexOf(option.value);
|
|
61
40
|
prevSelectedGroups.splice(indexOfGroup, 1);
|
|
62
41
|
}
|
|
63
42
|
else {
|
|
64
|
-
setSelectedItems((prevData) => (Object.assign(Object.assign({}, prevData), { [
|
|
65
|
-
prevSelectedGroups.push(
|
|
43
|
+
setSelectedItems((prevData) => (Object.assign(Object.assign({}, prevData), { [option.value]: true })));
|
|
44
|
+
prevSelectedGroups.push(option.value);
|
|
66
45
|
}
|
|
67
|
-
const
|
|
68
|
-
.map((value) => {
|
|
46
|
+
const mapValueToKey = (value) => {
|
|
69
47
|
const selectedItem = list.find((item) => item.value === value);
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
48
|
+
return selectedItem;
|
|
49
|
+
};
|
|
50
|
+
const updatedFilterValues = prevSelectedGroups.map((item) => mapValueToKey(item));
|
|
51
|
+
updateFilter(dispatch, {
|
|
52
|
+
filterKey: SolrKeys.group,
|
|
53
|
+
values: updatedFilterValues,
|
|
54
|
+
});
|
|
77
55
|
};
|
|
78
56
|
const handleMenuArrowKeys = (key) => {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
if (key === 'ArrowDown') {
|
|
92
|
-
if (focusedItemIndex === null || focusedItemIndex === list.length - 1) {
|
|
93
|
-
indexToFocus = 0;
|
|
57
|
+
let indexToFocus;
|
|
58
|
+
if (isOpen) {
|
|
59
|
+
if (key === 'ArrowUp') {
|
|
60
|
+
// When no index is set or at the first index, focus to the last, otherwise decrement focus index
|
|
61
|
+
if (focusedItemIndex === null || focusedItemIndex === 0) {
|
|
62
|
+
indexToFocus = (list === null || list === void 0 ? void 0 : list.length) - 1;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
indexToFocus = focusedItemIndex - 1;
|
|
66
|
+
}
|
|
94
67
|
}
|
|
95
|
-
|
|
96
|
-
|
|
68
|
+
if (key === 'ArrowDown') {
|
|
69
|
+
// When no index is set or at the last index, focus to the first, otherwise increment focus index
|
|
70
|
+
if (focusedItemIndex === null || focusedItemIndex === (list === null || list === void 0 ? void 0 : list.length) - 1) {
|
|
71
|
+
indexToFocus = 0;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
indexToFocus = focusedItemIndex + 1;
|
|
75
|
+
}
|
|
97
76
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
if (focusedItem === null || focusedItem === void 0 ? void 0 : focusedItem.value) {
|
|
102
|
-
setActiveItem(`select-multi-typeahead-checkbox-${String(focusedItem.value).replace(' ', '-')}`);
|
|
77
|
+
setFocusedItemIndex(indexToFocus);
|
|
78
|
+
const focusedItem = list[indexToFocus];
|
|
79
|
+
setActiveItem(`select-multi-typeahead-checkbox-${focusedItem === null || focusedItem === void 0 ? void 0 : focusedItem.value.replace(' ', '-')}`);
|
|
103
80
|
}
|
|
104
81
|
};
|
|
105
82
|
const onInputKeyDown = (event) => {
|
|
106
|
-
const focusedItem = focusedItemIndex
|
|
83
|
+
const focusedItem = focusedItemIndex ? list[focusedItemIndex] : list[0];
|
|
107
84
|
switch (event.key) {
|
|
85
|
+
// Select the first available option
|
|
108
86
|
case 'Enter':
|
|
109
87
|
if (!isOpen) {
|
|
110
88
|
setIsOpen((prevIsOpen) => !prevIsOpen);
|
|
111
89
|
}
|
|
112
90
|
else if (isOpen && (focusedItem === null || focusedItem === void 0 ? void 0 : focusedItem.value) !== 'no results') {
|
|
113
|
-
onSelect(focusedItem);
|
|
91
|
+
onSelect(focusedItem === null || focusedItem === void 0 ? void 0 : focusedItem.value);
|
|
114
92
|
}
|
|
115
93
|
break;
|
|
116
94
|
case 'Tab':
|
|
@@ -128,37 +106,36 @@ export function GroupsFilter({ selectedGroups: controlledSelectedGroups, onGroup
|
|
|
128
106
|
const onTextInputChange = (_event, value) => {
|
|
129
107
|
setInputValue(value);
|
|
130
108
|
};
|
|
131
|
-
const
|
|
132
|
-
const placeholder = showSelectionCountBadge
|
|
133
|
-
? isLoading
|
|
134
|
-
? t('Loading...')
|
|
135
|
-
: defaultEmptyPlaceholder
|
|
136
|
-
: getDropdownBtnPlaceholder(isLoading ? t('Loading...') : defaultEmptyPlaceholder, selectedGroups, '', ((_b = caseGroups.data) === null || _b === void 0 ? void 0 : _b.length) || 0, t('All selected'));
|
|
137
|
-
const hasSelectedGroups = selectedGroups.length > 0;
|
|
109
|
+
const placeholder = getDropdownBtnPlaceholder(t('Select a group'), filterInfo[SolrKeys.group], '', (caseGroups.data || []).length, t('All selected'));
|
|
138
110
|
const onClick = () => {
|
|
139
111
|
var _a;
|
|
140
112
|
setInputValue('');
|
|
141
113
|
setSelectedItems({});
|
|
142
|
-
|
|
114
|
+
updateFilter(dispatch, {
|
|
115
|
+
filterKey: SolrKeys.group,
|
|
116
|
+
values: [],
|
|
117
|
+
});
|
|
143
118
|
(_a = textInputRef === null || textInputRef === void 0 ? void 0 : textInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
144
119
|
};
|
|
145
120
|
const toggle = (toggleRef) => (React.createElement(MenuToggle, { variant: "typeahead", onClick: onToggleClick, innerRef: toggleRef, isExpanded: isOpen, isFullWidth: true },
|
|
146
121
|
React.createElement(TextInputGroup, { isPlain: true },
|
|
147
|
-
React.createElement(TextInputGroupMain, Object.assign({ value: inputValue, onClick: onToggleClick, onChange: onTextInputChange, onKeyDown: onInputKeyDown, id:
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
React.createElement(Button, { icon: React.createElement(TimesIcon, { "aria-hidden": true }), variant: "plain", onClick: onClick, "aria-label": t('Clear input value') }))) : null)));
|
|
122
|
+
React.createElement(TextInputGroupMain, Object.assign({ value: inputValue, onClick: onToggleClick, onChange: onTextInputChange, onKeyDown: onInputKeyDown, id: "multi-typeahead-select-checkbox-input", autoComplete: "off", innerRef: textInputRef, placeholder: placeholder }, (activeItem && { 'aria-activedescendant': activeItem }), { role: "combobox", isExpanded: isOpen, "aria-controls": "select-multi-typeahead-checkbox-listbox" })),
|
|
123
|
+
Object.keys(selectedItems).filter((key) => selectedItems[key] === true).length ? (React.createElement(TextInputGroupUtilities, null,
|
|
124
|
+
React.createElement(Button, { icon: React.createElement(TimesIcon, { "aria-hidden": true }), variant: "plain", onClick: onClick, "aria-label": "Clear input value" }))) : (''))));
|
|
151
125
|
const dropdownOptions = useMemo(() => {
|
|
152
126
|
return (!isEmpty(selectOptions) ? selectOptions : list).map((option, index) => !isUndefined(option.value) && (React.createElement(SelectOption, { key: option.key, value: option, hasCheckbox: true, isSelected: selectedItems[option.value], isFocused: focusedItemIndex !== null && focusedItemIndex === index, id: `select-multi-typeahead-${option.value.replace(' ', '-')}` }, option.value)));
|
|
153
127
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
154
|
-
}, [selectedItems, caseGroups, selectOptions, focusedItemIndex]);
|
|
128
|
+
}, [selectedItems, caseGroups === null || caseGroups === void 0 ? void 0 : caseGroups.data, selectOptions, focusedItemIndex]);
|
|
155
129
|
useEffect(() => {
|
|
156
130
|
let newSelectOptions = list;
|
|
131
|
+
// Filter menu items based on the text input value when one exists
|
|
157
132
|
if (inputValue) {
|
|
158
133
|
newSelectOptions = list.filter((option) => String(option === null || option === void 0 ? void 0 : option.value).toLowerCase().startsWith(inputValue.toLowerCase()));
|
|
134
|
+
// When no options are found after filtering, display 'No results found'
|
|
159
135
|
if (!newSelectOptions.length) {
|
|
160
136
|
newSelectOptions = [{ isDisabled: false, children: `No results found` }];
|
|
161
137
|
}
|
|
138
|
+
// Open the menu when the input value changes and the new value is not empty
|
|
162
139
|
if (!isOpen) {
|
|
163
140
|
setIsOpen(true);
|
|
164
141
|
}
|
|
@@ -167,26 +144,29 @@ export function GroupsFilter({ selectedGroups: controlledSelectedGroups, onGroup
|
|
|
167
144
|
setFocusedItemIndex(null);
|
|
168
145
|
setActiveItem(null);
|
|
169
146
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
170
|
-
}, [inputValue
|
|
147
|
+
}, [inputValue]);
|
|
171
148
|
useEffect(() => {
|
|
172
|
-
|
|
149
|
+
var _a;
|
|
150
|
+
if (isEmpty(filterInfo[SolrKeys.group])) {
|
|
173
151
|
setSelectedItems({});
|
|
174
152
|
}
|
|
175
153
|
else {
|
|
176
|
-
const
|
|
154
|
+
const selectedGroups = (_a = filterInfo[SolrKeys.group]) === null || _a === void 0 ? void 0 : _a.reduce((selection, group) => {
|
|
177
155
|
selection[group === null || group === void 0 ? void 0 : group.value] = true;
|
|
178
156
|
return selection;
|
|
179
157
|
}, {});
|
|
180
|
-
setSelectedItems(
|
|
158
|
+
setSelectedItems(selectedGroups);
|
|
181
159
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
160
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
161
|
+
}, [filterInfo[SolrKeys.group]]);
|
|
162
|
+
return (React.createElement("div", { className: "group-filter" },
|
|
163
|
+
React.createElement("label", { htmlFor: "case-list-group-filter", className: "pf-v6-u-mb-sm group-filter-label" }, t(filterNamesMap[SolrKeys.group])),
|
|
185
164
|
React.createElement("div", { className: "pf-v6-c-select" },
|
|
186
|
-
React.createElement(Select, { shouldFocusToggleOnSelect: true, shouldPreventScrollOnItemFocus: true, "data-tracking-id": "groups-filter", id:
|
|
165
|
+
React.createElement(Select, { shouldFocusToggleOnSelect: true, shouldPreventScrollOnItemFocus: true, "data-tracking-id": "groups-filter", id: "case-list-group-filter", title: t(filterNamesMap[SolrKeys.group]), isOpen: isOpen, selected: selectedItems, onSelect: (_e, v) => onSelect(v), onOpenChange: (nextOpen) => setIsOpen(nextOpen), popperProps: { direction: 'down', enableFlip: false }, toggle: toggle, isScrollable: true },
|
|
187
166
|
React.createElement(SelectList, null,
|
|
188
167
|
dropdownOptions,
|
|
189
|
-
canViewCaseGroups && (React.createElement(
|
|
190
|
-
React.createElement(
|
|
191
|
-
React.createElement(
|
|
168
|
+
canViewCaseGroups && (React.createElement(React.Fragment, null,
|
|
169
|
+
React.createElement(MenuFooter, { className: "group-filter-manage-groups-footer" },
|
|
170
|
+
React.createElement(Link, { className: "cta cta-link", to: "/manage/groups" },
|
|
171
|
+
React.createElement(Trans, null, "Manage groups"))))))))));
|
|
192
172
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { IProductVersionPivotMap } from '../CaseList';
|
|
2
3
|
import { IProductFilter } from '../CaseListFilterReducer';
|
|
3
4
|
interface IProps {
|
|
4
5
|
productList: IProductFilter[];
|
|
6
|
+
productVersionPivot: IProductVersionPivotMap[];
|
|
5
7
|
}
|
|
6
|
-
export declare function ProductFilterChip({ productList }: IProps): React.JSX.Element;
|
|
8
|
+
export declare function ProductFilterChip({ productList, productVersionPivot }: IProps): React.JSX.Element;
|
|
7
9
|
export {};
|
|
8
10
|
//# 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;AAI1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAgB,MAAM,0BAA0B,CAAC;AAGxE,UAAU,MAAM;IACZ,WAAW,EAAE,cAAc,EAAE,CAAC;IAC9B,mBAAmB,EAAE,uBAAuB,EAAE,CAAC;CAClD;AAED,wBAAgB,iBAAiB,CAAC,EAAE,WAAW,EAAE,mBAAwB,EAAE,EAAE,MAAM,qBAsElF"}
|
|
@@ -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, productVersionPivot = [] }) {
|
|
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 }) {
|
|
|
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, productVersionPivot: productVersionPivot }),
|
|
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,10 +1,9 @@
|
|
|
1
|
+
import { IFacetResponse } from '@rh-support/types/shared';
|
|
1
2
|
import React from 'react';
|
|
2
|
-
interface IProductOption {
|
|
3
|
-
name: string;
|
|
4
|
-
productId: string;
|
|
5
|
-
}
|
|
6
3
|
interface IProps {
|
|
7
|
-
|
|
4
|
+
filterValues: IFacetResponse[];
|
|
5
|
+
isSolrSearchDown: boolean;
|
|
6
|
+
allProducts: string[];
|
|
8
7
|
}
|
|
9
8
|
export declare function ProductsFilter(props: IProps): React.JSX.Element;
|
|
10
9
|
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":"AAUA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAI1D,OAAO,KAAkD,MAAM,OAAO,CAAC;AAQvE,UAAU,MAAM;IACZ,YAAY,EAAE,cAAc,EAAE,CAAC;IAC/B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,WAAW,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,qBA+O3C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MenuToggle, Select, SelectList, SelectOption, TextInputGroup, TextInputGroupMain, } from '@patternfly/react-core';
|
|
2
|
-
import { useSelectKeyboardNavigator } from '@rh-support/components';
|
|
2
|
+
import { SingleSelectDropdown, 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, _b, _c, _d, _f;
|
|
14
14
|
const { t } = useTranslation();
|
|
15
15
|
const dispatch = useContext(CaseListFilterDispatchContext);
|
|
16
16
|
const { filterInfo } = useContext(CaseListFilterStateContext);
|
|
17
|
-
const { allProducts } = props;
|
|
17
|
+
const { allProducts, filterValues, isSolrSearchDown } = props;
|
|
18
18
|
const [isOpen, setIsOpen] = useState(false);
|
|
19
19
|
const [selectedItems, setSelectedItems] = useState({});
|
|
20
20
|
const [activeItem, setActiveItem] = useState(null);
|
|
@@ -23,24 +23,51 @@ 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 = filterValues.map((product) => ({
|
|
27
27
|
field: SolrKeys.product,
|
|
28
|
-
value: product.
|
|
29
|
-
productId: product.productId,
|
|
28
|
+
value: product.value,
|
|
30
29
|
[SolrKeys.version]: [],
|
|
31
30
|
}));
|
|
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
|
|
32
61
|
const onSelect = (option) => {
|
|
33
|
-
var _a;
|
|
34
62
|
let newSelectedProducts = [];
|
|
35
63
|
if (selectedProducts === null || selectedProducts === void 0 ? void 0 : selectedProducts.some((product) => option.value === product.value)) {
|
|
36
64
|
newSelectedProducts = selectedProducts.filter((product) => option.value !== product.value);
|
|
37
65
|
setSelectedItems((prevData) => (Object.assign(Object.assign({}, prevData), { [option.value]: false })));
|
|
38
66
|
}
|
|
39
67
|
else {
|
|
40
|
-
const productId = option.productId || ((_a = allProducts.find((p) => p.name === option.value)) === null || _a === void 0 ? void 0 : _a.productId) || '';
|
|
41
68
|
newSelectedProducts = [
|
|
42
69
|
...selectedProducts,
|
|
43
|
-
{ field: SolrKeys.product, value: option.value,
|
|
70
|
+
{ field: SolrKeys.product, value: option.value, [SolrKeys.version]: [] },
|
|
44
71
|
];
|
|
45
72
|
setSelectedItems((prevData) => (Object.assign(Object.assign({}, prevData), { [option.value]: true })));
|
|
46
73
|
}
|
|
@@ -66,12 +93,21 @@ export function ProductsFilter(props) {
|
|
|
66
93
|
resetIndexOnClose: true,
|
|
67
94
|
isDisabled: false,
|
|
68
95
|
setIsOpen,
|
|
69
|
-
onSelect
|
|
96
|
+
onSelect: (item) => {
|
|
97
|
+
if (isSolrSearchDown) {
|
|
98
|
+
onFilterChangeSingleSelect(item);
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
onSelect(item);
|
|
102
|
+
}
|
|
103
|
+
},
|
|
70
104
|
});
|
|
71
105
|
const onTextInputChange = (_event, value) => {
|
|
72
106
|
setInputValue(value);
|
|
73
107
|
};
|
|
74
|
-
const placeholder =
|
|
108
|
+
const placeholder = isSolrSearchDown
|
|
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'));
|
|
75
111
|
const toggleForMultiSelect = (toggleRef) => (React.createElement(MenuToggle, { variant: "typeahead", onClick: onToggleClick, innerRef: toggleRef, isExpanded: isOpen, isFullWidth: true },
|
|
76
112
|
React.createElement(TextInputGroup, { isPlain: true },
|
|
77
113
|
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" })))));
|
|
@@ -93,6 +129,9 @@ export function ProductsFilter(props) {
|
|
|
93
129
|
}, [inputValue]);
|
|
94
130
|
useEffect(() => {
|
|
95
131
|
var _a;
|
|
132
|
+
if (isSolrSearchDown) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
96
135
|
if (isEmpty(filterInfo === null || filterInfo === void 0 ? void 0 : filterInfo[SolrPivotKeys.product_version])) {
|
|
97
136
|
setSelectedItems({});
|
|
98
137
|
}
|
|
@@ -103,13 +142,13 @@ export function ProductsFilter(props) {
|
|
|
103
142
|
}, {});
|
|
104
143
|
setSelectedItems(selectedProductItems || {});
|
|
105
144
|
}
|
|
106
|
-
}, [filterInfo]);
|
|
145
|
+
}, [filterInfo, isSolrSearchDown]);
|
|
107
146
|
const renderOptions = () => {
|
|
108
147
|
const filteredOptions = getFilteredOptions();
|
|
109
|
-
return filteredOptions.map((option, index) => (React.createElement(SelectOption, { key: `product-option-${index}`, value: option, hasCheckbox:
|
|
148
|
+
return filteredOptions.map((option, index) => (React.createElement(SelectOption, { key: `product-option-${index}`, value: option, hasCheckbox: !isSolrSearchDown, isSelected: selectedItems[option.value], isFocused: focusedItemIndex !== null && focusedItemIndex === index, id: `select-product-${String(option.value).replace(/\s/g, '-')}` }, option.value)));
|
|
110
149
|
};
|
|
111
150
|
return (React.createElement("div", { className: "product-filter" },
|
|
112
151
|
React.createElement("label", { htmlFor: "case-list-products-filter", className: "pf-v6-u-mb-sm products-filter-label" }, t(filterNamesMap[SolrKeys.product])),
|
|
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()))));
|
|
152
|
+
isSolrSearchDown ? (React.createElement(SingleSelectDropdown, { id: "case-list-products-filter", selected: selectedOption, options: singleSelectOptions, placeholder: allProducts.length > 0 ? t('Select a product') : t('No products available'), onSelect: (options) => onSingleSelectChange(options[0]), dataTrackingId: "products-filter", isScrollable: true, isDisabled: allProducts.length === 0 })) : (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' } },
|
|
153
|
+
React.createElement(SelectList, null, renderOptions())))));
|
|
115
154
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { IFacetResponse } from '@rh-support/types/shared';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
interface IProps {
|
|
4
|
+
filterValues: IFacetResponse[];
|
|
3
5
|
allCaseSeverities: string[];
|
|
6
|
+
isSolrSearchDown: boolean;
|
|
4
7
|
}
|
|
5
8
|
export declare function SeverityFilter(props: IProps): React.JSX.Element;
|
|
6
9
|
export {};
|