@rh-support/manage 2.1.51 → 2.1.52
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/TopContentManagement/TopContentEditor/TopContentSuggestion/TopContentSuggestionHintAccept.d.ts.map +1 -1
- package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentSuggestion/TopContentSuggestionHintAccept.js +21 -16
- package/lib/esm/scss/_pf-overrides.scss +5 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TopContentSuggestionHintAccept.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TopContentManagement/TopContentEditor/TopContentSuggestion/TopContentSuggestionHintAccept.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,mBAAmB,EAAE,MAAM,2DAA2D,CAAC;AASrH,OAAc,EAAE,EAAE,EAAgC,MAAM,OAAO,CAAC;AAgBhE,UAAU,MAAM;IACZ,QAAQ,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,SAAS,EAAE,mBAAmB,CAAC;CAClC;AAED,eAAO,MAAM,8BAA8B,EAAE,EAAE,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"TopContentSuggestionHintAccept.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TopContentManagement/TopContentEditor/TopContentSuggestion/TopContentSuggestionHintAccept.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,mBAAmB,EAAE,MAAM,2DAA2D,CAAC;AASrH,OAAc,EAAE,EAAE,EAAgC,MAAM,OAAO,CAAC;AAgBhE,UAAU,MAAM;IACZ,QAAQ,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,SAAS,EAAE,mBAAmB,CAAC;CAClC;AAED,eAAO,MAAM,8BAA8B,EAAE,EAAE,CAAC,MAAM,CA2PrD,CAAC"}
|
|
@@ -30,11 +30,11 @@ export const TopContentSuggestionHintAccept = ({ onCancel, resources }) => {
|
|
|
30
30
|
const [selected, setSelected] = useState();
|
|
31
31
|
const [isSaving, setIsSaving] = useState(false);
|
|
32
32
|
const [resourceTitle, setResourceTitle] = useState('');
|
|
33
|
-
const [linkToContent, setLinkToContent] = useState('');
|
|
34
33
|
const [isEditClicked, setIsEditClicked] = useState(false);
|
|
35
34
|
const categoryToSave = useMemo(() => topContentEditState.find((category) => category.categoryId === (selected === null || selected === void 0 ? void 0 : selected.id)), [topContentEditState, selected]);
|
|
36
35
|
const flagContentEditState = useMemo(() => flagContentUsage(topContentEditState, categoryUsage, selectedVersion), [topContentEditState, categoryUsage, selectedVersion]);
|
|
37
36
|
const isMajorVersionOnly = isUndefined(getVersion(selectedVersion).minor);
|
|
37
|
+
const linkToContent = resources.resourceViewUri;
|
|
38
38
|
const minorSelectedNoMinorContentButAvailableMajorContent = !topContentResponse.isFetching &&
|
|
39
39
|
!isEmpty(topContentResponse.data) &&
|
|
40
40
|
getVersion(selectedVersion).minor &&
|
|
@@ -43,12 +43,12 @@ export const TopContentSuggestionHintAccept = ({ onCancel, resources }) => {
|
|
|
43
43
|
!isAddingCategory;
|
|
44
44
|
const isCategoryLimitReached = (minorSelectedNoMinorContentButAvailableMajorContent ? [] : flagContentEditState).length >= CATEGORY_LIMIT.MAX;
|
|
45
45
|
const isCategoryInList = flagContentEditState.some((c) => c.categoryId === (selected === null || selected === void 0 ? void 0 : selected.id));
|
|
46
|
-
const onToggle = () => {
|
|
47
|
-
setSelectOpen(
|
|
46
|
+
const onToggle = (isExpanded) => {
|
|
47
|
+
setSelectOpen(isExpanded);
|
|
48
48
|
};
|
|
49
49
|
const onSelect = (event, selection, isPlaceholder) => {
|
|
50
50
|
setSelected(selection);
|
|
51
|
-
onToggle();
|
|
51
|
+
onToggle(false);
|
|
52
52
|
};
|
|
53
53
|
const isDisabled = isEmpty(linkToContent) ||
|
|
54
54
|
isEmpty(trim(resourceTitle)) ||
|
|
@@ -106,10 +106,19 @@ export const TopContentSuggestionHintAccept = ({ onCancel, resources }) => {
|
|
|
106
106
|
addContentToCategory();
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
|
+
const getCategoryOptions = (options) => {
|
|
110
|
+
return options.map((category, id) => (React.createElement(SelectOption, { key: id, value: category }, category.categoryName)));
|
|
111
|
+
};
|
|
112
|
+
const onFilter = (_, value) => {
|
|
113
|
+
if (!value)
|
|
114
|
+
return getCategoryOptions(categories.data);
|
|
115
|
+
const input = new RegExp(value, 'i');
|
|
116
|
+
const newOptions = categories.data.filter((c) => input.test(c.categoryName));
|
|
117
|
+
return getCategoryOptions(newOptions);
|
|
118
|
+
};
|
|
109
119
|
useEffect(() => {
|
|
110
120
|
setResourceTitle(resources.resourceTitle);
|
|
111
|
-
|
|
112
|
-
}, [resources.resourceTitle, resources.resourceViewUri]);
|
|
121
|
+
}, [resources.resourceTitle]);
|
|
113
122
|
useEffect(() => {
|
|
114
123
|
try {
|
|
115
124
|
fetchCategories(topContentDispatch);
|
|
@@ -121,21 +130,17 @@ export const TopContentSuggestionHintAccept = ({ onCancel, resources }) => {
|
|
|
121
130
|
return (React.createElement(Card, { className: "pf-v5-u-m-sm" },
|
|
122
131
|
React.createElement(CardBody, { className: "card-hint" },
|
|
123
132
|
React.createElement(Form, null,
|
|
124
|
-
isEditClicked ? (React.createElement(
|
|
125
|
-
React.createElement(
|
|
126
|
-
React.createElement(TextInput, { isRequired: true, type: "text", id: "top-content-resource-link", name: "top-content-resource-link", "data-tracking-id": "top-content-resource-link", value: linkToContent, onChange: (_event, val) => setLinkToContent(val), placeholder: t('Enter link to content'), validated: isEmpty(linkToContent) || !isValidUrl(linkToContent)
|
|
127
|
-
? ValidatedOptions.error
|
|
128
|
-
: ValidatedOptions.default })),
|
|
129
|
-
React.createElement(FormGroup, { label: t('Headline'), isRequired: true, fieldId: "simple-form-email-01" },
|
|
130
|
-
React.createElement(TextInput, { isRequired: true, type: "text", id: "top-content-headline-category", name: "top-content-headline-category", "data-tracking-id": "top-content-headline-category", value: resourceTitle, onChange: (_event, val) => setResourceTitle(val), placeholder: t('Copy and paste the heading for consistency'), validated: isEmpty(trim(resourceTitle)) ? ValidatedOptions.error : ValidatedOptions.default })))) : (React.createElement("span", null,
|
|
133
|
+
isEditClicked ? (React.createElement(FormGroup, { label: t('Heading'), isRequired: true, fieldId: "simple-form-email-01" },
|
|
134
|
+
React.createElement(TextInput, { isRequired: true, type: "text", id: "top-content-headline-category", name: "top-content-headline-category", "data-tracking-id": "top-content-headline-category", value: resourceTitle, onChange: (_event, val) => setResourceTitle(val), placeholder: t('Copy and paste the heading for consistency'), validated: isEmpty(trim(resourceTitle)) ? ValidatedOptions.error : ValidatedOptions.default }))) : (React.createElement("span", null,
|
|
131
135
|
React.createElement(Button, { variant: "link", isInline: true },
|
|
132
136
|
React.createElement("u", null,
|
|
133
137
|
React.createElement("a", { className: "hint-title pf-v5-u-font-size-md", target: "_blank", href: linkToContent, rel: "noreferrer" }, resources.resourceTitle))),
|
|
134
|
-
React.createElement(Tooltip, { content: t('Edit
|
|
138
|
+
React.createElement(Tooltip, { content: t('Edit heading'), position: "top" },
|
|
135
139
|
React.createElement(Button, { variant: "link", icon: React.createElement(PencilAltIcon, null), onClick: () => setIsEditClicked((pre) => !pre) })))),
|
|
136
140
|
React.createElement(FormGroup, { label: t('Category'), isRequired: true, fieldId: "simple-form-email-01" },
|
|
137
|
-
React.createElement(Select, Object.assign({ variant: SelectVariant.
|
|
138
|
-
|
|
141
|
+
React.createElement(Select, Object.assign({ variant: SelectVariant.typeahead, id: "category-selection", name: "category-selection", "data-testid": "category-selection", placeholderText: t('Select an option or enter a new category'), onFilter: onFilter, onToggle: (_event, isExpanded) => onToggle(isExpanded), isOpen: isSelectOpen, onSelect: onSelect, selections: selected === null || selected === void 0 ? void 0 : selected.categoryName, isDisabled: categories.isError, loadingVariant: 'spinner' }, (categories.isFetching && { loadingVariant: 'spinner' })), getCategoryOptions(categories.data))),
|
|
142
|
+
isEditClicked && (React.createElement(FormGroup, { label: t('Link to content'), isRequired: true, fieldId: "top-content-link" },
|
|
143
|
+
React.createElement(TextInput, { type: "text", id: "top-content-resource-link", name: "top-content-resource-link", "data-tracking-id": "top-content-resource-link", value: linkToContent, isDisabled: true }))),
|
|
139
144
|
React.createElement("div", { className: "pf-v5-u-mt-sm" },
|
|
140
145
|
isCategoryLimitReached && !isCategoryInList && !isUndefined(selected) && React.createElement(CategoryLimit, null),
|
|
141
146
|
React.createElement(Button, { variant: "primary", onClick: onSaveContent, isDisabled: isSaving || isDisabled, isLoading: isSaving, "data-tracking-id": "suggested-content-save-button" },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/manage",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.52",
|
|
4
4
|
"description": "Customer Support Manage App",
|
|
5
5
|
"author": "Jordan Eudy <jeudy100@gmail.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
"defaults and supports es6-module",
|
|
102
102
|
"maintained node versions"
|
|
103
103
|
],
|
|
104
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "19f893dca537531c7f828ffa92daf8fe40649d78"
|
|
105
105
|
}
|