@rh-support/cases 2.6.6 → 2.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/esm/components/case-list/CaseList.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseList.js +5 -10
- package/lib/esm/components/case-list/case-list-filters/AccountsBookmarkedGroupFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/AccountsBookmarkedGroupFilter.js +34 -34
- package/lib/esm/components/case-list/case-list-filters/CaseListFilterChips.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/CaseListFilterChips.js +3 -3
- package/lib/esm/components/case-list/case-list-filters/CreatorSsoNameFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/CreatorSsoNameFilter.js +4 -4
- package/lib/esm/components/case-list/case-list-filters/CreatorSsoNameFilterChip.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/CreatorSsoNameFilterChip.js +5 -5
- package/lib/esm/components/case-list/case-list-filters/GroupsFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/GroupsFilter.js +4 -5
- package/lib/esm/components/case-list/case-list-filters/InternalSsoNameFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/InternalSsoNameFilter.js +6 -6
- package/lib/esm/components/case-list/case-list-filters/ProductFilterChip.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/ProductFilterChip.js +4 -5
- package/lib/esm/components/case-list/case-list-filters/ProductsFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/ProductsFilter.js +124 -32
- package/lib/esm/components/case-list/case-list-filters/SeverityFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/SeverityFilter.js +91 -20
- package/lib/esm/components/case-list/case-list-filters/StatusFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/StatusFilter.js +90 -18
- package/lib/esm/components/case-list/case-list-filters/TypeFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/TypeFilter.js +67 -16
- package/lib/esm/components/case-list/case-list-filters/VersionsFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/VersionsFilter.js +112 -15
- package/lib/esm/components/case-list/case-list-table/CaseListTable.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-table/CaseListTable.js +17 -18
- package/lib/esm/components/case-list/case-list-table/CloseCaseBtn.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-table/CloseCaseBtn.js +7 -4
- package/lib/esm/components/case-list/case-list-table/DownloadCSVFileModal.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-table/DownloadCSVFileModal.js +7 -7
- package/lib/esm/components/case-list/case-list-table/ExportCaseListCSV.js +1 -1
- package/lib/esm/components/case-list/case-list-table/SeverityLabel.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-table/SeverityLabel.js +6 -5
- package/lib/esm/components/case-list/case-list-table/TableActionsDropdown.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-table/TableActionsDropdown.js +5 -7
- package/lib/esm/components/case-list/case-list-table/table-column-selector/TableColumnSelector.js +1 -1
- package/lib/esm/components/case-list/case-search/AdvanceSearch.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-search/AdvanceSearch.js +13 -14
- package/lib/esm/components/case-list/case-search/BookmarkedSearchesSelector.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-search/BookmarkedSearchesSelector.js +21 -15
- package/lib/esm/components/case-list/case-search/CaseSearch.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-search/CaseSearch.js +2 -2
- package/lib/esm/components/case-list/case-search/SaveCaseSearchModal.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-search/SaveCaseSearchModal.js +16 -17
- package/lib/esm/css/caseList.css +89 -60
- package/lib/esm/css/caseSearch.css +13 -2
- package/lib/esm/css/escalation.css +4 -4
- package/lib/esm/scss/_main.scss +15 -11
- package/lib/esm/scss/_pf-overrides.scss +25 -12
- package/package.json +12 -12
|
@@ -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;
|
|
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;AAK3B,OAAO,KAAkD,MAAM,OAAO,CAAC;AAEvE,OAAO,EAAE,mBAAmB,EAAe,MAAM,kBAAkB,CAAC;AAEpE,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,MAAM,MAAM,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,qBAigBrC"}
|
|
@@ -10,10 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import '../../css/caseList.css';
|
|
11
11
|
import '../../css/caseSearch.css';
|
|
12
12
|
import { Alert, AlertActionCloseButton, AlertVariant, Button } from '@patternfly/react-core';
|
|
13
|
-
import
|
|
14
|
-
import AngleDoubleLeftIcon from '@patternfly/react-icons/dist/js/icons/angle-double-left-icon';
|
|
15
|
-
import AngleDoubleRightIcon from '@patternfly/react-icons/dist/js/icons/angle-double-right-icon';
|
|
16
|
-
import AngleDoubleUpIcon from '@patternfly/react-icons/dist/js/icons/angle-double-up-icon';
|
|
13
|
+
import OpenDrawerRightIcon from '@patternfly/react-icons/dist/js/icons/open-drawer-right-icon';
|
|
17
14
|
import { ErrorBoundary, ToastNotification, useBreakpoint, useDocumentTitle, useForceUpdate, usePrevious, } from '@rh-support/components';
|
|
18
15
|
import { CSSUserModal, fetchAllStatuses, fetchCaseGroupsForSSO, fetchCaseSeverities, fetchCaseTypes, fetchProducts, GlobalMetadataDispatchContext, GlobalMetadataStateContext, setUserPreferences, updateCaseListTraditionalSupportAgreed, updateUserPreferences, useGlobalDispatchContext, UserPreferencesKeys, } from '@rh-support/react-context';
|
|
19
16
|
import { getStringifiedParams, getUrlParsedParams, haventLoadedMetadata, haventLoadedProductsMetadata, pendoTrackEvent, solrResponseToFacetFields, solrResponseToPivotFields, } from '@rh-support/utils';
|
|
@@ -343,15 +340,13 @@ export function CaseList(props) {
|
|
|
343
340
|
React.createElement(CaseListFilterChips, { productVersionPivotValues: get(pivotValues, SolrPivotKeys.product_version, []), isSolrSearchDown: isSolrSearchDown })))),
|
|
344
341
|
React.createElement("section", { className: "case-search-bottom" },
|
|
345
342
|
isBasicSearchMode && (React.createElement("aside", { className: `case-search-filters ${((_a = filterSectionRef.current) === null || _a === void 0 ? void 0 : _a.expanded) ? '' : 'collapsed'}` },
|
|
346
|
-
React.createElement("h2", { className: "filter-header" }, ((_b = filterSectionRef.current) === null || _b === void 0 ? void 0 : _b.expanded) ? (React.createElement(React.Fragment, null,
|
|
347
|
-
React.createElement(Button, {
|
|
348
|
-
React.createElement("
|
|
349
|
-
React.createElement(Trans, null, "Filters"))))) : (React.createElement(Button, { variant: "link", isActive: false, title: t('Expand filter section'), "data-tracking-id": "expand-case-list-filter", onClick: onToggleFilterBtnClick, iconPosition: "right", icon: isXLScreen ? React.createElement(AngleDoubleRightIcon, null) : React.createElement(AngleDoubleDownIcon, null) }, isXLScreen ? null : (React.createElement("span", null,
|
|
350
|
-
React.createElement(Trans, null, "Filters")))))),
|
|
343
|
+
React.createElement("h2", { className: "filter-header pf-v6-u-display-flex" }, ((_b = filterSectionRef.current) === null || _b === void 0 ? void 0 : _b.expanded) ? (React.createElement(React.Fragment, null,
|
|
344
|
+
React.createElement(Button, { className: "pf-v6-u-flex-shrink-0 pf-v6-u-flex-none", variant: "link", title: t('Collapse filter section'), "data-tracking-id": "collapse-case-list-filter", onClick: onToggleFilterBtnClick, iconPosition: "right", icon: React.createElement(OpenDrawerRightIcon, { className: "mirrored" }) },
|
|
345
|
+
React.createElement(Trans, null, "Filters")))) : (React.createElement(Button, { className: "pf-v6-u-flex-shrink-0 pf-v6-u-flex-none", variant: "link", title: t('Expand filter section'), "data-tracking-id": "expand-case-list-filter", onClick: onToggleFilterBtnClick, iconPosition: "right", icon: React.createElement(OpenDrawerRightIcon, null) }, isXLScreen ? null : React.createElement(Trans, null, "Filters")))),
|
|
351
346
|
React.createElement("div", { className: "filter-wrapper" },
|
|
352
347
|
React.createElement("pfe-collapse-panel", { id: "case-filters-panel", "pfe-animation": "false", ref: filterSectionRef },
|
|
353
348
|
React.createElement(ErrorBoundary, { errorMsgInfo: { message: t('There was an error loading filters') } },
|
|
354
349
|
React.createElement(CaseListFilters, { filterValues: filterValuesFromFacetResponse, allCaseTypes: allCaseTypes, allCaseStatuses: allCaseStatuses, allCaseSeverities: allCaseSeverities, allProducts: allProducts, isSolrSearchDown: isSolrSearchDown })))))),
|
|
355
|
-
React.createElement("section", { className: "case-search-table" },
|
|
350
|
+
React.createElement("section", { className: "case-search-table pf-v6-u-display-flex pf-v6-u-flex-direction-column" },
|
|
356
351
|
React.createElement(CaseListTable, { caseList: caseList, caseGroups: caseGroups.data || [], loggedInUserRights: loggedInUserRights.data, sortInfo: filterState.sortInfo, paginationInfo: filterState.paginationInfo, isCaseListPageLoading: isFetching, hasError: hasError, isSolrDown: isSolrSearchDown }))))));
|
|
357
352
|
}
|
package/lib/esm/components/case-list/case-list-filters/AccountsBookmarkedGroupFilter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountsBookmarkedGroupFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/AccountsBookmarkedGroupFilter.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AccountsBookmarkedGroupFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/AccountsBookmarkedGroupFilter.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAS7D,eAAO,MAAM,YAAY,eAAgB,MAAM,sBAS9C,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,qBAoL1D"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Label, Tooltip } from '@patternfly/react-core';
|
|
2
|
-
import { Select, SelectOption, SelectVariant } from '@patternfly/react-core/deprecated';
|
|
1
|
+
import { Label, MenuToggle, Select, SelectOption, TextInputGroup, TextInputGroupMain, Tooltip, } from '@patternfly/react-core';
|
|
3
2
|
import InfoCircleIcon from '@patternfly/react-icons/dist/js/icons/info-circle-icon';
|
|
4
3
|
import { LoadingIndicator } from '@rh-support/components';
|
|
5
4
|
import { GlobalMetadataStateContext } from '@rh-support/react-context';
|
|
@@ -18,8 +17,8 @@ import { CaseListFilterDispatchContext, CaseListFilterStateContext } from '../Ca
|
|
|
18
17
|
import { updateFilter } from '../CaseListFilterReducer';
|
|
19
18
|
export const appendToMenu = (listLength) => {
|
|
20
19
|
return (React.createElement(React.Fragment, null,
|
|
21
|
-
listLength !== 0 && React.createElement("div", { className: "pf-
|
|
22
|
-
React.createElement(Link, { className: "cta cta-link pf-
|
|
20
|
+
listLength !== 0 && React.createElement("div", { className: "pf-v6-c-divider", role: "separator" }),
|
|
21
|
+
React.createElement(Link, { className: "cta cta-link pf-v6-c-select__menu-item", to: "/manage/bookmarks" },
|
|
23
22
|
React.createElement(Trans, null, "Manage bookmarks"))));
|
|
24
23
|
};
|
|
25
24
|
export const getLabel = (accountNo, accountName) => accountNo ? (accountName ? `${accountName} <${accountNo}>` : accountNo) : '';
|
|
@@ -45,9 +44,10 @@ export function AccountsBookmarkedGroupFilter(props) {
|
|
|
45
44
|
const dropdownOptions = [...groupedBookmarksOptionsSorted, ...managedAccountsList];
|
|
46
45
|
const selectedBookmarks = filterInfo[SolrKeys.accountNumber].filter((item) => Array.isArray(item.key));
|
|
47
46
|
const selectedAccounts = filterInfo[SolrKeys.accountNumber].filter((item) => !Array.isArray(item.key));
|
|
47
|
+
const [input, setInput] = useState('');
|
|
48
48
|
const getInfoToolTip = (groupName) => {
|
|
49
49
|
const list = groupedBookmarks[groupName];
|
|
50
|
-
return (React.createElement("ul", { className: "no-list-style pf-
|
|
50
|
+
return (React.createElement("ul", { className: "no-list-style pf-v6-u-pl-0" }, list.map((b) => {
|
|
51
51
|
return (React.createElement("li", { key: b.accountNumber },
|
|
52
52
|
b.name,
|
|
53
53
|
" (",
|
|
@@ -55,19 +55,8 @@ export function AccountsBookmarkedGroupFilter(props) {
|
|
|
55
55
|
")"));
|
|
56
56
|
})));
|
|
57
57
|
};
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
...options.map((b, id) => (React.createElement(SelectOption, { key: id, value: b, className: "pf-v5-c-select__menu-wrapper", role: "presentation" },
|
|
61
|
-
React.createElement("div", { className: "pf-v5-c-select__menu-item-main" },
|
|
62
|
-
React.createElement("input", { className: "pf-v5-c-check__input pf-v5-u-mr-sm", type: "checkbox", checked: some(filterInfo[SolrKeys.accountNumber], b) }),
|
|
63
|
-
React.createElement("span", null, b.value)),
|
|
64
|
-
Array.isArray(b.key) && (React.createElement(Tooltip, { content: getInfoToolTip(b.value), "aria-label": t('Bookmarked Accounts List') },
|
|
65
|
-
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)))))),
|
|
66
|
-
...(canManageBookmarkAccounts ? [appendToMenu((bookmarkedGroupAccounts.data || []).length)] : []),
|
|
67
|
-
];
|
|
68
|
-
};
|
|
69
|
-
const onBookmarksToggle = (open) => {
|
|
70
|
-
setIsOpen(open);
|
|
58
|
+
const onBookmarksToggle = () => {
|
|
59
|
+
setIsOpen((prev) => !prev);
|
|
71
60
|
};
|
|
72
61
|
const onBookmarksSelect = (e, selection) => {
|
|
73
62
|
let selected = filterInfo[SolrKeys.accountNumber];
|
|
@@ -81,19 +70,10 @@ export function AccountsBookmarkedGroupFilter(props) {
|
|
|
81
70
|
filterKey: SolrKeys.accountNumber,
|
|
82
71
|
values: selected.map((i) => ({ value: i.value, key: i.key })),
|
|
83
72
|
});
|
|
73
|
+
setInput('');
|
|
84
74
|
};
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
filterKey: SolrKeys.accountNumber,
|
|
88
|
-
values: [],
|
|
89
|
-
});
|
|
90
|
-
};
|
|
91
|
-
const onBookmarksFilter = (_, value) => {
|
|
92
|
-
if (!value)
|
|
93
|
-
return getBookmarksOptions(dropdownOptions);
|
|
94
|
-
const input = new RegExp(value, 'i');
|
|
95
|
-
const newOptions = dropdownOptions.filter((b) => input.test(b.value));
|
|
96
|
-
return getBookmarksOptions(newOptions);
|
|
75
|
+
const onTextInputChange = (value) => {
|
|
76
|
+
setInput(value);
|
|
97
77
|
};
|
|
98
78
|
if (!canReadBookmarkAccounts && !canAccessManagedAccounts) {
|
|
99
79
|
return null;
|
|
@@ -101,16 +81,36 @@ export function AccountsBookmarkedGroupFilter(props) {
|
|
|
101
81
|
/**
|
|
102
82
|
* Adding loading spinner since bookmarked accounts are getting loaded in the background for the globalMetadataState
|
|
103
83
|
*/
|
|
84
|
+
const getFilteredBookmarksOptions = (filterValue = '') => {
|
|
85
|
+
const regex = new RegExp(filterValue, 'i');
|
|
86
|
+
const filteredOptions = filterValue ? dropdownOptions.filter((b) => regex.test(b.value)) : dropdownOptions;
|
|
87
|
+
return [
|
|
88
|
+
...filteredOptions.map((b, id) => (React.createElement(SelectOption, { key: id, value: b, className: "pf-v6-c-select__menu-wrapper", role: "presentation" },
|
|
89
|
+
React.createElement("div", { className: "pf-v6-c-select__menu-item-main pf-v6-u-display-flex" },
|
|
90
|
+
React.createElement("div", { className: "pf-v6-c-select__menu-item-main" },
|
|
91
|
+
React.createElement("input", { className: "pf-v6-c-check__input pf-v6-u-mr-sm", type: "checkbox", checked: some(filterInfo[SolrKeys.accountNumber], b) }),
|
|
92
|
+
React.createElement("span", null, b.value)),
|
|
93
|
+
Array.isArray(b.key) && (React.createElement(Tooltip, { content: getInfoToolTip(b.value), "aria-label": t('Bookmarked Accounts List') },
|
|
94
|
+
React.createElement(Label, { color: "teal", className: "pf-v6-u-ml-auto pf-v6-u-mr-sm", icon: React.createElement(InfoCircleIcon, null), "aria-label": t('Bookmarked Accounts') }, b.key.length))))))),
|
|
95
|
+
...(canManageBookmarkAccounts ? [appendToMenu((bookmarkedGroupAccounts.data || []).length)] : []),
|
|
96
|
+
];
|
|
97
|
+
};
|
|
104
98
|
const bookmarkedAccountsOptions = [
|
|
105
99
|
...(bookmarkedGroupAccounts.isFetching
|
|
106
100
|
? [
|
|
107
|
-
React.createElement(SelectOption, { key: "loading-bookmarked-accounts", isDisabled: true },
|
|
101
|
+
React.createElement(SelectOption, { key: "loading-bookmarked-accounts", value: "loading-bookmarked-accounts", isDisabled: true },
|
|
108
102
|
React.createElement(LoadingIndicator, { size: "sm" })),
|
|
109
103
|
]
|
|
110
104
|
: []),
|
|
111
|
-
...
|
|
105
|
+
...getFilteredBookmarksOptions(input),
|
|
112
106
|
];
|
|
113
|
-
|
|
107
|
+
const toggle = (toggleRef) => (React.createElement(MenuToggle, { variant: "typeahead", onClick: onBookmarksToggle, innerRef: toggleRef, isExpanded: isOpen, isFullWidth: true },
|
|
108
|
+
React.createElement(TextInputGroup, { isPlain: true },
|
|
109
|
+
React.createElement(TextInputGroupMain, { value: input, onChange: (_, value) => onTextInputChange(value), onClick: (e) => {
|
|
110
|
+
e.stopPropagation();
|
|
111
|
+
setIsOpen(true);
|
|
112
|
+
}, autoComplete: "off", placeholder: getDropdownBtnPlaceholder(t(canAccessManagedAccounts ? 'Select an account' : 'Search for a bookmark'), canAccessManagedAccounts ? selectedAccounts : selectedBookmarks, '', dropdownOptions.length, canAccessManagedAccounts ? t('All accounts selected') : t('All bookmarks selected')), role: "combobox", isExpanded: isOpen, "aria-controls": "bookmark-account-select-listbox" }))));
|
|
113
|
+
return (React.createElement("div", { className: "pf-v6-c-select" },
|
|
114
114
|
React.createElement("label", { htmlFor: "case-list-account-filter", className: "case-list-account-filter-label" }, canAccessManagedAccounts ? t('Accounts') : t(filterNamesMap[SolrKeys.accountNumber])),
|
|
115
|
-
React.createElement(Select, {
|
|
115
|
+
React.createElement(Select, { toggle: toggle, onSelect: onBookmarksSelect, isOpen: isOpen, onOpenChange: (nextOpen) => setIsOpen(nextOpen), "data-tracking-id": "accounts-filter", id: "case-list-account-filter", isScrollable: true, popperProps: { direction: 'down', enableFlip: false }, shouldFocusFirstItemOnOpen: false }, bookmarkedAccountsOptions)));
|
|
116
116
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseListFilterChips.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/CaseListFilterChips.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAK1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAMtD,UAAU,MAAM;IACZ,yBAAyB,EAAE,uBAAuB,EAAE,CAAC;IACrD,gBAAgB,EAAE,OAAO,CAAC;CAC7B;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"CaseListFilterChips.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/CaseListFilterChips.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAK1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAMtD,UAAU,MAAM;IACZ,yBAAyB,EAAE,uBAAuB,EAAE,CAAC;IACrD,gBAAgB,EAAE,OAAO,CAAC;CAC7B;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,qBAmIhD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Button,
|
|
1
|
+
import { Button, Label, LabelGroup } from '@patternfly/react-core';
|
|
2
2
|
import { toNewCaseTypeMapper, toOldCaseTypeSwitcher } from '@rh-support/utils';
|
|
3
3
|
import flatMap from 'lodash/flatMap';
|
|
4
4
|
import remove from 'lodash/remove';
|
|
@@ -31,7 +31,7 @@ export function CaseListFilterChips(props) {
|
|
|
31
31
|
};
|
|
32
32
|
const renderFilterValueChips = (filterKey, filterValues, chipKeySuffix = '') => {
|
|
33
33
|
const filterChips = filterValues.map((chip, index) => {
|
|
34
|
-
return (React.createElement(
|
|
34
|
+
return (React.createElement(Label, { variant: "outline", key: `${filterKey}-${index}-${chipKeySuffix}`, onClose: deleteChip(filterKey, getChipKey(chip)) }, getChipValue(chip)));
|
|
35
35
|
});
|
|
36
36
|
return filterChips;
|
|
37
37
|
};
|
|
@@ -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(
|
|
47
|
+
React.createElement(LabelGroup, { numLabels: 7, className: "pf-v6-c-chip-group__simple" }, renderFilterValueChips(filterKey, caseTypeFilter, groupName))));
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
const renderAccountFilterChip = () => {
|
|
@@ -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,0BAIvB,CAAC;AAYF,eAAO,MAAM,eAAe;;;;;;;GAA6E,CAAC;AAE1G,eAAO,MAAM,kBAAkB,iEAyC9B,CAAC;AAEF,wBAAgB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"CreatorSsoNameFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/CreatorSsoNameFilter.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAYhF,eAAO,MAAM,WAAW,0BAIvB,CAAC;AAYF,eAAO,MAAM,eAAe;;;;;;;GAA6E,CAAC;AAE1G,eAAO,MAAM,kBAAkB,iEAyC9B,CAAC;AAEF,wBAAgB,oBAAoB,sBA6PnC"}
|
|
@@ -180,16 +180,16 @@ export function CreatorSsoNameFilter() {
|
|
|
180
180
|
return [
|
|
181
181
|
...(noResults && !isExternalNonOrgAdmin
|
|
182
182
|
? [
|
|
183
|
-
React.createElement("div", { key: "no-results", className: "pf-
|
|
183
|
+
React.createElement("div", { key: "no-results", className: "pf-v6-u-p-sm" },
|
|
184
184
|
React.createElement(Trans, null, "No results found")),
|
|
185
185
|
]
|
|
186
186
|
: []),
|
|
187
187
|
...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))),
|
|
188
188
|
...(!isEmpty(filteredOptions)
|
|
189
189
|
? [
|
|
190
|
-
React.createElement("div", { className: "pf-
|
|
190
|
+
React.createElement("div", { className: "pf-v6-c-divider", role: "separator", key: "separator" }),
|
|
191
191
|
React.createElement(SelectGroup, { key: "created-or-owned-by-accounts-group" },
|
|
192
|
-
React.createElement("h6", { className: "pf-
|
|
192
|
+
React.createElement("h6", { className: "pf-v6-u-pl-md" },
|
|
193
193
|
React.createElement(Trans, null, "Created or owned by")),
|
|
194
194
|
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) },
|
|
195
195
|
React.createElement(Truncate, { content: contact.label }))))),
|
|
@@ -210,7 +210,7 @@ export function CreatorSsoNameFilter() {
|
|
|
210
210
|
React.createElement(TextInputGroupMain, { value: externalQuery, onClick: onExternalToggle, onKeyDown: onInputKeyDown, placeholder: isExternalNonOrgAdmin
|
|
211
211
|
? t('Username')
|
|
212
212
|
: getDropdownBtnPlaceholder(t('Search for a name'), selectedExternalContacts.map((i) => i.label), ' ', filteredOptions.length + dropdownHeader.length, t('All selected')), onChange: onExternalQueryChange, isExpanded: isExternalOpen, innerRef: externalInputRef, "aria-controls": "external-ssousername-filter", role: "combobox" }),
|
|
213
|
-
React.createElement(TextInputGroupUtilities, null, !isEmpty(externalQuery) && (React.createElement(Button, {
|
|
213
|
+
React.createElement(TextInputGroupUtilities, null, !isEmpty(externalQuery) && (React.createElement(Button, { icon: isFetchingExternalContacts ? (React.createElement(LoadingIndicator, { show: true, size: "sm" })) : (React.createElement(TimesCircleIcon, { "aria-hidden": true })), variant: "plain", onClick: () => setExternalQuery(''), isDisabled: isFetchingExternalContacts, "aria-label": t('Clear') }))))));
|
|
214
214
|
const customToggle = (toggleRef) => (React.createElement(MenuToggle, { ref: toggleRef, onClick: onExternalToggle, isExpanded: isExternalOpen, style: { width: '100%' } }, getDropdownBtnPlaceholder(t('Username'), selectedExternalContacts.map((i) => i.label), ' ', dropdownHeader.length, t('All selected'))));
|
|
215
215
|
return (React.createElement("div", null,
|
|
216
216
|
React.createElement("label", { htmlFor: "case-list-username-filter", className: "case-list-username-filter-label" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreatorSsoNameFilterChip.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/CreatorSsoNameFilterChip.tsx"],"names":[],"mappings":"AAKA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAU/D,wBAAgB,wBAAwB,
|
|
1
|
+
{"version":3,"file":"CreatorSsoNameFilterChip.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/CreatorSsoNameFilterChip.tsx"],"names":[],"mappings":"AAKA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAU/D,wBAAgB,wBAAwB,sBAuIvC"}
|
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { contacts } from '@cee-eng/hydrajs';
|
|
11
|
-
import {
|
|
11
|
+
import { Label, LabelGroup } from '@patternfly/react-core';
|
|
12
12
|
import { useFetch } from '@rh-support/components';
|
|
13
13
|
import { GlobalMetadataStateContext } from '@rh-support/react-context';
|
|
14
14
|
import uniq from 'lodash/uniq';
|
|
@@ -103,14 +103,14 @@ 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(
|
|
106
|
+
React.createElement(LabelGroup, { numLabels: 7, className: "pf-v6-c-chip-group" },
|
|
107
107
|
own &&
|
|
108
108
|
filterInfo &&
|
|
109
109
|
filterInfo[SolrKeys.createdBySsoUsername] &&
|
|
110
|
-
filterInfo[SolrKeys.createdBySsoUsername].indexOf(own) !== -1 && (React.createElement(
|
|
110
|
+
filterInfo[SolrKeys.createdBySsoUsername].indexOf(own) !== -1 && (React.createElement(Label, { variant: "outline", key: 'sso-name-creator-filter-chip-key-own', onClose: deleteChipCreatorOwn }, t(filterNamesMap[SolrKeys.createdBySsoUsername]))),
|
|
111
111
|
own &&
|
|
112
112
|
filterInfo &&
|
|
113
113
|
filterInfo[SolrKeys.caseContactSSO] &&
|
|
114
|
-
filterInfo[SolrKeys.caseContactSSO].indexOf(own) !== -1 && (React.createElement(
|
|
115
|
-
chips.map((item, i) => (React.createElement(
|
|
114
|
+
filterInfo[SolrKeys.caseContactSSO].indexOf(own) !== -1 && (React.createElement(Label, { variant: "outline", key: 'sso-name-contact-filter-chip-key-own', onClose: deleteChipContactOwn }, t(filterNamesMap[SolrKeys.caseContactSSO]))),
|
|
115
|
+
chips.map((item, i) => (React.createElement(Label, { variant: "outline", key: 'sso-name-creator-filter-chip-key' + i, onClose: deleteChip(item.value) }, item.label))))));
|
|
116
116
|
}
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,sBA8P3B"}
|
|
@@ -122,8 +122,7 @@ export function GroupsFilter() {
|
|
|
122
122
|
React.createElement(TextInputGroup, { isPlain: true },
|
|
123
123
|
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" })),
|
|
124
124
|
Object.keys(selectedItems).filter((key) => selectedItems[key] === true).length ? (React.createElement(TextInputGroupUtilities, null,
|
|
125
|
-
React.createElement(Button, { variant: "plain", onClick: onClick, "aria-label": "Clear input value" }
|
|
126
|
-
React.createElement(TimesIcon, { "aria-hidden": true })))) : (''))));
|
|
125
|
+
React.createElement(Button, { icon: React.createElement(TimesIcon, { "aria-hidden": true }), variant: "plain", onClick: onClick, "aria-label": "Clear input value" }))) : (''))));
|
|
127
126
|
const dropdownOptions = useMemo(() => {
|
|
128
127
|
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)));
|
|
129
128
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -162,13 +161,13 @@ export function GroupsFilter() {
|
|
|
162
161
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
163
162
|
}, [filterInfo[SolrKeys.group]]);
|
|
164
163
|
return (React.createElement("div", { className: "group-filter" },
|
|
165
|
-
React.createElement("label", { htmlFor: "case-list-group-filter", className: "pf-
|
|
166
|
-
React.createElement("div", { className: "pf-
|
|
164
|
+
React.createElement("label", { htmlFor: "case-list-group-filter", className: "pf-v6-u-mb-sm group-filter-label" }, t(filterNamesMap[SolrKeys.group])),
|
|
165
|
+
React.createElement("div", { className: "pf-v6-c-select" },
|
|
167
166
|
React.createElement(Select, { role: "menu", "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 },
|
|
168
167
|
React.createElement(SelectList, null, dropdownOptions),
|
|
169
168
|
canViewCaseGroups && (React.createElement(React.Fragment, null,
|
|
170
169
|
React.createElement(Divider, { className: "case-group-filter" }),
|
|
171
170
|
React.createElement(SelectList, null,
|
|
172
|
-
React.createElement(Link, { className: "cta cta-link pf-
|
|
171
|
+
React.createElement(Link, { className: "cta cta-link pf-v6-c-select__menu-item", to: "/manage/groups" },
|
|
173
172
|
React.createElement(Trans, null, "Manage groups")))))))));
|
|
174
173
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalSsoNameFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/InternalSsoNameFilter.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAUhF,MAAM,CAAC,OAAO,UAAU,qBAAqB,
|
|
1
|
+
{"version":3,"file":"InternalSsoNameFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/InternalSsoNameFilter.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAUhF,MAAM,CAAC,OAAO,UAAU,qBAAqB,sBAgS5C"}
|
|
@@ -149,29 +149,29 @@ export default function InternalSsoNameFilter() {
|
|
|
149
149
|
return [
|
|
150
150
|
...(isFetchingInternalContacts
|
|
151
151
|
? [
|
|
152
|
-
React.createElement("div", { key: "searching", className: "pf-
|
|
152
|
+
React.createElement("div", { key: "searching", className: "pf-v6-u-p-sm" },
|
|
153
153
|
React.createElement(Trans, null, "Searching...")),
|
|
154
154
|
]
|
|
155
155
|
: []),
|
|
156
156
|
...(noResults && !isFetchingInternalContacts
|
|
157
157
|
? [
|
|
158
|
-
React.createElement("div", { key: "no-results", className: "pf-
|
|
158
|
+
React.createElement("div", { key: "no-results", className: "pf-v6-u-p-sm" },
|
|
159
159
|
React.createElement(Trans, null, "No results found")),
|
|
160
160
|
]
|
|
161
161
|
: []),
|
|
162
162
|
...dropdownHeader.map((contact, index) => (React.createElement(SelectOption, { key: contact.value, isFocused: focusedItemIndex === index, value: contact, hasCheckbox: true, isSelected: selectedInternalContacts.some((c) => c.value === contact.value) }, contact.label))),
|
|
163
163
|
...(!isEmpty(filteredOptions)
|
|
164
164
|
? [
|
|
165
|
-
React.createElement("div", { className: "pf-
|
|
165
|
+
React.createElement("div", { className: "pf-v6-c-divider", role: "separator" }),
|
|
166
166
|
React.createElement(SelectGroup, null,
|
|
167
|
-
React.createElement("h6", { className: "pf-
|
|
167
|
+
React.createElement("h6", { className: "pf-v6-u-pl-md" },
|
|
168
168
|
React.createElement(Trans, null, "Created or owned by")),
|
|
169
169
|
filteredOptions.map((contact, index) => (React.createElement(SelectOption, { key: contact.value, isFocused: focusedItemIndex === index + dropdownHeader.length, value: contact, hasCheckbox: true, isSelected: selectedInternalContacts.some((c) => c.value === contact.value) }, contact.label)))),
|
|
170
170
|
]
|
|
171
171
|
: []),
|
|
172
172
|
...(renderedList.length < internalContactList.length
|
|
173
173
|
? [
|
|
174
|
-
React.createElement("div", { className: "pf-
|
|
174
|
+
React.createElement("div", { className: "pf-v6-c-divider", role: "separator" }),
|
|
175
175
|
React.createElement(SelectOption, { key: "show-more", value: 'show-more', onClick: onDisplayMoreClick },
|
|
176
176
|
React.createElement(Flex, { justifyContent: { default: 'justifyContentCenter' } },
|
|
177
177
|
React.createElement(FlexItem, null,
|
|
@@ -201,7 +201,7 @@ export default function InternalSsoNameFilter() {
|
|
|
201
201
|
const internalToggle = (toggleRef) => (React.createElement(MenuToggle, { variant: "typeahead", onClick: onInternalToggle, innerRef: toggleRef, isExpanded: isInternalOpen, isFullWidth: true },
|
|
202
202
|
React.createElement(TextInputGroup, { isPlain: true },
|
|
203
203
|
React.createElement(TextInputGroupMain, { value: internalQuery, onClick: onInternalToggle, onKeyDown: onInputKeyDown, placeholder: getDropdownBtnPlaceholder(t('Search for a name'), selectedInternalContacts.map((i) => i.label), ' ', filteredInternalList.length, t('All selected')), onChange: onInternalQueryChange, isExpanded: isInternalOpen, innerRef: internalInputRef, "aria-controls": "internal-ssousername-filter", role: "combobox" }),
|
|
204
|
-
React.createElement(TextInputGroupUtilities, null, !isEmpty(internalQuery) && (React.createElement(Button, {
|
|
204
|
+
React.createElement(TextInputGroupUtilities, null, !isEmpty(internalQuery) && (React.createElement(Button, { icon: isFetchingInternalContacts ? (React.createElement(LoadingIndicator, { show: true, size: "sm" })) : (React.createElement(TimesCircleIcon, { "aria-hidden": true })), variant: "plain", onClick: () => setInternalQuery(''), isDisabled: isFetchingInternalContacts, "aria-label": t('Clear') }))))));
|
|
205
205
|
return (React.createElement(Select, { id: "internal-ssousername-filter", "data-tracking-id": "internal-ssousername-filter", isOpen: isInternalOpen, onOpenChange: () => setIsInternalOpen(false), toggle: internalToggle, popperProps: { direction: 'down', enableFlip: false }, isScrollable: true, onSelect: (_e, v) => onSelectInternal(v) },
|
|
206
206
|
React.createElement(SelectList, null, filteredInternalList)));
|
|
207
207
|
}
|
|
@@ -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,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,
|
|
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,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,qBAuElF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Button, ButtonVariant,
|
|
1
|
+
import { Button, ButtonVariant, Label, LabelGroup } from '@patternfly/react-core';
|
|
2
2
|
import TimesCircleIcon from '@patternfly/react-icons/dist/js/icons/times-circle-icon';
|
|
3
3
|
import { ability, CaseListFields, resourceActions, resources } from '@rh-support/user-permissions';
|
|
4
4
|
import React, { useContext } from 'react';
|
|
@@ -27,9 +27,8 @@ export function ProductFilterChip({ productList, productVersionPivot = [] }) {
|
|
|
27
27
|
return (React.createElement("div", { className: "filter-chip" },
|
|
28
28
|
React.createElement("span", { className: "filter-chip__heading" },
|
|
29
29
|
React.createElement(Trans, null, filterNamesMap[SolrKeys.product])),
|
|
30
|
-
canAccessVersionsFilter ? (React.createElement(React.Fragment, null, productList.map((currentProduct, index) => (React.createElement(
|
|
30
|
+
canAccessVersionsFilter ? (React.createElement(React.Fragment, null, productList.map((currentProduct, index) => (React.createElement(LabelGroup, { numLabels: 10, key: `${currentProduct.value}-${index}`, categoryName: currentProduct.value },
|
|
31
31
|
React.createElement(VersionsFilter, { productInfo: currentProduct, productVersionPivot: productVersionPivot }),
|
|
32
|
-
currentProduct[SolrKeys.version].map((chip) => (React.createElement(
|
|
33
|
-
React.createElement(Button, { className: "pf-
|
|
34
|
-
React.createElement(TimesCircleIcon, { "aria-hidden": "true" }))))))) : (React.createElement(ChipGroup, { numChips: 10, categoryName: "Product", key: "products" }, productList.map((currentProduct, index) => (React.createElement(Chip, { key: `${currentProduct.value}-${index}`, onClick: () => deleteProduct(currentProduct) }, currentProduct.value)))))));
|
|
32
|
+
currentProduct[SolrKeys.version].map((chip) => (React.createElement(Label, { variant: "outline", key: chip.value, onClose: () => deleteVersion(currentProduct, chip) }, chip.value))),
|
|
33
|
+
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)))))));
|
|
35
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductsFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/ProductsFilter.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ProductsFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/ProductsFilter.tsx"],"names":[],"mappings":"AAaA,OAAO,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,qBA8P3C"}
|
|
@@ -1,20 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { Button, MenuToggle, Select, SelectList, SelectOption, TextInputGroup, TextInputGroupMain, TextInputGroupUtilities, } from '@patternfly/react-core';
|
|
2
|
+
import TimesIcon from '@patternfly/react-icons/dist/js/icons/times-icon';
|
|
3
|
+
import { SingleSelectDropdown, useSelectKeyboardNavigator } from '@rh-support/components';
|
|
3
4
|
import { getDropdownBtnPlaceholder } from '@rh-support/utils';
|
|
5
|
+
import isEmpty from 'lodash/isEmpty';
|
|
4
6
|
import isUndefined from 'lodash/isUndefined';
|
|
5
|
-
import React, { useContext, useState } from 'react';
|
|
7
|
+
import React, { useContext, useEffect, useRef, useState } from 'react';
|
|
6
8
|
import { useTranslation } from 'react-i18next';
|
|
7
9
|
import { SolrKeys, SolrPivotKeys } from '../../../enums/filters';
|
|
8
10
|
import { filterNamesMap } from '../../../utils/constants';
|
|
9
11
|
import { CaseListFilterDispatchContext, CaseListFilterStateContext } from '../CaseListFilterContext';
|
|
10
12
|
import { updateFilter } from '../CaseListFilterReducer';
|
|
11
13
|
export function ProductsFilter(props) {
|
|
14
|
+
var _a, _b, _c, _d, _f;
|
|
12
15
|
const { t } = useTranslation();
|
|
13
16
|
const dispatch = useContext(CaseListFilterDispatchContext);
|
|
14
17
|
const { filterInfo } = useContext(CaseListFilterStateContext);
|
|
15
18
|
const { allProducts, filterValues, isSolrSearchDown } = props;
|
|
16
19
|
const [isOpen, setIsOpen] = useState(false);
|
|
17
|
-
const
|
|
20
|
+
const [selectedItems, setSelectedItems] = useState({});
|
|
21
|
+
const [activeItem, setActiveItem] = useState(null);
|
|
22
|
+
const [inputValue, setInputValue] = useState('');
|
|
23
|
+
const textInputRef = useRef();
|
|
18
24
|
const selectedProducts = !isUndefined(filterInfo) && !isUndefined(filterInfo[SolrPivotKeys.product_version])
|
|
19
25
|
? filterInfo[SolrPivotKeys.product_version]
|
|
20
26
|
: [];
|
|
@@ -23,49 +29,135 @@ export function ProductsFilter(props) {
|
|
|
23
29
|
value: product.value,
|
|
24
30
|
[SolrKeys.version]: [],
|
|
25
31
|
}));
|
|
26
|
-
const
|
|
32
|
+
const singleSelectOptions = allProducts.length > 0
|
|
33
|
+
? allProducts.map((product) => ({
|
|
34
|
+
value: product,
|
|
35
|
+
label: product,
|
|
36
|
+
}))
|
|
37
|
+
: [{ value: '', label: t('No products available') }];
|
|
38
|
+
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) || '';
|
|
39
|
+
const selectedOption = {
|
|
40
|
+
value: selectedProduct,
|
|
41
|
+
label: selectedProduct,
|
|
42
|
+
};
|
|
43
|
+
// Single select mode for when Solr is down
|
|
44
|
+
const onFilterChangeSingleSelect = (selection) => {
|
|
27
45
|
updateFilter(dispatch, {
|
|
28
46
|
filterKey: SolrPivotKeys.product_version,
|
|
29
|
-
values: [{ field: SolrKeys.product, value:
|
|
47
|
+
values: [{ field: SolrKeys.product, value: selection.value, [SolrKeys.version]: [] }],
|
|
30
48
|
});
|
|
31
49
|
setIsOpen(false);
|
|
32
50
|
};
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
51
|
+
const onSingleSelectChange = (option) => {
|
|
52
|
+
// Don't update filter if no products are available
|
|
53
|
+
if (allProducts.length === 0 || option.value === '') {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
updateFilter(dispatch, {
|
|
57
|
+
filterKey: SolrPivotKeys.product_version,
|
|
58
|
+
values: [{ field: SolrKeys.product, value: option.value, [SolrKeys.version]: [] }],
|
|
59
|
+
});
|
|
39
60
|
};
|
|
40
|
-
|
|
61
|
+
// Multi-select mode
|
|
62
|
+
const onSelect = (option) => {
|
|
41
63
|
let newSelectedProducts = [];
|
|
42
|
-
if (selectedProducts === null || selectedProducts === void 0 ? void 0 : selectedProducts.some((product) =>
|
|
43
|
-
newSelectedProducts = selectedProducts.filter((product) =>
|
|
64
|
+
if (selectedProducts === null || selectedProducts === void 0 ? void 0 : selectedProducts.some((product) => option.value === product.value)) {
|
|
65
|
+
newSelectedProducts = selectedProducts.filter((product) => option.value !== product.value);
|
|
66
|
+
setSelectedItems((prevData) => (Object.assign(Object.assign({}, prevData), { [option.value]: false })));
|
|
44
67
|
}
|
|
45
68
|
else {
|
|
46
69
|
newSelectedProducts = [
|
|
47
70
|
...selectedProducts,
|
|
48
|
-
{ field: SolrKeys.product, value:
|
|
71
|
+
{ field: SolrKeys.product, value: option.value, [SolrKeys.version]: [] },
|
|
49
72
|
];
|
|
73
|
+
setSelectedItems((prevData) => (Object.assign(Object.assign({}, prevData), { [option.value]: true })));
|
|
50
74
|
}
|
|
51
|
-
updateFilter(dispatch, {
|
|
75
|
+
updateFilter(dispatch, {
|
|
76
|
+
filterKey: SolrPivotKeys.product_version,
|
|
77
|
+
values: newSelectedProducts,
|
|
78
|
+
});
|
|
52
79
|
};
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
React.createElement(Checkbox, { id: "product-option-check", checked: selectedProducts === null || selectedProducts === void 0 ? void 0 : selectedProducts.some((product) => p.value === product.value) })),
|
|
57
|
-
React.createElement("span", null, p.value))));
|
|
80
|
+
const onToggleClick = (e) => {
|
|
81
|
+
e.stopPropagation();
|
|
82
|
+
setIsOpen(!isOpen);
|
|
58
83
|
};
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
84
|
+
const onClick = () => {
|
|
85
|
+
var _a;
|
|
86
|
+
setInputValue('');
|
|
87
|
+
(_a = textInputRef === null || textInputRef === void 0 ? void 0 : textInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
88
|
+
};
|
|
89
|
+
const getFilteredOptions = () => {
|
|
90
|
+
if (!inputValue)
|
|
91
|
+
return productOptions;
|
|
92
|
+
const formattedValue = inputValue === null || inputValue === void 0 ? void 0 : inputValue.replace(/\\/g, ''); // Removes '\' from search query as it creates SyntaxError for RegEx
|
|
63
93
|
const input = new RegExp(formattedValue, 'i');
|
|
64
|
-
|
|
65
|
-
|
|
94
|
+
return productOptions.filter((product) => input.test(product.value));
|
|
95
|
+
};
|
|
96
|
+
// Integrate the keyboard navigator hook
|
|
97
|
+
const { focusedItemIndex, onInputKeyDown, setFocusedItemIndex } = useSelectKeyboardNavigator({
|
|
98
|
+
list: getFilteredOptions(),
|
|
99
|
+
isOpen,
|
|
100
|
+
resetIndexOnClose: true,
|
|
101
|
+
isDisabled: false,
|
|
102
|
+
setIsOpen,
|
|
103
|
+
onSelect: (item) => {
|
|
104
|
+
if (isSolrSearchDown) {
|
|
105
|
+
onFilterChangeSingleSelect(item);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
onSelect(item);
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
const onTextInputChange = (_event, value) => {
|
|
113
|
+
setInputValue(value);
|
|
114
|
+
};
|
|
115
|
+
const placeholder = isSolrSearchDown
|
|
116
|
+
? ((_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')
|
|
117
|
+
: 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'));
|
|
118
|
+
const toggleForMultiSelect = (toggleRef) => (React.createElement(MenuToggle, { variant: "typeahead", onClick: onToggleClick, innerRef: toggleRef, isExpanded: isOpen, isFullWidth: true },
|
|
119
|
+
React.createElement(TextInputGroup, { isPlain: true },
|
|
120
|
+
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" })),
|
|
121
|
+
Object.keys(selectedItems).filter((key) => selectedItems[key] === true).length > 0 && (React.createElement(TextInputGroupUtilities, null,
|
|
122
|
+
React.createElement(Button, { icon: React.createElement(TimesIcon, { "aria-hidden": true }), variant: "plain", onClick: onClick, "aria-label": "Clear input value" }))))));
|
|
123
|
+
useEffect(() => {
|
|
124
|
+
let newSelectOptions = productOptions;
|
|
125
|
+
if (inputValue) {
|
|
126
|
+
newSelectOptions = getFilteredOptions();
|
|
127
|
+
if (!newSelectOptions.length) {
|
|
128
|
+
// @ts-ignore
|
|
129
|
+
newSelectOptions = [{ isDisabled: false, children: `No results found` }];
|
|
130
|
+
}
|
|
131
|
+
if (!isOpen) {
|
|
132
|
+
setIsOpen(true);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
setFocusedItemIndex(-1);
|
|
136
|
+
setActiveItem(null);
|
|
137
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
138
|
+
}, [inputValue]);
|
|
139
|
+
useEffect(() => {
|
|
140
|
+
var _a;
|
|
141
|
+
if (isSolrSearchDown) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (isEmpty(filterInfo === null || filterInfo === void 0 ? void 0 : filterInfo[SolrPivotKeys.product_version])) {
|
|
145
|
+
setSelectedItems({});
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
const selectedProductItems = (_a = filterInfo === null || filterInfo === void 0 ? void 0 : filterInfo[SolrPivotKeys.product_version]) === null || _a === void 0 ? void 0 : _a.reduce((selection, product) => {
|
|
149
|
+
selection[product.value] = true;
|
|
150
|
+
return selection;
|
|
151
|
+
}, {});
|
|
152
|
+
setSelectedItems(selectedProductItems || {});
|
|
153
|
+
}
|
|
154
|
+
}, [filterInfo, isSolrSearchDown]);
|
|
155
|
+
const renderOptions = () => {
|
|
156
|
+
const filteredOptions = getFilteredOptions();
|
|
157
|
+
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)));
|
|
66
158
|
};
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
React.createElement(
|
|
70
|
-
|
|
159
|
+
return (React.createElement("div", { className: "product-filter" },
|
|
160
|
+
React.createElement("label", { htmlFor: "case-list-products-filter", className: "pf-v6-u-mb-sm products-filter-label" }, t(filterNamesMap[SolrKeys.product])),
|
|
161
|
+
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, { 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 } },
|
|
162
|
+
React.createElement(SelectList, null, renderOptions())))));
|
|
71
163
|
}
|