@rh-support/troubleshoot 0.2.129 → 0.2.132

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.
@@ -1 +1 @@
1
- {"version":3,"file":"ProductVersion.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDetails/ProductVersion.tsx"],"names":[],"mappings":"AAsBA,UAAU,MAAM;IACZ,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACvC;AAYD,iBAAS,eAAe,CAAC,KAAK,EAAE,MAAM,eA0PrC;AAED,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"ProductVersion.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDetails/ProductVersion.tsx"],"names":[],"mappings":"AAsBA,UAAU,MAAM;IACZ,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACvC;AAYD,iBAAS,eAAe,CAAC,KAAK,EAAE,MAAM,eAmQrC;AAED,eAAe,eAAe,CAAC"}
@@ -19,7 +19,7 @@ import uniq from 'lodash/uniq';
19
19
  import React, { useContext, useEffect, useMemo, useState } from 'react';
20
20
  import { Trans, useTranslation } from 'react-i18next';
21
21
  import { useCaseDispatch, useCaseSelector } from '../../../../context/CaseContext';
22
- import { getVersionsDetails, updateCaseDetails } from '../../../../reducers/CaseReducer';
22
+ import { getVersionsDetails, setCaseDetails, updateCaseDetails } from '../../../../reducers/CaseReducer';
23
23
  const getVersions = (products, product) => {
24
24
  const allProductsIndex = findIndex(products, (p) => p.product === product);
25
25
  return allProductsIndex !== -1 ? products[allProductsIndex].versions || [] : [];
@@ -40,22 +40,26 @@ function ProductNVersion(props) {
40
40
  caseNumber: state.caseDetails.caseNumber,
41
41
  versionsDetails: state.versionsDetails,
42
42
  }), isEqual);
43
- const productVenisons = useMemo(() => versionsDetails.data.map(({ name }) => name),
43
+ const productVersions = useMemo(() => versionsDetails.data
44
+ .map(({ name }) => name)
45
+ .sort()
46
+ .reverse(),
44
47
  // eslint-disable-next-line react-hooks/exhaustive-deps
45
48
  [product, versionsDetails.data]);
46
49
  const caseDispatch = useCaseDispatch();
47
50
  const dispatchToGlobalMetadataReducer = useContext(GlobalMetadataDispatchContext);
48
51
  const { globalMetadataState: { allProducts }, } = useContext(GlobalMetadataStateContext);
49
52
  const productSEVersions = useMemo(() => getVersions(allProducts.data.productsResult, product), [allProducts.data.productsResult, product]);
50
- const [isProductInValid, setIsProductInValid] = useState(false);
53
+ const [isProductInvalid, setIsProductInvalid] = useState(false);
54
+ const [isVersionInvalid, setIsVersionInvalid] = useState(false);
51
55
  const [selectedProductLocal, setSelectedProductLocal] = useState(product);
52
56
  const [selectedVersionLocal, setSelectedVersionLocal] = useState(version);
53
57
  const canEditCase = useCanEditCase();
54
58
  useEffect(() => {
55
- setVersions(productVenisons);
56
- if ((productVenisons === null || productVenisons === void 0 ? void 0 : productVenisons.length) && !selectedVersionLocal)
57
- setSelectedVersionLocal(productVenisons[0]);
58
- }, [productVenisons, selectedVersionLocal]);
59
+ setVersions(productVersions);
60
+ if ((productVersions === null || productVersions === void 0 ? void 0 : productVersions.length) && !selectedVersionLocal && (productVersions === null || productVersions === void 0 ? void 0 : productVersions.length) < 2)
61
+ setSelectedVersionLocal(productVersions[0]);
62
+ }, [productVersions, selectedVersionLocal]);
59
63
  /**
60
64
  * Sync local version from global state if they change from someplace else
61
65
  */
@@ -69,7 +73,7 @@ function ProductNVersion(props) {
69
73
  }
