@rh-support/manage 1.0.40 → 1.0.41

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.
@@ -1 +1 @@
1
- {"version":3,"file":"TopContentSuggestion.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TopContentManagement/TopContentEditor/TopContentSuggestion/TopContentSuggestion.tsx"],"names":[],"mappings":"AACA,OAAc,EAAE,EAAE,EAAuB,MAAM,OAAO,CAAC;AAOvD,UAAU,MAAM;CAAG;AAEnB,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC,MAAM,CAiC3C,CAAC"}
1
+ {"version":3,"file":"TopContentSuggestion.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TopContentManagement/TopContentEditor/TopContentSuggestion/TopContentSuggestion.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,EAAE,EAAuB,MAAM,OAAO,CAAC;AAOvD,UAAU,MAAM;CAAG;AAEnB,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC,MAAM,CAoC3C,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { ExpandableSection, Panel, PanelMain, PanelMainBody, Title } from '@patternfly/react-core';
2
+ import { isEmpty } from 'lodash';
2
3
  import React, { useEffect, useState } from 'react';
3
4
  import { Trans } from 'react-i18next';
4
5
  import { useTopContentContext, useTopContentDispatchContext } from '../../../../context/TopContentProvider';
@@ -15,6 +16,8 @@ export const TopContentSuggestion = () => {
15
16
  fetchTopContentSuggestions(topContentDispatch, selectedProduct.name, selectedVersion);
16
17
  }
17
18
  }, [topContentDispatch, selectedProduct, selectedVersion]);
