@rh-support/troubleshoot 2.6.330 → 2.6.331
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/CaseEditView/CaseSolutions/CaseSolutions.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/CaseSolutions/CaseSolutions.js +131 -83
- package/lib/esm/components/CaseEditView/CaseSolutions/CaseSolutionsItem.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/CaseSolutions/CaseSolutionsItem.js +3 -3
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/ProductVersion.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/ProductVersion.js +2 -4
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseComments.d.ts +0 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseComments.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseComments.js +14 -27
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.js +4 -18
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useCommentDrafts.d.ts +1 -3
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useCommentDrafts.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useCommentDrafts.js +9 -5
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.d.ts +0 -3
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.js +37 -92
- package/lib/esm/components/CaseManagement/CaseLabelsCreate.d.ts +4 -0
- package/lib/esm/components/CaseManagement/CaseLabelsCreate.d.ts.map +1 -0
- package/lib/esm/components/CaseManagement/CaseLabelsCreate.js +108 -0
- package/lib/esm/components/CaseManagement/CaseManagement.d.ts.map +1 -1
- package/lib/esm/components/CaseManagement/CaseManagement.js +4 -0
- package/lib/esm/components/shared/fileUpload/reducer/AttachmentHelper.js +1 -1
- package/lib/esm/components/wizardLayout/GlobalTroubleshootEffects.d.ts.map +1 -1
- package/lib/esm/components/wizardLayout/GlobalTroubleshootEffects.js +35 -42
- package/lib/esm/css/case.css +41 -3
- package/lib/esm/hooks/useCaseComments/useCreateCaseComment.d.ts.map +1 -1
- package/lib/esm/hooks/useCaseComments/useCreateCaseComment.js +2 -1
- package/lib/esm/models/cache.d.ts +0 -2
- package/lib/esm/models/cache.d.ts.map +1 -1
- package/lib/esm/reducers/CaseConstNTypes.d.ts +2 -0
- package/lib/esm/reducers/CaseConstNTypes.d.ts.map +1 -1
- package/lib/esm/reducers/CaseConstNTypes.js +1 -0
- package/lib/esm/reducers/CaseDiscussionTabReducer.d.ts +0 -4
- package/lib/esm/reducers/CaseDiscussionTabReducer.d.ts.map +1 -1
- package/lib/esm/reducers/CaseDiscussionTabReducer.js +0 -11
- package/lib/esm/reducers/CaseReducer.d.ts +7 -1
- package/lib/esm/reducers/CaseReducer.d.ts.map +1 -1
- package/lib/esm/reducers/CaseReducer.js +37 -7
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseSolutions.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/CaseSolutions/CaseSolutions.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CaseSolutions.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/CaseSolutions/CaseSolutions.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAsD,MAAM,OAAO,CAAC;AAwF3E,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,sBAAsB,EAAE,OAAO,CAAC;CACnC;AAUD,eAAO,MAAM,aAAa,+EAmhBxB,CAAC"}
|
|
@@ -22,12 +22,14 @@ import { search } from '@cee-eng/hydrajs';
|
|
|
22
22
|
import { Button, Card, CardBody, CardExpandableContent, CardHeader, Label, Modal, ModalBody, ModalFooter, ModalHeader, ModalVariant, } from '@patternfly/react-core';
|
|
23
23
|
import { PaginatedList, ToastNotification } from '@rh-support/components';
|
|
24
24
|
import { useGlobalStateContext } from '@rh-support/react-context';
|
|
25
|
-
|
|
25
|
+
// TODO: KCS pin/unpin disabled -- PCM-15276 -- restore when pin/unpin is re-enabled
|
|
26
|
+
// import { AbilityContext, CaseDetailsFields, resourceActions, resources } from '@rh-support/user-permissions';
|
|
26
27
|
import { getSolrParams } from '@rh-support/utils';
|
|
27
28
|
import { isEmpty } from 'lodash';
|
|
28
29
|
import find from 'lodash/find';
|
|
29
30
|
import isEqual from 'lodash/isEqual';
|
|
30
|
-
|
|
31
|
+
// TODO: KCS pin/unpin disabled -- PCM-15276 -- restore when pin/unpin is re-enabled
|
|
32
|
+
// import some from 'lodash/some';
|
|
31
33
|
import React, { forwardRef, useContext, useEffect, useState } from 'react';
|
|
32
34
|
import { Trans, useTranslation } from 'react-i18next';
|
|
33
35
|
import { CaseStatusEnum } from '../../../constants/caseDetailsConstants';
|
|
@@ -127,15 +129,18 @@ export const CaseSolutions = forwardRef((props, ref) => {
|
|
|
127
129
|
const recommendationsDispatch = useRecommendationDispatchContext();
|
|
128
130
|
const { postComment } = usePostComment({ caseNumber: props.caseNumber });
|
|
129
131
|
const { caseNumber, isSecureSupportAccount } = props;
|
|
130
|
-
|
|
132
|
+
// TODO: KCS pin/unpin disabled -- PCM-15276 -- restore when pin/unpin is re-enabled
|
|
133
|
+
// const [isPinLoading, setIsPinLoading] = useState({});
|
|
131
134
|
const [isCaseCloseLoading, setIsCaseCloseLoading] = useState(false);
|
|
132
135
|
const [pinnedOpen, setPinnedOpen] = useState(true);
|
|
133
136
|
const [recommendations, setRecommendations] = useState([]);
|
|
134
137
|
const [topRecommendations, setTopRecommendations] = useState([]);
|
|
135
138
|
const [isCloseCaseModalOpen, setIsCloseCaseModalOpen] = useState(false);
|
|
136
|
-
|
|
139
|
+
// TODO: KCS pin/unpin disabled -- PCM-15276 -- restore when pin/unpin is re-enabled
|
|
140
|
+
// const ability = useContext(AbilityContext);
|
|
137
141
|
const { t } = useTranslation();
|
|
138
|
-
|
|
142
|
+
// TODO: KCS pin/unpin disabled -- PCM-15276 -- restore when pin/unpin is re-enabled
|
|
143
|
+
// const hasPin = some(recommendations, (p) => p.isPinned);
|
|
139
144
|
// TODO: KCS linking disabled -- PCM-15276 -- restore when linking is re-enabled
|
|
140
145
|
// const hasLink = some(recommendations, (p) => p.isLinked);
|
|
141
146
|
const getCommentBody = () => {
|
|
@@ -163,26 +168,40 @@ export const CaseSolutions = forwardRef((props, ref) => {
|
|
|
163
168
|
setStatusUpdating(caseOverviewDispatch, false);
|
|
164
169
|
}
|
|
165
170
|
});
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
171
|
+
// TODO: KCS pin/unpin disabled -- PCM-15276 -- restore when pin/unpin is re-enabled
|
|
172
|
+
// const updateRecommendation = async (recommendationToUpdate: ICaseDetailAsideRecommendation, linked: boolean) => {
|
|
173
|
+
// const recommendation: any = {
|
|
174
|
+
// resourceId: recommendationToUpdate.resourceId,
|
|
175
|
+
// resourceType: recommendationToUpdate.resourceType,
|
|
176
|
+
// linked,
|
|
177
|
+
// };
|
|
178
|
+
//
|
|
179
|
+
// if (recommendationToUpdate.resourceViewURI)
|
|
180
|
+
// recommendation.resourceViewURI = recommendationToUpdate.resourceViewURI;
|
|
181
|
+
//
|
|
182
|
+
// // for some doc types like Errata we don't have resourceURI. If resourceURI was not available,
|
|
183
|
+
// // we constructe a 'fake' one to be used when linking in SFDC
|
|
184
|
+
// recommendation.resourceURI = recommendationToUpdate.resourceURI
|
|
185
|
+
// ? recommendationToUpdate.resourceURI
|
|
186
|
+
// : recommendationToUpdate.resourceViewURI
|
|
187
|
+
// ? recommendationToUpdate.resourceViewURI
|
|
188
|
+
// : recommendationToUpdate.resourceId;
|
|
189
|
+
//
|
|
190
|
+
// await updateCaseDetails(
|
|
191
|
+
// caseDispatch,
|
|
192
|
+
// caseNumber,
|
|
193
|
+
// {
|
|
194
|
+
// caseResourceLinks: [recommendation],
|
|
195
|
+
// },
|
|
196
|
+
// true
|
|
197
|
+
// );
|
|
198
|
+
// };
|
|
199
|
+
// TODO: KCS pin/unpin disabled -- PCM-15276 -- restore when pin/unpin is re-enabled
|
|
200
|
+
// const canPinUnpin = ability.can(
|
|
201
|
+
// resourceActions.PATCH,
|
|
202
|
+
// resources.CASE_DETAILS,
|
|
203
|
+
// CaseDetailsFields.CASE_DETAILS_PIN_UNPIN_RESOURCES
|
|
204
|
+
// );
|
|
186
205
|
// TODO: KCS linking disabled -- PCM-15276 -- restore when linking is re-enabled
|
|
187
206
|
// const canLinkUnlink = ability.can(
|
|
188
207
|
// resourceActions.PATCH,
|
|
@@ -192,53 +211,80 @@ export const CaseSolutions = forwardRef((props, ref) => {
|
|
|
192
211
|
const addDtmEvent = (stepName) => {
|
|
193
212
|
// reserve for when fixing dtm
|
|
194
213
|
};
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
214
|
+
// TODO: KCS pin/unpin disabled -- PCM-15276 -- restore when pin/unpin is re-enabled
|
|
215
|
+
// const updateRecommendations =
|
|
216
|
+
// (recommendationToUpdate: ICaseDetailAsideRecommendation, isPinned: boolean, isLinked: boolean) => async () => {
|
|
217
|
+
// try {
|
|
218
|
+
// setIsPinLoading((prevPiningMap) => ({ ...prevPiningMap, [recommendationToUpdate.resourceId]: true }));
|
|
219
|
+
// await updateRecommendation(recommendationToUpdate, isLinked !== undefined ? !isLinked : !isPinned);
|
|
220
|
+
//
|
|
221
|
+
// setTopRecommendations((prevTopRecs) =>
|
|
222
|
+
// prevTopRecs.map((rec) =>
|
|
223
|
+
// rec.resourceId === recommendationToUpdate.resourceId
|
|
224
|
+
// ? {
|
|
225
|
+
// ...rec,
|
|
226
|
+
// isLinked: isLinked !== undefined ? !isLinked : !!rec.isLinked,
|
|
227
|
+
// isPinned: isPinned !== undefined ? !isPinned : !!rec.isPinned,
|
|
228
|
+
// }
|
|
229
|
+
// : rec
|
|
230
|
+
// )
|
|
231
|
+
// );
|
|
232
|
+
//
|
|
233
|
+
// setRecommendations((prevRecs) => {
|
|
234
|
+
// const toBeAdded = !prevRecs.some((r) => r.resourceId === recommendationToUpdate.resourceId);
|
|
235
|
+
//
|
|
236
|
+
// if (toBeAdded) {
|
|
237
|
+
// return [
|
|
238
|
+
// ...prevRecs,
|
|
239
|
+
// {
|
|
240
|
+
// ...recommendationToUpdate,
|
|
241
|
+
// isLinked: isLinked !== undefined ? !isLinked : recommendationToUpdate.isLinked,
|
|
242
|
+
// isPinned: isPinned !== undefined ? !isPinned : recommendationToUpdate.isPinned,
|
|
243
|
+
// isPinnedAndLinked:
|
|
244
|
+
// (isPinned !== undefined ? !isPinned : recommendationToUpdate.isPinned) &&
|
|
245
|
+
// (isLinked !== undefined ? !isLinked : recommendationToUpdate.isLinked),
|
|
246
|
+
// },
|
|
247
|
+
// ];
|
|
248
|
+
// } else {
|
|
249
|
+
// return prevRecs
|
|
250
|
+
// .map((rec) =>
|
|
251
|
+
// rec.resourceId === recommendationToUpdate.resourceId
|
|
252
|
+
// ? {
|
|
253
|
+
// ...rec,
|
|
254
|
+
// isLinked: isLinked !== undefined ? !isLinked : !!rec.isLinked,
|
|
255
|
+
// isPinned: isPinned !== undefined ? !isPinned : !!rec.isPinned,
|
|
256
|
+
// isPinnedAndLinked:
|
|
257
|
+
// (isPinned !== undefined ? !isPinned : rec.isPinned) &&
|
|
258
|
+
// (isLinked !== undefined ? !isLinked : rec.isLinked),
|
|
259
|
+
// }
|
|
260
|
+
// : rec
|
|
261
|
+
// )
|
|
262
|
+
// .filter((rec) => rec.isLinked || rec.isPinned);
|
|
263
|
+
// }
|
|
264
|
+
// });
|
|
265
|
+
// setIsPinLoading((prevPiningMap) => ({ ...prevPiningMap, [recommendationToUpdate.resourceId]: false }));
|
|
266
|
+
// } catch (error) {
|
|
267
|
+
// if (error.status === 403) {
|
|
268
|
+
// ToastNotification.addDangerMessage(
|
|
269
|
+
// t('You do not have the proper entitlements to pin a recommendation.'),
|
|
270
|
+
// <>
|
|
271
|
+
// {t('Please')}
|
|
272
|
+
// <a href="/support/contact/customerService"> {t('contact Customer Service')} </a>
|
|
273
|
+
// {t('if you think this is an error.')}
|
|
274
|
+
// </>
|
|
275
|
+
// );
|
|
276
|
+
// } else {
|
|
277
|
+
// isPinned !== undefined || isLinked !== undefined
|
|
278
|
+
// ? caseUpdateError.showError(error, t('Could not unpin the solution'))
|
|
279
|
+
// : caseUpdateError.showError(error, t('Could not pin the solution'));
|
|
280
|
+
// }
|
|
281
|
+
// setIsPinLoading((prevPiningMap) => {
|
|
282
|
+
// const newMap = { ...prevPiningMap };
|
|
283
|
+
// delete newMap[recommendationToUpdate.resourceId];
|
|
284
|
+
// return newMap;
|
|
285
|
+
// });
|
|
286
|
+
// }
|
|
287
|
+
// };
|
|
242
288
|
// fetch top recommendations
|
|
243
289
|
useEffect(() => {
|
|
244
290
|
function fetchRecs() {
|
|
@@ -297,9 +343,14 @@ export const CaseSolutions = forwardRef((props, ref) => {
|
|
|
297
343
|
populatePinSections();
|
|
298
344
|
}
|
|
299
345
|
}, [allDocs, isFetchingCaseDetails, isLoadingRecommendations, recomendationsObj]);
|
|
300
|
-
const renderTopRecommendations = (recommendation, index, type) => (React.createElement(React.Fragment, null,
|
|
301
|
-
|
|
302
|
-
|
|
346
|
+
const renderTopRecommendations = (recommendation, index, type) => (React.createElement(React.Fragment, null,
|
|
347
|
+
React.createElement(CaseSolutionsItem
|
|
348
|
+
// TODO: KCS pin/unpin disabled -- PCM-15276 -- restore showPin when pin/unpin is re-enabled
|
|
349
|
+
, {
|
|
350
|
+
// TODO: KCS pin/unpin disabled -- PCM-15276 -- restore showPin when pin/unpin is re-enabled
|
|
351
|
+
showPin: false, type: type, pinTitle: '', isPinLoading: {}, index: index, recommendation: recommendation, onPinClicked: () => { }, onLinkClick: (name) => addDtmEvent(name) })));
|
|
352
|
+
// TODO: KCS pin/unpin disabled -- PCM-15276 -- restore showPin when pin/unpin is re-enabled
|
|
353
|
+
const renderPinsByCustomer = (recommendation, index, type) => (React.createElement(CaseSolutionsItem, { showPin: false, type: type, pinTitle: '', isPinLoading: {}, index: index, recommendation: recommendation, onPinClicked: () => { }, onLinkClick: (name) => addDtmEvent(name) }));
|
|
303
354
|
// TODO: KCS linking disabled -- PCM-15276 -- restore when linking is re-enabled
|
|
304
355
|
// customer logged in: we show links but perform pin/unpin
|
|
305
356
|
// const renderHandpickedCustomerView = (
|
|
@@ -378,14 +429,11 @@ export const CaseSolutions = forwardRef((props, ref) => {
|
|
|
378
429
|
React.createElement("span", { className: "badge-item pf-v6-u-font-size-sm pf-v6-u-mx-sm", style: { lineHeight: '18px' } },
|
|
379
430
|
React.createElement(Label, null, pinnedRecommendations.length)))),
|
|
380
431
|
React.createElement(CardExpandableContent, null,
|
|
381
|
-
React.createElement(CardBody, null,
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
{ title: '5', value: 5 },
|
|
387
|
-
{ title: '10', value: 10 },
|
|
388
|
-
] })))))),
|
|
432
|
+
React.createElement(CardBody, null,
|
|
433
|
+
React.createElement(PaginatedList, { id: "case-details-pinned-recommendations", listItems: pinnedRecommendations.map((rec, index) => renderPinsByCustomer(rec, index, 'pinned-recommendations')), perPage: 5, className: "list-icons list-icons-flush", isFetching: !!isLoadingRecommendations, perPageOptions: [
|
|
434
|
+
{ title: '5', value: 5 },
|
|
435
|
+
{ title: '10', value: 10 },
|
|
436
|
+
] }))))),
|
|
389
437
|
topRecommendations.length > 0 && (React.createElement(Card, { className: "card-support recommendations", ref: ref },
|
|
390
438
|
React.createElement(CardHeader, null,
|
|
391
439
|
React.createElement("h3", { className: "card-heading case-detail-panel-card-heading" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseSolutionsItem.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/CaseSolutions/CaseSolutionsItem.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAS5E,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AACrF,UAAU,MAAM;IACZ,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAGnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,8BAA8B,CAAC;IAC/C,YAAY,EAAE,GAAG,CAAC;IAClB,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC;AAED,MAAM,WAAW,8BAA+B,SAAQ,OAAO,CAAC,iBAAiB,CAAC;IAC9E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,0BAA0B,CAAC;CACnD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"CaseSolutionsItem.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/CaseSolutions/CaseSolutionsItem.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAS5E,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AACrF,UAAU,MAAM;IACZ,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAGnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,8BAA8B,CAAC;IAC/C,YAAY,EAAE,GAAG,CAAC;IAClB,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC;AAED,MAAM,WAAW,8BAA+B,SAAQ,OAAO,CAAC,iBAAiB,CAAC;IAC9E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,0BAA0B,CAAC;CACnD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,qBA+D9C"}
|
|
@@ -13,10 +13,10 @@ export function CaseSolutionsItem(props) {
|
|
|
13
13
|
const isLoading = !!props.isPinLoading[props.recommendation.resourceId];
|
|
14
14
|
return (React.createElement("div", null,
|
|
15
15
|
React.createElement("div", { className: "recommendation-header" },
|
|
16
|
-
React.createElement(Button, { icon: React.createElement(React.Fragment, null,
|
|
16
|
+
props.showPin && (React.createElement(Button, { icon: React.createElement(React.Fragment, null,
|
|
17
17
|
isLoading && React.createElement(LoadingIndicator, { show: isLoading, size: "xs" }),
|
|
18
|
-
!isLoading &&
|
|
19
|
-
React.createElement(Icon, { size: "md", color: "0066cc" }, props.isPinned ? (React.createElement(StarIcon, { className: "pinned-resource" })) : (React.createElement(OutlinedStarIcon, { className: "pinned-resource" })))))), title: props.pinTitle, onClick: props.onPinClicked, "data-tracking-id": `case-resource-${props.pinTitle}`, variant: "plain", className: "list-icon" }),
|
|
18
|
+
!isLoading && (React.createElement(React.Fragment, null,
|
|
19
|
+
React.createElement(Icon, { size: "md", color: "0066cc" }, props.isPinned ? (React.createElement(StarIcon, { className: "pinned-resource" })) : (React.createElement(OutlinedStarIcon, { className: "pinned-resource" })))))), title: props.pinTitle, onClick: props.onPinClicked, "data-tracking-id": `case-resource-${props.pinTitle}`, variant: "plain", className: "list-icon" })),
|
|
20
20
|
React.createElement("a", { href: props.recommendation.resourceViewURI, "data-tracking-id": `case-resource-${props.type}-link-${props.index}`, target: "_blank", rel: "noopener noreferrer", className: "case-resource-recommendation-link", dangerouslySetInnerHTML: {
|
|
21
21
|
__html: DOMPurify.sanitize(truncate(decodeMarkTag(props.recommendation.title || ''), maxTitleLength)),
|
|
22
22
|
}, onClick: () => props.onLinkClick('case solution click') })),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductVersion.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDetails/ProductVersion.tsx"],"names":[],"mappings":"AA0CA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAevE,UAAU,MAAM;IACZ,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACvC;AAED,iBAAS,eAAe,CAAC,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"ProductVersion.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDetails/ProductVersion.tsx"],"names":[],"mappings":"AA0CA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAevE,UAAU,MAAM;IACZ,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACvC;AAED,iBAAS,eAAe,CAAC,KAAK,EAAE,MAAM,qBAgbrC;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -123,7 +123,7 @@ function ProductNVersion(props) {
|
|
|
123
123
|
}
|
|
124
124
|
};
|
|
125
125
|
const updateProductVerstion = (selectedProduct, selectedVersion) => __awaiter(this, void 0, void 0, function* () {
|
|
126
|
-
var _a, _b;
|
|
126
|
+
var _a, _b, _c;
|
|
127
127
|
let onlyVersionChanged = false;
|
|
128
128
|
try {
|
|
129
129
|
if (product === selectedProduct) {
|
|
@@ -135,9 +135,7 @@ function ProductNVersion(props) {
|
|
|
135
135
|
const serviceLevels = !onlyVersionChanged
|
|
136
136
|
? resolveProductServiceLevelsForAccount(selectedAccountDetails.data, allProducts.data.productsResult, selectedProduct)
|
|
137
137
|
: undefined;
|
|
138
|
-
yield updateCaseDetailsGraphQL(caseDispatch, apolloClient, caseNumber, Object.assign(Object.assign(Object.assign({ product: selectedProduct, version: selectedVersion }, (selectedVersionId ? { productId: selectedVersionId } : {})), (!onlyVersionChanged
|
|
139
|
-
? { entitlementId: serviceLevels.defaultEntitlementId }
|
|
140
|
-
: {})), (!onlyVersionChanged && (serviceLevels === null || serviceLevels === void 0 ? void 0 : serviceLevels.entitlementSla)
|
|
138
|
+
yield updateCaseDetailsGraphQL(caseDispatch, apolloClient, caseNumber, Object.assign(Object.assign(Object.assign({ product: selectedProduct, version: selectedVersion }, (selectedVersionId ? { productId: selectedVersionId } : {})), (!onlyVersionChanged ? { entitlementId: (_c = serviceLevels === null || serviceLevels === void 0 ? void 0 : serviceLevels.defaultEntitlementId) !== null && _c !== void 0 ? _c : null } : {})), (!onlyVersionChanged && (serviceLevels === null || serviceLevels === void 0 ? void 0 : serviceLevels.entitlementSla)
|
|
141
139
|
? { entitlementSla: serviceLevels.entitlementSla }
|
|
142
140
|
: {})), false, { existingCaseDetails });
|
|
143
141
|
if (!onlyVersionChanged) {
|
|
@@ -6,7 +6,6 @@ interface IProps {
|
|
|
6
6
|
feedback: number;
|
|
7
7
|
onFeedBackUpdate: (id: string, feedback: number) => void;
|
|
8
8
|
accountNumber: string;
|
|
9
|
-
onReply: (commentText: string, commentCreator: string, isPublic: boolean) => void;
|
|
10
9
|
showJumpToComment?: boolean;
|
|
11
10
|
onJumpToComment?: (commentId: string) => void;
|
|
12
11
|
downloadAttachment: ({ caseNumber, uuid, name }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseComments.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDiscussion/CaseComments.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"CaseComments.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDiscussion/CaseComments.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AA2BvE,OAAO,KAAwC,MAAM,OAAO,CAAC;AAU7D,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,kBAAkB,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CAChH;AAED,QAAA,MAAM,YAAY,4EAgUhB,CAAC;AAEH,eAAe,YAAY,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// TODO: Re-enable after GraphQL migration of feedback (Allowed Regression #5)
|
|
2
2
|
// import { ICommentFeedback } from '@cee-eng/hydrajs/@types/api/public/commentFeedback';
|
|
3
|
-
import { EventTypes, linkifyBZIDs, linkifyWithCaseIDs,
|
|
3
|
+
import { EventTypes, linkifyBZIDs, linkifyWithCaseIDs, processRME } from '@cee-eng/ui-toolkit';
|
|
4
4
|
import { Icon } from '@patternfly/react-core';
|
|
5
5
|
// TODO: Re-enable after GraphQL migration of feedback (Allowed Regression #5)
|
|
6
6
|
// import { Tooltip, TooltipPosition } from '@patternfly/react-core';
|
|
@@ -11,7 +11,6 @@ import { Icon } from '@patternfly/react-core';
|
|
|
11
11
|
// import OutlinedSmileIcon from '@patternfly/react-icons/dist/js/icons/outlined-smile-icon';
|
|
12
12
|
// import SmileIcon from '@patternfly/react-icons/dist/js/icons/smile-icon';
|
|
13
13
|
import UserCircleIcon from '@patternfly/react-icons/dist/js/icons/user-circle-icon';
|
|
14
|
-
import { EditorMode } from '@rh-support/components';
|
|
15
14
|
// TODO: Re-enable after GraphQL migration of feedback (Allowed Regression #5)
|
|
16
15
|
// import { LoadingIndicator, ToastNotification } from '@rh-support/components';
|
|
17
16
|
import { AbilityContext,
|
|
@@ -45,9 +44,6 @@ const CaseComments = React.forwardRef((props, ref) => {
|
|
|
45
44
|
// TODO: Re-enable after GraphQL migration of feedback (Allowed Regression #5)
|
|
46
45
|
// const [isFeedbackUpdating, setIsFeedbackUpdating] = useState(false);
|
|
47
46
|
const { isExportingPDF } = useContext(PDFContext);
|
|
48
|
-
const commentReply = (comment) => () => {
|
|
49
|
-
props.onReply(comment.commentBody, comment.createdBy, comment.isPublic);
|
|
50
|
-
};
|
|
51
47
|
const onJumpToComment = (commentId) => () => props.showJumpToComment && props.onJumpToComment && props.onJumpToComment(commentId);
|
|
52
48
|
// TODO: Re-enable after GraphQL migration of feedback (Allowed Regression #5)
|
|
53
49
|
// const applyCommentFeedback = (comment: ICaseComment, feedback) => async (e) => {
|
|
@@ -181,15 +177,6 @@ const CaseComments = React.forwardRef((props, ref) => {
|
|
|
181
177
|
// Remove <ul> and </ul> tags completely
|
|
182
178
|
.replace(/<\/?ul>/gi, ''));
|
|
183
179
|
}
|
|
184
|
-
const commentMarkdown = (markdown) => {
|
|
185
|
-
let htmlString = parseCommentMarkdown(markdown, { showButtonForAttachmentLink: true, disableImagePreview: isExportingPDF, encodeHTMLEntities: false },
|
|
186
|
-
// @ts-ignore
|
|
187
|
-
{ openLinksInNewTab: true, gfm: true, breaks: true });
|
|
188
|
-
if (isExportingPDF) {
|
|
189
|
-
htmlString = formatMarkdownHtmlForPDF(htmlString);
|
|
190
|
-
}
|
|
191
|
-
return { __html: sanitizeHtml(htmlString) };
|
|
192
|
-
};
|
|
193
180
|
const onCommentAreaClick = (e) => {
|
|
194
181
|
let { event } = e.target['dataset'];
|
|
195
182
|
if (!event) {
|
|
@@ -205,13 +192,12 @@ const CaseComments = React.forwardRef((props, ref) => {
|
|
|
205
192
|
};
|
|
206
193
|
const parseCommentHtml = (commentText, contentType) => {
|
|
207
194
|
let text = commentText;
|
|
208
|
-
if (contentType ===
|
|
209
|
-
//
|
|
195
|
+
if (contentType === 'plaintext') {
|
|
196
|
+
// Legacy plain-text comments: normalize SFDC HTML line breaks
|
|
210
197
|
text = text
|
|
211
198
|
.replace(/<br\s*\/?>/gi, '\n')
|
|
212
199
|
.replace(/<\/p>/gi, '\n')
|
|
213
200
|
.replace(/<p>/gi, '');
|
|
214
|
-
// Escape all angle brackets so plaintext tags don't get swallowed by DOMPurify
|
|
215
201
|
text = text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
216
202
|
text = linkifyLinks(text);
|
|
217
203
|
text = linkifyWithCaseIDs(text);
|
|
@@ -221,16 +207,19 @@ const CaseComments = React.forwardRef((props, ref) => {
|
|
|
221
207
|
return text;
|
|
222
208
|
};
|
|
223
209
|
const computeCommentText = (comment) => {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
210
|
+
if (isEmpty(comment.commentBody))
|
|
211
|
+
return null;
|
|
212
|
+
// Legacy plain-text comments still need escaping and linkification
|
|
213
|
+
if (comment.contentType === 'plaintext') {
|
|
214
|
+
const parseComment = parseCommentHtml(comment.commentBody, comment.contentType);
|
|
229
215
|
return (React.createElement("pre", { className: "push-top-narrow comment-plaintext reset-pre-text", dangerouslySetInnerHTML: commentText(parseComment), style: { fontFamily: isExportingPDF ? 'DejaVu Sans' : '' } }));
|
|
230
216
|
}
|
|
231
|
-
|
|
232
|
-
|
|
217
|
+
// HTML comments (new rich text or legacy markdown — both stored as HTML)
|
|
218
|
+
let htmlString = comment.commentBody;
|
|
219
|
+
if (isExportingPDF) {
|
|
220
|
+
htmlString = formatMarkdownHtmlForPDF(htmlString);
|
|
233
221
|
}
|
|
222
|
+
return (React.createElement("div", { className: "push-top-narrow comment-richtext", dangerouslySetInnerHTML: { __html: sanitizeHtml(htmlString) }, style: { fontFamily: isExportingPDF ? 'DejaVu Sans' : '' } }));
|
|
234
223
|
};
|
|
235
224
|
useEffect(() => {
|
|
236
225
|
if ((markdownRef === null || markdownRef === void 0 ? void 0 : markdownRef.current) && isExportingPDF) {
|
|
@@ -244,7 +233,7 @@ const CaseComments = React.forwardRef((props, ref) => {
|
|
|
244
233
|
}, [props.comment, isExportingPDF]);
|
|
245
234
|
if (!((_a = props.comment) === null || _a === void 0 ? void 0 : _a.isPublic) && !canSeePrivateComments)
|
|
246
235
|
return React.createElement(React.Fragment, null);
|
|
247
|
-
return (React.createElement("
|
|
236
|
+
return (React.createElement("article", { ref: ref, id: props.comment.id, "aria-label": `Comment by ${props.comment.lastModifiedById}`, className: `prevent-split ${computePrivateComment(props.comment)} support-comment ${computeDiscussionCardCalss(props.comment)} ${ref ? 'selected-case-comment' : ''}` },
|
|
248
237
|
React.createElement("header", null,
|
|
249
238
|
React.createElement("h4", null,
|
|
250
239
|
computeCommentAuthorIcon(props.comment),
|
|
@@ -262,8 +251,6 @@ const CaseComments = React.forwardRef((props, ref) => {
|
|
|
262
251
|
React.createElement("span", { className: "pull-right pf-v6-l-flex pf-m-align-items-center" },
|
|
263
252
|
props.showJumpToComment && (React.createElement(DiscussionItemLink, { onClick: onJumpToComment(props.comment.id), discussionType: DiscussionType.COMMENT, itemId: props.comment.id, caseNumber: caseNumber, isCopyLink: false },
|
|
264
253
|
React.createElement(Trans, null, "Jump to comment"))),
|
|
265
|
-
React.createElement("button", { onClick: commentReply(props.comment), className: `btn btn-app btn-link case-reply-button ${isExportingPDF ? 'hide-in-pdf' : ''}`, "data-tracking-id": "case-comment-reply", type: "button" },
|
|
266
|
-
React.createElement(Trans, null, "Reply")),
|
|
267
254
|
React.createElement(JumpAndCopyLink, { caseNumber: caseNumber, cardId: props.comment.id, discussionType: DiscussionType.COMMENT })))));
|
|
268
255
|
});
|
|
269
256
|
export default CaseComments;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseDiscussion.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAkBvE,OAAO,KAAoE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"CaseDiscussion.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAkBvE,OAAO,KAAoE,MAAM,OAAO,CAAC;AAoCzF,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,YAAY,EAAE,CAAC;IAC7B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;IAGxB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,KAAK,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;IAC/C,eAAe,EAAE,OAAO,CAAC;IACzB,eAAe,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;CAClD;AAOD,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,KAAK,EAAE,MAAM,qBAugBnD"}
|
|
@@ -26,7 +26,7 @@ import { AutoSizer, CellMeasurer, CellMeasurerCache, List, WindowScroller } from
|
|
|
26
26
|
import { useCaseDispatch, useCaseSelector } from '../../../../context/CaseContext';
|
|
27
27
|
import { useCaseDetailsPageDispatchContext, useCaseDetailsPageStateContext, } from '../../../../context/CaseDetailsPageContext';
|
|
28
28
|
import { useCaseDiscussionTabDispatchContext, useCaseDiscussionTabStateContext, } from '../../../../context/CaseDiscussionTabContext';
|
|
29
|
-
import {
|
|
29
|
+
import { discussionSortOrderConst, DiscussionType, setDiscussions, setSort, updateAttachment, updateAttacmentsAfterRemoval, updateDiscussionStateAttachments, } from '../../../../reducers/CaseDiscussionTabReducer';
|
|
30
30
|
import { setCaseState } from '../../../../reducers/CaseReducer';
|
|
31
31
|
import { AttachmentContextProvider } from '../../../shared/fileUpload/reducer/AttachmentReducerContext';
|
|
32
32
|
import { PDFContext } from '../../PDFContainer';
|
|
@@ -52,7 +52,7 @@ export default function CaseDiscussion(props) {
|
|
|
52
52
|
const urlSearchParams = getUrlParsedParams(useLocation().search);
|
|
53
53
|
const discussionIdFromUrl = ((urlSearchParams === null || urlSearchParams === void 0 ? void 0 : urlSearchParams.commentId) || (urlSearchParams === null || urlSearchParams === void 0 ? void 0 : urlSearchParams.attachmentId));
|
|
54
54
|
const activeDiscussionElementRef = useRef(null);
|
|
55
|
-
const { sort, discussionFiltersListState, allDiscussions
|
|
55
|
+
const { sort, discussionFiltersListState, allDiscussions } = useCaseDiscussionTabStateContext();
|
|
56
56
|
const { globalMetadataState: { navBarRef }, } = useGlobalStateContext();
|
|
57
57
|
const dispatchDiscussion = useCaseDiscussionTabDispatchContext();
|
|
58
58
|
const { caseDetailsPageState: { caseAttachmentHydra }, } = useCaseDetailsPageStateContext();
|
|
@@ -73,7 +73,6 @@ export default function CaseDiscussion(props) {
|
|
|
73
73
|
const [isCommentSearchCleared, setIsCommentSearchCleared] = useState(false);
|
|
74
74
|
const [isJumpToCommentClicked, setJumpToCommentClicked] = useState(false);
|
|
75
75
|
const [canUpdateScrollTop, setCanUpdateScrollTop] = useState(true);
|
|
76
|
-
const [replyingToPrivateComment, setReplyingToPrivateComment] = useState(null);
|
|
77
76
|
const [discussionSectionWidth, setDiscussionSectionWidth] = useState(null);
|
|
78
77
|
const [isSortOpen, setIsSortOpen] = useState(false);
|
|
79
78
|
const [sortSelected, setSortSelected] = useState('Select a value');
|
|
@@ -148,19 +147,6 @@ export default function CaseDiscussion(props) {
|
|
|
148
147
|
}
|
|
149
148
|
dtmTrackEventCaseStepEncountered('comment', caseNumber, product, version);
|
|
150
149
|
});
|
|
151
|
-
const onReply = (commentText, commentCreator, isPublic) => {
|
|
152
|
-
var _a;
|
|
153
|
-
setReplyingToPrivateComment(!isPublic);
|
|
154
|
-
setCommentText(dispatchDiscussion, commentText, commentCreator);
|
|
155
|
-
scrollIntoView(props.tabRef, { navBarRef, timeout: 0, onlyIfNotInViewport: true, offset: 30 });
|
|
156
|
-
commentIndex !== -1 && setCommentIndex(-1);
|
|
157
|
-
isCommentSearchCleared && setIsCommentSearchCleared(false);
|
|
158
|
-
(_a = listRef === null || listRef === void 0 ? void 0 : listRef.current) === null || _a === void 0 ? void 0 : _a.scrollToPosition(0);
|
|
159
|
-
};
|
|
160
|
-
const resetReplyComment = () => {
|
|
161
|
-
clearReplyComment(dispatchDiscussion);
|
|
162
|
-
setReplyingToPrivateComment(null);
|
|
163
|
-
};
|
|
164
150
|
/** Strips special chars to prevent regex injection, then HTML-escapes via DOM round-trip to prevent XSS. */
|
|
165
151
|
const sanitizedSearchInput = (value) => {
|
|
166
152
|
if (!value)
|
|
@@ -261,7 +247,7 @@ export default function CaseDiscussion(props) {
|
|
|
261
247
|
if (isEmpty(discussion) || isEmpty(discussion.item))
|
|
262
248
|
return null;
|
|
263
249
|
return (React.createElement("div", { "data-tracking-id": "discussion-elements", key: discussion.item.id },
|
|
264
|
-
discussion.discussionType === DiscussionType.COMMENT && (React.createElement(CaseComments, { caseNumber: caseNumber, ref: discussionIdFromUrl === discussion.item.id ? activeDiscussionElementRef : null, comment: discussion.item, onFeedBackUpdate: () => { }, feedback: discussion.feedback, accountNumber: props.accountNumber,
|
|
250
|
+
discussion.discussionType === DiscussionType.COMMENT && (React.createElement(CaseComments, { caseNumber: caseNumber, ref: discussionIdFromUrl === discussion.item.id ? activeDiscussionElementRef : null, comment: discussion.item, onFeedBackUpdate: () => { }, feedback: discussion.feedback, accountNumber: props.accountNumber, showJumpToComment: !isEmpty(searchCommentText), onJumpToComment: onJumpToComment, downloadAttachment: downloadAttachment })),
|
|
265
251
|
discussion.discussionType === DiscussionType.ATTACHMENT && (React.createElement(CaseAttachment, { attachment: discussion.item, onAttachmentRemove: onAttachmentRemove, onMetadataUpdate: onMetadataUpdate, showJumpToComment: !isEmpty(searchCommentText), onJumpToComment: onJumpToComment, downloadAttachment: downloadAttachment, ref: discussionIdFromUrl === discussion.item.id ? activeDiscussionElementRef : null }))));
|
|
266
252
|
};
|
|
267
253
|
const rowRenderer = ({ index, parent, key, style, }) => {
|
|
@@ -335,7 +321,7 @@ export default function CaseDiscussion(props) {
|
|
|
335
321
|
return (React.createElement(React.Fragment, null,
|
|
336
322
|
React.createElement(ErrorBoundary, { errorMsgInfo: { message: t('There was an error loading post comment section') } },
|
|
337
323
|
React.createElement(AttachmentContextProvider, null,
|
|
338
|
-
React.createElement(PostComment, { caseNumber: caseNumber, allDiscussions: allDiscussions, onCommentAdded: onCommentAdded, onAttachmentAdded: onAttachmentAdded, onAttachmentRemove: onAttachmentRemove
|
|
324
|
+
React.createElement(PostComment, { caseNumber: caseNumber, allDiscussions: allDiscussions, onCommentAdded: onCommentAdded, onAttachmentAdded: onAttachmentAdded, onAttachmentRemove: onAttachmentRemove }))),
|
|
339
325
|
props.commentsLoading && allDiscussions.length === 0 && React.createElement(LoadingIndicator, { size: "sm" }),
|
|
340
326
|
props.commentsError && allDiscussions.length === 0 && (React.createElement(AlertMessage, { variant: AlertType.DANGER, show: true, title: t('Failed to load comments. Try refreshing.') })),
|
|
341
327
|
!props.commentsLoading && !props.commentsError && allDiscussions.length === 0 && (React.createElement(Trans, null, "No comments")),
|
package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useCommentDrafts.d.ts
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import { EditorMode } from '@rh-support/components';
|
|
2
1
|
import { Dispatch, SetStateAction } from 'react';
|
|
3
2
|
interface UseCommentDraftsParams {
|
|
4
3
|
caseNumber: string;
|
|
5
4
|
loggedInUserSSO: string;
|
|
6
5
|
commentSignature: string;
|
|
7
6
|
setCommentText: Dispatch<SetStateAction<string>>;
|
|
8
|
-
setCommentType: Dispatch<SetStateAction<EditorMode>>;
|
|
9
7
|
setIsPublic: Dispatch<SetStateAction<boolean | undefined>>;
|
|
10
8
|
applySignature: (text: string) => void;
|
|
11
9
|
}
|
|
12
|
-
export declare function useCommentDrafts({ caseNumber, loggedInUserSSO, commentSignature, setCommentText,
|
|
10
|
+
export declare function useCommentDrafts({ caseNumber, loggedInUserSSO, commentSignature, setCommentText, setIsPublic, applySignature, }: UseCommentDraftsParams): {
|
|
13
11
|
saveDraft: (...args: any[]) => void;
|
|
14
12
|
clearDraft: () => Promise<void>;
|
|
15
13
|
};
|
package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useCommentDrafts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCommentDrafts.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useCommentDrafts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"useCommentDrafts.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useCommentDrafts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAsB,MAAM,OAAO,CAAC;AAMrE,UAAU,sBAAsB;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IACjD,WAAW,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC;IAC3D,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1C;AAED,wBAAgB,gBAAgB,CAAC,EAC7B,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,cAAc,GACjB,EAAE,sBAAsB;;;EAqDxB"}
|
|
@@ -11,11 +11,11 @@ import { debounce } from '@patternfly/react-core';
|
|
|
11
11
|
import { useEffect, useMemo } from 'react';
|
|
12
12
|
import { CaseDetailsCacheNamespaces } from '../../../../../enums/cache';
|
|
13
13
|
import { CaseDetailsCacheUtils } from '../../../../../utils/caseDetailsCacheUtils';
|
|
14
|
-
export function useCommentDrafts({ caseNumber, loggedInUserSSO, commentSignature, setCommentText,
|
|
15
|
-
const saveDraft = useMemo(() => debounce(function (value,
|
|
14
|
+
export function useCommentDrafts({ caseNumber, loggedInUserSSO, commentSignature, setCommentText, setIsPublic, applySignature, }) {
|
|
15
|
+
const saveDraft = useMemo(() => debounce(function (value, publicFlag) {
|
|
16
16
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17
17
|
const { value: prevDraftComments = {} } = (yield CaseDetailsCacheUtils.get(CaseDetailsCacheNamespaces.COMMENTS_DRAFT.name, loggedInUserSSO)) || {};
|
|
18
|
-
prevDraftComments[caseNumber] = { text: value, privateFlag: !publicFlag
|
|
18
|
+
prevDraftComments[caseNumber] = { text: value, privateFlag: !publicFlag };
|
|
19
19
|
CaseDetailsCacheUtils.set(CaseDetailsCacheNamespaces.COMMENTS_DRAFT.name, loggedInUserSSO, {
|
|
20
20
|
value: prevDraftComments,
|
|
21
21
|
});
|
|
@@ -36,10 +36,14 @@ export function useCommentDrafts({ caseNumber, loggedInUserSSO, commentSignature
|
|
|
36
36
|
const draft = draftComments[caseNumber];
|
|
37
37
|
if (!((_a = draft === null || draft === void 0 ? void 0 : draft.text) === null || _a === void 0 ? void 0 : _a.trim()))
|
|
38
38
|
return;
|
|
39
|
-
|
|
39
|
+
// Legacy guard: old drafts stored as plain text without HTML tags
|
|
40
|
+
let draftText = draft.text;
|
|
41
|
+
if (!/<[a-z][\s\S]*>/i.test(draftText)) {
|
|
42
|
+
draftText = `<p>${draftText}</p>`;
|
|
43
|
+
}
|
|
44
|
+
applySignature(draftText);
|
|
40
45
|
if (draft.privateFlag)
|
|
41
46
|
setIsPublic(false);
|
|
42
|
-
setCommentType(draft.type);
|
|
43
47
|
});
|
|
44
48
|
}
|
|
45
49
|
loadDraft();
|
|
@@ -2,12 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import { IDiscussion } from '../../../../reducers/CaseDiscussionTabReducer';
|
|
3
3
|
interface IProps {
|
|
4
4
|
caseNumber: string;
|
|
5
|
-
commentText?: string;
|
|
6
|
-
commentCreator?: string;
|
|
7
5
|
onCommentAdded?: () => Promise<void>;
|
|
8
6
|
onAttachmentAdded?: () => void;
|
|
9
7
|
onAttachmentRemove?: (uuid: string) => void;
|
|
10
|
-
onCommentClear?: () => void;
|
|
11
8
|
/**
|
|
12
9
|
* Controls the initial visibility toggle state.
|
|
13
10
|
* - `true` / `false` — sets comment visibility to public/private.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PostComment.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDiscussion/PostComment.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PostComment.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDiscussion/PostComment.tsx"],"names":[],"mappings":"AASA,OAAO,KAA+D,MAAM,OAAO,CAAC;AAOpF,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAmB5E,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C;;;;;OAKG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,WAAW,EAAE,CAAC;CACjC;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,qBA0XxC"}
|