@rh-support/manage 0.2.44 → 0.2.62

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.
Files changed (58) hide show
  1. package/README.md +2 -0
  2. package/lib/esm/components/TopContentManagement/CategoryLimit/CategoryLimit.d.ts +4 -0
  3. package/lib/esm/components/TopContentManagement/CategoryLimit/CategoryLimit.d.ts.map +1 -0
  4. package/lib/esm/components/TopContentManagement/CategoryLimit/CategoryLimit.js +20 -0
  5. package/lib/esm/components/TopContentManagement/CategoryLimit/CategoryLimitGuidelines.d.ts +8 -0
  6. package/lib/esm/components/TopContentManagement/CategoryLimit/CategoryLimitGuidelines.d.ts.map +1 -0
  7. package/lib/esm/components/TopContentManagement/CategoryLimit/CategoryLimitGuidelines.js +17 -0
  8. package/lib/esm/components/TopContentManagement/CategoryLimit/QuestionAnswer.d.ts +7 -0
  9. package/lib/esm/components/TopContentManagement/CategoryLimit/QuestionAnswer.d.ts.map +1 -0
  10. package/lib/esm/components/TopContentManagement/CategoryLimit/QuestionAnswer.js +12 -0
  11. package/lib/esm/components/TopContentManagement/ContentUsage/ContentAccordion.d.ts +8 -0
  12. package/lib/esm/components/TopContentManagement/ContentUsage/ContentAccordion.d.ts.map +1 -0
  13. package/lib/esm/components/TopContentManagement/ContentUsage/ContentAccordion.js +37 -0
  14. package/lib/esm/components/TopContentManagement/ContentUsage/MajorVersionPerformanceMetrics.d.ts +12 -0
  15. package/lib/esm/components/TopContentManagement/ContentUsage/MajorVersionPerformanceMetrics.d.ts.map +1 -0
  16. package/lib/esm/components/TopContentManagement/ContentUsage/MajorVersionPerformanceMetrics.js +42 -0
  17. package/lib/esm/components/TopContentManagement/ContentUsage/NeedsAttention.d.ts +3 -0
  18. package/lib/esm/components/TopContentManagement/ContentUsage/NeedsAttention.d.ts.map +1 -0
  19. package/lib/esm/components/TopContentManagement/ContentUsage/NeedsAttention.js +8 -0
  20. package/lib/esm/components/TopContentManagement/ContentUsage/PerformanceMetricClickCount.d.ts +8 -0
  21. package/lib/esm/components/TopContentManagement/ContentUsage/PerformanceMetricClickCount.d.ts.map +1 -0
  22. package/lib/esm/components/TopContentManagement/ContentUsage/PerformanceMetricClickCount.js +32 -0
  23. package/lib/esm/components/TopContentManagement/ContentUsage/PerformanceMetrics.d.ts +12 -0
  24. package/lib/esm/components/TopContentManagement/ContentUsage/PerformanceMetrics.d.ts.map +1 -0
  25. package/lib/esm/components/TopContentManagement/ContentUsage/PerformanceMetrics.js +15 -0
  26. package/lib/esm/components/TopContentManagement/ContentUsage/PerformanceMetricsSelect.d.ts +13 -0
  27. package/lib/esm/components/TopContentManagement/ContentUsage/PerformanceMetricsSelect.d.ts.map +1 -0
  28. package/lib/esm/components/TopContentManagement/ContentUsage/PerformanceMetricsSelect.js +20 -0
  29. package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentCategory.d.ts.map +1 -1
  30. package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentCategory.js +4 -1
  31. package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentSingleItem.d.ts.map +1 -1
  32. package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentSingleItem.js +7 -5
  33. package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentSingleItemLink.d.ts +11 -0
  34. package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentSingleItemLink.d.ts.map +1 -0
  35. package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentSingleItemLink.js +20 -0
  36. package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentEditor.d.ts.map +1 -1
  37. package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentEditor.js +33 -20
  38. package/lib/esm/components/TopContentManagement/TopContentProductVersionSelector.d.ts +2 -0
  39. package/lib/esm/components/TopContentManagement/TopContentProductVersionSelector.d.ts.map +1 -1
  40. package/lib/esm/components/TopContentManagement/TopContentProductVersionSelector.js +1 -1
  41. package/lib/esm/constants/TopContent.d.ts +16 -0
  42. package/lib/esm/constants/TopContent.d.ts.map +1 -1
  43. package/lib/esm/constants/TopContent.js +16 -0
  44. package/lib/esm/context/TopContentProvider.d.ts.map +1 -1
  45. package/lib/esm/context/TopContentProvider.js +1 -0
  46. package/lib/esm/hooks/useVersionsDiffer.d.ts +8 -0
  47. package/lib/esm/hooks/useVersionsDiffer.d.ts.map +1 -0
  48. package/lib/esm/hooks/useVersionsDiffer.js +42 -0
  49. package/lib/esm/reducers/TopContentHelpers.d.ts +15 -0
  50. package/lib/esm/reducers/TopContentHelpers.d.ts.map +1 -1
  51. package/lib/esm/reducers/TopContentHelpers.js +49 -0
  52. package/lib/esm/reducers/TopContentReducer.d.ts +7 -2
  53. package/lib/esm/reducers/TopContentReducer.d.ts.map +1 -1
  54. package/lib/esm/reducers/TopContentReducer.js +34 -2
  55. package/lib/esm/scss/_main.scss +7 -0
  56. package/lib/esm/scss/_pf4-overrides.scss +67 -0
  57. package/lib/esm/scss/index.scss +11 -0
  58. package/package.json +11 -11
package/README.md CHANGED
@@ -9,3 +9,5 @@ const manage = require('manage');
9
9
 
10
10
  // TODO: DEMONSTRATE API
