@rh-support/manage 0.2.35 → 0.2.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentCategory.d.ts.map +1 -1
- package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentCategory.js +1 -4
- package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentSingleItem.d.ts.map +1 -1
- package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentSingleItem.js +5 -7
- package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentEditor.d.ts.map +1 -1
- package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentEditor.js +17 -19
- package/lib/esm/context/TopContentProvider.d.ts.map +1 -1
- package/lib/esm/context/TopContentProvider.js +0 -1
- package/lib/esm/reducers/TopContentHelpers.d.ts +0 -14
- package/lib/esm/reducers/TopContentHelpers.d.ts.map +1 -1
- package/lib/esm/reducers/TopContentHelpers.js +0 -46
- package/lib/esm/reducers/TopContentReducer.d.ts +2 -7
- package/lib/esm/reducers/TopContentReducer.d.ts.map +1 -1
- package/lib/esm/reducers/TopContentReducer.js +2 -34
- package/lib/esm/scss/_main.scss +0 -10
- package/lib/esm/scss/index.scss +0 -2
- package/package.json +6 -6
- package/lib/esm/components/TopContentManagement/ContentUsage/NeedsAttention.d.ts +0 -3
- package/lib/esm/components/TopContentManagement/ContentUsage/NeedsAttention.d.ts.map +0 -1
- package/lib/esm/components/TopContentManagement/ContentUsage/NeedsAttention.js +0 -8
- package/lib/esm/components/TopContentManagement/ContentUsage/PerformanceMetrics.d.ts +0 -12
- package/lib/esm/components/TopContentManagement/ContentUsage/PerformanceMetrics.d.ts.map +0 -1
- package/lib/esm/components/TopContentManagement/ContentUsage/PerformanceMetrics.js +0 -43
- package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentSingleItemLink.d.ts +0 -11
- package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentSingleItemLink.d.ts.map +0 -1
- package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentSingleItemLink.js +0 -20
- package/lib/esm/scss/_pf4-overrides.scss +0 -25
|
@@ -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;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"}
|
|
@@ -5,7 +5,6 @@ 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';
|
|
9
8
|
import { TopContentComponent } from './TopContentComponent';
|
|
10
9
|
export function TopContentCategory(props) {
|
|
11
10
|
const { globalMetadataState: { navBarRef }, } = useGlobalStateContext();
|
|
@@ -37,9 +36,7 @@ export function TopContentCategory(props) {
|
|
|
37
36
|
React.createElement(AccordionToggle, { id: props.category.categoryName, onClick: toggleExpanded, isExpanded: isExpanded },
|
|
38
37
|
React.createElement("h3", { ref: headerRef },
|
|
39
38
|
props.isArrangingCats && (React.createElement(GripVerticalIcon, { style: { cursor: 'move' }, title: t('Drag'), size: "sm", className: "pf-u-mr-sm" })),
|
|
40
|
-
props.category.categoryName,
|
|
41
|
-
" ",
|
|
42
|
-
props.category.isAttentionNeeded && React.createElement(NeedsAttention, null))),
|
|
39
|
+
props.category.categoryName)),
|
|
43
40
|
React.createElement(AccordionContent, { isHidden: !isExpanded },
|
|
44
41
|
React.createElement(TopContentComponent, { category: props.category, scrollToTop: scrollToTop, categoryMode: CategoryMode.EXISTING_SECTION }))))));
|
|
45
42
|
}
|
|
@@ -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;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"}
|
|
@@ -21,7 +21,6 @@ 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';
|
|
25
24
|
function formatDuplicateWarning(arr) {
|
|
26
25
|
if (arr.length === 0 || arr.length === 1)
|
|
27
26
|
return arr;
|
|
@@ -241,18 +240,17 @@ export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i
|
|
|
241
240
|
const isSaveButtonDisabled = !(contentTitleIsValid && contentUrlIsValid && localContentTitle && localContentUrl) ||
|
|
242
241
|
(!newCategory && content.mode === ContentMode.NEW_SECTION_CONTENT) ||
|
|
243
242
|
(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
|
-
});
|
|
248
243
|
return (React.createElement(React.Fragment, null,
|
|
249
244
|
isPreview && content.mode !== ContentMode.ADD && content.mode !== ContentMode.NEW_SECTION_CONTENT && (React.createElement("li", { className: `push-bottom-narrow ${snapshot.isDragging ? 'list-flat tc-drag' : ''}` },
|
|
250
245
|
isArrangingContent && (React.createElement(GripVerticalIcon, { style: { cursor: 'move' }, title: t('Drag'), color: "#06c", size: "sm", className: "pf-u-mr-sm" })),
|
|
251
246
|
!isArrangingContent ? (React.createElement(React.Fragment, null,
|
|
252
|
-
React.createElement(
|
|
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),
|
|
253
248
|
' ',
|
|
254
249
|
React.createElement(Button, { variant: "link", isInline: true, icon: React.createElement(EditAltIcon, null), onClick: editToggle, title: 'Edit' }))) : (content.contentTitle),
|
|
255
|
-
React.createElement("div", null,
|
|
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
|
+
})))),
|
|
256
254
|
(!isPreview || content.mode === ContentMode.ADD || content.mode === ContentMode.NEW_SECTION_CONTENT) && (React.createElement("form", { noValidate: true, onSubmit: onSubmit, className: "card card-light push-bottom" },
|
|
257
255
|
content.mode === ContentMode.NEW_SECTION_CONTENT && (React.createElement(AddNewCategoryDropDown, { onCategoryChange: onAddedNewCategoryChange })),
|
|
258
256
|
React.createElement("div", { className: "form-group" },
|
|
@@ -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":"AAuCA,wBAAgB,gBAAgB,gBAqR/B"}
|
|
@@ -11,11 +11,10 @@ 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,
|
|
14
|
+
import React, { useEffect, 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';
|
|
19
18
|
import { CategoryMode, fetchTopContent, reArrangeCategory, resetChangeInCategory, resetContentWithSelectedProduct, resetDuplicatUrls, setAddNewSection, setIsAddingCategory, setIsSearchModeEnabled, setTopContentArrangingCategory, setTopContentArrangingContent, } from '../../../reducers/TopContentReducer';
|
|
20
19
|
import { NoTopContentFound } from '../NoTopContentFound';
|
|
21
20
|
import { TopContentHeader } from '../TopContentHeader';
|
|
@@ -28,10 +27,9 @@ export function TopContentEditor() {
|
|
|
28
27
|
const [isArrangingCats, setIsArrangingCats] = useState(false);
|
|
29
28
|
const [newCategoryVersion, setNewCategoryVersion] = useState(undefined);
|
|
30
29
|
const topContentResultsRef = useRef(null);
|
|
31
|
-
const { topContentResponse, topContentEditState, isAddingCategory, isCatOnlyForMajorVersion, isSearchModeEnabled, selectedProduct, selectedVersion,
|
|
30
|
+
const { topContentResponse, topContentEditState, isAddingCategory, isCatOnlyForMajorVersion, isSearchModeEnabled, selectedProduct, selectedVersion, } = useTopContentContext();
|
|
32
31
|
const topContentDispatch = useTopContentDispatchContext();
|
|
33
|
-
const
|
|
34
|
-
const [filteredTC, setFilteredTC] = useState(flagContentEditState);
|
|
32
|
+
const [filteredTC, setFilteredTC] = useState(topContentEditState);
|
|
35
33
|
const onProductChange = (selectedProduct) => {
|
|
36
34
|
resetContentWithSelectedProduct(topContentDispatch, selectedProduct);
|
|
37
35
|
};
|
|
@@ -41,14 +39,14 @@ export function TopContentEditor() {
|
|
|
41
39
|
fetchTopContent(topContentDispatch, selectedProduct, selectedVersion);
|
|
42
40
|
};
|
|
43
41
|
useEffect(() => {
|
|
44
|
-
!isSearchModeEnabled && setFilteredTC(
|
|
42
|
+
!isSearchModeEnabled && setFilteredTC(topContentEditState);
|
|
45
43
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
46
|
-
}, [
|
|
44
|
+
}, [topContentEditState]);
|
|
47
45
|
const onAddCategory = (isMajorVersionOnly, isCreatingNewSet = false, version, hasMajorContentCreatingMinorContent) => {
|
|
48
46
|
hasMajorContentCreatingMinorContent && resetDuplicatUrls(topContentDispatch);
|
|
49
47
|
setCategoryToOpen(null);
|
|
50
48
|
setIsAddingCategory(topContentDispatch, true);
|
|
51
|
-
setAddNewSection(topContentDispatch,
|
|
49
|
+
setAddNewSection(topContentDispatch, topContentEditState, isMajorVersionOnly, isCreatingNewSet);
|
|
52
50
|
setNewCategoryVersion(version);
|
|
53
51
|
};
|
|
54
52
|
const arrangeSection = () => {
|
|
@@ -57,7 +55,7 @@ export function TopContentEditor() {
|
|
|
57
55
|
const onSaveArrangement = () => __awaiter(this, void 0, void 0, function* () {
|
|
58
56
|
setIsArrangingCats(false);
|
|
59
57
|
try {
|
|
60
|
-
yield reArrangeCategory(
|
|
58
|
+
yield reArrangeCategory(topContentEditState);
|
|
61
59
|
ToastNotification.addSuccessMessage(t('Categories updated successfully'));
|
|
62
60
|
}
|
|
63
61
|
catch (error) {
|
|
@@ -74,24 +72,24 @@ export function TopContentEditor() {
|
|
|
74
72
|
if (!result.destination || result.source.index === result.destination.index)
|
|
75
73
|
return;
|
|
76
74
|
if (result.destination.droppableId === 'content-editor-cat-drop-zone') {
|
|
77
|
-
setTopContentArrangingCategory(topContentDispatch,
|
|
75
|
+
setTopContentArrangingCategory(topContentDispatch, topContentEditState, result.source.index, result.destination.index);
|
|
78
76
|
}
|
|
79
77
|
else {
|
|
80
78
|
// pass categoryID as a part of dropabbleId
|
|
81
|
-
setTopContentArrangingContent(topContentDispatch,
|
|
79
|
+
setTopContentArrangingContent(topContentDispatch, topContentEditState, result.destination.droppableId, result.source.index, result.destination.index);
|
|
82
80
|
}
|
|
83
81
|
};
|
|
84
|
-
const showNoTopContentFound = (isEmpty(selectedProduct.name) || isEmpty(selectedVersion) ||
|
|
82
|
+
const showNoTopContentFound = (isEmpty(selectedProduct.name) || isEmpty(selectedVersion) || topContentEditState.length === 0) &&
|
|
85
83
|
!topContentResponse.isError &&
|
|
86
84
|
!topContentResponse.isFetching &&
|
|
87
85
|
!isAddingCategory;
|
|
88
86
|
const showSectionFooter = !isArrangingCats &&
|
|
89
87
|
!isAddingCategory &&
|
|
90
88
|
selectedVersion &&
|
|
91
|
-
|
|
89
|
+
topContentEditState.length !== 0 &&
|
|
92
90
|
!isSearchModeEnabled;
|
|
93
91
|
const isContentOnlyForMajorVersion = !topContentResponse.isFetching &&
|
|
94
|
-
|
|
92
|
+
topContentEditState.length !== 0 &&
|
|
95
93
|
isRegularVersion(selectedVersion) &&
|
|
96
94
|
isCatOnlyForMajorVersion &&
|
|
97
95
|
!isAddingCategory;
|
|
@@ -99,18 +97,18 @@ export function TopContentEditor() {
|
|
|
99
97
|
setIsSearchModeEnabled(topContentDispatch, searchTerm ? true : false);
|
|
100
98
|
setFilteredTC(searchResults);
|
|
101
99
|
};
|
|
102
|
-
const minorSelectedNoMinorContentButAvailableMajorContent = isContentOnlyForMajorVersion && getVersion(selectedVersion).minor &&
|
|
100
|
+
const minorSelectedNoMinorContentButAvailableMajorContent = isContentOnlyForMajorVersion && getVersion(selectedVersion).minor && topContentEditState.length !== 0;
|
|
103
101
|
return (React.createElement(React.Fragment, null,
|
|
104
102
|
React.createElement(TopContentHeader, null),
|
|
105
103
|
!topContentResponse.isFetching && topContentResponse.isError && (React.createElement(Alert, { isInline: true, variant: AlertVariant.danger, title: React.createElement(Trans, null, "Error loading Top Content") })),
|
|
106
104
|
React.createElement(TopContentProductVersionSelector, { selectedProduct: selectedProduct, selectedVersion: selectedVersion, onProductChange: onProductChange, onVersionChange: onVersionChange }),
|
|
107
|
-
!topContentResponse.isFetching && (React.createElement(TopContentSearch, { dataTrackingId: "top-content-filter-manage", topContentData:
|
|
105
|
+
!topContentResponse.isFetching && (React.createElement(TopContentSearch, { dataTrackingId: "top-content-filter-manage", topContentData: topContentEditState, onSearch: onSearch, topContentResultsWrapperRef: topContentResultsRef })),
|
|
108
106
|
React.createElement("div", { className: "top-content-manage-wrapper" },
|
|
109
107
|
topContentResponse.isFetching ? (React.createElement(Bullseye, null,
|
|
110
108
|
React.createElement(EmptyState, { variant: EmptyStateVariant.full },
|
|
111
109
|
React.createElement(Spinner, { size: "lg" })))) : (!topContentResponse.isFetching &&
|
|
112
|
-
showNoTopContentFound && (React.createElement(NoTopContentFound, { version: selectedVersion, product: selectedProduct.name, dataLength:
|
|
113
|
-
minorSelectedNoMinorContentButAvailableMajorContent ? (React.createElement(NoTopContentFound, { version: selectedVersion, product: selectedProduct.name, dataLength:
|
|
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 },
|
|
114
112
|
React.createElement(Droppable, { droppableId: "content-editor-cat-drop-zone" }, (provided) => (React.createElement("div", Object.assign({}, provided.droppableProps, { ref: (el) => {
|
|
115
113
|
provided.innerRef(el);
|
|
116
114
|
topContentResultsRef.current = el;
|
|
@@ -131,7 +129,7 @@ export function TopContentEditor() {
|
|
|
131
129
|
React.createElement(Button, { variant: "primary", onClick: () => onAddCategory(isContentOnlyForMajorVersion, false, selectedVersion), "data-tracking-id": "add-new-section-topcontent" },
|
|
132
130
|
React.createElement(Trans, null, "Add a new section")),
|
|
133
131
|
' ',
|
|
134
|
-
React.createElement(Button, { variant: "secondary", onClick: arrangeSection, isDisabled:
|
|
132
|
+
React.createElement(Button, { variant: "secondary", onClick: arrangeSection, isDisabled: topContentEditState.length < 2 },
|
|
135
133
|
React.createElement(Trans, null, "Arrange section")))),
|
|
136
134
|
isArrangingCats && (React.createElement(React.Fragment, null,
|
|
137
135
|
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,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"}
|
|
@@ -13,7 +13,6 @@ export const intialTopContentContext = {
|
|
|
13
13
|
categories: getApiResourceObject([]),
|
|
14
14
|
contentUrls: {},
|
|
15
15
|
isSearchModeEnabled: false,
|
|
16
|
-
categoryUsage: {},
|
|
17
16
|
};
|
|
18
17
|
const initalDispatchContext = null;
|
|
19
18
|
export const TopContentStateContext = React.createContext(intialTopContentContext);
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
import { ITopContentResourceUsagesResponse } from '@cee-eng/hydrajs/@types/models/topContent/topContentModel';
|
|
2
|
-
import { ITopContentEditState } from './TopContentReducer';
|
|
3
1
|
export declare const getTopContentUrl: (contentUrl: string) => string;
|
|
4
2
|
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
3
|
//# 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":"AAGA,eAAO,MAAM,gBAAgB,eAAgB,MAAM,WASlD,CAAC;AAEF,eAAO,MAAM,cAAc,6BAe1B,CAAC"}
|
|
@@ -1,16 +1,4 @@
|
|
|
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
|
-
};
|
|
12
1
|
import { getAccessHostname } from '@rh-support/api';
|
|
13
|
-
import { outlier } from '@rh-support/utils';
|
|
14
2
|
import isEmpty from 'lodash/isEmpty';
|
|
15
3
|
export const getTopContentUrl = (contentUrl) => {
|
|
16
4
|
// There is some data urls (e.g. /solutions/articles/etc.) that aren't valid urls
|
|
@@ -39,37 +27,3 @@ export const getContentUrls = (contentsArray) => {
|
|
|
39
27
|
return result;
|
|
40
28
|
}, {});
|
|
41
29
|
};
|
|
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,14 +1,12 @@
|
|
|
1
1
|
import { IProduct as IHydraProduct, IProduct } from '@cee-eng/hydrajs/@types/models/product';
|
|
2
|
-
import { ITopContent, ITopContentCategory, ITopContentList
|
|
2
|
+
import { ITopContent, ITopContentCategory, ITopContentList } 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;
|
|
7
6
|
}
|
|
8
7
|
export interface ITopContentEditState extends Omit<ITopContentList, 'content'> {
|
|
9
8
|
catMode?: string;
|
|
10
9
|
content: ITopContentItemState[];
|
|
11
|
-
isAttentionNeeded?: boolean;
|
|
12
10
|
}
|
|
13
11
|
/** sample obj for IContentUrlsDups type
|
|
14
12
|
contentUrls:IContentUrlsDups = {
|
|
@@ -36,7 +34,6 @@ export interface ITopContentState {
|
|
|
36
34
|
categories: IApiResponseDetails<ITopContentCategory[]>;
|
|
37
35
|
contentUrls: IContentUrlsDups;
|
|
38
36
|
isSearchModeEnabled: boolean;
|
|
39
|
-
categoryUsage: ITopContentResourceUsagesResponse;
|
|
40
37
|
}
|
|
41
38
|
export declare enum ContentMode {
|
|
42
39
|
INITIAL = "initial",
|
|
@@ -59,8 +56,7 @@ export declare enum TopContentReducerConstants {
|
|
|
59
56
|
updateTopContentCategories = "updateTopContentCategories",
|
|
60
57
|
changeTopContentStateOnCatsArrangementSave = "changeTopContentStateOnCatsArrangementSave",
|
|
61
58
|
setIsSearchModeEnabled = "setIsSearchModeEnabled",
|
|
62
|
-
resetDuplicatUrls = "resetDuplicatUrls"
|
|
63
|
-
getTopContentResourceUsage = "getTopContentResourceUsage"
|
|
59
|
+
resetDuplicatUrls = "resetDuplicatUrls"
|
|
64
60
|
}
|
|
65
61
|
declare type IActionType = IAction<TopContentReducerConstants, ITopContentState>;
|
|
66
62
|
export declare type TopContentReducerDispatchType = (value: IActionType) => void;
|
|
@@ -73,7 +69,6 @@ export declare const resetChangeInCategoryContent: (dispatch: TopContentReducerD
|
|
|
73
69
|
export declare const resetChangeInCategory: (dispatch: TopContentReducerDispatchType, topContentResponse: IApiResponseDetails<ITopContentEditState[]>) => void;
|
|
74
70
|
export declare const resetContentWithSelectedProduct: (dispatch: TopContentReducerDispatchType, selectedProduct: Partial<IHydraProduct>) => void;
|
|
75
71
|
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>;
|
|
77
72
|
export declare const addTopContent: (dispatch: TopContentReducerDispatchType, topContentEditState: ITopContentEditState[], categoryId: number) => void;
|
|
78
73
|
export declare const deleteTopContent: (dispatch: TopContentReducerDispatchType, topContentEditState: ITopContentEditState[], categoryId: number, topContentId: number) => Promise<never>;
|
|
79
74
|
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":"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"}
|
|
@@ -36,7 +36,6 @@ export var TopContentReducerConstants;
|
|
|
36
36
|
TopContentReducerConstants["changeTopContentStateOnCatsArrangementSave"] = "changeTopContentStateOnCatsArrangementSave";
|
|
37
37
|
TopContentReducerConstants["setIsSearchModeEnabled"] = "setIsSearchModeEnabled";
|
|
38
38
|
TopContentReducerConstants["resetDuplicatUrls"] = "resetDuplicatUrls";
|
|
39
|
-
TopContentReducerConstants["getTopContentResourceUsage"] = "getTopContentResourceUsage";
|
|
40
39
|
})(TopContentReducerConstants || (TopContentReducerConstants = {}));
|
|
41
40
|
export const TopContentReducer = (pState, action) => {
|
|
42
41
|
switch (action.type) {
|
|
@@ -73,9 +72,6 @@ export const TopContentReducer = (pState, action) => {
|
|
|
73
72
|
case TopContentReducerConstants.resetDuplicatUrls: {
|
|
74
73
|
return Object.assign(Object.assign({}, pState), { contentUrls: action.payload.contentUrls });
|
|
75
74
|
}
|
|
76
|
-
case TopContentReducerConstants.getTopContentResourceUsage: {
|
|
77
|
-
return Object.assign(Object.assign({}, pState), { categoryUsage: action.payload.categoryUsage });
|
|
78
|
-
}
|
|
79
75
|
default: {
|
|
80
76
|
return pState;
|
|
81
77
|
}
|
|
@@ -190,10 +186,7 @@ export const fetchTopContent = (dispatch, selectedProduct, selectedVersion) => _
|
|
|
190
186
|
sortby: 'rank',
|
|
191
187
|
});
|
|
192
188
|
const resultFiltered = results.filter((c) => c.content.length > 0);
|
|
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
|
-
});
|
|
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 }))) })));
|
|
197
190
|
const isCatOnlyForMajorVersion = ((_a = topContentEditState[0]) === null || _a === void 0 ? void 0 : _a.minorVersion) ? false : true;
|
|
198
191
|
const contentUrls = getContentUrls(resultFiltered);
|
|
199
192
|
dispatch({
|
|
@@ -207,8 +200,6 @@ export const fetchTopContent = (dispatch, selectedProduct, selectedVersion) => _
|
|
|
207
200
|
contentUrls,
|
|
208
201
|
},
|
|
209
202
|
});
|
|
210
|
-
// Fetch TopContent Recourse Usage
|
|
211
|
-
fetchTopContentRecourseUsage(dispatch, selectedProduct.name, selectedVersion);
|
|
212
203
|
}
|
|
213
204
|
catch (e) {
|
|
214
205
|
dispatch({
|
|
@@ -224,29 +215,6 @@ export const fetchTopContent = (dispatch, selectedProduct, selectedVersion) => _
|
|
|
224
215
|
return Promise.reject(e);
|
|
225
216
|
}
|
|
226
217
|
});
|
|
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
|
-
});
|
|
250
218
|
export const addTopContent = (dispatch, topContentEditState, categoryId) => {
|
|
251
219
|
topContentEditState.forEach((cat) => {
|
|
252
220
|
if (cat.id === categoryId) {
|
|
@@ -455,7 +423,7 @@ export const reArrangeContent = (dispatch, topContentEditState, categoryId) => _
|
|
|
455
423
|
export const reArrangeCategory = (topContentEditState) => __awaiter(void 0, void 0, void 0, function* () {
|
|
456
424
|
try {
|
|
457
425
|
const toUpdate = [];
|
|
458
|
-
topContentEditState.forEach((cat) => {
|
|
426
|
+
topContentEditState.forEach((cat, i) => {
|
|
459
427
|
cat.content.forEach((item) => {
|
|
460
428
|
toUpdate.push({
|
|
461
429
|
id: item.topContentId,
|
package/lib/esm/scss/_main.scss
CHANGED
|
@@ -220,16 +220,6 @@
|
|
|
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
|
-
}
|
|
233
223
|
}
|
|
234
224
|
|
|
235
225
|
// specific overrides under manage because of a different implementation
|
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.37",
|
|
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.27",
|
|
101
101
|
"@rh-support/configs": "0.2.5",
|
|
102
|
-
"@rh-support/react-context": "0.2.
|
|
102
|
+
"@rh-support/react-context": "0.2.30",
|
|
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.21",
|
|
105
|
+
"@rh-support/utils": "0.2.19",
|
|
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": "230218b05ecdb08d048db04a7f8fcb6646b4fa35"
|
|
117
117
|
}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,8 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,43 +0,0 @@
|
|
|
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,11 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,20 +0,0 @@
|
|
|
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,25 +0,0 @@
|
|
|
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
|
-
}
|