@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.
Files changed (132) hide show
  1. package/lib/esm/components/AccountInfo/OwnerSelector.js +5 -5
  2. package/lib/esm/components/CaseEditView/CaseDetailsErrorMessage.d.ts.map +1 -1
  3. package/lib/esm/components/CaseEditView/CaseDetailsErrorMessage.js +16 -6
  4. package/lib/esm/components/CaseEditView/CaseDetailsTabs.d.ts.map +1 -1
  5. package/lib/esm/components/CaseEditView/CaseDetailsTabs.js +11 -7
  6. package/lib/esm/components/CaseEditView/CaseOverview/CaseStatus.d.ts +2 -0
  7. package/lib/esm/components/CaseEditView/CaseOverview/CaseStatus.d.ts.map +1 -1
  8. package/lib/esm/components/CaseEditView/CaseOverview/CaseStatus.js +19 -8
  9. package/lib/esm/components/CaseEditView/CaseOverview/index.d.ts.map +1 -1
  10. package/lib/esm/components/CaseEditView/CaseOverview/index.js +23 -19
  11. package/lib/esm/components/CaseEditView/CaseSolutions/CaseSolutions.d.ts.map +1 -1
  12. package/lib/esm/components/CaseEditView/CaseSolutions/CaseSolutions.js +1 -1
  13. package/lib/esm/components/CaseEditView/ConfirmationModals/ReopenCaseModal.js +2 -2
  14. package/lib/esm/components/CaseEditView/RequestRemoteSession/NewEssTermsModal.d.ts.map +1 -1
  15. package/lib/esm/components/CaseEditView/RequestRemoteSession/NewEssTermsModal.js +7 -5
  16. package/lib/esm/components/CaseEditView/RequestRemoteSession/RemoteSessionAgreementModal.d.ts.map +1 -1
  17. package/lib/esm/components/CaseEditView/RequestRemoteSession/RemoteSessionAgreementModal.js +7 -5
  18. package/lib/esm/components/CaseEditView/RequestRemoteSession/remoteSessionUtils.d.ts +6 -0
  19. package/lib/esm/components/CaseEditView/RequestRemoteSession/remoteSessionUtils.d.ts.map +1 -1
  20. package/lib/esm/components/CaseEditView/RequestRemoteSession/remoteSessionUtils.js +8 -0
  21. package/lib/esm/components/CaseEditView/Tabs/CaseActionPlan/CaseActionPlan.d.ts.map +1 -1
  22. package/lib/esm/components/CaseEditView/Tabs/CaseActionPlan/CaseActionPlan.js +6 -3
  23. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseContactPhoneNumber.js +1 -1
  24. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseDetailsManagement.d.ts.map +1 -1
  25. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseDetailsManagement.js +41 -8
  26. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseHostname.js +1 -1
  27. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseInternalStatus.js +1 -1
  28. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseOpenshiftClusterId/CaseOpenshiftClusterId.d.ts.map +1 -1
  29. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseOpenshiftClusterId/CaseOpenshiftClusterId.js +11 -11
  30. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CasePhoneNumberConfirmAlert.js +1 -1
  31. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseReferenceNumber.js +1 -1
  32. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseSbrGroups.d.ts.map +1 -1
  33. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseSbrGroups.js +3 -1
  34. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/ProductVersion.d.ts.map +1 -1
  35. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/ProductVersion.js +1 -6
  36. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/Summary.js +1 -1
  37. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/useCustomEmails.d.ts.map +1 -1
  38. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/useCustomEmails.js +4 -2
  39. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseAttachment.d.ts.map +1 -1
  40. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseAttachment.js +5 -3
  41. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseComments.d.ts.map +1 -1
  42. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseComments.js +33 -3
  43. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.d.ts +6 -0
  44. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.d.ts.map +1 -1
  45. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.js +210 -35
  46. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useCommentDrafts.d.ts +1 -1
  47. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useCommentDrafts.d.ts.map +1 -1
  48. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useCommentDrafts.js +3 -1
  49. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.d.ts.map +1 -1
  50. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.js +11 -17
  51. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/VerifyCaseStatusModal/VerifyCaseStatusModal.d.ts.map +1 -1
  52. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/VerifyCaseStatusModal/VerifyCaseStatusModal.js +1 -1
  53. package/lib/esm/components/CaseEditView/Tabs/CaseHistory/CaseHistory.d.ts.map +1 -1
  54. package/lib/esm/components/CaseEditView/Tabs/CaseHistory/CaseHistory.js +5 -2
  55. package/lib/esm/components/CaseEditView/Tabs/CaseHistory/Timeline.d.ts +2 -1
  56. package/lib/esm/components/CaseEditView/Tabs/CaseHistory/Timeline.d.ts.map +1 -1
  57. package/lib/esm/components/CaseEditView/Tabs/CaseHistory/Timeline.js +4 -11
  58. package/lib/esm/components/CaseEditView/Tabs/CasePrivateNotes/CasePrivateNotes.d.ts.map +1 -1
  59. package/lib/esm/components/CaseEditView/Tabs/CasePrivateNotes/CasePrivateNotes.js +6 -3
  60. package/lib/esm/components/CaseEditView/Tabs/CaseSummary/CaseSummary.d.ts.map +1 -1
  61. package/lib/esm/components/CaseEditView/Tabs/CaseSummary/CaseSummary.js +1 -0
  62. package/lib/esm/components/CaseInformation/CaseGroup.d.ts.map +1 -1
  63. package/lib/esm/components/CaseInformation/CaseGroup.js +6 -2
  64. package/lib/esm/components/CaseInformation/CaseLabels.d.ts.map +1 -1
  65. package/lib/esm/components/CaseInformation/CaseLabels.js +21 -16
  66. package/lib/esm/components/CaseInformation/Fts.js +2 -2
  67. package/lib/esm/components/CaseInformation/Severity.d.ts.map +1 -1
  68. package/lib/esm/components/CaseInformation/Severity.js +16 -15
  69. package/lib/esm/components/CaseManagement/CaseLabelsCreate.d.ts.map +1 -1
  70. package/lib/esm/components/CaseManagement/CaseLabelsCreate.js +52 -21
  71. package/lib/esm/components/CaseManagement/Cep.js +1 -1
  72. package/lib/esm/components/CaseManagement/NoClusterIDReasonSelector.d.ts.map +1 -1
  73. package/lib/esm/components/CaseManagement/NoClusterIDReasonSelector.js +1 -3
  74. package/lib/esm/components/CaseManagement/OpenShiftClusterId.d.ts.map +1 -1
  75. package/lib/esm/components/CaseManagement/OpenShiftClusterId.js +1 -1
  76. package/lib/esm/components/CaseManagement/OpenshiftDropdownV4.d.ts +0 -1
  77. package/lib/esm/components/CaseManagement/OpenshiftDropdownV4.d.ts.map +1 -1
  78. package/lib/esm/components/CaseManagement/OpenshiftDropdownV4.js +6 -12
  79. package/lib/esm/components/CaseManagement/RHAssociatesSelector.d.ts.map +1 -1
  80. package/lib/esm/components/CaseManagement/RHAssociatesSelector.js +4 -2
  81. package/lib/esm/components/CaseManagement/SendNotifications/CaseContactSelector.d.ts.map +1 -1
  82. package/lib/esm/components/CaseManagement/SendNotifications/CaseContactSelector.js +4 -2
  83. package/lib/esm/components/EditDescription/EditDescription.d.ts.map +1 -1
  84. package/lib/esm/components/EditDescription/EditDescription.js +3 -1
  85. package/lib/esm/components/IdeaInformation/IdeaInformation.d.ts.map +1 -1
  86. package/lib/esm/components/IdeaInformation/IdeaInformation.js +11 -3
  87. package/lib/esm/components/UpdateSeverityModal/UpdateSeverityModal.d.ts.map +1 -1
  88. package/lib/esm/components/UpdateSeverityModal/UpdateSeverityModal.js +52 -46
  89. package/lib/esm/components/shared/fileUpload/reducer/AttachmentHelper.d.ts +1 -0
  90. package/lib/esm/components/shared/fileUpload/reducer/AttachmentHelper.d.ts.map +1 -1
  91. package/lib/esm/components/shared/fileUpload/reducer/AttachmentHelper.js +126 -54
  92. package/lib/esm/components/shared/fileUpload/useFileUploader.d.ts.map +1 -1
  93. package/lib/esm/components/shared/fileUpload/useFileUploader.js +6 -3
  94. package/lib/esm/components/wizardLayout/MainSection.d.ts.map +1 -1
  95. package/lib/esm/components/wizardLayout/MainSection.js +2 -1
  96. package/lib/esm/css/case.css +154 -8
  97. package/lib/esm/graphql/queries/getEscalationDetails.d.ts.map +1 -1
  98. package/lib/esm/graphql/queries/getEscalationDetails.js +5 -0
  99. package/lib/esm/hooks/useCaseComments/caseCommentsQuery.d.ts.map +1 -1
  100. package/lib/esm/hooks/useCaseComments/caseCommentsQuery.js +6 -1
  101. package/lib/esm/hooks/useCaseComments/index.d.ts +2 -1
  102. package/lib/esm/hooks/useCaseComments/index.d.ts.map +1 -1
  103. package/lib/esm/hooks/useCaseComments/types.d.ts +8 -0
  104. package/lib/esm/hooks/useCaseComments/types.d.ts.map +1 -1
  105. package/lib/esm/hooks/useCaseComments/useCaseComments.d.ts +12 -3
  106. package/lib/esm/hooks/useCaseComments/useCaseComments.d.ts.map +1 -1
  107. package/lib/esm/hooks/useCaseComments/useCaseComments.js +84 -9
  108. package/lib/esm/hooks/useCaseHistory.d.ts +2 -2
  109. package/lib/esm/hooks/useCaseHistory.d.ts.map +1 -1
  110. package/lib/esm/hooks/useCaseHistory.js +16 -7
  111. package/lib/esm/hooks/useCaseLabelLinkMutations.d.ts +2 -0
  112. package/lib/esm/hooks/useCaseLabelLinkMutations.d.ts.map +1 -1
  113. package/lib/esm/hooks/useCaseLabelLinkMutations.js +21 -28
  114. package/lib/esm/hooks/useCaseUpdateErrorMessage.d.ts +9 -1
  115. package/lib/esm/hooks/useCaseUpdateErrorMessage.d.ts.map +1 -1
  116. package/lib/esm/hooks/useCaseUpdateErrorMessage.js +103 -16
  117. package/lib/esm/models/caseHistory.d.ts +6 -0
  118. package/lib/esm/models/caseHistory.d.ts.map +1 -1
  119. package/lib/esm/reducers/CaseDiscussionTabReducer.d.ts +2 -1
  120. package/lib/esm/reducers/CaseDiscussionTabReducer.d.ts.map +1 -1
  121. package/lib/esm/reducers/CaseDiscussionTabReducer.js +26 -4
  122. package/lib/esm/reducers/CaseHelpers.d.ts.map +1 -1
  123. package/lib/esm/reducers/CaseHelpers.js +5 -3
  124. package/lib/esm/reducers/CaseReducer.d.ts.map +1 -1
  125. package/lib/esm/reducers/CaseReducer.js +6 -2
  126. package/lib/esm/utils/caseHistoryUtils.d.ts +19 -0
  127. package/lib/esm/utils/caseHistoryUtils.d.ts.map +1 -1
  128. package/lib/esm/utils/caseHistoryUtils.js +31 -0
  129. package/lib/esm/utils/linkifyHtmlTextNodes.d.ts +8 -0
  130. package/lib/esm/utils/linkifyHtmlTextNodes.d.ts.map +1 -0
  131. package/lib/esm/utils/linkifyHtmlTextNodes.js +37 -0
  132. package/package.json +7 -6