11
11
  ```
12
+
13
+ .
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ declare const CategoryLimit: FC;
3
+ export default CategoryLimit;
4
+ //# sourceMappingURL=CategoryLimit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CategoryLimit.d.ts","sourceRoot":"","sources":["../../../../../src/components/TopContentManagement/CategoryLimit/CategoryLimit.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AAK5C,QAAA,MAAM,aAAa,EAAE,EA8BpB,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { Button, Popover } from '@patternfly/react-core';
2
+ import CircleInfo from '@patternfly/react-icons/dist/js/icons/info-circle-icon';
3
+ import React, { useState } from 'react';
4
+ import { Trans } from 'react-i18next';
5
+ import { CategoryLimitGuidelines } from './CategoryLimitGuidelines';
6
+ const CategoryLimit = () => {
7
+ const [isModalOpen, setModalOpen] = useState(false);
8
+ const onHideModal = () => setModalOpen(false);
9
+ return (React.createElement(React.Fragment, null,
10
+ React.createElement(Popover, { "aria-label": "limit-reached-pop-over", headerContent: React.createElement(Trans, null, "Reached limit"), bodyContent: (hide) => (React.createElement(Trans, null,
11
+ "You have reached the limit for adding categories for this product and version.",
12
+ React.createElement("span", { className: "top-content-tooltip-view-metric-label", onClick: () => {
13
+ hide();
14
+ setModalOpen(true);
15
+ } }, "Review guidelines."))) },
16
+ React.createElement(Button, { variant: "plain" },
17
+ React.createElement(CircleInfo, { size: "md" }))),
18
+ React.createElement(CategoryLimitGuidelines, { isModalOpen: isModalOpen, onHideModal: onHideModal })));
19
+ };
20
+ export default CategoryLimit;
@@ -0,0 +1,8 @@
1
+ import { FC } from 'react';
2
+ interface IProps {
3
+ isModalOpen: boolean;
4
+ onHideModal: () => void;
5
+ }
6
+ export declare const CategoryLimitGuidelines: FC<IProps>;
7
+ export {};
8
+ //# sourceMappingURL=CategoryLimitGuidelines.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CategoryLimitGuidelines.d.ts","sourceRoot":"","sources":["../../../../../src/components/TopContentManagement/CategoryLimit/CategoryLimitGuidelines.tsx"],"names":[],"mappings":"AACA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAMlC,UAAU,MAAM;IACZ,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,MAAM,IAAI,CAAC;CAC3B;AACD,eAAO,MAAM,uBAAuB,EAAE,EAAE,CAAC,MAAM,CAoC9C,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { Button, ButtonVariant, Modal, ModalVariant, Title, TitleSizes } from '@patternfly/react-core';
2
+ import React from 'react';
3
+ import { Trans } from 'react-i18next';
4
+ import { CATEGORY_LIMIT, DIGIT_WORD_MAP } from '../../../constants/TopContent';
5
+ import QuestionAnswer from './QuestionAnswer';
6
+ export const CategoryLimitGuidelines = ({ isModalOpen, onHideModal }) => {
7
+ return (React.createElement(Modal, { variant: ModalVariant.medium, id: "top-content-category-limit-guidelines", "aria-label": "top-content-category-limit-guidelines", isOpen: isModalOpen, onClose: onHideModal, actions: [
8
+ React.createElement(Button, { variant: ButtonVariant.secondary, key: "close-button", onClick: onHideModal }, "Cancel"),
9
+ ] },
10
+ React.createElement(Title, { headingLevel: "h1", size: TitleSizes['2xl'] },
11
+ React.createElement(Trans, null, " Top content guideline ")),
12
+ React.createElement(Trans, null,
13
+ React.createElement("p", { className: "pf-u-pt-sm" }, "Guidelines and limitations for top content resources.")),
14
+ React.createElement(QuestionAnswer, { question: "What is top content?", answer: "Top content is defined as the top resource for given product and version that will provide the most value for our customer and the highest likelihood for case deflection." }),
15
+ React.createElement(QuestionAnswer, { question: "What is not top content", answer: "Resource that are accessible in other parts of the customer journey throughout the Customer Portal. For example, labs are not a top content resource. " }),
16
+ React.createElement(QuestionAnswer, { question: "Category and link restrictions", answer: `we allow for a minimum of ${DIGIT_WORD_MAP[CATEGORY_LIMIT.MIN]} and max ${DIGIT_WORD_MAP[CATEGORY_LIMIT.MAX]} categories, and links within each category.` })));
17
+ };
@@ -0,0 +1,7 @@
1
+ import { FC } from 'react';
2
+ declare const QuestionAnswer: FC<{
3
+ question: string;
4
+ answer: string;
5
+ }>;
6
+ export default QuestionAnswer;
7
+ //# sourceMappingURL=QuestionAnswer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuestionAnswer.d.ts","sourceRoot":"","sources":["../../../../../src/components/TopContentManagement/CategoryLimit/QuestionAnswer.tsx"],"names":[],"mappings":"AACA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGlC,QAAA,MAAM,cAAc,EAAE,EAAE,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAO5D,CAAC;AACF,eAAe,cAAc,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { Title } from '@patternfly/react-core';
2
+ import React from 'react';
3
+ import { Trans } from 'react-i18next';
4
+ const QuestionAnswer = ({ question, answer }) => (React.createElement("div", { className: "pf-u-pt-lg" },
5
+ React.createElement(Title, { headingLevel: "h6", size: "md" },
6
+ React.createElement(Trans, null,
7
+ " ",
8
+ question)),
9
+ React.createElement(Trans, null,
10
+ " ",
11
+ answer)));
12
+ export default QuestionAnswer;
@@ -0,0 +1,8 @@
1
+ import { FC } from 'react';
2
+ import { ITopContentItemState } from '../../../reducers/TopContentReducer';
3
+ interface IProps {
4
+ contentList: ITopContentItemState[];
5
+ }
6
+ export declare const ContentAccordion: FC<IProps>;
7
+ export {};
8
+ //# sourceMappingURL=ContentAccordion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentAccordion.d.ts","sourceRoot":"","sources":["../../../../../src/components/TopContentManagement/ContentUsage/ContentAccordion.tsx"],"names":[],"mappings":"AAUA,OAAc,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AAG5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAG3E,UAAU,MAAM;IACZ,WAAW,EAAE,oBAAoB,EAAE,CAAC;CACvC;AAED,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,MAAM,CAmEvC,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { Accordion, AccordionContent, AccordionItem, AccordionToggle, Panel, PanelMain, PanelMainBody, } from '@patternfly/react-core';
2
+ import { formatDate } from '@rh-support/utils';
3
+ import React, { useState } from 'react';
4
+ import { useTranslation } from 'react-i18next';
5
+ import { PerformanceMetricClickCount } from './PerformanceMetricClickCount';
6
+ export const ContentAccordion = ({ contentList }) => {
7
+ const [expanded, setExpanded] = useState(0);
8
+ const { t } = useTranslation();
9
+ const onToggle = (id) => () => {
10
+ if (id === expanded) {
11
+ setExpanded(0);
12
+ }
13
+ else {
14
+ setExpanded(id);
15
+ }
16
+ };
17
+ return (!!(contentList === null || contentList === void 0 ? void 0 : contentList.length) && (React.createElement("div", { className: "content" },
18
+ React.createElement(Panel, { variant: "bordered" },
19
+ React.createElement(PanelMain, null,
20
+ React.createElement(PanelMainBody, null,
21
+ React.createElement(Accordion, { isBordered: true }, contentList.map(({ contentTitle, topContentId, updatedOn, createdOn, updatedBy, createdBy, isAttentionNeeded, }) => {
22
+ const lastModifiedBy = t(`Last modified {{created}} by {{by}}`, {
23
+ created: formatDate(updatedOn || createdOn),
24
+ by: updatedBy || createdBy,
25
+ });
26
+ return (React.createElement(AccordionItem, { key: topContentId },
27
+ React.createElement(AccordionToggle, { onClick: onToggle(topContentId), isExpanded: expanded === topContentId, id: contentTitle },
28
+ React.createElement("span", { className: isAttentionNeeded ? 'pf-u-danger-color-200' : '' },
29
+ ' ',
30
+ contentTitle)),
31
+ React.createElement(AccordionContent, { id: contentTitle, isHidden: expanded !== topContentId },
32
+ React.createElement("span", { className: "pf-u-font-size-sm" }, lastModifiedBy),
33
+ React.createElement("br", null),
34
+ React.createElement("br", null),
35
+ React.createElement(PerformanceMetricClickCount, { needsAttention: isAttentionNeeded, contentId: topContentId }))));
36
+ }))))))));
37
+ };
@@ -0,0 +1,12 @@
1
+ import { FC } from 'react';
2
+ import { ITopContentEditState } from '../../../reducers/TopContentReducer';
3
+ interface IProps {
4
+ isModalOpen: boolean;
5
+ onHideModal: () => void;
6
+ filteredTC: ITopContentEditState[];
7
+ selectedMajorVersion: string;
8
+ selectedProduct: string;
9
+ }
10
+ export declare const MajorVersionPerformanceMetrics: FC<IProps>;
11
+ export {};
12
+ //# sourceMappingURL=MajorVersionPerformanceMetrics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MajorVersionPerformanceMetrics.d.ts","sourceRoot":"","sources":["../../../../../src/components/TopContentManagement/ContentUsage/MajorVersionPerformanceMetrics.tsx"],"names":[],"mappings":"AAWA,OAAc,EAAE,EAAE,EAAgC,MAAM,OAAO,CAAC;AAMhE,OAAO,EAAE,oBAAoB,EAAwB,MAAM,qCAAqC,CAAC;AAIjG,UAAU,MAAM;IACZ,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,UAAU,EAAE,oBAAoB,EAAE,CAAC;IACnC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,eAAe,EAAE,MAAM,CAAC;CAC3B;AACD,eAAO,MAAM,8BAA8B,EAAE,EAAE,CAAC,MAAM,CA6ErD,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { Button, ButtonVariant, Flex, FlexItem, Modal, ModalVariant, Title, TitleSizes, } from '@patternfly/react-core';
2
+ import React, { useEffect, useMemo, useState } from 'react';
3
+ import { Trans } from 'react-i18next';
4
+ import { useTopContentContext } from '../../../context/TopContentProvider';
5
+ import { useVersionsDiffer } from '../../../hooks/useVersionsDiffer';
6
+ import { flagContentUsage } from '../../../reducers/TopContentHelpers';
7
+ import { ContentAccordion } from './ContentAccordion';
8
+ import { PerformanceMetricsSelect } from './PerformanceMetricsSelect';
9
+ export const MajorVersionPerformanceMetrics = ({ isModalOpen, onHideModal, filteredTC, selectedMajorVersion, selectedProduct, }) => {
10
+ const [selectedVersion, setVersion] = useState(selectedMajorVersion.split('.x')[0]);
11
+ const [selectedCategory, setSelectedCategory] = useState('');
12
+ const [selectedContent, setSelectedContent] = useState([]);
13
+ const { categoryUsage } = useTopContentContext();
14
+ const flagContentEditState = useMemo(() => flagContentUsage(filteredTC, categoryUsage, selectedVersion), [filteredTC, categoryUsage, selectedVersion]);
15
+ const [isLoading, versionDifference] = useVersionsDiffer(selectedProduct, selectedMajorVersion.split('.x')[0]);
16
+ useEffect(() => {
17
+ var _a;
18
+ const filteredContent = ((_a = flagContentEditState.find((tc) => tc.categoryName === selectedCategory)) === null || _a === void 0 ? void 0 : _a.content) || [];
19
+ setSelectedContent(filteredContent);
20
+ }, [selectedVersion, selectedCategory, flagContentEditState]);
21
+ const onModalClose = () => {
22
+ setSelectedContent([]);
23
+ setVersion('');
24
+ setSelectedCategory('');
25
+ onHideModal();
26
+ };
27
+ return (React.createElement(Modal, { variant: ModalVariant.large, id: "top-content-major-version-performance-metric", "aria-label": "top-content-performance-metric", isOpen: isModalOpen, onClose: onModalClose, actions: [
28
+ React.createElement(Button, { variant: ButtonVariant.secondary, key: "close-button", onClick: onModalClose }, "Cancel"),
29
+ ] },
30
+ React.createElement("div", { className: "sticky-header" },
31
+ React.createElement(Title, { headingLevel: "h1", size: TitleSizes['2xl'] },
32
+ React.createElement(Trans, null, " Performance metrics ")),
33
+ React.createElement("p", { className: "pf-u-pt-sm" }, "Better understand the Performance for the top content resources."),
34
+ React.createElement("br", null),
35
+ React.createElement(Flex, { justifyContent: { default: 'justifyContentSpaceBetween' } },
36
+ React.createElement(FlexItem, { className: "pf-u-w-50 pf-u-pr-md", style: { marginRight: 'unset' } },
37
+ React.createElement(PerformanceMetricsSelect, { placeholderText: "select a version", title: `Version using ${selectedMajorVersion}`, onSelectCallback: (e, selectedOption) => setVersion(selectedOption), options: versionDifference, optionValue: (option) => option, isLoading: isLoading })),
38
+ React.createElement(FlexItem, { className: "pf-u-w-50 pf-u-pl-md" },
39
+ React.createElement(PerformanceMetricsSelect, { placeholderText: "select a category", title: "Categories", options: flagContentEditState, optionValue: (option) => option.categoryName, onSelectCallback: (e, selectedOption) => setSelectedCategory(selectedOption) })))),
40
+ React.createElement("br", null),
41
+ React.createElement(ContentAccordion, { contentList: selectedContent })));
42
+ };
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ export declare const NeedsAttention: FC;
3
+ //# sourceMappingURL=NeedsAttention.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NeedsAttention.d.ts","sourceRoot":"","sources":["../../../../../src/components/TopContentManagement/ContentUsage/NeedsAttention.tsx"],"names":[],"mappings":"AACA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGlC,eAAO,MAAM,cAAc,EAAE,EAe5B,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { Label, Tooltip } from '@patternfly/react-core';
2
+ import React from 'react';
3
+ import { Trans } from 'react-i18next';
4
+ export const NeedsAttention = () => {
5
+ return (React.createElement(Tooltip, { content: React.createElement(Trans, null, "Category is under performing. Please review the link and considering replacing with more applicable category.") },
6
+ React.createElement(Label, { color: "red" },
7
+ React.createElement(Trans, null, "Needs Attention"))));
8
+ };
@@ -0,0 +1,8 @@
1
+ import { FC } from 'react';
2
+ interface IProps {
3
+ contentId: number;
4
+ needsAttention: boolean;
5
+ }
6
+ export declare const PerformanceMetricClickCount: FC<IProps>;
7
+ export {};
8
+ //# sourceMappingURL=PerformanceMetricClickCount.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PerformanceMetricClickCount.d.ts","sourceRoot":"","sources":["../../../../../src/components/TopContentManagement/ContentUsage/PerformanceMetricClickCount.tsx"],"names":[],"mappings":"AASA,OAAc,EAAE,EAAE,EAAqB,MAAM,OAAO,CAAC;AAKrD,UAAU,MAAM;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,OAAO,CAAC;CAC3B;AAED,eAAO,MAAM,2BAA2B,EAAE,EAAE,CAAC,MAAM,CAmDlD,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { HelperText, HelperTextItem, Panel, PanelMain, PanelMainBody, ToggleGroup, ToggleGroupItem, } from '@patternfly/react-core';
2
+ import React, { useMemo, useState } from 'react';
3
+ import { Trans } from 'react-i18next';
4
+ import { useTopContentContext } from '../../../context/TopContentProvider';
5
+ export const PerformanceMetricClickCount = ({ contentId, needsAttention }) => {
6
+ const { categoryUsage, selectedVersion } = useTopContentContext();
7
+ const [selectedOption, setSelectedOption] = useState(0);
8
+ const topContentUsageMetrics = useMemo(() => {
9
+ var _a;
10
+ const resourceUsage = (_a = categoryUsage === null || categoryUsage === void 0 ? void 0 : categoryUsage[selectedVersion]) === null || _a === void 0 ? void 0 : _a.find(({ resourceEntityId }) => contentId === +resourceEntityId);
11
+ if (resourceUsage)
12
+ return [resourceUsage.clickCount30Days, resourceUsage.clickCount60Days, resourceUsage.clickCount90Days];
13
+ }, [contentId, categoryUsage, selectedVersion]);
14
+ const onSelect = (index) => () => {
15
+ setSelectedOption(index);
16
+ };
17
+ const count = (topContentUsageMetrics === null || topContentUsageMetrics === void 0 ? void 0 : topContentUsageMetrics[selectedOption]) || 0;
18
+ return (React.createElement(React.Fragment, null,
19
+ React.createElement(ToggleGroup, { "aria-label": "performance-usage-days-selector" },
20
+ React.createElement(ToggleGroupItem, { buttonId: "last-30-days", text: "Last 30 days", isSelected: selectedOption === 0, onChange: onSelect(0) }),
21
+ React.createElement(ToggleGroupItem, { buttonId: "last-60-days", text: "Last 60 days", isSelected: selectedOption === 1, onChange: onSelect(1) }),
22
+ React.createElement(ToggleGroupItem, { buttonId: "last-90-days", text: "Last 90 days", isSelected: selectedOption === 2, onChange: onSelect(2) })),
23
+ React.createElement(Panel, { variant: "bordered" },
24
+ React.createElement(PanelMain, null,
25
+ React.createElement(PanelMainBody, { className: "panel-body" },
26
+ React.createElement(HelperText, null,
27
+ React.createElement(HelperTextItem, { variant: needsAttention ? 'error' : 'default' },
28
+ React.createElement(Trans, { count: count },
29
+ "Clicked ",
30
+ { count },
31
+ " times"))))))));
32
+ };
@@ -0,0 +1,12 @@
1
+ import { FC } from 'react';
2
+ interface IProps {
3
+ isModalOpen: boolean;
4
+ onHideModal: () => void;
5
+ needsAttention: boolean;
6
+ contentId: number;
7
+ title: string;
8
+ lastModifiedBy: string;
9
+ }
10
+ export declare const PerformanceMetrics: FC<IProps>;
11
+ export {};
12
+ //# sourceMappingURL=PerformanceMetrics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PerformanceMetrics.d.ts","sourceRoot":"","sources":["../../../../../src/components/TopContentManagement/ContentUsage/PerformanceMetrics.tsx"],"names":[],"mappings":"AACA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAKlC,UAAU,MAAM;IACZ,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;CAC1B;AACD,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,MAAM,CAiCzC,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { Button, Modal, ModalVariant, Title, TitleSizes } from '@patternfly/react-core';
2
+ import React from 'react';
3
+ import { Trans } from 'react-i18next';
4
+ import { PerformanceMetricClickCount } from './PerformanceMetricClickCount';
5
+ export const PerformanceMetrics = ({ isModalOpen, onHideModal, needsAttention, contentId, title, lastModifiedBy, }) => {
6
+ return (React.createElement(Modal, { variant: ModalVariant.small, id: "top-content-performance-metric", "aria-label": "top-content-performance-metric", isOpen: isModalOpen, onClose: onHideModal, actions: [
7
+ React.createElement(Button, { variant: "secondary", key: "close-button", onClick: onHideModal }, "Cancel"),
8
+ ] },
9
+ React.createElement(Title, { headingLevel: "h1", size: TitleSizes['2xl'] },
10
+ React.createElement(Trans, null, " Performance metrics ")),
11
+ React.createElement("p", { className: "pf-u-pb-lg pf-u-pt-sm" }, "Better understand the Performance for the top content resources."),
12
+ React.createElement("div", { className: "pf-u-pb-xs top-content-tooltip-view-metric-label" }, title),
13
+ React.createElement("div", { className: "pf-u-pb-lg" }, lastModifiedBy),
14
+ React.createElement(PerformanceMetricClickCount, { needsAttention: needsAttention, contentId: contentId })));
15
+ };
@@ -0,0 +1,13 @@
1
+ import { SelectOptionObject } from '@patternfly/react-core';
2
+ import React, { FC } from 'react';
3
+ interface IProps {
4
+ placeholderText: string;
5
+ title: string;
6
+ onSelectCallback: (event: React.MouseEvent | React.ChangeEvent, value: string | SelectOptionObject, isPlaceholder?: boolean) => void;
7
+ options: Array<any>;
8
+ optionValue: (option: any) => string;
9
+ isLoading?: boolean;
10
+ }
11
+ export declare const PerformanceMetricsSelect: FC<IProps>;
12
+ export {};
13
+ //# sourceMappingURL=PerformanceMetricsSelect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PerformanceMetricsSelect.d.ts","sourceRoot":"","sources":["../../../../../src/components/TopContentManagement/ContentUsage/PerformanceMetricsSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwB,kBAAkB,EAAiB,MAAM,wBAAwB,CAAC;AACjG,OAAO,KAAK,EAAE,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AAG5C,UAAU,MAAM;IACZ,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,CACd,KAAK,EAAE,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,WAAW,EAC3C,KAAK,EAAE,MAAM,GAAG,kBAAkB,EAClC,aAAa,CAAC,EAAE,OAAO,KACtB,IAAI,CAAC;IACV,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACpB,WAAW,EAAE,CAAC,MAAM,KAAA,KAAK,MAAM,CAAC;IAChC,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,eAAO,MAAM,wBAAwB,EAAE,EAAE,CAAC,MAAM,CAsC/C,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { Select, SelectOption, SelectVariant } from '@patternfly/react-core';
2
+ import React, { useState } from 'react';
3
+ import { Trans } from 'react-i18next';
4
+ export const PerformanceMetricsSelect = ({ placeholderText, title, onSelectCallback, options, optionValue, isLoading = false, }) => {
5
+ const [isOpen, setOpen] = useState(false);
6
+ const [selected, setSelected] = useState(null);
7
+ const onToggle = (isOpen) => setOpen(isOpen);
8
+ const onSelect = (e, selected) => {
9
+ setSelected(selected);
10
+ onSelectCallback(e, selected);
11
+ setOpen(false);
12
+ };
13
+ return (React.createElement(React.Fragment, null,
14
+ React.createElement("div", { className: "pf-u-font-weight-bold" },
15
+ React.createElement(Trans, null,
16
+ " ",
17
+ title,
18
+ " ")),
19
+ React.createElement(Select, { variant: SelectVariant.single, placeholderText: placeholderText, "aria-label": "Select Input with descriptions", onToggle: onToggle, onSelect: onSelect, selections: selected, isOpen: isOpen, disabled: isLoading }, options.map((option, index) => (React.createElement(SelectOption, { key: index, value: optionValue(option) }))))));
20
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"TopContentCategory.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentCategory.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAmD,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAGhF,OAAO,EAAgB,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAG5F,UAAU,MAAM;IACZ,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,QAAQ,EAAE,sBAAsB,CAAC;IACjC,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;CAClC;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,eAgE/C"}
1
+ {"version":3,"file":"TopContentCategory.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentCategory.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAmD,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAGhF,OAAO,EAAgB,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAI5F,UAAU,MAAM;IACZ,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,QAAQ,EAAE,sBAAsB,CAAC;IACjC,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;CAClC;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,eAgE/C"}
@@ -5,6 +5,7 @@ import { scrollIntoView } from '@rh-support/utils';
5
5
  import React, { useCallback, useEffect, useRef, useState } from 'react';
6
6
  import { useTranslation } from 'react-i18next';
7
7
  import { CategoryMode } from '../../../../reducers/TopContentReducer';
8
+ import { NeedsAttention } from '../../ContentUsage/NeedsAttention';
8
9
  import { TopContentComponent } from './TopContentComponent';
9
10
  export function TopContentCategory(props) {
10
11
  const { globalMetadataState: { navBarRef }, } = useGlobalStateContext();
@@ -36,7 +37,9 @@ export function TopContentCategory(props) {
36
37
  React.createElement(AccordionToggle, { id: props.category.categoryName, onClick: toggleExpanded, isExpanded: isExpanded },
37
38
  React.createElement("h3", { ref: headerRef },
38
39
  props.isArrangingCats && (React.createElement(GripVerticalIcon, { style: { cursor: 'move' }, title: t('Drag'), size: "sm", className: "pf-u-mr-sm" })),
39
- props.category.categoryName)),
40
+ props.category.categoryName,
41
+ " ",
42
+ props.category.isAttentionNeeded && React.createElement(NeedsAttention, null))),
40
43
  React.createElement(AccordionContent, { isHidden: !isExpanded },
41
44
  React.createElement(TopContentComponent, { category: props.category, scrollToTop: scrollToTop, categoryMode: CategoryMode.EXISTING_SECTION }))))));
42
45
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TopContentSingleItem.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentSingleItem.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAK7D,OAAO,EAIH,oBAAoB,EAOvB,MAAM,wCAAwC,CAAC;AAGhD,UAAU,MAAM;IACZ,kBAAkB,EAAE,OAAO,CAAC;IAC5B,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,QAAQ,EAAE,sBAAsB,CAAC;IACjC,CAAC,EAAE,MAAM,CAAC;CACb;AAaD,eAAO,MAAM,oBAAoB,kDAAmD,MAAM,gBAgYzF,CAAC"}
1
+ {"version":3,"file":"TopContentSingleItem.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentSingleItem.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAK7D,OAAO,EAIH,oBAAoB,EAOvB,MAAM,wCAAwC,CAAC;AAIhD,UAAU,MAAM;IACZ,kBAAkB,EAAE,OAAO,CAAC;IAC5B,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,QAAQ,EAAE,sBAAsB,CAAC;IACjC,CAAC,EAAE,MAAM,CAAC;CACb;AAaD,eAAO,MAAM,oBAAoB,kDAAmD,MAAM,gBA4XzF,CAAC"}
@@ -21,6 +21,7 @@ import { useTopContentContext, useTopContentDispatchContext } from '../../../../
21
21
  import { getTopContentUrl } from '../../../../reducers/TopContentHelpers';
22
22
  import { ContentMode, deleteTopContent, fetchTopContent, removeTopContent, saveAddedNewSectionContents, saveAddToTopContent, saveChangeInCategoryContent, setIsAddingCategory, } from '../../../../reducers/TopContentReducer';
23
23
  import { AddNewCategoryDropDown } from './AddNewCategoryDropDown';
24
+ import { TopContentSingleItemLink } from './TopContentSingleItemLink';
24
25
  function formatDuplicateWarning(arr) {
25
26
  if (arr.length === 0 || arr.length === 1)
26
27
  return arr;
@@ -240,17 +241,18 @@ export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i
240
241
  const isSaveButtonDisabled = !(contentTitleIsValid && contentUrlIsValid && localContentTitle && localContentUrl) ||
241
242
  (!newCategory && content.mode === ContentMode.NEW_SECTION_CONTENT) ||
242
243
  (localContentUrl === content.contentUrl && localContentTitle === content.contentTitle);
244
+ const lastModifiedBy = t(`Last modified {{created}} by {{by}}`, {
245
+ created: formatDate(content.updatedOn || content.createdOn),
246
+ by: content.updatedBy || content.createdBy,
247
+ });
243
248
  return (React.createElement(React.Fragment, null,
244
249
  isPreview && content.mode !== ContentMode.ADD && content.mode !== ContentMode.NEW_SECTION_CONTENT && (React.createElement("li", { className: `push-bottom-narrow ${snapshot.isDragging ? 'list-flat tc-drag' : ''}` },
245
250
  isArrangingContent && (React.createElement(GripVerticalIcon, { style: { cursor: 'move' }, title: t('Drag'), color: "#06c", size: "sm", className: "pf-u-mr-sm" })),
246
251
  !isArrangingContent ? (React.createElement(React.Fragment, null,
247
- React.createElement("a", { className: "pcm-manage-top-content", "data-tracking-id": "pcm-manage-top-content", href: getTopContentUrl(content.contentUrl), target: "_blank", rel: "noopener noreferrer" }, content.contentTitle),
252
+ React.createElement(TopContentSingleItemLink, { url: getTopContentUrl(content.contentUrl), title: content.contentTitle, contentId: content.topContentId, needsAttention: content.isAttentionNeeded, lastModifiedBy: lastModifiedBy }),
248
253
  ' ',
249
254
  React.createElement(Button, { variant: "link", isInline: true, icon: React.createElement(EditAltIcon, null), onClick: editToggle, title: 'Edit' }))) : (content.contentTitle),
250
- React.createElement("div", null, t(`Last modified {{created}} by {{by}}`, {
251
- created: formatDate(content.updatedOn || content.createdOn),
252
- by: content.updatedBy || content.createdBy,
253
- })))),
255
+ React.createElement("div", null, lastModifiedBy))),
254
256
  (!isPreview || content.mode === ContentMode.ADD || content.mode === ContentMode.NEW_SECTION_CONTENT) && (React.createElement("form", { noValidate: true, onSubmit: onSubmit, className: "card card-light push-bottom" },
255
257
  content.mode === ContentMode.NEW_SECTION_CONTENT && (React.createElement(AddNewCategoryDropDown, { onCategoryChange: onAddedNewCategoryChange })),
256
258
  React.createElement("div", { className: "form-group" },
@@ -0,0 +1,11 @@
1
+ import { FC } from 'react';
2
+ interface IProps {
3
+ title: string;
4
+ url: string;
5
+ needsAttention?: boolean;
6
+ contentId?: number;
7
+ lastModifiedBy: string;
8
+ }
9
+ export declare const TopContentSingleItemLink: FC<IProps>;
10
+ export {};
11
+ //# sourceMappingURL=TopContentSingleItemLink.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TopContentSingleItemLink.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentSingleItemLink.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AAK5C,UAAU,MAAM;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;CAC1B;AAED,eAAO,MAAM,wBAAwB,EAAE,EAAE,CAAC,MAAM,CAgD/C,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { Button, Tooltip } from '@patternfly/react-core';
2
+ import ExclamationTriangle from '@patternfly/react-icons/dist/js/icons/exclamation-triangle-icon';
3
+ import React, { useState } from 'react';
4
+ import { Trans } from 'react-i18next';
5
+ import { PerformanceMetrics } from '../../ContentUsage/PerformanceMetrics';
6
+ export const TopContentSingleItemLink = ({ title, url, needsAttention = false, contentId, lastModifiedBy, }) => {
7
+ const [isModalOpen, setModalOpen] = useState(false);
8
+ const onHideModal = () => setModalOpen(false);
9
+ const onOpenModal = () => setModalOpen(true);
10
+ const content = (React.createElement(React.Fragment, null,
11
+ React.createElement(Trans, null, " Performance is low. This link will be removed in 7 days."),
12
+ React.createElement("span", { onClick: onOpenModal, style: { color: 'var(--pf-global--primary-color--100)' } },
13
+ React.createElement(Trans, null, "View performance metrics"))));
14
+ return (React.createElement(React.Fragment, null,
15
+ needsAttention && (React.createElement(Tooltip, { content: content, exitDelay: 500 },
16
+ React.createElement(Button, { variant: "plain", className: "top-content-tooltip" },
17
+ React.createElement(ExclamationTriangle, null)))),
18
+ React.createElement("a", { className: needsAttention ? 'top-content-needs-attention' : 'pcm-manage-top-content', "data-tracking-id": "pcm-manage-top-content", href: url, target: "_blank", rel: "noopener noreferrer" }, title),
19
+ React.createElement(PerformanceMetrics, { isModalOpen: isModalOpen, onHideModal: onHideModal, needsAttention: needsAttention, contentId: contentId, title: title, lastModifiedBy: lastModifiedBy })));
20
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"TopContentEditor.d.ts","sourceRoot":"","sources":["../../../../../src/components/TopContentManagement/TopContentEditor/TopContentEditor.tsx"],"names":[],"mappings":"AAuCA,wBAAgB,gBAAgB,gBAqR/B"}
1
+ {"version":3,"file":"TopContentEditor.d.ts","sourceRoot":"","sources":["../../../../../src/components/TopContentManagement/TopContentEditor/TopContentEditor.tsx"],"names":[],"mappings":"AA2CA,wBAAgB,gBAAgB,gBAoT/B"}
@@ -11,11 +11,15 @@ import { Accordion, Alert, AlertVariant, Bullseye, Button, EmptyState, EmptyStat
11
11
  import { ToastNotification, TopContentSearch } from '@rh-support/components';
12
12
  import { getVersion, isRegularVersion } from '@rh-support/utils';
13
13
  import isEmpty from 'lodash/isEmpty';
14
- import React, { useEffect, useRef, useState } from 'react';
14
+ import React, { useEffect, useMemo, useRef, useState } from 'react';
15
15
  import { DragDropContext, Draggable, Droppable } from 'react-beautiful-dnd';
16
16
  import { Trans, useTranslation } from 'react-i18next';
17
+ import { CATEGORY_LIMIT } from '../../../constants/TopContent';
17
18
  import { useTopContentContext, useTopContentDispatchContext } from '../../../context/TopContentProvider';
19
+ import { flagContentUsage, isMajorVersion } from '../../../reducers/TopContentHelpers';
18
20
  import { CategoryMode, fetchTopContent, reArrangeCategory, resetChangeInCategory, resetContentWithSelectedProduct, resetDuplicatUrls, setAddNewSection, setIsAddingCategory, setIsSearchModeEnabled, setTopContentArrangingCategory, setTopContentArrangingContent, } from '../../../reducers/TopContentReducer';
21
+ import CategoryLimit from '../CategoryLimit/CategoryLimit';
22
+ import { MajorVersionPerformanceMetrics } from '../ContentUsage/MajorVersionPerformanceMetrics';
19
23
  import { NoTopContentFound } from '../NoTopContentFound';
20
24
  import { TopContentHeader } from '../TopContentHeader';
21
25
  import { TopContentProductVersionSelector } from '../TopContentProductVersionSelector';
@@ -27,26 +31,30 @@ export function TopContentEditor() {
27
31
  const [isArrangingCats, setIsArrangingCats] = useState(false);
28
32
  const [newCategoryVersion, setNewCategoryVersion] = useState(undefined);
29
33
  const topContentResultsRef = useRef(null);
30
- const { topContentResponse, topContentEditState, isAddingCategory, isCatOnlyForMajorVersion, isSearchModeEnabled, selectedProduct, selectedVersion, } = useTopContentContext();
34
+ const { topContentResponse, topContentEditState, isAddingCategory, isCatOnlyForMajorVersion, isSearchModeEnabled, selectedProduct, selectedVersion, categoryUsage, } = useTopContentContext();
31
35
  const topContentDispatch = useTopContentDispatchContext();
32
- const [filteredTC, setFilteredTC] = useState(topContentEditState);
36
+ const flagContentEditState = useMemo(() => flagContentUsage(topContentEditState, categoryUsage, selectedVersion), [topContentEditState, categoryUsage, selectedVersion]);
37
+ const [filteredTC, setFilteredTC] = useState(flagContentEditState);
33
38
  const onProductChange = (selectedProduct) => {
34
39
  resetContentWithSelectedProduct(topContentDispatch, selectedProduct);
35
40
  };
41
+ const [isModalOpen, setModalOpen] = useState(false);
42
+ const onHideModal = () => setModalOpen(false);
43
+ const onOpenModal = () => setModalOpen(true);
36
44
  const onVersionChange = (selectedVersion) => {
37
45
  if (!selectedVersion)
38
46
  return;
39
47
  fetchTopContent(topContentDispatch, selectedProduct, selectedVersion);
40
48
  };
41
49
  useEffect(() => {
42
- !isSearchModeEnabled && setFilteredTC(topContentEditState);
50
+ !isSearchModeEnabled && setFilteredTC(flagContentEditState);
43
51
  // eslint-disable-next-line react-hooks/exhaustive-deps
44
- }, [topContentEditState]);
52
+ }, [flagContentEditState]);
45
53
  const onAddCategory = (isMajorVersionOnly, isCreatingNewSet = false, version, hasMajorContentCreatingMinorContent) => {
46
54
  hasMajorContentCreatingMinorContent && resetDuplicatUrls(topContentDispatch);
47
55
  setCategoryToOpen(null);
48
56
  setIsAddingCategory(topContentDispatch, true);
49
- setAddNewSection(topContentDispatch, topContentEditState, isMajorVersionOnly, isCreatingNewSet);
57
+ setAddNewSection(topContentDispatch, flagContentEditState, isMajorVersionOnly, isCreatingNewSet);
50
58
  setNewCategoryVersion(version);
51
59
  };
52
60
  const arrangeSection = () => {
@@ -55,7 +63,7 @@ export function TopContentEditor() {
55
63
  const onSaveArrangement = () => __awaiter(this, void 0, void 0, function* () {
56
64
  setIsArrangingCats(false);
57
65
  try {
58
- yield reArrangeCategory(topContentEditState);
66
+ yield reArrangeCategory(flagContentEditState);
59
67
  ToastNotification.addSuccessMessage(t('Categories updated successfully'));
60
68
  }
61
69
  catch (error) {
@@ -72,24 +80,24 @@ export function TopContentEditor() {
72
80
  if (!result.destination || result.source.index === result.destination.index)
73
81
  return;
74
82
  if (result.destination.droppableId === 'content-editor-cat-drop-zone') {
75
- setTopContentArrangingCategory(topContentDispatch, topContentEditState, result.source.index, result.destination.index);
83
+ setTopContentArrangingCategory(topContentDispatch, flagContentEditState, result.source.index, result.destination.index);
76
84
  }
77
85
  else {
78
86
  // pass categoryID as a part of dropabbleId
79
- setTopContentArrangingContent(topContentDispatch, topContentEditState, result.destination.droppableId, result.source.index, result.destination.index);
87
+ setTopContentArrangingContent(topContentDispatch, flagContentEditState, result.destination.droppableId, result.source.index, result.destination.index);
80
88
  }
81
89
  };
82
- const showNoTopContentFound = (isEmpty(selectedProduct.name) || isEmpty(selectedVersion) || topContentEditState.length === 0) &&
90
+ const showNoTopContentFound = (isEmpty(selectedProduct.name) || isEmpty(selectedVersion) || flagContentEditState.length === 0) &&
83
91
  !topContentResponse.isError &&
84
92
  !topContentResponse.isFetching &&
85
93
  !isAddingCategory;
86
94
  const showSectionFooter = !isArrangingCats &&
87
95
  !isAddingCategory &&
88
96
  selectedVersion &&
89
- topContentEditState.length !== 0 &&
97
+ flagContentEditState.length !== 0 &&
90
98
  !isSearchModeEnabled;
91
99
  const isContentOnlyForMajorVersion = !topContentResponse.isFetching &&
92
- topContentEditState.length !== 0 &&
100
+ flagContentEditState.length !== 0 &&
93
101
  isRegularVersion(selectedVersion) &&
94
102
  isCatOnlyForMajorVersion &&
95
103
  !isAddingCategory;
@@ -97,18 +105,19 @@ export function TopContentEditor() {
97
105
  setIsSearchModeEnabled(topContentDispatch, searchTerm ? true : false);
98
106
  setFilteredTC(searchResults);
99
107
  };
100
- const minorSelectedNoMinorContentButAvailableMajorContent = isContentOnlyForMajorVersion && getVersion(selectedVersion).minor && topContentEditState.length !== 0;
108
+ const minorSelectedNoMinorContentButAvailableMajorContent = isContentOnlyForMajorVersion && getVersion(selectedVersion).minor && flagContentEditState.length !== 0;
109
+ const isCategoryLimitReached = filteredTC.length >= CATEGORY_LIMIT.MAX;
101
110
  return (React.createElement(React.Fragment, null,
102
111
  React.createElement(TopContentHeader, null),
103
112
  !topContentResponse.isFetching && topContentResponse.isError && (React.createElement(Alert, { isInline: true, variant: AlertVariant.danger, title: React.createElement(Trans, null, "Error loading Top Content") })),
104
113
  React.createElement(TopContentProductVersionSelector, { selectedProduct: selectedProduct, selectedVersion: selectedVersion, onProductChange: onProductChange, onVersionChange: onVersionChange }),
105
- !topContentResponse.isFetching && (React.createElement(TopContentSearch, { dataTrackingId: "top-content-filter-manage", topContentData: topContentEditState, onSearch: onSearch, topContentResultsWrapperRef: topContentResultsRef })),
114
+ !topContentResponse.isFetching && (React.createElement(TopContentSearch, { dataTrackingId: "top-content-filter-manage", topContentData: flagContentEditState, onSearch: onSearch, topContentResultsWrapperRef: topContentResultsRef })),
106
115
  React.createElement("div", { className: "top-content-manage-wrapper" },
107
116
  topContentResponse.isFetching ? (React.createElement(Bullseye, null,
108
117
  React.createElement(EmptyState, { variant: EmptyStateVariant.full },
109
118
  React.createElement(Spinner, { size: "lg" })))) : (!topContentResponse.isFetching &&
110
- showNoTopContentFound && (React.createElement(NoTopContentFound, { version: selectedVersion, product: selectedProduct.name, dataLength: topContentEditState.length, onAddCategory: onAddCategory, isContentOnlyForMajorVersion: isContentOnlyForMajorVersion }))),
111
- minorSelectedNoMinorContentButAvailableMajorContent ? (React.createElement(NoTopContentFound, { version: selectedVersion, product: selectedProduct.name, dataLength: topContentEditState.length, onAddCategory: onAddCategory, onVersionChange: onVersionChange, isContentOnlyForMajorVersion: isContentOnlyForMajorVersion })) : (React.createElement(DragDropContext, { onDragEnd: onDragEnd },
119
+ showNoTopContentFound && (React.createElement(NoTopContentFound, { version: selectedVersion, product: selectedProduct.name, dataLength: flagContentEditState.length, onAddCategory: onAddCategory, isContentOnlyForMajorVersion: isContentOnlyForMajorVersion }))),
120
+ minorSelectedNoMinorContentButAvailableMajorContent ? (React.createElement(NoTopContentFound, { version: selectedVersion, product: selectedProduct.name, dataLength: flagContentEditState.length, onAddCategory: onAddCategory, onVersionChange: onVersionChange, isContentOnlyForMajorVersion: isContentOnlyForMajorVersion })) : (React.createElement(DragDropContext, { onDragEnd: onDragEnd },
112
121
  React.createElement(Droppable, { droppableId: "content-editor-cat-drop-zone" }, (provided) => (React.createElement("div", Object.assign({}, provided.droppableProps, { ref: (el) => {
113
122
  provided.innerRef(el);
114
123
  topContentResultsRef.current = el;
@@ -126,15 +135,19 @@ export function TopContentEditor() {
126
135
  provided.placeholder),
127
136
  React.createElement("div", { className: "pf-u-p-md" },
128
137
  showSectionFooter && (React.createElement(React.Fragment, null,
129
- React.createElement(Button, { variant: "primary", onClick: () => onAddCategory(isContentOnlyForMajorVersion, false, selectedVersion), "data-tracking-id": "add-new-section-topcontent" },
138
+ isCategoryLimitReached && React.createElement(CategoryLimit, null),
139
+ React.createElement(Button, { variant: "primary", onClick: () => onAddCategory(isContentOnlyForMajorVersion, false, selectedVersion), isDisabled: isCategoryLimitReached, "data-tracking-id": "add-new-section-topcontent" },
130
140
  React.createElement(Trans, null, "Add a new section")),
131
141
  ' ',
132
- React.createElement(Button, { variant: "secondary", onClick: arrangeSection, isDisabled: topContentEditState.length < 2 },
133
- React.createElement(Trans, null, "Arrange section")))),
142
+ React.createElement(Button, { variant: "secondary", onClick: arrangeSection, isDisabled: flagContentEditState.length < 2 },
143
+ React.createElement(Trans, null, "Arrange section")),
144
+ isMajorVersion(selectedVersion) && (React.createElement(Button, { variant: "link", className: "pf-u-float-right", isInline: true, onClick: onOpenModal },
145
+ React.createElement(Trans, null, "View performance"))))),
134
146
  isArrangingCats && (React.createElement(React.Fragment, null,
135
147
  React.createElement(Button, { variant: "primary", onClick: onSaveArrangement },
136
148
  React.createElement(Trans, null, "Save")),
137
149
  ' ',
138
150
  React.createElement(Button, { variant: "link", onClick: onCancelArrangement },
139
- React.createElement(Trans, null, "Cancel")))))))))))));
151
+ React.createElement(Trans, null, "Cancel")))))))))),
152
+ React.createElement(MajorVersionPerformanceMetrics, { isModalOpen: isModalOpen, onHideModal: onHideModal, filteredTC: filteredTC, selectedMajorVersion: selectedVersion, selectedProduct: selectedProduct.name }))));
140
153
  }
@@ -1,3 +1,4 @@
1
+ import { IItemResponse } from '@cee-eng/hydrajs/@types/models/general';
1
2
  import { IProduct as IHydraProduct } from '@cee-eng/hydrajs/@types/models/product';
2
3
  import { IDClassNameProps } from '@rh-support/types/shared';
3
4
  interface IProps extends IDClassNameProps {
@@ -7,6 +8,7 @@ interface IProps extends IDClassNameProps {
7
8
  onVersionChange: (version: string) => void;
8
9
  htmlForId: string;
9
10
  }
11
+ export declare function postVersionsProcessor(versionItems: IItemResponse<string[]>): IItemResponse<string[]>;
10
12
  declare function TopContentProductVersionSelector(props: IProps): JSX.Element;
11
13
  declare namespace TopContentProductVersionSelector {
12
14
  var defaultProps: Partial<IProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"TopContentProductVersionSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/TopContentManagement/TopContentProductVersionSelector.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAEnF,OAAO,EAAE,gBAAgB,EAAW,MAAM,0BAA0B,CAAC;AASrE,UAAU,MAAO,SAAQ,gBAAgB;IACrC,eAAe,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IACxC,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;IAC3D,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,SAAS,EAAE,MAAM,CAAC;CACrB;AAgCD,iBAAS,gCAAgC,CAAC,KAAK,EAAE,MAAM,eA4HtD;kBA5HQ,gCAAgC;;;AA+HzC,OAAO,EAAE,gCAAgC,EAAE,CAAC"}
1
+ {"version":3,"file":"TopContentProductVersionSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/TopContentManagement/TopContentProductVersionSelector.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAEnF,OAAO,EAAE,gBAAgB,EAAW,MAAM,0BAA0B,CAAC;AASrE,UAAU,MAAO,SAAQ,gBAAgB;IACrC,eAAe,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IACxC,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;IAC3D,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,SAAS,EAAE,MAAM,CAAC;CACrB;AAQD,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,aAAa,CAAC,MAAM,EAAE,CAAC,2BAG1E;AAqBD,iBAAS,gCAAgC,CAAC,KAAK,EAAE,MAAM,eA4HtD;kBA5HQ,gCAAgC;;;AA+HzC,OAAO,EAAE,gCAAgC,EAAE,CAAC"}
@@ -11,7 +11,7 @@ const defaultProps = {
11
11
  className: '',
12
12
  id: '',
13
13
  };
14
- function postVersionsProcessor(versionItems) {
14
+ export function postVersionsProcessor(versionItems) {
15
15
  versionItems.items = getProcessedVersions(getUniqueSortedVersions(versionItems.items));
16
16
  return versionItems;
17
17
  }
@@ -1,2 +1,18 @@
1
1
  export declare const TopContentCategories: readonly string[];
2
+ export declare const DIGIT_WORD_MAP: {
3
+ 1: string;
4
+ 2: string;
5
+ 3: string;
6
+ 4: string;
7
+ 5: string;
8
+ 6: string;
9
+ 7: string;
10
+ 8: string;
11
+ 9: string;
12
+ 10: string;
13
+ };
14
+ export declare const CATEGORY_LIMIT: {
15
+ MIN: number;
16
+ MAX: number;
17
+ };
2
18
  //# sourceMappingURL=TopContent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TopContent.d.ts","sourceRoot":"","sources":["../../../src/constants/TopContent.tsx"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,mBA4B/B,CAAC"}
1
+ {"version":3,"file":"TopContent.d.ts","sourceRoot":"","sources":["../../../src/constants/TopContent.tsx"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,mBA4B/B,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;CAW1B,CAAC;AAEF,eAAO,MAAM,cAAc;;;CAG1B,CAAC"}
@@ -27,3 +27,19 @@ export const TopContentCategories = Object.freeze([
27
27
  'Troubleshooting basics',
28
28
  'Troubleshooting or monitoring',
29
29
  ]);
30
+ export const DIGIT_WORD_MAP = {
31
+ 1: 'one',
32
+ 2: 'two',
33
+ 3: 'three',
34
+ 4: 'four',
35
+ 5: 'five',
36
+ 6: 'six',
37
+ 7: 'seven',
38
+ 8: 'eight',
39
+ 9: 'nine',
40
+ 10: 'ten',
41
+ };
42
+ export const CATEGORY_LIMIT = {
43
+ MIN: 2,
44
+ MAX: 7,
45
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"TopContentProvider.d.ts","sourceRoot":"","sources":["../../../src/context/TopContentProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAiC,MAAM,OAAO,CAAC;AAEtD,OAAO,EAAE,gBAAgB,EAAqB,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AAEnH,eAAO,MAAM,uBAAuB,EAAE,gBAYrC,CAAC;AAGF,eAAO,MAAM,sBAAsB,iCAAiE,CAAC;AACrG,eAAO,MAAM,yBAAyB,8CAA6C,CAAC;AAEpF,wBAAgB,oBAAoB,qBAMnC;AAED,wBAAgB,4BAA4B,kCAM3C;AAED,wBAAgB,yBAAyB,CAAC,EAAE,QAAQ,EAAE;;CAAA,eAOrD"}
1
+ {"version":3,"file":"TopContentProvider.d.ts","sourceRoot":"","sources":["../../../src/context/TopContentProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAiC,MAAM,OAAO,CAAC;AAEtD,OAAO,EAAE,gBAAgB,EAAqB,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AAEnH,eAAO,MAAM,uBAAuB,EAAE,gBAarC,CAAC;AAGF,eAAO,MAAM,sBAAsB,iCAAiE,CAAC;AACrG,eAAO,MAAM,yBAAyB,8CAA6C,CAAC;AAEpF,wBAAgB,oBAAoB,qBAMnC;AAED,wBAAgB,4BAA4B,kCAM3C;AAED,wBAAgB,yBAAyB,CAAC,EAAE,QAAQ,EAAE;;CAAA,eAOrD"}
@@ -13,6 +13,7 @@ export const intialTopContentContext = {
13
13
  categories: getApiResourceObject([]),
14
14
  contentUrls: {},
15
15
  isSearchModeEnabled: false,
16
+ categoryUsage: {},
16
17
  };
17
18
  const initalDispatchContext = null;
18
19
  export const TopContentStateContext = React.createContext(intialTopContentContext);
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This hook is used for to differentiate actual versions of product from versions with top content
3
+ * @param {string} selectedProductName Selected product name
4
+ * @param {string} selectedMajorVersion Selected version
5
+ * @returns {[boolean, String[]]} Loading status and differentiated list of versions
6
+ */
7
+ export declare const useVersionsDiffer: (selectedProductName: string, selectedMajorVersion: string) => [boolean, String[]];
8
+ //# sourceMappingURL=useVersionsDiffer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useVersionsDiffer.d.ts","sourceRoot":"","sources":["../../../src/hooks/useVersionsDiffer.tsx"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,wBAAyB,MAAM,wBAAwB,MAAM,KAAG,CAAC,OAAO,EAAE,MAAM,EAAE,CA6C/G,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { pcm, products as productsApi } from '@cee-eng/hydrajs';
2
+ import { useFetch } from '@rh-support/components';
3
+ import { difference } from 'lodash';
4
+ import { useEffect, useState } from 'react';
5
+ import { postVersionsProcessor } from '../components/TopContentManagement/TopContentProductVersionSelector';
6
+ /**
7
+ * This hook is used for to differentiate actual versions of product from versions with top content
8
+ * @param {string} selectedProductName Selected product name
9
+ * @param {string} selectedMajorVersion Selected version
10
+ * @returns {[boolean, String[]]} Loading status and differentiated list of versions
11
+ */
12
+ export const useVersionsDiffer = (selectedProductName, selectedMajorVersion) => {
13
+ const [majorVersion, setMajorVersion] = useState([]);
14
+ // Get selected product version
15
+ // Note we need to call version API again over here because TopContentProductVersionSelector is having version at component state level and if we decide to
16
+ // use it lot of prop drilling will happen or if use lift that state to redux store code refactoring required
17
+ const { request: getProductVersions, isFetching: isLoadingVersions, data: versions, } = useFetch(productsApi.getProductVersions, { initialData: [], postProcessor: postVersionsProcessor });
18
+ // Get versions who are having top content
19
+ const { request: getTopContentVersions, isFetching: isTopContentVersion, data: topContentVersion, } = useFetch(pcm.topContent.getTopContentVersions, {
20
+ initialData: [],
21
+ postProcessor: (a) => a,
22
+ });
23
+ useEffect(() => {
24
+ if (selectedProductName && selectedMajorVersion) {
25
+ getProductVersions(selectedProductName);
26
+ getTopContentVersions({
27
+ productName: selectedProductName,
28
+ majorVersion: +selectedMajorVersion,
29
+ });
30
+ }
31
+ // eslint-disable-next-line react-hooks/exhaustive-deps
32
+ }, [selectedProductName, selectedMajorVersion]);
33
+ // In this effect we are calculating and finding difference between original version list and version with top content
34
+ useEffect(() => {
35
+ var _a, _b;
36
+ if (((_a = versions === null || versions === void 0 ? void 0 : versions.items) === null || _a === void 0 ? void 0 : _a.length) && (topContentVersion === null || topContentVersion === void 0 ? void 0 : topContentVersion.length)) {
37
+ const subVersions = (_b = versions === null || versions === void 0 ? void 0 : versions.items) === null || _b === void 0 ? void 0 : _b.filter((item) => item.startsWith(selectedMajorVersion)).map((item) => { var _a; return (_a = item.split('.')) === null || _a === void 0 ? void 0 : _a[1]; }).sort();
38
+ setMajorVersion(difference(subVersions, topContentVersion));
39
+ }
40
+ }, [versions, topContentVersion, selectedMajorVersion]);
41
+ return [isLoadingVersions || isTopContentVersion, majorVersion.map((item) => `${selectedMajorVersion}.${item}`)];
42
+ };
@@ -1,3 +1,18 @@
1
+ import { ITopContentResourceUsagesResponse } from '@cee-eng/hydrajs/@types/models/topContent/topContentModel';
2
+ import { ITopContentEditState } from './TopContentReducer';
1
3
  export declare const getTopContentUrl: (contentUrl: string) => string;
2
4
  export declare const getContentUrls: (contentsArray: any) => any;
5
+ /**
6
+ * Iterate all categories and its content to with content usage data to map and flag category and its content needs attention
7
+ *
8
+ * 1. Find the outlier from the category usage data.
9
+ * 2. Compare and filter category usage with outlier lower boundary.
10
+ * 3. Use filtered data with actually category data to add need attention flag
11
+ * @param categories
12
+ * @param categoryUsage
13
+ * @param selectedVersion
14
+ * @returns categories
15
+ */
16
+ export declare const flagContentUsage: (categories: ITopContentEditState[], categoryUsage: ITopContentResourceUsagesResponse, selectedVersion: string) => ITopContentEditState[];
17
+ export declare const isMajorVersion: (selectedVersion: string) => boolean;
3
18
  //# sourceMappingURL=TopContentHelpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TopContentHelpers.d.ts","sourceRoot":"","sources":["../../../src/reducers/TopContentHelpers.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB,eAAgB,MAAM,WASlD,CAAC;AAEF,eAAO,MAAM,cAAc,6BAe1B,CAAC"}
1
+ {"version":3,"file":"TopContentHelpers.d.ts","sourceRoot":"","sources":["../../../src/reducers/TopContentHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,iCAAiC,EAEpC,MAAM,2DAA2D,CAAC;AAKnE,OAAO,EAAE,oBAAoB,EAAwB,MAAM,qBAAqB,CAAC;AAEjF,eAAO,MAAM,gBAAgB,eAAgB,MAAM,WASlD,CAAC;AAEF,eAAO,MAAM,cAAc,6BAe1B,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,eACb,oBAAoB,EAAE,iBACnB,iCAAiC,mBAC/B,MAAM,2BAiC1B,CAAC;AAEF,eAAO,MAAM,cAAc,oBAAqB,MAAM,KAAG,OAExD,CAAC"}
@@ -1,4 +1,16 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
1
12
  import { getAccessHostname } from '@rh-support/api';
13
+ import { outlier } from '@rh-support/utils';
2
14
  import isEmpty from 'lodash/isEmpty';
3
15
  export const getTopContentUrl = (contentUrl) => {
4
16
  // There is some data urls (e.g. /solutions/articles/etc.) that aren't valid urls
@@ -27,3 +39,40 @@ export const getContentUrls = (contentsArray) => {
27
39
  return result;
28
40
  }, {});
29
41
  };
42
+ /**
43
+ * Iterate all categories and its content to with content usage data to map and flag category and its content needs attention
44
+ *
45
+ * 1. Find the outlier from the category usage data.
46
+ * 2. Compare and filter category usage with outlier lower boundary.
47
+ * 3. Use filtered data with actually category data to add need attention flag
48
+ * @param categories
49
+ * @param categoryUsage
50
+ * @param selectedVersion
51
+ * @returns categories
52
+ */
53
+ export const flagContentUsage = (categories, categoryUsage, selectedVersion) => {
54
+ var _a, _b;
55
+ if (!isMajorVersion(selectedVersion) && !isEmpty(categoryUsage === null || categoryUsage === void 0 ? void 0 : categoryUsage[selectedVersion])) {
56
+ const [, lowerBoundary] = outlier((_a = categoryUsage === null || categoryUsage === void 0 ? void 0 : categoryUsage[selectedVersion]) === null || _a === void 0 ? void 0 : _a.map(({ clickCount30Days }) => clickCount30Days));
57
+ const filteredResourceUsages = (_b = categoryUsage === null || categoryUsage === void 0 ? void 0 : categoryUsage[selectedVersion]) === null || _b === void 0 ? void 0 : _b.filter(({ clickCount30Days }) => lowerBoundary > clickCount30Days);
58
+ const categoriesWithFlaggedContent = categories === null || categories === void 0 ? void 0 : categories.map((_a) => {
59
+ var { content } = _a, rest = __rest(_a, ["content"]);
60
+ let isAttentionNeededOnCategory = false;
61
+ const contentWithFlag = content === null || content === void 0 ? void 0 : content.map((_a) => {
62
+ var { topContentId } = _a, rest = __rest(_a, ["topContentId"]);
63
+ const isAttentionNeeded = filteredResourceUsages.some(({ resourceEntityId }) => +resourceEntityId === topContentId);
64
+ !isAttentionNeededOnCategory && (isAttentionNeededOnCategory = isAttentionNeeded);
65
+ return Object.assign(Object.assign({}, rest), { topContentId,
66
+ isAttentionNeeded });
67
+ });
68
+ return Object.assign(Object.assign({}, rest), { content: contentWithFlag, isAttentionNeeded: isAttentionNeededOnCategory });
69
+ });
70
+ return categoriesWithFlaggedContent;
71
+ }
72
+ else {
73
+ return categories;
74
+ }
75
+ };
76
+ export const isMajorVersion = (selectedVersion) => {
77
+ return /.x/.test(selectedVersion);
78
+ };
@@ -1,12 +1,14 @@
1
1
  import { IProduct as IHydraProduct, IProduct } from '@cee-eng/hydrajs/@types/models/product';
2
- import { ITopContent, ITopContentCategory, ITopContentList } from '@cee-eng/hydrajs/@types/models/topContent/topContentModel';
2
+ import { ITopContent, ITopContentCategory, ITopContentList, ITopContentResourceUsagesResponse } from '@cee-eng/hydrajs/@types/models/topContent/topContentModel';
3
3
  import { IAction, IApiResponseDetails } from '@rh-support/types/shared';
4
4
  export interface ITopContentItemState extends ITopContent {
5
5
  mode?: ContentMode;
6
+ isAttentionNeeded?: boolean;
6
7
  }
7
8
  export interface ITopContentEditState extends Omit<ITopContentList, 'content'> {
8
9
  catMode?: string;
9
10
  content: ITopContentItemState[];
11
+ isAttentionNeeded?: boolean;
10
12
  }
11
13
  /** sample obj for IContentUrlsDups type
12
14
  contentUrls:IContentUrlsDups = {
@@ -34,6 +36,7 @@ export interface ITopContentState {
34
36
  categories: IApiResponseDetails<ITopContentCategory[]>;
35
37
  contentUrls: IContentUrlsDups;
36
38
  isSearchModeEnabled: boolean;
39
+ categoryUsage: ITopContentResourceUsagesResponse;
37
40
  }
38
41
  export declare enum ContentMode {
39
42
  INITIAL = "initial",
@@ -56,7 +59,8 @@ export declare enum TopContentReducerConstants {
56
59
  updateTopContentCategories = "updateTopContentCategories",
57
60
  changeTopContentStateOnCatsArrangementSave = "changeTopContentStateOnCatsArrangementSave",
58
61
  setIsSearchModeEnabled = "setIsSearchModeEnabled",
59
- resetDuplicatUrls = "resetDuplicatUrls"
62
+ resetDuplicatUrls = "resetDuplicatUrls",
63
+ getTopContentResourceUsage = "getTopContentResourceUsage"
60
64
  }
61
65
  declare type IActionType = IAction<TopContentReducerConstants, ITopContentState>;
62
66
  export declare type TopContentReducerDispatchType = (value: IActionType) => void;
@@ -69,6 +73,7 @@ export declare const resetChangeInCategoryContent: (dispatch: TopContentReducerD
69
73
  export declare const resetChangeInCategory: (dispatch: TopContentReducerDispatchType, topContentResponse: IApiResponseDetails<ITopContentEditState[]>) => void;
70
74
  export declare const resetContentWithSelectedProduct: (dispatch: TopContentReducerDispatchType, selectedProduct: Partial<IHydraProduct>) => void;
71
75
  export declare const fetchTopContent: (dispatch: TopContentReducerDispatchType, selectedProduct: Partial<IProduct>, selectedVersion: string) => Promise<never>;
76
+ export declare const fetchTopContentRecourseUsage: (dispatch: TopContentReducerDispatchType, productName: string, version: string) => Promise<void>;
72
77
  export declare const addTopContent: (dispatch: TopContentReducerDispatchType, topContentEditState: ITopContentEditState[], categoryId: number) => void;
73
78
  export declare const deleteTopContent: (dispatch: TopContentReducerDispatchType, topContentEditState: ITopContentEditState[], categoryId: number, topContentId: number) => Promise<never>;
74
79
  export declare const removeTopContent: (dispatch: TopContentReducerDispatchType, topContentEditState: ITopContentEditState[], categoryId: number, i: number) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"TopContentReducer.d.ts","sourceRoot":"","sources":["../../../src/reducers/TopContentReducer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,IAAI,aAAa,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAC7F,OAAO,EACH,WAAW,EAEX,mBAAmB,EACnB,eAAe,EAGlB,MAAM,2DAA2D,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAMxE,MAAM,WAAW,oBAAqB,SAAQ,WAAW;IACrD,IAAI,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC;IAC1E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,oBAAoB,EAAE,CAAC;CACnC;AAED;;;;;;;EAOE;AACF,UAAU,YAAY;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,gBAAgB;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAAC;CAC/B;AAED,MAAM,WAAW,gBAAgB;IAC7B,oBAAoB,EAAE,OAAO,CAAC;IA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MAAM,4BACG,OAAO,cACrB,GAAG,mBA2DlB,CAAC;AAGF,eAAO,MAAM,mBAAmB,aAClB,6BAA6B,uBAClB,oBAAoB,EAAE,MACvC,MAAM,cACE,MAAM,WACT,oBAAoB,SACtB,MAAM,mBA2ChB,CAAC;AAGF,eAAO,MAAM,2BAA2B,aAC1B,6BAA6B,uBAClB,oBAAoB,EAAE,cAC/B,MAAM,WACT,oBAAoB,SACtB,MAAM,mBAsChB,CAAC;AAGF,eAAO,MAAM,gBAAgB,aACf,6BAA6B,uBAClB,oBAAoB,EAAE,cAC/B,MAAM,mBA+BrB,CAAC;AAGF,eAAO,MAAM,iBAAiB,wBAA+B,oBAAoB,EAAE,oGAiBlF,CAAC;AAEF,eAAO,MAAM,eAAe,aAAoB,6BAA6B,mBAwB5E,CAAC;AAEF,eAAO,MAAM,sBAAsB,aAAc,6BAA6B,uBAAuB,OAAO,SAK3G,CAAC;AAEF,eAAO,MAAM,iBAAiB,aAAc,6BAA6B,SAKxE,CAAC"}
@@ -36,6 +36,7 @@ export var TopContentReducerConstants;
36
36
  TopContentReducerConstants["changeTopContentStateOnCatsArrangementSave"] = "changeTopContentStateOnCatsArrangementSave";
37
37
  TopContentReducerConstants["setIsSearchModeEnabled"] = "setIsSearchModeEnabled";
38
38
  TopContentReducerConstants["resetDuplicatUrls"] = "resetDuplicatUrls";
39
+ TopContentReducerConstants["getTopContentResourceUsage"] = "getTopContentResourceUsage";
39
40
  })(TopContentReducerConstants || (TopContentReducerConstants = {}));
40
41
  export const TopContentReducer = (pState, action) => {
41
42
  switch (action.type) {
@@ -72,6 +73,9 @@ export const TopContentReducer = (pState, action) => {
72
73
  case TopContentReducerConstants.resetDuplicatUrls: {
73
74
  return Object.assign(Object.assign({}, pState), { contentUrls: action.payload.contentUrls });
74
75
  }
76
+ case TopContentReducerConstants.getTopContentResourceUsage: {
77
+ return Object.assign(Object.assign({}, pState), { categoryUsage: action.payload.categoryUsage });
78
+ }
75
79
  default: {
76
80
  return pState;
77
81
  }
@@ -186,7 +190,10 @@ export const fetchTopContent = (dispatch, selectedProduct, selectedVersion) => _
186
190
  sortby: 'rank',
187
191
  });
188
192
  const resultFiltered = results.filter((c) => c.content.length > 0);
189
- const topContentEditState = resultFiltered.map((cat) => (Object.assign(Object.assign({}, cat), { catMode: CategoryMode.EXISTING_SECTION, content: cat.content.map((contentItem) => (Object.assign(Object.assign({}, contentItem), { mode: ContentMode.INITIAL }))) })));
193
+ const topContentEditState = resultFiltered.map((cat) => {
194
+ const content = cat.content.map((contentItem) => (Object.assign(Object.assign({}, contentItem), { mode: ContentMode.INITIAL })));
195
+ return Object.assign(Object.assign({}, cat), { catMode: CategoryMode.EXISTING_SECTION, content });
196
+ });
190
197
  const isCatOnlyForMajorVersion = ((_a = topContentEditState[0]) === null || _a === void 0 ? void 0 : _a.minorVersion) ? false : true;
191
198
  const contentUrls = getContentUrls(resultFiltered);
192
199
  dispatch({
@@ -200,6 +207,8 @@ export const fetchTopContent = (dispatch, selectedProduct, selectedVersion) => _
200
207
  contentUrls,
201
208
  },
202
209
  });
210
+ // Fetch TopContent Recourse Usage
211
+ fetchTopContentRecourseUsage(dispatch, selectedProduct.name, selectedVersion);
203
212
  }
204
213
  catch (e) {
205
214
  dispatch({
@@ -215,6 +224,29 @@ export const fetchTopContent = (dispatch, selectedProduct, selectedVersion) => _
215
224
  return Promise.reject(e);
216
225
  }
217
226
  });
227
+ export const fetchTopContentRecourseUsage = (dispatch, productName, version) => __awaiter(void 0, void 0, void 0, function* () {
228
+ try {
229
+ dispatch({
230
+ type: TopContentReducerConstants.getTopContentResourceUsage,
231
+ payload: { categoryUsage: {} },
232
+ });
233
+ const categoryUsage = yield pcm.topContent.postTopContentResourceUsage({
234
+ source: 'Top Content',
235
+ product: productName,
236
+ version: version.split('.x')[0], // Need to remove minor version 'x' as top content resource usage API don't support it.,
237
+ });
238
+ dispatch({
239
+ type: TopContentReducerConstants.getTopContentResourceUsage,
240
+ payload: { categoryUsage },
241
+ });
242
+ }
243
+ catch (e) {
244
+ dispatch({
245
+ type: TopContentReducerConstants.getTopContentResourceUsage,
246
+ payload: { categoryUsage: {} },
247
+ });
248
+ }
249
+ });
218
250
  export const addTopContent = (dispatch, topContentEditState, categoryId) => {
219
251
  topContentEditState.forEach((cat) => {
220
252
  if (cat.id === categoryId) {
@@ -423,7 +455,7 @@ export const reArrangeContent = (dispatch, topContentEditState, categoryId) => _
423
455
  export const reArrangeCategory = (topContentEditState) => __awaiter(void 0, void 0, void 0, function* () {
424
456
  try {
425
457
  const toUpdate = [];
426
- topContentEditState.forEach((cat, i) => {
458
+ topContentEditState.forEach((cat) => {
427
459
  cat.content.forEach((item) => {
428
460
  toUpdate.push({
429
461
  id: item.topContentId,
@@ -220,6 +220,13 @@
220
220
  border: 1px solid #ccc;
221
221
  border-top: none;
222
222
  }
223
+ .top-content-needs-attention {
224
+ color: var(--pf-global--danger-color--100);
225
+ }
226
+ .top-content-tooltip {
227
+ color: var(--pf-global--danger-color--100);
228
+ padding: 2px;
229
+ }
223
230
  }
224
231
 
225
232
  // specific overrides under manage because of a different implementation
@@ -0,0 +1,67 @@
1
+ // Patternfly overrides
2
+
3
+ div#top-content-performance-metric.pf-c-modal-box {
4
+ .pf-c-modal-box__body {
5
+ .pf-c-title {
6
+ margin-bottom: unset;
7
+ }
8
+ .top-content-tooltip-view-metric-label {
9
+ color: var(--pf-global--primary-color--100);
10
+ }
11
+ .pf-c-panel__main-body {
12
+ padding: var(--pf-global--spacer--md);
13
+ }
14
+ .pf-c-toggle-group__button {
15
+ /* Somehow below style is getting added by Patternfly which is overriding default button padding
16
+ * [class*="pf-c-"], [class*="pf-c-"]::before, [class*="pf-c-"]::after {
17
+ padding: 0;
18
+ margin: 0;
19
+ background-color: transparent;
20
+ */
21
+ padding: var(--pf-c-toggle-group__button--PaddingTop) var(--pf-c-toggle-group__button--PaddingRight)
22
+ var(--pf-c-toggle-group__button--PaddingBottom) var(--pf-c-toggle-group__button--PaddingLeft);
23
+ }
24
+ }
25
+ }
26
+
27
+ div#top-content-category-limit-guidelines.pf-c-modal-box {
28
+ .pf-c-modal-box__body {
29
+ .pf-c-title {
30
+ margin-bottom: unset;
31
+ }
32
+ }
33
+ }
34
+
35
+ div#top-content-major-version-performance-metric.pf-c-modal-box {
36
+ .pf-c-modal-box__body {
37
+ overflow-x: unset;
38
+ overflow-y: unset;
39
+ .pf-c-title {
40
+ margin-bottom: unset;
41
+ }
42
+ .pf-c-toggle-group__button {
43
+ /* Somehow below style is getting added by Patternfly which is overriding default button padding
44
+ * [class*="pf-c-"], [class*="pf-c-"]::before, [class*="pf-c-"]::after {
45
+ padding: 0;
46
+ margin: 0;
47
+ background-color: transparent;
48
+ */
49
+ padding: var(--pf-c-toggle-group__button--PaddingTop) var(--pf-c-toggle-group__button--PaddingRight)
50
+ var(--pf-c-toggle-group__button--PaddingBottom) var(--pf-c-toggle-group__button--PaddingLeft);
51
+ }
52
+ .sticky-header {
53
+ position: sticky;
54
+ top: 0;
55
+ background: var(--pf-c-modal-box--BackgroundColor);
56
+ z-index: 1;
57
+ padding-bottom: var(--pf-global--spacer--sm);
58
+ }
59
+ .content {
60
+ height: 30vh;
61
+ overflow: auto;
62
+ }
63
+ .panel-body {
64
+ padding: var(--pf-global--spacer--md);
65
+ }
66
+ }
67
+ }
@@ -19,4 +19,15 @@
19
19
  }
20
20
  }
21
21
  }
22
+ .pf-c-popover {
23
+ .pf-c-popover__content {
24
+ .pf-c-popover__body {
25
+ .top-content-tooltip-view-metric-label {
26
+ color: var(--pf-global--primary-color--100);
27
+ }
28
+ }
29
+ }
30
+ }
22
31
  }
32
+
33
+ @import './pf4-overrides';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/manage",
3
- "version": "0.2.44",
3
+ "version": "0.2.62",
4
4
  "description": "Customer Support Manage App",
5
5
  "author": "Jordan Eudy <jeudy100@gmail.com>",
6
6
  "homepage": "",
@@ -51,7 +51,7 @@
51
51
  "not op_mini all"
52
52
  ],
53
53
  "peerDependencies": {
54
- "@cee-eng/hydrajs": "4.7.20",
54
+ "@cee-eng/hydrajs": "4.7.22",
55
55
  "@patternfly/patternfly": "4.176.2",
56
56
  "@patternfly/pfe-accordion": "1.12.3",
57
57
  "@patternfly/pfe-collapse": "1.12.3",
@@ -89,20 +89,20 @@
89
89
  "typescript": "4.3.5"
90
90
  },
91
91
  "dependencies": {
92
- "@cee-eng/hydrajs": "4.7.20",
92
+ "@cee-eng/hydrajs": "4.7.22",
93
93
  "@patternfly/patternfly": "4.176.2",
94
94
  "@patternfly/pfe-accordion": "1.12.3",
95
95
  "@patternfly/pfe-collapse": "1.12.3",
96
96
  "@patternfly/pfe-tabs": "1.12.3",
97
97
  "@patternfly/react-core": "4.194.0",
98
98
  "@patternfly/react-table": "4.63.0",
99
- "@rh-support/api": "^0.3.12",
100
- "@rh-support/components": "^1.1.31",
101
- "@rh-support/configs": "^0.2.7",
102
- "@rh-support/react-context": "^0.2.34",
103
- "@rh-support/types": "^0.2.2",
104
- "@rh-support/user-permissions": "^0.2.25",
105
- "@rh-support/utils": "^0.2.23",
99
+ "@rh-support/api": "0.3.13",
100
+ "@rh-support/components": "1.1.52",
101
+ "@rh-support/configs": "0.2.5",
102
+ "@rh-support/react-context": "0.2.52",
103
+ "@rh-support/types": "0.2.0",
104
+ "@rh-support/user-permissions": "0.2.42",
105
+ "@rh-support/utils": "0.2.32",
106
106
  "@types/react-beautiful-dnd": "^13.0.0",
107
107
  "i18next": ">=17.0.1",
108
108
  "lodash": ">=4.17.15",
@@ -113,5 +113,5 @@
113
113
  "react-i18next": ">=10.11.0",
114
114
  "react-router-dom": ">=5.1.2"
115
115
  },
116
- "gitHead": "70f8095b855f531eb814e85cb5a77908405fff5f"
116
+ "gitHead": "3d97efe5cebb4e398f73d61326cad31e087aa63f"
117
117
  }