@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.
Files changed (162) hide show
  1. package/lib/esm/components/case/NewCaseButton.js +1 -1
  2. package/lib/esm/components/case-list/CaseList.d.ts +7 -0
  3. package/lib/esm/components/case-list/CaseList.d.ts.map +1 -1
  4. package/lib/esm/components/case-list/CaseList.js +135 -366
  5. package/lib/esm/components/case-list/CaseListContext.d.ts.map +1 -1
  6. package/lib/esm/components/case-list/CaseListContext.js +2 -5
  7. package/lib/esm/components/case-list/CaseListFilterContext.d.ts.map +1 -1
  8. package/lib/esm/components/case-list/CaseListFilterContext.js +1 -2
  9. package/lib/esm/components/case-list/CaseListFilterHelpers.d.ts +2 -3
  10. package/lib/esm/components/case-list/CaseListFilterHelpers.d.ts.map +1 -1
  11. package/lib/esm/components/case-list/CaseListFilterHelpers.js +6 -19
  12. package/lib/esm/components/case-list/CaseListFilterReducer.d.ts +4 -36
  13. package/lib/esm/components/case-list/CaseListFilterReducer.d.ts.map +1 -1
  14. package/lib/esm/components/case-list/CaseListFilterReducer.js +12 -6
  15. package/lib/esm/components/case-list/CaseListReducer.d.ts +10 -22
  16. package/lib/esm/components/case-list/CaseListReducer.d.ts.map +1 -1
  17. package/lib/esm/components/case-list/CaseListReducer.js +7 -25
  18. package/lib/esm/components/case-list/case-list-filters/AccountsFilter.d.ts.map +1 -1
  19. package/lib/esm/components/case-list/case-list-filters/AccountsFilter.js +11 -18
  20. package/lib/esm/components/case-list/case-list-filters/AdditionalFilters.d.ts.map +1 -1
  21. package/lib/esm/components/case-list/case-list-filters/AdditionalFilters.js +2 -6
  22. package/lib/esm/components/case-list/case-list-filters/CaseListFilterChips.d.ts +7 -1
  23. package/lib/esm/components/case-list/case-list-filters/CaseListFilterChips.d.ts.map +1 -1
  24. package/lib/esm/components/case-list/case-list-filters/CaseListFilterChips.js +16 -12
  25. package/lib/esm/components/case-list/case-list-filters/CaseListFilters.d.ts +5 -2
  26. package/lib/esm/components/case-list/case-list-filters/CaseListFilters.d.ts.map +1 -1
  27. package/lib/esm/components/case-list/case-list-filters/CaseListFilters.js +13 -14
  28. package/lib/esm/components/case-list/case-list-filters/CreatorSsoNameFilter.d.ts.map +1 -1
  29. package/lib/esm/components/case-list/case-list-filters/CreatorSsoNameFilter.js +14 -21
  30. package/lib/esm/components/case-list/case-list-filters/CreatorSsoNameFilterChip.d.ts.map +1 -1
  31. package/lib/esm/components/case-list/case-list-filters/CreatorSsoNameFilterChip.js +0 -3
  32. package/lib/esm/components/case-list/case-list-filters/GroupsFilter.d.ts +1 -11
  33. package/lib/esm/components/case-list/case-list-filters/GroupsFilter.d.ts.map +1 -1
  34. package/lib/esm/components/case-list/case-list-filters/GroupsFilter.js +70 -90
  35. package/lib/esm/components/case-list/case-list-filters/ProductFilterChip.d.ts +3 -1
  36. package/lib/esm/components/case-list/case-list-filters/ProductFilterChip.d.ts.map +1 -1
  37. package/lib/esm/components/case-list/case-list-filters/ProductFilterChip.js +2 -2
  38. package/lib/esm/components/case-list/case-list-filters/ProductsFilter.d.ts +4 -5
  39. package/lib/esm/components/case-list/case-list-filters/ProductsFilter.d.ts.map +1 -1
  40. package/lib/esm/components/case-list/case-list-filters/ProductsFilter.js +54 -15
  41. package/lib/esm/components/case-list/case-list-filters/SeverityFilter.d.ts +3 -0
  42. package/lib/esm/components/case-list/case-list-filters/SeverityFilter.d.ts.map +1 -1
  43. package/lib/esm/components/case-list/case-list-filters/SeverityFilter.js +44 -18
  44. package/lib/esm/components/case-list/case-list-filters/StatusFilter.d.ts +3 -0
  45. package/lib/esm/components/case-list/case-list-filters/StatusFilter.d.ts.map +1 -1
  46. package/lib/esm/components/case-list/case-list-filters/StatusFilter.js +44 -14
  47. package/lib/esm/components/case-list/case-list-filters/VersionsFilter.d.ts +3 -1
  48. package/lib/esm/components/case-list/case-list-filters/VersionsFilter.d.ts.map +1 -1
  49. package/lib/esm/components/case-list/case-list-filters/VersionsFilter.js +59 -60
  50. package/lib/esm/components/case-list/case-list-table/CaseListTable.d.ts +3 -8
  51. package/lib/esm/components/case-list/case-list-table/CaseListTable.d.ts.map +1 -1
  52. package/lib/esm/components/case-list/case-list-table/CaseListTable.js +55 -88
  53. package/lib/esm/components/case-list/case-list-table/DownloadCSVFileModal.d.ts +5 -0
  54. package/lib/esm/components/case-list/case-list-table/DownloadCSVFileModal.d.ts.map +1 -1
  55. package/lib/esm/components/case-list/case-list-table/DownloadCSVFileModal.js +70 -51
  56. package/lib/esm/components/case-list/case-list-table/ExportCaseListCSV.d.ts.map +1 -1
  57. package/lib/esm/components/case-list/case-list-table/ExportCaseListCSV.js +15 -5
  58. package/lib/esm/components/case-list/case-list-table/SeverityLabel.js +1 -1
  59. package/lib/esm/components/case-list/case-list-table/TableActionsDropdown.d.ts.map +1 -1
  60. package/lib/esm/components/case-list/case-list-table/TableActionsDropdown.js +3 -2
  61. package/lib/esm/components/case-list/case-list-table/table-column-selector/TableColumnSelector.d.ts.map +1 -1
  62. package/lib/esm/components/case-list/case-list-table/table-column-selector/TableColumnSelector.js +0 -1
  63. package/lib/esm/components/case-list/case-search/BookmarkedSearchesSelector.d.ts.map +1 -1
  64. package/lib/esm/components/case-list/case-search/BookmarkedSearchesSelector.js +0 -1
  65. package/lib/esm/components/case-list/case-search/CaseSearch.d.ts.map +1 -1
  66. package/lib/esm/components/case-list/case-search/CaseSearch.js +24 -55
  67. package/lib/esm/components/case-list/case-search/useAdvanceSearchParser.d.ts.map +1 -1
  68. package/lib/esm/components/case-list/case-search/useAdvanceSearchParser.js +1 -2
  69. package/lib/esm/css/caseList.css +22 -183
  70. package/lib/esm/css/caseSearch.css +0 -114
  71. package/lib/esm/enums/case.d.ts +5 -13
  72. package/lib/esm/enums/case.d.ts.map +1 -1
  73. package/lib/esm/enums/case.js +3 -23
  74. package/lib/esm/enums/caseSearch.d.ts +0 -3
  75. package/lib/esm/enums/caseSearch.d.ts.map +1 -1
  76. package/lib/esm/enums/caseSearch.js +1 -2
  77. package/lib/esm/enums/filters.d.ts +1 -3
  78. package/lib/esm/enums/filters.d.ts.map +1 -1
  79. package/lib/esm/enums/filters.js +0 -2
  80. package/lib/esm/hooks/useCloseCase.d.ts.map +1 -1
  81. package/lib/esm/hooks/useCloseCase.js +21 -38
  82. package/lib/esm/hooks/useExportCaseListCSV.d.ts.map +1 -1
  83. package/lib/esm/hooks/useExportCaseListCSV.js +9 -1
  84. package/lib/esm/hooks/useFilterStateOnLoad.d.ts +1 -1
  85. package/lib/esm/hooks/useFilterStateOnLoad.d.ts.map +1 -1
  86. package/lib/esm/hooks/useFilterStateOnLoad.js +5 -7
  87. package/lib/esm/index.js +0 -1
  88. package/lib/esm/models/caseList.d.ts +0 -1
  89. package/lib/esm/models/caseList.d.ts.map +1 -1
  90. package/lib/esm/test-utils/mockData.d.ts +0 -1
  91. package/lib/esm/test-utils/mockData.d.ts.map +1 -1
  92. package/lib/esm/test-utils/mockData.js +1 -2
  93. package/lib/esm/utils/caseSearchUtils.d.ts.map +1 -1
  94. package/lib/esm/utils/caseSearchUtils.js +2 -39
  95. package/lib/esm/utils/constants.d.ts +1 -5
  96. package/lib/esm/utils/constants.d.ts.map +1 -1
  97. package/lib/esm/utils/constants.js +2 -10
  98. package/lib/esm/utils/mockSolrResponse.js +1 -1
  99. package/package.json +8 -10
  100. package/lib/esm/components/case-list/case-list-filters/CaseLabelsFilter.d.ts +0 -3
  101. package/lib/esm/components/case-list/case-list-filters/CaseLabelsFilter.d.ts.map +0 -1
  102. package/lib/esm/components/case-list/case-list-filters/CaseLabelsFilter.js +0 -177
  103. package/lib/esm/components/case-list/case-list-table/CaseListLabelGroup.d.ts +0 -9
  104. package/lib/esm/components/case-list/case-list-table/CaseListLabelGroup.d.ts.map +0 -1
  105. package/lib/esm/components/case-list/case-list-table/CaseListLabelGroup.js +0 -105
  106. package/lib/esm/components/case-list/case-search/AdvanceSearchToggleButton.d.ts +0 -8
  107. package/lib/esm/components/case-list/case-search/AdvanceSearchToggleButton.d.ts.map +0 -1
  108. package/lib/esm/components/case-list/case-search/AdvanceSearchToggleButton.js +0 -8
  109. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAccountSection.d.ts +0 -10
  110. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAccountSection.d.ts.map +0 -1
  111. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAccountSection.js +0 -29
  112. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAuditsSection.d.ts +0 -10
  113. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAuditsSection.d.ts.map +0 -1
  114. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchAuditsSection.js +0 -16
  115. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchCaseSection.d.ts +0 -9
  116. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchCaseSection.d.ts.map +0 -1
  117. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchCaseSection.js +0 -21
  118. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchDateRangeField.d.ts +0 -12
  119. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchDateRangeField.d.ts.map +0 -1
  120. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchDateRangeField.js +0 -31
  121. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchFieldBlock.d.ts +0 -10
  122. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchFieldBlock.d.ts.map +0 -1
  123. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchFieldBlock.js +0 -10
  124. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchModal.d.ts +0 -10
  125. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchModal.d.ts.map +0 -1
  126. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchModal.js +0 -92
  127. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchOwnerSection.d.ts +0 -9
  128. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchOwnerSection.d.ts.map +0 -1
  129. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchOwnerSection.js +0 -20
  130. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchProductSection.d.ts +0 -9
  131. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchProductSection.d.ts.map +0 -1
  132. package/lib/esm/components/case-list/case-search/advance-search-modal/AdvanceSearchProductSection.js +0 -28
  133. package/lib/esm/components/case-list/case-search/advance-search-modal/ProductVersionDrilldownSelect.d.ts +0 -9
  134. package/lib/esm/components/case-list/case-search/advance-search-modal/ProductVersionDrilldownSelect.d.ts.map +0 -1
  135. package/lib/esm/components/case-list/case-search/advance-search-modal/ProductVersionDrilldownSelect.js +0 -241
  136. package/lib/esm/components/case-list/case-search/advance-search-modal/SelectableLabelFilter.d.ts +0 -11
  137. package/lib/esm/components/case-list/case-search/advance-search-modal/SelectableLabelFilter.d.ts.map +0 -1
  138. package/lib/esm/components/case-list/case-search/advance-search-modal/SelectableLabelFilter.js +0 -23
  139. package/lib/esm/hooks/useCaseLabels.d.ts +0 -14
  140. package/lib/esm/hooks/useCaseLabels.d.ts.map +0 -1
  141. package/lib/esm/hooks/useCaseLabels.js +0 -55
  142. package/lib/esm/utils/advanceSearchFormMapper.d.ts +0 -11
  143. package/lib/esm/utils/advanceSearchFormMapper.d.ts.map +0 -1
  144. package/lib/esm/utils/advanceSearchFormMapper.js +0 -71
  145. package/lib/esm/utils/advanceSearchUtils.d.ts +0 -24
  146. package/lib/esm/utils/advanceSearchUtils.d.ts.map +0 -1
  147. package/lib/esm/utils/advanceSearchUtils.js +0 -150
  148. package/lib/esm/utils/caseGroupDefaultFilterUtils.d.ts +0 -12
  149. package/lib/esm/utils/caseGroupDefaultFilterUtils.d.ts.map +0 -1
  150. package/lib/esm/utils/caseGroupDefaultFilterUtils.js +0 -34
  151. package/lib/esm/utils/caseGroupDefaultUtils.d.ts +0 -10
  152. package/lib/esm/utils/caseGroupDefaultUtils.d.ts.map +0 -1
  153. package/lib/esm/utils/caseGroupDefaultUtils.js +0 -20
  154. package/lib/esm/utils/caseListGraphQLUtils.d.ts +0 -28
  155. package/lib/esm/utils/caseListGraphQLUtils.d.ts.map +0 -1
  156. package/lib/esm/utils/caseListGraphQLUtils.js +0 -280
  157. package/lib/esm/utils/caseListMapper.d.ts +0 -6
  158. package/lib/esm/utils/caseListMapper.d.ts.map +0 -1
  159. package/lib/esm/utils/caseListMapper.js +0 -44
  160. package/lib/esm/utils/caseListVariablesBuilder.d.ts +0 -15
  161. package/lib/esm/utils/caseListVariablesBuilder.d.ts.map +0 -1
  162. 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
