@rh-support/react-context 2.1.20-beta.16 → 2.1.20-beta.18
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 +174 -94
- 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 +9 -9
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;AAQxF,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,eAmS7C;kBAnSQ,uBAAuB;;;AAsShC,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -8,13 +8,15 @@ 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';
|
|
17
|
+
import isNull from 'lodash/isNull';
|
|
16
18
|
import uniqBy from 'lodash/uniqBy';
|
|
17
|
-
import React, { useEffect, useMemo, useState } from 'react';
|
|
19
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
18
20
|
import { Trans, useTranslation } from 'react-i18next';
|
|
19
21
|
const defaultProps = {
|
|
20
22
|
id: '',
|
|
@@ -36,48 +38,84 @@ const defaultProps = {
|
|
|
36
38
|
isInValid: false,
|
|
37
39
|
restrictedOnSubscriptionAbuse: false,
|
|
38
40
|
};
|
|
41
|
+
const getDisplayName = (account) => {
|
|
42
|
+
if (!account) {
|
|
43
|
+
return '';
|
|
44
|
+
}
|
|
45
|
+
return account.accountNumber
|
|
46
|
+
? account.name
|
|
47
|
+
? `${account.name} (${account.accountNumber})`
|
|
48
|
+
: account.accountNumber
|
|
49
|
+
: '';
|
|
50
|
+
};
|
|
39
51
|
function AccountSelectorInternal(props) {
|
|
40
52
|
const { request, isFetching } = useFetch(accounts.getAccounts, { isAbortable: true });
|
|
41
53
|
const [items, setItems] = useState([]);
|
|
42
54
|
const [selectedItems, setSelectedItems] = useState([]);
|
|
55
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
56
|
+
const [isQueryChanged, setIsQueryChanged] = useState(false);
|
|
57
|
+
const [query, setQuery] = useState('');
|
|
58
|
+
const [focusedItemIndex, setFocusedItemIndex] = useState(null);
|
|
59
|
+
const textInputRef = useRef();
|
|
60
|
+
const inputGroupRef = useRef();
|
|
43
61
|
const { t } = useTranslation();
|
|
44
62
|
const bookmarkedAccountsDeduped = uniqBy(props.bookmarkedAccounts, (b) => b.accountNumber);
|
|
63
|
+
const pageSize = 20;
|
|
64
|
+
const [resultSize, setResultSize] = useState(pageSize);
|
|
65
|
+
const setQueryLabel = (selectedItems) => {
|
|
66
|
+
const item = !isEmpty(selectedItems) && !props.multiple ? selectedItems[0] : {};
|
|
67
|
+
setQuery(getDisplayName(item));
|
|
68
|
+
};
|
|
69
|
+
const itemsToRender = useMemo(() => (isEmpty(items) ? bookmarkedAccountsDeduped : items.slice(0, props.paginate ? resultSize : items.length)), [items, bookmarkedAccountsDeduped, props.paginate, resultSize]);
|
|
45
70
|
useEffect(() => {
|
|
46
71
|
if (!props.multiple) {
|
|
47
72
|
const selectedItem = (props.selectedAccounts || [])[0];
|
|
48
|
-
selectedItem && selectedItem.accountNumber && setSelectedItems(props.selectedAccounts);
|
|
73
|
+
selectedItem && selectedItem.accountNumber && setSelectedItems(props.selectedAccounts || []);
|
|
49
74
|
}
|
|
50
75
|
else {
|
|
51
|
-
setSelectedItems(props.selectedAccounts);
|
|
76
|
+
setSelectedItems(props.selectedAccounts || []);
|
|
52
77
|
}
|
|
53
78
|
}, [props.selectedAccounts, props.multiple]);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
: '';
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
setQueryLabel(selectedItems);
|
|
81
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
82
|
+
}, [selectedItems, props.multiple]);
|
|
83
|
+
const onDisplayMoreClick = (e) => {
|
|
84
|
+
e.stopPropagation();
|
|
85
|
+
setResultSize((pre) => Math.min(pre + pageSize, items.length));
|
|
86
|
+
setIsOpen(true);
|
|
63
87
|
};
|
|
64
|
-
const
|
|
65
|
-
if (
|
|
66
|
-
return
|
|
88
|
+
const dropdownOptions = useMemo(() => {
|
|
89
|
+
if (isFetching) {
|
|
90
|
+
return (React.createElement("div", { key: "searching", className: "pf-v5-u-px-md pf-v5-u-py-sm" },
|
|
91
|
+
React.createElement(Trans, null, "Searching...")));
|
|
67
92
|
}
|
|
68
|
-
|
|
69
|
-
.
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
React.createElement(
|
|
75
|
-
" ",
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
93
|
+
if (isQueryChanged && isEmpty(items)) {
|
|
94
|
+
return (React.createElement("div", { key: "no-results", className: "pf-v5-u-px-md pf-v5-u-py-sm" },
|
|
95
|
+
React.createElement(Trans, null, "No results found")));
|
|
96
|
+
}
|
|
97
|
+
return [
|
|
98
|
+
...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' } },
|
|
99
|
+
React.createElement(FlexItem, { className: "form-instructions form-invalid" }, getDisplayName(item)),
|
|
100
|
+
React.createElement(FlexItem, { className: "form-instructions form-invalid pf-v5-u-text-nowrap pf-v5-u-pr-sm" },
|
|
101
|
+
React.createElement(InfoCircleIcon, null),
|
|
102
|
+
" ",
|
|
103
|
+
React.createElement(Trans, null, "Subscription abuse")))) : (React.createElement("span", null, getDisplayName(item)))))),
|
|
104
|
+
...(resultSize < items.length
|
|
105
|
+
? [
|
|
106
|
+
React.createElement("div", { className: "pf-v5-c-divider", role: "separator", key: "separator" }),
|
|
107
|
+
React.createElement(SelectOption, { key: 'diplay-more-option', onClick: onDisplayMoreClick, value: 'display-more' },
|
|
108
|
+
React.createElement(Flex, { justifyContent: { default: 'justifyContentCenter' } },
|
|
109
|
+
React.createElement(FlexItem, { className: '"pf-v5-c-button pf-m-link pf-m-inline' },
|
|
110
|
+
React.createElement(Trans, null, "Display additional results")))),
|
|
111
|
+
]
|
|
112
|
+
: []),
|
|
113
|
+
];
|
|
114
|
+
},
|
|
115
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
116
|
+
[items, bookmarkedAccountsDeduped, isFetching, itemsToRender, isQueryChanged]);
|
|
79
117
|
const fetchAccounts = (query) => __awaiter(this, void 0, void 0, function* () {
|
|
80
|
-
if (query
|
|
118
|
+
if (isEmpty(query)) {
|
|
81
119
|
return;
|
|
82
120
|
}
|
|
83
121
|
const fields = ['accountNumber', 'accountId', 'name', 'subscriptionAbuse'].join(',');
|
|
@@ -94,79 +132,121 @@ function AccountSelectorInternal(props) {
|
|
|
94
132
|
else {
|
|
95
133
|
params.accountNumberLike = query;
|
|
96
134
|
}
|
|
97
|
-
const queryParams =
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const response = yield request(queryParams);
|
|
101
|
-
const options = response && response.items && response.items.length ? getDropdownOptions(response.items) : [];
|
|
135
|
+
const queryParams = params;
|
|
136
|
+
const response = request && (yield request(queryParams));
|
|
137
|
+
const options = response && response.items && response.items.length ? response.items : [];
|
|
102
138
|
setItems(options);
|
|
103
|
-
// setIsLoading(false);
|
|
104
139
|
});
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
140
|
+
const onOuterClick = () => {
|
|
141
|
+
setQueryLabel(props.selectedAccounts || []);
|
|
142
|
+
setSelectedItems(props.selectedAccounts || []);
|
|
143
|
+
};
|
|
144
|
+
useEffect(() => {
|
|
145
|
+
const handleClickOutside = (event) => {
|
|
146
|
+
if (inputGroupRef.current && !inputGroupRef.current.contains(event.target)) {
|
|
147
|
+
onOuterClick();
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
151
|
+
return () => {
|
|
152
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
111
153
|
};
|
|
112
|
-
|
|
113
|
-
|
|
154
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
155
|
+
}, [selectedItems, props.selectedAccounts]);
|
|
156
|
+
const onMultiAccountSelection = (selection) => {
|
|
157
|
+
let list = [];
|
|
158
|
+
if (selectedItems.some((item) => item.accountNumber === selection.accountNumber)) {
|
|
159
|
+
list = selectedItems.filter((item) => item.accountNumber !== selection.accountNumber);
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
list = [...props.selectedAccounts, selection];
|
|
163
|
+
}
|
|
164
|
+
setSelectedItems(list);
|
|
165
|
+
props.onSelect && props.onSelect(list);
|
|
114
166
|
};
|
|
115
|
-
const
|
|
116
|
-
|
|
167
|
+
const onSingleAccountSelection = (selection) => {
|
|
168
|
+
var _a;
|
|
169
|
+
setSelectedItems([selection]);
|
|
170
|
+
props.onSelect && props.onSelect([selection]);
|
|
171
|
+
setIsOpen(false);
|
|
172
|
+
(_a = textInputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
173
|
+
};
|
|
174
|
+
const onFilter = (_event, value) => {
|
|
175
|
+
setQuery(value);
|
|
176
|
+
setIsQueryChanged(!isEmpty(value));
|
|
177
|
+
fetchAccounts(value);
|
|
178
|
+
setResultSize(pageSize);
|
|
179
|
+
setFocusedItemIndex(null);
|
|
180
|
+
};
|
|
181
|
+
const onToggleClick = () => {
|
|
182
|
+
setIsOpen((pre) => !pre);
|
|
117
183
|
};
|
|
118
|
-
const
|
|
184
|
+
const onClearSelection = (e) => {
|
|
185
|
+
var _a;
|
|
186
|
+
e.stopPropagation();
|
|
187
|
+
setIsOpen(true);
|
|
119
188
|
setSelectedItems([]);
|
|
189
|
+
setItems([]);
|
|
190
|
+
setIsQueryChanged(false);
|
|
191
|
+
(_a = textInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
120
192
|
};
|
|
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);
|
|
193
|
+
const onSelect = (selection) => {
|
|
194
|
+
if (selection === 'display-more' || isUndefined(selection) || isNull(selection))
|
|
195
|
+
return;
|
|
196
|
+
props.multiple ? onMultiAccountSelection(selection) : onSingleAccountSelection(selection);
|
|
140
197
|
};
|
|
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
|
-
|
|
198
|
+
const handleMenuArrowKeys = (key) => {
|
|
199
|
+
let indexToFocus;
|
|
200
|
+
if (isOpen) {
|
|
201
|
+
if (key === 'ArrowUp') {
|
|
202
|
+
// When no index is set or at the first index, focus to the last, otherwise decrement focus index
|
|
203
|
+
if (focusedItemIndex === null || focusedItemIndex === 0) {
|
|
204
|
+
indexToFocus = itemsToRender.length - 1;
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
indexToFocus = focusedItemIndex - 1;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
if (key === 'ArrowDown') {
|
|
211
|
+
// When no index is set or at the last index, focus to the first, otherwise increment focus index
|
|
212
|
+
if (focusedItemIndex === null || focusedItemIndex === itemsToRender.length - 1) {
|
|
213
|
+
indexToFocus = 0;
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
indexToFocus = focusedItemIndex + 1;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
setFocusedItemIndex(indexToFocus);
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
const onInputKeyDown = (event) => {
|
|
223
|
+
const focusedItem = focusedItemIndex ? itemsToRender[focusedItemIndex] : itemsToRender[0];
|
|
224
|
+
switch (event.key) {
|
|
225
|
+
// Select the first available option
|
|
226
|
+
case 'Enter':
|
|
227
|
+
if (!isOpen) {
|
|
228
|
+
setIsOpen((pre) => !pre);
|
|
229
|
+
}
|
|
230
|
+
else if (isOpen) {
|
|
231
|
+
onSelect(focusedItem);
|
|
232
|
+
}
|
|
233
|
+
break;
|
|
234
|
+
case 'Escape':
|
|
235
|
+
setIsOpen(false);
|
|
236
|
+
break;
|
|
237
|
+
case 'ArrowUp':
|
|
238
|
+
case 'ArrowDown':
|
|
239
|
+
event.preventDefault();
|
|
240
|
+
handleMenuArrowKeys(event.key);
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
168
243
|
};
|
|
169
|
-
|
|
244
|
+
const toggle = (toggleRef) => (React.createElement(MenuToggle, { innerRef: toggleRef, variant: "typeahead", onClick: onToggleClick, isExpanded: isOpen, isFullWidth: true, isDisabled: props.disabled },
|
|
245
|
+
React.createElement(TextInputGroup, { isPlain: true, innerRef: inputGroupRef },
|
|
246
|
+
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` }),
|
|
247
|
+
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 })))))));
|
|
248
|
+
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 },
|
|
249
|
+
React.createElement(SelectList, null, dropdownOptions)));
|
|
170
250
|
}
|
|
171
251
|
AccountSelectorInternal.defaultProps = defaultProps;
|
|
172
252
|
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.20-beta.
|
|
3
|
+
"version": "2.1.20-beta.18",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
],
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"@cee-eng/hydrajs": "4.16.33",
|
|
30
|
-
"@patternfly/react-core": "
|
|
31
|
-
"@patternfly/react-icons": "
|
|
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",
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@cee-eng/hydrajs": "4.16.33",
|
|
41
|
-
"@patternfly/react-core": "
|
|
42
|
-
"@patternfly/react-icons": "
|
|
43
|
-
"@rh-support/components": "2.1.19-beta.
|
|
41
|
+
"@patternfly/react-core": "5.1.1",
|
|
42
|
+
"@patternfly/react-icons": "5.1.1",
|
|
43
|
+
"@rh-support/components": "2.1.19-beta.17",
|
|
44
44
|
"@rh-support/types": "2.0.2",
|
|
45
|
-
"@rh-support/user-permissions": "2.1.13-beta.
|
|
46
|
-
"@rh-support/utils": "2.1.10-beta.
|
|
45
|
+
"@rh-support/user-permissions": "2.1.13-beta.15",
|
|
46
|
+
"@rh-support/utils": "2.1.10-beta.14",
|
|
47
47
|
"i18next": "^19.0.1",
|
|
48
48
|
"localforage": "^1.10.0",
|
|
49
49
|
"lodash": "^4.17.21",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"defaults and supports es6-module",
|
|
85
85
|
"maintained node versions"
|
|
86
86
|
],
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "41cdb63f8c678315dfb4668006a7ea656df5c988"
|
|
88
88
|
}
|