@rh-support/manage 0.2.34 → 0.2.35
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/ContentUsage/NeedsAttention.d.ts +3 -0
- package/lib/esm/components/TopContentManagement/ContentUsage/NeedsAttention.d.ts.map +1 -0
- package/lib/esm/components/TopContentManagement/ContentUsage/NeedsAttention.js +8 -0
- package/lib/esm/components/TopContentManagement/ContentUsage/PerformanceMetrics.d.ts +12 -0
- package/lib/esm/components/TopContentManagement/ContentUsage/PerformanceMetrics.d.ts.map +1 -0
- package/lib/esm/components/TopContentManagement/ContentUsage/PerformanceMetrics.js +43 -0
- package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentCategory.d.ts.map +1 -1
- package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentCategory.js +4 -1
- package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentSingleItem.d.ts.map +1 -1
- package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentSingleItem.js +7 -5
- package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentSingleItemLink.d.ts +11 -0
- package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentSingleItemLink.d.ts.map +1 -0
- package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentSingleItemLink.js +20 -0
- package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentEditor.d.ts.map +1 -1
- package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentEditor.js +19 -17
- package/lib/esm/context/TopContentProvider.d.ts.map +1 -1
- package/lib/esm/context/TopContentProvider.js +1 -0
- package/lib/esm/reducers/TopContentHelpers.d.ts +14 -0
- package/lib/esm/reducers/TopContentHelpers.d.ts.map +1 -1
- package/lib/esm/reducers/TopContentHelpers.js +46 -0
- package/lib/esm/reducers/TopContentReducer.d.ts +7 -2
- package/lib/esm/reducers/TopContentReducer.d.ts.map +1 -1
- package/lib/esm/reducers/TopContentReducer.js +34 -2
- package/lib/esm/scss/_main.scss +10 -0
- package/lib/esm/scss/_pf4-overrides.scss +25 -0
- package/lib/esm/scss/index.scss +2 -0
- package/package.json +6 -6
|
@@ -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,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,EAAqB,MAAM,OAAO,CAAC;AAKrD,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,CA6EzC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Button, HelperText, HelperTextItem, Modal, ModalVariant, Panel, PanelMain, PanelMainBody, Title, TitleSizes, 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 PerformanceMetrics = ({ isModalOpen, onHideModal, needsAttention, contentId, title, lastModifiedBy, }) => {
|
|
6
|
+
const [selectedOption, setSelectedOption] = useState(0);
|
|
7
|
+
const { categoryUsage, selectedVersion } = useTopContentContext();
|
|
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(Modal, { variant: ModalVariant.small, id: "top-content-performance-metric", "aria-label": "top-content-performance-metric", isOpen: isModalOpen, onClose: onHideModal, actions: [
|
|
19
|
+
React.createElement(Button, { variant: "secondary", key: "close-button", onClick: onHideModal }, "Cancel"),
|
|
20
|
+
] },
|
|
21
|
+
React.createElement(Title, { headingLevel: "h1", size: TitleSizes['2xl'] },
|
|
22
|
+
React.createElement(Trans, null, " Performance metrics ")),
|
|
23
|
+
React.createElement("p", { className: "pf-u-pt-sm" }, "Better understand the Performance for the top content resources."),
|
|
24
|
+
React.createElement("br", null),
|
|
25
|
+
React.createElement("span", { className: "top-content-tooltip-view-metric-label" }, title),
|
|
26
|
+
React.createElement("br", null),
|
|
27
|
+
React.createElement("span", null, lastModifiedBy),
|
|
28
|
+
React.createElement("br", null),
|
|
29
|
+
React.createElement("br", null),
|
|
30
|
+
React.createElement(ToggleGroup, { "aria-label": "performance-usage-days-selector" },
|
|
31
|
+
React.createElement(ToggleGroupItem, { buttonId: "last-30-days", text: "Last 30 days", isSelected: selectedOption === 0, onChange: onSelect(0) }),
|
|
32
|
+
React.createElement(ToggleGroupItem, { buttonId: "last-60-days", text: "Last 60 days", isSelected: selectedOption === 1, onChange: onSelect(1) }),
|
|
33
|
+
React.createElement(ToggleGroupItem, { buttonId: "last-90-days", text: "Last 90 days", isSelected: selectedOption === 2, onChange: onSelect(2) })),
|
|
34
|
+
React.createElement(Panel, { variant: "bordered" },
|
|
35
|
+
React.createElement(PanelMain, null,
|
|
36
|
+
React.createElement(PanelMainBody, null,
|
|
37
|
+
React.createElement(HelperText, null,
|
|
38
|
+
React.createElement(HelperTextItem, { variant: needsAttention ? 'error' : 'default' },
|
|
39
|
+
React.createElement(Trans, { count: count },
|
|
40
|
+
"Clicked ",
|
|
41
|
+
{ count },
|
|
42
|
+
" times"))))))));
|
|
43
|
+
};
|
|
@@ -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;
|
|
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;
|
|
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(
|
|
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,
|
|
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":"
|
|
1
|
+
{"version":3,"file":"TopContentEditor.d.ts","sourceRoot":"","sources":["../../../../../src/components/TopContentManagement/TopContentEditor/TopContentEditor.tsx"],"names":[],"mappings":"AAwCA,wBAAgB,gBAAgB,gBA2R/B"}
|
|
@@ -11,10 +11,11 @@ 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
17
|
import { useTopContentContext, useTopContentDispatchContext } from '../../../context/TopContentProvider';
|
|
18
|
+
import { flagContentUsage } from '../../../reducers/TopContentHelpers';
|
|
18
19
|
import { CategoryMode, fetchTopContent, reArrangeCategory, resetChangeInCategory, resetContentWithSelectedProduct, resetDuplicatUrls, setAddNewSection, setIsAddingCategory, setIsSearchModeEnabled, setTopContentArrangingCategory, setTopContentArrangingContent, } from '../../../reducers/TopContentReducer';
|
|
19
20
|
import { NoTopContentFound } from '../NoTopContentFound';
|
|
20
21
|
import { TopContentHeader } from '../TopContentHeader';
|
|
@@ -27,9 +28,10 @@ export function TopContentEditor() {
|
|
|
27
28
|
const [isArrangingCats, setIsArrangingCats] = useState(false);
|
|
28
29
|
const [newCategoryVersion, setNewCategoryVersion] = useState(undefined);
|
|
29
30
|
const topContentResultsRef = useRef(null);
|
|
30
|
-
const { topContentResponse, topContentEditState, isAddingCategory, isCatOnlyForMajorVersion, isSearchModeEnabled, selectedProduct, selectedVersion, } = useTopContentContext();
|
|
31
|
+
const { topContentResponse, topContentEditState, isAddingCategory, isCatOnlyForMajorVersion, isSearchModeEnabled, selectedProduct, selectedVersion, categoryUsage, } = useTopContentContext();
|
|
31
32
|
const topContentDispatch = useTopContentDispatchContext();
|
|
32
|
-
const
|
|
33
|
+
const flagContentEditState = useMemo(() => flagContentUsage(topContentEditState, categoryUsage, selectedVersion), [topContentEditState, categoryUsage, selectedVersion]);
|
|
34
|
+
const [filteredTC, setFilteredTC] = useState(flagContentEditState);
|
|
33
35
|
const onProductChange = (selectedProduct) => {
|
|
34
36
|
resetContentWithSelectedProduct(topContentDispatch, selectedProduct);
|
|
35
37
|
};
|
|
@@ -39,14 +41,14 @@ export function TopContentEditor() {
|
|
|
39
41
|
fetchTopContent(topContentDispatch, selectedProduct, selectedVersion);
|
|
40
42
|
};
|
|
41
43
|
useEffect(() => {
|
|
42
|
-
!isSearchModeEnabled && setFilteredTC(
|
|
44
|
+
!isSearchModeEnabled && setFilteredTC(flagContentEditState);
|
|
43
45
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
44
|
-
}, [
|
|
46
|
+
}, [flagContentEditState]);
|
|
45
47
|
const onAddCategory = (isMajorVersionOnly, isCreatingNewSet = false, version, hasMajorContentCreatingMinorContent) => {
|
|
46
48
|
hasMajorContentCreatingMinorContent && resetDuplicatUrls(topContentDispatch);
|
|
47
49
|
setCategoryToOpen(null);
|
|
48
50
|
setIsAddingCategory(topContentDispatch, true);
|
|
49
|
-
setAddNewSection(topContentDispatch,
|
|
51
|
+
setAddNewSection(topContentDispatch, flagContentEditState, isMajorVersionOnly, isCreatingNewSet);
|
|
50
52
|
setNewCategoryVersion(version);
|
|
51
53
|
};
|
|
52
54
|
const arrangeSection = () => {
|
|
@@ -55,7 +57,7 @@ export function TopContentEditor() {
|
|
|
55
57
|
const onSaveArrangement = () => __awaiter(this, void 0, void 0, function* () {
|
|
56
58
|
setIsArrangingCats(false);
|
|
57
59
|
try {
|
|
58
|
-
yield reArrangeCategory(
|
|
60
|
+
yield reArrangeCategory(flagContentEditState);
|
|
59
61
|
ToastNotification.addSuccessMessage(t('Categories updated successfully'));
|
|
60
62
|
}
|
|
61
63
|
catch (error) {
|
|
@@ -72,24 +74,24 @@ export function TopContentEditor() {
|
|
|
72
74
|
if (!result.destination || result.source.index === result.destination.index)
|
|
73
75
|
return;
|
|
74
76
|
if (result.destination.droppableId === 'content-editor-cat-drop-zone') {
|
|
75
|
-
setTopContentArrangingCategory(topContentDispatch,
|
|
77
|
+
setTopContentArrangingCategory(topContentDispatch, flagContentEditState, result.source.index, result.destination.index);
|
|
76
78
|
}
|
|
77
79
|
else {
|
|
78
80
|
// pass categoryID as a part of dropabbleId
|
|
79
|
-
setTopContentArrangingContent(topContentDispatch,
|
|
81
|
+
setTopContentArrangingContent(topContentDispatch, flagContentEditState, result.destination.droppableId, result.source.index, result.destination.index);
|
|
80
82
|
}
|
|
81
83
|
};
|
|
82
|
-
const showNoTopContentFound = (isEmpty(selectedProduct.name) || isEmpty(selectedVersion) ||
|
|
84
|
+
const showNoTopContentFound = (isEmpty(selectedProduct.name) || isEmpty(selectedVersion) || flagContentEditState.length === 0) &&
|
|
83
85
|
!topContentResponse.isError &&
|
|
84
86
|
!topContentResponse.isFetching &&
|
|
85
87
|
!isAddingCategory;
|
|
86
88
|
const showSectionFooter = !isArrangingCats &&
|
|
87
89
|
!isAddingCategory &&
|
|
88
90
|
selectedVersion &&
|
|
89
|
-
|
|
91
|
+
flagContentEditState.length !== 0 &&
|
|
90
92
|
!isSearchModeEnabled;
|
|
91
93
|
const isContentOnlyForMajorVersion = !topContentResponse.isFetching &&
|
|
92
|
-
|
|
94
|
+
flagContentEditState.length !== 0 &&
|
|
93
95
|
isRegularVersion(selectedVersion) &&
|
|
94
96
|
isCatOnlyForMajorVersion &&
|
|
95
97
|
!isAddingCategory;
|
|
@@ -97,18 +99,18 @@ export function TopContentEditor() {
|
|
|
97
99
|
setIsSearchModeEnabled(topContentDispatch, searchTerm ? true : false);
|
|
98
100
|
setFilteredTC(searchResults);
|
|
99
101
|
};
|
|
100
|
-
const minorSelectedNoMinorContentButAvailableMajorContent = isContentOnlyForMajorVersion && getVersion(selectedVersion).minor &&
|
|
102
|
+
const minorSelectedNoMinorContentButAvailableMajorContent = isContentOnlyForMajorVersion && getVersion(selectedVersion).minor && flagContentEditState.length !== 0;
|
|
101
103
|
return (React.createElement(React.Fragment, null,
|
|
102
104
|
React.createElement(TopContentHeader, null),
|
|
103
105
|
!topContentResponse.isFetching && topContentResponse.isError && (React.createElement(Alert, { isInline: true, variant: AlertVariant.danger, title: React.createElement(Trans, null, "Error loading Top Content") })),
|
|
104
106
|
React.createElement(TopContentProductVersionSelector, { selectedProduct: selectedProduct, selectedVersion: selectedVersion, onProductChange: onProductChange, onVersionChange: onVersionChange }),
|
|
105
|
-
!topContentResponse.isFetching && (React.createElement(TopContentSearch, { dataTrackingId: "top-content-filter-manage", topContentData:
|
|
107
|
+
!topContentResponse.isFetching && (React.createElement(TopContentSearch, { dataTrackingId: "top-content-filter-manage", topContentData: flagContentEditState, onSearch: onSearch, topContentResultsWrapperRef: topContentResultsRef })),
|
|
106
108
|
React.createElement("div", { className: "top-content-manage-wrapper" },
|
|
107
109
|
topContentResponse.isFetching ? (React.createElement(Bullseye, null,
|
|
108
110
|
React.createElement(EmptyState, { variant: EmptyStateVariant.full },
|
|
109
111
|
React.createElement(Spinner, { size: "lg" })))) : (!topContentResponse.isFetching &&
|
|
110
|
-
showNoTopContentFound && (React.createElement(NoTopContentFound, { version: selectedVersion, product: selectedProduct.name, dataLength:
|
|
111
|
-
minorSelectedNoMinorContentButAvailableMajorContent ? (React.createElement(NoTopContentFound, { version: selectedVersion, product: selectedProduct.name, dataLength:
|
|
112
|
+
showNoTopContentFound && (React.createElement(NoTopContentFound, { version: selectedVersion, product: selectedProduct.name, dataLength: flagContentEditState.length, onAddCategory: onAddCategory, isContentOnlyForMajorVersion: isContentOnlyForMajorVersion }))),
|
|
113
|
+
minorSelectedNoMinorContentButAvailableMajorContent ? (React.createElement(NoTopContentFound, { version: selectedVersion, product: selectedProduct.name, dataLength: flagContentEditState.length, onAddCategory: onAddCategory, onVersionChange: onVersionChange, isContentOnlyForMajorVersion: isContentOnlyForMajorVersion })) : (React.createElement(DragDropContext, { onDragEnd: onDragEnd },
|
|
112
114
|
React.createElement(Droppable, { droppableId: "content-editor-cat-drop-zone" }, (provided) => (React.createElement("div", Object.assign({}, provided.droppableProps, { ref: (el) => {
|
|
113
115
|
provided.innerRef(el);
|
|
114
116
|
topContentResultsRef.current = el;
|
|
@@ -129,7 +131,7 @@ export function TopContentEditor() {
|
|
|
129
131
|
React.createElement(Button, { variant: "primary", onClick: () => onAddCategory(isContentOnlyForMajorVersion, false, selectedVersion), "data-tracking-id": "add-new-section-topcontent" },
|
|
130
132
|
React.createElement(Trans, null, "Add a new section")),
|
|
131
133
|
' ',
|
|
132
|
-
React.createElement(Button, { variant: "secondary", onClick: arrangeSection, isDisabled:
|
|
134
|
+
React.createElement(Button, { variant: "secondary", onClick: arrangeSection, isDisabled: flagContentEditState.length < 2 },
|
|
133
135
|
React.createElement(Trans, null, "Arrange section")))),
|
|
134
136
|
isArrangingCats && (React.createElement(React.Fragment, null,
|
|
135
137
|
React.createElement(Button, { variant: "primary", onClick: onSaveArrangement },
|
|
@@ -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,
|
|
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);
|
|
@@ -1,3 +1,17 @@
|
|
|
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[];
|
|
3
17
|
//# sourceMappingURL=TopContentHelpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TopContentHelpers.d.ts","sourceRoot":"","sources":["../../../src/reducers/TopContentHelpers.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -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,37 @@ 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 (!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
|
+
};
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"TopContentReducer.d.ts","sourceRoot":"","sources":["../../../src/reducers/TopContentReducer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,IAAI,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AuB,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) =>
|
|
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
|
|
458
|
+
topContentEditState.forEach((cat) => {
|
|
427
459
|
cat.content.forEach((item) => {
|
|
428
460
|
toUpdate.push({
|
|
429
461
|
id: item.topContentId,
|
package/lib/esm/scss/_main.scss
CHANGED
|
@@ -220,6 +220,16 @@
|
|
|
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
|
+
}
|
|
230
|
+
.top-content-tooltip-view-metric-label {
|
|
231
|
+
color: var(--pf-global--primary-color--100);
|
|
232
|
+
}
|
|
223
233
|
}
|
|
224
234
|
|
|
225
235
|
// specific overrides under manage because of a different implementation
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
}
|
package/lib/esm/scss/index.scss
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/manage",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.35",
|
|
4
4
|
"description": "Customer Support Manage App",
|
|
5
5
|
"author": "Jordan Eudy <jeudy100@gmail.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -97,12 +97,12 @@
|
|
|
97
97
|
"@patternfly/react-core": "4.194.0",
|
|
98
98
|
"@patternfly/react-table": "4.63.0",
|
|
99
99
|
"@rh-support/api": "0.3.10",
|
|
100
|
-
"@rh-support/components": "1.1.
|
|
100
|
+
"@rh-support/components": "1.1.25",
|
|
101
101
|
"@rh-support/configs": "0.2.5",
|
|
102
|
-
"@rh-support/react-context": "0.2.
|
|
102
|
+
"@rh-support/react-context": "0.2.28",
|
|
103
103
|
"@rh-support/types": "0.2.0",
|
|
104
|
-
"@rh-support/user-permissions": "0.2.
|
|
105
|
-
"@rh-support/utils": "0.2.
|
|
104
|
+
"@rh-support/user-permissions": "0.2.19",
|
|
105
|
+
"@rh-support/utils": "0.2.17",
|
|
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": "
|
|
116
|
+
"gitHead": "2821a4eb373d262b83d3a512900eb68d1fa22d55"
|
|
117
117
|
}
|