70
74
  if (allProducts.data && ((_a = allProducts.data.productsResult) === null || _a === void 0 ? void 0 : _a.length) !== 0) {
71
75
  const productSEVersions = getVersions(allProducts.data.productsResult, product);
72
- const versions = (productSEVersions === null || productSEVersions === void 0 ? void 0 : productSEVersions.length) ? productSEVersions : productVenisons;
76
+ const versions = (productSEVersions === null || productSEVersions === void 0 ? void 0 : productSEVersions.length) ? productSEVersions : productVersions;
73
77
  setVersions(versions);
74
78
  }
75
79
  setSelectedProductLocal(product);
@@ -96,7 +100,7 @@ function ProductNVersion(props) {
96
100
  yield updateCaseDetails(caseDispatch, caseNumber, caseDetails);
97
101
  setIsProductUpdating(false);
98
102
  setIsVersionUpdating(false);
99
- setIsProductInValid(false);
103
+ setIsProductInvalid(false);
100
104
  ToastNotification.addSuccessMessage(t(`Product and Version have been successfully updated`));
101
105
  }
102
106
  catch (e) {
@@ -104,7 +108,7 @@ function ProductNVersion(props) {
104
108
  setSelectedVersionLocal(version);
105
109
  setIsProductUpdating(false);
106
110
  setIsVersionUpdating(false);
107
- setIsProductInValid(false);
111
+ setIsProductInvalid(false);
108
112
  ToastNotification.addDangerMessage(t(`Product and Version failed to update`));
109
113
  }
110
114
  }