- export const CaseListFilters = ({ allCaseTypes, allCaseSeverities, allCaseStatuses, allProducts }) => {
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(CaseLabelsFilter, null),
33
- 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) => ({
34
- name: p.product,
35
- productId: p.productId,
36
- }))) || [] })),
37
- canAccessSeverityFilter && React.createElement(SeverityFilter, { allCaseSeverities: allCaseSeverities.data }),
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,sBAiQnC"}
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 { useApolloClient } from '@apollo/client/react';
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 { fetchLoggedInUserAccountContactsFromGraphQL, getDropdownBtnPlaceholder } from '@rh-support/utils';
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 [isFetchingExternalContacts, setIsFetchingExternalContacts] = useState(false);
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
- setIsFetchingExternalContacts(true);
168
- try {
169
- const externalContacts = isExternalNonOrgAdmin
170
- ? []
171
- : yield fetchLoggedInUserAccountContactsFromGraphQL(apolloClient);
172
- const chipsNameSsoPairs = externalContacts.reduce((result, item) => {
173
- result[item.ssoUsername] = { firstName: item.firstName || '', lastName: item.lastName || '' };
174
- return result;
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, apolloClient]);
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,sBA0IvC"}
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 interface GroupsFilterProps {
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":"AAgBA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAKrD,OAAO,KAA2D,MAAM,OAAO,CAAC;AAShF,MAAM,WAAW,iBAAiB;IAC9B,qFAAqF;IACrF,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1C,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,KAAK,IAAI,CAAC;IAC5D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAID,wBAAgB,YAAY,CAAC,EACzB,cAAc,EAAE,wBAAwB,EACxC,cAAc,EACd,SAAiB,EACjB,QAAmC,EACnC,uBAA+B,EAC/B,WAAW,EAAE,eAAe,GAC/B,GAAE,iBAAsB,qBA+RxB"}
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 { Badge, Button, MenuFooter, MenuToggle, Select, SelectList, SelectOption, TextInputGroup, TextInputGroupMain, TextInputGroupUtilities, } from '@patternfly/react-core';
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
- const EMPTY_GROUPS = [];
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 = useMemo(() => (caseGroups.data || []).map((group) => ({ value: group.name, key: group.groupNum })), [caseGroups.data]);
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 applyGroupSelection = (updatedFilterValues) => {
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[optionValue]) {
59
- setSelectedItems((prevData) => (Object.assign(Object.assign({}, prevData), { [optionValue]: !prevData[optionValue] })));
60
- const indexOfGroup = prevSelectedGroups.indexOf(optionValue);
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), { [optionValue]: true })));
65
- prevSelectedGroups.push(optionValue);
43
+ setSelectedItems((prevData) => (Object.assign(Object.assign({}, prevData), { [option.value]: true })));
44
+ prevSelectedGroups.push(option.value);
66
45
  }
