@rh-support/manage 2.1.95 → 2.1.96
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/ManageTabs.d.ts.map +1 -1
- package/lib/esm/ManageTabs.js +11 -1
- package/lib/esm/Routes.d.ts +1 -0
- package/lib/esm/Routes.d.ts.map +1 -1
- package/lib/esm/Routes.js +6 -0
- package/lib/esm/components/ManageBookmarkedAccountsTab/BookmarkAccountSelector.d.ts.map +1 -1
- package/lib/esm/components/ManageBookmarkedAccountsTab/BookmarkAccountSelector.js +6 -1
- package/lib/esm/components/ManageExpiredContents/ExpiredContentCategory.d.ts +9 -0
- package/lib/esm/components/ManageExpiredContents/ExpiredContentCategory.d.ts.map +1 -0
- package/lib/esm/components/ManageExpiredContents/ExpiredContentCategory.js +18 -0
- package/lib/esm/components/ManageExpiredContents/ExpiredContentHeader.d.ts +3 -0
- package/lib/esm/components/ManageExpiredContents/ExpiredContentHeader.d.ts.map +1 -0
- package/lib/esm/components/ManageExpiredContents/ExpiredContentHeader.js +9 -0
- package/lib/esm/components/ManageExpiredContents/ExpiredContentManagement.d.ts +3 -0
- package/lib/esm/components/ManageExpiredContents/ExpiredContentManagement.d.ts.map +1 -0
- package/lib/esm/components/ManageExpiredContents/ExpiredContentManagement.js +13 -0
- package/lib/esm/components/ManageExpiredContents/ExpiredContentManager.d.ts +3 -0
- package/lib/esm/components/ManageExpiredContents/ExpiredContentManager.d.ts.map +1 -0
- package/lib/esm/components/ManageExpiredContents/ExpiredContentManager.js +70 -0
- package/lib/esm/components/ManageExpiredContents/ExpiredContentSingleItem.d.ts +9 -0
- package/lib/esm/components/ManageExpiredContents/ExpiredContentSingleItem.d.ts.map +1 -0
- package/lib/esm/components/ManageExpiredContents/ExpiredContentSingleItem.js +77 -0
- package/lib/esm/components/ManageExpiredContents/ExpiredContentSingleItemView.d.ts +14 -0
- package/lib/esm/components/ManageExpiredContents/ExpiredContentSingleItemView.d.ts.map +1 -0
- package/lib/esm/components/ManageExpiredContents/ExpiredContentSingleItemView.js +141 -0
- package/lib/esm/components/ManageExpiredContents/index.d.ts +2 -0
- package/lib/esm/components/ManageExpiredContents/index.d.ts.map +1 -0
- package/lib/esm/components/ManageExpiredContents/index.js +1 -0
- package/lib/esm/components/ManageTags/TagsManager.d.ts.map +1 -1
- package/lib/esm/components/ManageTags/TagsManager.js +5 -4
- package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentSingleItem.d.ts +2 -0
- package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentSingleItem.d.ts.map +1 -1
- package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentSingleItem.js +74 -19
- package/lib/esm/context/ExpiredContentContextProvider.d.ts +8 -0
- package/lib/esm/context/ExpiredContentContextProvider.d.ts.map +1 -0
- package/lib/esm/context/ExpiredContentContextProvider.js +10 -0
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +1 -0
- package/lib/esm/reducers/ExpiredContentReducer.d.ts +35 -0
- package/lib/esm/reducers/ExpiredContentReducer.d.ts.map +1 -0
- package/lib/esm/reducers/ExpiredContentReducer.js +190 -0
- package/lib/esm/reducers/TopContentReducer.d.ts.map +1 -1
- package/lib/esm/reducers/TopContentReducer.js +12 -6
- package/package.json +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ManageTabs.d.ts","sourceRoot":"","sources":["../../src/ManageTabs.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,mBAAmB,EAAa,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"ManageTabs.d.ts","sourceRoot":"","sources":["../../src/ManageTabs.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,mBAAmB,EAAa,MAAM,kBAAkB,CAAC;AAclE,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,EAAE,CAAC,CAAC;IACpC,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,qBAqMvC"}
|
package/lib/esm/ManageTabs.js
CHANGED
|
@@ -8,6 +8,7 @@ import { useParams } from 'react-router-dom';
|
|
|
8
8
|
import { ConfigsTable } from './components/Configs/ConfigsTable';
|
|
9
9
|
import { ManageGroupUsers } from './components/Groups/ManageGroupUsers';
|
|
10
10
|
import { ManageGroupedBookmarkedAccountsTab } from './components/ManageBookmarkedAccountsTab';
|
|
11
|
+
import { ExpiredContentManagement } from './components/ManageExpiredContents/ExpiredContentManagement';
|
|
11
12
|
import { ManagePartnerships } from './components/ManagePartnerships/index';
|
|
12
13
|
import { ManagePreferences } from './components/ManagePreferences';
|
|
13
14
|
import { TagsManagement } from './components/ManageTags';
|
|
@@ -20,7 +21,7 @@ export function ManageTabs(props) {
|
|
|
20
21
|
const [activeTabKey, setActiveTabKey] = useState(0);
|
|
21
22
|
const { activeTab } = useParams();
|
|
22
23
|
const { t } = useTranslation();
|
|
23
|
-
const { groupsRoute, bookmarkedAccountsRoute, topContentRoute, notificationEmailsRoute, preferencesRoute, configsRoute, partnershipsRoute, tagsManagerRoute, } = Routes.getPaths();
|
|
24
|
+
const { groupsRoute, bookmarkedAccountsRoute, topContentRoute, notificationEmailsRoute, preferencesRoute, configsRoute, partnershipsRoute, tagsManagerRoute, expiredContentRoute, } = Routes.getPaths();
|
|
24
25
|
useDocumentTitle(PageTitle.MANAGE);
|
|
25
26
|
const canViewManageTab = ability.can(resourceActions.READ, resources.MANAGE);
|
|
26
27
|
const canViewManageTopContent = ability.can(resourceActions.READ, resources.TOP_CONTENT) && canViewManageTab;
|
|
@@ -85,6 +86,15 @@ export function ManageTabs(props) {
|
|
|
85
86
|
component: React.createElement(TopContentManagement, null),
|
|
86
87
|
id: 'manage-top-content',
|
|
87
88
|
});
|
|
89
|
+
canViewManageTopContent &&
|
|
90
|
+
tabsToRender.push({
|
|
91
|
+
title: 'Expired Content',
|
|
92
|
+
key: 'expired-content-tab',
|
|
93
|
+
'data-tracking-id': 'manage-expired-content-tab',
|
|
94
|
+
routePath: expiredContentRoute,
|
|
95
|
+
id: 'manage-expired-content',
|
|
96
|
+
component: React.createElement(ExpiredContentManagement, null),
|
|
97
|
+
});
|
|
88
98
|
canViewManageTopContent &&
|
|
89
99
|
tabsToRender.push({
|
|
90
100
|
title: 'Tags Manager',
|
package/lib/esm/Routes.d.ts
CHANGED
package/lib/esm/Routes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Routes.d.ts","sourceRoot":"","sources":["../../src/Routes.ts"],"names":[],"mappings":"AAAA,UAAU,KAAK;IACX,QAAQ,CAAC,OAAO,EAAE,MAAM,MAAM,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACzB;AAED,UAAU,YAAY;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB,EAAE,KAAK,CAAC;IAC1B,eAAe,EAAE,KAAK,CAAC;IACvB,QAAQ,EAAE,MAAM;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAC1C,aAAa,EAAE,MAAM,MAAM,EAAE,CAAC;IAC9B,MAAM,EAAE,KAAK,CAAC;IACd,aAAa,EAAE,KAAK,CAAC;IACrB,UAAU,EAAE,KAAK,CAAC;IAClB,WAAW,EAAE,KAAK,CAAC;IACnB,WAAW,EAAE,KAAK,CAAC;IACnB,kBAAkB,EAAE,KAAK,CAAC;IAC1B,OAAO,EAAE,KAAK,CAAC;IACf,YAAY,EAAE,KAAK,CAAC;CACvB;AAED,eAAO,MAAM,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"Routes.d.ts","sourceRoot":"","sources":["../../src/Routes.ts"],"names":[],"mappings":"AAAA,UAAU,KAAK;IACX,QAAQ,CAAC,OAAO,EAAE,MAAM,MAAM,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACzB;AAED,UAAU,YAAY;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB,EAAE,KAAK,CAAC;IAC1B,eAAe,EAAE,KAAK,CAAC;IACvB,QAAQ,EAAE,MAAM;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAC1C,aAAa,EAAE,MAAM,MAAM,EAAE,CAAC;IAC9B,MAAM,EAAE,KAAK,CAAC;IACd,aAAa,EAAE,KAAK,CAAC;IACrB,UAAU,EAAE,KAAK,CAAC;IAClB,cAAc,EAAE,KAAK,CAAC;IACtB,WAAW,EAAE,KAAK,CAAC;IACnB,WAAW,EAAE,KAAK,CAAC;IACnB,kBAAkB,EAAE,KAAK,CAAC;IAC1B,OAAO,EAAE,KAAK,CAAC;IACf,YAAY,EAAE,KAAK,CAAC;CACvB;AAED,eAAO,MAAM,MAAM,EAAE,YAqFpB,CAAC"}
|
package/lib/esm/Routes.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BookmarkAccountSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/ManageBookmarkedAccountsTab/BookmarkAccountSelector.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAIhF,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"BookmarkAccountSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/ManageBookmarkedAccountsTab/BookmarkAccountSelector.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAIhF,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAQtD,OAAO,KAAsC,MAAM,OAAO,CAAC;AAG3D,UAAU,MAAM;IACZ,uBAAuB,EAAE,SAAS,EAAE,CAAC;IACrC,iBAAiB,CAAC,EAAE,kBAAkB,CAAC;IACvC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,yBAAyB,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,IAAI,CAAC;IAC5D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,SAAS,EAAE,CAAC;IAC9B,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,qBA6PpD;yBA7Pe,uBAAuB"}
|
|
@@ -11,6 +11,7 @@ import { accounts } from '@cee-eng/hydrajs';
|
|
|
11
11
|
import { Label, LabelGroup, Tooltip } from '@patternfly/react-core';
|
|
12
12
|
import { Select, SelectOption, SelectVariant } from '@patternfly/react-core/deprecated';
|
|
13
13
|
import InfoCircleIcon from '@patternfly/react-icons/dist/js/icons/info-circle-icon';
|
|
14
|
+
import { sortAccountsByQuery } from '@rh-support/react-context/src/utils/utils';
|
|
14
15
|
import assign from 'lodash/assign';
|
|
15
16
|
import compact from 'lodash/compact';
|
|
16
17
|
import debounce from 'lodash/debounce';
|
|
@@ -41,12 +42,15 @@ export function BookmarkAccountSelector(props) {
|
|
|
41
42
|
limit: 60,
|
|
42
43
|
accountNumberNotNull: true,
|
|
43
44
|
};
|
|
45
|
+
let queryKey;
|
|
44
46
|
// query as number is a hack to get around TS, isNaN can take a string but it was throwing error here
|
|
45
47
|
if (isNaN(query)) {
|
|
46
48
|
params.nameLike = query;
|
|
49
|
+
queryKey = 'name';
|
|
47
50
|
}
|
|
48
51
|
else {
|
|
49
52
|
params.accountNumberLike = query;
|
|
53
|
+
queryKey = 'accountNumber';
|
|
50
54
|
}
|
|
51
55
|
const queryParams = !isEmpty(props.accountListParams)
|
|
52
56
|
? assign({}, props.accountListParams, params)
|
|
@@ -67,7 +71,8 @@ export function BookmarkAccountSelector(props) {
|
|
|
67
71
|
return bookmarksMatch.length > 0
|
|
68
72
|
? Object.assign(Object.assign({}, account), { bookmarkGroupName: acountGroups, isBookmarked: true, isBookmarkedAndHasGroup: acountGroups.length > 0 }) : Object.assign(Object.assign({}, account), { bookmarkGroupName: [], isBookmarked: false, isBookmarkedAndHasGroup: false });
|
|
69
73
|
});
|
|
70
|
-
|
|
74
|
+
const sortedOptions = sortAccountsByQuery(accountsResponse, query, queryKey);
|
|
75
|
+
setOptions(sortedOptions);
|
|
71
76
|
setIsSearching(false);
|
|
72
77
|
}
|
|
73
78
|
catch (err) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IExpiredContentEditState } from '../../reducers/ExpiredContentReducer';
|
|
3
|
+
interface IProps {
|
|
4
|
+
category: IExpiredContentEditState;
|
|
5
|
+
isCategoryExpanded?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export default function ExpiredContentCategory({ category, isCategoryExpanded }: IProps): React.JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=ExpiredContentCategory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpiredContentCategory.d.ts","sourceRoot":"","sources":["../../../../src/components/ManageExpiredContents/ExpiredContentCategory.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAGhF,UAAU,MAAM;IACZ,QAAQ,EAAE,wBAAwB,CAAC;IACnC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,EAAE,QAAQ,EAAE,kBAA0B,EAAE,EAAE,MAAM,qBA0B9F"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AccordionContent, AccordionItem, AccordionToggle } from '@patternfly/react-core';
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import ExpiredContentSingleItem from './ExpiredContentSingleItem';
|
|
4
|
+
export default function ExpiredContentCategory({ category, isCategoryExpanded = false }) {
|
|
5
|
+
const [isExpanded, setIsExpanded] = useState(isCategoryExpanded);
|
|
6
|
+
const toggleExpanded = () => {
|
|
7
|
+
setIsExpanded((pre) => !pre);
|
|
8
|
+
};
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
isCategoryExpanded !== isExpanded && setIsExpanded(isCategoryExpanded);
|
|
11
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
12
|
+
}, [isCategoryExpanded]);
|
|
13
|
+
return (React.createElement(AccordionItem, null,
|
|
14
|
+
React.createElement(AccordionToggle, { id: category.categoryName, onClick: toggleExpanded, isExpanded: isExpanded },
|
|
15
|
+
React.createElement("h3", null, category.categoryName)),
|
|
16
|
+
React.createElement(AccordionContent, { isHidden: !isExpanded },
|
|
17
|
+
React.createElement("ul", { className: "list-flat list-flushleft" }, category.content.map((content, i) => (React.createElement(ExpiredContentSingleItem, { key: content.topContentId, content: content, category: category })))))));
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpiredContentHeader.d.ts","sourceRoot":"","sources":["../../../../src/components/ManageExpiredContents/ExpiredContentHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,CAAC,OAAO,UAAU,oBAAoB,sBAW3C"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Trans } from 'react-i18next';
|
|
3
|
+
export default function ExpiredContentHeader() {
|
|
4
|
+
return (React.createElement("header", null,
|
|
5
|
+
React.createElement("h2", null,
|
|
6
|
+
React.createElement(Trans, null, "Outdated Content")),
|
|
7
|
+
React.createElement("p", { className: "pf-v5-u-mt-md pf-v5-u-mb-sm" },
|
|
8
|
+
React.createElement(Trans, null))));
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpiredContentManagement.d.ts","sourceRoot":"","sources":["../../../../src/components/ManageExpiredContents/ExpiredContentManagement.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,wBAAgB,wBAAwB,sBAWvC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ErrorBoundary } from '@rh-support/components';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { ExpiredContentContextProvider } from '../../context/ExpiredContentContextProvider';
|
|
5
|
+
import { TagManagementContextProvider } from '../../context/TagManagementContextProvider';
|
|
6
|
+
import ExipredContentManager from './ExpiredContentManager';
|
|
7
|
+
export function ExpiredContentManagement() {
|
|
8
|
+
const { t } = useTranslation();
|
|
9
|
+
return (React.createElement(ErrorBoundary, { errorMsgInfo: { message: t('There was an error loading contents') } },
|
|
10
|
+
React.createElement(TagManagementContextProvider, null,
|
|
11
|
+
React.createElement(ExpiredContentContextProvider, null,
|
|
12
|
+
React.createElement(ExipredContentManager, null)))));
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpiredContentManager.d.ts","sourceRoot":"","sources":["../../../../src/components/ManageExpiredContents/ExpiredContentManager.tsx"],"names":[],"mappings":"AAeA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAUhF,MAAM,CAAC,OAAO,UAAU,qBAAqB,sBAoH5C"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Accordion, Bullseye, EmptyState, EmptyStateBody, EmptyStateHeader, EmptyStateIcon, EmptyStateVariant, Spinner, Switch, } from '@patternfly/react-core';
|
|
2
|
+
import SearchIcon from '@patternfly/react-icons/dist/js/icons/search-icon';
|
|
3
|
+
import { TagsSelector, TopContentSearch } from '@rh-support/components';
|
|
4
|
+
import isEmpty from 'lodash/isEmpty';
|
|
5
|
+
import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
6
|
+
import { Trans, useTranslation } from 'react-i18next';
|
|
7
|
+
import { ExpiredContentDispatchContext, ExpiredContentStateContext } from '../../context/ExpiredContentContextProvider';
|
|
8
|
+
import { TagManagementDispatchContext, TagManagementStateContext } from '../../context/TagManagementContextProvider';
|
|
9
|
+
import { fetchExpiredContent, setExpiredContentFilteredTags } from '../../reducers/ExpiredContentReducer';
|
|
10
|
+
import { fetchTopContentTags } from '../../reducers/TagManagmentReducer';
|
|
11
|
+
import ExpiredContentCategory from './ExpiredContentCategory';
|
|
12
|
+
import ExpiredContentHeader from './ExpiredContentHeader';
|
|
13
|
+
export default function ExipredContentManager() {
|
|
14
|
+
const expiredContentResultsRef = useRef(null);
|
|
15
|
+
const { t } = useTranslation();
|
|
16
|
+
const [showApprochingExpiry, setShowApprochingExpiry] = useState(false);
|
|
17
|
+
const { expiredContentEditState, expiredContentResponse, filteredTags } = useContext(ExpiredContentStateContext);
|
|
18
|
+
const { tags: availableTags } = useContext(TagManagementStateContext);
|
|
19
|
+
const dispatch = useContext(ExpiredContentDispatchContext);
|
|
20
|
+
const tagManagerDispatch = useContext(TagManagementDispatchContext);
|
|
21
|
+
const [contentFilteredByQuery, setContentFilteredByQuery] = useState(expiredContentEditState);
|
|
22
|
+
const [searchQuery, setSearchQuery] = useState('');
|
|
23
|
+
const onSearch = (searchTerm, searchResults) => {
|
|
24
|
+
setContentFilteredByQuery(searchResults);
|
|
25
|
+
};
|
|
26
|
+
const filteredEC = useMemo(() => {
|
|
27
|
+
if (isEmpty(filteredTags))
|
|
28
|
+
return contentFilteredByQuery;
|
|
29
|
+
const filteredTagsIds = filteredTags.map((tag) => tag.id);
|
|
30
|
+
//filter top contents on basis of tags
|
|
31
|
+
const filteredData = contentFilteredByQuery.flatMap((item) => {
|
|
32
|
+
const contents = item.content.filter((content) => (content.tags || []).some((tag) => filteredTagsIds.includes(tag.id)));
|
|
33
|
+
if (!isEmpty(contents))
|
|
34
|
+
return [Object.assign(Object.assign({}, item), { content: contents })];
|
|
35
|
+
return [];
|
|
36
|
+
});
|
|
37
|
+
return filteredData;
|
|
38
|
+
}, [contentFilteredByQuery, filteredTags]);
|
|
39
|
+
const handleChange = (_event, checked) => {
|
|
40
|
+
setShowApprochingExpiry(checked);
|
|
41
|
+
fetchExpiredContent(dispatch, checked);
|
|
42
|
+
};
|
|
43
|
+
const onTagFilterChange = (tags) => {
|
|
44
|
+
setExpiredContentFilteredTags(dispatch, tags);
|
|
45
|
+
};
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
fetchExpiredContent(dispatch);
|
|
48
|
+
fetchTopContentTags(tagManagerDispatch, false);
|
|
49
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
50
|
+
}, []);
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
setContentFilteredByQuery(expiredContentEditState);
|
|
53
|
+
}, [expiredContentEditState]);
|
|
54
|
+
return (React.createElement(React.Fragment, null,
|
|
55
|
+
React.createElement(ExpiredContentHeader, null),
|
|
56
|
+
React.createElement("div", { className: "toolbar" },
|
|
57
|
+
React.createElement(TopContentSearch, { dataTrackingId: "expired-content-filter-manage", topContentData: expiredContentEditState, onSearch: onSearch, topContentResultsWrapperRef: expiredContentResultsRef, className: "toolbar-content", isDisabled: expiredContentResponse.isFetching, searchQuery: searchQuery, setSearchQuery: setSearchQuery }),
|
|
58
|
+
React.createElement("div", { className: "toolbar-content pf-v5-u-ml-md" },
|
|
59
|
+
React.createElement("label", { htmlFor: 'tag-selector' },
|
|
60
|
+
React.createElement(Trans, null, "All tags")),
|
|
61
|
+
React.createElement(TagsSelector, { tagOptions: availableTags, onChange: onTagFilterChange, selectedTags: filteredTags, disabled: expiredContentResponse.isFetching })),
|
|
62
|
+
React.createElement("div", { className: "toolbar-content pf-v5-u-mt-md" },
|
|
63
|
+
React.createElement(Switch, { id: "content-approaching-expiry-", label: t('Show approaching expiry'), isChecked: showApprochingExpiry, onChange: handleChange }))),
|
|
64
|
+
React.createElement("div", { className: "expired-content-manage-wrapper pf-v5-u-pt-md", ref: expiredContentResultsRef }, expiredContentResponse.isFetching ? (React.createElement(Bullseye, null,
|
|
65
|
+
React.createElement(EmptyState, { variant: EmptyStateVariant.full },
|
|
66
|
+
React.createElement(Spinner, { size: "lg" })))) : isEmpty(filteredEC) ? (React.createElement(EmptyState, { variant: EmptyStateVariant.xs },
|
|
67
|
+
React.createElement(EmptyStateHeader, { titleText: React.createElement(Trans, null, "No contents found"), icon: React.createElement(EmptyStateIcon, { icon: SearchIcon }) }),
|
|
68
|
+
React.createElement(EmptyStateBody, null,
|
|
69
|
+
React.createElement(Trans, null, "There are no contents to display")))) : (React.createElement(Accordion, null, filteredEC.map((category, i) => (React.createElement(ExpiredContentCategory, { key: category.id, category: category, isCategoryExpanded: !isEmpty(searchQuery) || !isEmpty(filteredTags) }))))))));
|
|
70
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IExpiredContent, IExpiredContentEditState } from '../../reducers/ExpiredContentReducer';
|
|
3
|
+
interface IProps {
|
|
4
|
+
content: IExpiredContent;
|
|
5
|
+
category: IExpiredContentEditState;
|
|
6
|
+
}
|
|
7
|
+
export default function ExpiredContentSingleItem({ content, category }: IProps): React.JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=ExpiredContentSingleItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpiredContentSingleItem.d.ts","sourceRoot":"","sources":["../../../../src/components/ManageExpiredContents/ExpiredContentSingleItem.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAIpD,OAAO,EAEH,eAAe,EACf,wBAAwB,EAE3B,MAAM,sCAAsC,CAAC;AAG9C,UAAU,MAAM;IACZ,OAAO,EAAE,eAAe,CAAC;IACzB,QAAQ,EAAE,wBAAwB,CAAC;CACtC;AAED,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,MAAM,qBA2G7E"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { Button, Label } from '@patternfly/react-core';
|
|
11
|
+
import EditAltIcon from '@patternfly/react-icons/dist/js/icons/edit-alt-icon';
|
|
12
|
+
import { ToastNotification } from '@rh-support/components';
|
|
13
|
+
import { formatDate, isFutureDate } from '@rh-support/utils';
|
|
14
|
+
import React, { useContext, useState } from 'react';
|
|
15
|
+
import { useTranslation } from 'react-i18next';
|
|
16
|
+
import { ExpiredContentDispatchContext, ExpiredContentStateContext } from '../../context/ExpiredContentContextProvider';
|
|
17
|
+
import { deleteExpiredContent, updateExpiredContent, } from '../../reducers/ExpiredContentReducer';
|
|
18
|
+
import ExpiredContentSingleItemView from './ExpiredContentSingleItemView';
|
|
19
|
+
export default function ExpiredContentSingleItem({ content, category }) {
|
|
20
|
+
var _a, _b;
|
|
21
|
+
const { t } = useTranslation();
|
|
22
|
+
const { expiredContentEditState, filteredTags } = useContext(ExpiredContentStateContext);
|
|
23
|
+
const dispatch = useContext(ExpiredContentDispatchContext);
|
|
24
|
+
const [isPreview, setIsPreview] = useState(true);
|
|
25
|
+
const [isSaving, setIsSaving] = useState(false);
|
|
26
|
+
const [isDeleting, setIsDeleting] = useState(false);
|
|
27
|
+
const editToggle = () => {
|
|
28
|
+
setIsPreview(!isPreview);
|
|
29
|
+
};
|
|
30
|
+
const onSave = (updatedContent, deletedTags) => __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
try {
|
|
32
|
+
setIsSaving(true);
|
|
33
|
+
yield updateExpiredContent(dispatch, expiredContentEditState, category.categoryId, updatedContent, deletedTags);
|
|
34
|
+
editToggle();
|
|
35
|
+
ToastNotification.addSuccessMessage(t('Content updated successfully'));
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
ToastNotification.addDangerMessage(t('There was an error updating content'));
|
|
39
|
+
}
|
|
40
|
+
finally {
|
|
41
|
+
setIsSaving(false);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
const onDelete = () => __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
try {
|
|
46
|
+
setIsDeleting(true);
|
|
47
|
+
yield deleteExpiredContent(dispatch, expiredContentEditState, category.id, content.topContentId);
|
|
48
|
+
editToggle();
|
|
49
|
+
ToastNotification.addSuccessMessage(t('Content deleted successfully'));
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
ToastNotification.addDangerMessage(t('There was an error deleting content'));
|
|
53
|
+
}
|
|
54
|
+
finally {
|
|
55
|
+
setIsDeleting(false);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
const lastModifiedBy = t(`Last modified {{created}} by {{by}}`, {
|
|
59
|
+
created: formatDate(content.updatedOn || content.createdOn),
|
|
60
|
+
by: content.updatedBy || content.createdBy,
|
|
61
|
+
});
|
|
62
|
+
const expiredText = t(` ${isFutureDate(content.expiryDate) ? 'Expires' : 'Expired'} on {{expired}}`, {
|
|
63
|
+
expired: formatDate(content.expiryDate),
|
|
64
|
+
});
|
|
65
|
+
return (React.createElement(React.Fragment, null, isPreview ? (React.createElement("li", { className: `push-bottom-narrow` },
|
|
66
|
+
React.createElement("a", { className: 'pcm-manage-top-content', "data-tracking-id": "pcm-manage-top-content", href: content.contentUrl, target: "_blank", rel: "noopener noreferrer" }, content.contentTitle),
|
|
67
|
+
React.createElement(Button, { variant: "link", isInline: true, icon: React.createElement(EditAltIcon, null), onClick: editToggle, title: 'Edit', "data-tracking-id": "edit-expired-top-content" }),
|
|
68
|
+
React.createElement("div", null,
|
|
69
|
+
lastModifiedBy,
|
|
70
|
+
" | ",
|
|
71
|
+
expiredText,
|
|
72
|
+
" | ",
|
|
73
|
+
content.product,
|
|
74
|
+
" ", (_a = content.majorVersion) !== null && _a !== void 0 ? _a : '',
|
|
75
|
+
content.minorVersion ? `.${content.minorVersion}` : ''),
|
|
76
|
+
React.createElement("div", null, (_b = content.tags) === null || _b === void 0 ? void 0 : _b.map((tag) => (React.createElement(Label, { isCompact: true, className: "pf-v5-u-mr-xs pf-v5-u-mt-sm", key: tag.id, color: filteredTags.some((t) => t.id === tag.id) ? 'gold' : 'grey' }, tag.tagName)))))) : (React.createElement(ExpiredContentSingleItemView, { category: category, content: content, onCancel: editToggle, onSave: onSave, onDelete: onDelete, isDeleting: isDeleting, isSaving: isSaving }))));
|
|
77
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IExpiredContent, IExpiredContentEditState } from '../../reducers/ExpiredContentReducer';
|
|
3
|
+
interface IProps {
|
|
4
|
+
content: IExpiredContent;
|
|
5
|
+
category: IExpiredContentEditState;
|
|
6
|
+
onCancel: () => void;
|
|
7
|
+
onSave: (updatedContent: any, deletedTags: any[]) => void;
|
|
8
|
+
onDelete: () => void;
|
|
9
|
+
isSaving?: boolean;
|
|
10
|
+
isDeleting?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export default function ExpiredContentSingleItemView({ category, content, onCancel, onSave, onDelete, isSaving, isDeleting, }: IProps): React.JSX.Element;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=ExpiredContentSingleItemView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpiredContentSingleItemView.d.ts","sourceRoot":"","sources":["../../../../src/components/ManageExpiredContents/ExpiredContentSingleItemView.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAI7D,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAIjG,UAAU,MAAM;IACZ,OAAO,EAAE,eAAe,CAAC;IACzB,QAAQ,EAAE,wBAAwB,CAAC;IACnC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,EAAE,CAAC,cAAc,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;IAC1D,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,CAAC,OAAO,UAAU,4BAA4B,CAAC,EACjD,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,UAAU,GACb,EAAE,MAAM,qBAmNR"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { Button, DatePicker, Flex, FlexItem, FormGroup, TextInput, ValidatedOptions } from '@patternfly/react-core';
|
|
11
|
+
import { TagsSelector, ToastNotification } from '@rh-support/components';
|
|
12
|
+
import { getDrupalResIdIfTypeFromUrl, getText, isValidDate, isValidUrl } from '@rh-support/utils';
|
|
13
|
+
import { isEqual } from 'lodash';
|
|
14
|
+
import differenceBy from 'lodash/differenceBy';
|
|
15
|
+
import isEmpty from 'lodash/isEmpty';
|
|
16
|
+
import React, { useContext, useMemo, useState } from 'react';
|
|
17
|
+
import { Trans, useTranslation } from 'react-i18next';
|
|
18
|
+
import { TagManagementStateContext } from '../../context/TagManagementContextProvider';
|
|
19
|
+
import { getTopContentUrl } from '../../reducers/TopContentHelpers';
|
|
20
|
+
import { getDocsFromUrl } from '../TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentSingleItem';
|
|
21
|
+
export default function ExpiredContentSingleItemView({ category, content, onCancel, onSave, onDelete, isSaving, isDeleting, }) {
|
|
22
|
+
var _a, _b;
|
|
23
|
+
const { t } = useTranslation();
|
|
24
|
+
const tagManagementEditState = useContext(TagManagementStateContext);
|
|
25
|
+
const { tags: tagOptions } = tagManagementEditState;
|
|
26
|
+
const [isFetchingSolrSearch, setIsFetchingSolrSearch] = useState(false);
|
|
27
|
+
const [localContentUrl, setLocalContentUrl] = useState(content.contentUrl);
|
|
28
|
+
const [localContentTitle, setLocalContentTitle] = useState(content.contentTitle);
|
|
29
|
+
const [localSelectedTags, setLocalSelectedTags] = useState(content.tags || []);
|
|
30
|
+
const [localExpiryDate, setLocalExpiryDate] = useState((content === null || content === void 0 ? void 0 : content.expiryDate) || '');
|
|
31
|
+
const [contentTitleIsValid, setContentTitleIsValid] = useState(true);
|
|
32
|
+
const [contentUrlIsValid, setContentUrlIsValid] = useState(true);
|
|
33
|
+
const oldTagsIds = useMemo(() => { var _a; return ((_a = content === null || content === void 0 ? void 0 : content.tags) === null || _a === void 0 ? void 0 : _a.map((t) => t.id)) || []; }, [content === null || content === void 0 ? void 0 : content.tags]);
|
|
34
|
+
const localTagsIds = useMemo(() => localSelectedTags === null || localSelectedTags === void 0 ? void 0 : localSelectedTags.map((t) => t.id), [localSelectedTags]);
|
|
35
|
+
const onSubmit = (e) => e.preventDefault();
|
|
36
|
+
const updateContentTitleFromUrl = (contentUrl) => __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
var _c, _d;
|
|
38
|
+
// throws toast warning and clears it after 4 seconds
|
|
39
|
+
const throwWarningMessage = () => {
|
|
40
|
+
const message = getText('Unable to automatically fetch title. Please enter manually');
|
|
41
|
+
ToastNotification.addWarningMessage(message, '', { autoClose: 4000 });
|
|
42
|
+
};
|
|
43
|
+
try {
|
|
44
|
+
const nodeId = getDrupalResIdIfTypeFromUrl(contentUrl);
|
|
45
|
+
if (!nodeId)
|
|
46
|
+
return;
|
|
47
|
+
const docs = yield getDocsFromUrl(contentUrl);
|
|
48
|
+
const contentTitle = ((_c = docs[0]) === null || _c === void 0 ? void 0 : _c.publishedTitle) || ((_d = docs[0]) === null || _d === void 0 ? void 0 : _d.allTitle);
|
|
49
|
+
if (docs.length > 0 && docs[0].id === nodeId + '' && contentTitle) {
|
|
50
|
+
setLocalContentTitle(contentTitle);
|
|
51
|
+
setContentTitleIsValid(true);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
throwWarningMessage();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch (e) {
|
|
58
|
+
throwWarningMessage();
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
const onLocalContentUrlChange = () => __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
if (localContentUrl === content.contentUrl)
|
|
63
|
+
return;
|
|
64
|
+
setIsFetchingSolrSearch(true);
|
|
65
|
+
yield updateContentTitleFromUrl(localContentUrl);
|
|
66
|
+
setIsFetchingSolrSearch(false);
|
|
67
|
+
});
|
|
68
|
+
const checkDuplicateUrls = (url) => {
|
|
69
|
+
//
|
|
70
|
+
onLocalContentUrlChange();
|
|
71
|
+
};
|
|
72
|
+
const onContentUrlChange = (contentUrl, event) => __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
setContentUrlIsValid(isValidUrl(contentUrl));
|
|
74
|
+
checkDuplicateUrls(contentUrl);
|
|
75
|
+
setLocalContentUrl(contentUrl);
|
|
76
|
+
});
|
|
77
|
+
const onContentTitleChange = (contentTitle, event) => {
|
|
78
|
+
const contentTitleIsValid = event.target.validity.valid;
|
|
79
|
+
setContentTitleIsValid(contentTitleIsValid);
|
|
80
|
+
setLocalContentTitle(contentTitle);
|
|
81
|
+
};
|
|
82
|
+
const handleLocalTagChange = (tags) => {
|
|
83
|
+
setLocalSelectedTags(tags);
|
|
84
|
+
};
|
|
85
|
+
const onExpiryDateChange = (event, str, date) => {
|
|
86
|
+
setLocalExpiryDate(str);
|
|
87
|
+
};
|
|
88
|
+
const expiryDateValidator = (date) => {
|
|
89
|
+
if (date < new Date())
|
|
90
|
+
return t('Invalid expiry date');
|
|
91
|
+
return '';
|
|
92
|
+
};
|
|
93
|
+
const onContentSave = () => {
|
|
94
|
+
const newTags = differenceBy(localTagsIds, oldTagsIds);
|
|
95
|
+
const deletedTags = differenceBy(oldTagsIds, localTagsIds);
|
|
96
|
+
const updatedContent = Object.assign(Object.assign({}, content), { contentTitle: localContentTitle, contentUrl: localContentUrl, tagList: newTags, tags: localSelectedTags.map((t) => ({ id: t.id, tagName: t.tagName })), expiryDate: localExpiryDate });
|
|
97
|
+
onSave(updatedContent, deletedTags);
|
|
98
|
+
};
|
|
99
|
+
const doesInputHasSpaces = isEmpty(localContentTitle.trim());
|
|
100
|
+
const isSaveButtonDisabled = doesInputHasSpaces ||
|
|
101
|
+
!(contentTitleIsValid &&
|
|
102
|
+
contentUrlIsValid &&
|
|
103
|
+
localContentTitle &&
|
|
104
|
+
localContentUrl &&
|
|
105
|
+
((isValidDate(localExpiryDate) && isEmpty(expiryDateValidator(new Date(localExpiryDate)))) ||
|
|
106
|
+
(isEmpty(localExpiryDate) && isEmpty((_a = content.expiryDate) !== null && _a !== void 0 ? _a : '')))) ||
|
|
107
|
+
(localContentUrl === content.contentUrl &&
|
|
108
|
+
localContentTitle === content.contentTitle &&
|
|
109
|
+
isEqual(localTagsIds, oldTagsIds) &&
|
|
110
|
+
isEqual(localExpiryDate.split('T')[0], ((_b = content.expiryDate) === null || _b === void 0 ? void 0 : _b.split('T')[0]) || ''));
|
|
111
|
+
return (React.createElement("form", { noValidate: true, onSubmit: onSubmit, className: "card card-light push-bottom" },
|
|
112
|
+
React.createElement("div", { className: "form-group" },
|
|
113
|
+
React.createElement("label", { htmlFor: localContentTitle },
|
|
114
|
+
"Heading",
|
|
115
|
+
' ',
|
|
116
|
+
React.createElement("span", { className: "form-required", "aria-hidden": true }, "*")),
|
|
117
|
+
React.createElement(TextInput, { isRequired: true, type: "text", maxLength: 254, required: true, value: localContentTitle, isDisabled: isFetchingSolrSearch, "aria-label": t('Copy and paste the heading for consistency'), placeholder: t('Copy and paste the heading for consistency'), onChange: (e, v) => onContentTitleChange(v, e), validated: contentTitleIsValid ? ValidatedOptions.default : ValidatedOptions.error })),
|
|
118
|
+
React.createElement("div", { className: "form-group" },
|
|
119
|
+
React.createElement("label", { htmlFor: localContentUrl },
|
|
120
|
+
"Link to content",
|
|
121
|
+
' ',
|
|
122
|
+
React.createElement("span", { className: "form-required", "aria-hidden": true }, "*")),
|
|
123
|
+
React.createElement(TextInput, { type: "url", maxLength: 254, isRequired: true, pattern: "^(http(s)?:\\/\\/)+[\\w\\-\\._~:\\/?#[\\]@!\\$&'\\(\\)\\*\\+,;=.]+$", value: getTopContentUrl(localContentUrl), "aria-label": t('Entering a solution or article link first will automatically generate the heading for you'), placeholder: t('Entering a solution or article link first will automatically generate the heading for you'), onChange: (evt, val) => onContentUrlChange(val, evt), validated: contentUrlIsValid ? ValidatedOptions.default : ValidatedOptions.error })),
|
|
124
|
+
React.createElement(Flex, { className: "pf-v5-u-my-lg" },
|
|
125
|
+
React.createElement(FlexItem, { flex: { default: 'flex_1' } },
|
|
126
|
+
React.createElement(FormGroup, { label: t('Tags') },
|
|
127
|
+
React.createElement("div", { className: "pf-v5-c-form-control" },
|
|
128
|
+
React.createElement(TagsSelector, { tagOptions: tagOptions, onChange: handleLocalTagChange, selectedTags: localSelectedTags, placeholder: t('Select tags to improve discoverability') })))),
|
|
129
|
+
React.createElement(FlexItem, null,
|
|
130
|
+
React.createElement(FormGroup, { label: t('Expiry date') },
|
|
131
|
+
React.createElement(DatePicker, { onBlur: onExpiryDateChange, onChange: onExpiryDateChange, value: !isEmpty(localExpiryDate) ? localExpiryDate.split('T')[0] : '', validators: [expiryDateValidator] })))),
|
|
132
|
+
React.createElement("span", { className: "top-content-single-item-footer" },
|
|
133
|
+
React.createElement("span", null,
|
|
134
|
+
React.createElement(Button, { variant: "primary", onClick: onContentSave, isDisabled: isSaveButtonDisabled || isSaving, isLoading: isSaving },
|
|
135
|
+
React.createElement(Trans, null, "Save")),
|
|
136
|
+
' ',
|
|
137
|
+
React.createElement(Button, { variant: "tertiary", onClick: onCancel, "data-tracking-id": "cancel-button-top-content" },
|
|
138
|
+
React.createElement(Trans, null, "Cancel"))),
|
|
139
|
+
React.createElement("span", { className: "content-actions" },
|
|
140
|
+
React.createElement(Button, { variant: "danger", "aria-label": t('Delete content'), onClick: onDelete, isDisabled: isDeleting }, "Delete")))));
|
|
141
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ManageExpiredContents/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ExpiredContentManagement } from './ExpiredContentManagement';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TagsManager.d.ts","sourceRoot":"","sources":["../../../../src/components/ManageTags/TagsManager.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAOxE,MAAM,CAAC,OAAO,UAAU,WAAW,
|
|
1
|
+
{"version":3,"file":"TagsManager.d.ts","sourceRoot":"","sources":["../../../../src/components/ManageTags/TagsManager.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAOxE,MAAM,CAAC,OAAO,UAAU,WAAW,sBAuYlC"}
|
|
@@ -80,6 +80,7 @@ export default function TagsManager() {
|
|
|
80
80
|
try {
|
|
81
81
|
setIsCreatingNewTag(true);
|
|
82
82
|
yield createNewTags(dispatch, [{ tagName: newTagName.trim(), isActive: true }]);
|
|
83
|
+
setTagSearchTerm('');
|
|
83
84
|
ToastNotification.addSuccessMessage(t('Successfully created tag'));
|
|
84
85
|
}
|
|
85
86
|
catch (err) {
|
|
@@ -88,10 +89,10 @@ export default function TagsManager() {
|
|
|
88
89
|
}
|
|
89
90
|
finally {
|
|
90
91
|
setIsCreatingNewTag(false);
|
|
91
|
-
|
|
92
|
+
onCancelCreateNewTag();
|
|
92
93
|
}
|
|
93
94
|
});
|
|
94
|
-
const
|
|
95
|
+
const onCancelCreateNewTag = () => {
|
|
95
96
|
setCreateTagError('');
|
|
96
97
|
setCreateTagModalOpen(false);
|
|
97
98
|
setNewTagName('');
|
|
@@ -197,10 +198,10 @@ export default function TagsManager() {
|
|
|
197
198
|
React.createElement(TrashIcon, null))))),
|
|
198
199
|
},
|
|
199
200
|
];
|
|
200
|
-
const CreateTagModel = (React.createElement(Modal, { title: t('Create a tag'), onClose:
|
|
201
|
+
const CreateTagModel = (React.createElement(Modal, { title: t('Create a tag'), onClose: onCancelCreateNewTag, isOpen: createTagModalOpen, actions: [
|
|
201
202
|
React.createElement(Button, { key: "create-tag", variant: ButtonVariant.primary, onClick: onCreateNewTag, isLoading: isCreatingNewTag, isDisabled: !isEmpty(createTagError) || isCreatingNewTag },
|
|
202
203
|
React.createElement(Trans, null, "Create")),
|
|
203
|
-
React.createElement(Button, { key: "cancel-create-tag", variant: ButtonVariant.link, onClick:
|
|
204
|
+
React.createElement(Button, { key: "cancel-create-tag", variant: ButtonVariant.link, onClick: onCancelCreateNewTag }, "Cancel"),
|
|
204
205
|
] },
|
|
205
206
|
React.createElement(FormGroup, { label: "Tag name", isRequired: true },
|
|
206
207
|
React.createElement(TextInput, { isRequired: true, type: "text", id: "create-new-tag-text-input", value: newTagName, onChange: (e, v) => {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ISolrArticle, ISolrSolution } from '@cee-eng/hydrajs/@types/models/solr/solr';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { DraggableStateSnapshot } from 'react-beautiful-dnd';
|
|
3
4
|
import { ITopContentEditState } from '../../../../reducers/TopContentReducer';
|
|
@@ -8,6 +9,7 @@ interface IProps {
|
|
|
8
9
|
i: number;
|
|
9
10
|
}
|
|
10
11
|
export declare function formatDuplicateWarning(arr: any): any;
|
|
12
|
+
export declare function getDocsFromUrl(url: string): Promise<(ISolrSolution | ISolrArticle)[]>;
|
|
11
13
|
export declare const TopContentSingleItem: ({ isArrangingContent, category, snapshot, i }: IProps) => React.JSX.Element;
|
|
12
14
|
export {};
|
|
13
15
|
//# sourceMappingURL=TopContentSingleItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TopContentSingleItem.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentSingleItem.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TopContentSingleItem.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentSingleItem.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAiB,aAAa,EAAE,MAAM,0CAA0C,CAAC;AA8BtG,OAAO,KAAmD,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAM7D,OAAO,EAIH,oBAAoB,EAOvB,MAAM,wCAAwC,CAAC;AAIhD,UAAU,MAAM;IACZ,kBAAkB,EAAE,OAAO,CAAC;IAC5B,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,QAAQ,CAAC,EAAE,sBAAsB,CAAC;IAClC,CAAC,EAAE,MAAM,CAAC;CACb;AAED,wBAAgB,sBAAsB,CAAC,GAAG,KAAA,OASzC;AAED,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,6CA2B/C;AAED,eAAO,MAAM,oBAAoB,kDAAmD,MAAM,sBA+ezF,CAAC"}
|
|
@@ -8,12 +8,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { search } from '@cee-eng/hydrajs';
|
|
11
|
-
import { Button, Flex, FlexItem, FormGroup, Icon, Label, TextInput, ValidatedOptions } from '@patternfly/react-core';
|
|
11
|
+
import { Button, DatePicker, Flex, FlexItem, FormGroup, Icon, Label, TextInput, ValidatedOptions, } from '@patternfly/react-core';
|
|
12
12
|
import EditAltIcon from '@patternfly/react-icons/dist/js/icons/edit-alt-icon';
|
|
13
13
|
import ExclamationCircleIcon from '@patternfly/react-icons/dist/js/icons/exclamation-circle-icon';
|
|
14
14
|
import GripVerticalIcon from '@patternfly/react-icons/dist/js/icons/grip-vertical-icon';
|
|
15
15
|
import { TagsSelector, ToastNotification, useDebounce } from '@rh-support/components';
|
|
16
|
-
import { formatDate, getDrupalResIdIfTypeFromUrl, getText, isValidUrl } from '@rh-support/utils';
|
|
16
|
+
import { formatDate, getDrupalResIdIfTypeFromUrl, getText, isFutureDate, isValidDate, isValidUrl, } from '@rh-support/utils';
|
|
17
17
|
import { differenceBy, isEqual } from 'lodash';
|
|
18
18
|
import cloneDeep from 'lodash/cloneDeep';
|
|
19
19
|
import findIndex from 'lodash/findIndex';
|
|
@@ -37,7 +37,36 @@ export function formatDuplicateWarning(arr) {
|
|
|
37
37
|
return [...str, ' and ', arr.slice(-1)];
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
+
export function getDocsFromUrl(url) {
|
|
41
|
+
var _a;
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
try {
|
|
44
|
+
const nodeId = getDrupalResIdIfTypeFromUrl(url);
|
|
45
|
+
if (!nodeId)
|
|
46
|
+
return [];
|
|
47
|
+
const queryParam = {
|
|
48
|
+
q: '*:*',
|
|
49
|
+
start: 0,
|
|
50
|
+
rows: 1,
|
|
51
|
+
};
|
|
52
|
+
const expression = {
|
|
53
|
+
fq: ['documentKind:("Solution" OR "Article")', `id:${nodeId}`],
|
|
54
|
+
fl: 'id, allTitle, publishedTitle',
|
|
55
|
+
};
|
|
56
|
+
const response = yield search.solrSearchV2(queryParam, 'kcs', expression);
|
|
57
|
+
const docs = ((_a = response === null || response === void 0 ? void 0 : response.response) === null || _a === void 0 ? void 0 : _a.docs) || [];
|
|
58
|
+
if (docs.length == 0) {
|
|
59
|
+
throw new Error('');
|
|
60
|
+
}
|
|
61
|
+
return docs;
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
throw err;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
40
68
|
export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i }) => {
|
|
69
|
+
var _a, _b, _c;
|
|
41
70
|
const [isPreview, setIsPreview] = useState(true);
|
|
42
71
|
const [isFetchingSolrSearch, setIsFetchingSolrSearch] = useState(false);
|
|
43
72
|
const editToggle = () => {
|
|
@@ -52,6 +81,7 @@ export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i
|
|
|
52
81
|
const [localContentUrl, setLocalContentUrl] = useState(content.contentUrl);
|
|
53
82
|
const [localContentTitle, setLocalContentTitle] = useState(content.contentTitle);
|
|
54
83
|
const [localSelectedTags, setLocalSelectedTags] = useState(content.tags || []);
|
|
84
|
+
const [localExpiryDate, setLocalExpiryDate] = useState((content === null || content === void 0 ? void 0 : content.expiryDate) || '');
|
|
55
85
|
const [newCategory, setNewCategory] = useState(undefined);
|
|
56
86
|
const [contentTitleIsValid, setContentTitleIsValid] = useState(true);
|
|
57
87
|
const [contentUrlIsValid, setContentUrlIsValid] = useState(true);
|
|
@@ -71,7 +101,7 @@ export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i
|
|
|
71
101
|
setLocalSelectedTags(tags);
|
|
72
102
|
};
|
|
73
103
|
const updateContentTitleFromUrl = (contentUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
74
|
-
var
|
|
104
|
+
var _d, _e;
|
|
75
105
|
// throws toast warning and clears it after 4 seconds
|
|
76
106
|
const throwWarningMessage = () => {
|
|
77
107
|
const message = getText('Unable to automatically fetch title. Please enter manually');
|
|
@@ -81,18 +111,8 @@ export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i
|
|
|
81
111
|
const nodeId = getDrupalResIdIfTypeFromUrl(contentUrl);
|
|
82
112
|
if (!nodeId)
|
|
83
113
|
return;
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
start: 0,
|
|
87
|
-
rows: 1,
|
|
88
|
-
};
|
|
89
|
-
const expression = {
|
|
90
|
-
fq: ['documentKind:("Solution" OR "Article")', `id:${nodeId}`],
|
|
91
|
-
fl: 'id, allTitle, publishedTitle',
|
|
92
|
-
};
|
|
93
|
-
const response = yield search.solrSearchV2(queryParam, 'kcs', expression);
|
|
94
|
-
const docs = ((_a = response === null || response === void 0 ? void 0 : response.response) === null || _a === void 0 ? void 0 : _a.docs) || [];
|
|
95
|
-
const contentTitle = ((_b = docs[0]) === null || _b === void 0 ? void 0 : _b.publishedTitle) || ((_c = docs[0]) === null || _c === void 0 ? void 0 : _c.allTitle);
|
|
114
|
+
const docs = yield getDocsFromUrl(contentUrl);
|
|
115
|
+
const contentTitle = ((_d = docs[0]) === null || _d === void 0 ? void 0 : _d.publishedTitle) || ((_e = docs[0]) === null || _e === void 0 ? void 0 : _e.allTitle);
|
|
96
116
|
if (docs.length > 0 && docs[0].id === nodeId + '' && contentTitle) {
|
|
97
117
|
setLocalContentTitle(contentTitle);
|
|
98
118
|
setContentTitleIsValid(true);
|
|
@@ -158,6 +178,9 @@ export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i
|
|
|
158
178
|
const onSaveAddContentToCategory = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
159
179
|
try {
|
|
160
180
|
const newContent = Object.assign(Object.assign({}, content), { contentTitle: localContentTitle, contentUrl: localContentUrl, tagList: localSelectedTags.map((t) => t.id), tags: localSelectedTags.map((t) => ({ id: t.id, tagName: t.tagName })) });
|
|
181
|
+
if (!isEmpty(localExpiryDate)) {
|
|
182
|
+
newContent.expiryDate = localExpiryDate;
|
|
183
|
+
}
|
|
161
184
|
setIsSaving(true);
|
|
162
185
|
yield saveAddToTopContent(topContentDispatch, topContentEditState, category.id, category.categoryId, newContent, i);
|
|
163
186
|
ToastNotification.addSuccessMessage(t('Content added successfully'));
|
|
@@ -175,6 +198,9 @@ export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i
|
|
|
175
198
|
const deletedTags = differenceBy(oldTagsIds, localTagsIds);
|
|
176
199
|
try {
|
|
177
200
|
const updatedContent = Object.assign(Object.assign({}, content), { contentTitle: localContentTitle, contentUrl: localContentUrl, tagList: newTags, tags: localSelectedTags.map((t) => ({ id: t.id, tagName: t.tagName })) });
|
|
201
|
+
if (!isEmpty(localExpiryDate)) {
|
|
202
|
+
updatedContent.expiryDate = localExpiryDate;
|
|
203
|
+
}
|
|
178
204
|
setIsSaving(true);
|
|
179
205
|
yield saveChangeInCategoryContent(topContentDispatch, topContentEditState, category.categoryId, updatedContent, deletedTags);
|
|
180
206
|
editToggle();
|
|
@@ -190,6 +216,9 @@ export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i
|
|
|
190
216
|
const onSaveCreateNewCategory = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
191
217
|
try {
|
|
192
218
|
const newContent = Object.assign(Object.assign({}, content), { contentTitle: localContentTitle, contentUrl: localContentUrl, tagList: localSelectedTags.map((t) => t.id), tags: localSelectedTags.map((t) => ({ id: t.id, tagName: t.tagName })) });
|
|
219
|
+
if (!isEmpty(localExpiryDate)) {
|
|
220
|
+
newContent.expiryDate = localExpiryDate;
|
|
221
|
+
}
|
|
193
222
|
setIsSaving(true);
|
|
194
223
|
yield saveAddedNewSectionContents(topContentDispatch, topContentEditState, newCategory, selectedProduct, selectedVersion, isCatOnlyForMajorVersion, newContent);
|
|
195
224
|
ToastNotification.addSuccessMessage(t('Category created successfully'));
|
|
@@ -221,6 +250,7 @@ export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i
|
|
|
221
250
|
setNewCategory(category);
|
|
222
251
|
};
|
|
223
252
|
const onCancel = () => {
|
|
253
|
+
var _a;
|
|
224
254
|
if (content.mode === ContentMode.NEW_SECTION_CONTENT) {
|
|
225
255
|
fetchTopContent(topContentDispatch, selectedProduct, selectedVersion);
|
|
226
256
|
}
|
|
@@ -237,6 +267,17 @@ export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i
|
|
|
237
267
|
setContentUrlIsValid(true);
|
|
238
268
|
setIsAddingCategory(topContentDispatch, false);
|
|
239
269
|
setLocalSelectedTags(content.tags);
|
|
270
|
+
setLocalExpiryDate((_a = content.expiryDate) !== null && _a !== void 0 ? _a : '');
|
|
271
|
+
};
|
|
272
|
+
const expiryDateValidator = (date) => {
|
|
273
|
+
const today = new Date();
|
|
274
|
+
today.setHours(0, 0, 0, 0);
|
|
275
|
+
if (date < today)
|
|
276
|
+
return t('Invalid expiry date');
|
|
277
|
+
return '';
|
|
278
|
+
};
|
|
279
|
+
const onExpiryDateChange = (event, str, date) => {
|
|
280
|
+
setLocalExpiryDate(str);
|
|
240
281
|
};
|
|
241
282
|
useDebounce(() => {
|
|
242
283
|
onLocalContentUrlChange();
|
|
@@ -246,20 +287,28 @@ export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i
|
|
|
246
287
|
setIsPreview(true);
|
|
247
288
|
}, [isArrangingContent]);
|
|
248
289
|
useEffect(() => {
|
|
290
|
+
var _a;
|
|
249
291
|
setLocalContentTitle(content.contentTitle);
|
|
250
292
|
setLocalContentUrl(content.contentUrl);
|
|
251
293
|
setLocalSelectedTags(content.tags || []);
|
|
294
|
+
setLocalExpiryDate((_a = content.expiryDate) !== null && _a !== void 0 ? _a : '');
|
|
252
295
|
}, [content]);
|
|
253
296
|
// To check if input has spaces
|
|
254
297
|
const doesInputHasSpaces = isEmpty(localContentTitle.trim());
|
|
255
298
|
// To disable save button if empty depending on spaces
|
|
256
299
|
const isSaveButtonDisabled = doesInputHasSpaces ||
|
|
257
300
|
isDuplicateTitle ||
|
|
258
|
-
!(contentTitleIsValid &&
|
|
301
|
+
!(contentTitleIsValid &&
|
|
302
|
+
contentUrlIsValid &&
|
|
303
|
+
localContentTitle &&
|
|
304
|
+
localContentUrl &&
|
|
305
|
+
((isValidDate(localExpiryDate) && isEmpty(expiryDateValidator(new Date(localExpiryDate)))) ||
|
|
306
|
+
(isEmpty(localExpiryDate) && isEmpty((_a = content.expiryDate) !== null && _a !== void 0 ? _a : '')))) ||
|
|
259
307
|
(!newCategory && content.mode === ContentMode.NEW_SECTION_CONTENT) ||
|
|
260
308
|
(localContentUrl === content.contentUrl &&
|
|
261
309
|
localContentTitle === content.contentTitle &&
|
|
262
|
-
isEqual(localTagsIds, oldTagsIds)
|
|
310
|
+
isEqual(localTagsIds, oldTagsIds) &&
|
|
311
|
+
isEqual(localExpiryDate.split('T')[0], ((_b = content.expiryDate) === null || _b === void 0 ? void 0 : _b.split('T')[0]) || ''));
|
|
263
312
|
const lastModifiedBy = t(`Last modified {{created}} by {{by}}`, {
|
|
264
313
|
created: formatDate(content.updatedOn || content.createdOn),
|
|
265
314
|
by: content.updatedBy || content.createdBy,
|
|
@@ -273,7 +322,10 @@ export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i
|
|
|
273
322
|
' ',
|
|
274
323
|
React.createElement(Button, { variant: "link", isInline: true, icon: React.createElement(EditAltIcon, null), onClick: editToggle, title: 'Edit' }))) : (content.contentTitle),
|
|
275
324
|
React.createElement("div", null, lastModifiedBy),
|
|
276
|
-
React.createElement("div", null,
|
|
325
|
+
React.createElement("div", null,
|
|
326
|
+
(content.tags || []).map((tag) => (React.createElement(Label, { isCompact: true, className: "pf-v5-u-mr-xs pf-v5-u-mt-sm", key: tag.id, color: filteredTags.some((t) => t.id === tag.id) ? 'gold' : 'grey' }, tag.tagName))),
|
|
327
|
+
!isEmpty((_c = content.expiryDate) !== null && _c !== void 0 ? _c : '') && !isFutureDate(content.expiryDate) && (React.createElement(Label, { isCompact: true, className: "pf-v5-u-mr-xs pf-v5-u-mt-sm", color: "red" },
|
|
328
|
+
React.createElement(Trans, null, "Outdated Content")))))),
|
|
277
329
|
(!isPreview || content.mode === ContentMode.ADD || content.mode === ContentMode.NEW_SECTION_CONTENT) && (React.createElement("form", { noValidate: true, onSubmit: onSubmit, className: "card card-light push-bottom" },
|
|
278
330
|
content.mode === ContentMode.NEW_SECTION_CONTENT && (React.createElement(AddNewCategoryDropDown, { onCategoryChange: onAddedNewCategoryChange })),
|
|
279
331
|
React.createElement("div", { className: "form-group" },
|
|
@@ -303,7 +355,10 @@ export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i
|
|
|
303
355
|
React.createElement(FlexItem, { flex: { default: 'flex_1' } },
|
|
304
356
|
React.createElement(FormGroup, { label: t('Tags') },
|
|
305
357
|
React.createElement("div", { className: "pf-v5-c-form-control" },
|
|
306
|
-
React.createElement(TagsSelector, { tagOptions: tagOptions, onChange: handleLocalTagChange, selectedTags: localSelectedTags, placeholder: t('Select tags to improve discoverability') }))))
|
|
358
|
+
React.createElement(TagsSelector, { tagOptions: tagOptions, onChange: handleLocalTagChange, selectedTags: localSelectedTags, placeholder: t('Select tags to improve discoverability') })))),
|
|
359
|
+
React.createElement(FlexItem, null,
|
|
360
|
+
React.createElement(FormGroup, { label: t('Expiry date') },
|
|
361
|
+
React.createElement(DatePicker, { onBlur: onExpiryDateChange, onChange: onExpiryDateChange, value: !isEmpty(localExpiryDate) ? localExpiryDate.split('T')[0] : '', validators: [expiryDateValidator] })))),
|
|
307
362
|
React.createElement("span", { className: "top-content-single-item-footer" },
|
|
308
363
|
React.createElement("span", null,
|
|
309
364
|
React.createElement(Button, { variant: "primary", onClick: onSave, isDisabled: isSaveButtonDisabled || isSaving, isLoading: isSaving },
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ExpiredContentDispatchType, IExpiredContentState } from '../reducers/ExpiredContentReducer';
|
|
3
|
+
export declare const ExpiredContentStateContext: React.Context<IExpiredContentState>;
|
|
4
|
+
export declare const ExpiredContentDispatchContext: React.Context<ExpiredContentDispatchType>;
|
|
5
|
+
export declare function ExpiredContentContextProvider({ children }: {
|
|
6
|
+
children: any;
|
|
7
|
+
}): React.JSX.Element;
|
|
8
|
+
//# sourceMappingURL=ExpiredContentContextProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpiredContentContextProvider.d.ts","sourceRoot":"","sources":["../../../src/context/ExpiredContentContextProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,EACH,0BAA0B,EAE1B,oBAAoB,EAEvB,MAAM,mCAAmC,CAAC;AAG3C,eAAO,MAAM,0BAA0B,qCAAmE,CAAC;AAC3G,eAAO,MAAM,6BAA6B,2CAA8C,CAAC;AAEzF,wBAAgB,6BAA6B,CAAC,EAAE,QAAQ,EAAE;;CAAA,qBAOzD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { useReducer } from 'react';
|
|
2
|
+
import { ExpiredContentReducer, initialExpiredContent, } from '../reducers/ExpiredContentReducer';
|
|
3
|
+
const initialDispatchContext = null;
|
|
4
|
+
export const ExpiredContentStateContext = React.createContext(initialExpiredContent);
|
|
5
|
+
export const ExpiredContentDispatchContext = React.createContext(initialDispatchContext);
|
|
6
|
+
export function ExpiredContentContextProvider({ children }) {
|
|
7
|
+
const [expiredContentState, dispatch] = useReducer(ExpiredContentReducer, initialExpiredContent);
|
|
8
|
+
return (React.createElement(ExpiredContentStateContext.Provider, { value: Object.assign({}, expiredContentState) },
|
|
9
|
+
React.createElement(ExpiredContentDispatchContext.Provider, { value: dispatch }, children)));
|
|
10
|
+
}
|
package/lib/esm/index.d.ts
CHANGED
package/lib/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC"}
|
package/lib/esm/index.js
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ITag } from '@cee-eng/hydrajs/@types/models/tagModels';
|
|
2
|
+
import { ITopContent, ITopContentList } from '@cee-eng/hydrajs/@types/models/topContent/topContentModel';
|
|
3
|
+
import { IAction, IApiResponseDetails } from '@rh-support/types/shared';
|
|
4
|
+
export interface IExpiredContent extends ITopContent {
|
|
5
|
+
tagList?: (number | string)[];
|
|
6
|
+
product?: string;
|
|
7
|
+
majorVersion?: string;
|
|
8
|
+
minorVersion?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface IExpiredContentEditState extends Omit<ITopContentList, 'content' | 'productId' | 'majorVersion' | 'minorVersion'> {
|
|
11
|
+
content: IExpiredContent[];
|
|
12
|
+
}
|
|
13
|
+
export interface IExpiredContentState {
|
|
14
|
+
expiredContentResponse: IApiResponseDetails<IExpiredContentEditState[]>;
|
|
15
|
+
expiredContentEditState: IExpiredContentEditState[];
|
|
16
|
+
filteredTags: ITag[];
|
|
17
|
+
}
|
|
18
|
+
export declare const initialExpiredContent: IExpiredContentState;
|
|
19
|
+
export declare enum ExpiredContentReducerConstants {
|
|
20
|
+
getExpiredContent = "getExpiredContent",
|
|
21
|
+
filterExpiredContent = "filterExpiredContent",
|
|
22
|
+
resetExpiredContent = "resetExpiredContent",
|
|
23
|
+
updateExpiredContentState = "updateExpiredContentState",
|
|
24
|
+
updateFilteredTags = "updateFilteredTags"
|
|
25
|
+
}
|
|
26
|
+
type IActionType = IAction<ExpiredContentReducerConstants, IExpiredContentState>;
|
|
27
|
+
export type ExpiredContentDispatchType = (value: IActionType) => void;
|
|
28
|
+
export declare const ExpiredContentReducer: (state: IExpiredContentState, action: IActionType) => IExpiredContentState;
|
|
29
|
+
export declare const isContentExpired: (expiryDate: string | undefined) => boolean;
|
|
30
|
+
export declare const fetchExpiredContent: (dispatch: ExpiredContentDispatchType, fetchApproachingExpiry?: boolean) => Promise<void>;
|
|
31
|
+
export declare const updateExpiredContent: (dispatch: ExpiredContentDispatchType, expiredContentEditState: IExpiredContentEditState[], categoryId: number, content: IExpiredContent, deletedTags?: any[]) => Promise<void>;
|
|
32
|
+
export declare const deleteExpiredContent: (dispatch: ExpiredContentDispatchType, expiredContentEditState: IExpiredContentEditState[], categoryId: number, topContentId: number) => Promise<never>;
|
|
33
|
+
export declare const setExpiredContentFilteredTags: (dispatch: ExpiredContentDispatchType, tags: ITag[]) => void;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=ExpiredContentReducer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpiredContentReducer.d.ts","sourceRoot":"","sources":["../../../src/reducers/ExpiredContentReducer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,0CAA0C,CAAC;AAChE,OAAO,EACH,WAAW,EACX,eAA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MAAM,WACT,eAAe,gBACV,GAAG,EAAE,kBAmDtB,CAAC;AAEF,eAAO,MAAM,oBAAoB,aACnB,0BAA0B,2BACX,wBAAwB,EAAE,cACvC,MAAM,gBACJ,MAAM,mBAsBvB,CAAC;AAEF,eAAO,MAAM,6BAA6B,aAAc,0BAA0B,QAAQ,IAAI,EAAE,SAK/F,CAAC"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { pcm, products as productsApi } from '@cee-eng/hydrajs';
|
|
11
|
+
import { getApiResourceObject } from '@rh-support/utils';
|
|
12
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
13
|
+
import isEmpty from 'lodash/isEmpty';
|
|
14
|
+
import isUndefined from 'lodash/isUndefined';
|
|
15
|
+
export const initialExpiredContent = {
|
|
16
|
+
expiredContentResponse: getApiResourceObject([]),
|
|
17
|
+
expiredContentEditState: [],
|
|
18
|
+
filteredTags: [],
|
|
19
|
+
};
|
|
20
|
+
export var ExpiredContentReducerConstants;
|
|
21
|
+
(function (ExpiredContentReducerConstants) {
|
|
22
|
+
ExpiredContentReducerConstants["getExpiredContent"] = "getExpiredContent";
|
|
23
|
+
ExpiredContentReducerConstants["filterExpiredContent"] = "filterExpiredContent";
|
|
24
|
+
ExpiredContentReducerConstants["resetExpiredContent"] = "resetExpiredContent";
|
|
25
|
+
ExpiredContentReducerConstants["updateExpiredContentState"] = "updateExpiredContentState";
|
|
26
|
+
ExpiredContentReducerConstants["updateFilteredTags"] = "updateFilteredTags";
|
|
27
|
+
})(ExpiredContentReducerConstants || (ExpiredContentReducerConstants = {}));
|
|
28
|
+
export const ExpiredContentReducer = (state, action) => {
|
|
29
|
+
var _a, _b, _c, _d, _e, _f;
|
|
30
|
+
switch (action.type) {
|
|
31
|
+
case ExpiredContentReducerConstants.resetExpiredContent: {
|
|
32
|
+
return initialExpiredContent;
|
|
33
|
+
}
|
|
34
|
+
case ExpiredContentReducerConstants.getExpiredContent: {
|
|
35
|
+
return Object.assign(Object.assign({}, state), { expiredContentEditState: [...(_a = action.payload) === null || _a === void 0 ? void 0 : _a.expiredContentEditState], expiredContentResponse: (_b = action.payload) === null || _b === void 0 ? void 0 : _b.expiredContentResponse });
|
|
36
|
+
}
|
|
37
|
+
case ExpiredContentReducerConstants.filterExpiredContent: {
|
|
38
|
+
return Object.assign(Object.assign({}, state), { expiredContentEditState: (_c = action.payload) === null || _c === void 0 ? void 0 : _c.expiredContentEditState });
|
|
39
|
+
}
|
|
40
|
+
case ExpiredContentReducerConstants.updateExpiredContentState: {
|
|
41
|
+
return Object.assign(Object.assign({}, state), { expiredContentEditState: (_d = action.payload) === null || _d === void 0 ? void 0 : _d.expiredContentEditState, expiredContentResponse: (_e = action.payload) === null || _e === void 0 ? void 0 : _e.expiredContentResponse });
|
|
42
|
+
}
|
|
43
|
+
case ExpiredContentReducerConstants.updateFilteredTags: {
|
|
44
|
+
return Object.assign(Object.assign({}, state), { filteredTags: (_f = action.payload) === null || _f === void 0 ? void 0 : _f.filteredTags });
|
|
45
|
+
}
|
|
46
|
+
default: {
|
|
47
|
+
return state;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
export const isContentExpired = (expiryDate) => {
|
|
52
|
+
if (isUndefined(expiryDate))
|
|
53
|
+
return false;
|
|
54
|
+
const now = new Date();
|
|
55
|
+
const expiry = new Date(expiryDate);
|
|
56
|
+
return expiry <= now;
|
|
57
|
+
};
|
|
58
|
+
function formatDate(date) {
|
|
59
|
+
const year = date.getFullYear();
|
|
60
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
61
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
62
|
+
return `${year}-${month}-${day}`;
|
|
63
|
+
}
|
|
64
|
+
export const fetchExpiredContent = (dispatch, fetchApproachingExpiry = false) => __awaiter(void 0, void 0, void 0, function* () {
|
|
65
|
+
try {
|
|
66
|
+
let expiryTimeLimit = new Date();
|
|
67
|
+
if (fetchApproachingExpiry) {
|
|
68
|
+
// Add 7 days to the current date
|
|
69
|
+
expiryTimeLimit.setDate(expiryTimeLimit.getDate() + 7);
|
|
70
|
+
}
|
|
71
|
+
dispatch({
|
|
72
|
+
type: ExpiredContentReducerConstants.getExpiredContent,
|
|
73
|
+
payload: {
|
|
74
|
+
expiredContentResponse: getApiResourceObject([], true),
|
|
75
|
+
expiredContentEditState: [],
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
const [products, expiredContents] = yield Promise.all([
|
|
79
|
+
productsApi.getProducts(),
|
|
80
|
+
pcm.topContent.getTopContent({
|
|
81
|
+
startDate: '1970-01-01',
|
|
82
|
+
endDate: `${formatDate(expiryTimeLimit)}`,
|
|
83
|
+
}),
|
|
84
|
+
]);
|
|
85
|
+
const productIdToName = new Map();
|
|
86
|
+
products.forEach((p) => {
|
|
87
|
+
productIdToName.set(p.productId, p.name);
|
|
88
|
+
});
|
|
89
|
+
const categoryIndexMap = new Map();
|
|
90
|
+
const resultGroupedByCategory = expiredContents.reduce((accumulator, cat) => {
|
|
91
|
+
const existingCategoryIndex = categoryIndexMap.get(cat.categoryName);
|
|
92
|
+
cat.content.forEach((content) => {
|
|
93
|
+
var _a;
|
|
94
|
+
content.product = productIdToName.get((_a = cat.productId) !== null && _a !== void 0 ? _a : '') || cat.productId;
|
|
95
|
+
content.majorVersion = cat.majorVersion;
|
|
96
|
+
content.minorVersion = cat.minorVersion;
|
|
97
|
+
});
|
|
98
|
+
if (isUndefined(existingCategoryIndex)) {
|
|
99
|
+
accumulator.push(cat);
|
|
100
|
+
categoryIndexMap.set(cat.categoryName, accumulator.length - 1);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
accumulator[existingCategoryIndex].content = [].concat.apply([], [accumulator[existingCategoryIndex].content, cat.content]);
|
|
104
|
+
}
|
|
105
|
+
return accumulator;
|
|
106
|
+
}, []);
|
|
107
|
+
dispatch({
|
|
108
|
+
type: ExpiredContentReducerConstants.getExpiredContent,
|
|
109
|
+
payload: {
|
|
110
|
+
expiredContentResponse: getApiResourceObject(cloneDeep(resultGroupedByCategory)),
|
|
111
|
+
expiredContentEditState: resultGroupedByCategory,
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
catch (err) {
|
|
116
|
+
dispatch({
|
|
117
|
+
type: ExpiredContentReducerConstants.getExpiredContent,
|
|
118
|
+
payload: {
|
|
119
|
+
expiredContentResponse: getApiResourceObject([], false, true, err.message),
|
|
120
|
+
expiredContentEditState: [],
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
export const updateExpiredContent = (dispatch, expiredContentEditState, categoryId, content, deletedTags) => __awaiter(void 0, void 0, void 0, function* () {
|
|
126
|
+
const toUpdate = {
|
|
127
|
+
id: content.topContentId,
|
|
128
|
+
contentTitle: content.contentTitle,
|
|
129
|
+
contentUrl: content.contentUrl,
|
|
130
|
+
contentRank: content.contentRank,
|
|
131
|
+
tagList: content.tagList, // list of new tagIds which needs to be added in content
|
|
132
|
+
expiryDate: content.expiryDate,
|
|
133
|
+
isActive: 1,
|
|
134
|
+
};
|
|
135
|
+
try {
|
|
136
|
+
if (deletedTags && !isEmpty(deletedTags)) {
|
|
137
|
+
yield Promise.all(deletedTags.map((t) => pcm.topContentTag.deleteTagFromTopContent(content.topContentId, t)));
|
|
138
|
+
}
|
|
139
|
+
const updatedContent = yield pcm.topContent.patchTopContent({ topContents: [toUpdate] });
|
|
140
|
+
expiredContentEditState.forEach((cat) => {
|
|
141
|
+
if (cat.categoryId === categoryId) {
|
|
142
|
+
const index = cat.content.findIndex((c) => c.topContentId === content.topContentId);
|
|
143
|
+
if (index !== -1) {
|
|
144
|
+
cat.content[index] = Object.assign(Object.assign({}, cat.content[index]), { contentTitle: content.contentTitle, contentUrl: content.contentUrl, updatedBy: updatedContent.topContents[0].updatedBy, updatedOn: updatedContent.topContents[0].updatedOn, tags: content.tags, expiryDate: content.expiryDate });
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
// We need to clone deep current state to re-render
|
|
149
|
+
const clonedExpiredContentEditState = cloneDeep(expiredContentEditState);
|
|
150
|
+
dispatch({
|
|
151
|
+
type: ExpiredContentReducerConstants.updateExpiredContentState,
|
|
152
|
+
payload: {
|
|
153
|
+
expiredContentResponse: getApiResourceObject(cloneDeep(clonedExpiredContentEditState)),
|
|
154
|
+
expiredContentEditState: clonedExpiredContentEditState,
|
|
155
|
+
},
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
catch (e) {
|
|
159
|
+
console.log(e);
|
|
160
|
+
Promise.reject(e);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
export const deleteExpiredContent = (dispatch, expiredContentEditState, categoryId, topContentId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
164
|
+
try {
|
|
165
|
+
yield pcm.topContent.deleteTopContent(topContentId);
|
|
166
|
+
expiredContentEditState.forEach((cat) => {
|
|
167
|
+
if (cat.id === categoryId) {
|
|
168
|
+
cat.content = cat.content.filter((item) => item.topContentId !== topContentId);
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
const expiredContent = expiredContentEditState.filter((cat) => cat.content.length !== 0);
|
|
172
|
+
dispatch({
|
|
173
|
+
type: ExpiredContentReducerConstants.updateExpiredContentState,
|
|
174
|
+
payload: {
|
|
175
|
+
expiredContentResponse: getApiResourceObject(cloneDeep(expiredContent)),
|
|
176
|
+
expiredContentEditState: expiredContent,
|
|
177
|
+
},
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
catch (e) {
|
|
181
|
+
console.log(e);
|
|
182
|
+
return Promise.reject(e);
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
export const setExpiredContentFilteredTags = (dispatch, tags) => {
|
|
186
|
+
dispatch({
|
|
187
|
+
type: ExpiredContentReducerConstants.updateFilteredTags,
|
|
188
|
+
payload: { filteredTags: tags },
|
|
189
|
+
});
|
|
190
|
+
};
|
|
@@ -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,EAAE,IAAI,EAAE,MAAM,0CAA0C,CAAC;AAChE,OAAO,EACH,WAAW,EAEX,mBAAmB,EACnB,eAAe,EAGf,iCAAiC,EAEpC,MAAM,2DAA2D,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAQxE,MAAM,WAAW,oBAAqB,SAAQ,WAAW;IACrD,OAAO,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAC9B,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC;IAC1E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,oBAAoB,EAAE,CAAC;IAChC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;;;;;;EAOE;AACF,UAAU,YAAY;IAClB,CAAC,GAAG,EAAE,M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AC/B,MAAM,mBA+BrB,CAAC;AAGF,eAAO,MAAM,iBAAiB,aAChB,6BAA6B,uBAClB,oBAAoB,EAAE,mBA2B9C,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;AAEF,eAAO,MAAM,eAAe,aAAc,6BAA6B,QAAQ,IAAI,EAAE,SAKpF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,aACzB,6BAA6B,eAC1B,MAAM,WACV,MAAM,kBAsBlB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,aACzB,6BAA6B,cAC3B,qBAAqB,gBACnB,MAAM,mBAavB,CAAC"}
|
|
@@ -335,14 +335,17 @@ export const saveAddedNewSectionContents = (dispatch, topContentEditState, selec
|
|
|
335
335
|
topContentMasterDataId,
|
|
336
336
|
contentTitle: newContent.contentTitle,
|
|
337
337
|
contentUrl: newContent.contentUrl,
|
|
338
|
+
expiryDate: newContent.expiryDate,
|
|
338
339
|
categoryName: selectedCategory.categoryName,
|
|
339
340
|
categoryId: selectedCategory.id,
|
|
340
341
|
isActive: 1,
|
|
341
342
|
};
|
|
342
343
|
const res = yield pcm.topContent.postTopContent({ topContents: [toAdd] });
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
344
|
+
if (!isEmpty(newContent.tagList)) {
|
|
345
|
+
yield pcm.topContentTag.updateTagsOfTopContent({
|
|
346
|
+
topContents: [{ id: res.topContents[0].id, tagList: newContent.tagList }],
|
|
347
|
+
});
|
|
348
|
+
}
|
|
346
349
|
const newSavedContent = res.topContents[0];
|
|
347
350
|
const oldCat = {
|
|
348
351
|
id: -1,
|
|
@@ -385,12 +388,15 @@ export const saveAddToTopContent = (dispatch, topContentEditState, id, categoryI
|
|
|
385
388
|
contentTitle: content.contentTitle,
|
|
386
389
|
contentUrl: content.contentUrl,
|
|
387
390
|
contentRank: index,
|
|
391
|
+
expiryDate: content.expiryDate,
|
|
388
392
|
isActive: 1,
|
|
389
393
|
};
|
|
390
394
|
const res = yield pcm.topContent.postTopContent({ topContents: [toAdd] });
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
395
|
+
if (!isEmpty(content.tagList)) {
|
|
396
|
+
yield pcm.topContentTag.updateTagsOfTopContent({
|
|
397
|
+
topContents: [{ id: res.topContents[0].id, tagList: content.tagList }],
|
|
398
|
+
});
|
|
399
|
+
}
|
|
394
400
|
const newTopContentEditState = [...topContentEditState];
|
|
395
401
|
newTopContentEditState.forEach((cat) => {
|
|
396
402
|
var _a, _b, _c, _d, _e, _f;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/manage",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.96",
|
|
4
4
|
"description": "Customer Support Manage App",
|
|
5
5
|
"author": "Jordan Eudy <jeudy100@gmail.com>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"prepublishOnly": "npm run build"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@cee-eng/hydrajs": "4.17.
|
|
48
|
+
"@cee-eng/hydrajs": "4.17.24",
|
|
49
49
|
"@patternfly/patternfly": "5.1.0",
|
|
50
50
|
"@patternfly/react-core": "5.1.1",
|
|
51
51
|
"@patternfly/react-table": "5.1.1",
|
|
@@ -75,16 +75,16 @@
|
|
|
75
75
|
"typescript": "^5.3.3"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@cee-eng/hydrajs": "4.17.
|
|
78
|
+
"@cee-eng/hydrajs": "4.17.24",
|
|
79
79
|
"@patternfly/patternfly": "5.1.0",
|
|
80
80
|
"@patternfly/react-core": "5.1.1",
|
|
81
81
|
"@patternfly/react-table": "5.1.1",
|
|
82
|
-
"@rh-support/components": "2.1.
|
|
82
|
+
"@rh-support/components": "2.1.74",
|
|
83
83
|
"@rh-support/configs": "2.0.20",
|
|
84
|
-
"@rh-support/react-context": "2.1.
|
|
84
|
+
"@rh-support/react-context": "2.1.82",
|
|
85
85
|
"@rh-support/types": "2.0.4",
|
|
86
|
-
"@rh-support/user-permissions": "2.1.
|
|
87
|
-
"@rh-support/utils": "2.1.
|
|
86
|
+
"@rh-support/user-permissions": "2.1.49",
|
|
87
|
+
"@rh-support/utils": "2.1.38",
|
|
88
88
|
"@types/react-beautiful-dnd": "^13.0.0",
|
|
89
89
|
"lodash": ">=4.17.15",
|
|
90
90
|
"mark.js": "^8.11.1",
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"defaults and supports es6-module",
|
|
103
103
|
"maintained node versions"
|
|
104
104
|
],
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "87ee594dd371e4838eb7ff7d381f548ce8ae2b94"
|
|
106
106
|
}
|