@rh-support/cases 2.1.24 → 2.1.27

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 (43) hide show
  1. package/README.md +2 -0
  2. package/lib/esm/components/case-list/CaseList.d.ts.map +1 -1
  3. package/lib/esm/components/case-list/CaseList.js +2 -1
  4. package/lib/esm/components/case-list/case-list-filters/AccountsBookmarkedGroupFilter.d.ts.map +1 -1
  5. package/lib/esm/components/case-list/case-list-filters/AccountsBookmarkedGroupFilter.js +11 -10
  6. package/lib/esm/components/case-list/case-list-filters/AccountsFilter.d.ts.map +1 -1
  7. package/lib/esm/components/case-list/case-list-filters/AccountsFilter.js +5 -2
  8. package/lib/esm/components/case-list/case-list-filters/AdditionalFilters.js +1 -1
  9. package/lib/esm/components/case-list/case-list-filters/CaseListFilterChips.js +1 -1
  10. package/lib/esm/components/case-list/case-list-filters/CreatorSsoNameFilter.d.ts +10 -0
  11. package/lib/esm/components/case-list/case-list-filters/CreatorSsoNameFilter.d.ts.map +1 -1
  12. package/lib/esm/components/case-list/case-list-filters/CreatorSsoNameFilter.js +122 -164
  13. package/lib/esm/components/case-list/case-list-filters/CreatorSsoNameFilterChip.js +1 -1
  14. package/lib/esm/components/case-list/case-list-filters/GroupsFilter.js +2 -2
  15. package/lib/esm/components/case-list/case-list-filters/InternalSsoNameFilter.d.ts +2 -0
  16. package/lib/esm/components/case-list/case-list-filters/InternalSsoNameFilter.d.ts.map +1 -0
  17. package/lib/esm/components/case-list/case-list-filters/InternalSsoNameFilter.js +183 -0
  18. package/lib/esm/components/case-list/case-list-filters/ProductFilterChip.js +1 -1
  19. package/lib/esm/components/case-list/case-list-filters/ProductsFilter.d.ts.map +1 -1
  20. package/lib/esm/components/case-list/case-list-filters/ProductsFilter.js +5 -4
  21. package/lib/esm/components/case-list/case-list-filters/SeverityFilter.js +4 -4
  22. package/lib/esm/components/case-list/case-list-filters/StatusFilter.js +4 -4
  23. package/lib/esm/components/case-list/case-list-filters/TypeFilter.js +3 -3
  24. package/lib/esm/components/case-list/case-list-filters/VersionsFilter.js +2 -2
  25. package/lib/esm/components/case-list/case-list-table/CaseListTable.d.ts +1 -0
  26. package/lib/esm/components/case-list/case-list-table/CaseListTable.d.ts.map +1 -1
  27. package/lib/esm/components/case-list/case-list-table/CaseListTable.js +11 -12
  28. package/lib/esm/components/case-list/case-list-table/ExportCaseListCSV.js +1 -1
  29. package/lib/esm/components/case-list/case-search/AdvanceSearch.d.ts.map +1 -1
  30. package/lib/esm/components/case-list/case-search/AdvanceSearch.js +9 -9
  31. package/lib/esm/components/case-list/case-search/BookmarkedSearchesSelector.d.ts.map +1 -1
  32. package/lib/esm/components/case-list/case-search/BookmarkedSearchesSelector.js +6 -5
  33. package/lib/esm/components/case-list/case-search/CaseSearch.js +1 -1
  34. package/lib/esm/components/case-list/case-search/SaveCaseSearchModal.d.ts.map +1 -1
  35. package/lib/esm/components/case-list/case-search/SaveCaseSearchModal.js +10 -8
  36. package/lib/esm/components/escalations/EscalationForm.d.ts.map +1 -1
  37. package/lib/esm/components/escalations/EscalationForm.js +18 -9
  38. package/lib/esm/css/caseList.css +49 -41
  39. package/lib/esm/css/caseSearch.css +1 -1
  40. package/lib/esm/css/escalation.css +4 -4
  41. package/lib/esm/scss/_main.scss +11 -11
  42. package/lib/esm/scss/_pf-overrides.scss +3 -3
  43. package/package.json +14 -14
package/README.md CHANGED
@@ -16,3 +16,5 @@ export default function CasesApp(routeProps: RouteComponentProps<ICasesRouteURLP
16
16
  return (<Cases routeProps={routeProps} basePath="/cases" />);
17
17
  }