67
- const updatedFilterValues = prevSelectedGroups
68
- .map((value) => {
46
+ const mapValueToKey = (value) => {
69
47
  const selectedItem = list.find((item) => item.value === value);
70
- if (!(selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.key)) {
71
- return null;
72
- }
73
- return { key: String(selectedItem.key), value: String(selectedItem.value) };
74
- })
75
- .filter(Boolean);
76
- applyGroupSelection(updatedFilterValues);
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
- if (!isOpen || !list.length) {
80
- return;
81
- }
82
- let indexToFocus = 0;
83
- if (key === 'ArrowUp') {
84
- if (focusedItemIndex === null || focusedItemIndex === 0) {
85
- indexToFocus = list.length - 1;
86
- }
87
- else {
88
- indexToFocus = focusedItemIndex - 1;
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
- else {
96
- indexToFocus = focusedItemIndex + 1;
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
- setFocusedItemIndex(indexToFocus);
100
- const focusedItem = list[indexToFocus];
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 !== null ? list[focusedItemIndex] : list[0];
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 defaultEmptyPlaceholder = placeholderProp || t('Select a group');
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
- applyGroupSelection([]);
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: `${idPrefix}-input`, autoComplete: "off", innerRef: textInputRef, placeholder: placeholder }, (activeItem && { 'aria-activedescendant': activeItem }), { role: "combobox", isExpanded: isOpen, "aria-controls": `${idPrefix}-listbox` })),
148
- hasSelectedGroups ? (React.createElement(TextInputGroupUtilities, null,
149
- showSelectionCountBadge && (React.createElement(Badge, { className: "advance-search-dropdown-toggle-badge pf-v6-u-mr-sm" }, t('{{count}} selected', { count: selectedGroups.length }))),
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, list]);
147
+ }, [inputValue]);
171
148
  useEffect(() => {
172
- if (isEmpty(selectedGroups)) {
149
+ var _a;
150
+ if (isEmpty(filterInfo[SolrKeys.group])) {
173
151
  setSelectedItems({});
174
152
  }
175
153
  else {
176
- const nextSelectedItems = selectedGroups.reduce((selection, group) => {
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(nextSelectedItems);
158
+ setSelectedItems(selectedGroups);
181
159
  }
182
- }, [selectedGroups]);
183
- return (React.createElement("div", { className: "group-filter", "data-testid": "groups-filter" },
184
- !hideLabel && (React.createElement("label", { htmlFor: idPrefix, className: "pf-v6-u-mb-sm group-filter-label" }, t(filterNamesMap[SolrKeys.group]))),
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: idPrefix, 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 },
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(MenuFooter, { className: "group-filter-manage-groups-footer" },
190
- React.createElement(Link, { className: "cta cta-link", to: "/manage/groups" },
191
- React.createElement(Trans, null, "Manage groups")))))))));
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;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"}
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
- allProducts: IProductOption[];
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":"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
+ {"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 = allProducts.map((product) => ({
26
+ const productOptions = filterValues.map((product) => ({
27
27
  field: SolrKeys.product,
28
- value: product.name,
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, productId, [SolrKeys.version]: [] },
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 = 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'));
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: true, isSelected: selectedItems[option.value], isFocused: focusedItemIndex !== null && focusedItemIndex === index, id: `select-product-${String(option.value).replace(/\s/g, '-')}` }, option.value)));
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 {};