@rh-support/troubleshoot 0.2.127 → 0.2.130

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.
@@ -154,7 +154,7 @@ function Severity(props) {
154
154
  "\u00A0",
155
155
  filteredSeverities.filter((s) => s.disabled).length !== 0 && (React.createElement(Tooltip, { position: TooltipPosition.top, content: React.createElement(Trans, null, "Only the enabled severity levels are supported for selected product and version.") },
156
156
  React.createElement(WarningTriangleIcon, { color: "#ec7a08", size: "sm", title: "Support Severity Level warning" })))),
157
- props.onCaseDetailsPage === true ? (React.createElement(React.Fragment, null,
157
+ !props.isDisabled && props.onCaseDetailsPage === true ? (React.createElement(React.Fragment, null,
158
158
  React.createElement("div", { onClick: toggleModal },
159
159
  React.createElement(Dropdown, { name: "open-case-severity", placeholder: t(`Select a severity`), title: t(`Select a severity`), list: allCaseSeverities.data
160
160
  ? toOptions(filteredSeverities, {
@@ -1 +1 @@
1
- {"version":3,"file":"UpdateSeverityModal.d.ts","sourceRoot":"","sources":["../../../../src/components/UpdateSeverityModal/UpdateSeverityModal.tsx"],"names":[],"mappings":"AA0BA,UAAU,MAAM;IACZ,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,KAAK,EAAE,MAAM,eA8NxD"}
1
+ {"version":3,"file":"UpdateSeverityModal.d.ts","sourceRoot":"","sources":["../../../../src/components/UpdateSeverityModal/UpdateSeverityModal.tsx"],"names":[],"mappings":"AA0BA,UAAU,MAAM;IACZ,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,KAAK,EAAE,MAAM,eA4OxD"}
@@ -44,6 +44,7 @@ export default function UpdateSeverityModal(props) {
44
44
  caseDetails: {
45
45
  caseNumber: state.caseDetails.caseNumber,
46
46
  caseSeverity: state.caseDetails.severity,
47
+ caseStatus: state.caseDetails.status,
47
48
  },
48
49
  isCaseUpdating: state.isCaseUpdating,
49
50
  }), isEqual);
@@ -53,9 +54,17 @@ export default function UpdateSeverityModal(props) {
53
54
  const onCancel = () => {
54
55
  onClose();
55
56
  setSeverityUpdating(caseOverviewDispatch, false);
57
+ setNewSeverityValue([]);
56
58
  setCaseDetails(caseDispatch, { severity: currentSeverity });
57
59
  setDescriptionValue('');
58
60
  };
61
+ // To handle on successful submit
62
+ const onSuccessfulSubmit = () => {
63
+ onClose();
64
+ setSeverityUpdating(caseOverviewDispatch, false);
65
+ setNewSeverityValue([]);
66
+ setDescriptionValue('');
67
+ };
59
68
  // To handle description change
60
69
  const handleTextAreaChange = (value) => {
61
70
  setDescriptionValue(value);
@@ -68,10 +77,9 @@ export default function UpdateSeverityModal(props) {
68
77
  description: descriptionValue === null || descriptionValue === void 0 ? void 0 : descriptionValue.trim(),
69
78
  });
70
79
  // Severity update failed comment body
71
- const severityUpdateFailedComment = t('#### Severity update \n Failed to change severity from {{oldSeverity}} to {{newSeverity}}\n\n #### Description \n{{description}}', {
80
+ const severityUpdateFailedComment = t('#### Severity update \n Failed to change severity from {{oldSeverity}} to {{newSeverity}}. Please try again\n', {
72
81
  oldSeverity: currentSeverity,
73
82
  newSeverity: newSeverityValue,
74
- description: descriptionValue === null || descriptionValue === void 0 ? void 0 : descriptionValue.trim(),
75
83
  });
76
84
  try {
77
85
  setSeverityUpdating(caseOverviewDispatch, true);
@@ -83,34 +91,37 @@ export default function UpdateSeverityModal(props) {
83
91
  contentType: 'markdown',
84
92
  });
85
93
  try {
86
- yield checkForCaseStatusToggleOnAttachOrComment(caseDispatch, loggedInUserRights.data.isInternal(), caseDetails.caseSeverity);
87
- ToastNotification.addSuccessMessage(t('Severity has been successfully updated'));
94
+ checkForCaseStatusToggleOnAttachOrComment(caseDispatch, loggedInUserRights.data.isInternal(), caseDetails.caseStatus);
88
95
  setCurrentSeverity(newSeverityValue);
89
- onCancel();
96
+ onSuccessfulSubmit();
97
+ ToastNotification.addSuccessMessage(t('Severity has been successfully updated'));
90
98
  }
91
99
  catch (e) {
92
- yield updateCaseDetails(caseDispatch, caseDetails.caseNumber, {
93
- severity: currentSeverity,
94
- });
95
100
  yield postCommentRequest({
96
101
  caseNumber: caseDetails.caseNumber,
97
102
  commentBody: severityUpdateFailedComment === null || severityUpdateFailedComment === void 0 ? void 0 : severityUpdateFailedComment.trim(),
98
103
  contentType: 'markdown',
99
104
  });
100
- ToastNotification.addDangerMessage(t(`Failed to check case status. Please try again.`));
105
+ yield updateCaseDetails(caseDispatch, caseDetails.caseNumber, {
106
+ status: 'Waiting on Customer',
107
+ severity: currentSeverity,
108
+ });
109
+ setCaseDetails(caseDispatch, { status: 'Waiting on Customer' });
110
+ onSuccessfulSubmit();
111
+ ToastNotification.addDangerMessage(t(`Failed to update case status. Please try again`));
101
112
  }
102
113
  }
103
114
  catch (e) {
104
115
  yield updateCaseDetails(caseDispatch, caseDetails.caseNumber, {
105
116
  severity: currentSeverity,
106
117
  });
107
- ToastNotification.addDangerMessage(t(`Couldn't post severity update comment. Please try again.`));
118
+ onClose();
119
+ ToastNotification.addDangerMessage(t(`Couldn't post severity update comment. Please try again`));
108
120
  }
109
121
  }
110
122
  catch (e) {
111
- setSeverityUpdating(caseOverviewDispatch, false);
123
+ onSuccessfulSubmit();
112
124
  ToastNotification.addDangerMessage(t('Severity failed to update'));
113
- onCancel();
114
125
  }
115
126
  finally {
116
127
  yield updateDiscussionStateComments(dispatchDiscussion, caseDetails.caseNumber, allDiscussions, sort, caseFeedbacksHydra.data, discussionFiltersListState);
@@ -119,15 +130,15 @@ export default function UpdateSeverityModal(props) {
119
130
  // To check if description is valid
120
131
  const isTextAreaValid = () => {
121
132
  if (isEmpty(descriptionValue === null || descriptionValue === void 0 ? void 0 : descriptionValue.trim())) {
122
- return true;
133
+ return false;
123
134
  }
124
135
  else
125
- return false;
136
+ return true;
126
137
  };
127
138
  // To compare previous and current severity values
128
- const checkSeverity = () => {
129
- const checkForUndefined = newSeverityValue['severity'] === undefined;
130
- if (isEqual(currentSeverity, newSeverityValue['severity'])) {
139
+ const checkSeverityValid = () => {
140
+ const checkForUndefined = newSeverityValue.length === 0;
141
+ if (isEqual(currentSeverity, newSeverityValue)) {
131
142
  return false;
132
143
  }
133
144
  else if (checkForUndefined) {
@@ -138,18 +149,18 @@ export default function UpdateSeverityModal(props) {
138
149
  }
139
150
  };
140
151
  // To disable submit button wrt above conditions
141
- const isSubmitButtonDisabled = isTextAreaValid() || checkSeverity() ? true : false;
152
+ const isSubmitButtonDisabled = checkSeverityValid() && isTextAreaValid() ? false : true;
142
153
  // Update severity modal buttons
143
154
  const modalActions = [
144
- React.createElement(Button, { key: "submit", variant: "primary", onClick: onSubmit, isLoading: isCaseUpdating || isPostingComment, "data-tracking-id": "update-severity-submit", isDisabled: isSubmitButtonDisabled }, t('Submit')),
155
+ React.createElement(Button, { key: "submit", variant: "primary", onClick: onSubmit, isLoading: isCaseUpdating || isPostingComment, "data-tracking-id": "update-severity-submit", isDisabled: isSubmitButtonDisabled || isCaseUpdating || isPostingComment }, t('Submit')),
145
156
  React.createElement(Button, { key: "back", variant: "link", onClick: onCancel, "data-tracking-id": "update-severity-cancel" }, t('Cancel')),
146
157
  ];
147
158
  // To handle severity change in the modal
148
159
  const onSeverityChange = (payload) => __awaiter(this, void 0, void 0, function* () {
149
160
  if (canEditCase.alert())
150
161
  return;
151
- yield setUpdatedSeverity(payload);
152
- yield setNewSeverityValue(payload['severity']);
162
+ setUpdatedSeverity(payload);
163
+ setNewSeverityValue(payload['severity']);
153
164
  setCaseDetails(caseDispatch, payload);
154
165
  });
155
166
  // Returns the modal body with its contents
@@ -163,7 +174,9 @@ export default function UpdateSeverityModal(props) {
163
174
  React.createElement("label", { htmlFor: "date-input", className: "pf-u-mt-md" },
164
175
  React.createElement(Trans, null, "Describe update"),
165
176
  React.createElement("span", { className: "form-required", "aria-hidden": "true" }, "*")),
166
- React.createElement(TextArea, { placeholder: "Please identify any changes in the case's business impact", isDisabled: (caseOverviewState.caseSeverityUpdating && isCaseUpdating) || isPostingComment, value: descriptionValue, onChange: handleTextAreaChange, resizeOrientation: "vertical", "aria-label": "summary", isRequired: true }))))));
177
+ React.createElement(TextArea, { placeholder: "Please identify any changes in the case's business impact", isDisabled: (caseOverviewState.caseSeverityUpdating && isCaseUpdating) || isPostingComment, value: descriptionValue, onChange: handleTextAreaChange, resizeOrientation: "vertical", "aria-label": "summary", isRequired: true }),
178
+ React.createElement("div", { className: "pf-u-mt-xs" },
179
+ React.createElement(Trans, null, "Your comment will be visible under discussions")))))));
167
180
  };
168
181
  // Main modal and its headings
169
182
  return (React.createElement(Modal, { title: t('Update severity'), description: t('Describing your update helps us better assist you.'), isOpen: show, onClose: onCancel, actions: modalActions }, modalBody()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/troubleshoot",
3
- "version": "0.2.127",
3
+ "version": "0.2.130",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -28,7 +28,7 @@
28
28
  "peerDependencies": {
29
29
  "@cee-eng/hydrajs": "4.12.6",
30
30
  "@cee-eng/ui-toolkit": "1.1.6",
31
- "@patternfly/patternfly": "4.202.1",
31
+ "@patternfly/patternfly": "4.185.1",
32
32
  "@patternfly/pfe-accordion": "1.12.3",
33
33
  "@patternfly/pfe-collapse": "1.12.3",
34
34
  "@patternfly/pfe-tabs": "1.12.3",
@@ -74,8 +74,8 @@
74
74
  "@progress/kendo-drawing": "^1.6.0",
75
75
  "@progress/kendo-react-pdf": "^3.12.0",
76
76
  "@rh-support/api": "0.3.24",
77
- "@rh-support/components": "1.1.76",
78
- "@rh-support/react-context": "0.2.82",
77
+ "@rh-support/components": "1.1.77",
78
+ "@rh-support/react-context": "0.2.83",
79
79
  "@rh-support/types": "0.2.0",
80
80
  "@rh-support/user-permissions": "0.2.63",
81
81
  "@rh-support/utils": "0.2.46",
@@ -143,5 +143,5 @@
143
143
  "not ie <= 11",
144
144
  "not op_mini all"
145
145
  ],
146
- "gitHead": "1359173d6efb7ece2bd1d0760c001e053bc29893"
146
+ "gitHead": "6e187c73119882f908639c1b1f4340fc5455109c"
147
147
  }