@rh-support/react-context 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.
- package/README.md +0 -2
- package/lib/esm/components/AccountSelector/AccountSelectorInternal.d.ts.map +1 -1
- package/lib/esm/components/AccountSelector/AccountSelectorInternal.js +161 -93
- package/lib/esm/components/EmbeddedServiceChat/EmbeddedServiceChat.js +4 -4
- package/lib/esm/components/HostnameAwarenessModal/HostnameAwarenessModal.js +2 -2
- package/lib/esm/components/HostnameAwarenessModal/hostnameAwarenessModal.css +1 -1
- package/lib/esm/components/NewFeatureAnnouncement/NewFeatureLabel.js +1 -1
- package/lib/esm/components/SharedModals/CloseCaseModal.d.ts.map +1 -1
- package/lib/esm/components/SharedModals/CloseCaseModal.js +12 -6
- package/lib/esm/components/SharedModals/CloseCaseModal.scss +6 -6
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountSelectorInternal.d.ts","sourceRoot":"","sources":["../../../../src/components/AccountSelector/AccountSelectorInternal.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;
|
|
1
|
+
{"version":3,"file":"AccountSelectorInternal.d.ts","sourceRoot":"","sources":["../../../../src/components/AccountSelector/AccountSelectorInternal.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAgBhF,OAAO,EAAE,kBAAkB,EAA8B,MAAM,wBAAwB,CAAC;AAOxF,UAAU,MAAO,SAAQ,kBAAkB,CAAC,QAAQ,CAAC;IACjD,gBAAgB,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC9B,eAAe,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC7B,kBAAkB,CAAC,EAAE,QAAQ,EAAE,CAAC;IAChC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,GAAG,CAAC;IACzC,iBAAiB,CAAC,EAAE,kBAAkB,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6BAA6B,CAAC,EAAE,OAAO,CAAC;CAC3C;AAkCD,iBAAS,uBAAuB,CAAC,KAAK,EAAE,MAAM,eAiR7C;kBAjRQ,uBAAuB;;;AAoRhC,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -8,13 +8,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { accounts } from '@cee-eng/hydrajs';
|
|
11
|
+
import { Button, Flex, FlexItem, MenuToggle, Select, SelectList, SelectOption, TextInputGroup, TextInputGroupMain, TextInputGroupUtilities, } from '@patternfly/react-core';
|
|
11
12
|
import InfoCircleIcon from '@patternfly/react-icons/dist/js/icons/info-circle-icon';
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
13
|
+
import TimesCircleIcon from '@patternfly/react-icons/dist/js/icons/times-circle-icon';
|
|
14
|
+
import { LoadingIndicator, useFetch } from '@rh-support/components';
|
|
15
|
+
import { isUndefined } from 'lodash';
|
|
15
16
|
import isEmpty from 'lodash/isEmpty';
|
|
16
17
|
import uniqBy from 'lodash/uniqBy';
|
|
17
|
-
import React, { useEffect, useMemo, useState } from 'react';
|
|
18
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
18
19
|
import { Trans, useTranslation } from 'react-i18next';
|
|
19
20
|
const defaultProps = {
|
|
20
21
|
id: '',
|
|
@@ -36,50 +37,79 @@ const defaultProps = {
|
|
|
36
37
|
isInValid: false,
|
|
37
38
|
restrictedOnSubscriptionAbuse: false,
|
|
38
39
|
};
|
|
40
|
+
const getDisplayName = (account) => {
|
|
41
|
+
if (!account) {
|
|
42
|
+
return '';
|
|
43
|
+
}
|
|
44
|
+
return account.accountNumber
|
|
45
|
+
? account.name
|
|
46
|
+
? `${account.name} (${account.accountNumber})`
|
|
47
|
+
: account.accountNumber
|
|
48
|
+
: '';
|
|
49
|
+
};
|
|
39
50
|
function AccountSelectorInternal(props) {
|
|
40
51
|
const { request, isFetching } = useFetch(accounts.getAccounts, { isAbortable: true });
|
|
41
52
|
const [items, setItems] = useState([]);
|
|
42
53
|
const [selectedItems, setSelectedItems] = useState([]);
|
|
54
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
55
|
+
const [query, setQuery] = useState('');
|
|
56
|
+
const [focusedItemIndex, setFocusedItemIndex] = useState(null);
|
|
57
|
+
const abortControllerRef = useRef(undefined);
|
|
58
|
+
const textInputRef = useRef();
|
|
59
|
+
const inputGroupRef = useRef();
|
|
43
60
|
const { t } = useTranslation();
|
|
44
61
|
const bookmarkedAccountsDeduped = uniqBy(props.bookmarkedAccounts, (b) => b.accountNumber);
|
|
62
|
+
const pageSize = 20;
|
|
63
|
+
const [resultSize, setResultSize] = useState(pageSize);
|
|
64
|
+
const itemsToRender = useMemo(() => (isEmpty(items) ? bookmarkedAccountsDeduped : items.slice(0, props.paginate ? resultSize : items.length)), [items, bookmarkedAccountsDeduped, props.paginate, resultSize]);
|
|
45
65
|
useEffect(() => {
|
|
46
66
|
if (!props.multiple) {
|
|
47
67
|
const selectedItem = (props.selectedAccounts || [])[0];
|
|
48
|
-
selectedItem && selectedItem.accountNumber && setSelectedItems(props.selectedAccounts);
|
|
68
|
+
selectedItem && selectedItem.accountNumber && setSelectedItems(props.selectedAccounts || []);
|
|
49
69
|
}
|
|
50
70
|
else {
|
|
51
|
-
setSelectedItems(props.selectedAccounts);
|
|
71
|
+
setSelectedItems(props.selectedAccounts || []);
|
|
52
72
|
}
|
|
53
73
|
}, [props.selectedAccounts, props.multiple]);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
: '';
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
const item = !isEmpty(selectedItems) && !props.multiple ? selectedItems[0] : {};
|
|
76
|
+
setQuery(getDisplayName(item));
|
|
77
|
+
}, [selectedItems, props.multiple]);
|
|
78
|
+
const onDisplayMoreClick = (e) => {
|
|
79
|
+
e.stopPropagation();
|
|
80
|
+
setResultSize((pre) => Math.min(pre + pageSize, items.length));
|
|
81
|
+
setIsOpen(true);
|
|
63
82
|
};
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return accounts
|
|
69
|
-
.filter((account) => !!account && !props.excludeAccounts.find(({ accountId }) => accountId === account.accountId))
|
|
70
|
-
.map((account) => assign({
|
|
71
|
-
children: (React.createElement(React.Fragment, null, props.restrictedOnSubscriptionAbuse && account.subscriptionAbuse ? (React.createElement("span", { className: "form-instructions form-invalid" }, getDisplayName(account))) : (getDisplayName(account)))),
|
|
72
|
-
actionItem: (React.createElement(React.Fragment, null, props.restrictedOnSubscriptionAbuse && account.subscriptionAbuse && (React.createElement("span", { className: "form-instructions form-invalid pf-u-text-nowrap pf-u-pr-sm" },
|
|
73
|
-
' ',
|
|
83
|
+
const dropdownOptions = useMemo(() => [
|
|
84
|
+
...itemsToRender.map((item, index) => (React.createElement(SelectOption, { isFocused: focusedItemIndex === index, key: index, value: item, hasCheckbox: props.multiple, isSelected: selectedItems.some((account) => item.accountNumber === account.accountNumber) }, props.restrictedOnSubscriptionAbuse && item.subscriptionAbuse ? (React.createElement(Flex, { justifyContent: { default: 'justifyContentSpaceBetween' } },
|
|
85
|
+
React.createElement(FlexItem, { className: "form-instructions form-invalid" }, getDisplayName(item)),
|
|
86
|
+
React.createElement(FlexItem, { className: "form-instructions form-invalid pf-v5-u-text-nowrap pf-v5-u-pr-sm" },
|
|
74
87
|
React.createElement(InfoCircleIcon, null),
|
|
75
88
|
" ",
|
|
76
|
-
React.createElement(Trans, null, "Subscription abuse"))))),
|
|
77
|
-
|
|
78
|
-
|
|
89
|
+
React.createElement(Trans, null, "Subscription abuse")))) : (React.createElement("span", null, getDisplayName(item)))))),
|
|
90
|
+
...(resultSize < items.length
|
|
91
|
+
? [
|
|
92
|
+
React.createElement("div", { className: "pf-v5-c-divider", role: "separator", key: "separator" }),
|
|
93
|
+
React.createElement(SelectOption, { key: 'diplay-more-option', onClick: onDisplayMoreClick, value: 'display-more' },
|
|
94
|
+
React.createElement(Flex, { justifyContent: { default: 'justifyContentCenter' } },
|
|
95
|
+
React.createElement(FlexItem, { className: '"pf-v5-c-button pf-m-link pf-m-inline' },
|
|
96
|
+
React.createElement(Trans, null, "Display additional results")))),
|
|
97
|
+
]
|
|
98
|
+
: []),
|
|
99
|
+
],
|
|
100
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
101
|
+
[items, bookmarkedAccountsDeduped]);
|
|
79
102
|
const fetchAccounts = (query) => __awaiter(this, void 0, void 0, function* () {
|
|
80
|
-
if (query
|
|
103
|
+
if (isEmpty(query)) {
|
|
81
104
|
return;
|
|
82
105
|
}
|
|
106
|
+
if (abortControllerRef.current !== undefined) {
|
|
107
|
+
// Cancel the previous request
|
|
108
|
+
abortControllerRef.current.abort();
|
|
109
|
+
}
|
|
110
|
+
// recreate a new AbortController for each call
|
|
111
|
+
let controller = new AbortController();
|
|
112
|
+
abortControllerRef.current = controller;
|
|
83
113
|
const fields = ['accountNumber', 'accountId', 'name', 'subscriptionAbuse'].join(',');
|
|
84
114
|
// Initialize Params
|
|
85
115
|
let params = {
|
|
@@ -94,79 +124,117 @@ function AccountSelectorInternal(props) {
|
|
|
94
124
|
else {
|
|
95
125
|
params.accountNumberLike = query;
|
|
96
126
|
}
|
|
97
|
-
const queryParams =
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const response = yield request(queryParams);
|
|
101
|
-
const options = response && response.items && response.items.length ? getDropdownOptions(response.items) : [];
|
|
127
|
+
const queryParams = params;
|
|
128
|
+
const response = request && (yield request(queryParams, controller.signal));
|
|
129
|
+
const options = response && response.items && response.items.length ? response.items : [];
|
|
102
130
|
setItems(options);
|
|
103
|
-
// setIsLoading(false);
|
|
104
131
|
});
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
132
|
+
const onOuterClick = () => {
|
|
133
|
+
setSelectedItems(props.selectedAccounts || []);
|
|
134
|
+
};
|
|
135
|
+
useEffect(() => {
|
|
136
|
+
const handleClickOutside = (event) => {
|
|
137
|
+
if (inputGroupRef.current && !inputGroupRef.current.contains(event.target)) {
|
|
138
|
+
onOuterClick();
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
142
|
+
return () => {
|
|
143
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
111
144
|
};
|
|
112
|
-
|
|
113
|
-
|
|
145
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
146
|
+
}, [selectedItems, props.selectedAccounts]);
|
|
147
|
+
const onMultiAccountSelection = (selection) => {
|
|
148
|
+
let list = [];
|
|
149
|
+
if (selectedItems.some((item) => item.accountNumber === selection.accountNumber)) {
|
|
150
|
+
list = selectedItems.filter((item) => item.accountNumber !== selection.accountNumber);
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
list = [...props.selectedAccounts, selection];
|
|
154
|
+
}
|
|
155
|
+
setSelectedItems(list);
|
|
156
|
+
props.onSelect && props.onSelect(list);
|
|
114
157
|
};
|
|
115
|
-
const
|
|
116
|
-
|
|
158
|
+
const onSingleAccountSelection = (selection) => {
|
|
159
|
+
var _a;
|
|
160
|
+
setSelectedItems([selection]);
|
|
161
|
+
props.onSelect && props.onSelect([selection]);
|
|
162
|
+
setIsOpen(false);
|
|
163
|
+
(_a = textInputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
164
|
+
};
|
|
165
|
+
const onFilter = (_event, value) => {
|
|
166
|
+
setQuery(value);
|
|
167
|
+
fetchAccounts(value);
|
|
168
|
+
setResultSize(pageSize);
|
|
169
|
+
setFocusedItemIndex(null);
|
|
170
|
+
};
|
|
171
|
+
const onToggleClick = () => {
|
|
172
|
+
setIsOpen((pre) => !pre);
|
|
117
173
|
};
|
|
118
|
-
const
|
|
174
|
+
const onClearSelection = (e) => {
|
|
175
|
+
var _a;
|
|
176
|
+
e.stopPropagation();
|
|
177
|
+
setIsOpen(true);
|
|
119
178
|
setSelectedItems([]);
|
|
179
|
+
(_a = textInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
120
180
|
};
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
const memoizedBookmarkAccounts = useMemo(() => toOptions(getDropdownOptions(bookmarkedAccountsDeduped || []), {
|
|
126
|
-
labelKey: getDisplayName,
|
|
127
|
-
childrenKey: 'children',
|
|
128
|
-
actionItemKey: 'actionItem',
|
|
129
|
-
}),
|
|
130
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
131
|
-
[bookmarkedAccountsDeduped]);
|
|
132
|
-
const onMultiChange = (items) => {
|
|
133
|
-
const accounts = items.map((item) => ({
|
|
134
|
-
accountNumber: item.value.accountNumber,
|
|
135
|
-
name: item.value.name,
|
|
136
|
-
subscriptionAbuse: item.value.subscriptionAbuse,
|
|
137
|
-
}));
|
|
138
|
-
setSelectedItems(accounts);
|
|
139
|
-
props.onSelect && props.onSelect(accounts);
|
|
181
|
+
const onSelect = (selection) => {
|
|
182
|
+
if (selection === 'display-more' || isUndefined(selection))
|
|
183
|
+
return;
|
|
184
|
+
props.multiple ? onMultiAccountSelection(selection) : onSingleAccountSelection(selection);
|
|
140
185
|
};
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
186
|
+
const handleMenuArrowKeys = (key) => {
|
|
187
|
+
let indexToFocus;
|
|
188
|
+
if (isOpen) {
|
|
189
|
+
if (key === 'ArrowUp') {
|
|
190
|
+
// When no index is set or at the first index, focus to the last, otherwise decrement focus index
|
|
191
|
+
if (focusedItemIndex === null || focusedItemIndex === 0) {
|
|
192
|
+
indexToFocus = itemsToRender.length - 1;
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
indexToFocus = focusedItemIndex - 1;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
if (key === 'ArrowDown') {
|
|
199
|
+
// When no index is set or at the last index, focus to the first, otherwise increment focus index
|
|
200
|
+
if (focusedItemIndex === null || focusedItemIndex === itemsToRender.length - 1) {
|
|
201
|
+
indexToFocus = 0;
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
indexToFocus = focusedItemIndex + 1;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
setFocusedItemIndex(indexToFocus);
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
const onInputKeyDown = (event) => {
|
|
211
|
+
const focusedItem = focusedItemIndex ? itemsToRender[focusedItemIndex] : itemsToRender[0];
|
|
212
|
+
switch (event.key) {
|
|
213
|
+
// Select the first available option
|
|
214
|
+
case 'Enter':
|
|
215
|
+
if (!isOpen) {
|
|
216
|
+
setIsOpen((pre) => !pre);
|
|
217
|
+
}
|
|
218
|
+
else if (isOpen) {
|
|
219
|
+
onSelect(focusedItem);
|
|
220
|
+
}
|
|
221
|
+
break;
|
|
222
|
+
case 'Escape':
|
|
223
|
+
setIsOpen(false);
|
|
224
|
+
break;
|
|
225
|
+
case 'ArrowUp':
|
|
226
|
+
case 'ArrowDown':
|
|
227
|
+
event.preventDefault();
|
|
228
|
+
handleMenuArrowKeys(event.key);
|
|
229
|
+
break;
|
|
230
|
+
}
|
|
168
231
|
};
|
|
169
|
-
|
|
232
|
+
const toggle = (toggleRef) => (React.createElement(MenuToggle, { innerRef: toggleRef, variant: "typeahead", onClick: onToggleClick, isExpanded: isOpen, isFullWidth: true, isDisabled: props.disabled },
|
|
233
|
+
React.createElement(TextInputGroup, { isPlain: true, innerRef: inputGroupRef },
|
|
234
|
+
React.createElement(TextInputGroupMain, { value: query, onClick: onToggleClick, onKeyDown: onInputKeyDown, onChange: onFilter, placeholder: t(props.placeholder || ''), isExpanded: isOpen, innerRef: textInputRef, "aria-controls": `select${props.multiple ? '-multi' : ''}-typeahead-listbox` }),
|
|
235
|
+
React.createElement(TextInputGroupUtilities, null, !isEmpty(query) && (React.createElement(Button, { variant: "plain", onClick: onClearSelection, isDisabled: isFetching, "aria-label": t('Clear') }, isFetching ? React.createElement(LoadingIndicator, { show: true, size: "sm" }) : React.createElement(TimesCircleIcon, { "aria-hidden": true })))))));
|
|
236
|
+
return (React.createElement(Select, { "data-tracking-id": "account-selector-dropdown", isOpen: isOpen, onOpenChange: () => setIsOpen(false), id: props.id, toggle: toggle, popperProps: { direction: 'down', enableFlip: false }, onSelect: (_e, v) => onSelect(v), selected: selectedItems, isScrollable: true },
|
|
237
|
+
React.createElement(SelectList, null, dropdownOptions)));
|
|
170
238
|
}
|
|
171
239
|
AccountSelectorInternal.defaultProps = defaultProps;
|
|
172
240
|
export { AccountSelectorInternal };
|
|
@@ -17,7 +17,7 @@ export const EmbeddedServiceChat = () => {
|
|
|
17
17
|
setIsBlockedErrorBoxVisible(true);
|
|
18
18
|
};
|
|
19
19
|
const chatErrorMessagePopover = () => (React.createElement("div", { className: "chatButton chatError", id: "chat-blocked-popover-selector" },
|
|
20
|
-
React.createElement(Popover, { "aria-label": t('Cannot connect to chat support'), alertSeverityVariant: 'danger', position: PopoverPosition.top, hasAutoWidth: true, headerIcon: React.createElement(ExclamationCircleIcon, { className: "pf-u-danger-color-100" }), headerComponent: "h1", headerContent: React.createElement(Trans, null, "Cannot connect to chat support"), bodyContent: React.createElement("p", { className: "pf-u-px-md" },
|
|
20
|
+
React.createElement(Popover, { "aria-label": t('Cannot connect to chat support'), alertSeverityVariant: 'danger', position: PopoverPosition.top, hasAutoWidth: true, headerIcon: React.createElement(ExclamationCircleIcon, { className: "pf-v5-u-danger-color-100" }), headerComponent: "h1", headerContent: React.createElement(Trans, null, "Cannot connect to chat support"), bodyContent: React.createElement("p", { className: "pf-v5-u-px-md" },
|
|
21
21
|
React.createElement(Trans, null, "There are multiple problems that can cause this error."),
|
|
22
22
|
React.createElement("br", null),
|
|
23
23
|
React.createElement("a", { href: `https://access.redhat.com/articles/313583#${hasBlockedByBrowser
|
|
@@ -26,7 +26,7 @@ export const EmbeddedServiceChat = () => {
|
|
|
26
26
|
? 'troubleshoot_network'
|
|
27
27
|
: ''}`, target: "_blank", rel: "noreferrer noopener" },
|
|
28
28
|
React.createElement(Trans, null, "See a list of possible causes."))), isVisible: isBlockedErrorBoxVisible, shouldClose: shouldClose, shouldOpen: shouldOpen },
|
|
29
|
-
React.createElement(Button, { variant: ButtonVariant.link, className: "pf-u-m-0 pf-u-p-0" },
|
|
29
|
+
React.createElement(Button, { variant: ButtonVariant.link, className: "pf-v5-u-m-0 pf-v5-u-p-0" },
|
|
30
30
|
React.createElement(ChatSVGIcon, null)))));
|
|
31
31
|
useEffect(() => {
|
|
32
32
|
initEmbedChat();
|
|
@@ -35,8 +35,8 @@ export const EmbeddedServiceChat = () => {
|
|
|
35
35
|
if (chatNotLoaded)
|
|
36
36
|
return React.createElement(React.Fragment, null);
|
|
37
37
|
return loadingChat ? (React.createElement("div", { className: "chatButton" },
|
|
38
|
-
React.createElement(Spinner, {
|
|
38
|
+
React.createElement(Spinner, { diameter: "28px", className: "pf-v5-u-m-xs" }))) : hasBlockedByBrowser || hasChatDomainsBlocked ? (chatErrorMessagePopover()) : !isChatStarted ? (React.createElement("div", { className: "chatButton", onClick: onStartChat, "data-tracking-id": "embedded-service-chat", ref: componentRef, id: "chat-bot-wrapper" },
|
|
39
39
|
React.createElement(ChatSVGIcon, null),
|
|
40
40
|
React.createElement(NewFeaturePopoverAnnouncement, { "aria-label": t('Support now has a chatbot (beta). Try it if you need help with a case.'), featureName: FeatureAnnouncementKeys.CHAT_BOT, sectionRef: componentRef, bodyContent: React.createElement("div", null,
|
|
41
|
-
React.createElement(Trans, null, "Support now has a chatbot (beta). Try it if you need help with a case.")),
|
|
41
|
+
React.createElement(Trans, null, "Support now has a chatbot (beta). Try it if you need help with a case.")), triggerRef: () => document.getElementById('chat-bot-wrapper') }))) : (React.createElement(React.Fragment, null));
|
|
42
42
|
};
|
|
@@ -105,8 +105,8 @@ export const HostnameAwarenessModal = () => {
|
|
|
105
105
|
return (React.createElement(React.Fragment, null,
|
|
106
106
|
React.createElement(Switch, { label: "Share hostnames", isChecked: isHostnamesChecked, onChange: onHostnameSwitchChange, className: "push-top-narrow" }),
|
|
107
107
|
React.createElement(Tooltip, { content: shareHostnamesClarificationCopy, position: "right" },
|
|
108
|
-
React.createElement(InfoIcon, { className: "pf-u-ml-sm hostnameInfoIcon" })),
|
|
109
|
-
isHostnamesLoading && (React.createElement(Spinner, {
|
|
108
|
+
React.createElement(InfoIcon, { className: "pf-v5-u-ml-sm hostnameInfoIcon" })),
|
|
109
|
+
isHostnamesLoading && (React.createElement(Spinner, { size: "lg", className: "pf-v5-u-ml-sm hostnameSpinner", "aria-label": "Hostname loading" }))));
|
|
110
110
|
};
|
|
111
111
|
//Do not show modal if user cannot share hostnames.
|
|
112
112
|
const canUseHostName = ability.can(resourceActions.PATCH, resources.CASE_CREATE, CaseListFields.HOSTNAME);
|
|
@@ -28,6 +28,6 @@ export function NewFeatureLabel(props) {
|
|
|
28
28
|
onFeatureDismiss();
|
|
29
29
|
};
|
|
30
30
|
return (React.createElement(Popover, Object.assign({}, popoverProps, conditionalProps, { hasAutoWidth: true, onHidden: onHidden }),
|
|
31
|
-
React.createElement(Label, { color: "green", className: "pf-u-ml-sm", icon: React.createElement(InfoCircleIcon, null) },
|
|
31
|
+
React.createElement(Label, { color: "green", className: "pf-v5-u-ml-sm", icon: React.createElement(InfoCircleIcon, null) },
|
|
32
32
|
React.createElement(Trans, null, "New"))));
|
|
33
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CloseCaseModal.d.ts","sourceRoot":"","sources":["../../../../src/components/SharedModals/CloseCaseModal.tsx"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"CloseCaseModal.d.ts","sourceRoot":"","sources":["../../../../src/components/SharedModals/CloseCaseModal.tsx"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAC;AAmB/B,UAAU,MAAM;IACZ,SAAS,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;CACvB;AAUD,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,eAmK3C"}
|
|
@@ -8,8 +8,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import './CloseCaseModal.scss';
|
|
11
|
-
import { Button, ButtonVariant, Form, FormGroup,
|
|
12
|
-
import
|
|
11
|
+
import { Button, ButtonVariant, Form, FormGroup, FormHelperText, HelperText, HelperTextItem, Modal, ModalVariant, TextArea, } from '@patternfly/react-core';
|
|
12
|
+
import { Select, SelectOption } from '@patternfly/react-core/deprecated';
|
|
13
13
|
import isEmpty from 'lodash/isEmpty';
|
|
14
14
|
import React, { useState } from 'react';
|
|
15
15
|
import { Trans, useTranslation } from 'react-i18next';
|
|
@@ -67,7 +67,7 @@ export function CloseCaseModal(props) {
|
|
|
67
67
|
React.createElement(Button, { key: "close-modal", variant: ButtonVariant.secondary, onClick: props.onClose, isDisabled: props.isUpdating, "data-tracking-id": "close-case-description-modal-cancel" },
|
|
68
68
|
React.createElement(Trans, null, "Cancel")),
|
|
69
69
|
], variant: ModalVariant.medium },
|
|
70
|
-
React.createElement("div", { className: "pf-u-mb-md" }, !isCaseListPage ? (React.createElement("p", null,
|
|
70
|
+
React.createElement("div", { className: "pf-v5-u-mb-md" }, !isCaseListPage ? (React.createElement("p", null,
|
|
71
71
|
React.createElement(Trans, null,
|
|
72
72
|
"Confirming will set the status of this case ",
|
|
73
73
|
React.createElement("strong", null, "closed"),
|
|
@@ -80,9 +80,15 @@ export function CloseCaseModal(props) {
|
|
|
80
80
|
React.createElement("p", null,
|
|
81
81
|
React.createElement(Trans, null, "This action will also reset the currently selected filters to default state."))))),
|
|
82
82
|
React.createElement(Form, { className: "close-case-modal-form" },
|
|
83
|
-
React.createElement(FormGroup, { label: t('Resolution'), isRequired: true, fieldId: "case-resolution"
|
|
84
|
-
React.createElement(
|
|
83
|
+
React.createElement(FormGroup, { label: t('Resolution'), isRequired: true, fieldId: "case-resolution" },
|
|
84
|
+
React.createElement(FormHelperText, null,
|
|
85
|
+
React.createElement(HelperText, null,
|
|
86
|
+
isCaseListPage && !(showValidationError && !selectedResolution) && (React.createElement(HelperTextItem, null,
|
|
87
|
+
React.createElement(Trans, null, "All of the selected cases will have the same resolution in bulk edit."))),
|
|
88
|
+
showValidationError && !selectedResolution && (React.createElement(HelperTextItem, { variant: "error", hasIcon: true },
|
|
89
|
+
React.createElement(Trans, null, "Required field"))))),
|
|
90
|
+
React.createElement(Select, { "aria-label": t('Select an option that best fits'), id: "case-resolution", selections: selectedResolution, onSelect: onResolutionChange, isOpen: showDropdown, isDisabled: props.isUpdating, menuAppendTo: document.body, validated: showValidationError && !selectedResolution ? 'error' : 'default', placeholderText: t('Select an option that best fits'), onToggle: (_event, toggle) => onDropdownToggle(toggle) }, resolutionOptions.map((option, index) => (React.createElement(SelectOption, { key: index, value: option },
|
|
85
91
|
React.createElement(Trans, null, option)))))),
|
|
86
92
|
showTextArea && (React.createElement(FormGroup, { label: t('Please describe your resolution'), type: "text", isRequired: true, fieldId: "close-case-description" },
|
|
87
|
-
React.createElement(TextArea, { validated: showValidationError && !resolutionDescription ? 'error' : 'default', isRequired: true, id: "close-case-description", name: "close-case-description", "aria-describedby": "close-case-description", value: resolutionDescription, placeholder: t('Please describe your resolution to help us better understand.'), onChange: onDescriptionChange, isDisabled: props.isUpdating }))))));
|
|
93
|
+
React.createElement(TextArea, { validated: showValidationError && !resolutionDescription ? 'error' : 'default', isRequired: true, id: "close-case-description", name: "close-case-description", "aria-describedby": "close-case-description", value: resolutionDescription, placeholder: t('Please describe your resolution to help us better understand.'), onChange: (_event, description) => onDescriptionChange(description), isDisabled: props.isUpdating, resizeOrientation: "vertical" }))))));
|
|
88
94
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// To override close case modal font weight - PCM-11644
|
|
2
|
-
div#case-close-modal.pf-c-modal-box__body {
|
|
3
|
-
form.pf-c-form.close-case-modal-form {
|
|
4
|
-
div.pf-c-form__group {
|
|
5
|
-
div.pf-c-form__group-label {
|
|
6
|
-
label.pf-c-form__label {
|
|
7
|
-
span.pf-c-form__label-text {
|
|
2
|
+
div#case-close-modal.pf-v5-c-modal-box__body {
|
|
3
|
+
form.pf-v5-c-form.close-case-modal-form {
|
|
4
|
+
div.pf-v5-c-form__group {
|
|
5
|
+
div.pf-v5-c-form__group-label {
|
|
6
|
+
label.pf-v5-c-form__label {
|
|
7
|
+
span.pf-v5-c-form__label-text {
|
|
8
8
|
font-weight: 600 !important;
|
|
9
9
|
}
|
|
10
10
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/react-context",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.27",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"lib/**/*"
|
|
27
27
|
],
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@cee-eng/hydrajs": "4.16.
|
|
30
|
-
"@patternfly/react-core": "
|
|
31
|
-
"@patternfly/react-icons": "
|
|
29
|
+
"@cee-eng/hydrajs": "4.16.33",
|
|
30
|
+
"@patternfly/react-core": "5.1.1",
|
|
31
|
+
"@patternfly/react-icons": "5.1.1",
|
|
32
32
|
"i18next": "^19.0.1",
|
|
33
33
|
"lodash": "^4.17.21",
|
|
34
34
|
"react": "17.0.2",
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"react-test-renderer": "17.0.1"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@cee-eng/hydrajs": "4.16.
|
|
41
|
-
"@patternfly/react-core": "
|
|
42
|
-
"@patternfly/react-icons": "
|
|
43
|
-
"@rh-support/components": "2.1.
|
|
40
|
+
"@cee-eng/hydrajs": "4.16.33",
|
|
41
|
+
"@patternfly/react-core": "5.1.1",
|
|
42
|
+
"@patternfly/react-icons": "5.1.1",
|
|
43
|
+
"@rh-support/components": "2.1.25",
|
|
44
44
|
"@rh-support/types": "2.0.2",
|
|
45
|
-
"@rh-support/user-permissions": "2.1.
|
|
46
|
-
"@rh-support/utils": "2.1.
|
|
45
|
+
"@rh-support/user-permissions": "2.1.18",
|
|
46
|
+
"@rh-support/utils": "2.1.11",
|
|
47
47
|
"i18next": "^19.0.1",
|
|
48
48
|
"localforage": "^1.10.0",
|
|
49
49
|
"lodash": "^4.17.21",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"defaults and supports es6-module",
|
|
86
86
|
"maintained node versions"
|
|
87
87
|
],
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "e67736e7b8a06c4617cc8e49a905ba7819e5ae63"
|
|
89
89
|
}
|