@rh-support/troubleshoot 0.2.127 → 0.2.128

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,eAwOxD"}
@@ -53,9 +53,17 @@ export default function UpdateSeverityModal(props) {
53
53
  const onCancel = () => {
54
54
  onClose();
55
55
  setSeverityUpdating(caseOverviewDispatch, false);
56
+ setNewSeverityValue([]);
56
57
  setCaseDetails(caseDispatch, { severity: currentSeverity });
57
58
  setDescriptionValue('');
58
59
  };
60
+ // To handle on successful submit
61
+ const onSuccessfulSubmit = () => {
62
+ onClose();
63
+ setSeverityUpdating(caseOverviewDispatch, false);
64
+ setNewSeverityValue([]);
65
+ setDescriptionValue('');
66
+ };
59
67
  // To handle description change
60
68
  const handleTextAreaChange = (value) => {
61
69
  setDescriptionValue(value);
@@ -83,10 +91,10 @@ 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.caseSeverity);
88
95
  setCurrentSeverity(newSeverityValue);
89
- onCancel();
96
+ ToastNotification.addSuccessMessage(t('Severity has been successfully updated'));
97
+ onSuccessfulSubmit();
90
98
  }
91
99
  catch (e) {
92
100
  yield updateCaseDetails(caseDispatch, caseDetails.caseNumber, {
@@ -108,9 +116,8 @@ export default function UpdateSeverityModal(props) {
108
116
  }
109
117
  }
110
118
  catch (e) {
111
- setSeverityUpdating(caseOverviewDispatch, false);
112
119
  ToastNotification.addDangerMessage(t('Severity failed to update'));
113
- onCancel();
120
+ onSuccessfulSubmit();
114
121
  }
115
122
  finally {
116
123
  yield updateDiscussionStateComments(dispatchDiscussion, caseDetails.caseNumber, allDiscussions, sort, caseFeedbacksHydra.data, discussionFiltersListState);
@@ -119,15 +126,15 @@ export default function UpdateSeverityModal(props) {
119
126
  // To check if description is valid
120
127
  const isTextAreaValid = () => {
121
128
  if (isEmpty(descriptionValue === null || descriptionValue === void 0 ? void 0 : descriptionValue.trim())) {
122
- return true;
129
+ return false;
123
130
  }
124
131
  else
125
- return false;
132
+ return true;
126
133
  };
127
134
  // To compare previous and current severity values
128
- const checkSeverity = () => {
129
- const checkForUndefined = newSeverityValue['severity'] === undefined;
130
- if (isEqual(currentSeverity, newSeverityValue['severity'])) {
135
+ const checkSeverityValid = () => {
136
+ const checkForUndefined = newSeverityValue.length === 0;
137
+ if (isEqual(currentSeverity, newSeverityValue)) {
131
138
  return false;
132
139
  }
133
140
  else if (checkForUndefined) {
@@ -138,7 +145,7 @@ export default function UpdateSeverityModal(props) {
138
145
  }
139
146
  };
140
147
  // To disable submit button wrt above conditions
141
- const isSubmitButtonDisabled = isTextAreaValid() || checkSeverity() ? true : false;
148
+ const isSubmitButtonDisabled = checkSeverityValid() && isTextAreaValid() ? false : true;
142
149
  // Update severity modal buttons
143
150
  const modalActions = [
144
151
  React.createElement(Button, { key: "submit", variant: "primary", onClick: onSubmit, isLoading: isCaseUpdating || isPostingComment, "data-tracking-id": "update-severity-submit", isDisabled: isSubmitButtonDisabled }, t('Submit')),
@@ -148,8 +155,8 @@ export default function UpdateSeverityModal(props) {
148
155
  const onSeverityChange = (payload) => __awaiter(this, void 0, void 0, function* () {
149
156
  if (canEditCase.alert())
150
157
  return;
151
- yield setUpdatedSeverity(payload);
152
- yield setNewSeverityValue(payload['severity']);
158
+ setUpdatedSeverity(payload);
159
+ setNewSeverityValue(payload['severity']);
153
160
  setCaseDetails(caseDispatch, payload);
154
161
  });
155
162
  // Returns the modal body with its contents
@@ -163,7 +170,9 @@ export default function UpdateSeverityModal(props) {
163
170
  React.createElement("label", { htmlFor: "date-input", className: "pf-u-mt-md" },
164
171
  React.createElement(Trans, null, "Describe update"),
165
172
  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 }))))));
173
+ 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 }),
174
+ React.createElement("div", { className: "pf-u-mt-xs" },
175
+ React.createElement(Trans, null, "Your comment will be visible under discussions")))))));
167
176
  };
168
177
  // Main modal and its headings
169
178
  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.128",
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": "4ccfcdf67182264763662c2f1d833d9fa059a132"
147
147
  }