19
+ if (isEmpty(suggestion.linkedResources))
20
+ return React.createElement(React.Fragment, null);
18
21
  return (React.createElement(Panel, { variant: "raised", className: "pf-u-mx-md pf-u-p-md" },
19
22
  React.createElement(PanelMain, null,
20
23
  React.createElement(PanelMainBody, null,
@@ -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;AAgBrH,OAAc,EAAE,EAAE,EAAgC,MAAM,OAAO,CAAC;AAahE,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,CA8KrD,CAAC"}
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;AAmBrH,OAAc,EAAE,EAAE,EAAgC,MAAM,OAAO,CAAC;AAahE,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,CAmOrD,CAAC"}
@@ -7,9 +7,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { ActionGroup, Button, Card, CardBody, Form, FormGroup, Select, SelectOption, SelectVariant, TextInput, } from '@patternfly/react-core';
10
+ import { ActionGroup, Button, Card, CardBody, Form, FormGroup, Select, SelectOption, SelectVariant, TextInput, Tooltip, ValidatedOptions, } from '@patternfly/react-core';
11
+ import PencilAltIcon from '@patternfly/react-icons/dist/js/icons/pencil-alt-icon';
11
12
  import { ToastNotification } from '@rh-support/components';
12
- import { getVersion, isRegularVersion } from '@rh-support/utils';
13
+ import { getVersion, isRegularVersion, isValidUrl } from '@rh-support/utils';
13
14
  import { isEmpty, isUndefined } from 'lodash';
14
15
  import React, { useEffect, useMemo, useState } from 'react';
15
16
  import { Trans, useTranslation } from 'react-i18next';
@@ -23,6 +24,8 @@ export const TopContentSuggestionHintAccept = ({ onCancel, resources }) => {
23
24
  const [selected, setSelected] = useState();
24
25
  const [isSaving, setIsSaving] = useState(false);
25
26
  const [resourceTitle, setResourceTitle] = useState('');
27
+ const [linkToContent, setLinkToContent] = useState('');
28
+ const [isEditClicked, setIsEditClicked] = useState(false);
26
29
  const categoryToSave = useMemo(() => topContentEditState.find((category) => category.categoryId === (selected === null || selected === void 0 ? void 0 : selected.id)), [topContentEditState, selected]);
27
30
  const isMajorVersionOnly = isUndefined(getVersion(selectedVersion).minor);
28
31
  const minorSelectedNoMinorContentButAvailableMajorContent = !topContentResponse.isFetching &&
@@ -38,13 +41,14 @@ export const TopContentSuggestionHintAccept = ({ onCancel, resources }) => {
38
41
  setSelected(selection);
39
42
  onToggle();
40
43
  };
44
+ const isDisabled = isEmpty(linkToContent) || isEmpty(resourceTitle) || isUndefined(selected) || !isValidUrl(linkToContent);
41
45
  const addContentToCategory = () => __awaiter(void 0, void 0, void 0, function* () {
42
46
  try {
43
47
  setIsSaving(true);
44
48
  const newContent = {
45
49
  contentTitle: resourceTitle,
46
50
  contentRank: categoryToSave === null || categoryToSave === void 0 ? void 0 : categoryToSave.content.length,
47
- contentUrl: resources.resourceViewUri,
51
+ contentUrl: linkToContent,
48
52
  mode: ContentMode.ADD,
49
53
  };
50
54
  yield saveAddToTopContent(topContentDispatch, topContentEditState, categoryToSave.id, categoryToSave === null || categoryToSave === void 0 ? void 0 : categoryToSave.categoryId, newContent, -1);
@@ -63,7 +67,7 @@ export const TopContentSuggestionHintAccept = ({ onCancel, resources }) => {
63
67
  setIsSaving(true);
64
68
  const newContent = {
65
69
  contentTitle: resourceTitle,
66
- contentUrl: resources.resourceViewUri,
70
+ contentUrl: linkToContent,
67
71
  isAttentionNeeded: false,
68
72
  mode: ContentMode.NEW_SECTION_CONTENT,
69
73
  };
@@ -91,7 +95,8 @@ export const TopContentSuggestionHintAccept = ({ onCancel, resources }) => {
91
95
  });
92
96
  useEffect(() => {
93
97
  setResourceTitle(resources.resourceTitle);
94
- }, [resources.resourceTitle]);
98
+ setLinkToContent(resources.resourceViewUri);
99
+ }, [resources.resourceTitle, resources.resourceViewUri]);
95
100
  useEffect(() => {
96
101
  try {
97
102
  fetchCategories(topContentDispatch);
@@ -102,15 +107,24 @@ export const TopContentSuggestionHintAccept = ({ onCancel, resources }) => {
102
107
  }, [topContentDispatch, t]);
103
108
  return (React.createElement(Card, null,
104
109
  React.createElement(CardBody, { className: "card-hint" },
105
- React.createElement("span", { className: "hint-title" }, resources.resourceTitle),
106
110
  React.createElement(Form, null,
111
+ isEditClicked ? (React.createElement(React.Fragment, null,
112
+ React.createElement(FormGroup, { label: t('Link to content'), isRequired: true, fieldId: "top-content-link" },
113
+ 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: setLinkToContent, validated: isEmpty(linkToContent) || !isValidUrl(linkToContent)
114
+ ? ValidatedOptions.error
115
+ : ValidatedOptions.default })),
116
+ React.createElement(FormGroup, { label: t('Headline'), isRequired: true, fieldId: "simple-form-email-01" },
117
+ 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: setResourceTitle, validated: isEmpty(resourceTitle) ? ValidatedOptions.error : ValidatedOptions.default })))) : (React.createElement("span", null,
118
+ React.createElement(Button, { variant: "link", isInline: true },
119
+ React.createElement("u", null,
120
+ React.createElement("a", { className: "hint-title pf-u-font-size-md", target: "_blank", href: linkToContent, rel: "noreferrer" }, resources.resourceTitle))),
121
+ React.createElement(Tooltip, { content: t('Edit Link to content and Headline'), position: "top" },
122
+ React.createElement(Button, { variant: "link", icon: React.createElement(PencilAltIcon, null), onClick: () => setIsEditClicked((pre) => !pre) })))),
107
123
  React.createElement(FormGroup, { label: t('Category'), isRequired: true, fieldId: "simple-form-email-01" },
108
- React.createElement(Select, { variant: SelectVariant.single, id: "category-selection", name: "category-selection", "data-testid": "category-selection", placeholderText: "Select a category", onToggle: onToggle, isOpen: isSelectOpen, onSelect: onSelect, selections: selected === null || selected === void 0 ? void 0 : selected.categoryName, isDisabled: categories.isFetching || categories.isError }, categories.data.map((category, id) => (React.createElement(SelectOption, { key: id, value: category },
124
+ React.createElement(Select, Object.assign({ variant: SelectVariant.single, id: "category-selection", name: "category-selection", "data-testid": "category-selection", placeholderText: "Select a category", onToggle: onToggle, isOpen: isSelectOpen, onSelect: onSelect, selections: selected === null || selected === void 0 ? void 0 : selected.categoryName, isDisabled: categories.isError, loadingVariant: 'spinner' }, (categories.isFetching && { loadingVariant: 'spinner' })), categories.data.map((category, id) => (React.createElement(SelectOption, { key: id, value: category },
109
125
  React.createElement("div", null, category.categoryName)))))),
110
- React.createElement(FormGroup, { label: t('Headline'), isRequired: true, fieldId: "simple-form-email-01" },
111
- React.createElement(TextInput, { isRequired: true, type: "text", id: "top-content-hind-category", name: "top-content-hind-category", "data-tracking-id": "top-content-hind-category", value: resourceTitle, onChange: setResourceTitle })),
112
- React.createElement(ActionGroup, null,
113
- React.createElement(Button, { variant: "primary", onClick: onSaveContent, isDisabled: isSaving || isUndefined(selected), isLoading: isSaving, "data-tracking-id": "suggested-content-save-button" },
126
+ React.createElement(ActionGroup, { className: "pf-u-mt-sm" },
127
+ React.createElement(Button, { variant: "primary", onClick: onSaveContent, isDisabled: isSaving || isDisabled, isLoading: isSaving, "data-tracking-id": "suggested-content-save-button" },
114
128
  React.createElement(Trans, null, "Save")),
115
129
  React.createElement(Button, { variant: "link", onClick: () => onCancel(false) },
116
130
  React.createElement(Trans, null, "Cancel")))))));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/manage",
3
- "version": "1.0.40",
3
+ "version": "1.0.41",
4
4
  "description": "Customer Support Manage App",
5
5
  "author": "Jordan Eudy <jeudy100@gmail.com>",
6
6
  "homepage": "",
@@ -94,12 +94,12 @@
94
94
  "@patternfly/pfe-tabs": "1.12.3",
95
95
  "@patternfly/react-core": "4.264.0",
96
96
  "@patternfly/react-table": "4.111.33",
97
- "@rh-support/components": "1.2.21",
97
+ "@rh-support/components": "1.2.23",
98
98
  "@rh-support/configs": "1.0.3",
99
- "@rh-support/react-context": "1.0.29",
99
+ "@rh-support/react-context": "1.0.31",
100
100
  "@rh-support/types": "0.2.0",
101
- "@rh-support/user-permissions": "1.0.11",
102
- "@rh-support/utils": "1.0.9",
101
+ "@rh-support/user-permissions": "1.0.13",
102
+ "@rh-support/utils": "1.0.11",
103
103
  "@types/react-beautiful-dnd": "^13.0.0",
104
104
  "i18next": ">=17.0.1",
105
105
  "lodash": ">=4.17.15",
@@ -109,5 +109,5 @@
109
109
  "react-i18next": ">=10.11.0",
110
110
  "react-router-dom": ">=5.1.2"
111
111
  },
112
- "gitHead": "229815fdeca8ae5ce5b49996cfc7dd6ceb6dc5a8"
112
+ "gitHead": "5a6ac6cd2418495e7fdd0f48cfaa34a7c627635a"
113
113
  }