@rh-support/manage 2.1.97 → 2.1.99
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/ManageExpiredContents/ExpiredContentHeader.js +1 -1
- package/lib/esm/components/ManageExpiredContents/ExpiredContentManager.d.ts.map +1 -1
- package/lib/esm/components/ManageExpiredContents/ExpiredContentManager.js +1 -3
- package/lib/esm/components/ManageExpiredContents/ExpiredContentSingleItem.d.ts.map +1 -1
- package/lib/esm/components/ManageExpiredContents/ExpiredContentSingleItem.js +2 -2
- package/lib/esm/components/ManageExpiredContents/ExpiredContentSingleItemView.d.ts.map +1 -1
- package/lib/esm/components/ManageExpiredContents/ExpiredContentSingleItemView.js +46 -8
- package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentSingleItem.d.ts.map +1 -1
- package/lib/esm/components/TopContentManagement/TopContentEditor/TopContentCategoryContent/TopContentSingleItem.js +45 -7
- package/lib/esm/reducers/ExpiredContentReducer.d.ts +2 -1
- package/lib/esm/reducers/ExpiredContentReducer.d.ts.map +1 -1
- package/lib/esm/reducers/ExpiredContentReducer.js +25 -8
- package/package.json +4 -4
|
@@ -3,7 +3,7 @@ import { Trans } from 'react-i18next';
|
|
|
3
3
|
export default function ExpiredContentHeader() {
|
|
4
4
|
return (React.createElement("header", null,
|
|
5
5
|
React.createElement("h2", null,
|
|
6
|
-
React.createElement(Trans, null, "
|
|
6
|
+
React.createElement(Trans, null, "Expired Content")),
|
|
7
7
|
React.createElement("p", { className: "pf-v5-u-mt-md pf-v5-u-mb-sm" },
|
|
8
8
|
React.createElement(Trans, null))));
|
|
9
9
|
}
|
|
@@ -1 +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,
|
|
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,sBAmH5C"}
|
|
@@ -13,8 +13,7 @@ import ExpiredContentHeader from './ExpiredContentHeader';
|
|
|
13
13
|
export default function ExipredContentManager() {
|
|
14
14
|
const expiredContentResultsRef = useRef(null);
|
|
15
15
|
const { t } = useTranslation();
|
|
16
|
-
const
|
|
17
|
-
const { expiredContentEditState, expiredContentResponse, filteredTags } = useContext(ExpiredContentStateContext);
|
|
16
|
+
const { expiredContentEditState, expiredContentResponse, filteredTags, showApprochingExpiry } = useContext(ExpiredContentStateContext);
|
|
18
17
|
const { tags: availableTags } = useContext(TagManagementStateContext);
|
|
19
18
|
const dispatch = useContext(ExpiredContentDispatchContext);
|
|
20
19
|
const tagManagerDispatch = useContext(TagManagementDispatchContext);
|
|
@@ -37,7 +36,6 @@ export default function ExipredContentManager() {
|
|
|
37
36
|
return filteredData;
|
|
38
37
|
}, [contentFilteredByQuery, filteredTags]);
|
|
39
38
|
const handleChange = (_event, checked) => {
|
|
40
|
-
setShowApprochingExpiry(checked);
|
|
41
39
|
fetchExpiredContent(dispatch, checked);
|
|
42
40
|
};
|
|
43
41
|
const onTagFilterChange = (tags) => {
|
|
@@ -1 +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,
|
|
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,qBA4G7E"}
|
|
@@ -19,7 +19,7 @@ import ExpiredContentSingleItemView from './ExpiredContentSingleItemView';
|
|
|
19
19
|
export default function ExpiredContentSingleItem({ content, category }) {
|
|
20
20
|
var _a, _b;
|
|
21
21
|
const { t } = useTranslation();
|
|
22
|
-
const { expiredContentEditState, filteredTags } = useContext(ExpiredContentStateContext);
|
|
22
|
+
const { expiredContentEditState, filteredTags, showApprochingExpiry } = useContext(ExpiredContentStateContext);
|
|
23
23
|
const dispatch = useContext(ExpiredContentDispatchContext);
|
|
24
24
|
const [isPreview, setIsPreview] = useState(true);
|
|
25
25
|
const [isSaving, setIsSaving] = useState(false);
|
|
@@ -30,7 +30,7 @@ export default function ExpiredContentSingleItem({ content, category }) {
|
|
|
30
30
|
const onSave = (updatedContent, deletedTags) => __awaiter(this, void 0, void 0, function* () {
|
|
31
31
|
try {
|
|
32
32
|
setIsSaving(true);
|
|
33
|
-
yield updateExpiredContent(dispatch, expiredContentEditState, category.categoryId, updatedContent, deletedTags);
|
|
33
|
+
yield updateExpiredContent(dispatch, expiredContentEditState, category.categoryId, updatedContent, deletedTags, showApprochingExpiry);
|
|
34
34
|
editToggle();
|
|
35
35
|
ToastNotification.addSuccessMessage(t('Content updated successfully'));
|
|
36
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpiredContentSingleItemView.d.ts","sourceRoot":"","sources":["../../../../src/components/ManageExpiredContents/ExpiredContentSingleItemView.tsx"],"names":[],"mappings":"AAOA,OAAO,
|
|
1
|
+
{"version":3,"file":"ExpiredContentSingleItemView.d.ts","sourceRoot":"","sources":["../../../../src/components/ManageExpiredContents/ExpiredContentSingleItemView.tsx"],"names":[],"mappings":"AAOA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAIhF,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,qBAqQR"}
|
|
@@ -9,11 +9,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { Button, DatePicker, Flex, FlexItem, FormGroup, TextInput, ValidatedOptions } from '@patternfly/react-core';
|
|
11
11
|
import { TagsSelector, ToastNotification } from '@rh-support/components';
|
|
12
|
-
import { getDrupalResIdIfTypeFromUrl, getText, isValidDate, isValidUrl } from '@rh-support/utils';
|
|
12
|
+
import { getDrupalResIdIfTypeFromUrl, getText, isFutureDate, isValidDate, isValidUrl } from '@rh-support/utils';
|
|
13
13
|
import { isEqual } from 'lodash';
|
|
14
14
|
import differenceBy from 'lodash/differenceBy';
|
|
15
15
|
import isEmpty from 'lodash/isEmpty';
|
|
16
|
-
import React, { useContext, useMemo, useState } from 'react';
|
|
16
|
+
import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
17
17
|
import { Trans, useTranslation } from 'react-i18next';
|
|
18
18
|
import { TagManagementStateContext } from '../../context/TagManagementContextProvider';
|
|
19
19
|
import { getTopContentUrl } from '../../reducers/TopContentHelpers';
|
|
@@ -23,15 +23,19 @@ export default function ExpiredContentSingleItemView({ category, content, onCanc
|
|
|
23
23
|
const { t } = useTranslation();
|
|
24
24
|
const tagManagementEditState = useContext(TagManagementStateContext);
|
|
25
25
|
const { tags: tagOptions } = tagManagementEditState;
|
|
26
|
+
const ref = useRef(null);
|
|
26
27
|
const [isFetchingSolrSearch, setIsFetchingSolrSearch] = useState(false);
|
|
27
28
|
const [localContentUrl, setLocalContentUrl] = useState(content.contentUrl);
|
|
28
29
|
const [localContentTitle, setLocalContentTitle] = useState(content.contentTitle);
|
|
29
30
|
const [localSelectedTags, setLocalSelectedTags] = useState(content.tags || []);
|
|
30
31
|
const [localExpiryDate, setLocalExpiryDate] = useState((content === null || content === void 0 ? void 0 : content.expiryDate) || '');
|
|
32
|
+
const [shouldShowExpDateErr, setShouldShowExpDateErr] = useState(false);
|
|
33
|
+
const [datePickerFocused, setDatePickerFocused] = useState(false);
|
|
31
34
|
const [contentTitleIsValid, setContentTitleIsValid] = useState(true);
|
|
32
35
|
const [contentUrlIsValid, setContentUrlIsValid] = useState(true);
|
|
33
36
|
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
37
|
const localTagsIds = useMemo(() => localSelectedTags === null || localSelectedTags === void 0 ? void 0 : localSelectedTags.map((t) => t.id), [localSelectedTags]);
|
|
38
|
+
const expiryDateErrMsg = isFutureDate(localExpiryDate) ? '' : t('Invalid expiry date');
|
|
35
39
|
const onSubmit = (e) => e.preventDefault();
|
|
36
40
|
const updateContentTitleFromUrl = (contentUrl) => __awaiter(this, void 0, void 0, function* () {
|
|
37
41
|
var _c, _d;
|
|
@@ -86,7 +90,8 @@ export default function ExpiredContentSingleItemView({ category, content, onCanc
|
|
|
86
90
|
setLocalExpiryDate(str);
|
|
87
91
|
};
|
|
88
92
|
const expiryDateValidator = (date) => {
|
|
89
|
-
|
|
93
|
+
const today = new Date();
|
|
94
|
+
if (date < today)
|
|
90
95
|
return t('Invalid expiry date');
|
|
91
96
|
return '';
|
|
92
97
|
};
|
|
@@ -108,27 +113,60 @@ export default function ExpiredContentSingleItemView({ category, content, onCanc
|
|
|
108
113
|
localContentTitle === content.contentTitle &&
|
|
109
114
|
isEqual(localTagsIds, oldTagsIds) &&
|
|
110
115
|
isEqual(localExpiryDate.split('T')[0], ((_b = content.expiryDate) === null || _b === void 0 ? void 0 : _b.split('T')[0]) || ''));
|
|
111
|
-
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
var _a, _b;
|
|
118
|
+
const datePickerElement = (_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.querySelector('#content-expiry-date input');
|
|
119
|
+
const tagsSelectorElement = (_b = ref === null || ref === void 0 ? void 0 : ref.current) === null || _b === void 0 ? void 0 : _b.querySelector('#expired-content-tag');
|
|
120
|
+
const handleFocusOnDatePicker = () => {
|
|
121
|
+
setDatePickerFocused(true);
|
|
122
|
+
};
|
|
123
|
+
const handleTagSelectorClick = () => {
|
|
124
|
+
!shouldShowExpDateErr && setShouldShowExpDateErr(true);
|
|
125
|
+
};
|
|
126
|
+
if (datePickerElement) {
|
|
127
|
+
datePickerElement.addEventListener('focusin', handleFocusOnDatePicker);
|
|
128
|
+
}
|
|
129
|
+
if (tagsSelectorElement) {
|
|
130
|
+
tagsSelectorElement.addEventListener('click', handleTagSelectorClick);
|
|
131
|
+
}
|
|
132
|
+
return () => {
|
|
133
|
+
if (datePickerElement) {
|
|
134
|
+
datePickerElement.removeEventListener('focusin', handleFocusOnDatePicker);
|
|
135
|
+
}
|
|
136
|
+
if (tagsSelectorElement) {
|
|
137
|
+
tagsSelectorElement.removeEventListener('click', handleTagSelectorClick);
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
141
|
+
}, []);
|
|
142
|
+
return (React.createElement("form", { noValidate: true, onSubmit: onSubmit, className: "card card-light push-bottom", ref: ref },
|
|
112
143
|
React.createElement("div", { className: "form-group" },
|
|
113
144
|
React.createElement("label", { htmlFor: localContentTitle },
|
|
114
145
|
"Heading",
|
|
115
146
|
' ',
|
|
116
147
|
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'),
|
|
148
|
+
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'), onFocus: () => setShouldShowExpDateErr(true), onChange: (e, v) => {
|
|
149
|
+
onContentTitleChange(v, e);
|
|
150
|
+
!shouldShowExpDateErr && setShouldShowExpDateErr(true);
|
|
151
|
+
}, validated: contentTitleIsValid ? ValidatedOptions.default : ValidatedOptions.error })),
|
|
118
152
|
React.createElement("div", { className: "form-group" },
|
|
119
153
|
React.createElement("label", { htmlFor: localContentUrl },
|
|
120
154
|
"Link to content",
|
|
121
155
|
' ',
|
|
122
156
|
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'),
|
|
157
|
+
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'), onFocus: () => setShouldShowExpDateErr(true), onChange: (evt, val) => {
|
|
158
|
+
onContentUrlChange(val, evt);
|
|
159
|
+
!shouldShowExpDateErr && setShouldShowExpDateErr(true);
|
|
160
|
+
}, validated: contentUrlIsValid ? ValidatedOptions.default : ValidatedOptions.error })),
|
|
124
161
|
React.createElement(Flex, { className: "pf-v5-u-my-lg" },
|
|
125
162
|
React.createElement(FlexItem, { flex: { default: 'flex_1' } },
|
|
126
163
|
React.createElement(FormGroup, { label: t('Tags') },
|
|
127
164
|
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') })))),
|
|
165
|
+
React.createElement(TagsSelector, { tagOptions: tagOptions, onChange: handleLocalTagChange, selectedTags: localSelectedTags, placeholder: t('Select tags to improve discoverability'), id: "expired-content-tag" })))),
|
|
129
166
|
React.createElement(FlexItem, null,
|
|
130
167
|
React.createElement(FormGroup, { label: t('Expiry date') },
|
|
131
|
-
React.createElement(DatePicker, { onBlur: onExpiryDateChange, onChange: onExpiryDateChange, value: !isEmpty(localExpiryDate) ? localExpiryDate.split('T')[0] : '', validators: [expiryDateValidator] })
|
|
168
|
+
React.createElement(DatePicker, { onBlur: onExpiryDateChange, onChange: onExpiryDateChange, value: !isEmpty(localExpiryDate) ? localExpiryDate.split('T')[0] : '', validators: [expiryDateValidator], id: "content-expiry-date", invalidFormatText: t('Invalid date format') }),
|
|
169
|
+
shouldShowExpDateErr && !datePickerFocused && (React.createElement("p", { className: "form-instructions form-invalid pf-v5-u-font-size-sm pf-v5-u-danger-color-200 pf-v5-u-my-0" }, expiryDateErrMsg))))),
|
|
132
170
|
React.createElement("span", { className: "top-content-single-item-footer" },
|
|
133
171
|
React.createElement("span", null,
|
|
134
172
|
React.createElement(Button, { variant: "primary", onClick: onContentSave, isDisabled: isSaveButtonDisabled || isSaving, isLoading: isSaving },
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,KAA2D,MAAM,OAAO,CAAC;AAChF,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,sBAkiBzF,CAAC"}
|
|
@@ -18,7 +18,7 @@ import { differenceBy, isEqual } from 'lodash';
|
|
|
18
18
|
import cloneDeep from 'lodash/cloneDeep';
|
|
19
19
|
import findIndex from 'lodash/findIndex';
|
|
20
20
|
import isEmpty from 'lodash/isEmpty';
|
|
21
|
-
import React, { useContext, useEffect, useMemo, useState } from 'react';
|
|
21
|
+
import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
22
22
|
import { Trans, useTranslation } from 'react-i18next';
|
|
23
23
|
import { TagManagementStateContext } from '../../../../context/TagManagementContextProvider';
|
|
24
24
|
import { useTopContentContext, useTopContentDispatchContext } from '../../../../context/TopContentProvider';
|
|
@@ -77,6 +77,7 @@ export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i
|
|
|
77
77
|
const { topContentEditState, isCatOnlyForMajorVersion, selectedProduct, selectedVersion, contentUrls, filteredTags, } = useTopContentContext();
|
|
78
78
|
const tagManagementEditState = useContext(TagManagementStateContext);
|
|
79
79
|
const { tags: tagOptions } = tagManagementEditState;
|
|
80
|
+
const ref = useRef(null);
|
|
80
81
|
const topContentDispatch = useTopContentDispatchContext();
|
|
81
82
|
const [localContentUrl, setLocalContentUrl] = useState(content.contentUrl);
|
|
82
83
|
const [localContentTitle, setLocalContentTitle] = useState(content.contentTitle);
|
|
@@ -88,10 +89,13 @@ export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i
|
|
|
88
89
|
const [showDuplicateError, setShowDuplicateError] = useState(false);
|
|
89
90
|
const [duplicatUrlErrorArray, setDuplicatUrlErrorArray] = useState([]);
|
|
90
91
|
const [isSaving, setIsSaving] = useState(false);
|
|
92
|
+
const [shouldShowExpDateErr, setShouldShowExpDateErr] = useState(false);
|
|
93
|
+
const [datePickerFocused, setDatePickerFocused] = useState(false);
|
|
91
94
|
const duplicateTitleCategoryIndex = findIndex(category.content, (c) => c.contentTitle === localContentTitle.trim());
|
|
92
95
|
const isDuplicateTitle = duplicateTitleCategoryIndex !== -1 && duplicateTitleCategoryIndex !== i && !isEmpty(localContentTitle.trim());
|
|
93
96
|
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]);
|
|
94
97
|
const localTagsIds = useMemo(() => localSelectedTags === null || localSelectedTags === void 0 ? void 0 : localSelectedTags.map((t) => t.id), [localSelectedTags]);
|
|
98
|
+
const expiryDateErrMsg = isEmpty(localExpiryDate) || isFutureDate(localExpiryDate) ? '' : t('Invalid expiry date');
|
|
95
99
|
const onContentTitleChange = (contentTitle, event) => {
|
|
96
100
|
const contentTitleIsValid = event.target.validity.valid;
|
|
97
101
|
setContentTitleIsValid(contentTitleIsValid);
|
|
@@ -271,7 +275,6 @@ export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i
|
|
|
271
275
|
};
|
|
272
276
|
const expiryDateValidator = (date) => {
|
|
273
277
|
const today = new Date();
|
|
274
|
-
today.setHours(0, 0, 0, 0);
|
|
275
278
|
if (date < today)
|
|
276
279
|
return t('Invalid expiry date');
|
|
277
280
|
return '';
|
|
@@ -293,6 +296,34 @@ export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i
|
|
|
293
296
|
setLocalSelectedTags(content.tags || []);
|
|
294
297
|
setLocalExpiryDate((_a = content.expiryDate) !== null && _a !== void 0 ? _a : '');
|
|
295
298
|
}, [content]);
|
|
299
|
+
useEffect(() => {
|
|
300
|
+
var _a, _b;
|
|
301
|
+
const datePickerElement = (_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.querySelector('#content-expiry-date input');
|
|
302
|
+
const tagsSelectorElement = (_b = ref === null || ref === void 0 ? void 0 : ref.current) === null || _b === void 0 ? void 0 : _b.querySelector('#top-content-tag');
|
|
303
|
+
const handleFocusOnDatePicker = () => {
|
|
304
|
+
setDatePickerFocused(true);
|
|
305
|
+
};
|
|
306
|
+
const handleTagSelectorClick = () => {
|
|
307
|
+
!shouldShowExpDateErr && setShouldShowExpDateErr(true);
|
|
308
|
+
};
|
|
309
|
+
if (datePickerElement) {
|
|
310
|
+
datePickerElement.addEventListener('focusin', handleFocusOnDatePicker);
|
|
311
|
+
}
|
|
312
|
+
if (tagsSelectorElement) {
|
|
313
|
+
tagsSelectorElement.addEventListener('click', handleTagSelectorClick);
|
|
314
|
+
}
|
|
315
|
+
return () => {
|
|
316
|
+
if (datePickerElement) {
|
|
317
|
+
datePickerElement.removeEventListener('focusin', handleFocusOnDatePicker);
|
|
318
|
+
}
|
|
319
|
+
if (tagsSelectorElement) {
|
|
320
|
+
tagsSelectorElement.removeEventListener('click', handleTagSelectorClick);
|
|
321
|
+
}
|
|
322
|
+
setDatePickerFocused(false);
|
|
323
|
+
setShouldShowExpDateErr(false);
|
|
324
|
+
};
|
|
325
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
326
|
+
}, [isPreview]);
|
|
296
327
|
// To check if input has spaces
|
|
297
328
|
const doesInputHasSpaces = isEmpty(localContentTitle.trim());
|
|
298
329
|
// To disable save button if empty depending on spaces
|
|
@@ -326,14 +357,17 @@ export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i
|
|
|
326
357
|
(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
358
|
!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
359
|
React.createElement(Trans, null, "Outdated Content")))))),
|
|
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" },
|
|
360
|
+
(!isPreview || content.mode === ContentMode.ADD || content.mode === ContentMode.NEW_SECTION_CONTENT) && (React.createElement("form", { noValidate: true, onSubmit: onSubmit, className: "card card-light push-bottom", ref: ref },
|
|
330
361
|
content.mode === ContentMode.NEW_SECTION_CONTENT && (React.createElement(AddNewCategoryDropDown, { onCategoryChange: onAddedNewCategoryChange })),
|
|
331
362
|
React.createElement("div", { className: "form-group" },
|
|
332
363
|
React.createElement("label", { htmlFor: localContentTitle },
|
|
333
364
|
"Heading",
|
|
334
365
|
' ',
|
|
335
366
|
React.createElement("span", { className: "form-required", "aria-hidden": true }, "*")),
|
|
336
|
-
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'),
|
|
367
|
+
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'), onFocus: () => setShouldShowExpDateErr(true), onChange: (e, v) => {
|
|
368
|
+
onContentTitleChange(v, e);
|
|
369
|
+
!shouldShowExpDateErr && setShouldShowExpDateErr(true);
|
|
370
|
+
}, validated: contentTitleIsValid && !isDuplicateTitle
|
|
337
371
|
? ValidatedOptions.default
|
|
338
372
|
: ValidatedOptions.error }),
|
|
339
373
|
isDuplicateTitle && (React.createElement("p", { className: "form-instructions form-invalid " },
|
|
@@ -345,7 +379,10 @@ export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i
|
|
|
345
379
|
"Link to content",
|
|
346
380
|
' ',
|
|
347
381
|
React.createElement("span", { className: "form-required", "aria-hidden": true }, "*")),
|
|
348
|
-
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'),
|
|
382
|
+
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'), onFocus: () => setShouldShowExpDateErr(true), onChange: (evt, val) => {
|
|
383
|
+
onContentUrlChange(val, evt);
|
|
384
|
+
!shouldShowExpDateErr && setShouldShowExpDateErr(true);
|
|
385
|
+
}, validated: contentUrlIsValid ? ValidatedOptions.default : ValidatedOptions.error }),
|
|
349
386
|
showDuplicateError && (React.createElement("p", { className: "form-instructions form-invalid" },
|
|
350
387
|
React.createElement(ExclamationCircleIcon, { color: "#c9190b", className: "pf-v5-u-mr-sm" }),
|
|
351
388
|
" Duplicate url. This url is already added in ",
|
|
@@ -355,10 +392,11 @@ export const TopContentSingleItem = ({ isArrangingContent, category, snapshot, i
|
|
|
355
392
|
React.createElement(FlexItem, { flex: { default: 'flex_1' } },
|
|
356
393
|
React.createElement(FormGroup, { label: t('Tags') },
|
|
357
394
|
React.createElement("div", { className: "pf-v5-c-form-control" },
|
|
358
|
-
React.createElement(TagsSelector, { tagOptions: tagOptions, onChange: handleLocalTagChange, selectedTags: localSelectedTags, placeholder: t('Select tags to improve discoverability') })))),
|
|
395
|
+
React.createElement(TagsSelector, { tagOptions: tagOptions, onChange: handleLocalTagChange, selectedTags: localSelectedTags, placeholder: t('Select tags to improve discoverability'), id: "top-content-tag" })))),
|
|
359
396
|
React.createElement(FlexItem, null,
|
|
360
397
|
React.createElement(FormGroup, { label: t('Expiry date') },
|
|
361
|
-
React.createElement(DatePicker, { onBlur: onExpiryDateChange, onChange: onExpiryDateChange, value: !isEmpty(localExpiryDate) ? localExpiryDate.split('T')[0] : '', validators: [expiryDateValidator] })
|
|
398
|
+
React.createElement(DatePicker, { onBlur: onExpiryDateChange, onChange: onExpiryDateChange, value: !isEmpty(localExpiryDate) ? localExpiryDate.split('T')[0] : '', validators: [expiryDateValidator], id: "content-expiry-date", invalidFormatText: t('Invalid date format') }),
|
|
399
|
+
shouldShowExpDateErr && !datePickerFocused && (React.createElement("p", { className: "form-instructions form-invalid pf-v5-u-font-size-sm pf-v5-u-danger-color-200 pf-v5-u-my-0" }, expiryDateErrMsg))))),
|
|
362
400
|
React.createElement("span", { className: "top-content-single-item-footer" },
|
|
363
401
|
React.createElement("span", null,
|
|
364
402
|
React.createElement(Button, { variant: "primary", onClick: onSave, isDisabled: isSaveButtonDisabled || isSaving, isLoading: isSaving },
|
|
@@ -14,6 +14,7 @@ export interface IExpiredContentState {
|
|
|
14
14
|
expiredContentResponse: IApiResponseDetails<IExpiredContentEditState[]>;
|
|
15
15
|
expiredContentEditState: IExpiredContentEditState[];
|
|
16
16
|
filteredTags: ITag[];
|
|
17
|
+
showApprochingExpiry: boolean;
|
|
17
18
|
}
|
|
18
19
|
export declare const initialExpiredContent: IExpiredContentState;
|
|
19
20
|
export declare enum ExpiredContentReducerConstants {
|
|
@@ -28,7 +29,7 @@ export type ExpiredContentDispatchType = (value: IActionType) => void;
|
|
|
28
29
|
export declare const ExpiredContentReducer: (state: IExpiredContentState, action: IActionType) => IExpiredContentState;
|
|
29
30
|
export declare const isContentExpired: (expiryDate: string | undefined) => boolean;
|
|
30
31
|
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 updateExpiredContent: (dispatch: ExpiredContentDispatchType, expiredContentEditState: IExpiredContentEditState[], categoryId: number, content: IExpiredContent, deletedTags?: any[], showApprochingExpiry?: boolean) => Promise<void>;
|
|
32
33
|
export declare const deleteExpiredContent: (dispatch: ExpiredContentDispatchType, expiredContentEditState: IExpiredContentEditState[], categoryId: number, topContentId: number) => Promise<never>;
|
|
33
34
|
export declare const setExpiredContentFilteredTags: (dispatch: ExpiredContentDispatchType, tags: ITag[]) => void;
|
|
34
35
|
export {};
|
|
@@ -1 +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,eAAe,EAElB,MAAM,2DAA2D,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAMxE,MAAM,WAAW,eAAgB,SAAQ,WAAW;IAChD,OAAO,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,wBACb,SAAQ,IAAI,CAAC,eAAe,EAAE,SAAS,GAAG,WAAW,GAAG,cAAc,GAAG,cAAc,CAAC;IACxF,OAAO,EAAE,eAAe,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,oBAAoB;IACjC,sBAAsB,EAAE,mBAAmB,CAAC,wBAAwB,EAAE,CAAC,CAAC;IACxE,uBAAuB,EAAE,wBAAwB,EAAE,CAAC;IACpD,YAAY,EAAE,IAAI,EAAE,CAAC;
|
|
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,eAAe,EAElB,MAAM,2DAA2D,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAMxE,MAAM,WAAW,eAAgB,SAAQ,WAAW;IAChD,OAAO,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,wBACb,SAAQ,IAAI,CAAC,eAAe,EAAE,SAAS,GAAG,WAAW,GAAG,cAAc,GAAG,cAAc,CAAC;IACxF,OAAO,EAAE,eAAe,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,oBAAoB;IACjC,sBAAsB,EAAE,mBAAmB,CAAC,wBAAwB,EAAE,CAAC,CAAC;IACxE,uBAAuB,EAAE,wBAAwB,EAAE,CAAC;IACpD,YAAY,EAAE,IAAI,EAAE,CAAC;IACrB,oBAAoB,EAAE,OAAO,CAAC;CACjC;AAED,eAAO,MAAM,qBAAqB,EAAE,oBAKnC,CAAC;AAEF,oBAAY,8BAA8B;IACtC,iBAAiB,sBAAsB;IACvC,oBAAoB,yBAAyB;IAC7C,mBAAmB,wBAAwB;IAC3C,yBAAyB,8BAA8B;IACvD,kBAAkB,uBAAuB;CAC5C;AAED,KAAK,WAAW,GAAG,OAAO,CAAC,8BAA8B,EAAE,oBAAoB,CAAC,CAAC;AACjF,MAAM,MAAM,0BAA0B,GAAG,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;AAEtE,eAAO,MAAM,qBAAqB,UAAW,oBAAoB,0BAAwB,oBAiCxF,CAAC;AAEF,eAAO,MAAM,gBAAgB,eAAgB,MAAM,GAAG,SAAS,YAM9D,CAAC;AASF,eAAO,MAAM,mBAAmB,aAClB,0BAA0B,2BACZ,OAAO,kBA8ElC,CAAC;AAEF,eAAO,MAAM,oBAAoB,aACnB,0BAA0B,2BACX,wBAAwB,EAAE,cACvC,MAAM,WACT,eAAe,gBACV,GAAG,EAAE,yBACG,OAAO,kBAmEhC,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"}
|
|
@@ -16,6 +16,7 @@ export const initialExpiredContent = {
|
|
|
16
16
|
expiredContentResponse: getApiResourceObject([]),
|
|
17
17
|
expiredContentEditState: [],
|
|
18
18
|
filteredTags: [],
|
|
19
|
+
showApprochingExpiry: false,
|
|
19
20
|
};
|
|
20
21
|
export var ExpiredContentReducerConstants;
|
|
21
22
|
(function (ExpiredContentReducerConstants) {
|
|
@@ -26,22 +27,22 @@ export var ExpiredContentReducerConstants;
|
|
|
26
27
|
ExpiredContentReducerConstants["updateFilteredTags"] = "updateFilteredTags";
|
|
27
28
|
})(ExpiredContentReducerConstants || (ExpiredContentReducerConstants = {}));
|
|
28
29
|
export const ExpiredContentReducer = (state, action) => {
|
|
29
|
-
var _a, _b, _c, _d, _e, _f;
|
|
30
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
30
31
|
switch (action.type) {
|
|
31
32
|
case ExpiredContentReducerConstants.resetExpiredContent: {
|
|
32
33
|
return initialExpiredContent;
|
|
33
34
|
}
|
|
34
35
|
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
|
+
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, showApprochingExpiry: (_c = action.payload) === null || _c === void 0 ? void 0 : _c.showApprochingExpiry });
|
|
36
37
|
}
|
|
37
38
|
case ExpiredContentReducerConstants.filterExpiredContent: {
|
|
38
|
-
return Object.assign(Object.assign({}, state), { expiredContentEditState: (
|
|
39
|
+
return Object.assign(Object.assign({}, state), { expiredContentEditState: (_d = action.payload) === null || _d === void 0 ? void 0 : _d.expiredContentEditState });
|
|
39
40
|
}
|
|
40
41
|
case ExpiredContentReducerConstants.updateExpiredContentState: {
|
|
41
|
-
return Object.assign(Object.assign({}, state), { expiredContentEditState: (
|
|
42
|
+
return Object.assign(Object.assign({}, state), { expiredContentEditState: (_e = action.payload) === null || _e === void 0 ? void 0 : _e.expiredContentEditState, expiredContentResponse: (_f = action.payload) === null || _f === void 0 ? void 0 : _f.expiredContentResponse });
|
|
42
43
|
}
|
|
43
44
|
case ExpiredContentReducerConstants.updateFilteredTags: {
|
|
44
|
-
return Object.assign(Object.assign({}, state), { filteredTags: (
|
|
45
|
+
return Object.assign(Object.assign({}, state), { filteredTags: (_g = action.payload) === null || _g === void 0 ? void 0 : _g.filteredTags });
|
|
45
46
|
}
|
|
46
47
|
default: {
|
|
47
48
|
return state;
|
|
@@ -73,6 +74,7 @@ export const fetchExpiredContent = (dispatch, fetchApproachingExpiry = false) =>
|
|
|
73
74
|
payload: {
|
|
74
75
|
expiredContentResponse: getApiResourceObject([], true),
|
|
75
76
|
expiredContentEditState: [],
|
|
77
|
+
showApprochingExpiry: fetchApproachingExpiry,
|
|
76
78
|
},
|
|
77
79
|
});
|
|
78
80
|
const [products, expiredContents] = yield Promise.all([
|
|
@@ -109,6 +111,7 @@ export const fetchExpiredContent = (dispatch, fetchApproachingExpiry = false) =>
|
|
|
109
111
|
payload: {
|
|
110
112
|
expiredContentResponse: getApiResourceObject(cloneDeep(resultGroupedByCategory)),
|
|
111
113
|
expiredContentEditState: resultGroupedByCategory,
|
|
114
|
+
showApprochingExpiry: fetchApproachingExpiry,
|
|
112
115
|
},
|
|
113
116
|
});
|
|
114
117
|
}
|
|
@@ -118,11 +121,12 @@ export const fetchExpiredContent = (dispatch, fetchApproachingExpiry = false) =>
|
|
|
118
121
|
payload: {
|
|
119
122
|
expiredContentResponse: getApiResourceObject([], false, true, err.message),
|
|
120
123
|
expiredContentEditState: [],
|
|
124
|
+
showApprochingExpiry: fetchApproachingExpiry,
|
|
121
125
|
},
|
|
122
126
|
});
|
|
123
127
|
}
|
|
124
128
|
});
|
|
125
|
-
export const updateExpiredContent = (dispatch, expiredContentEditState, categoryId, content, deletedTags) => __awaiter(void 0, void 0, void 0, function* () {
|
|
129
|
+
export const updateExpiredContent = (dispatch, expiredContentEditState, categoryId, content, deletedTags, showApprochingExpiry = false) => __awaiter(void 0, void 0, void 0, function* () {
|
|
126
130
|
const toUpdate = {
|
|
127
131
|
id: content.topContentId,
|
|
128
132
|
contentTitle: content.contentTitle,
|
|
@@ -132,6 +136,11 @@ export const updateExpiredContent = (dispatch, expiredContentEditState, category
|
|
|
132
136
|
expiryDate: content.expiryDate,
|
|
133
137
|
isActive: 1,
|
|
134
138
|
};
|
|
139
|
+
let expiryTimeLimit = new Date();
|
|
140
|
+
if (showApprochingExpiry) {
|
|
141
|
+
// Add 7 days to the current date
|
|
142
|
+
expiryTimeLimit.setDate(expiryTimeLimit.getDate() + 7);
|
|
143
|
+
}
|
|
135
144
|
try {
|
|
136
145
|
if (deletedTags && !isEmpty(deletedTags)) {
|
|
137
146
|
yield Promise.all(deletedTags.map((t) => pcm.topContentTag.deleteTagFromTopContent(content.topContentId, t)));
|
|
@@ -146,11 +155,19 @@ export const updateExpiredContent = (dispatch, expiredContentEditState, category
|
|
|
146
155
|
}
|
|
147
156
|
});
|
|
148
157
|
// We need to clone deep current state to re-render
|
|
149
|
-
const clonedExpiredContentEditState = cloneDeep(expiredContentEditState)
|
|
158
|
+
const clonedExpiredContentEditState = cloneDeep(expiredContentEditState)
|
|
159
|
+
.map((cat) => {
|
|
160
|
+
const expiredContents = cat.content.filter((c) => {
|
|
161
|
+
const contentExpiryDate = new Date(c.expiryDate);
|
|
162
|
+
return contentExpiryDate <= expiryTimeLimit;
|
|
163
|
+
});
|
|
164
|
+
return Object.assign(Object.assign({}, cat), { content: expiredContents });
|
|
165
|
+
})
|
|
166
|
+
.filter((c) => c.content.length > 0);
|
|
150
167
|
dispatch({
|
|
151
168
|
type: ExpiredContentReducerConstants.updateExpiredContentState,
|
|
152
169
|
payload: {
|
|
153
|
-
expiredContentResponse: getApiResourceObject(
|
|
170
|
+
expiredContentResponse: getApiResourceObject(clonedExpiredContentEditState),
|
|
154
171
|
expiredContentEditState: clonedExpiredContentEditState,
|
|
155
172
|
},
|
|
156
173
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/manage",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.99",
|
|
4
4
|
"description": "Customer Support Manage App",
|
|
5
5
|
"author": "Jordan Eudy <jeudy100@gmail.com>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -79,9 +79,9 @@
|
|
|
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.75",
|
|
83
83
|
"@rh-support/configs": "2.0.20",
|
|
84
|
-
"@rh-support/react-context": "2.1.
|
|
84
|
+
"@rh-support/react-context": "2.1.84",
|
|
85
85
|
"@rh-support/types": "2.0.4",
|
|
86
86
|
"@rh-support/user-permissions": "2.1.49",
|
|
87
87
|
"@rh-support/utils": "2.1.38",
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"defaults and supports es6-module",
|
|
103
103
|
"maintained node versions"
|
|
104
104
|
],
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "1be6a7c11c2ef265ff8eb0a27e581a87f2625dfd"
|
|
106
106
|
}
|