@rh-support/troubleshoot 2.6.357 → 2.6.358

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 (39) hide show
  1. package/lib/esm/components/AccountInfo/OwnerSelector.js +4 -4
  2. package/lib/esm/components/CaseEditView/CaseDetailsErrorMessage.js +2 -2
  3. package/lib/esm/components/CaseEditView/CaseOverview/index.d.ts.map +1 -1
  4. package/lib/esm/components/CaseEditView/CaseOverview/index.js +7 -6
  5. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseDetailsManagement.d.ts.map +1 -1
  6. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseDetailsManagement.js +41 -8
  7. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseOpenshiftClusterId/CaseOpenshiftClusterId.js +10 -10
  8. package/lib/esm/components/CaseInformation/CaseLabels.d.ts.map +1 -1
  9. package/lib/esm/components/CaseInformation/CaseLabels.js +15 -12
  10. package/lib/esm/components/CaseInformation/Severity.d.ts.map +1 -1
  11. package/lib/esm/components/CaseInformation/Severity.js +16 -15
  12. package/lib/esm/components/CaseManagement/CaseLabelsCreate.d.ts.map +1 -1
  13. package/lib/esm/components/CaseManagement/CaseLabelsCreate.js +52 -21
  14. package/lib/esm/components/CaseManagement/NoClusterIDReasonSelector.d.ts.map +1 -1
  15. package/lib/esm/components/CaseManagement/NoClusterIDReasonSelector.js +1 -3
  16. package/lib/esm/components/CaseManagement/OpenShiftClusterId.d.ts.map +1 -1
  17. package/lib/esm/components/CaseManagement/OpenShiftClusterId.js +1 -1
  18. package/lib/esm/components/CaseManagement/OpenshiftDropdownV4.d.ts +0 -1
  19. package/lib/esm/components/CaseManagement/OpenshiftDropdownV4.d.ts.map +1 -1
  20. package/lib/esm/components/CaseManagement/OpenshiftDropdownV4.js +6 -12
  21. package/lib/esm/components/IdeaInformation/IdeaInformation.d.ts.map +1 -1
  22. package/lib/esm/components/IdeaInformation/IdeaInformation.js +11 -3
  23. package/lib/esm/components/UpdateSeverityModal/UpdateSeverityModal.d.ts.map +1 -1
  24. package/lib/esm/components/UpdateSeverityModal/UpdateSeverityModal.js +50 -44
  25. package/lib/esm/components/shared/fileUpload/reducer/AttachmentHelper.d.ts +1 -0
  26. package/lib/esm/components/shared/fileUpload/reducer/AttachmentHelper.d.ts.map +1 -1
  27. package/lib/esm/components/shared/fileUpload/reducer/AttachmentHelper.js +126 -54
  28. package/lib/esm/components/shared/fileUpload/useFileUploader.d.ts.map +1 -1
  29. package/lib/esm/components/shared/fileUpload/useFileUploader.js +6 -3
  30. package/lib/esm/components/wizardLayout/MainSection.d.ts.map +1 -1
  31. package/lib/esm/components/wizardLayout/MainSection.js +2 -1
  32. package/lib/esm/hooks/useCaseLabelLinkMutations.d.ts +2 -0
  33. package/lib/esm/hooks/useCaseLabelLinkMutations.d.ts.map +1 -1
  34. package/lib/esm/hooks/useCaseLabelLinkMutations.js +21 -28
  35. package/lib/esm/reducers/CaseHelpers.d.ts.map +1 -1
  36. package/lib/esm/reducers/CaseHelpers.js +5 -3
  37. package/lib/esm/reducers/CaseReducer.d.ts.map +1 -1
  38. package/lib/esm/reducers/CaseReducer.js +6 -2
  39. package/package.json +6 -6
@@ -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"}
@@ -8,13 +8,15 @@ import isEqual from 'lodash/isEqual';
8
8
  import React, { useContext, useEffect } from 'react';
9
9
  import { Trans, useTranslation } from 'react-i18next';
10
10
  import { useCaseDispatch, useCaseSelector } from '../../context/CaseContext';
11
+ import { useShowCaseGroupField } from '../../hooks/useCaseGroupUiState';
11
12
  import { setCaseDetails } from '../../reducers/CaseReducer';
12
- // import CaseGroup from '../CaseInformation/CaseGroup';
13
+ import CaseGroup from '../CaseInformation/CaseGroup';
13
14
  import { ContactPhoneNumber } from '../CaseInformation/ContactPhoneNumber';
14
15
  // TODO: Re-enable once phone number verification flow is fully supported with GraphQL
15
16
  // import { ContactPhoneNumberAlert } from '../CaseInformation/ContactPhoneNumberAlert';
16
17
  import Severity from '../CaseInformation/Severity';
17
18
  import SupportLevel from '../CaseInformation/SupportLevel';
19
+ import CaseLabelsCreate from '../CaseManagement/CaseLabelsCreate';
18
20
  import CaseLanguageSelector from '../CaseManagement/CaseLanguageSelector';
19
21
  // import { Cep } from '../CaseManagement/Cep';
20
22
  import OpenReferenceNumber from '../CaseManagement/OpenReferenceNumber';