@@ -135,7 +139,8 @@ function ProductNVersion(props) {
135
139
  yield updateCaseDetails(caseDispatch, caseNumber, caseDetails);
136
140
  setIsProductUpdating(false);
137
141
  setIsVersionUpdating(false);
138
- setIsProductInValid(false);
142
+ setIsProductInvalid(false);
143
+ setIsVersionInvalid(false);
139
144
  if (onlyVersionChanged) {
140
145
  ToastNotification.addSuccessMessage(t(`Version has been successfully updated`));
141
146
  }
@@ -147,7 +152,7 @@ function ProductNVersion(props) {
147
152
  setSelectedVersionLocal(version);
148
153
  setIsProductUpdating(false);
149
154
  setIsVersionUpdating(false);
150
- setIsProductInValid(false);
155
+ setIsProductInvalid(false);
151
156
  if (onlyVersionChanged) {
152
157
  ToastNotification.addDangerMessage(t(`Version failed to update`));
153
158
  }
@@ -158,12 +163,12 @@ function ProductNVersion(props) {
158
163
  });
159
164
  const validateProduct = (selectedItem) => {
160
165
  const isValid = !isProductUpdating && (isEmpty(selectedItem) || isEmpty(selectedItem.label));
161
- setIsProductInValid(isValid);
166
+ setIsProductInvalid(isValid);
162
167
  };
163
168
  const onOuterClick = () => {
164
169
  setSelectedProductLocal(product);
165
170
  setSelectedVersionLocal(version);
166
- setIsProductInValid(false);
171
+ setIsProductInvalid(true);
167
172
  };
168
173
  const onProductClear = () => {
169
174
  const defaultSelectedProduct = {
@@ -173,6 +178,9 @@ function ProductNVersion(props) {
173
178
  isTopProduct: false,
174
179
  isEntitledProduct: true,
175
180
  };
181
+ setCaseDetails(caseDispatch, { product: '', version: '' });
182
+ setIsProductInvalid(true);
183
+ setIsVersionInvalid(true);
176
184
  onProductChange(toOption(defaultSelectedProduct, { labelKey: 'product' }));
177
185
  };
178
186
  useEffect(() => {
@@ -180,9 +188,11 @@ function ProductNVersion(props) {
180
188
  getVersionsDetails(caseDispatch, product);
181
189
  }
182
190
  }, [caseDispatch, product]);
191
+ // To check if version in invalid
192
+ const checkIfVersionIsInvalid = isVersionInvalid && isEmpty(selectedVersionLocal);
183
193
  return (React.createElement(React.Fragment, null,
184
194
  React.createElement(AlertMessage, { show: !allProducts.isFetching && allProducts.isError, title: t('There was an error loading products.'), variant: AlertType.DANGER }),
185
- isEmpty(selectedVersionLocal) && !((selectedVersionLocal === null || selectedVersionLocal === void 0 ? void 0 : selectedVersionLocal.length) < 2) && (React.createElement(Alert, { isInline: true, className: "pf-u-mb-md", variant: AlertVariant.danger, title: React.createElement(Trans, null, "Please clear the errors to change the product on your case") })),
195
+ isEmpty(selectedVersionLocal) && (selectedVersionLocal === null || selectedVersionLocal === void 0 ? void 0 : selectedVersionLocal.length) < 2 && (React.createElement(Alert, { isInline: true, className: "pf-u-mb-md", variant: AlertVariant.danger, title: React.createElement(Trans, null, "Please clear the errors to change the product on your case") })),
186
196
  React.createElement(React.Fragment, null,
187
197
  React.createElement("div", { className: "form-group all-product-selector-dropdown" },
188
198
  React.createElement("div", { className: "product-selector-wrapper" },
@@ -190,17 +200,15 @@ function ProductNVersion(props) {
190
200
  React.createElement(Trans, null, "Product")),
191
201
  React.createElement(Dropdown, { className: "open-case-product", placeholder: t('Select a product'), id: "case-details-product-selector", selectedItem: toOption({
192
202
  product: selectedProductLocal,
193
- versions: (productSEVersions === null || productSEVersions === void 0 ? void 0 : productSEVersions.length) ? productSEVersions : productVenisons,
203
+ versions: (productSEVersions === null || productSEVersions === void 0 ? void 0 : productSEVersions.length) ? productSEVersions : productVersions,
194
204
  featuredVersion: '',
195
205
  selectedVersion: selectedVersionLocal,
196
206
  isTopProduct: checkIsTopProduct(allProducts.data.productsResult, product),
197
207
  isEntitledProduct: true,
198
- }, { labelKey: 'product' }), list: toOptions(filter(allProducts.data.productsResult, (p) => p.isEntitledProduct), { labelKey: 'product' }), title: t(`Select a product`), disabled: isProductUpdating || (allProducts.isFetching && !allProducts.isError), isInValid: isProductInValid, onChange: onProductChange, isLoadingList: isProductUpdating, "data-tracking-id": "case-details-product-selector", onOuterClick: onOuterClick, searchable: true, onClearSelection: onProductClear })),
208
+ }, { labelKey: 'product' }), list: toOptions(filter(allProducts.data.productsResult, (p) => p.isEntitledProduct), { labelKey: 'product' }), title: t(`Select a product`), disabled: isProductUpdating || (allProducts.isFetching && !allProducts.isError), isInValid: isProductInvalid, onChange: onProductChange, isLoadingList: isProductUpdating, "data-tracking-id": "case-details-product-selector", onOuterClick: onOuterClick, searchable: true, onClearSelection: onProductClear })),
199
209
  React.createElement("div", { className: "version-selector-wrapper" },
200
210
  React.createElement("label", { htmlFor: "version-dropdown" },
201
211
  React.createElement(Trans, null, "Version")),
202
- React.createElement(Dropdown, { className: "open-case-version", id: "version-dropdown", selectedItem: toOption(selectedVersionLocal), list: toOptions(uniq(versions)), title: t(`Select a version`), isInValid: isEmpty(selectedVersionLocal), disabled: isVersionUpdating ||
203
- (selectedVersionLocal === null || selectedVersionLocal === void 0 ? void 0 : selectedVersionLocal.length) < 2 ||
204
- (allProducts.isFetching && !allProducts.isError), onChange: onVersionChange, isLoadingList: isVersionUpdating, "data-tracking-id": "case-details-version-selector" }))))));
212
+ React.createElement(Dropdown, { className: "open-case-version", id: "version-dropdown", selectedItem: toOption(selectedVersionLocal), list: toOptions(uniq(versions)), title: t(`Select a version`), isInValid: checkIfVersionIsInvalid, disabled: isVersionUpdating || (allProducts.isFetching && !allProducts.isError), onChange: onVersionChange, isLoadingList: isVersionUpdating, "data-tracking-id": "case-details-version-selector" }))))));
205
213
  }