18
18
  ```
19
+
20
+ .
@@ -1 +1 @@
1
- {"version":3,"file":"CaseList.d.ts","sourceRoot":"","sources":["../../../../src/components/case-list/CaseList.tsx"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAC;AAChC,OAAO,0BAA0B,CAAC;AA4BlC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAKH,0BAA0B,EAI7B,MAAM,mBAAmB,CAAC;AAO3B,OAAO,EAAE,mBAAmB,EAAe,MAAM,cAAc,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,IAAI,CAAC;AAK1C,OAAO,EAAgB,WAAW,EAA2B,MAAM,uBAAuB,CAAC;AAmC3F,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,oBAAoB,CAAC,CAAC;CACzD;AAED,MAAM,WAAW,uBAAwB,SAAQ,cAAc;IAC3D,YAAY,EAAE,cAAc,EAAE,CAAC;CAClC;AAED,oBAAY,YAAY,GAAG,0BAA0B,CAAC,WAAW,EAAE,uBAAuB,CAAC,CAAC;AAM5F,MAAM,WAAW,gBAAgB;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAC;CAChC;AAED,MAAM,WAAW,aAAa;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,eA2frC"}
1
+ {"version":3,"file":"CaseList.d.ts","sourceRoot":"","sources":["../../../../src/components/case-list/CaseList.tsx"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAC;AAChC,OAAO,0BAA0B,CAAC;AA4BlC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAKH,0BAA0B,EAI7B,MAAM,mBAAmB,CAAC;AAO3B,OAAO,EAAE,mBAAmB,EAAe,MAAM,cAAc,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,IAAI,CAAC;AAK1C,OAAO,EAAgB,WAAW,EAA2B,MAAM,uBAAuB,CAAC;AAmC3F,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,oBAAoB,CAAC,CAAC;CACzD;AAED,MAAM,WAAW,uBAAwB,SAAQ,cAAc;IAC3D,YAAY,EAAE,cAAc,EAAE,CAAC;CAClC;AAED,oBAAY,YAAY,GAAG,0BAA0B,CAAC,WAAW,EAAE,uBAAuB,CAAC,CAAC;AAM5F,MAAM,WAAW,gBAAgB;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAC;CAChC;AAED,MAAM,WAAW,aAAa;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,eA6frC"}
@@ -58,6 +58,7 @@ export function CaseList(props) {
58
58
  const searchType = searchParams[FILTER_URL_QUERY_TYPE];
59
59
  const abortControllerRef = useRef(undefined);
60
60
  const isXLScreen = breakPoint.xl;
61
+ const isXXLScreen = breakPoint.xxl;
61
62
  const isFirstMount = useRef(true);
62
63
  const filterSectionRef = useRef(null);
63
64
  const filterState = useContext(CaseListFilterStateContext);
@@ -355,5 +356,5 @@ export function CaseList(props) {
355
356
  React.createElement(ErrorBoundary, { errorMsgInfo: { message: t('There was an error loading filters') } },
356
357
  React.createElement(CaseListFilters, { filterValues: filterValuesFromFacetResponse, allCaseTypes: allCaseTypes, allCaseStatuses: allCaseStatuses, allCaseSeverities: allCaseSeverities, allProducts: allProducts, isSolrSearchDown: isSolrSearchDown })))))),
357
358
  React.createElement("section", { className: "case-search-table" },
358
- React.createElement(CaseListTable, { caseList: caseList, caseGroups: caseGroups.data || [], loggedInUserRights: loggedInUserRights.data, sortInfo: filterState.sortInfo, paginationInfo: filterState.paginationInfo, isCaseListPageLoading: isFetching, hasError: hasError, isSolrDown: isSolrSearchDown })))));
359
+ React.createElement(CaseListTable, { caseList: caseList, caseGroups: caseGroups.data || [], loggedInUserRights: loggedInUserRights.data, sortInfo: filterState.sortInfo, paginationInfo: filterState.paginationInfo, isCaseListPageLoading: isFetching, hasError: hasError, isSolrDown: isSolrSearchDown, isXXLScreen: isXXLScreen })))));
359
360
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AccountsBookmarkedGroupFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/AccountsBookmarkedGroupFilter.tsx"],"names":[],"mappings":"AAkBA,eAAO,MAAM,YAAY,eAAgB,MAAM,gBAS9C,CAAC;AAEF,UAAU,MAAM;IACZ,uBAAuB,EAAE,OAAO,CAAC;IACjC,wBAAwB,EAAE,OAAO,CAAC;IAClC,yBAAyB,EAAE,OAAO,CAAC;CACtC;AAOD,eAAO,MAAM,QAAQ,cAAe,MAAM,eAAe,MAAM,WACiB,CAAC;AAEjF,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,MAAM,eAgJ1D"}
1
+ {"version":3,"file":"AccountsBookmarkedGroupFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/AccountsBookmarkedGroupFilter.tsx"],"names":[],"mappings":"AAmBA,eAAO,MAAM,YAAY,eAAgB,MAAM,gBAS9C,CAAC;AAEF,UAAU,MAAM;IACZ,uBAAuB,EAAE,OAAO,CAAC;IACjC,wBAAwB,EAAE,OAAO,CAAC;IAClC,yBAAyB,EAAE,OAAO,CAAC;CACtC;AAOD,eAAO,MAAM,QAAQ,cAAe,MAAM,eAAe,MAAM,WACiB,CAAC;AAEjF,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,MAAM,eAgJ1D"}
@@ -1,4 +1,5 @@
1
- import { Label, Select, SelectOption, SelectVariant, Tooltip } from '@patternfly/react-core';
1
+ import { Label, Tooltip } from '@patternfly/react-core';
2
+ import { Select, SelectOption, SelectVariant } from '@patternfly/react-core/deprecated';
2
3
  import InfoCircleIcon from '@patternfly/react-icons/dist/js/icons/info-circle-icon';
3
4
  import { GlobalMetadataStateContext } from '@rh-support/react-context';
4
5
  import { getDropdownBtnPlaceholder } from '@rh-support/utils';
@@ -16,8 +17,8 @@ import { CaseListFilterDispatchContext, CaseListFilterStateContext } from '../Ca
16
17
  import { updateFilter } from '../CaseListFilterReducer';
17
18
  export const appendToMenu = (listLength) => {
18
19
  return (React.createElement(React.Fragment, null,
19
- listLength !== 0 && React.createElement("div", { className: "pf-c-divider", role: "separator" }),
20
- React.createElement(Link, { className: "cta cta-link pf-c-select__menu-item", to: "/manage/bookmarks" },
20
+ listLength !== 0 && React.createElement("div", { className: "pf-v5-c-divider", role: "separator" }),
21
+ React.createElement(Link, { className: "cta cta-link pf-v5-c-select__menu-item", to: "/manage/bookmarks" },
21
22
  React.createElement(Trans, null, "Manage bookmarks"))));
22
23
  };
23
24
  export const getLabel = (accountNo, accountName) => accountNo ? (accountName ? `${accountName} <${accountNo}>` : accountNo) : '';
@@ -45,7 +46,7 @@ export function AccountsBookmarkedGroupFilter(props) {
45
46
  const selectedAccounts = filterInfo[SolrKeys.accountNumber].filter((item) => !Array.isArray(item.key));
46
47
  const getInfoToolTip = (groupName) => {
47
48
  const list = groupedBookmarks[groupName];
48
- return (React.createElement("ul", { className: "no-list-style pf-u-pl-0" }, list.map((b) => {
49
+ return (React.createElement("ul", { className: "no-list-style pf-v5-u-pl-0" }, list.map((b) => {
49
50
  return (React.createElement("li", { key: b.accountNumber },
50
51
  b.name,
51
52
  " (",
@@ -55,12 +56,12 @@ export function AccountsBookmarkedGroupFilter(props) {
55
56
  };
56
57
  const getBookmarksOptions = (options) => {
57
58
  return [
58
- ...options.map((b, id) => (React.createElement(SelectOption, { key: id, value: b, className: "pf-c-select__menu-wrapper", role: "presentation" },
59
- React.createElement("div", { className: "pf-c-select__menu-item-main" },
60
- React.createElement("input", { className: "pf-c-check__input pf-u-mr-sm", type: "checkbox", checked: some(filterInfo[SolrKeys.accountNumber], b) }),
59
+ ...options.map((b, id) => (React.createElement(SelectOption, { key: id, value: b, className: "pf-v5-c-select__menu-wrapper", role: "presentation" },
60
+ React.createElement("div", { className: "pf-v5-c-select__menu-item-main" },
61
+ React.createElement("input", { className: "pf-v5-c-check__input pf-v5-u-mr-sm", type: "checkbox", checked: some(filterInfo[SolrKeys.accountNumber], b) }),
61
62
  React.createElement("span", null, b.value)),
62
63
  Array.isArray(b.key) && (React.createElement(Tooltip, { content: getInfoToolTip(b.value), "aria-label": t('Bookmarked Accounts List') },
63
- React.createElement(Label, { color: "cyan", className: "pf-u-ml-auto pf-u-mr-sm", icon: React.createElement(InfoCircleIcon, null), "aria-label": t('Bookmarked Accounts') }, b.key.length)))))),
64
+ React.createElement(Label, { color: "cyan", className: "pf-v5-u-ml-auto pf-v5-u-mr-sm", icon: React.createElement(InfoCircleIcon, null), "aria-label": t('Bookmarked Accounts') }, b.key.length)))))),
64
65
  ...(canManageBookmarkAccounts ? [appendToMenu((bookmarkedGroupAccounts.data || []).length)] : []),
65
66
  ];
66
67
  };
@@ -96,7 +97,7 @@ export function AccountsBookmarkedGroupFilter(props) {
96
97
  if (!canReadBookmarkAccounts && !canAccessManagedAccounts) {
97
98
  return null;
98
99
  }
99
- return (React.createElement("div", { className: "pf-c-select" },
100
+ return (React.createElement("div", { className: "pf-v5-c-select" },
100
101
  React.createElement("label", { htmlFor: "case-list-group-filter" }, canAccessManagedAccounts ? t('Accounts') : t(filterNamesMap[SolrKeys.accountNumber])),
101
- React.createElement(Select, { variant: SelectVariant.typeaheadMulti, onToggle: onBookmarksToggle, onSelect: onBookmarksSelect, onClear: onBookmarksClear, isOpen: isOpen, onFilter: onBookmarksFilter, placeholderText: getDropdownBtnPlaceholder(t(canAccessManagedAccounts ? 'Search for an account' : 'Search for a bookmark'), canAccessManagedAccounts ? selectedAccounts : selectedBookmarks, '', dropdownOptions.length, canAccessManagedAccounts ? t('All accounts') : t('All bookmarks')), "data-tracking-id": "accounts-filter", id: "case-list-group-filter" }, getBookmarksOptions(dropdownOptions))));
102
+ React.createElement(Select, { variant: SelectVariant.typeaheadMulti, onToggle: (_event, open) => onBookmarksToggle(open), onSelect: onBookmarksSelect, onClear: onBookmarksClear, isOpen: isOpen, onFilter: onBookmarksFilter, placeholderText: getDropdownBtnPlaceholder(t(canAccessManagedAccounts ? 'Search for an account' : 'Search for a bookmark'), canAccessManagedAccounts ? selectedAccounts : selectedBookmarks, '', dropdownOptions.length, canAccessManagedAccounts ? t('All accounts') : t('All bookmarks')), "data-tracking-id": "accounts-filter", id: "case-list-group-filter" }, getBookmarksOptions(dropdownOptions))));
102
103
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AccountsFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/AccountsFilter.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAe1F,UAAU,MAAM;IACZ,uBAAuB,EAAE,OAAO,CAAC;CACpC;AAED,eAAO,MAAM,gCAAgC,YAAa,QAAQ,WAMjE,CAAC;AACF,eAAO,MAAM,+BAA+B,YAAa,QAAQ,sBAAsB,CAAC,WAEvF,CAAC;AAEF,eAAO,MAAM,QAAQ,0CACyD,CAAC;AAE/E,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,eAqF3C"}
1
+ {"version":3,"file":"AccountsFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/AccountsFilter.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAe1F,UAAU,MAAM;IACZ,uBAAuB,EAAE,OAAO,CAAC;CACpC;AAED,eAAO,MAAM,gCAAgC,YAAa,QAAQ,WAMjE,CAAC;AACF,eAAO,MAAM,+BAA+B,YAAa,QAAQ,sBAAsB,CAAC,WAEvF,CAAC;AAEF,eAAO,MAAM,QAAQ,0CACyD,CAAC;AAE/E,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,eA0F3C"}
@@ -15,7 +15,7 @@ import filter from 'lodash/filter';
15
15
  import remove from 'lodash/remove';
16
16
  import uniqBy from 'lodash/uniqBy';
17
17
  import React, { useContext, useEffect } from 'react';
18
- import { useTranslation } from 'react-i18next';
18
+ import { Trans, useTranslation } from 'react-i18next';
19
19
  import { SolrKeys } from '../../../enums/filters';
20
20
  import { CaseListFilterDispatchContext, CaseListFilterStateContext } from '../CaseListFilterContext';
21
21
  import { updateFilter } from '../CaseListFilterReducer';
@@ -95,5 +95,8 @@ export function AccountsFilter(props) {
95
95
  if (!canReadBookmarkAccounts) {
96
96
  return null;
97
97
  }
98
- return (React.createElement(AccountSelectorInternal, { label: t('i18nAccounts', 'Accounts'), selectedAccounts: selectedAccounts, multiple: true, suggestBookmarkAccounts: false, placeholder: getDropdownBtnPlaceholder(t('Search for an account'), (selectedAccounts || []).map((i) => i.name), ''), onSelect: onAccountsFilterChange }));
98
+ return (React.createElement("div", null,
99
+ React.createElement("label", { htmlFor: "case-list-accounts-filter" },
100
+ React.createElement(Trans, null, "Accounts")),
101
+ React.createElement(AccountSelectorInternal, { label: t('i18nAccounts', 'Accounts'), selectedAccounts: selectedAccounts, multiple: true, suggestBookmarkAccounts: false, placeholder: getDropdownBtnPlaceholder(t('Search for an account'), (selectedAccounts || []).map((i) => i.name), ''), onSelect: onAccountsFilterChange })));
99
102
  }
@@ -25,5 +25,5 @@ export function AdditionalFilters() {
25
25
  React.createElement("div", { className: "additional-filters" },
26
26
  React.createElement("h3", null,
27
27
  React.createElement(Trans, null, "More")),
28
- React.createElement(Checkbox, { label: t(AdditionalFilterLabels[SolrKeys.escalation]), isChecked: escalated, onChange: onEscalatedChange, "aria-label": t(AdditionalFilterLabels[SolrKeys.escalation]), id: "escalated", name: "escalated", "data-tracking-id": "escalated-filter-selector" }))));
28
+ React.createElement(Checkbox, { label: t(AdditionalFilterLabels[SolrKeys.escalation]), isChecked: escalated, onChange: (_event, checked) => onEscalatedChange(checked), "aria-label": t(AdditionalFilterLabels[SolrKeys.escalation]), id: "escalated", name: "escalated", "data-tracking-id": "escalated-filter-selector" }))));
29
29
  }
@@ -44,7 +44,7 @@ export function CaseListFilterChips(props) {
44
44
  return (React.createElement("div", { className: "filter-chip", key: `${filterKey}-bookmarks-${groupName}` },
45
45
  React.createElement("span", { className: "filter-chip__heading" },
46
46
  React.createElement(Trans, null, groupName || filterNamesMap[filterKey] || filterKey)),
47
- React.createElement(ChipGroup, { numChips: 7, className: "pf-c-chip-group__simple" }, renderFilterValueChips(filterKey, caseTypeFilter, groupName))));
47
+ React.createElement(ChipGroup, { numChips: 7, className: "pf-v5-c-chip-group__simple" }, renderFilterValueChips(filterKey, caseTypeFilter, groupName))));
48
48
  }
49
49
  };
50
50
  const renderAccountFilterChip = () => {
@@ -1,2 +1,12 @@
1
+ export declare const getFullName: (contact: any) => string;
2
+ export declare const getFilterValues: (contactList: any, own: any) => {
3
+ firstName: string;
4
+ lastName: string;
5
+ firstNameCustom: string;
6
+ lastNameCustom: string;
7
+ value: string;
8
+ label: string;
9
+ }[];
10
+ export declare const getSelectedListObj: (contactsList: any, filterInfo: any, own: any, t: any) => any[];
1
11
  export declare function CreatorSsoNameFilter(): JSX.Element;
2
12
  //# sourceMappingURL=CreatorSsoNameFilter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CreatorSsoNameFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/CreatorSsoNameFilter.tsx"],"names":[],"mappings":"AAmDA,wBAAgB,oBAAoB,gBAwSnC"}
1
+ {"version":3,"file":"CreatorSsoNameFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/CreatorSsoNameFilter.tsx"],"names":[],"mappings":"AA+BA,eAAO,MAAM,WAAW,0BAIvB,CAAC;AAYF,eAAO,MAAM,eAAe;;;;;;;GAA6E,CAAC;AAE1G,eAAO,MAAM,kBAAkB,iEAyC9B,CAAC;AAEF,wBAAgB,oBAAoB,gBAgOnC"}
@@ -7,21 +7,24 @@ 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 { accounts, contacts } from '@cee-eng/hydrajs';
11
- import { AsyncMultiDropDownList, MultiSelectDropDownList, useFetch } from '@rh-support/components';
10
+ import { accounts } from '@cee-eng/hydrajs';
11
+ import { Button, MenuToggle, Select, SelectGroup, SelectOption, TextInputGroup, TextInputGroupMain, TextInputGroupUtilities, } from '@patternfly/react-core';
12
+ import TimesCircleIcon from '@patternfly/react-icons/dist/js/icons/times-circle-icon';
13
+ import { LoadingIndicator, useFetch, useSelectKeyboardNavigator } from '@rh-support/components';
12
14
  import { GlobalMetadataStateContext } from '@rh-support/react-context';
13
- import { getDropdownBtnPlaceholder, toOptions } from '@rh-support/utils';
14
- import isEmpty from 'lodash/isEmpty';
15
+ import { getDropdownBtnPlaceholder } from '@rh-support/utils';
16
+ import { isEmpty } from 'lodash';
15
17
  import uniqBy from 'lodash/uniqBy';
16
- import React, { useContext, useEffect, useRef, useState } from 'react';
18
+ import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
17
19
  import { Trans, useTranslation } from 'react-i18next';
18
20
  import { SolrKeys } from '../../../enums/filters';
19
21
  import { filterNamesMap } from '../../../utils/constants';
20
- import { useCaseListDispatchContext, useCaseListStateContext } from '../CaseListContext';
22
+ import { useCaseListDispatchContext } from '../CaseListContext';
21
23
  import { CaseListFilterDispatchContext, CaseListFilterStateContext } from '../CaseListFilterContext';
22
24
  import { updateFilters } from '../CaseListFilterReducer';
23
25
  import { setChipsNameSsoMap } from '../CaseListReducer';
24
- const getFullName = (contact) => {
26
+ import InternalSsoNameFilter from './InternalSsoNameFilter';
27
+ export const getFullName = (contact) => {
25
28
  return contact.fullNameCustom
26
29
  ? `${contact.firstNameCustom} ${contact.lastNameCustom}`
27
30
  : `${contact.firstName} ${contact.lastName}`;
@@ -34,49 +37,100 @@ const mapToObj = (arr) => arr.map((item) => ({
34
37
  value: item.ssoUsername,
35
38
  label: `${getFullName(item)} <${item.ssoUsername}>`,
36
39
  }));
37
- const getFilterValues = (contactList, own) => mapToObj(contactList).filter((o) => o.value !== own);
40
+ export const getFilterValues = (contactList, own) => mapToObj(contactList).filter((o) => o.value !== own);
41
+ export const getSelectedListObj = (contactsList, filterInfo, own, t) => {
42
+ const created = [...filterInfo[SolrKeys.createdBySsoUsername]].reduce((result, sso) => {
43
+ if (sso === own) {
44
+ result.push({ value: 'createdByMe', label: t('Cases created by me') });
45
+ }
46
+ else {
47
+ const contact = contactsList.find((item) => (item === null || item === void 0 ? void 0 : item.ssoUsername) === sso);
48
+ contact &&
49
+ result.push({
50
+ value: contact.ssoUsername,
51
+ label: `${getFullName(contact)} <${contact.ssoUsername}>`,
52
+ });
53
+ !contact &&
54
+ result.push({
55
+ value: sso,
56
+ label: '',
57
+ });
58
+ }
59
+ return result;
60
+ }, []);
61
+ const owned = [...filterInfo[SolrKeys.caseContactSSO]].reduce((result, sso) => {
62
+ if (sso === own) {
63
+ result.push({ value: 'ownedByMe', label: t('Cases owned by me') });
64
+ }
65
+ else {
66
+ const contact = contactsList.find((item) => item.ssoUsername === sso);
67
+ contact &&
68
+ result.push({
69
+ value: contact.ssoUsername,
70
+ label: `${getFullName(contact)} <${contact.ssoUsername}>`,
71
+ });
72
+ !contact &&
73
+ result.push({
74
+ value: sso,
75
+ label: '',
76
+ });
77
+ }
78
+ return result;
79
+ }, []);
80
+ const selected = uniqBy([...created, ...owned], 'value');
81
+ return selected;
82
+ };
38
83
  export function CreatorSsoNameFilter() {
39
84
  const { t } = useTranslation();
40
85
  const { filterInfo } = useContext(CaseListFilterStateContext);
41
86
  const dispatch = useContext(CaseListFilterDispatchContext);
42
87
  const { globalMetadataState: { loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
43
- const { chipsNameSsoMap } = useCaseListStateContext();
44
88
  const CaseListDispatch = useCaseListDispatchContext();
45
89
  const own = loggedInUserRights.data.getSSOUsername();
46
- const PER_PAGE = 200;
47
90
  const isExternalNonOrgAdmin = !loggedInUserRights.data.isInternal() && loggedInUserRights.data.isCustomerNonOrgAdmin();
48
- const ASYNC_DROPDOWN_PAGE_SIZE = 10000;
49
91
  const { request: getExternalUserContactsList, isFetching: isFetchingExternalContacts } = useFetch(accounts.getAccountContacts, { propgateErrors: true });
50
- const { request: getInternalUserContactsList, isFetching: isFetchingInternalContacts } = useFetch(contacts.getSFDCContacts, { propgateErrors: true });
51
- const abortControllerRef = useRef(undefined);
92
+ const externalInputRef = useRef();
52
93
  const [externalContactList, setExternalContactList] = useState([]);
53
- const [internalContactList, setInternalContactList] = useState([]);
54
- const onFilterChange = (items) => {
55
- const selectedItems = items.map((item) => item.value.value);
56
- const caseCreated = selectedItems
57
- .filter((o) => o !== 'ownedByMe')
58
- .map((o) => (o === 'createdByMe' ? own : o));
59
- const caseOwnedBy = selectedItems
60
- .filter((o) => o !== 'createdByMe')
61
- .map((o) => (o === 'ownedByMe' ? own : o));
62
- const caseOwner = loggedInUserRights.data.isInternal() && caseOwnedBy.indexOf(own) !== -1 ? [own] : [];
63
- updateFilters(dispatch, [
64
- {
65
- filterKey: SolrKeys.createdBySsoUsername,
66
- values: caseCreated,
67
- },
68
- {
69
- filterKey: SolrKeys.caseContactSSO,
70
- values: caseOwnedBy,
71
- },
72
- {
73
- filterKey: SolrKeys.caseOwner,
74
- values: caseOwner,
75
- },
76
- ]);
94
+ const [isExternalOpen, setIsExternalOpen] = useState(false);
95
+ const [externalQuery, setExternalQuery] = useState('');
96
+ const onSelectExternal = (contact) => {
97
+ let list = [];
98
+ if (selectedExternalContacts.some((item) => item.value === contact.value)) {
99
+ list = selectedExternalContacts.filter((item) => item.value !== contact.value);
100
+ }
101
+ else {
102
+ list = [...selectedExternalContacts, contact];
103
+ }
104
+ onFilterChange(list);
105
+ setExternalQuery('');
77
106
  };
78
- const onFilterChangeAsync = (items) => {
79
- const selectedItems = items.map((item) => item.value.value);
107
+ const dropdownHeader = [
108
+ {
109
+ label: `${t('Cases created by me')}`,
110
+ value: 'createdByMe',
111
+ },
112
+ {
113
+ label: `${t('Cases owned by me')}`,
114
+ value: 'ownedByMe',
115
+ },
116
+ ];
117
+ const filteredOptions = useMemo(() => {
118
+ const filteredValues = getFilterValues(externalContactList, own);
119
+ const input = new RegExp(externalQuery, 'i');
120
+ const newOptions = filteredValues.filter((v) => input.test(v.value || ''));
121
+ return newOptions;
122
+ }, [externalContactList, own, externalQuery]);
123
+ const { onInputKeyDown, focusedItemIndex } = useSelectKeyboardNavigator({
124
+ list: [...dropdownHeader, ...filteredOptions],
125
+ isOpen: isExternalOpen,
126
+ setIsOpen: setIsExternalOpen,
127
+ onSelect: onSelectExternal,
128
+ });
129
+ const selectedExternalContacts = useMemo(() => getSelectedListObj(externalContactList, filterInfo, own, t),
130
+ // eslint-disable-next-line react-hooks/exhaustive-deps
131
+ [externalContactList, filterInfo, own]);
132
+ const onFilterChange = (items) => {
133
+ const selectedItems = items.map((item) => item.value);
80
134
  const caseCreated = selectedItems
81
135
  .filter((o) => o !== 'ownedByMe')
82
136
  .map((o) => (o === 'createdByMe' ? own : o));
@@ -98,111 +152,7 @@ export function CreatorSsoNameFilter() {
98
152
  values: caseOwner,
99
153
  },
100
154
  ]);
101
- // set name/sso pairs on state to be used in filter chip component
102
- if (loggedInUserRights.data.isInternal()) {
103
- const chipsNameSsoPairs = {};
104
- items.forEach((item) => {
105
- var _a, _b, _c, _d;
106
- const sso = item.value.value;
107
- if (sso !== 'ownedByMe' && sso !== 'createdByMe' && !chipsNameSsoMap[sso]) {
108
- chipsNameSsoPairs[sso] = {
109
- firstName: ((_a = item.value) === null || _a === void 0 ? void 0 : _a.firstName) || '',
110
- lastName: ((_b = item.value) === null || _b === void 0 ? void 0 : _b.lastName) || '',
111
- firstNameCustom: ((_c = item.value) === null || _c === void 0 ? void 0 : _c.firstNameCustom) || '',
112
- lastNameCustom: ((_d = item.value) === null || _d === void 0 ? void 0 : _d.lastNameCustom) || '',
113
- };
114
- }
115
- });
116
- setChipsNameSsoMap(CaseListDispatch, chipsNameSsoPairs);
117
- }
118
155
  };
119
- const dropdownHeader = [
120
- {
121
- isNotSearchable: true,
122
- label: `${t('Cases created by me')}`,
123
- value: 'createdByMe',
124
- },
125
- {
126
- isNotSearchable: true,
127
- label: `${t('Cases owned by me')}`,
128
- value: 'ownedByMe',
129
- },
130
- {
131
- children: isExternalNonOrgAdmin || (externalContactList.length === 0 && internalContactList.length === 0) ? (React.createElement(React.Fragment, null)) : (React.createElement(React.Fragment, null,
132
- React.createElement("div", { className: "pf-c-divider", role: "separator" }),
133
- React.createElement("h3", { className: "subheading subheading-sm pf-u-pl-md" },
134
- React.createElement(Trans, null, "Created or owned by")))),
135
- isNotSearchable: true,
136
- isNonActionable: true,
137
- isNotSelectable: true,
138
- },
139
- ];
140
- const getSelectedListObj = (contactsList) => {
141
- const created = [...filterInfo[SolrKeys.createdBySsoUsername]].reduce((result, sso) => {
142
- if (sso === own) {
143
- result.push({ value: 'createdByMe', label: t('Cases created by me') });
144
- }
145
- else {
146
- const contact = contactsList.find((item) => (item === null || item === void 0 ? void 0 : item.ssoUsername) === sso);
147
- contact &&
148
- result.push({
149
- value: contact.ssoUsername,
150
- label: `${getFullName(contact)} <${contact.ssoUsername}>`,
151
- });
152
- !contact &&
153
- result.push({
154
- value: sso,
155
- label: '',
156
- });
157
- }
158
- return result;
159
- }, []);
160
- const owned = [...filterInfo[SolrKeys.caseContactSSO]].reduce((result, sso) => {
161
- if (sso === own) {
162
- result.push({ value: 'ownedByMe', label: t('Cases owned by me') });
163
- }
164
- else {
165
- const contact = contactsList.find((item) => item.ssoUsername === sso);
166
- contact &&
167
- result.push({
168
- value: contact.ssoUsername,
169
- label: `${getFullName(contact)} <${contact.ssoUsername}>`,
170
- });
171
- !contact &&
172
- result.push({
173
- value: sso,
174
- label: '',
175
- });
176
- }
177
- return result;
178
- }, []);
179
- const selected = uniqBy([...created, ...owned], 'value');
180
- return toOptions(selected, {
181
- labelKey: 'label',
182
- });
183
- };
184
- const onSearchAsync = (query) => __awaiter(this, void 0, void 0, function* () {
185
- if (query == null) {
186
- return;
187
- }
188
- if (abortControllerRef.current !== undefined) {
189
- // Cancel the previous request
190
- abortControllerRef.current.abort();
191
- }
192
- // recreate a new AbortController for each call
193
- let controller = new AbortController();
194
- abortControllerRef.current = controller;
195
- const queryParams = {
196
- internal: false,
197
- limit: ASYNC_DROPDOWN_PAGE_SIZE,
198
- nameLookup: query,
199
- };
200
- const response = yield getInternalUserContactsList(queryParams, controller.signal);
201
- const contacts = response && response.items && response.items.length !== 0
202
- ? response.items.filter((c) => !isEmpty(c.ssoUsername))
203
- : [];
204
- setInternalContactList(contacts);
205
- });
206
156
  // fetch data on load for external users
207
157
  useEffect(() => {
208
158
  if (loggedInUserRights.data.isInternal())
@@ -221,25 +171,33 @@ export function CreatorSsoNameFilter() {
221
171
  fetchStrataAccountUsers();
222
172
  // eslint-disable-next-line react-hooks/exhaustive-deps
223
173
  }, [dispatch, isExternalNonOrgAdmin, loggedInUserRights.data]);
224
- const asyncMultiDropDownList = [
225
- ...dropdownHeader,
226
- ...getFilterValues(internalContactList, own),
227
- ];
228
- const multiDropDownList = [
229
- ...dropdownHeader,
230
- ...getFilterValues(externalContactList, own),
231
- ];
232
- return (React.createElement(React.Fragment, null, !loggedInUserRights.data.isInternal() ? (React.createElement(MultiSelectDropDownList, { placeholder: getDropdownBtnPlaceholder(t('Search for a name'), getSelectedListObj(externalContactList).map((i) => i.label), ' ', multiDropDownList.length, t('All contacts')), id: "external-ssousername-filter", "data-tracking-id": "external-ssousername-filter", selectedItems: getSelectedListObj(externalContactList), list: toOptions(multiDropDownList, {
233
- labelKey: 'label',
234
- childrenKey: 'children',
235
- nonSearchableItemKey: 'isNotSearchable',
236
- nonActionableItemKey: 'isNonActionable',
237
- nonSelectableItemKey: 'isNotSelectable',
238
- }), title: t(filterNamesMap['usernameFilterTitle']), onChange: onFilterChange, emptyListLabel: isExternalNonOrgAdmin ? '' : t('No results found'), searchable: true, label: t(filterNamesMap['usernameFilterTitle']), isLoadingList: isFetchingExternalContacts })) : (React.createElement(AsyncMultiDropDownList, { placeholder: getDropdownBtnPlaceholder(t('Search for a name'), getSelectedListObj(internalContactList).map((i) => i.label), ' ', asyncMultiDropDownList.length, t('All contacts')), id: "internal-ssousername-async-filter", "data-tracking-id": "internal-ssousername-async-filter", selectedItems: getSelectedListObj(internalContactList), list: toOptions(asyncMultiDropDownList, {
239
- labelKey: 'label',
240
- childrenKey: 'children',
241
- nonSearchableItemKey: 'isNotSearchable',
242
- nonActionableItemKey: 'isNonActionable',
243
- nonSelectableItemKey: 'isNotSelectable',
244
- }), title: t(filterNamesMap['usernameFilterTitle']), onChange: onFilterChangeAsync, delay: 300, useCache: true, paginate: true, emptyListLabel: t('No results found'), maxResults: PER_PAGE, onSearch: onSearchAsync, minLength: 0, label: t(filterNamesMap['usernameFilterTitle']), isLoadingList: isFetchingInternalContacts }))));
174
+ const filteredExternalList = useMemo(() => {
175
+ return [
176
+ ...dropdownHeader.map((contact, index) => (React.createElement(SelectOption, { key: contact.value, isFocused: focusedItemIndex === index, value: contact, hasCheckbox: true, isSelected: selectedExternalContacts.some((c) => c.value === contact.value) }, contact.label))),
177
+ ...(!isEmpty(filteredOptions)
178
+ ? [
179
+ React.createElement("div", { className: "pf-v5-c-divider", role: "separator", key: "separator" }),
180
+ React.createElement(SelectGroup, { key: "created-or-owned-by-accounts-group" },
181
+ React.createElement("h3", { className: "subheading subheading-sm pf-v5-u-pl-md" },
182
+ React.createElement(Trans, null, "Created or owned by")),
183
+ filteredOptions.map((contact, index) => (React.createElement(SelectOption, { key: contact.value, isFocused: focusedItemIndex === index + dropdownHeader.length, value: contact, hasCheckbox: true, isSelected: selectedExternalContacts.some((c) => c.value === contact.value) }, contact.label)))),
184
+ ]
185
+ : []),
186
+ ];
187
+ // eslint-disable-next-line react-hooks/exhaustive-deps
188
+ }, [filteredOptions, selectedExternalContacts, focusedItemIndex]);
189
+ const onExternalQueryChange = (_v, query) => {
190
+ setExternalQuery(query);
191
+ };
192
+ const onExternalToggle = () => {
193
+ setIsExternalOpen((pre) => !pre);
194
+ };
195
+ const externalToggle = (toggleRef) => (React.createElement(MenuToggle, { variant: "typeahead", onClick: onExternalToggle, innerRef: toggleRef, isExpanded: isExternalOpen, isFullWidth: true },
196
+ React.createElement(TextInputGroup, { isPlain: true },
197
+ React.createElement(TextInputGroupMain, { value: externalQuery, onClick: onExternalToggle, onKeyDown: onInputKeyDown, placeholder: getDropdownBtnPlaceholder(t('Search for a name'), selectedExternalContacts.map((i) => i.label), ' ', filteredOptions.length + dropdownHeader.length, t('All contacts')), onChange: onExternalQueryChange, isExpanded: isExternalOpen, innerRef: externalInputRef }),
198
+ React.createElement(TextInputGroupUtilities, null, !isEmpty(externalQuery) && (React.createElement(Button, { variant: "plain", onClick: () => setExternalQuery(''), isDisabled: isFetchingExternalContacts, "aria-label": t('Clear') }, isFetchingExternalContacts ? (React.createElement(LoadingIndicator, { show: true, size: "sm" })) : (React.createElement(TimesCircleIcon, { "aria-hidden": true }))))))));
199
+ return (React.createElement("div", null,
200
+ React.createElement("label", { htmlFor: "case-list-username-filter" },
201
+ React.createElement(Trans, null, filterNamesMap['usernameFilterTitle'])),
202
+ !loggedInUserRights.data.isInternal() ? (React.createElement(Select, { id: "external-ssousername-filter", "data-tracking-id": "external-ssousername-filter", isOpen: isExternalOpen, onOpenChange: () => setIsExternalOpen(false), toggle: externalToggle, popperProps: { direction: 'down', enableFlip: false }, isScrollable: true, onSelect: (_e, v) => onSelectExternal(v) }, filteredExternalList)) : (React.createElement(InternalSsoNameFilter, null))));
245
203
  }
@@ -103,7 +103,7 @@ export function CreatorSsoNameFilterChip() {
103
103
  return (React.createElement("div", { className: "filter-chip" },
104
104
  React.createElement("span", { className: "filter-chip__heading" },
105
105
  React.createElement(Trans, null, filterNamesMap['usernameFilterTitle'])),
106
- React.createElement(ChipGroup, { numChips: 7, className: "pf-c-chip-group" },
106
+ React.createElement(ChipGroup, { numChips: 7, className: "pf-v5-c-chip-group" },
107
107
  own &&
108
108
  filterInfo &&
109
109
  filterInfo[SolrKeys.createdBySsoUsername] &&
@@ -26,8 +26,8 @@ export function GroupsFilter() {
26
26
  ...(caseGroups.data ? caseGroups.data.map((group) => ({ value: group.name, key: group.groupNum })) : []),
27
27
  {
28
28
  children: canViewCaseGroups ? (React.createElement(React.Fragment, null,
29
- React.createElement("div", { className: "pf-c-divider", role: "separator" }),
30
- React.createElement(Link, { className: "cta cta-link pf-c-select__menu-item", to: "/manage/groups" },
29
+ React.createElement("div", { className: "pf-v5-c-divider", role: "separator" }),
30
+ React.createElement(Link, { className: "cta cta-link pf-v5-c-select__menu-item", to: "/manage/groups" },
31
31
  React.createElement(Trans, null, "Manage groups")))) : (React.createElement(React.Fragment, null)),
32
32
  isNotSearchable: true,
33
33
  isNonActionable: true,
@@ -0,0 +1,2 @@
1
+ export default function InternalSsoNameFilter(): JSX.Element;
2
+ //# sourceMappingURL=InternalSsoNameFilter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InternalSsoNameFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/InternalSsoNameFilter.tsx"],"names":[],"mappings":"AAgCA,MAAM,CAAC,OAAO,UAAU,qBAAqB,gBAsQ5C"}