@@ -32,6 +34,7 @@ export default function IdeaInformation() {
32
34
  selectedAccountDetails: state.selectedAccountDetails,
33
35
  }), isEqual);
34
36
  const caseDispatch = useCaseDispatch();
37
+ const showCaseGroupField = useShowCaseGroupField();
35
38
  const isMetadataLoading = () => {
36
39
  return !isMetadataLoadingError() && (loggedInUser.isFetching || selectedAccountDetails.isFetching);
37
40
  };
@@ -101,8 +104,13 @@ export default function IdeaInformation() {
101
104
  React.createElement(GridItem, { span: 12, xl2: 6, className: "pf-v6-u-mb-xl" },
102
105
  React.createElement(ContactPhoneNumber, null))),
103
106
  React.createElement(Grid, { hasGutter: true },
104
- React.createElement(GridItem, { span: 12, xl2: 6, className: "pf-v6-u-mb-xs" },
105
- React.createElement(CaseLanguageSelector, { isManageStep: true }))),
107
+ React.createElement(GridItem, { span: 12, xl2: showCaseGroupField ? 6 : 12, className: "pf-v6-u-mb-xs" },
108
+ React.createElement(CaseLanguageSelector, { isManageStep: true })),
109
+ showCaseGroupField && (React.createElement(GridItem, { span: 12, xl2: 6, className: "pf-v6-u-mb-xs" },
110
+ React.createElement(CaseGroup, { init: true })))),
111
+ React.createElement(Grid, { hasGutter: true },
112
+ React.createElement(GridItem, { span: 12, xl2: 12, className: "pf-v6-u-mb-xs" },
113
+ React.createElement(CaseLabelsCreate, null))),
106
114
  React.createElement(RHAssociatesSelector, null),
107
115
  React.createElement(OpenReferenceNumber, { inlineEditable: false, hideSaveCancel: true }))))));
108
116
  }
@@ -1 +1 @@
1
- {"version":3,"file":"UpdateSeverityModal.d.ts","sourceRoot":"","sources":["../../../../src/components/UpdateSeverityModal/UpdateSeverityModal.tsx"],"names":[],"mappings":"AAkCA,OAAO,KAAmE,MAAM,OAAO,CAAC;AAexF,UAAU,MAAM;IACZ,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,KAAK,EAAE,MAAM,qBAwoBxD"}
1
+ {"version":3,"file":"UpdateSeverityModal.d.ts","sourceRoot":"","sources":["../../../../src/components/UpdateSeverityModal/UpdateSeverityModal.tsx"],"names":[],"mappings":"AAiCA,OAAO,KAAmE,MAAM,OAAO,CAAC;AAexF,UAAU,MAAM;IACZ,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,KAAK,EAAE,MAAM,qBA+oBxD"}
@@ -11,7 +11,7 @@ import { useApolloClient } from '@apollo/client/react';
11
11
  import { Button, Dropdown, DropdownItem, DropdownList, Flex, FlexItem, MenuToggle, Modal, ModalBody, ModalFooter, ModalHeader, Spinner, TextArea, } from '@patternfly/react-core';
12
12
  import { ToastNotification } from '@rh-support/components';
13
13
  import { GlobalMetadataStateContext, useCanEditCase } from '@rh-support/react-context';
14
- import { autoEnableFtsOnCaseViewEditPage, isPremiumEntitlement, isSev1, PreviousCaseTypes, severitySort, showFtsOnCreateCasePage, } from '@rh-support/utils';
14
+ import { getFtsForSeverityChange, isPremiumEntitlement, isSev1, PreviousCaseTypes, severitySort, } from '@rh-support/utils';
15
15
  import { isUndefined } from 'lodash';
16
16
  import find from 'lodash/find';
17
17
  import includes from 'lodash/includes';
