@rh-support/troubleshoot 2.6.357 → 2.6.361
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/AccountInfo/OwnerSelector.js +5 -5
- package/lib/esm/components/CaseEditView/CaseDetailsErrorMessage.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/CaseDetailsErrorMessage.js +16 -6
- package/lib/esm/components/CaseEditView/CaseDetailsTabs.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/CaseDetailsTabs.js +11 -7
- package/lib/esm/components/CaseEditView/CaseOverview/CaseStatus.d.ts +2 -0
- package/lib/esm/components/CaseEditView/CaseOverview/CaseStatus.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/CaseOverview/CaseStatus.js +19 -8
- package/lib/esm/components/CaseEditView/CaseOverview/index.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/CaseOverview/index.js +23 -19
- package/lib/esm/components/CaseEditView/CaseSolutions/CaseSolutions.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/CaseSolutions/CaseSolutions.js +1 -1
- package/lib/esm/components/CaseEditView/ConfirmationModals/ReopenCaseModal.js +2 -2
- package/lib/esm/components/CaseEditView/RequestRemoteSession/NewEssTermsModal.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/RequestRemoteSession/NewEssTermsModal.js +7 -5
- package/lib/esm/components/CaseEditView/RequestRemoteSession/RemoteSessionAgreementModal.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/RequestRemoteSession/RemoteSessionAgreementModal.js +7 -5
- package/lib/esm/components/CaseEditView/RequestRemoteSession/remoteSessionUtils.d.ts +6 -0
- package/lib/esm/components/CaseEditView/RequestRemoteSession/remoteSessionUtils.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/RequestRemoteSession/remoteSessionUtils.js +8 -0
- package/lib/esm/components/CaseEditView/Tabs/CaseActionPlan/CaseActionPlan.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseActionPlan/CaseActionPlan.js +6 -3
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseContactPhoneNumber.js +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseDetailsManagement.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseDetailsManagement.js +41 -8
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseHostname.js +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseInternalStatus.js +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseOpenshiftClusterId/CaseOpenshiftClusterId.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseOpenshiftClusterId/CaseOpenshiftClusterId.js +11 -11
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CasePhoneNumberConfirmAlert.js +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseReferenceNumber.js +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseSbrGroups.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseSbrGroups.js +3 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/ProductVersion.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/ProductVersion.js +1 -6
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/Summary.js +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/useCustomEmails.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/useCustomEmails.js +4 -2
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseAttachment.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseAttachment.js +5 -3
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseComments.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseComments.js +33 -3
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.d.ts +6 -0
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.js +210 -35
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useCommentDrafts.d.ts +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useCommentDrafts.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useCommentDrafts.js +3 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.js +11 -17
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/VerifyCaseStatusModal/VerifyCaseStatusModal.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/VerifyCaseStatusModal/VerifyCaseStatusModal.js +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseHistory/CaseHistory.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseHistory/CaseHistory.js +5 -2
- package/lib/esm/components/CaseEditView/Tabs/CaseHistory/Timeline.d.ts +2 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseHistory/Timeline.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseHistory/Timeline.js +4 -11
- package/lib/esm/components/CaseEditView/Tabs/CasePrivateNotes/CasePrivateNotes.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CasePrivateNotes/CasePrivateNotes.js +6 -3
- package/lib/esm/components/CaseEditView/Tabs/CaseSummary/CaseSummary.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseSummary/CaseSummary.js +1 -0
- package/lib/esm/components/CaseInformation/CaseGroup.d.ts.map +1 -1
- package/lib/esm/components/CaseInformation/CaseGroup.js +6 -2
- package/lib/esm/components/CaseInformation/CaseLabels.d.ts.map +1 -1
- package/lib/esm/components/CaseInformation/CaseLabels.js +21 -16
- package/lib/esm/components/CaseInformation/Fts.js +2 -2
- package/lib/esm/components/CaseInformation/Severity.d.ts.map +1 -1
- package/lib/esm/components/CaseInformation/Severity.js +16 -15
- package/lib/esm/components/CaseManagement/CaseLabelsCreate.d.ts.map +1 -1
- package/lib/esm/components/CaseManagement/CaseLabelsCreate.js +52 -21
- package/lib/esm/components/CaseManagement/Cep.js +1 -1
- package/lib/esm/components/CaseManagement/NoClusterIDReasonSelector.d.ts.map +1 -1
- package/lib/esm/components/CaseManagement/NoClusterIDReasonSelector.js +1 -3
- package/lib/esm/components/CaseManagement/OpenShiftClusterId.d.ts.map +1 -1
- package/lib/esm/components/CaseManagement/OpenShiftClusterId.js +1 -1
- package/lib/esm/components/CaseManagement/OpenshiftDropdownV4.d.ts +0 -1
- package/lib/esm/components/CaseManagement/OpenshiftDropdownV4.d.ts.map +1 -1
- package/lib/esm/components/CaseManagement/OpenshiftDropdownV4.js +6 -12
- package/lib/esm/components/CaseManagement/RHAssociatesSelector.d.ts.map +1 -1
- package/lib/esm/components/CaseManagement/RHAssociatesSelector.js +4 -2
- package/lib/esm/components/CaseManagement/SendNotifications/CaseContactSelector.d.ts.map +1 -1
- package/lib/esm/components/CaseManagement/SendNotifications/CaseContactSelector.js +4 -2
- package/lib/esm/components/EditDescription/EditDescription.d.ts.map +1 -1
- package/lib/esm/components/EditDescription/EditDescription.js +3 -1
- package/lib/esm/components/IdeaInformation/IdeaInformation.d.ts.map +1 -1
- package/lib/esm/components/IdeaInformation/IdeaInformation.js +11 -3
- package/lib/esm/components/UpdateSeverityModal/UpdateSeverityModal.d.ts.map +1 -1
- package/lib/esm/components/UpdateSeverityModal/UpdateSeverityModal.js +52 -46
- package/lib/esm/components/shared/fileUpload/reducer/AttachmentHelper.d.ts +1 -0
- package/lib/esm/components/shared/fileUpload/reducer/AttachmentHelper.d.ts.map +1 -1
- package/lib/esm/components/shared/fileUpload/reducer/AttachmentHelper.js +126 -54
- package/lib/esm/components/shared/fileUpload/useFileUploader.d.ts.map +1 -1
- package/lib/esm/components/shared/fileUpload/useFileUploader.js +6 -3
- package/lib/esm/components/wizardLayout/MainSection.d.ts.map +1 -1
- package/lib/esm/components/wizardLayout/MainSection.js +2 -1
- package/lib/esm/css/case.css +154 -8
- package/lib/esm/graphql/queries/getEscalationDetails.d.ts.map +1 -1
- package/lib/esm/graphql/queries/getEscalationDetails.js +5 -0
- package/lib/esm/hooks/useCaseComments/caseCommentsQuery.d.ts.map +1 -1
- package/lib/esm/hooks/useCaseComments/caseCommentsQuery.js +6 -1
- package/lib/esm/hooks/useCaseComments/index.d.ts +2 -1
- package/lib/esm/hooks/useCaseComments/index.d.ts.map +1 -1
- package/lib/esm/hooks/useCaseComments/types.d.ts +8 -0
- package/lib/esm/hooks/useCaseComments/types.d.ts.map +1 -1
- package/lib/esm/hooks/useCaseComments/useCaseComments.d.ts +12 -3
- package/lib/esm/hooks/useCaseComments/useCaseComments.d.ts.map +1 -1
- package/lib/esm/hooks/useCaseComments/useCaseComments.js +84 -9
- package/lib/esm/hooks/useCaseHistory.d.ts +2 -2
- package/lib/esm/hooks/useCaseHistory.d.ts.map +1 -1
- package/lib/esm/hooks/useCaseHistory.js +16 -7
- package/lib/esm/hooks/useCaseLabelLinkMutations.d.ts +2 -0
- package/lib/esm/hooks/useCaseLabelLinkMutations.d.ts.map +1 -1
- package/lib/esm/hooks/useCaseLabelLinkMutations.js +21 -28
- package/lib/esm/hooks/useCaseUpdateErrorMessage.d.ts +9 -1
- package/lib/esm/hooks/useCaseUpdateErrorMessage.d.ts.map +1 -1
- package/lib/esm/hooks/useCaseUpdateErrorMessage.js +103 -16
- package/lib/esm/models/caseHistory.d.ts +6 -0
- package/lib/esm/models/caseHistory.d.ts.map +1 -1
- package/lib/esm/reducers/CaseDiscussionTabReducer.d.ts +2 -1
- package/lib/esm/reducers/CaseDiscussionTabReducer.d.ts.map +1 -1
- package/lib/esm/reducers/CaseDiscussionTabReducer.js +26 -4
- package/lib/esm/reducers/CaseHelpers.d.ts.map +1 -1
- package/lib/esm/reducers/CaseHelpers.js +5 -3
- package/lib/esm/reducers/CaseReducer.d.ts.map +1 -1
- package/lib/esm/reducers/CaseReducer.js +6 -2
- package/lib/esm/utils/caseHistoryUtils.d.ts +19 -0
- package/lib/esm/utils/caseHistoryUtils.d.ts.map +1 -1
- package/lib/esm/utils/caseHistoryUtils.js +31 -0
- package/lib/esm/utils/linkifyHtmlTextNodes.d.ts +8 -0
- package/lib/esm/utils/linkifyHtmlTextNodes.d.ts.map +1 -0
- package/lib/esm/utils/linkifyHtmlTextNodes.js +37 -0
- package/package.json +7 -6
package/lib/esm/css/case.css
CHANGED
|
@@ -123,13 +123,40 @@ button,
|
|
|
123
123
|
word-break: break-word;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
.support-comment .comment-body ul
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
.support-comment .comment-body ul,
|
|
127
|
+
.support-comment .comment-body ol,
|
|
128
|
+
.support-comment .comment-richtext ul,
|
|
129
|
+
.support-comment .comment-richtext ol {
|
|
130
|
+
margin: 0;
|
|
131
|
+
margin-bottom: 1rem;
|
|
132
|
+
padding: 0;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.support-comment .comment-body ul,
|
|
136
|
+
.support-comment .comment-richtext ul {
|
|
137
|
+
margin-left: 1.5rem;
|
|
138
|
+
list-style: disc outside;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.support-comment .comment-body ul ul,
|
|
142
|
+
.support-comment .comment-richtext ul ul {
|
|
143
|
+
list-style: circle outside;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.support-comment .comment-body ul ul ul,
|
|
147
|
+
.support-comment .comment-richtext ul ul ul {
|
|
148
|
+
list-style: square outside;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.support-comment .comment-body ol,
|
|
152
|
+
.support-comment .comment-richtext ol {
|
|
153
|
+
margin-left: 1.5rem;
|
|
154
|
+
list-style: decimal outside;
|
|
129
155
|
}
|
|
130
156
|
|
|
131
|
-
.support-comment .comment-body ol
|
|
132
|
-
|
|
157
|
+
.support-comment .comment-body ol ol,
|
|
158
|
+
.support-comment .comment-richtext ol ol {
|
|
159
|
+
list-style: lower-alpha outside;
|
|
133
160
|
}
|
|
134
161
|
|
|
135
162
|
#case-description ul {
|
|
@@ -355,14 +382,46 @@ input[aria-invalid='true'].pf-v6-c-form-control {
|
|
|
355
382
|
}
|
|
356
383
|
|
|
357
384
|
.comment-body ul,
|
|
385
|
+
.comment-body ol,
|
|
386
|
+
.comment-richtext ul,
|
|
387
|
+
.comment-richtext ol,
|
|
388
|
+
.markdown-preview ul,
|
|
389
|
+
.markdown-preview ol {
|
|
390
|
+
margin: 0;
|
|
391
|
+
margin-bottom: 1rem;
|
|
392
|
+
padding: 0;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
.comment-body ul,
|
|
396
|
+
.comment-richtext ul,
|
|
358
397
|
.markdown-preview ul {
|
|
359
|
-
|
|
360
|
-
|
|
398
|
+
margin-left: 1.5rem;
|
|
399
|
+
list-style: disc outside;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
.comment-body ul ul,
|
|
403
|
+
.comment-richtext ul ul,
|
|
404
|
+
.markdown-preview ul ul {
|
|
405
|
+
list-style: circle outside;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
.comment-body ul ul ul,
|
|
409
|
+
.comment-richtext ul ul ul,
|
|
410
|
+
.markdown-preview ul ul ul {
|
|
411
|
+
list-style: square outside;
|
|
361
412
|
}
|
|
362
413
|
|
|
363
414
|
.comment-body ol,
|
|
415
|
+
.comment-richtext ol,
|
|
364
416
|
.markdown-preview ol {
|
|
365
|
-
|
|
417
|
+
margin-left: 1.5rem;
|
|
418
|
+
list-style: decimal outside;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
.comment-body ol ol,
|
|
422
|
+
.comment-richtext ol ol,
|
|
423
|
+
.markdown-preview ol ol {
|
|
424
|
+
list-style: lower-alpha outside;
|
|
366
425
|
}
|
|
367
426
|
|
|
368
427
|
.comment-body .ql-align-center {
|
|
@@ -397,6 +456,19 @@ input[aria-invalid='true'].pf-v6-c-form-control {
|
|
|
397
456
|
padding-left: 15em;
|
|
398
457
|
}
|
|
399
458
|
|
|
459
|
+
.comment-body p,
|
|
460
|
+
.comment-richtext p {
|
|
461
|
+
margin-bottom: 1rem;
|
|
462
|
+
margin-top: 0;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
.comment-body ul ul,
|
|
466
|
+
.comment-body ol ol,
|
|
467
|
+
.comment-body ul ol,
|
|
468
|
+
.comment-body ol ul {
|
|
469
|
+
margin-left: 1.5rem;
|
|
470
|
+
}
|
|
471
|
+
|
|
400
472
|
.tab-title-with-badge {
|
|
401
473
|
display: flex;
|
|
402
474
|
align-items: center;
|
|
@@ -449,3 +521,77 @@ input[aria-invalid='true'].pf-v6-c-form-control {
|
|
|
449
521
|
.remove-watcher-button {
|
|
450
522
|
max-width: 15rem;
|
|
451
523
|
}
|
|
524
|
+
|
|
525
|
+
.load-more-skeleton {
|
|
526
|
+
display: block;
|
|
527
|
+
margin-bottom: 1rem;
|
|
528
|
+
padding: 1.4rem 1.3rem 0.8rem 1.5rem;
|
|
529
|
+
background-color: #fff;
|
|
530
|
+
border: 1px solid #d2d2d2;
|
|
531
|
+
border-left: 4px solid #6a6e73;
|
|
532
|
+
overflow: hidden;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
.load-more-skeleton__header {
|
|
536
|
+
display: flex;
|
|
537
|
+
align-items: center;
|
|
538
|
+
margin-bottom: 16px;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
.load-more-skeleton__avatar {
|
|
542
|
+
width: 32px;
|
|
543
|
+
height: 32px;
|
|
544
|
+
border-radius: 50%;
|
|
545
|
+
background-color: #e0e0e0;
|
|
546
|
+
flex-shrink: 0;
|
|
547
|
+
animation: skeleton-pulse 1.5s ease-in-out infinite;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
.load-more-skeleton__name {
|
|
551
|
+
width: 120px;
|
|
552
|
+
height: 14px;
|
|
553
|
+
border-radius: 4px;
|
|
554
|
+
background-color: #e0e0e0;
|
|
555
|
+
margin-left: 12px;
|
|
556
|
+
animation: skeleton-pulse 1.5s ease-in-out infinite;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
.load-more-skeleton__timestamp {
|
|
560
|
+
width: 140px;
|
|
561
|
+
height: 12px;
|
|
562
|
+
border-radius: 4px;
|
|
563
|
+
background-color: #e0e0e0;
|
|
564
|
+
margin-left: auto;
|
|
565
|
+
animation: skeleton-pulse 1.5s ease-in-out infinite;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
.load-more-skeleton__body {
|
|
569
|
+
padding-left: 44px;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
.load-more-skeleton__line {
|
|
573
|
+
height: 14px;
|
|
574
|
+
border-radius: 4px;
|
|
575
|
+
background-color: #e0e0e0;
|
|
576
|
+
animation: skeleton-pulse 1.5s ease-in-out infinite;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
.load-more-skeleton__line + .load-more-skeleton__line {
|
|
580
|
+
margin-top: 10px;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
@keyframes skeleton-pulse {
|
|
584
|
+
0%,
|
|
585
|
+
100% {
|
|
586
|
+
opacity: 0.6;
|
|
587
|
+
}
|
|
588
|
+
50% {
|
|
589
|
+
opacity: 1;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
.infinite-scroll-end-status {
|
|
594
|
+
text-align: center;
|
|
595
|
+
margin-top: 16px;
|
|
596
|
+
color: var(--pf-t--global--color--status--danger--default, #c9190b);
|
|
597
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getEscalationDetails.d.ts","sourceRoot":"","sources":["../../../../src/graphql/queries/getEscalationDetails.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"getEscalationDetails.d.ts","sourceRoot":"","sources":["../../../../src/graphql/queries/getEscalationDetails.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,sBAAsB,uCAkClC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"caseCommentsQuery.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useCaseComments/caseCommentsQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAEhF,eAAO,MAAM,iBAAiB,EAAE,iBAAiB,CAAC,6BAA6B,EAAE,sBAAsB,
|
|
1
|
+
{"version":3,"file":"caseCommentsQuery.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useCaseComments/caseCommentsQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAEhF,eAAO,MAAM,iBAAiB,EAAE,iBAAiB,CAAC,6BAA6B,EAAE,sBAAsB,CAuDtG,CAAC"}
|
|
@@ -4,10 +4,11 @@ export const GET_CASE_COMMENTS = gql `
|
|
|
4
4
|
$filter: RedHatSupportCaseComment__c_Filter!
|
|
5
5
|
$orderBy: RedHatSupportCaseComment__c_OrderBy
|
|
6
6
|
$first: Int
|
|
7
|
+
$after: String
|
|
7
8
|
) {
|
|
8
9
|
redhat_support_uiapi {
|
|
9
10
|
query {
|
|
10
|
-
RedHatSupportCaseComment__c(where: $filter, orderBy: $orderBy, first: $first) {
|
|
11
|
+
RedHatSupportCaseComment__c(where: $filter, orderBy: $orderBy, first: $first, after: $after) {
|
|
11
12
|
edges {
|
|
12
13
|
node {
|
|
13
14
|
Id
|
|
@@ -45,6 +46,10 @@ export const GET_CASE_COMMENTS = gql `
|
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
}
|
|
49
|
+
pageInfo {
|
|
50
|
+
hasNextPage
|
|
51
|
+
endCursor
|
|
52
|
+
}
|
|
48
53
|
}
|
|
49
54
|
}
|
|
50
55
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { CREATE_CASE_COMMENT } from '@rh-support/utils';
|
|
2
2
|
export { GET_CASE_COMMENTS } from './caseCommentsQuery';
|
|
3
3
|
export { deriveCreatedByType, deriveIsPublic, mapCaseCommentNode, mapCaseCommentsResponse, mapVisibility, } from './mapCaseComment';
|
|
4
|
-
export type { ICaseCommentEdge, ICaseCommentNode, ICaseCommentsConnection, ICreateCaseCommentResponse, ICreateCaseCommentVariables, IGetCaseCommentsQueryResponse, IUseCaseCommentsOptions, } from './types';
|
|
4
|
+
export type { ICaseCommentEdge, ICaseCommentNode, ICaseCommentsConnection, ICreateCaseCommentResponse, ICreateCaseCommentVariables, IGetCaseCommentsQueryResponse, IPageInfo, IUseCaseCommentsOptions, } from './types';
|
|
5
|
+
export type { IUseCaseCommentsReturn } from './useCaseComments';
|
|
5
6
|
export { useCaseComments } from './useCaseComments';
|
|
6
7
|
export { useCreateCaseComment } from './useCreateCaseComment';
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useCaseComments/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EACH,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,uBAAuB,EACvB,aAAa,GAChB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACR,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,0BAA0B,EAC1B,2BAA2B,EAC3B,6BAA6B,EAC7B,uBAAuB,GAC1B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useCaseComments/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EACH,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,uBAAuB,EACvB,aAAa,GAChB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACR,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,0BAA0B,EAC1B,2BAA2B,EAC3B,6BAA6B,EAC7B,SAAS,EACT,uBAAuB,GAC1B,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -29,8 +29,13 @@ export interface ICaseCommentNode {
|
|
|
29
29
|
export interface ICaseCommentEdge {
|
|
30
30
|
node: ICaseCommentNode;
|
|
31
31
|
}
|
|
32
|
+
export interface IPageInfo {
|
|
33
|
+
hasNextPage: boolean;
|
|
34
|
+
endCursor: string | null;
|
|
35
|
+
}
|
|
32
36
|
export interface ICaseCommentsConnection {
|
|
33
37
|
edges: ICaseCommentEdge[];
|
|
38
|
+
pageInfo?: IPageInfo;
|
|
34
39
|
}
|
|
35
40
|
export interface IGetCaseCommentsQueryResponse {
|
|
36
41
|
redhat_support_uiapi: {
|
|
@@ -53,6 +58,7 @@ export interface ICaseCommentsVariables {
|
|
|
53
58
|
order: 'ASC' | 'DESC';
|
|
54
59
|
}>;
|
|
55
60
|
first?: number;
|
|
61
|
+
after?: string;
|
|
56
62
|
}
|
|
57
63
|
export interface IUseCaseCommentsOptions {
|
|
58
64
|
caseId: string;
|
|
@@ -63,6 +69,8 @@ export interface IUseCaseCommentsOptions {
|
|
|
63
69
|
first?: number;
|
|
64
70
|
/** When true, only Public comments are fetched (external / customer users). */
|
|
65
71
|
publicOnly?: boolean;
|
|
72
|
+
/** Cursor for pagination — pass to resume from a previous page. */
|
|
73
|
+
after?: string;
|
|
66
74
|
}
|
|
67
75
|
export interface ICreateCaseCommentInput {
|
|
68
76
|
Case__c: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useCaseComments/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACnC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,uBAAuB;IACpC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CACzB;AAED,MAAM,WAAW,wBAAwB;IACrC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,MAAM,WAAW,qBAAqB;IAClC,IAAI,EAAE,sBAAsB,CAAC;CAChC;AAED,MAAM,WAAW,0BAA0B;IACvC,IAAI,EAAE,sBAAsB,CAAC;CAChC;AAED,MAAM,WAAW,gBAAgB;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,sBAAsB,CAAC;IAC7B,OAAO,EAAE,sBAAsB,CAAC;IAChC,SAAS,EAAE,qBAAqB,CAAC;IACjC,aAAa,EAAE,uBAAuB,CAAC;IACvC,cAAc,EAAE,uBAAuB,CAAC;IACxC,gBAAgB,EAAE,sBAAsB,CAAC;IACzC,aAAa,EAAE,wBAAwB,CAAC;IACxC,cAAc,EAAE,0BAA0B,CAAC;IAC3C,WAAW,EAAE,sBAAsB,CAAC;CACvC;AAED,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,gBAAgB,CAAC;CAC1B;AAED,MAAM,WAAW,uBAAuB;IACpC,KAAK,EAAE,gBAAgB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useCaseComments/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACnC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,uBAAuB;IACpC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CACzB;AAED,MAAM,WAAW,wBAAwB;IACrC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,MAAM,WAAW,qBAAqB;IAClC,IAAI,EAAE,sBAAsB,CAAC;CAChC;AAED,MAAM,WAAW,0BAA0B;IACvC,IAAI,EAAE,sBAAsB,CAAC;CAChC;AAED,MAAM,WAAW,gBAAgB;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,sBAAsB,CAAC;IAC7B,OAAO,EAAE,sBAAsB,CAAC;IAChC,SAAS,EAAE,qBAAqB,CAAC;IACjC,aAAa,EAAE,uBAAuB,CAAC;IACvC,cAAc,EAAE,uBAAuB,CAAC;IACxC,gBAAgB,EAAE,sBAAsB,CAAC;IACzC,aAAa,EAAE,wBAAwB,CAAC;IACxC,cAAc,EAAE,0BAA0B,CAAC;IAC3C,WAAW,EAAE,sBAAsB,CAAC;CACvC;AAED,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,gBAAgB,CAAC;CAC1B;AAED,MAAM,WAAW,SAAS;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,uBAAuB;IACpC,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,QAAQ,CAAC,EAAE,SAAS,CAAC;CACxB;AAED,MAAM,WAAW,6BAA6B;IAC1C,oBAAoB,EAAE;QAClB,KAAK,EAAE;YACH,2BAA2B,EAAE,uBAAuB,CAAC;SACxD,CAAC;KACL,CAAC;CACL;AAED,MAAM,WAAW,mBAAmB;IAChC,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IACxB,aAAa,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;CAClC;AAED,MAAM,WAAW,sBAAsB;IACnC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,KAAK,GAAG,MAAM,CAAA;KAAE,CAAC,CAAC;IACpD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,uBAAuB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,KAAK,GAAG,MAAM,CAAA;KAAE,CAAC,CAAC;IACpD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+EAA+E;IAC/E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,uBAAuB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,2BAA2B;IACxC,YAAY,EAAE,uBAAuB,CAAC;CACzC;AAED,MAAM,WAAW,0BAA0B;IACvC,oBAAoB,EAAE;QAClB,oBAAoB,EAAE;YAClB,mBAAmB,EAAE;gBACjB,EAAE,EAAE,MAAM,CAAC;aACd,CAAC;SACL,CAAC;KACL,CAAC;CACL"}
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
import { ICaseComment } from '@cee-eng/hydrajs/@types/api/public/case';
|
|
2
2
|
import { IUseCaseCommentsOptions } from './types';
|
|
3
|
-
interface IUseCaseCommentsReturn {
|
|
3
|
+
export interface IUseCaseCommentsReturn {
|
|
4
4
|
comments: ICaseComment[];
|
|
5
5
|
loading: boolean;
|
|
6
6
|
error: Error | undefined;
|
|
7
7
|
refetch: () => Promise<unknown>;
|
|
8
|
+
fetchMore: () => Promise<unknown>;
|
|
9
|
+
hasNextPage: boolean;
|
|
10
|
+
isLoadingMore: boolean;
|
|
11
|
+
loadMoreError: boolean;
|
|
12
|
+
loadMoreRetryCount: number;
|
|
13
|
+
retryLoadMore: () => Promise<unknown>;
|
|
8
14
|
}
|
|
9
15
|
/**
|
|
10
16
|
* Fetches case comments from the Salesforce GraphQL API for a given case ID.
|
|
11
17
|
* Supports custom sort ordering and pagination clamping (1–2000 records).
|
|
12
18
|
* External / customer users (no VIEW_PRIVATE_COMMENT) only receive Public comments.
|
|
13
19
|
* Returns mapped ICaseComment[] along with loading, error, and refetch handles.
|
|
20
|
+
*
|
|
21
|
+
* Pagination uses Apollo's fetchMore; pages accumulate in the cache via
|
|
22
|
+
* relayStylePagination. nextFetchPolicy returns 'cache-first' after the first
|
|
23
|
+
* result so cache-and-network does not refetch and overwrite merged pages.
|
|
14
24
|
*/
|
|
15
|
-
export declare function useCaseComments({ caseId, skip, orderBy, first, publicOnly, }: IUseCaseCommentsOptions): IUseCaseCommentsReturn;
|
|
16
|
-
export {};
|
|
25
|
+
export declare function useCaseComments({ caseId, skip, orderBy, first, publicOnly, after, }: IUseCaseCommentsOptions): IUseCaseCommentsReturn;
|
|
17
26
|
//# sourceMappingURL=useCaseComments.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCaseComments.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useCaseComments/useCaseComments.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useCaseComments.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useCaseComments/useCaseComments.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAOvE,OAAO,EAAuB,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAEvE,MAAM,WAAW,sBAAsB;IACnC,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IACzB,OAAO,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAChC,SAAS,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAClC,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,aAAa,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CACzC;AAgBD;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,EAC5B,MAAM,EACN,IAAI,EACJ,OAAO,EACP,KAAK,EACL,UAAU,EACV,KAAK,GACR,EAAE,uBAAuB,GAAG,sBAAsB,CA4GlD"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import { NetworkStatus } from '@apollo/client/core';
|
|
1
2
|
import { useQuery } from '@apollo/client/react';
|
|
2
3
|
import { ability, CaseDiscussionFields, resourceActions, resources } from '@rh-support/user-permissions';
|
|
3
4
|
import clamp from 'lodash/clamp';
|
|
4
|
-
import { useMemo } from 'react';
|
|
5
|
+
import { useCallback, useMemo, useRef, useState } from 'react';
|
|
5
6
|
import { GET_CASE_COMMENTS } from './caseCommentsQuery';
|
|
6
7
|
import { mapCaseCommentsResponse } from './mapCaseComment';
|
|
7
8
|
const MAX_FIRST = 2000;
|
|
8
9
|
const MIN_FIRST = 1;
|
|
10
|
+
const DEFAULT_PAGE_SIZE = 20;
|
|
9
11
|
function buildCaseCommentsFilter(caseId, publicOnly) {
|
|
10
12
|
if (publicOnly) {
|
|
11
13
|
return {
|
|
@@ -20,19 +22,92 @@ function buildCaseCommentsFilter(caseId, publicOnly) {
|
|
|
20
22
|
* Supports custom sort ordering and pagination clamping (1–2000 records).
|
|
21
23
|
* External / customer users (no VIEW_PRIVATE_COMMENT) only receive Public comments.
|
|
22
24
|
* Returns mapped ICaseComment[] along with loading, error, and refetch handles.
|
|
25
|
+
*
|
|
26
|
+
* Pagination uses Apollo's fetchMore; pages accumulate in the cache via
|
|
27
|
+
* relayStylePagination. nextFetchPolicy returns 'cache-first' after the first
|
|
28
|
+
* result so cache-and-network does not refetch and overwrite merged pages.
|
|
23
29
|
*/
|
|
24
|
-
export function useCaseComments({ caseId, skip, orderBy, first, publicOnly, }) {
|
|
30
|
+
export function useCaseComments({ caseId, skip, orderBy, first, publicOnly, after, }) {
|
|
31
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
25
32
|
const canSeePrivateComments = ability.can(resourceActions.PATCH, resources.CASE_COMMENTS, CaseDiscussionFields.VIEW_PRIVATE_COMMENT);
|
|
26
33
|
const shouldFilterPublicOnly = publicOnly !== null && publicOnly !== void 0 ? publicOnly : !canSeePrivateComments;
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
orderBy: orderBy !== null && orderBy !== void 0 ? orderBy : { LastModifiedDate: { order: 'DESC' } },
|
|
31
|
-
first: clamp(first !== null && first !== void 0 ? first : MAX_FIRST, MIN_FIRST, MAX_FIRST),
|
|
32
|
-
},
|
|
34
|
+
const clampedFirst = clamp(first !== null && first !== void 0 ? first : DEFAULT_PAGE_SIZE, MIN_FIRST, MAX_FIRST);
|
|
35
|
+
const { data, loading, error, refetch, fetchMore: apolloFetchMore, networkStatus, } = useQuery(GET_CASE_COMMENTS, {
|
|
36
|
+
variables: Object.assign({ filter: buildCaseCommentsFilter(caseId, shouldFilterPublicOnly), orderBy: orderBy !== null && orderBy !== void 0 ? orderBy : { LastModifiedDate: { order: 'DESC' } }, first: clampedFirst }, (after ? { after } : {})),
|
|
33
37
|
skip: skip || !caseId,
|
|
34
38
|
fetchPolicy: 'cache-and-network',
|
|
39
|
+
nextFetchPolicy(_currentFetchPolicy, { reason }) {
|
|
40
|
+
if (reason === 'variables-changed') {
|
|
41
|
+
return 'cache-and-network';
|
|
42
|
+
}
|
|
43
|
+
return 'cache-first';
|
|
44
|
+
},
|
|
45
|
+
notifyOnNetworkStatusChange: true,
|
|
35
46
|
});
|
|
47
|
+
const [loadMoreError, setLoadMoreError] = useState(false);
|
|
48
|
+
const [loadMoreRetryCount, setLoadMoreRetryCount] = useState(0);
|
|
49
|
+
const fetchLockRef = useRef(false);
|
|
50
|
+
const pageInfo = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.redhat_support_uiapi) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.RedHatSupportCaseComment__c) === null || _c === void 0 ? void 0 : _c.pageInfo;
|
|
51
|
+
const hasNextPage = (_d = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.hasNextPage) !== null && _d !== void 0 ? _d : false;
|
|
52
|
+
const endCursor = (_e = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.endCursor) !== null && _e !== void 0 ? _e : null;
|
|
53
|
+
const isLoadingMore = networkStatus === NetworkStatus.fetchMore;
|
|
36
54
|
const comments = useMemo(() => mapCaseCommentsResponse(data), [data]);
|
|
37
|
-
|
|
55
|
+
// DEBUG: track every render of the hook
|
|
56
|
+
const edgeCount = (_k = (_j = (_h = (_g = (_f = data === null || data === void 0 ? void 0 : data.redhat_support_uiapi) === null || _f === void 0 ? void 0 : _f.query) === null || _g === void 0 ? void 0 : _g.RedHatSupportCaseComment__c) === null || _h === void 0 ? void 0 : _h.edges) === null || _j === void 0 ? void 0 : _j.length) !== null && _k !== void 0 ? _k : 0;
|
|
57
|
+
console.log('[useCaseComments] render', {
|
|
58
|
+
networkStatus,
|
|
59
|
+
loading,
|
|
60
|
+
isLoadingMore,
|
|
61
|
+
hasNextPage,
|
|
62
|
+
endCursor: endCursor === null || endCursor === void 0 ? void 0 : endCursor.slice(0, 20),
|
|
63
|
+
edgeCount,
|
|
64
|
+
commentsMapped: comments.length,
|
|
65
|
+
fetchLocked: fetchLockRef.current,
|
|
66
|
+
});
|
|
67
|
+
const fetchMore = useCallback(() => {
|
|
68
|
+
if (fetchLockRef.current || !hasNextPage || !endCursor) {
|
|
69
|
+
console.log('[useCaseComments] fetchMore SKIPPED', {
|
|
70
|
+
fetchLocked: fetchLockRef.current,
|
|
71
|
+
hasNextPage,
|
|
72
|
+
endCursor: !!endCursor,
|
|
73
|
+
});
|
|
74
|
+
return Promise.resolve();
|
|
75
|
+
}
|
|
76
|
+
fetchLockRef.current = true;
|
|
77
|
+
setLoadMoreError(false);
|
|
78
|
+
console.log('[useCaseComments] fetchMore START', { endCursor: endCursor === null || endCursor === void 0 ? void 0 : endCursor.slice(0, 20) });
|
|
79
|
+
return apolloFetchMore({
|
|
80
|
+
variables: { after: endCursor },
|
|
81
|
+
})
|
|
82
|
+
.then(() => {
|
|
83
|
+
console.log('[useCaseComments] fetchMore SUCCESS');
|
|
84
|
+
setLoadMoreRetryCount(0);
|
|
85
|
+
setLoadMoreError(false);
|
|
86
|
+
})
|
|
87
|
+
.catch((err) => {
|
|
88
|
+
console.log('[useCaseComments] fetchMore ERROR', err === null || err === void 0 ? void 0 : err.message);
|
|
89
|
+
setLoadMoreError(true);
|
|
90
|
+
setLoadMoreRetryCount((prev) => prev + 1);
|
|
91
|
+
})
|
|
92
|
+
.finally(() => {
|
|
93
|
+
fetchLockRef.current = false;
|
|
94
|
+
});
|
|
95
|
+
}, [hasNextPage, endCursor, apolloFetchMore]);
|
|
96
|
+
const retryLoadMore = useCallback(() => {
|
|
97
|
+
setLoadMoreError(false);
|
|
98
|
+
fetchLockRef.current = false;
|
|
99
|
+
return fetchMore();
|
|
100
|
+
}, [fetchMore]);
|
|
101
|
+
return {
|
|
102
|
+
comments,
|
|
103
|
+
loading,
|
|
104
|
+
error,
|
|
105
|
+
refetch,
|
|
106
|
+
fetchMore,
|
|
107
|
+
hasNextPage,
|
|
108
|
+
isLoadingMore,
|
|
109
|
+
loadMoreError,
|
|
110
|
+
loadMoreRetryCount,
|
|
111
|
+
retryLoadMore,
|
|
112
|
+
};
|
|
38
113
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type TypedDocumentNode } from '@apollo/client';
|
|
2
|
-
import type { ICaseHistoryItem, IGetCaseHistoryData, IGetCaseHistoryVars } from '../models/caseHistory';
|
|
2
|
+
import type { CaseHistorySortOrder, ICaseHistoryItem, IGetCaseHistoryData, IGetCaseHistoryVars } from '../models/caseHistory';
|
|
3
3
|
/**
|
|
4
4
|
* OldValue/NewValue use inline fragments with aliased fields (e.g. `stringValue: value`).
|
|
5
5
|
* These aliases produce the property names that `extractStringValue` checks against.
|
|
@@ -21,6 +21,6 @@ interface UseCaseHistoryResult {
|
|
|
21
21
|
loading: boolean;
|
|
22
22
|
error: Error | undefined;
|
|
23
23
|
}
|
|
24
|
-
export declare function useCaseHistory(caseId: string | undefined, first?: number): UseCaseHistoryResult;
|
|
24
|
+
export declare function useCaseHistory(caseId: string | undefined, isViewerInternal?: boolean, sortOrder?: CaseHistorySortOrder, first?: number): UseCaseHistoryResult;
|
|
25
25
|
export {};
|
|
26
26
|
//# sourceMappingURL=useCaseHistory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCaseHistory.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCaseHistory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAO,MAAM,gBAAgB,CAAC;AAI7D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"useCaseHistory.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCaseHistory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAO,MAAM,gBAAgB,CAAC;AAI7D,OAAO,KAAK,EACR,oBAAoB,EAEpB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,uBAAuB,CAAC;AAG/B;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,EAAE,iBAAiB,CAAC,mBAAmB,EAAE,mBAAmB,CAiExF,CAAC;AAEF,UAAU,oBAAoB;IAC1B,YAAY,EAAE,gBAAgB,EAAE,CAAC;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;CAC5B;AAED,wBAAgB,cAAc,CAC1B,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,gBAAgB,UAAO,EACvB,SAAS,GAAE,oBAA6B,EACxC,KAAK,SAAO,GACb,oBAAoB,CAqBtB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { gql } from '@apollo/client';
|
|
2
2
|
import { useQuery } from '@apollo/client/react';
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
|
-
import { filterSfdcIdEntries, normalizeNodeToHistoryItem } from '../utils/caseHistoryUtils';
|
|
4
|
+
import { filterInternalOnlyEntries, filterSfdcIdEntries, normalizeNodeToHistoryItem } from '../utils/caseHistoryUtils';
|
|
5
5
|
/**
|
|
6
6
|
* OldValue/NewValue use inline fragments with aliased fields (e.g. `stringValue: value`).
|
|
7
7
|
* These aliases produce the property names that `extractStringValue` checks against.
|
|
@@ -18,10 +18,14 @@ import { filterSfdcIdEntries, normalizeNodeToHistoryItem } from '../utils/caseHi
|
|
|
18
18
|
* histories while staying well within the SF API limit.
|
|
19
19
|
*/
|
|
20
20
|
export const GET_CASE_HISTORY = gql `
|
|
21
|
-
query GetCaseHistory(
|
|
21
|
+
query GetCaseHistory(
|
|
22
|
+
$caseId: ID!
|
|
23
|
+
$first: Int = 2000
|
|
24
|
+
$orderBy: RedHatSupportCaseHistory_OrderBy = { CreatedDate: { order: DESC } }
|
|
25
|
+
) {
|
|
22
26
|
redhat_support_uiapi {
|
|
23
27
|
query {
|
|
24
|
-
RedHatSupportCaseHistory(first: $first, where: { CaseId: { eq: $caseId } }) {
|
|
28
|
+
RedHatSupportCaseHistory(first: $first, where: { CaseId: { eq: $caseId } }, orderBy: $orderBy) {
|
|
25
29
|
edges {
|
|
26
30
|
node {
|
|
27
31
|
Id
|
|
@@ -79,9 +83,13 @@ export const GET_CASE_HISTORY = gql `
|
|
|
79
83
|
}
|
|
80
84
|
}
|
|
81
85
|
`;
|
|
82
|
-
export function useCaseHistory(caseId, first = 2000) {
|
|
86
|
+
export function useCaseHistory(caseId, isViewerInternal = true, sortOrder = 'DESC', first = 2000) {
|
|
83
87
|
const { data, loading, error } = useQuery(GET_CASE_HISTORY, {
|
|
84
|
-
variables: {
|
|
88
|
+
variables: {
|
|
89
|
+
caseId: caseId || '',
|
|
90
|
+
first,
|
|
91
|
+
orderBy: { CreatedDate: { order: sortOrder } },
|
|
92
|
+
},
|
|
85
93
|
// Empty string = no case selected; skip avoids a wasted network request.
|
|
86
94
|
skip: !caseId,
|
|
87
95
|
// Shows cached data immediately while revalidating, avoiding a loading flash on re-visits.
|
|
@@ -92,7 +100,8 @@ export function useCaseHistory(caseId, first = 2000) {
|
|
|
92
100
|
const edges = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.redhat_support_uiapi) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.RedHatSupportCaseHistory) === null || _c === void 0 ? void 0 : _c.edges;
|
|
93
101
|
if (!edges)
|
|
94
102
|
return [];
|
|
95
|
-
|
|
96
|
-
|
|
103
|
+
const normalized = filterSfdcIdEntries(edges).map(normalizeNodeToHistoryItem);
|
|
104
|
+
return isViewerInternal ? normalized : filterInternalOnlyEntries(normalized);
|
|
105
|
+
}, [data, isViewerInternal]);
|
|
97
106
|
return { historyItems, loading, error };
|
|
98
107
|
}
|
|
@@ -11,10 +11,12 @@ interface UseCaseLabelLinksResult {
|
|
|
11
11
|
assignedLinks: LabelLink[];
|
|
12
12
|
selectedLabelIds: string[];
|
|
13
13
|
loading: boolean;
|
|
14
|
+
error: Error | undefined;
|
|
14
15
|
mutating: boolean;
|
|
15
16
|
setAssignedLinks: React.Dispatch<React.SetStateAction<LabelLink[]>>;
|
|
16
17
|
createLink: (caseId: string, labelId: string) => Promise<string | undefined>;
|
|
17
18
|
deleteLink: (linkId: string) => Promise<void>;
|
|
19
|
+
refetch: () => Promise<void>;
|
|
18
20
|
}
|
|
19
21
|
export declare function useCaseLabelLinks(salesforceAccountId?: string, caseId?: string): UseCaseLabelLinksResult;
|
|
20
22
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCaseLabelLinkMutations.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCaseLabelLinkMutations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useCaseLabelLinkMutations.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCaseLabelLinkMutations.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,WAAW;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,SAAS;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACnB;AAOD,UAAU,uBAAuB;IAC7B,eAAe,EAAE,WAAW,EAAE,CAAC;IAC/B,aAAa,EAAE,SAAS,EAAE,CAAC;IAC3B,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,gBAAgB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;IACpE,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC7E,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAChC;AAED,wBAAgB,iBAAiB,CAAC,mBAAmB,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,uBAAuB,CAoFxG"}
|
|
@@ -8,51 +8,42 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { useApolloClient, useMutation } from '@apollo/client/react';
|
|
11
|
-
import { CREATE_CASE_LABEL_LINK, DELETE_CASE_LABEL_LINK,
|
|
11
|
+
import { CREATE_CASE_LABEL_LINK, DELETE_CASE_LABEL_LINK, fetchAllAccountCaseLabels, fetchAllCaseLabelLinksForCase, } from '@rh-support/utils';
|
|
12
12
|
import unescape from 'lodash/unescape';
|
|
13
13
|
import { useCallback, useEffect, useState } from 'react';
|
|
14
|
+
const mapCaseLabelNode = (node) => {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
return ({
|
|
17
|
+
id: node.Id,
|
|
18
|
+
name: unescape((_b = (_a = node.Name) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : ''),
|
|
19
|
+
});
|
|
20
|
+
};
|
|
14
21
|
export function useCaseLabelLinks(salesforceAccountId, caseId) {
|
|
15
22
|
const client = useApolloClient();
|
|
16
23
|
const [availableLabels, setAvailableLabels] = useState([]);
|
|
17
24
|
const [assignedLinks, setAssignedLinks] = useState([]);
|
|
18
25
|
const [loading, setLoading] = useState(false);
|
|
26
|
+
const [error, setError] = useState(undefined);
|
|
19
27
|
const fetchData = useCallback(() => __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
21
28
|
if (!salesforceAccountId || !caseId)
|
|
22
29
|
return;
|
|
23
30
|
setLoading(true);
|
|
31
|
+
setError(undefined);
|
|
24
32
|
try {
|
|
25
|
-
const [
|
|
26
|
-
client
|
|
27
|
-
|
|
28
|
-
variables: { where: { Account__c: { eq: salesforceAccountId } } },
|
|
29
|
-
fetchPolicy: 'network-only',
|
|
30
|
-
}),
|
|
31
|
-
client.query({
|
|
32
|
-
query: GET_CASE_LABEL_LINKS,
|
|
33
|
-
variables: { where: { Case__c: { eq: caseId } } },
|
|
34
|
-
fetchPolicy: 'network-only',
|
|
35
|
-
}),
|
|
33
|
+
const [labelNodes, linkNodes] = yield Promise.all([
|
|
34
|
+
fetchAllAccountCaseLabels(client, salesforceAccountId),
|
|
35
|
+
fetchAllCaseLabelLinksForCase(client, caseId),
|
|
36
36
|
]);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
.
|
|
40
|
-
|
|
41
|
-
return ({
|
|
42
|
-
id: node.Id,
|
|
43
|
-
name: unescape((_b = (_a = node.Name) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : ''),
|
|
44
|
-
});
|
|
45
|
-
})
|
|
46
|
-
.filter((l) => l.id && l.name));
|
|
47
|
-
const linkEdges = (_k = (_j = (_h = (_g = (_f = linksResult.data) === null || _f === void 0 ? void 0 : _f.redhat_support_uiapi) === null || _g === void 0 ? void 0 : _g.query) === null || _h === void 0 ? void 0 : _h.RedHatSupportCaseLabelLink__c) === null || _j === void 0 ? void 0 : _j.edges) !== null && _k !== void 0 ? _k : [];
|
|
48
|
-
setAssignedLinks(linkEdges
|
|
49
|
-
.filter(({ node }) => { var _a; return node.Id && ((_a = node.Label__c) === null || _a === void 0 ? void 0 : _a.value); })
|
|
50
|
-
.map(({ node }) => ({
|
|
37
|
+
setAvailableLabels(labelNodes.map(mapCaseLabelNode).filter((l) => l.id && l.name));
|
|
38
|
+
setAssignedLinks(linkNodes
|
|
39
|
+
.filter((node) => { var _a; return node.Id && ((_a = node.Label__c) === null || _a === void 0 ? void 0 : _a.value); })
|
|
40
|
+
.map((node) => ({
|
|
51
41
|
linkId: node.Id,
|
|
52
42
|
labelId: node.Label__c.value,
|
|
53
43
|
})));
|
|
54
44
|
}
|
|
55
|
-
catch (
|
|
45
|
+
catch (e) {
|
|
46
|
+
setError(e);
|
|
56
47
|
setAvailableLabels([]);
|
|
57
48
|
setAssignedLinks([]);
|
|
58
49
|
}
|
|
@@ -83,9 +74,11 @@ export function useCaseLabelLinks(salesforceAccountId, caseId) {
|
|
|
83
74
|
assignedLinks,
|
|
84
75
|
selectedLabelIds,
|
|
85
76
|
loading,
|
|
77
|
+
error,
|
|
86
78
|
mutating: createLoading || deleteLoading,
|
|
87
79
|
setAssignedLinks,
|
|
88
80
|
createLink,
|
|
89
81
|
deleteLink,
|
|
82
|
+
refetch: fetchData,
|
|
90
83
|
};
|
|
91
84
|
}
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
+
export type CaseUpdateErrorContent = {
|
|
2
|
+
title: string;
|
|
3
|
+
message: string;
|
|
4
|
+
onRetry?: () => unknown;
|
|
5
|
+
};
|
|
6
|
+
export declare function getErrorStatusCode(error: unknown): number;
|
|
7
|
+
export declare function isGenericNetworkError(error: unknown): boolean;
|
|
1
8
|
export declare function useCaseUpdateErrorMessage(): {
|
|
2
|
-
showError: (e:
|
|
9
|
+
showError: (e: unknown, fallbackOrContent: string | CaseUpdateErrorContent) => void;
|
|
10
|
+
showFieldError: (e: unknown, fieldName: string, onRetry?: () => unknown) => void;
|
|
3
11
|
};
|
|
4
12
|
//# sourceMappingURL=useCaseUpdateErrorMessage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCaseUpdateErrorMessage.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCaseUpdateErrorMessage.
|
|
1
|
+
{"version":3,"file":"useCaseUpdateErrorMessage.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCaseUpdateErrorMessage.tsx"],"names":[],"mappings":"AAQA,MAAM,MAAM,sBAAsB,GAAG;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC;CAC3B,CAAC;AA8BF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAsBzD;AAOD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAK7D;AAED,wBAAgB,yBAAyB;mBAgCf,OAAO,qBAAqB,MAAM,GAAG,sBAAsB;wBA2CtD,OAAO,aAAa,MAAM,YAAY,MAAM,OAAO;EAYjF"}
|