@@ -1 +1 @@
1
- {"version":3,"file":"CaseGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/CaseGroup.tsx"],"names":[],"mappings":"AAyBA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAmB5E,UAAU,MAAM;IACZ,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB;AAWD,iBAAS,SAAS,CAAC,KAAK,EAAE,MAAM,qBAmf/B;AAED,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"CaseGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/CaseGroup.tsx"],"names":[],"mappings":"AAyBA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAmB5E,UAAU,MAAM;IACZ,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB;AAWD,iBAAS,SAAS,CAAC,KAAK,EAAE,MAAM,qBAwf/B;AAED,eAAe,SAAS,CAAC"}
@@ -115,7 +115,7 @@ function CaseGroup(props) {
115
115
  }
116
116
  catch (e) {
117
117
  setCaseGroupUpdating(false);
118
- caseUpdateError.showError(e, t(`Group failed to update`));
118
+ caseUpdateError.showFieldError(e, t('Group'), () => onCaseGroupUpdate(caseDetails));
119
119
  }
120
120
  });
121
121
  const onCaseGroupChange = (selection) => __awaiter(this, void 0, void 0, function* () {
@@ -225,6 +225,10 @@ function CaseGroup(props) {
225
225
  const onCaseGroupClear = () => __awaiter(this, void 0, void 0, function* () {
226
226
  if (canEditCase.alert())
227
227
  return;
228
+ if (isGroupMandatory && caseNumber) {
229
+ ToastNotification.addDangerMessage(t('Case Group is required for this account and cannot be removed.'));
230
+ return;
231
+ }
228
232
  const caseDetails = {
229
233
  groupNumber: '',
230
234
  groupName: '',
@@ -241,7 +245,7 @@ function CaseGroup(props) {
241
245
  }
242
246
  catch (e) {
243
247
  setCaseGroupUpdating(false);
244
- caseUpdateError.showError(e, t(`Group failed to update`));
248
+ caseUpdateError.showFieldError(e, t('Group'), onCaseGroupClear);
245
249
  return;
246
250
  }
247
251
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CaseLabels.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/CaseLabels.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAWzD,MAAM,CAAC,OAAO,UAAU,UAAU,sBAmLjC"}
1
+ {"version":3,"file":"CaseLabels.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/CaseLabels.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAYzD,MAAM,CAAC,OAAO,UAAU,UAAU,sBA4LjC"}
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { Label, MenuToggle, Select, SelectList, SelectOption, Spinner, } from '@patternfly/react-core';
11
- import { ToastNotification } from '@rh-support/components';
11
+ import { CaseLabelLoadErrorModal, ToastNotification } from '@rh-support/components';
12
12
  import { GlobalMetadataStateContext, useCanEditCase } from '@rh-support/react-context';
13
13
  import isEqual from 'lodash/isEqual';
14
14
  import React, { useContext, useState } from 'react';
@@ -16,21 +16,21 @@ import { Trans, useTranslation } from 'react-i18next';
16
16
  import { Link } from 'react-router-dom';
17
17
  import { useCaseSelector } from '../../context/CaseContext';
18
18
  import { useCaseLabelLinks } from '../../hooks/useCaseLabelLinkMutations';
19
+ import { useCaseUpdateErrorMessage } from '../../hooks/useCaseUpdateErrorMessage';
19
20
  const NUM_VISIBLE_LABELS = 3;
20
21
  export default function CaseLabels() {
22
+ var _a;
21
23
  const { t } = useTranslation();
24
+ const caseUpdateError = useCaseUpdateErrorMessage();
22
25
  const canEditCase = useCanEditCase();
23
- const { globalMetadataState: { loggedInUser }, } = useContext(GlobalMetadataStateContext);
26
+ const { globalMetadataState: { loggedInUser, loggedInUsersAccount }, } = useContext(GlobalMetadataStateContext);
24
27
  const isOrgAdmin = loggedInUser.data.isOrgAdmin;
25
- const { caseId, salesforceAccountId } = useCaseSelector((state) => {
26
- var _a, _b;
27
- return ({
28
- caseId: state.caseDetails.id,
29
- salesforceAccountId: (_b = (_a = state.selectedAccountDetails) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.salesforceAccountId,
30
- });
31
- }, isEqual);
32
- const { availableLabels, assignedLinks, selectedLabelIds, loading, mutating, setAssignedLinks, createLink, deleteLink, } = useCaseLabelLinks(salesforceAccountId, caseId);
28
+ const { caseId } = useCaseSelector((state) => ({ caseId: state.caseDetails.id }), isEqual);
29
+ const labelAccountId = (_a = loggedInUsersAccount.data) === null || _a === void 0 ? void 0 : _a.salesforceAccountId;
30
+ const isLabelAccountReady = !loggedInUsersAccount.isFetching && Boolean(labelAccountId);
31
+ const { availableLabels, assignedLinks, selectedLabelIds, loading, error, mutating, setAssignedLinks, createLink, deleteLink, refetch, } = useCaseLabelLinks(isLabelAccountReady ? labelAccountId : undefined, caseId);
33
32
  const [isOpen, setIsOpen] = useState(false);
33
+ const [isErrorModalDismissed, setIsErrorModalDismissed] = useState(false);
34
34
  const handleSelect = (_event, labelId) => __awaiter(this, void 0, void 0, function* () {
35
35
  if (!labelId || typeof labelId !== 'string')
36
36
  return;
@@ -51,8 +51,8 @@ export default function CaseLabels() {
51
51
  ToastNotification.addSuccessMessage(t('Label has been added'));
52
52
  }
53
53
  }
54
- catch (_a) {
55
- ToastNotification.addDangerMessage(t('Failed to update labels'));
54
+ catch (e) {
55
+ caseUpdateError.showFieldError(e, t('Labels'), () => handleSelect(_event, labelId));
56
56
  }
57
57
  });
58
58
  const handleChipRemove = (labelId) => __awaiter(this, void 0, void 0, function* () {
@@ -66,16 +66,17 @@ export default function CaseLabels() {
66
66
  setAssignedLinks((prev) => prev.filter((l) => l.linkId !== link.linkId));
67
67
  ToastNotification.addSuccessMessage(t('Label has been removed'));
68
68
  }
69
- catch (_a) {
70
- ToastNotification.addDangerMessage(t('Failed to remove label'));
69
+ catch (e) {
70
+ caseUpdateError.showFieldError(e, t('Labels'), () => handleChipRemove(labelId));
71
71
  }
72
72
  });
73
73
  const selectedLabels = availableLabels.filter((l) => selectedLabelIds.includes(l.id));
74
74
  const haltEvent = (e) => e.stopPropagation();
75
75
  const toggle = (toggleRef) => (React.createElement(MenuToggle, { ref: toggleRef, onClick: () => setIsOpen((prev) => !prev), isExpanded: isOpen, isDisabled: loading ||
76
76
  mutating ||
77
+ !!error ||
77
78
  !caseId ||
78
- (!isOrgAdmin && availableLabels.length === 0) ||
79
+ (!isOrgAdmin && availableLabels.length === 0 && !error) ||
79
80
  canEditCase.isCaseNotEditable, isFullWidth: true, style: { height: '36px' } }, loading || mutating ? (React.createElement(Spinner, { size: "md" })) : selectedLabels.length > 0 ? (React.createElement("span", { style: { display: 'flex', gap: '8px', alignItems: 'center', flexWrap: 'nowrap' } },
80
81
  selectedLabels.slice(0, NUM_VISIBLE_LABELS).map((label) => (React.createElement(Label, { key: label.id, variant: "outline", onClose: () => handleChipRemove(label.id), closeBtnAriaLabel: t('Remove label {{name}}', { name: label.name }), onClick: haltEvent }, label.name))),
81
82
  selectedLabels.length > NUM_VISIBLE_LABELS && (React.createElement("span", { style: {
@@ -87,11 +88,15 @@ export default function CaseLabels() {
87
88
  if (!caseId)
88
89
  return null;
89
90
  return (React.createElement("div", { className: "form-group" },
91
+ React.createElement(CaseLabelLoadErrorModal, { isOpen: !!error && !isErrorModalDismissed, onRetry: () => {
92
+ setIsErrorModalDismissed(false);
93
+ refetch();
94
+ }, onClose: () => setIsErrorModalDismissed(true) }),
90
95
  React.createElement("label", { htmlFor: "case-labels" },
91
96
  React.createElement(Trans, null, "Labels")),
92
97
  React.createElement(Select, { id: "case-labels", "data-tracking-id": "case-labels", role: "menu", isOpen: isOpen, onSelect: handleSelect, onOpenChange: () => setIsOpen(false), toggle: toggle, shouldFocusFirstItemOnOpen: false, isScrollable: true, popperProps: { direction: 'down', enableFlip: false } },
93
98
  React.createElement(SelectList, { id: "case-labels-listbox" }, availableLabels.map((label) => (React.createElement(SelectOption, { key: label.id, value: label.id, hasCheckbox: true, isSelected: selectedLabelIds.includes(label.id) }, label.name))))),
94
- !loading && availableLabels.length === 0 && (React.createElement("p", { className: "form-instructions" }, isOrgAdmin ? (React.createElement(Trans, null,
99
+ !loading && !error && availableLabels.length === 0 && (React.createElement("p", { className: "form-instructions" }, isOrgAdmin ? (React.createElement(Trans, null,
95
100
  React.createElement("strong", null, "No labels available:"),
96
101
  " You haven't created any labels yet.",
97
102
  ' ',
@@ -68,7 +68,7 @@ function Fts(props) {
68
68
  }
69
69
  catch (e) {
70
70
  setFtsContactUpdating(false);
71
- caseUpdateError.showError(e, t(`Failed to update the case`));
71
+ caseUpdateError.showFieldError(e, t('24x7 Support'), () => onCaseFtsContactUpdate(caseDetails));
72
72
  }
73
73
  });
74
74
  const onCaseFtsUpdate = (caseDetails) => __awaiter(this, void 0, void 0, function* () {
@@ -82,7 +82,7 @@ function Fts(props) {
82
82
  }
83
83
  catch (e) {
84
84
  setFtsUpdating(false);
85
- caseUpdateError.showError(e, t(`Failed to update the case`));
85
+ caseUpdateError.showFieldError(e, t('24x7 Support'), () => onCaseFtsUpdate(caseDetails));
86
86
  }
87
87
  });
88
88
  const onFtsChange = (e) => __awaiter(this, void 0, void 0, function* () {
@@ -1 +1 @@
1
- {"version":3,"file":"Severity.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/Severity.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAMvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAc5D,OAAO,KAA0C,MAAM,OAAO,CAAC;AAW/D,UAAU,MAAO,SAAQ,gBAAgB;IACrC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gBAAgB,CAAC,EAAE,CAAC,WAAW,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;IAChE,oBAAoB,EAAE,OAAO,CAAC;CACjC;AASD,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,GAAG,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;CACxD;AAED,iBAAS,QAAQ,CAAC,KAAK,EAAE,MAAM,qBA0R9B;kBA1RQ,QAAQ;;;AA4RjB,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"Severity.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/Severity.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAMvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAa5D,OAAO,KAA0C,MAAM,OAAO,CAAC;AAW/D,UAAU,MAAO,SAAQ,gBAAgB;IACrC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gBAAgB,CAAC,EAAE,CAAC,WAAW,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;IAChE,oBAAoB,EAAE,OAAO,CAAC;CACjC;AASD,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,GAAG,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;CACxD;AAED,iBAAS,QAAQ,CAAC,KAAK,EAAE,MAAM,qBA+R9B;kBA/RQ,QAAQ;;;AAiSjB,eAAe,QAAQ,CAAC"}
@@ -3,7 +3,7 @@ import QuestionCircleIcon from '@patternfly/react-icons/dist/js/icons/question-c
3
3
  import WarningTriangleIcon from '@patternfly/react-icons/dist/js/icons/warning-triangle-icon';
4
4
  import { SingleSelectDropdown, ValueChangedIcon } from '@rh-support/components';
5
5
  import { GlobalMetadataStateContext } from '@rh-support/react-context';
6
- import { autoEnableFtsOnCaseViewEditPage, PreviousCaseTypes, severitySort, showFtsOnCreateCasePage, } from '@rh-support/utils';
6
+ import { getFtsForSeverityChange, PreviousCaseTypes, severitySort, } from '@rh-support/utils';
7
7
  import find from 'lodash/find';
8
8
  import findLast from 'lodash/findLast';
9
9
  import includes from 'lodash/includes';
@@ -56,12 +56,11 @@ function Severity(props) {
56
56
  const casePayload = {
57
57
  severity: value,
58
58
  };
59
- // Auto-enable 24x7 only for severity 1; uncheck it when leaving severity 1.
60
- !isOnCaseDetailsPage && (casePayload.fts = showFtsOnCreateCasePage(entitlementSla, value, ftsCreateOptions));
61
- if (isOnCaseDetailsPage) {
62
- casePayload.fts = autoEnableFtsOnCaseViewEditPage(entitlementSla, value);
59
+ // Always send an explicit fts flag so CasePatch clears 24x7 when leaving severity 1.
60
+ casePayload.fts = getFtsForSeverityChange(entitlementSla, value, Object.assign({ isCaseEdit: isOnCaseDetailsPage }, ftsCreateOptions));
61
+ if (isIdea) {
62
+ casePayload.fts = false;
63
63
  }
64
- casePayload.fts = casePayload.fts && !isIdea;
65
64
  if (isOnCaseDetailsPage) {
66
65
  props.onSeverityChange && props.onSeverityChange(casePayload);
67
66
  }
@@ -110,8 +109,11 @@ function Severity(props) {
110
109
  label: `${severity} - ${getSeverityDescription(severity)}`,
111
110
  additionalInfo: getNewSeverityStringDef(severity),
112
111
  };
113
- const toggleModal = () => {
114
- setOpenUpdateSeverityModal((openUpdateSeverityModal) => !openUpdateSeverityModal);
112
+ const openSeverityModal = () => {
113
+ setOpenUpdateSeverityModal(true);
114
+ };
115
+ const closeSeverityModal = () => {
116
+ setOpenUpdateSeverityModal(false);
115
117
  };
116
118
  useEffect(() => {
117
119
  var _a, _b, _c;
@@ -174,13 +176,12 @@ function Severity(props) {
174
176
  React.createElement(Icon, { size: "sm" },
175
177
  React.createElement(WarningTriangleIcon, { color: "#ec7a08", title: "Support Severity Level warning" })))),
176
178
  !props.isDisabled && isOnCaseDetailsPage ? (React.createElement(React.Fragment, null,
177
- React.createElement("div", { onClick: toggleModal },
178
- React.createElement(SingleSelectDropdown, { dataTrackingId: "get-support-severity", selected: getSelectedDropdownOption, options: getDropdownOptions, onSelect: onSeverityChange, isDisabled: allCaseSeverities.isError ||
179
- props.isDisabled ||
180
- allCaseSeverities.isFetching ||
181
- ownersEntitlements.isFetching ||
182
- versionsDetails.isFetching, isLoading: props.isFetching, placeholder: t(`Select a severity`), isInvalid: allCaseSeverities.isError || isSeverityInValid, isScrollable: true, isModalOpen: openUpdateSeverityModal })),
183
- openUpdateSeverityModal && (React.createElement(UpdateSeverityModal, { isDisabled: props.isFetching, isFetching: props.isFetching, show: openUpdateSeverityModal, onClose: toggleModal })))) : (React.createElement("div", null,
179
+ React.createElement(SingleSelectDropdown, { dataTrackingId: "get-support-severity", selected: getSelectedDropdownOption, options: getDropdownOptions, onSelect: onSeverityChange, isDisabled: allCaseSeverities.isError ||
180
+ props.isDisabled ||
181
+ allCaseSeverities.isFetching ||
182
+ ownersEntitlements.isFetching ||
183
+ versionsDetails.isFetching, isLoading: props.isFetching, placeholder: t(`Select a severity`), isInvalid: allCaseSeverities.isError || isSeverityInValid, isScrollable: true, isModalOpen: openUpdateSeverityModal, onMenuToggle: openSeverityModal }),
184
+ openUpdateSeverityModal && (React.createElement(UpdateSeverityModal, { isDisabled: props.isFetching, isFetching: props.isFetching, show: openUpdateSeverityModal, onClose: closeSeverityModal })))) : (React.createElement("div", null,
184
185
  React.createElement(SingleSelectDropdown, { className: "case-creation-severity-select", dataTrackingId: "get-support-severity", selected: getSelectedDropdownOption, options: getDropdownOptions, onSelect: onSeverityChange, isDisabled: allCaseSeverities.isError ||
185
186
  props.isDisabled ||
186
187
  allCaseSeverities.isFetching ||
@@ -1 +1 @@
1
- {"version":3,"file":"CaseLabelsCreate.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseManagement/CaseLabelsCreate.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAYjF,wFAAwF;AACxF,MAAM,CAAC,OAAO,UAAU,gBAAgB,sBAgLvC"}
1
+ {"version":3,"file":"CaseLabelsCreate.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseManagement/CaseLabelsCreate.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAqE,MAAM,OAAO,CAAC;AAY1F,wFAAwF;AACxF,MAAM,CAAC,OAAO,UAAU,gBAAgB,sBA6NvC"}
@@ -9,11 +9,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { useApolloClient } from '@apollo/client/react';
11
11
  import { Label, MenuToggle, Select, SelectList, SelectOption, Spinner, } from '@patternfly/react-core';
12
+ import { CaseLabelLoadErrorModal } from '@rh-support/components';
12
13
  import { GlobalMetadataStateContext } from '@rh-support/react-context';
13
- import { GET_CASE_LABELS, } from '@rh-support/utils';
14
+ import { fetchAllAccountCaseLabels } from '@rh-support/utils';
14
15
  import isEqual from 'lodash/isEqual';
15
16
  import unescape from 'lodash/unescape';
16
- import React, { useCallback, useContext, useEffect, useState } from 'react';
17
+ import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react';
17
18
  import { Trans, useTranslation } from 'react-i18next';
18
19
  import { Link } from 'react-router-dom';
19
20
  import { useCaseDispatch, useCaseSelector } from '../../context/CaseContext';
@@ -21,40 +22,65 @@ import { setCaseState } from '../../reducers/CaseReducer';
21
22
  const NUM_VISIBLE_LABELS = 3;
22
23
  /** Case creation Labels dropdown — selection is stored and linked after case create. */
23
24
  export default function CaseLabelsCreate() {
25
+ var _a, _b, _c;
24
26
  const { t } = useTranslation();
25
27
  const client = useApolloClient();
26
28
  const caseDispatch = useCaseDispatch();
27
- const { globalMetadataState: { loggedInUser }, } = useContext(GlobalMetadataStateContext);
29
+ const { globalMetadataState: { loggedInUser, loggedInUsersAccount }, } = useContext(GlobalMetadataStateContext);
28
30
  const isOrgAdmin = loggedInUser.data.isOrgAdmin;
29
- const { salesforceAccountId, selectedLabelIds } = useCaseSelector((state) => {
30
- var _a, _b, _c;
31
+ const { salesforceAccountIdFromSelected, isSelectedAccountFetching, selectedAccountNumber, selectedLabelIds } = useCaseSelector((state) => {
32
+ var _a, _b, _c, _d, _e, _f, _g;
31
33
  return ({
32
- salesforceAccountId: (_b = (_a = state.selectedAccountDetails) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.salesforceAccountId,
33
- selectedLabelIds: (_c = state.selectedLabelIds) !== null && _c !== void 0 ? _c : [],
34
+ salesforceAccountIdFromSelected: (_b = (_a = state.selectedAccountDetails) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.salesforceAccountId,
35
+ isSelectedAccountFetching: (_d = (_c = state.selectedAccountDetails) === null || _c === void 0 ? void 0 : _c.isFetching) !== null && _d !== void 0 ? _d : false,
36
+ selectedAccountNumber: (_f = (_e = state.selectedAccountDetails) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.accountNumber,
37
+ selectedLabelIds: (_g = state.selectedLabelIds) !== null && _g !== void 0 ? _g : [],
34
38
  });
35
39
  }, isEqual);
40
+ const salesforceAccountId = useMemo(() => {
41
+ var _a, _b;
42
+ if (salesforceAccountIdFromSelected) {
43
+ return salesforceAccountIdFromSelected;
44
+ }
45
+ const loggedInAccountNumber = (_a = loggedInUsersAccount.data) === null || _a === void 0 ? void 0 : _a.accountNumber;
46
+ const loggedInSalesforceAccountId = (_b = loggedInUsersAccount.data) === null || _b === void 0 ? void 0 : _b.salesforceAccountId;
47
+ if (loggedInSalesforceAccountId &&
48
+ (!selectedAccountNumber || selectedAccountNumber === loggedInAccountNumber)) {
49
+ return loggedInSalesforceAccountId;
50
+ }
51
+ return undefined;
52
+ }, [
53
+ salesforceAccountIdFromSelected,
54
+ (_a = loggedInUsersAccount.data) === null || _a === void 0 ? void 0 : _a.accountNumber,
55
+ (_b = loggedInUsersAccount.data) === null || _b === void 0 ? void 0 : _b.salesforceAccountId,
56
+ selectedAccountNumber,
57
+ ]);
58
+ const isAccountLoading = isSelectedAccountFetching || loggedInUsersAccount.isFetching;
59
+ const labelAccountId = salesforceAccountId !== null && salesforceAccountId !== void 0 ? salesforceAccountId : (_c = loggedInUsersAccount.data) === null || _c === void 0 ? void 0 : _c.salesforceAccountId;
36
60
  const [availableLabels, setAvailableLabels] = useState([]);
37
61
  const [loading, setLoading] = useState(false);
62
+ const [error, setError] = useState(undefined);
38
63
  const [isOpen, setIsOpen] = useState(false);
64
+ const [isErrorModalDismissed, setIsErrorModalDismissed] = useState(false);
39
65
  const updateSelectedLabelIds = (nextIds) => {
40
66
  setCaseState(caseDispatch, { selectedLabelIds: nextIds });
41
67
  };
42
68
  const fetchLabels = useCallback(() => __awaiter(this, void 0, void 0, function* () {
43
- var _a, _b, _c, _d;
44
- if (!salesforceAccountId) {
69
+ if (!labelAccountId) {
70
+ if (isAccountLoading) {
71
+ setLoading(true);
72
+ return;
73
+ }
74
+ setLoading(false);
45
75
  setAvailableLabels([]);
46
76
  return;
47
77
  }
48
78
  setLoading(true);
79
+ setError(undefined);
49
80
  try {
50
- const { data } = yield client.query({
51
- query: GET_CASE_LABELS,
52
- variables: { where: { Account__c: { eq: salesforceAccountId } } },
53
- fetchPolicy: 'cache-first',
54
- });
55
- const edges = (_d = (_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.RedHatSupportCaseLabel__c) === null || _c === void 0 ? void 0 : _c.edges) !== null && _d !== void 0 ? _d : [];
56
- setAvailableLabels(edges
57
- .map(({ node }) => {
81
+ const labelNodes = yield fetchAllAccountCaseLabels(client, labelAccountId);
82
+ setAvailableLabels(labelNodes
83
+ .map((node) => {
58
84
  var _a, _b;
59
85
  return ({
60
86
  id: node.Id,
@@ -63,13 +89,14 @@ export default function CaseLabelsCreate() {
63
89
  })
64
90
  .filter((label) => label.id && label.name));
65
91
  }
66
- catch (_e) {
92
+ catch (e) {
93
+ setError(e);
67
94
  setAvailableLabels([]);
68
95
  }
69
96
  finally {
70
97
  setLoading(false);
71
98
  }
72
- }), [client, salesforceAccountId]);
99
+ }), [client, isAccountLoading, labelAccountId]);
73
100
  useEffect(() => {
74
101
  fetchLabels();
75
102
  }, [fetchLabels]);
@@ -85,7 +112,7 @@ export default function CaseLabelsCreate() {
85
112
  };
86
113
  const selectedLabels = availableLabels.filter((label) => selectedLabelIds.includes(label.id));
87
114
  const haltEvent = (e) => e.stopPropagation();
88
- const toggle = (toggleRef) => (React.createElement(MenuToggle, { ref: toggleRef, onClick: () => setIsOpen((prev) => !prev), isExpanded: isOpen, isDisabled: loading || (!isOrgAdmin && availableLabels.length === 0), isFullWidth: true, style: { height: '36px' } }, loading ? (React.createElement(Spinner, { size: "md" })) : selectedLabels.length > 0 ? (React.createElement("span", { style: { display: 'flex', gap: '8px', alignItems: 'center', flexWrap: 'nowrap' } },
115
+ const toggle = (toggleRef) => (React.createElement(MenuToggle, { ref: toggleRef, onClick: () => setIsOpen((prev) => !prev), isExpanded: isOpen, isDisabled: loading || isAccountLoading || !!error || (!isOrgAdmin && availableLabels.length === 0 && !error), isFullWidth: true, style: { height: '36px' } }, loading || isAccountLoading ? (React.createElement(Spinner, { size: "md" })) : selectedLabels.length > 0 ? (React.createElement("span", { style: { display: 'flex', gap: '8px', alignItems: 'center', flexWrap: 'nowrap' } },
89
116
  selectedLabels.slice(0, NUM_VISIBLE_LABELS).map((label) => (React.createElement(Label, { key: label.id, variant: "outline", onClose: () => handleChipRemove(label.id), closeBtnAriaLabel: t('Remove label {{name}}', { name: label.name }), onClick: haltEvent }, label.name))),
90
117
  selectedLabels.length > NUM_VISIBLE_LABELS && (React.createElement("span", { style: {
91
118
  color: 'var(--pf-t--global--text--color--link--default)',
@@ -94,11 +121,15 @@ export default function CaseLabelsCreate() {
94
121
  cursor: 'pointer',
95
122
  } }, t('{{count}} more', { count: selectedLabels.length - NUM_VISIBLE_LABELS }))))) : availableLabels.length === 0 ? (t('No label assigned')) : (t('Select labels'))));
96
123
  return (React.createElement("div", { className: "form-group" },
124
+ React.createElement(CaseLabelLoadErrorModal, { isOpen: !!error && !isErrorModalDismissed, onRetry: () => {
125
+ setIsErrorModalDismissed(false);
126
+ fetchLabels();
127
+ }, onClose: () => setIsErrorModalDismissed(true) }),
97
128
  React.createElement("label", { htmlFor: "case-labels-create" },
98
129
  React.createElement(Trans, null, "Labels")),
99
130
  React.createElement(Select, { id: "case-labels-create", "data-tracking-id": "case-labels-create", role: "menu", isOpen: isOpen, onSelect: handleSelect, onOpenChange: () => setIsOpen(false), toggle: toggle, shouldFocusFirstItemOnOpen: false, isScrollable: true, popperProps: { direction: 'down', enableFlip: false } },
100
131
  React.createElement(SelectList, { id: "case-labels-create-listbox" }, availableLabels.map((label) => (React.createElement(SelectOption, { key: label.id, value: label.id, hasCheckbox: true, isSelected: selectedLabelIds.includes(label.id) }, label.name))))),
101
- !loading && availableLabels.length === 0 && (React.createElement("p", { className: "form-instructions" }, isOrgAdmin ? (React.createElement(Trans, null,
132
+ !loading && !isAccountLoading && !error && availableLabels.length === 0 && (React.createElement("p", { className: "form-instructions" }, isOrgAdmin ? (React.createElement(Trans, null,
102
133
  React.createElement("strong", null, "No labels available:"),
103
134
  " You haven't created any labels yet.",
104
135
  ' ',
@@ -99,7 +99,7 @@ export function Cep(props) {
99
99
  ToastNotification.addSuccessMessage(t(`Consultant Engagement in Progress has been updated successfully`));
100
100
  }
101
101
  catch (e) {
102
- caseUpdateError.showError(e, t(`Consultant Engagement in Progress failed to update`));
102
+ caseUpdateError.showFieldError(e, t('Consultant Engagement in Progress'), () => cepUpdate(caseDetails));
103
103
  }
104
104
  });
105
105
  const onCancel = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"NoClusterIDReasonSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseManagement/NoClusterIDReasonSelector.tsx"],"names":[],"mappings":"AAWA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAM/D,UAAU,MAAM;IACZ,uBAAuB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,oBAAoB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,4BAA4B,EAAE,MAAM,CAAC;IACrC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,QAAA,MAAM,yBAAyB,GAAI,OAAO,MAAM,sBAwL/C,CAAC;AAEF,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
1
+ {"version":3,"file":"NoClusterIDReasonSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseManagement/NoClusterIDReasonSelector.tsx"],"names":[],"mappings":"AAWA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAM/D,UAAU,MAAM;IACZ,uBAAuB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,oBAAoB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,4BAA4B,EAAE,MAAM,CAAC;IACrC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,QAAA,MAAM,yBAAyB,GAAI,OAAO,MAAM,sBAqL/C,CAAC;AAEF,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
@@ -46,9 +46,7 @@ const NoClusterIDReasonSelector = (props) => {
46
46
  const cleaned = value.trim().length === 0 ? '' : value;
47
47
  setInputValue(cleaned);
48
48
  setHasLargeReasonExplanation(cleaned.length > SESSION_NO_CLUSTER_REASON_LENGTH_LIMIT);
49
- if (!props.onReasonInputBoxBlur) {
50
- (_a = props.onReasonInputBoxChanged) === null || _a === void 0 ? void 0 : _a.call(props, cleaned);
51
- }
49
+ (_a = props.onReasonInputBoxChanged) === null || _a === void 0 ? void 0 : _a.call(props, cleaned);
52
50
  };
53
51
  const handleInputBlur = () => {
54
52
  var _a;
@@ -1 +1 @@
1
- {"version":3,"file":"OpenShiftClusterId.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseManagement/OpenShiftClusterId.tsx"],"names":[],"mappings":"AAKA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAuB/D,eAAO,MAAM,oBAAoB,yBAShC,CAAC;AAEF,eAAO,MAAM,uBAAuB,yBAInC,CAAC;AAEF,eAAO,MAAM,4BAA4B,yBAYxC,CAAC;AAEF,eAAO,MAAM,qBAAqB,yBAIjC,CAAC;AAEF,UAAU,MAAM;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,qBAmT/C"}
1
+ {"version":3,"file":"OpenShiftClusterId.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseManagement/OpenShiftClusterId.tsx"],"names":[],"mappings":"AAKA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAuB/D,eAAO,MAAM,oBAAoB,yBAShC,CAAC;AAEF,eAAO,MAAM,uBAAuB,yBAInC,CAAC;AAEF,eAAO,MAAM,4BAA4B,yBAYxC,CAAC;AAEF,eAAO,MAAM,qBAAqB,yBAIjC,CAAC;AAEF,UAAU,MAAM;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,qBAkT/C"}
@@ -232,7 +232,7 @@ export function OpenShiftClusterId(props) {
232
232
  return null;
233
233
  return (React.createElement("div", { className: `${props.className ? props.className : ''}` },
234
234
  !showV3TextBox && (React.createElement(OpenshiftDropdownV4, { openshiftDisplayName: openshiftDisplayName, openshiftClusterIDState: openshiftClusterID || selectedReason, onClusterIdStateUpdate: onClusterIdStateUpdate, isClusterIdInvalid: isNextBtnClickedToShowValidationError &&
235
- ((isEmpty(openshiftClusterID) && isEmpty(selectedReason)) || isClusterIdInvalid), clusterIdDropdownFormInstructions: clusterIdDropdownFormInstructions(), onClusterClear: resetClusterData, isV3: product === 'OpenShift Container Platform' && !showV3TextBox })),
235
+ ((isEmpty(openshiftClusterID) && isEmpty(selectedReason)) || isClusterIdInvalid), clusterIdDropdownFormInstructions: clusterIdDropdownFormInstructions(), onClusterClear: resetClusterData })),
236
236
  noClusterIdReasonExplanation !== 'v3-cluster' && dontKnowSelected && !showV3TextBox && (React.createElement(NoClusterIDReasonSelector, { noClusterIdReasonExplanation: noClusterIdReasonExplanation, noClusterIdReason: noClusterIdReason, onReasonInputBoxChanged: onReasonExplanationInputBoxChanged, onReasonChange: onReasonChange, isInValid: isInVaidNoClusterIdReason, isCustomer: isCustomer })),
237
237
  (v3Selected || showV3TextBox) && (React.createElement(OpenShiftV3Inputbox, { v3ClusterName: v3ClusterName, onReasonInputBoxChanged: v3ClusterNameInputBoxChanged, isInValid: isEmpty(v3ClusterName.trim()) && isNextBtnClickedToShowValidationError, v3Selected: v3Selected }))));
238
238
  }
@@ -7,7 +7,6 @@ interface IProps extends IDClassNameProps {
7
7
  isClusterIdInvalid: boolean;
8
8
  clusterIdDropdownFormInstructions?: JSX.Element;
9
9
  onClusterClear: () => void;
10
- isV3: boolean;
11
10
  isDisabled?: boolean;
12
11
  noClusterIdReasonExplanation?: string;
13
12
  openshiftDisplayName?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"OpenshiftDropdownV4.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseManagement/OpenshiftDropdownV4.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAgB5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAI5D,OAAO,KAA2D,MAAM,OAAO,CAAC;AAOhF,UAAU,MAAO,SAAQ,gBAAgB;IACrC,uBAAuB,EAAE,MAAM,CAAC;IAChC,sBAAsB,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,oBAAoB,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACzF,kBAAkB,EAAE,OAAO,CAAC;IAC5B,iCAAiC,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IAChD,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,uBAAuB,CAAC,EAAE,CAAC,GAAG,KAAA,KAAK,IAAI,CAAC;CAC3C;AAsBD,iBAAS,mBAAmB,CAAC,KAAK,EAAE,MAAM,qBAyfzC;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
1
+ {"version":3,"file":"OpenshiftDropdownV4.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseManagement/OpenshiftDropdownV4.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAgB5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAI5D,OAAO,KAA2D,MAAM,OAAO,CAAC;AAOhF,UAAU,MAAO,SAAQ,gBAAgB;IACrC,uBAAuB,EAAE,MAAM,CAAC;IAChC,sBAAsB,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,oBAAoB,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACzF,kBAAkB,EAAE,OAAO,CAAC;IAC5B,iCAAiC,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IAChD,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,uBAAuB,CAAC,EAAE,CAAC,GAAG,KAAA,KAAK,IAAI,CAAC;CAC3C;AAsBD,iBAAS,mBAAmB,CAAC,KAAK,EAAE,MAAM,qBAmfzC;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
@@ -117,8 +117,8 @@ function OpenshiftDropdownV4(props) {
117
117
  const dropdownOptions = useMemo(() => [
118
118
  { type: 'checkbox', key: 'show-hide-archived-clusters', label: t('Show archived clusters') },
119
119
  { type: 'option', key: 'dont-have-id', label: t("I don't have my Cluster ID") },
120
- ...(props.isV3 ? [{ type: 'option', key: 'v3-cluster', label: t('The case is for a v3 cluster') }] : []),
121
- ], [props.isV3, t]);
120
+ { type: 'option', key: 'v3-cluster', label: t('The case is for a v3 cluster') },
121
+ ], [t]);
122
122
  // Use the keyboard navigation hook
123
123
  const { focusedItemIndex, onInputKeyDown } = useSelectKeyboardNavigator({
124
124
  list: dropdownOptions,
@@ -145,13 +145,9 @@ function OpenshiftDropdownV4(props) {
145
145
  const dropdownHeaderOptions = useMemo(() => [
146
146
  React.createElement(SelectOption, { hasCheckbox: true, key: "show-archived-clusters", "aria-label": t('Show archived clusters'), id: "show-archived-clusters", className: "archived-clusters-checkbox", "data-tracking-id": "show-hide-archived-clusters", value: { type: 'checkbox' }, isSelected: showArchivedClusters }, t('Show archived clusters')),
147
147
  React.createElement(Divider, { component: "div", key: 'cluster-id-options-divider-e' }),
148
- React.createElement(SelectOption, { key: 'dont-have-id', value: createState('dont-have-id', t("I don't have my Cluster ID")), "data-tracking-id": "dont-have-cluster-id", isFocused: focusedItemIndex === 1 }, "I don't have my Cluster ID"),
149
- ...(props.isV3
150
- ? [
151
- React.createElement(SelectOption, { key: 'v3-cluster', value: createState('v3-cluster', t('The case is for a v3 cluster')), "data-tracking-id": "v3-cluster-case", isFocused: focusedItemIndex === 2 }, t('The case is for a v3 cluster')),
152
- ]
153
- : []),
154
- ], [showArchivedClusters, focusedItemIndex, props.isV3, t]);
148
+ React.createElement(SelectOption, { key: 'dont-have-id', value: createState('dont-have-id', t("I don't have my Cluster ID")), "data-tracking-id": "dont-have-cluster-id", isFocused: focusedItemIndex === 1 }, t("I don't have my Cluster ID")),
149
+ React.createElement(SelectOption, { key: 'v3-cluster', value: createState('v3-cluster', t('The case is for a v3 cluster')), "data-tracking-id": "v3-cluster-case", isFocused: focusedItemIndex === 2 }, t('The case is for a v3 cluster')),
150
+ ], [showArchivedClusters, focusedItemIndex, t]);
155
151
  const getClusterOptions = (clusters, total = totalResultsNo) => {
156
152
  const clustersResponseGrouped = groupBy(clusters, 'console_url') || [];
157
153
  const domainNames = Object.keys(clustersResponseGrouped) || [];
@@ -294,8 +290,6 @@ function OpenshiftDropdownV4(props) {
294
290
  }, [props.openshiftClusterIDState, props.openshiftDisplayName, props.noClusterIdReasonExplanation]);
295
291
  // need to get clusters when user opens the dropdown
296
292
  // as the api response is cached np extra call is made on open/close
297
- // added observing props.isV3 because re-render
298
- // is needed when user on overview page changing version
299
293
  useEffect(() => {
300
294
  if (!isOpen)
301
295
  return;
@@ -314,7 +308,7 @@ function OpenshiftDropdownV4(props) {
314
308
  isUnmounted = true;
315
309
  };
316
310
  // eslint-disable-next-line react-hooks/exhaustive-deps
317
- }, [props.isV3, showArchivedClusters, isOpen, inputVal]);
311
+ }, [showArchivedClusters, isOpen, inputVal]);
318
312
  const onTextInputChange = (_event, value) => {
319
313
  setInputVal(value);
320
314
  props.onClusterIdStateUpdate({ external_cluster_id: value });
@@ -1 +1 @@
1
- {"version":3,"file":"RHAssociatesSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseManagement/RHAssociatesSelector.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAS5D,MAAM,WAAW,MAAM;CAAG;AAG1B,iBAAS,oBAAoB,CAAC,KAAK,EAAE,MAAM,qBAoN1C;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
1
+ {"version":3,"file":"RHAssociatesSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseManagement/RHAssociatesSelector.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAU5D,MAAM,WAAW,MAAM;CAAG;AAG1B,iBAAS,oBAAoB,CAAC,KAAK,EAAE,MAAM,qBAqN1C;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
@@ -23,11 +23,13 @@ import React, { useContext, useRef, useState } from 'react';
23
23
  import { Token } from 'react-bootstrap-typeahead';
24
24
  import { Trans, useTranslation } from 'react-i18next';
25
25
  import { useCaseDispatch, useCaseSelector } from '../../context/CaseContext';
26
+ import { useCaseUpdateErrorMessage } from '../../hooks/useCaseUpdateErrorMessage';
26
27
  import { addingNotifiedUsers, deleteNotifiedUsers, setNotifiedUser } from '../../reducers/CaseReducer';
27
28
  import { PDFContext } from '../CaseEditView/PDFContainer';
28
29
  import { ContactSelectorInternal } from '../shared/input/ContactSelectorInternal';
29
30
  function RHAssociatesSelector(props) {
30
31
  const { t } = useTranslation();
32
+ const caseUpdateError = useCaseUpdateErrorMessage();
31
33
  const { globalMetadataState: { loggedInUser, loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
32
34
  const [isRHAssociatesUpdating, setIsRHAssociatesUpdating] = useState(false);
33
35
  const ability = useContext(AbilityContext);
@@ -51,7 +53,7 @@ function RHAssociatesSelector(props) {
51
53
  }
52
54
  catch (e) {
53
55
  setIsRHAssociatesUpdating(false);
54
- ToastNotification.addDangerMessage(t(`Red Hat associate failed to update`));
56
+ caseUpdateError.showFieldError(e, t('Red Hat associate'), () => onRhAssociateAdded(addedUsers));
55
57
  }
56
58
  });
57
59
  const onRhAssociateRemoved = (removedUsers) => __awaiter(this, void 0, void 0, function* () {
@@ -64,7 +66,7 @@ function RHAssociatesSelector(props) {
64
66
  }
65
67
  catch (e) {
66
68
  setIsRHAssociatesUpdating(false);
67
- ToastNotification.addDangerMessage(t(`Red Hat associate failed to get removed`));
69
+ caseUpdateError.showFieldError(e, t('Red Hat associate'), () => onRhAssociateRemoved(removedUsers));
68
70
  }
69
71
  });
70
72
  const onNotifiedUserChange = (selectedContacts_1, ...args_1) => __awaiter(this, [selectedContacts_1, ...args_1], void 0, function* (selectedContacts, throwTrackEventOnAdd = false) {
@@ -1 +1 @@
1
- {"version":3,"file":"CaseContactSelector.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseManagement/SendNotifications/CaseContactSelector.tsx"],"names":[],"mappings":"AA2BA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAgBvE,MAAM,WAAW,MAAM;CAAG;AAG1B,iBAAS,mBAAmB,CAAC,KAAK,EAAE,MAAM,qBAsdzC;AAED,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"CaseContactSelector.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseManagement/SendNotifications/CaseContactSelector.tsx"],"names":[],"mappings":"AA2BA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAiBvE,MAAM,WAAW,MAAM;CAAG;AAG1B,iBAAS,mBAAmB,CAAC,KAAK,EAAE,MAAM,qBAudzC;AAED,eAAe,mBAAmB,CAAC"}
@@ -28,6 +28,7 @@ import React, { useContext, useEffect, useRef, useState } from 'react';
28
28
  import { Token } from 'react-bootstrap-typeahead';
29
29
  import { Trans, useTranslation } from 'react-i18next';
30
30
  import { useCaseDispatch, useCaseSelector } from '../../../context/CaseContext';
31
+ import { useCaseUpdateErrorMessage } from '../../../hooks/useCaseUpdateErrorMessage';
31
32
  import { addingNotifiedUsers, deleteNotifiedUsers, setNotifiedUser, setSelectedCaseGroupUsers, } from '../../../reducers/CaseReducer';
32
33
  import { PDFContext } from '../../CaseEditView/PDFContainer';
33
34
  import { useCustomEmails } from '../../CaseEditView/Tabs/CaseDetails/useCustomEmails';
@@ -38,6 +39,7 @@ function CaseContactSelector(props) {
38
39
  const canSeeEmailNotifications = ability.can(resourceActions.PATCH, resources.CASE_DETAILS, CaseDetailsFields.CASE_DETAILS_SEND_NOTIFICATIONS);
39
40
  const [isAssociatesUpdating, setIsAssociatesUpdating] = useState(false);
40
41
  const { t } = useTranslation();
42
+ const caseUpdateError = useCaseUpdateErrorMessage();
41
43
  const { accountNumber, caseNumber, contactSsoUsername, selectedNotificationContacts, selectedOwner, customEmailsList, product, selectedCaseGroupUsers, ownersCaseGroups, groupNumber, createdById, version, isCaseOwnerUpdating, } = useCaseSelector((state) => ({
42
44
  accountNumber: state.caseDetails.accountNumberRef,
43
45
  caseNumber: state.caseDetails.caseNumber,
@@ -78,7 +80,7 @@ function CaseContactSelector(props) {
78
80
  }
79
81
  catch (e) {
80
82
  setIsAssociatesUpdating(false);
81
- ToastNotification.addDangerMessage(t(`Contact failed to update`));
83
+ caseUpdateError.showFieldError(e, t('Contact'), () => onCaseContactAdded(addedUsers));
82
84
  }
83
85
  });
84
86
  const onCaseContactRemoved = (removedUsers) => __awaiter(this, void 0, void 0, function* () {
@@ -91,7 +93,7 @@ function CaseContactSelector(props) {
91
93
  }
92
94
  catch (e) {
93
95
  setIsAssociatesUpdating(false);
94
- ToastNotification.addDangerMessage(t(`Contact failed to update`));
96
+ caseUpdateError.showFieldError(e, t('Contact'), () => onCaseContactRemoved(removedUsers));
95
97
  }
96
98
  });
97
99
  const addCaseContact = (toAdd) => __awaiter(this, void 0, void 0, function* () {
@@ -1 +1 @@
1
- {"version":3,"file":"EditDescription.d.ts","sourceRoot":"","sources":["../../../../src/components/EditDescription/EditDescription.tsx"],"names":[],"mappings":"AAMA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAQpD,UAAU,MAAM;IACZ,cAAc,EAAE,OAAO,CAAC;CAC3B;AAUD,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,KAAK,EAAE,MAAM,qBAgEpD"}
1
+ {"version":3,"file":"EditDescription.d.ts","sourceRoot":"","sources":["../../../../src/components/EditDescription/EditDescription.tsx"],"names":[],"mappings":"AAMA,OAAO,KAA+B,MAAM,OAAO,CAAC;AASpD,UAAU,MAAM;IACZ,cAAc,EAAE,OAAO,CAAC;CAC3B;AAUD,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,KAAK,EAAE,MAAM,qBAiEpD"}
@@ -16,6 +16,7 @@ import React, { useContext, useState } from 'react';
16
16
  import { Trans, useTranslation } from 'react-i18next';
17
17
  import { useParams } from 'react-router-dom';
18
18
  import { useCaseDispatch, useCaseSelector } from '../../context/CaseContext';
19
+ import { useCaseUpdateErrorMessage } from '../../hooks/useCaseUpdateErrorMessage';
19
20
  import { setCaseDetails } from '../../reducers/CaseReducer';
20
21
  import { PDFContext } from '../CaseEditView/PDFContainer';
21
22
  const linkifiedDescription = (text) => {
@@ -26,6 +27,7 @@ const linkifiedDescription = (text) => {
26
27
  };
27
28
  export default function EditDescription(props) {
28
29
  const { t } = useTranslation();
30
+ const caseUpdateError = useCaseUpdateErrorMessage();
29
31
  const { caseNumber } = useParams();
30
32
  const { description, hasLargeCaseDescription } = useCaseSelector((state) => ({
31
33
  description: state.caseDetails.description,
@@ -50,7 +52,7 @@ export default function EditDescription(props) {
50
52
  catch (e) {
51
53
  setLocalDescription(description);
52
54
  setIsUpdating(false);
53
- ToastNotification.addDangerMessage(t('Case description failed to update'));
55
+ caseUpdateError.showFieldError(e, t('Description'), onDescriptionSave);
54
56
  }
55
57
  });
56
58
  const onDescriptionChange = (event) => {
@@ -1 +1 @@
1
- {"version":3,"file":"IdeaInformation.d.ts","sourceRoot":"","sources":["../../../../src/components/IdeaInformation/IdeaInformation.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAkBrD,MAAM,CAAC,OAAO,UAAU,eAAe,sBAoJtC"}
1
+ {"version":3,"file":"IdeaInformation.d.ts","sourceRoot":"","sources":["../../../../src/components/IdeaInformation/IdeaInformation.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAoBrD,MAAM,CAAC,OAAO,UAAU,eAAe,sBA0JtC"}