@@ -118,12 +118,9 @@ export default function UpdateSeverityModal(props) {
118
118
  // To update the state when severity changes
119
119
  const updateState = (value) => {
120
120
  const casePayload = { severity: value };
121
- // .. change fts on sev change only while creating case or wchen we change to sev1
122
- isEmpty(caseDetails.caseNumber) &&
123
- (casePayload.fts = showFtsOnCreateCasePage(caseDetails.entitlementSla, value));
124
- !isEmpty(caseDetails.caseNumber) &&
125
- autoEnableFtsOnCaseViewEditPage(caseDetails.entitlementSla, value) &&
126
- (casePayload.fts = true);
121
+ casePayload.fts = getFtsForSeverityChange(caseDetails.entitlementSla, value, {
122
+ isCaseEdit: !isEmpty(caseDetails.caseNumber),
123
+ });
127
124
  };
128
125
  // Modal cancel function which resets the field
129
126
  const onCancel = () => __awaiter(this, void 0, void 0, function* () {
@@ -169,19 +166,21 @@ export default function UpdateSeverityModal(props) {
169
166
  return '<h4>Contact Support Update</h4><p>User updated 24x7 contact information</p>';
170
167
  };
171
168
  const updateCaseFtsInfo = () => __awaiter(this, void 0, void 0, function* () {
169
+ const ftsUpdateComment = `${getFtsUpdateComment()}<h4>Description</h4><p>${descriptionValue.trim()}</p>`;
172
170
  try {
173
- const ftsUpdateComment = `${getFtsUpdateComment()}<h4>Description</h4><p>${descriptionValue.trim()}</p>`;
174
171
  yield updateSeverityViaGraphQL({
175
172
  severity: currentSeverity || caseDetails.caseSeverity,
176
173
  fts: localFts,
177
174
  contactInfo24x7: localFtsContact,
178
175
  });
179
- yield postComment({
176
+ ToastNotification.addSuccessMessage(t(`Case has been successfully updated`));
177
+ void postComment({
180
178
  commentBody: ftsUpdateComment === null || ftsUpdateComment === void 0 ? void 0 : ftsUpdateComment.trim(),
181
179
  contentType: 'markdown',
182
180
  updateDiscussionState: true,
181
+ }).catch((err) => {
182
+ caseUpdateError.showError(err, t(`Couldn't post severity update comment. Please try again`));
183
183
  });
184
- ToastNotification.addSuccessMessage(t(`Case has been successfully updated`));
185
184
  }
186
185
  catch (err) {
187
186
  caseUpdateError.showError(err, t(`Failed to update the case`));
@@ -190,6 +189,7 @@ export default function UpdateSeverityModal(props) {
190
189
  onClose();
191
190
  setDescriptionValue('');
192
191
  setIsUpdateClickedToShowError(false);
192
+ setSeverityUpdating(caseOverviewDispatch, false);
193
193
  }
194
194
  });
195
195
  const onSubmit = () => __awaiter(this, void 0, void 0, function* () {
@@ -216,48 +216,51 @@ export default function UpdateSeverityModal(props) {
216
216
  try {
217
217
  setSeverityUpdating(caseOverviewDispatch, true);
218
218
  yield updateSeverityViaGraphQL(updatedCaseDetails);
219
- try {
220
- yield postComment({
221
- commentBody: severityUpdateComment === null || severityUpdateComment === void 0 ? void 0 : severityUpdateComment.trim(),
222
- contentType: 'markdown',
223
- updateDiscussionState: true,
224
- });
219
+ setSeverityUpdating(caseOverviewDispatch, false);
220
+ const newSeverity = updatedCaseDetails['severity'];
221
+ setCurrentSeverity(newSeverity);
222
+ onSuccessfulSubmit();
223
+ ToastNotification.addSuccessMessage(t('Severity has been successfully updated'));
224
+ void (() => __awaiter(this, void 0, void 0, function* () {
225
225
  try {
226
- yield checkForCaseStatusToggleOnAttachOrComment(caseDispatch, loggedInUserRights.data.isInternal(), caseDetails.caseStatus, {
227
- apolloClient: client,
228
- caseNumber: caseDetails.caseNumber,
229
- existingCaseDetails,
230
- });
231
- setCurrentSeverity(updatedCaseDetails['severity']);
232
- onSuccessfulSubmit();
233
- ToastNotification.addSuccessMessage(t('Severity has been successfully updated'));
234
- }
235
- catch (e) {
236
226
  yield postComment({
237
- commentBody: severityUpdateFailedComment === null || severityUpdateFailedComment === void 0 ? void 0 : severityUpdateFailedComment.trim(),
227
+ commentBody: severityUpdateComment === null || severityUpdateComment === void 0 ? void 0 : severityUpdateComment.trim(),
238
228
  contentType: 'markdown',
239
229
  updateDiscussionState: true,
240
230
  });
241
- onClose();
242
- caseUpdateError.showError(e, t(`Failed to update case status. Please try again`));
231
+ try {
232
+ yield checkForCaseStatusToggleOnAttachOrComment(caseDispatch, loggedInUserRights.data.isInternal(), caseDetails.caseStatus, {
233
+ apolloClient: client,
234
+ caseNumber: caseDetails.caseNumber,
235
+ existingCaseDetails,
236
+ });
237
+ }
238
+ catch (e) {
239
+ yield postComment({
240
+ commentBody: severityUpdateFailedComment === null || severityUpdateFailedComment === void 0 ? void 0 : severityUpdateFailedComment.trim(),
241
+ contentType: 'markdown',
242
+ updateDiscussionState: true,
243
+ });
244
+ caseUpdateError.showError(e, t(`Failed to update case status. Please try again`));
245
+ yield updateSeverityViaGraphQL({
246
+ status: 'Waiting on Customer Action Required',
247
+ severity: updatedCaseDetails['severity'],
248
+ });
249
+ }
250
+ }
251
+ catch (e) {
252
+ caseUpdateError.showError(e, t(`Couldn't post severity update comment. Please try again`));
243
253
  yield updateSeverityViaGraphQL({
244
- status: 'Waiting on Customer Action Required',
245
- severity: updatedCaseDetails['severity'],
254
+ severity: caseDetails.caseSeverity,
246
255
  });
256
+ setCurrentSeverity(caseDetails.caseSeverity);
257
+ reUpdateSeverity(caseDetails.caseSeverity);
258
+ setSeverityUpdating(caseOverviewDispatch, false);
247
259
  }
248
- }
249
- catch (e) {
250
- onClose();
251
- caseUpdateError.showError(e, t(`Couldn't post severity update comment. Please try again`));
252
- yield updateSeverityViaGraphQL({
253
- severity: caseDetails.caseSeverity,
254
- });
255
- setDescriptionValue(descriptionValue === null || descriptionValue === void 0 ? void 0 : descriptionValue.trim());
256
- reUpdateSeverity(caseDetails.caseSeverity);
257
- setSeverityUpdating(caseOverviewDispatch, false);
258
- }
260
+ }))();
259
261
  }
260
262
  catch (e) {
263
+ setSeverityUpdating(caseOverviewDispatch, false);
261
264
  onClose();
262
265
  caseUpdateError.showError(e, t('Severity failed to update'));
263
266
  yield updateSeverityViaGraphQL({
@@ -353,8 +356,11 @@ export default function UpdateSeverityModal(props) {
353
356
  });
354
357
  }
355
358
  else {
356
- setLocalFts(false);
357
- setUpdatedCaseDetails({ severity: option.name, fts: false });
359
+ const ftsForSeverity = isIdea
360
+ ? false
361
+ : getFtsForSeverityChange(caseDetails.entitlementSla, option.name, { isCaseEdit: true });
362
+ setLocalFts(ftsForSeverity);
363
+ setUpdatedCaseDetails({ severity: option.name, fts: ftsForSeverity });
358
364
  }
359
365
  setCurrentSeverity(option.name);
360
366
  updateState(option.name);
@@ -37,6 +37,7 @@ export declare const hasQueuedAttachmentUploads: (selectedLocalFiles: IFileLocal
37
37
  export declare const hasAbortedOrFailedAttachments: (selectedLocalFiles: IFileLocal[]) => boolean;
38
38
  /** True when at least one non-deleted file remains in the upload queue (UI visibility). */
39
39
  export declare const hasSomeSelectedFiles: (selectedLocalFiles: IFileLocal[]) => boolean;
40
+ export declare const clearUploadRuntimeState: () => void;
40
41
  export declare const isUploadingAttachment: (selectedLocalFiles: IFileLocal[]) => boolean;
41
42
  export declare const isAnalysingAnyAttachment: (selectedLocalFiles: IFileLocal[]) => boolean;
42
43
  export declare const canShowProgressBar: (file: IFileLocal) => boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"AttachmentHelper.d.ts","sourceRoot":"","sources":["../../../../../../src/components/shared/fileUpload/reducer/AttachmentHelper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAC;AAC3F,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AAEvF,OAAO,EACH,iBAAiB,EAWpB,MAAM,mBAAmB,CAAC;AAO3B,OAAO,EACH,uBAAuB,EAEvB,6BAA6B,EAK7B,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,eAAe,EAMf,qBAAqB,EACxB,MAAM,qB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Y,EAAE,MAAM,EACpB,SAAS,EAAE,UAAU,EACrB,WAAW,EAAE,OAAO,EACpB,SAAS,EAAE,MAAM,EACjB,gBAAgB,CAAC,EAAE,qBAAqB,iBA6D3C;AAED,wBAAsB,sBAAsB,CACxC,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,OAAO,EACpB,QAAQ,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,IAAI,GAClD,OAAO,CAAC,gBAAgB,CAAC,CAwB3B;AAID,wBAAsB,2BAA2B,CAC7C,QAAQ,KAAA,EACR,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,UAAU,EACrB,SAAS,EAAE,MAAM,EACjB,YAAY,CAAC,EAAE,iBAAiB,EAChC,gBAAgB,CAAC,EAAE,MAAM,iBA4E5B;AAED,wBAAsB,uBAAuB,CAAC,QAAQ,KAAA,EAAE,SAAS,EAAE,MAAM,iBA+CxE;AAED,wBAAgB,+BAA+B,CAAC,UAAU,EAAE,UAAU,EAAE,WAEvE;AAED,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,UAAU,EAAE,WAKzD;AAED,eAAO,MAAM,uBAAuB,GAAI,YAAY,UAAU,KAAG,OAShE,CAAC;AAKF,eAAO,MAAM,2BAA2B,UAOvC,CAAC;AAEF,eAAO,MAAM,8BAA8B,GAAI,oBAAoB,UAAU,EAAE,YAE9E,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,aAAQ,SAUvC,CAAC"}
1
+ {"version":3,"file":"AttachmentHelper.d.ts","sourceRoot":"","sources":["../../../../../../src/components/shared/fileUpload/reducer/AttachmentHelper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAC;AAC3F,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AAEvF,OAAO,EACH,iBAAiB,EAWpB,MAAM,mBAAmB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Q,KAAA,EACR,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,UAAU,EAAE,EACxB,WAAW,EAAE,OAAO,iBAMvB;AAED,wBAAsB,0BAA0B,CAC5C,QAAQ,KAAA,EACR,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,UAAU,EACrB,WAAW,EAAE,OAAO,EACpB,SAAS,EAAE,MAAM,EACjB,gBAAgB,CAAC,EAAE,qBAAqB,iBA6D3C;AAED,wBAAsB,sBAAsB,CACxC,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,OAAO,EACpB,QAAQ,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,IAAI,GAClD,OAAO,CAAC,gBAAgB,CAAC,CAwB3B;AAID,wBAAsB,2BAA2B,CAC7C,QAAQ,KAAA,EACR,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,UAAU,EACrB,SAAS,EAAE,MAAM,EACjB,YAAY,CAAC,EAAE,iBAAiB,EAChC,gBAAgB,CAAC,EAAE,MAAM,iBA4E5B;AAED,wBAAsB,uBAAuB,CAAC,QAAQ,KAAA,EAAE,SAAS,EAAE,MAAM,iBA+CxE;AAED,wBAAgB,+BAA+B,CAAC,UAAU,EAAE,UAAU,EAAE,WAEvE;AAED,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,UAAU,EAAE,WAKzD;AAED,eAAO,MAAM,uBAAuB,GAAI,YAAY,UAAU,KAAG,OAShE,CAAC;AAKF,eAAO,MAAM,2BAA2B,UAOvC,CAAC;AAEF,eAAO,MAAM,8BAA8B,GAAI,oBAAoB,UAAU,EAAE,YAE9E,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,aAAQ,SAUvC,CAAC"}
@@ -11,41 +11,54 @@ import { Config, pcm, sessionAttachments } from '@cee-eng/hydrajs';
11
11
  import { ToastNotification } from '@rh-support/components';
12
12
  import { CaseAttachmentUploadError, deleteCaseAttachment, fetchCaseDetailsByCaseNumber, GET_CONTENT_DOCUMENT_IDS, getText, MultipartUploadError, pendoTrackEvent, pollAttachmentUploadStatus, pollContentVersionStatus, uploadCaseAttachment, } from '@rh-support/utils';
13
13
  import find from 'lodash/find';
14
- import forEach from 'lodash/forEach';
15
14
  import includes from 'lodash/includes';
16
15
  import isEmpty from 'lodash/isEmpty';
17
16
  import isUndefined from 'lodash/isUndefined';
18
17
  import { AnalysisStatusConstants, AttachmentReducerConstants, defaultAnalysisMetadata, defaultUploadMetadata, onFilesSelect, resetAttachment, udpateFileUploadMetadata, updateAnalysisMetadata, updateAttachmentIdForFile, UploadStatusConstants, } from './AttachmentReducer';
19
18
  import { FileStatusHelper } from './FileStatusHelper';
20
19
  export const onDrop = (dispatchToAttachmentReducer, isSessionId, isPrivate = false) => (acceptedFiles) => {
21
- const onFilesSelectLocal = (caseFiles) => {
22
- onFilesSelect(dispatchToAttachmentReducer, caseFiles);
23
- };
24
- forEach(acceptedFiles, (file) => __awaiter(void 0, void 0, void 0, function* () {
25
- try {
26
- const fileAccessDetails = yield getFileAccessDetails(file);
27
- const localFile = {
28
- name: file.name,
29
- size: file.size,
30
- lastModified: file.lastModified,
31
- type: file.type,
32
- description: '',
33
- isPrivate: isPrivate,
34
- uploadProgress: Object.assign(Object.assign({}, defaultUploadMetadata), { uploadStatus: isSessionId
35
- ? UploadStatusConstants.attachedOnSession
36
- : UploadStatusConstants.attachedOnCase }),
37
- analysisMetadata: Object.assign({}, defaultAnalysisMetadata),
38
- uploadability: Object.assign({}, fileAccessDetails),
39
- includeResults: true,
40
- };
41
- onFilesSelectLocal({ selectedLocalFiles: [localFile], selectedOriginalFiles: [file] });
42
- }
43
- catch (e) {
44
- if (!e.ableToUpload) {
45
- ToastNotification.addDangerMessage(e.ableToUploadMessage);
20
+ if (!acceptedFiles.length) {
21
+ return;
22
+ }
23
+ void (() => __awaiter(void 0, void 0, void 0, function* () {
24
+ const results = yield Promise.all(acceptedFiles.map((file) => __awaiter(void 0, void 0, void 0, function* () {
25
+ try {
26
+ const fileAccessDetails = yield getFileAccessDetails(file);
27
+ const localFile = {
28
+ name: file.name,
29
+ size: file.size,
30
+ lastModified: file.lastModified,
31
+ type: file.type,
32
+ description: '',
33
+ isPrivate: isPrivate,
34
+ uploadProgress: Object.assign(Object.assign({}, defaultUploadMetadata), { uploadStatus: isSessionId
35
+ ? UploadStatusConstants.attachedOnSession
36
+ : UploadStatusConstants.attachedOnCase }),
37
+ analysisMetadata: Object.assign({}, defaultAnalysisMetadata),
38
+ uploadability: Object.assign({}, fileAccessDetails),
39
+ includeResults: true,
40
+ };
41
+ return { localFile, file };
46
42
  }
43
+ catch (e) {
44
+ if (!e.ableToUpload) {
45
+ ToastNotification.addDangerMessage(e.ableToUploadMessage);
46
+ }
47
+ return null;
48
+ }
49
+ })));
50
+ const selectedLocalFiles = [];
51
+ const selectedOriginalFiles = [];
52
+ results.forEach((result) => {
53
+ if (result) {
54
+ selectedLocalFiles.push(result.localFile);
55
+ selectedOriginalFiles.push(result.file);
56
+ }
57
+ });
58
+ if (selectedLocalFiles.length > 0) {
59
+ onFilesSelect(dispatchToAttachmentReducer, { selectedLocalFiles, selectedOriginalFiles });
47
60
  }
48
- }));
61
+ }))();
49
62
  };
50
63
  const getFileAccessDetails = (file) => __awaiter(void 0, void 0, void 0, function* () {
51
64
  const fileName = (file === null || file === void 0 ? void 0 : file.name) || '';
@@ -101,6 +114,40 @@ export const hasAbortedOrFailedAttachments = (selectedLocalFiles) => !isEmpty(fi
101
114
  isUploadFailed(localFile.uploadProgress.uploadStatus)));
102
115
  /** True when at least one non-deleted file remains in the upload queue (UI visibility). */
103
116
  export const hasSomeSelectedFiles = (selectedLocalFiles) => !isEmpty(find(selectedLocalFiles, (localFile) => !isFileDeleted(localFile.uploadProgress.uploadStatus)));
117
+ const MAX_CONCURRENT_SESSION_UPLOADS = 3;
118
+ const SESSION_UPLOAD_MAX_ATTEMPTS = 2;
119
+ const SESSION_UPLOAD_RETRY_DELAY_MS = 500;
120
+ const activeUploadLockKeys = new Set();
121
+ const sessionUploadQueues = new Map();
122
+ const buildUploadLockKey = (idToUploadTo, localFile) => `${idToUploadTo}:${localFile.name}:${localFile.size}:${localFile.lastModified}`;
123
+ export const clearUploadRuntimeState = () => {
124
+ activeUploadLockKeys.clear();
125
+ sessionUploadQueues.clear();
126
+ };
127
+ const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
128
+ const acquireSessionUploadSlot = (sessionId) => new Promise((resolve) => {
129
+ const tryAcquire = () => {
130
+ var _a;
131
+ const queue = (_a = sessionUploadQueues.get(sessionId)) !== null && _a !== void 0 ? _a : { activeCount: 0, waiting: [] };
132
+ sessionUploadQueues.set(sessionId, queue);
133
+ if (queue.activeCount < MAX_CONCURRENT_SESSION_UPLOADS) {
134
+ queue.activeCount++;
135
+ resolve(() => {
136
+ queue.activeCount--;
137
+ const next = queue.waiting.shift();
138
+ if (next) {
139
+ next();
140
+ }
141
+ else if (queue.activeCount === 0) {
142
+ sessionUploadQueues.delete(sessionId);
143
+ }
144
+ });
145
+ return;
146
+ }
147
+ queue.waiting.push(tryAcquire);
148
+ };
149
+ tryAcquire();
150
+ });
104
151
  export const isUploadingAttachment = (selectedLocalFiles) => !isEmpty(find(selectedLocalFiles, (localFile) => isUploading(localFile.uploadProgress.uploadStatus)));
105
152
  export const isAnalysingAnyAttachment = (selectedLocalFiles) => !isEmpty(find(selectedLocalFiles, (localFile) => isAnalysingFile(localFile.analysisMetadata.analysisStatus)));
106
153
  export const canShowProgressBar = (file) => isUploading(file.uploadProgress.uploadStatus) || isAnalysingFile(file.analysisMetadata.analysisStatus);
@@ -150,29 +197,25 @@ needsAnalyzing = false, isSessionId = false, slowUploadConfig = {}, apolloClient
150
197
  if (eligibleCount === 0) {
151
198
  return;
152
199
  }
153
- const startEligibleUploads = () => {
154
- eligibleIndices.forEach((index) => {
155
- const localFile = caseFiles.selectedLocalFiles[index];
156
- uploadFile({
157
- dispatch,
158
- idToUploadTo,
159
- localFile,
160
- originalFile: caseFiles.selectedOriginalFiles[index],
161
- index,
162
- needsAnalyzing,
163
- isSessionId,
164
- slowUploadConfig,
165
- apolloClient,
166
- caseSalesforceId,
167
- onCaseFileUploaded,
168
- });
200
+ const startEligibleUpload = (index) => {
201
+ const localFile = caseFiles.selectedLocalFiles[index];
202
+ return uploadFile({
203
+ dispatch,
204
+ idToUploadTo,
205
+ localFile,
206
+ originalFile: caseFiles.selectedOriginalFiles[index],
207
+ index,
208
+ needsAnalyzing,
209
+ isSessionId,
210
+ slowUploadConfig,
211
+ apolloClient,
212
+ caseSalesforceId,
213
+ onCaseFileUploaded,
169
214
  });
170
215
  };
171
- if (isUploadingAttachment(caseFiles.selectedLocalFiles)) {
172
- startEligibleUploads();
173
- return;
174
- }
175
- startEligibleUploads();
216
+ eligibleIndices.forEach((index) => {
217
+ void startEligibleUpload(index);
218
+ });
176
219
  });
177
220
  export const uploadFile = (_a) => __awaiter(void 0, [_a], void 0, function* ({ dispatch, idToUploadTo, localFile, originalFile, index,
178
221
  // isSecureSupport = false, // TODO: Re-enable when Hydra/GraphQL attachment APIs support secure support again
@@ -186,6 +229,12 @@ needsAnalyzing = false, isSessionId = false, slowUploadConfig = {}, apolloClient
186
229
  if (isUploading(uploadStatus) || isUploadComplete(uploadStatus)) {
187
230
  return;
188
231
  }
232
+ const uploadLockKey = buildUploadLockKey(idToUploadTo, localFile);
233
+ if (activeUploadLockKeys.has(uploadLockKey)) {
234
+ return;
235
+ }
236
+ activeUploadLockKeys.add(uploadLockKey);
237
+ let releaseSessionUploadSlot;
189
238
  // For Metadata you must add x-amz-meta
190
239
  // only add x-amz-meta if the value is present else the aws throws signature invalid errors
191
240
  const putObjectRequest = {
@@ -241,12 +290,31 @@ needsAnalyzing = false, isSessionId = false, slowUploadConfig = {}, apolloClient
241
290
  updateUploadMetadata(dispatch, index, initialUploadPayload);
242
291
  let attachmentId = '';
243
292
  if (isSessionId) {
244
- attachmentId = yield sessionAttachments.uploadSessionAttachmentS3(idToUploadTo, {
245
- description: localFile.description,
246
- fileName: localFile.name,
247
- sessionId: idToUploadTo,
248
- size: localFile.size,
249
- }, putObjectRequest, listener, true, { partSize: 5 * 1024 * 1024, queueSize: 5 }, Object.assign(Object.assign({}, slowUploadConfig), { preferSlowS3Upload: Config.userConfig.preferSlowS3Upload }));
293
+ releaseSessionUploadSlot = yield acquireSessionUploadSlot(idToUploadTo);
294
+ for (let attempt = 1; attempt <= SESSION_UPLOAD_MAX_ATTEMPTS; attempt++) {
295
+ try {
296
+ attachmentId = yield sessionAttachments.uploadSessionAttachmentS3(idToUploadTo, {
297
+ description: localFile.description,
298
+ fileName: localFile.name,
299
+ sessionId: idToUploadTo,
300
+ size: localFile.size,
301
+ }, putObjectRequest, listener, true, { partSize: 5 * 1024 * 1024, queueSize: 5 }, Object.assign(Object.assign({}, slowUploadConfig), { preferSlowS3Upload: Config.userConfig.preferSlowS3Upload }));
302
+ break;
303
+ }
304
+ catch (error) {
305
+ const isUserAbort = (error === null || error === void 0 ? void 0 : error.message) === 'Request aborted by user';
306
+ if (isUserAbort || attempt >= SESSION_UPLOAD_MAX_ATTEMPTS) {
307
+ throw error;
308
+ }
309
+ updateUploadMetadata(dispatch, index, {
310
+ uploadStatus: UploadStatusConstants.uploadingOnSession,
311
+ uploadErrorMessage: '',
312
+ percentUploaded: 0,
313
+ onAbort: undefined,
314
+ });
315
+ yield delay(SESSION_UPLOAD_RETRY_DELAY_MS * attempt);
316
+ }
317
+ }
250
318
  }
251
319
  else {
252
320
  // Mirror master Hydra listener behavior for circular progress + abort button.
@@ -372,6 +440,10 @@ needsAnalyzing = false, isSessionId = false, slowUploadConfig = {}, apolloClient
372
440
  updateUploadMetadata(dispatch, index, uploadErrorPayload);
373
441
  }
374
442
  }
443
+ finally {
444
+ releaseSessionUploadSlot === null || releaseSessionUploadSlot === void 0 ? void 0 : releaseSessionUploadSlot();
445
+ activeUploadLockKeys.delete(uploadLockKey);
446
+ }
375
447
  });
376
448
  export function doSosReportAnalysisForAllFiles(dispatch, idToUploadTo, localFiles, isSessionId) {
377
449
  return __awaiter(this, void 0, void 0, function* () {
@@ -1 +1 @@
1
- {"version":3,"file":"useFileUploader.d.ts","sourceRoot":"","sources":["../../../../../src/components/shared/fileUpload/useFileUploader.tsx"],"names":[],"mappings":"AAaA,OAAO,KAA8D,MAAM,OAAO,CAAC;AAgBnF,OAAO,EACH,UAAU,EAKb,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAKnD,wBAAgB,eAAe,CAAC,KAAK,EAAE,wBAAwB;gCA0JjB,MAAM;gCAYA,UAAU,mBAAmB,MAAM,WAAW,UAAU;oCAOpD,MAAM,QAAQ,UAAU;wBAtGzD,KAAK,CAAC,UAAU,CAAC,iBAAiB,EAAE,UAAU,CAAC;4BAsJ3B,MAAM;kCA9DN,MAAM;EAwFhD"}
1
+ {"version":3,"file":"useFileUploader.d.ts","sourceRoot":"","sources":["../../../../../src/components/shared/fileUpload/useFileUploader.tsx"],"names":[],"mappings":"AAaA,OAAO,KAA8D,MAAM,OAAO,CAAC;AAgBnF,OAAO,EACH,UAAU,EAKb,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAKnD,wBAAgB,eAAe,CAAC,KAAK,EAAE,wBAAwB;gCA8JjB,MAAM;gCAYA,UAAU,mBAAmB,MAAM,WAAW,UAAU;oCAOpD,MAAM,QAAQ,UAAU;wBAxGzD,KAAK,CAAC,UAAU,CAAC,iBAAiB,EAAE,UAAU,CAAC;4BAwJ3B,MAAM;kCA9DN,MAAM;EAwFhD"}
@@ -47,6 +47,8 @@ export function useFileUploader(props) {
47
47
  useBrowserAPIForDetection,
48
48
  }), [checkForS3SlowUploads, useBrowserAPIForDetection]);
49
49
  const isInitialMountRef = useRef(true);
50
+ const caseFilesRef = useRef(caseFiles);
51
+ caseFilesRef.current = caseFiles;
50
52
  const selectedLocalFiles = attachmentState.caseFiles.selectedLocalFiles;
51
53
  const prevSelectedFiles = usePrevious(selectedLocalFiles);
52
54
  const resolveCaseSalesforceId = useCallback(() => __awaiter(this, void 0, void 0, function* () {
@@ -82,7 +84,7 @@ export function useFileUploader(props) {
82
84
  uploadAllFiles({
83
85
  dispatch,
84
86
  idToUploadTo: idToUploadTo || sessionId,
85
- caseFiles,
87
+ caseFiles: caseFilesRef.current,
86
88
  needsAnalyzing,
87
89
  isSessionId,
88
90
  slowUploadConfig,
@@ -92,7 +94,6 @@ export function useFileUploader(props) {
92
94
  });
93
95
  }), [
94
96
  apolloClient,
95
- caseFiles,
96
97
  dispatch,
97
98
  idToUploadTo,
98
99
  isSessionId,
@@ -107,7 +108,9 @@ export function useFileUploader(props) {
107
108
  sessionRestoreDispatch,
108
109
  slowUploadConfig,
109
110
  ]);
110
- const debouncedAutoUploadOnSelect = useMemo(() => debounce(() => void onUploadAll(), AUTO_UPLOAD_ON_SELECT_DEBOUNCE_MS), [onUploadAll]);
111
+ const onUploadAllRef = useRef(onUploadAll);
112
+ onUploadAllRef.current = onUploadAll;
113
+ const debouncedAutoUploadOnSelect = useMemo(() => debounce(() => void onUploadAllRef.current(), AUTO_UPLOAD_ON_SELECT_DEBOUNCE_MS), []);
111
114
  useEffect(() => () => debouncedAutoUploadOnSelect.cancel(), [debouncedAutoUploadOnSelect]);
112
115
  useEffect(() => {
113
116
  if (isInitialMountRef.current) {
@@ -1 +1 @@
1
- {"version":3,"file":"MainSection.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/MainSection.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,UAAU,MAAM;IACZ,OAAO,EAAE,gBAAgB,CAAC;IAC1B,KAAK,EAAE,MAAM,GAAG,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;IAC5C,QAAQ,EAAE,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;IACtC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;IACnD,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAKD,QAAA,MAAM,WAAW;;;CAkFhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"MainSection.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/MainSection.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,UAAU,MAAM;IACZ,OAAO,EAAE,gBAAgB,CAAC;IAC1B,KAAK,EAAE,MAAM,GAAG,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;IAC5C,QAAQ,EAAE,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;IACtC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;IACnD,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAKD,QAAA,MAAM,WAAW;;;CAkFhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { Alert } from '@patternfly/react-core';
2
2
  import { ErrorBoundary, LoadingIndicator } from '@rh-support/components';
3
3
  import { GlobalMetadataStateContext } from '@rh-support/react-context';
4
+ import { getCssPortalUrl } from '@rh-support/utils';
4
5
  import isEqual from 'lodash/isEqual';
5
6
  import React, { useContext } from 'react';
6
7
  import { useCaseSelector } from '../../context/CaseContext';
@@ -26,7 +27,7 @@ const MainSection = (props) => {
26
27
  "To adhere to data regulations, open this case through",
27
28
  ' ',
28
29
  React.createElement("b", null,
29
- React.createElement("a", { href: "https://govsupport.redhat.com/css/s/", target: "_blank", rel: "noopener noreferrer", "data-tracking-id": "stateside-support-link" }, "Confirmed Sovereign Support")),
30
+ React.createElement("a", { href: getCssPortalUrl(), target: "_blank", rel: "noopener noreferrer", "data-tracking-id": "stateside-support-link" }, "Confirmed Sovereign Support")),
30
31
  ' ',
31
32
  "instead of traditional support."))),
32
33
  React.createElement(LoadingIndicator, { show: props.isLoading, size: "lg" }),
@@ -11,10 +11,12 @@ interface UseCaseLabelLinksResult {
11
11
  assignedLinks: LabelLink[];
12
12
  selectedLabelIds: string[];
13
13
  loading: boolean;
14
+ error: Error | undefined;
14
15
  mutating: boolean;
15
16
  setAssignedLinks: React.Dispatch<React.SetStateAction<LabelLink[]>>;
16
17
  createLink: (caseId: string, labelId: string) => Promise<string | undefined>;
17
18
  deleteLink: (linkId: string) => Promise<void>;
19
+ refetch: () => Promise<void>;
18
20
  }
19
21
  export declare function useCaseLabelLinks(salesforceAccountId?: string, caseId?: string): UseCaseLabelLinksResult;
20
22
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"useCaseLabelLinkMutations.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCaseLabelLinkMutations.ts"],"names":[],"mappings":"AAoBA,MAAM,WAAW,WAAW;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,SAAS;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;C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