206
214
  export default ProductNVersion;
@@ -1 +1 @@
1
- {"version":3,"file":"Fts.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/Fts.tsx"],"names":[],"mappings":"AAYA,UAAU,MAAM;IACZ,cAAc,EAAE,OAAO,CAAC;IACxB,cAAc,EAAE,OAAO,CAAC;IACxB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAQD,iBAAS,GAAG,CAAC,KAAK,EAAE,MAAM,eAyKzB;kBAzKQ,GAAG;;;AA4KZ,eAAe,GAAG,CAAC"}
1
+ {"version":3,"file":"Fts.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/Fts.tsx"],"names":[],"mappings":"AAYA,UAAU,MAAM;IACZ,cAAc,EAAE,OAAO,CAAC;IACxB,cAAc,EAAE,OAAO,CAAC;IACxB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAQD,iBAAS,GAAG,CAAC,KAAK,EAAE,MAAM,eA8KzB;kBA9KQ,GAAG;;;AAiLZ,eAAe,GAAG,CAAC"}
@@ -91,7 +91,7 @@ function Fts(props) {
91
91
  const setContactInfoIntoGlobalState = (cInfo) => __awaiter(this, void 0, void 0, function* () {
92
92
  if (contactInfo24x7 === cInfo)
93
93
  return;
94
- const caseDetails = { contactInfo24x7: cInfo };
94
+ const caseDetails = { contactInfo24x7: cInfo === null || cInfo === void 0 ? void 0 : cInfo.trim() };
95
95
  if (!isEmpty(caseNumber)) {
96
96
  // edit/view case
97
97
  yield onCaseFtsContactUpdate(caseDetails);
@@ -125,6 +125,8 @@ function Fts(props) {
125
125
  return React.createElement(React.Fragment, null);
126
126
  if (!isEmpty(caseNumber) && !showFtsOnCaseViewEditPage(entitlementSla, severity))
127
127
  return React.createElement(React.Fragment, null);
128
+ // To disable save button if field is empty or is updating
129
+ const isSaveDisabled = isEmpty(contactInfo24X7State === null || contactInfo24X7State === void 0 ? void 0 : contactInfo24X7State.trim()) || contactInfo24X7State === contactInfo24x7 || isFtsContactUpdating;
128
130
  return (React.createElement(React.Fragment, null,
129
131
  React.createElement("div", { className: "form-group push-top" },
130
132
  React.createElement("input", { type: "checkbox", id: "open-case-fts", "data-tracking-id": "open-case-fts", disabled: disableFtsNContact, name: "open-case-fts", checked: fts, onChange: onFtsChange }),
@@ -132,7 +134,7 @@ function Fts(props) {
132
134
  React.createElement(Trans, null, "24x7 Support")),
133
135
  React.createElement(LoadingIndicator, { size: "sm", isInline: true, show: isFtsUpdating, className: "pf-u-ml-sm" })),
134
136
  fts === true && (React.createElement(React.Fragment, null,
135
- React.createElement(InlineEdit, { labelProps: { htmlFor: 'open-case-24-7-contact' }, labelContent: React.createElement(Trans, null, "24x7 Contact"), allowInlineEdit: props.inlineEditable && !disableFtsNContact, hideSaveCancel: props.hideSaveCancel, initialIsEditing: props.initialIsEditing, content: contactInfo24x7, onSave: onSave, onCancel: onCancel, saveDisabled: contactInfo24X7State === contactInfo24x7 || isFtsContactUpdating, loadingIndicator: isFtsContactUpdating ? React.createElement(LoadingIndicator, { isInline: true }) : null },
137
+ React.createElement(InlineEdit, { labelProps: { htmlFor: 'open-case-24-7-contact' }, labelContent: React.createElement(Trans, null, "24x7 Contact"), allowInlineEdit: props.inlineEditable && !disableFtsNContact, hideSaveCancel: props.hideSaveCancel, initialIsEditing: props.initialIsEditing, content: contactInfo24x7, onSave: onSave, onCancel: onCancel, saveDisabled: isSaveDisabled, loadingIndicator: isFtsContactUpdating ? React.createElement(LoadingIndicator, { isInline: true }) : null },
136
138
  React.createElement(TextAreaAutosize, { id: "open-case-24-7-contact", className: `form-control`, name: "open-case-24-7-contact", value: contactInfo24X7State, onChange: onFtsContactChange, disabled: disableFtsNContact, "data-tracking-id": "open-case-24-7-contact" }),
137
139
  React.createElement("p", { className: "form-instructions" },
138
140
  React.createElement(Trans, null, "Please provide contact information where you can be reached at any time to help you with your case."))),
@@ -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,eA4OxD"}
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,eAwPxD"}
@@ -52,10 +52,12 @@ export default function UpdateSeverityModal(props) {
52
52
  const [currentSeverity, setCurrentSeverity] = useState(caseDetails.caseSeverity);
53
53
  // Modal cancel function which resets the field
54
54
  const onCancel = () => {
55
+ if (isCaseUpdating || isPostingComment)
56
+ return;
55
57
  onClose();
56
58
  setSeverityUpdating(caseOverviewDispatch, false);
57
- setNewSeverityValue([]);
58
59
  setCaseDetails(caseDispatch, { severity: currentSeverity });
60
+ setNewSeverityValue([]);
59
61
  setDescriptionValue('');
60
62
  };
61
63
  // To handle on successful submit
@@ -115,11 +117,16 @@ export default function UpdateSeverityModal(props) {
115
117
  yield updateCaseDetails(caseDispatch, caseDetails.caseNumber, {
116
118
  severity: currentSeverity,
117
119
  });
120
+ setDescriptionValue('');
118
121
  onClose();
122
+ setSeverityUpdating(caseOverviewDispatch, false);
119
123
  ToastNotification.addDangerMessage(t(`Couldn't post severity update comment. Please try again`));
120
124
  }
121
125
  }
122
126
  catch (e) {
127
+ yield updateCaseDetails(caseDispatch, caseDetails.caseNumber, {
128
+ severity: currentSeverity,
129
+ });
123
130
  onSuccessfulSubmit();
124
131
  ToastNotification.addDangerMessage(t('Severity failed to update'));
125
132
  }
@@ -152,8 +159,8 @@ export default function UpdateSeverityModal(props) {
152
159
  const isSubmitButtonDisabled = checkSeverityValid() && isTextAreaValid() ? false : true;
153
160
  // Update severity modal buttons
154
161
  const modalActions = [
155
- React.createElement(Button, { key: "submit", variant: "primary", onClick: onSubmit, isLoading: isCaseUpdating || isPostingComment, "data-tracking-id": "update-severity-submit", isDisabled: isSubmitButtonDisabled }, t('Submit')),
156
- React.createElement(Button, { key: "back", variant: "link", onClick: onCancel, "data-tracking-id": "update-severity-cancel" }, t('Cancel')),
162
+ React.createElement(Button, { key: "submit", variant: "primary", onClick: onSubmit, isLoading: isCaseUpdating || isPostingComment, "data-tracking-id": "update-severity-submit", isDisabled: isSubmitButtonDisabled || isCaseUpdating || isPostingComment }, t('Submit')),
163
+ React.createElement(Button, { key: "back", variant: "link", onClick: onCancel, "data-tracking-id": "update-severity-cancel", isDisabled: isCaseUpdating || isPostingComment }, t('Cancel')),
157
164
  ];
158
165
  // To handle severity change in the modal
159
166
  const onSeverityChange = (payload) => __awaiter(this, void 0, void 0, function* () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/troubleshoot",
3
- "version": "0.2.129",
3
+ "version": "0.2.132",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -143,5 +143,5 @@
143
143
  "not ie <= 11",
144
144
  "not op_mini all"
145
145
  ],
146
- "gitHead": "c3c7b3d58a29bcb5415583524cd0468ce67da0a6"
146
+ "gitHead": "33e34e81bbe7407a38cbbca6fa03125bad491706"
147
147
  }