@rh-support/troubleshoot 2.6.303 → 2.6.304
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.
- package/lib/esm/components/CaseEditView/Case.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Case.js +5 -17
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseAttachment.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseAttachment.js +69 -21
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.js +53 -72
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useMarkdownFileUploader.d.ts +1 -2
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useMarkdownFileUploader.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useMarkdownFileUploader.js +13 -8
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.d.ts +2 -0
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.js +63 -26
- package/lib/esm/components/CaseInformation/FileDiag.d.ts.map +1 -1
- package/lib/esm/components/CaseInformation/FileDiag.js +10 -3
- package/lib/esm/components/ConfirmationModals/NoAttachmentSelectedModal.d.ts.map +1 -1
- package/lib/esm/components/ConfirmationModals/NoAttachmentSelectedModal.js +5 -3
- package/lib/esm/components/SubmitCase/SubmitCase.d.ts.map +1 -1
- package/lib/esm/components/SubmitCase/SubmitCase.js +1 -1
- package/lib/esm/components/shared/fileUpload/FileUploader.d.ts.map +1 -1
- package/lib/esm/components/shared/fileUpload/FileUploader.js +1 -1
- package/lib/esm/components/shared/fileUpload/WidgetFileUploader.d.ts.map +1 -1
- package/lib/esm/components/shared/fileUpload/WidgetFileUploader.js +2 -2
- package/lib/esm/components/shared/fileUpload/fileSelectors/FileSelectorButton.d.ts +1 -1
- package/lib/esm/components/shared/fileUpload/fileSelectors/FileSelectorButton.d.ts.map +1 -1
- package/lib/esm/components/shared/fileUpload/reducer/AttachmentHelper.d.ts +8 -7
- package/lib/esm/components/shared/fileUpload/reducer/AttachmentHelper.d.ts.map +1 -1
- package/lib/esm/components/shared/fileUpload/reducer/AttachmentHelper.js +39 -48
- package/lib/esm/components/shared/fileUpload/types/index.d.ts +2 -1
- package/lib/esm/components/shared/fileUpload/types/index.d.ts.map +1 -1
- package/lib/esm/components/shared/fileUpload/useFileUploader.d.ts +2 -2
- package/lib/esm/components/shared/fileUpload/useFileUploader.d.ts.map +1 -1
- package/lib/esm/components/shared/fileUpload/useFileUploader.js +38 -14
- package/lib/esm/hooks/useS3Upload.d.ts +5 -4
- package/lib/esm/hooks/useS3Upload.d.ts.map +1 -1
- package/lib/esm/hooks/useS3Upload.js +25 -30
- package/lib/esm/reducers/CaseDetailsPageReducer.d.ts +2 -1
- package/lib/esm/reducers/CaseDetailsPageReducer.d.ts.map +1 -1
- package/lib/esm/reducers/CaseDetailsPageReducer.js +12 -4
- package/lib/esm/reducers/CaseDiscussionTabReducer.d.ts +2 -1
- package/lib/esm/reducers/CaseDiscussionTabReducer.d.ts.map +1 -1
- package/lib/esm/reducers/CaseDiscussionTabReducer.js +11 -4
- package/package.json +6 -6
|
@@ -7,46 +7,43 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
// TODO: Re-enable after GraphQL migration of attachments
|
|
11
|
-
// import { IAttachment } from '@cee-eng/hydrajs/@types/models/attachment';
|
|
12
10
|
import { Button, ButtonVariant, Checkbox } from '@patternfly/react-core';
|
|
11
|
+
import PlusIcon from '@patternfly/react-icons/dist/js/icons/plus-icon';
|
|
13
12
|
import { EditorMode, LoadingIndicator, MarkdownEditor, ToastNotification, usePrevious } from '@rh-support/components';
|
|
14
13
|
import { GlobalMetadataStateContext, useCanEditCase, useUserPreferences } from '@rh-support/react-context';
|
|
15
|
-
import { ability, CaseDiscussionFields, resourceActions, resources } from '@rh-support/user-permissions';
|
|
14
|
+
import { ability, CaseDiscussionFields, CaseListFields, resourceActions, resources, } from '@rh-support/user-permissions';
|
|
16
15
|
import isEmpty from 'lodash/isEmpty';
|
|
17
16
|
import isEqual from 'lodash/isEqual';
|
|
18
17
|
import React, { useCallback, useContext, useEffect, useRef, useState } from 'react';
|
|
18
|
+
import { useDropzone } from 'react-dropzone';
|
|
19
19
|
import { Trans, useTranslation } from 'react-i18next';
|
|
20
20
|
import { useCaseDispatch, useCaseSelector } from '../../../../context/CaseContext';
|
|
21
21
|
import { useCreateCaseComment } from '../../../../hooks/useCaseComments';
|
|
22
22
|
import { useCaseUpdateErrorMessage } from '../../../../hooks/useCaseUpdateErrorMessage';
|
|
23
23
|
import { checkForCaseStatusToggleOnAttachOrComment } from '../../../../reducers/CaseReducer';
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// AttachmentDispatchContext,
|
|
28
|
-
// AttachmentStateContext,
|
|
29
|
-
// hasSomeSelectedFiles,
|
|
30
|
-
// hasSomeUnUploadedAttachments,
|
|
31
|
-
// isUploadingAttachment,
|
|
32
|
-
// resetAttachment,
|
|
33
|
-
// } from '../../../shared/fileUpload';
|
|
34
|
-
// import FileSelectorButton from '../../../shared/fileUpload/fileSelectors/FileSelectorButton';
|
|
35
|
-
// import FileUpload from '../../../shared/fileUpload/FileUpload';
|
|
24
|
+
import { AttachmentDispatchContext, AttachmentStateContext, hasSomeSelectedFiles, hasSomeUnUploadedAttachments, isUploadingAttachment, resetAttachment, } from '../../../shared/fileUpload';
|
|
25
|
+
import FileSelectorButton from '../../../shared/fileUpload/fileSelectors/FileSelectorButton';
|
|
26
|
+
import FileUpload from '../../../shared/fileUpload/FileUpload';
|
|
36
27
|
import { PDFContext } from '../../PDFContainer';
|
|
37
|
-
|
|
38
|
-
// import { useAttachmentUploadCompletion } from './PostComment/useAttachmentUploadCompletion';
|
|
28
|
+
import { useAttachmentUploadCompletion } from './PostComment/useAttachmentUploadCompletion';
|
|
39
29
|
import { useCommentDrafts } from './PostComment/useCommentDrafts';
|
|
40
|
-
|
|
30
|
+
import { useMarkdownFileUploader } from './PostComment/useMarkdownFileUploader';
|
|
41
31
|
import { VerifyCaseStatusModal } from './VerifyCaseStatusModal/VerifyCaseStatusModal';
|
|
42
32
|
export function PostComment(props) {
|
|
43
|
-
var _a;
|
|
33
|
+
var _a, _b, _c;
|
|
44
34
|
const { t } = useTranslation();
|
|
45
35
|
const caseUpdateError = useCaseUpdateErrorMessage();
|
|
46
36
|
let { caseNumber } = props;
|
|
47
37
|
const [isTextAreaFocused, setIsTextAreaFocused] = useState(false);
|
|
38
|
+
const canAddAttachments = ability.can(resourceActions.PATCH, resources.CASE_CREATE, CaseListFields.ATTACHMENTS);
|
|
48
39
|
const canPostPrivateComments = ability.can(resourceActions.PATCH, resources.CASE_COMMENTS, CaseDiscussionFields.POST_PRIVATE_COMMENT);
|
|
49
40
|
const { createComment, loading: isPostingComment } = useCreateCaseComment();
|
|
41
|
+
const dispatchToAttachmentReducer = useContext(AttachmentDispatchContext);
|
|
42
|
+
const { attachmentState } = useContext(AttachmentStateContext);
|
|
43
|
+
const isUploadingAttachmentPrevious = useRef(false);
|
|
44
|
+
const isUploadingAttachments = isUploadingAttachment(attachmentState.caseFiles.selectedLocalFiles);
|
|
45
|
+
const hasSomeUnUploadedFiles = hasSomeUnUploadedAttachments(attachmentState.caseFiles.selectedLocalFiles);
|
|
46
|
+
const hasSomeSelectedFilesLocal = hasSomeSelectedFiles(attachmentState.caseFiles.selectedLocalFiles);
|
|
50
47
|
const [isPublic, setIsPublic] = useState(props.defaultIsPublic === null ? true : props.defaultIsPublic);
|
|
51
48
|
const [commentType, setCommentType] = useState(EditorMode.PLAIN);
|
|
52
49
|
const [commentSignature, setCommentSignature] = useState('');
|
|
@@ -83,11 +80,21 @@ export function PostComment(props) {
|
|
|
83
80
|
const [cssCommentAgreed, setCssCommentAgreed] = useState(false);
|
|
84
81
|
const [isProcessing, setIsProcessing] = useState(false);
|
|
85
82
|
const { globalMetadataState: { loggedInUser, loggedInUserRights, loggedInUsersAccount }, } = useContext(GlobalMetadataStateContext);
|
|
83
|
+
const { onFileAttach, cancelFileUpload } = useMarkdownFileUploader({
|
|
84
|
+
caseNumber,
|
|
85
|
+
onAttachmentAdded: (_a = props.onAttachmentAdded) !== null && _a !== void 0 ? _a : (() => undefined),
|
|
86
|
+
});
|
|
87
|
+
const { getRootProps, getInputProps } = useDropzone({
|
|
88
|
+
onDrop: (files) => onFileAttach(files, isPublic),
|
|
89
|
+
multiple: false,
|
|
90
|
+
noClick: true,
|
|
91
|
+
noKeyboard: true,
|
|
92
|
+
});
|
|
86
93
|
const { status, caseSalesforceId } = useCaseSelector((state) => ({
|
|
87
94
|
status: state.caseDetails.status,
|
|
88
95
|
caseSalesforceId: state.caseDetails.id,
|
|
89
96
|
}), isEqual);
|
|
90
|
-
const isConfirmedStateSideSupport = (
|
|
97
|
+
const isConfirmedStateSideSupport = (_b = loggedInUsersAccount === null || loggedInUsersAccount === void 0 ? void 0 : loggedInUsersAccount.data) === null || _b === void 0 ? void 0 : _b.hasConfirmedStatesideSupport;
|
|
91
98
|
const caseDispatch = useCaseDispatch();
|
|
92
99
|
const [isCommentTooLong, setIsCommentTooLong] = useState(false);
|
|
93
100
|
const canEditCase = useCanEditCase();
|
|
@@ -132,8 +139,24 @@ export function PostComment(props) {
|
|
|
132
139
|
(_a = props.onCommentClear) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
133
140
|
setCommentText(commentSignature ? `\n ${commentSignature}` : '');
|
|
134
141
|
});
|
|
142
|
+
const resetAttachmentSection = () => {
|
|
143
|
+
resetAttachment(dispatchToAttachmentReducer);
|
|
144
|
+
};
|
|
145
|
+
useAttachmentUploadCompletion({
|
|
146
|
+
isUploadingAttachments,
|
|
147
|
+
hasSomeUnUploadedFiles,
|
|
148
|
+
isUploadingAttachmentPrevious,
|
|
149
|
+
caseDispatch,
|
|
150
|
+
isInternal: loggedInUserRights.data.isInternal(),
|
|
151
|
+
status,
|
|
152
|
+
resetAttachmentSection,
|
|
153
|
+
onAttachmentAdded: (_c = props.onAttachmentAdded) !== null && _c !== void 0 ? _c : (() => undefined),
|
|
154
|
+
setCssCommentAgreed,
|
|
155
|
+
});
|
|
135
156
|
const onCancelClick = () => {
|
|
136
157
|
resetCommentSection();
|
|
158
|
+
resetAttachmentSection();
|
|
159
|
+
cancelFileUpload();
|
|
137
160
|
};
|
|
138
161
|
const onCommentTextChange = (value, mode) => __awaiter(this, void 0, void 0, function* () {
|
|
139
162
|
setCommentType(mode !== null && mode !== void 0 ? mode : commentType);
|
|
@@ -210,6 +233,10 @@ export function PostComment(props) {
|
|
|
210
233
|
return commentText.trim() === commentSignature;
|
|
211
234
|
}
|
|
212
235
|
const isPostCommentDisabled = isProcessing || !commentText || isCommentSignatureMatch();
|
|
236
|
+
const isFileUploadDisabled = isConfirmedStateSideSupport && !cssCommentAgreed;
|
|
237
|
+
const onFileUploadClick = () => {
|
|
238
|
+
ToastNotification.addInfoMessage(t('Uploading Attachment(s)'));
|
|
239
|
+
};
|
|
213
240
|
/**
|
|
214
241
|
* Formats a reply as a markdown blockquote. Truncates the original text
|
|
215
242
|
* to 1000 characters, prepends an attribution header, and prefixes each
|
|
@@ -251,12 +278,15 @@ export function PostComment(props) {
|
|
|
251
278
|
const isSubmitDisabled = isReplyDisabled() ||
|
|
252
279
|
isCommentEmpty ||
|
|
253
280
|
isPostCommentDisabled ||
|
|
281
|
+
isUploadingAttachments ||
|
|
282
|
+
hasSomeUnUploadedFiles ||
|
|
254
283
|
(isConfirmedStateSideSupport && !cssCommentAgreed);
|
|
255
284
|
return (React.createElement("div", { className: `pf-v6-u-mb-md ${isExportingPDF ? 'hide-in-pdf' : ''}`, ref: componentRef },
|
|
256
|
-
React.createElement(MarkdownEditor, { className: `${!isPublic && canPostPrivateComments ? 'is-private' : ''}`, disabled: isProcessing || canEditCase.isCaseNotEditable, "aria-label": "comment text area", editorMode: commentType, hideToolbars: true, onFocus: () => setIsTextAreaFocused(true), onBlur: onTextAreaBlur, onChange: onCommentTextChange, value: commentText, rows: isTextAreaFocused ? 12 : 4, bindTextArea: textAreaRef, onCommentExceedCharsLimit: onCommentExceedCharsLimit,
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
285
|
+
React.createElement(MarkdownEditor, { className: `${!isPublic && canPostPrivateComments ? 'is-private' : ''}`, disabled: isProcessing || canEditCase.isCaseNotEditable, "aria-label": "comment text area", editorMode: commentType, hideToolbars: true, onFocus: () => setIsTextAreaFocused(true), onBlur: onTextAreaBlur, onChange: onCommentTextChange, value: commentText, rows: isTextAreaFocused ? 12 : 4, bindTextArea: textAreaRef, onCommentExceedCharsLimit: onCommentExceedCharsLimit, mdPlaceholder: !isPublic && canPostPrivateComments
|
|
286
|
+
? 'Add a comment or attach a file privately'
|
|
287
|
+
: 'Add a comment to this case', plainTextPlaceholder: !isPublic && canPostPrivateComments
|
|
288
|
+
? 'Add a comment or attach a file privately'
|
|
289
|
+
: 'Add a comment to this case' }),
|
|
260
290
|
isConfirmedStateSideSupport && (React.createElement("div", { className: "pf-v6-u-mt-md pf-v6-u-mb-lg" },
|
|
261
291
|
React.createElement("input", { type: "checkbox", id: "css-case-comment-agreement", name: "css-case-comment-agreement", "data-tracking-id": "css-case-comment-agreement", checked: cssCommentAgreed, onChange: (e) => setCssCommentAgreed(e.target.checked) }),
|
|
262
292
|
React.createElement("label", { htmlFor: "css-case-comment-agreement", className: "pf-v6-u-font-weight-normal pf-v6-u-font-size-sm" },
|
|
@@ -266,8 +296,15 @@ export function PostComment(props) {
|
|
|
266
296
|
isModalOpen && loggedInUserRights.data.isInternal() && isPublic && (React.createElement(VerifyCaseStatusModal, { onClose: onCancel, onConfirm: onConfirm, isUpdating: isPostingComment, caseNumber: props.caseNumber })),
|
|
267
297
|
React.createElement(Button, { "data-tracking-id": "postcomment-submit-button", type: "button", variant: ButtonVariant.primary, onClick: loggedInUser.data.isInternal && isPublic ? onBtnClick : isNotInternalConfirm, isDisabled: isSubmitDisabled, className: "postcomment-submit" },
|
|
268
298
|
React.createElement(Trans, null, "Submit")),
|
|
269
|
-
React.createElement(Button, { className: "secondary-button-pill", "data-tracking-id": "postcomment-cancel-button", type: "button", variant: ButtonVariant.link, onClick: onCancelClick, isDisabled: isPostCommentDisabled },
|
|
299
|
+
React.createElement(Button, { className: "secondary-button-pill", "data-tracking-id": "postcomment-cancel-button", type: "button", variant: ButtonVariant.link, onClick: onCancelClick, isDisabled: isPostCommentDisabled && !hasSomeSelectedFilesLocal },
|
|
270
300
|
React.createElement(Trans, null, "Cancel")),
|
|
301
|
+
canAddAttachments && (React.createElement(FileSelectorButton, { isSessionId: false, isDisabled: isFileUploadDisabled, buttonLabel: React.createElement(React.Fragment, null,
|
|
302
|
+
React.createElement(PlusIcon, null),
|
|
303
|
+
" ",
|
|
304
|
+
React.createElement(Trans, null, "Attach a file")) })),
|
|
271
305
|
canPostPrivateComments && (React.createElement("span", { className: "post-comment-checkbox" },
|
|
272
|
-
React.createElement(Checkbox, { label: t('Private'), isChecked: !isPublic && canPostPrivateComments, onChange: handleCheckboxToggle, "aria-label": t('Private'), id: "private-comment", name: "private-comment", "data-tracking-id": "private-comment-checkbox" })))))
|
|
306
|
+
React.createElement(Checkbox, { label: t('Private'), isChecked: !isPublic && canPostPrivateComments, onChange: handleCheckboxToggle, "aria-label": t('Private'), id: "private-comment", name: "private-comment", "data-tracking-id": "private-comment-checkbox" }))))),
|
|
307
|
+
canAddAttachments && (React.createElement("div", Object.assign({}, getRootProps(), { className: "post-comment-dropzone" }),
|
|
308
|
+
React.createElement("input", Object.assign({}, getInputProps())),
|
|
309
|
+
React.createElement(FileUpload, { idToUploadTo: caseNumber, caseSalesforceId: caseSalesforceId, onUploadClick: onFileUploadClick, isSessionId: false, needsAnalyzing: false, autoUploadOnSelect: true, isPrivate: !isPublic })))));
|
|
273
310
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileDiag.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/FileDiag.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FileDiag.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/FileDiag.tsx"],"names":[],"mappings":"AAKA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAQ/D,UAAU,MAAM;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,qBAuCrC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// TODO: Re-enable when Hydra/GraphQL attachment APIs support secure support again
|
|
2
|
+
// import { GlobalMetadataStateContext } from '@rh-support/react-context';
|
|
2
3
|
import { ability, CaseListFields, resourceActions, resources } from '@rh-support/user-permissions';
|
|
3
4
|
import { PreviousCaseTypes } from '@rh-support/utils';
|
|
4
5
|
import isEqual from 'lodash/isEqual';
|
|
@@ -11,7 +12,10 @@ import { WidgetFileUploader } from '../shared/fileUpload/WidgetFileUploader';
|
|
|
11
12
|
export function FileDiag(props) {
|
|
12
13
|
const { sessionRestore: { activeSessionId }, } = useContext(SessionRestoreStateContext);
|
|
13
14
|
const canAddAttachments = ability.can(resourceActions.PATCH, resources.CASE_CREATE, CaseListFields.ATTACHMENTS);
|
|
14
|
-
|
|
15
|
+
// TODO: Re-enable when Hydra/GraphQL attachment APIs support secure support again
|
|
16
|
+
// const {
|
|
17
|
+
// globalMetadataState: { loggedInUsersAccount },
|
|
18
|
+
// } = useContext(GlobalMetadataStateContext);
|
|
15
19
|
const { rulesState } = useContext(RulesStateContext);
|
|
16
20
|
const { caseType } = useCaseSelector((state) => ({
|
|
17
21
|
caseType: state.caseDetails.caseType,
|
|
@@ -22,5 +26,8 @@ export function FileDiag(props) {
|
|
|
22
26
|
}, [caseType]);
|
|
23
27
|
if (!canAddAttachments)
|
|
24
28
|
return null;
|
|
25
|
-
return (React.createElement(WidgetFileUploader, { className: props.className, idToUploadTo: activeSessionId, isPrivate: false, needsAnalyzing: isIdea ? false : true, isSessionId: true,
|
|
29
|
+
return (React.createElement(WidgetFileUploader, { className: props.className, idToUploadTo: activeSessionId, isPrivate: false, needsAnalyzing: isIdea ? false : true, isSessionId: true,
|
|
30
|
+
// isSecureSupport={loggedInUsersAccount.data.secureSupport!}
|
|
31
|
+
// autoUploadOnSelect={loggedInUsersAccount.data.secureSupport ? false : true}
|
|
32
|
+
autoUploadOnSelect: true, helperText: getValidAttachmentRules(rulesState.EARules.rules).length > 0 ? React.createElement(FileEARule, null) : null, isIdea: isIdea }));
|
|
26
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoAttachmentSelectedModal.d.ts","sourceRoot":"","sources":["../../../../src/components/ConfirmationModals/NoAttachmentSelectedModal.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NoAttachmentSelectedModal.d.ts","sourceRoot":"","sources":["../../../../src/components/ConfirmationModals/NoAttachmentSelectedModal.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAiBvE,UAAU,MAAM;IACZ,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,EAAE,MAAM,IAAI,CAAC;CACzB;AAID,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,qBAgJtD"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Button, ButtonVariant, Modal, ModalBody, ModalFooter, ModalHeader, ModalVariant, } from '@patternfly/react-core';
|
|
2
|
-
import { GlobalMetadataStateContext } from '@rh-support/react-context';
|
|
3
2
|
import { ability, resourceActions, resources } from '@rh-support/user-permissions';
|
|
4
3
|
import { pendoTrackEvent } from '@rh-support/utils';
|
|
5
4
|
import React, { useContext, useEffect, useRef, useState } from 'react';
|
|
@@ -16,7 +15,6 @@ const TIMEOUT_DURATION = 9000;
|
|
|
16
15
|
export function NoAttachmentSelectedModal(props) {
|
|
17
16
|
const { t } = useTranslation();
|
|
18
17
|
const { sessionRestore: { activeSessionId }, } = useContext(SessionRestoreStateContext);
|
|
19
|
-
const { globalMetadataState: { loggedInUsersAccount }, } = useContext(GlobalMetadataStateContext);
|
|
20
18
|
const { attachmentState: { caseFiles: { selectedLocalFiles }, }, } = useContext(AttachmentStateContext);
|
|
21
19
|
const [isUploading, setIsUploading] = useState(false);
|
|
22
20
|
const isAnyFileAttachedLocal = isAnyFileAttached(selectedLocalFiles);
|
|
@@ -78,7 +76,11 @@ export function NoAttachmentSelectedModal(props) {
|
|
|
78
76
|
React.createElement("p", { className: "pf-v6-u-mb-md" },
|
|
79
77
|
React.createElement(Trans, null, "Uploading an attachment will speed up your case's resolution time")),
|
|
80
78
|
React.createElement(FileEARule, { isInline: true })))),
|
|
81
|
-
React.createElement(FileUpload, { idToUploadTo: activeSessionId, onUploadClick: onFileUploadClick, isSessionId: true, needsAnalyzing: true,
|
|
79
|
+
React.createElement(FileUpload, { idToUploadTo: activeSessionId, onUploadClick: onFileUploadClick, isSessionId: true, needsAnalyzing: true,
|
|
80
|
+
// TODO: Re-enable when Hydra/GraphQL attachment APIs support secure support again
|
|
81
|
+
// autoUploadOnSelect={loggedInUsersAccount.data.secureSupport ? false : true}
|
|
82
|
+
// isSecureSupport={loggedInUsersAccount.data.secureSupport}
|
|
83
|
+
autoUploadOnSelect: true, isPrivate: false }),
|
|
82
84
|
React.createElement(ModalFooter, null, isUploading ? (React.createElement(Button, { key: "create-case", variant: ButtonVariant.primary, onClick: props.onConfirm, "data-tracking-id": "skip-upload-or-analysis-and-submit" },
|
|
83
85
|
React.createElement(Trans, null, "Skip analyze and create my case"))) : isAnyFileAttachedLocal ? (!canUseSessionManagement && (React.createElement(Button, { className: "pf-v6-u-mt-sm", variant: ButtonVariant.primary, onClick: props.onConfirm, "data-tracking-id": "no-attachment-modal-create-case" },
|
|
84
86
|
React.createElement(Trans, null, "Create Case")))) : (React.createElement(React.Fragment, null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubmitCase.d.ts","sourceRoot":"","sources":["../../../../src/components/SubmitCase/SubmitCase.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAErD,OAAO,EAAQ,mBAAmB,EAAe,MAAM,kBAAkB,CAAC;AAQ1E,OAAO,EAAqB,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAWrF,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;CACpD;AAED,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"SubmitCase.d.ts","sourceRoot":"","sources":["../../../../src/components/SubmitCase/SubmitCase.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAErD,OAAO,EAAQ,mBAAmB,EAAe,MAAM,kBAAkB,CAAC;AAQ1E,OAAO,EAAqB,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAWrF,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;CACpD;AAED,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,KAAK,EAAE,MAAM,qBA8Y/C"}
|
|
@@ -214,7 +214,7 @@ export default function SubmitCase(props) {
|
|
|
214
214
|
React.createElement(Button, { className: "pf-v6-u-ml-md view-case-button", component: "a", href: getCaseURL(), variant: "primary", "data-tracking-id": "get-support-view-case", "aria-label": t('View case'), isAriaDisabled: isUploadingAttachment(attachmentState.caseFiles.selectedLocalFiles) },
|
|
215
215
|
React.createElement(Trans, null, "View case"))))) : (React.createElement(Button, { component: (props) => (React.createElement(Link, Object.assign({}, props, { to: `/case/${caseNoOfCreatedCase}` }))), variant: "primary", "data-tracking-id": "get-support-view-case", "aria-label": t('View case'), className: "view-case-button" },
|
|
216
216
|
React.createElement(Trans, null, "View case"))))))),
|
|
217
|
-
!isEmpty(attachmentState.caseFiles.selectedLocalFiles) && (React.createElement(FileUploader, { idToUploadTo: caseNoOfCreatedCase, isSessionId: false
|
|
217
|
+
!isEmpty(attachmentState.caseFiles.selectedLocalFiles) && (React.createElement(FileUploader, { idToUploadTo: caseNoOfCreatedCase, isSessionId: false })),
|
|
218
218
|
React.createElement("div", null,
|
|
219
219
|
(!isEmpty(topContent.data) || !rulesState.EARules.rules || !clusterRecommendations) &&
|
|
220
220
|
!isIdea && (React.createElement(Content, { className: "pf-v6-u-mt-2xl pf-v6-u-font-weight-light", component: ContentVariants.h2 },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileUploader.d.ts","sourceRoot":"","sources":["../../../../../src/components/shared/fileUpload/FileUploader.tsx"],"names":[],"mappings":"AACA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAYrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAGnD,UAAU,MAAO,SAAQ,wBAAwB;CAAG;AAQpD,iBAAS,YAAY,CAAC,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"FileUploader.d.ts","sourceRoot":"","sources":["../../../../../src/components/shared/fileUpload/FileUploader.tsx"],"names":[],"mappings":"AACA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAYrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAGnD,UAAU,MAAO,SAAQ,wBAAwB;CAAG;AAQpD,iBAAS,YAAY,CAAC,KAAK,EAAE,MAAM,qBA+ClC;kBA/CQ,YAAY;;;AAiDrB,eAAe,YAAY,CAAC"}
|
|
@@ -26,7 +26,7 @@ function FileUploader(props) {
|
|
|
26
26
|
uploadFile(index);
|
|
27
27
|
}
|
|
28
28
|
else if (isSessionUploadComplete(file.uploadProgress.uploadStatus)) {
|
|
29
|
-
moveSessionAttachmentToCase(dispatchToAttachmentReducer, props.idToUploadTo, activeSessionId, file, index, apolloClient);
|
|
29
|
+
moveSessionAttachmentToCase(dispatchToAttachmentReducer, props.idToUploadTo, activeSessionId, file, index, apolloClient, props.caseSalesforceId);
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WidgetFileUploader.d.ts","sourceRoot":"","sources":["../../../../../src/components/shared/fileUpload/WidgetFileUploader.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,KAA0C,MAAM,OAAO,CAAC;AA0B/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAInD,UAAU,MAAO,SAAQ,wBAAwB,EAAE,gBAAgB;IAC/D,UAAU,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IACtC,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"WidgetFileUploader.d.ts","sourceRoot":"","sources":["../../../../../src/components/shared/fileUpload/WidgetFileUploader.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,KAA0C,MAAM,OAAO,CAAC;AA0B/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAInD,UAAU,MAAO,SAAQ,wBAAwB,EAAE,gBAAgB;IAC/D,UAAU,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IACtC,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;CAGpB;AAYD,iBAAS,kBAAkB,CAAC,KAAK,EAAE,MAAM,qBA8OxC;kBA9OQ,kBAAkB;;;AAkP3B,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -28,7 +28,7 @@ const defaultProps = {
|
|
|
28
28
|
autoUploadOnSelect: false,
|
|
29
29
|
isPrivate: false,
|
|
30
30
|
isIdea: false,
|
|
31
|
-
isSecureSupport: false,
|
|
31
|
+
// isSecureSupport: false,
|
|
32
32
|
};
|
|
33
33
|
function WidgetFileUploader(props) {
|
|
34
34
|
const { t } = useTranslation();
|
|
@@ -148,7 +148,7 @@ function WidgetFileUploader(props) {
|
|
|
148
148
|
});
|
|
149
149
|
return (React.createElement(Card, { id: "file-uploader-card", className: "file-diag pf-v6-u-mb-md", onPaste: handlePaste },
|
|
150
150
|
React.createElement(CardHeader, { "aria-label": t('File uploader') },
|
|
151
|
-
React.createElement("h3", { id: "file-uploader-title" }, props.isIdea
|
|
151
|
+
React.createElement("h3", { id: "file-uploader-title" }, props.isIdea ? React.createElement(Trans, null, "File uploader") : React.createElement(Trans, null, "Upload a file for Red Hat to analyze"))),
|
|
152
152
|
React.createElement(CardBody, { "aria-label": t('File upload area'), className: "file-upload-body" },
|
|
153
153
|
React.createElement(WidgetFileSelector, { isSessionId: props.isSessionId, isPrivate: props.isPrivate, isIdea: props.isIdea, showFileExceed: fileExceedInfo }),
|
|
154
154
|
!hasSomeSelectedFiles(selectedLocalFiles) ? ((!props.isIdea && props.helperText) || (React.createElement("p", { className: "pf-v6-u-mt-md" },
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
interface IProps extends React.HTMLProps<HTMLButtonElement> {
|
|
3
3
|
isSessionId: boolean;
|
|
4
4
|
isPrivate?: boolean;
|
|
5
|
-
buttonLabel?:
|
|
5
|
+
buttonLabel?: React.ReactNode;
|
|
6
6
|
isDisabled?: boolean;
|
|
7
7
|
}
|
|
8
8
|
declare function FileSelectorButton({ isSessionId, id, className, buttonLabel, isPrivate, isDisabled, ...btnProps }: IProps): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileSelectorButton.d.ts","sourceRoot":"","sources":["../../../../../../src/components/shared/fileUpload/fileSelectors/FileSelectorButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAO1C,UAAU,MAAO,SAAQ,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC;IACvD,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"FileSelectorButton.d.ts","sourceRoot":"","sources":["../../../../../../src/components/shared/fileUpload/fileSelectors/FileSelectorButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAO1C,UAAU,MAAO,SAAQ,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC;IACvD,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,iBAAS,kBAAkB,CAAC,EACxB,WAAW,EACX,EAAO,EACP,SAA4B,EAC5B,WAA6B,EAC7B,SAAiB,EACjB,UAAkB,EAClB,GAAG,QAAQ,EACd,EAAE,MAAM,qBA8BR;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CaseDiagnosticsStatus } from '@cee-eng/hydrajs/@types/api/pcm/preCaseDiagnostics';
|
|
2
2
|
import { ISlowUploadDetectionConfig } from '@cee-eng/hydrajs/@types/models/attachment';
|
|
3
|
+
import { ApolloQueryClient } from '@rh-support/utils';
|
|
3
4
|
import { AnalysisStatusConstants, AttachmentReducerDispatchType, IAnalysisResults, ICaseFiles, IFileLocal, IUploadMetadata, UploadStatusConstants } from './AttachmentReducer';
|
|
4
5
|
export declare const onDrop: (dispatchToAttachmentReducer: AttachmentReducerDispatchType, isSessionId: boolean, isPrivate?: boolean) => (acceptedFiles: File[]) => void;
|
|
5
6
|
export declare const isUploadingOnSession: (status: string) => status is UploadStatusConstants.uploadingOnSession;
|
|
@@ -37,32 +38,32 @@ export declare const isUploadedAndAnalysisFailed: (file: IFileLocal) => boolean;
|
|
|
37
38
|
export declare const isUploadedSuccessfully: (file: IFileLocal) => string;
|
|
38
39
|
export declare const isUploadedAndAnalysisSkipped: (file: IFileLocal) => boolean;
|
|
39
40
|
export declare const updateUploadMetadata: (dispatch: AttachmentReducerDispatchType, fileIndexToEdit: number, newUploadMetadata: Partial<IUploadMetadata>) => void;
|
|
40
|
-
export declare const uploadAllFiles: ({ dispatch, idToUploadTo, caseFiles,
|
|
41
|
+
export declare const uploadAllFiles: ({ dispatch, idToUploadTo, caseFiles, needsAnalyzing, isSessionId, slowUploadConfig, apolloClient, caseSalesforceId, }: {
|
|
41
42
|
dispatch: AttachmentReducerDispatchType;
|
|
42
43
|
idToUploadTo: string;
|
|
43
44
|
caseFiles: ICaseFiles;
|
|
44
|
-
isSecureSupport: boolean;
|
|
45
45
|
needsAnalyzing?: boolean;
|
|
46
46
|
isSessionId?: boolean;
|
|
47
47
|
slowUploadConfig?: ISlowUploadDetectionConfig;
|
|
48
|
+
apolloClient?: ApolloQueryClient;
|
|
49
|
+
caseSalesforceId?: string;
|
|
48
50
|
}) => Promise<void>;
|
|
49
|
-
export declare const uploadFile: ({ dispatch, idToUploadTo, localFile, originalFile, index,
|
|
51
|
+
export declare const uploadFile: ({ dispatch, idToUploadTo, localFile, originalFile, index, needsAnalyzing, isSessionId, slowUploadConfig, apolloClient, caseSalesforceId, }: {
|
|
50
52
|
dispatch: AttachmentReducerDispatchType;
|
|
51
53
|
idToUploadTo: string;
|
|
52
54
|
localFile: IFileLocal;
|
|
53
55
|
originalFile: File;
|
|
54
56
|
index: number;
|
|
55
|
-
isSecureSupport: boolean;
|
|
56
57
|
needsAnalyzing?: boolean;
|
|
57
58
|
isSessionId?: boolean;
|
|
58
59
|
slowUploadConfig?: ISlowUploadDetectionConfig;
|
|
60
|
+
apolloClient?: ApolloQueryClient;
|
|
61
|
+
caseSalesforceId?: string;
|
|
59
62
|
}) => Promise<void>;
|
|
60
63
|
export declare function doSosReportAnalysisForAllFiles(dispatch: any, idToUploadTo: string, localFiles: IFileLocal[], isSessionId: boolean): Promise<void>;
|
|
61
64
|
export declare function doSosReportAnalysisForFile(dispatch: any, idToUploadTo: string, attachmentId: string, localFile: IFileLocal, isSessionId: boolean, fileIndex: number, fileUploadStatus?: UploadStatusConstants): Promise<void>;
|
|
62
65
|
export declare function computeAnalysisResults(idToUploadTo: string, attachmentId: string, fileSize: number, isSessionId: boolean, listener: (status: CaseDiagnosticsStatus) => void): Promise<IAnalysisResults>;
|
|
63
|
-
export declare function moveSessionAttachmentToCase(dispatch: any, caseNumber: string, sessionId: string, localFile: IFileLocal, fileIndex: number, apolloClient?:
|
|
64
|
-
query: (options: any) => Promise<any>;
|
|
65
|
-
}): Promise<void>;
|
|
66
|
+
export declare function moveSessionAttachmentToCase(dispatch: any, caseNumber: string, sessionId: string, localFile: IFileLocal, fileIndex: number, apolloClient?: ApolloQueryClient, caseSalesforceId?: string): Promise<void>;
|
|
66
67
|
export declare function restoreFilesFromSession(dispatch: any, sessionId: string): Promise<void>;
|
|
67
68
|
export declare function isFileAnalysisFailedForAllFiles(localFiles: IFileLocal[]): boolean;
|
|
68
69
|
export declare function isAnyFileAttached(localFiles: 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,MA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,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,iBA2E5B;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"}
|
|
@@ -7,9 +7,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
10
|
+
import { Config, pcm, sessionAttachments } from '@cee-eng/hydrajs';
|
|
11
11
|
import { ToastNotification } from '@rh-support/components';
|
|
12
|
-
import { fetchCaseDetailsByCaseNumber, GET_CONTENT_DOCUMENT_IDS,
|
|
12
|
+
import { fetchCaseDetailsByCaseNumber, GET_CONTENT_DOCUMENT_IDS, getText, pendoTrackEvent, pollAttachmentUploadStatus, pollContentVersionStatus, uploadCaseAttachment, } from '@rh-support/utils';
|
|
13
13
|
import find from 'lodash/find';
|
|
14
14
|
import forEach from 'lodash/forEach';
|
|
15
15
|
import includes from 'lodash/includes';
|
|
@@ -110,7 +110,9 @@ export const isUploadedAndAnalysisSkipped = (file) => isSessionUploadComplete(fi
|
|
|
110
110
|
export const updateUploadMetadata = (dispatch, fileIndexToEdit, newUploadMetadata) => {
|
|
111
111
|
udpateFileUploadMetadata(dispatch, newUploadMetadata, fileIndexToEdit);
|
|
112
112
|
};
|
|
113
|
-
export const uploadAllFiles = (_a) => __awaiter(void 0, [_a], void 0, function* ({ dispatch, idToUploadTo, caseFiles,
|
|
113
|
+
export const uploadAllFiles = (_a) => __awaiter(void 0, [_a], void 0, function* ({ dispatch, idToUploadTo, caseFiles,
|
|
114
|
+
// isSecureSupport, // TODO: Re-enable when Hydra/GraphQL attachment APIs support secure support again
|
|
115
|
+
needsAnalyzing = false, isSessionId = false, slowUploadConfig = {}, apolloClient, caseSalesforceId, }) {
|
|
114
116
|
forEach(caseFiles.selectedLocalFiles, (localFile, index) => __awaiter(void 0, void 0, void 0, function* () {
|
|
115
117
|
const fileStatus = new FileStatusHelper(localFile);
|
|
116
118
|
if (fileStatus.isUploadComplete() ||
|
|
@@ -126,14 +128,17 @@ export const uploadAllFiles = (_a) => __awaiter(void 0, [_a], void 0, function*
|
|
|
126
128
|
localFile,
|
|
127
129
|
originalFile: caseFiles.selectedOriginalFiles[index],
|
|
128
130
|
index,
|
|
129
|
-
isSecureSupport,
|
|
130
131
|
needsAnalyzing,
|
|
131
132
|
isSessionId,
|
|
132
133
|
slowUploadConfig,
|
|
134
|
+
apolloClient,
|
|
135
|
+
caseSalesforceId,
|
|
133
136
|
});
|
|
134
137
|
}));
|
|
135
138
|
});
|
|
136
|
-
export const uploadFile = (_a) => __awaiter(void 0, [_a], void 0, function* ({ dispatch, idToUploadTo, localFile, originalFile, index,
|
|
139
|
+
export const uploadFile = (_a) => __awaiter(void 0, [_a], void 0, function* ({ dispatch, idToUploadTo, localFile, originalFile, index,
|
|
140
|
+
// isSecureSupport = false, // TODO: Re-enable when Hydra/GraphQL attachment APIs support secure support again
|
|
141
|
+
needsAnalyzing = false, isSessionId = false, slowUploadConfig = {}, apolloClient, caseSalesforceId, }) {
|
|
137
142
|
if (!localFile.uploadability.ableToUpload) {
|
|
138
143
|
return;
|
|
139
144
|
}
|
|
@@ -203,12 +208,29 @@ export const uploadFile = (_a) => __awaiter(void 0, [_a], void 0, function* ({ d
|
|
|
203
208
|
}, putObjectRequest, listener, true, { partSize: 5 * 1024 * 1024, queueSize: 5 }, Object.assign(Object.assign({}, slowUploadConfig), { preferSlowS3Upload: Config.userConfig.preferSlowS3Upload }));
|
|
204
209
|
}
|
|
205
210
|
else {
|
|
206
|
-
attachmentId = yield
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
211
|
+
attachmentId = yield uploadCaseAttachment(idToUploadTo, originalFile, (percent) => {
|
|
212
|
+
updateUploadMetadata(dispatch, index, {
|
|
213
|
+
uploadStatus: UploadStatusConstants.uploadingOnCase,
|
|
214
|
+
percentUploaded: percent,
|
|
215
|
+
uploadErrorMessage: '',
|
|
216
|
+
});
|
|
217
|
+
}, (abort) => {
|
|
218
|
+
updateUploadMetadata(dispatch, index, Object.assign(Object.assign({}, localFile.uploadProgress), { onAbort: () => {
|
|
219
|
+
abort();
|
|
220
|
+
updateUploadMetadata(dispatch, index, {
|
|
221
|
+
percentUploaded: 0,
|
|
222
|
+
onAbort: undefined,
|
|
223
|
+
uploadStatus: UploadStatusConstants.aborted,
|
|
224
|
+
});
|
|
225
|
+
} }));
|
|
226
|
+
});
|
|
227
|
+
if (apolloClient && caseSalesforceId) {
|
|
228
|
+
updateUploadMetadata(dispatch, index, {
|
|
229
|
+
uploadStatus: UploadStatusConstants.verifyingCaseUpload,
|
|
230
|
+
percentUploaded: 100,
|
|
231
|
+
});
|
|
232
|
+
yield pollAttachmentUploadStatus(apolloClient, caseSalesforceId, attachmentId);
|
|
233
|
+
}
|
|
212
234
|
}
|
|
213
235
|
attachmentId && updateAttachmentIdForFile(dispatch, attachmentId, index);
|
|
214
236
|
const uploadPayload = {
|
|
@@ -322,13 +344,7 @@ export function computeAnalysisResults(idToUploadTo, attachmentId, fileSize, isS
|
|
|
322
344
|
});
|
|
323
345
|
}
|
|
324
346
|
const SCT_PART_SIZE = 5 * 1024 * 1024;
|
|
325
|
-
|
|
326
|
-
const SCTUploadStatus = {
|
|
327
|
-
IN_PROGRESS: 'In Progress',
|
|
328
|
-
FAILED: 'Failed',
|
|
329
|
-
COMPLETED: 'Completed',
|
|
330
|
-
};
|
|
331
|
-
export function moveSessionAttachmentToCase(dispatch, caseNumber, sessionId, localFile, fileIndex, apolloClient) {
|
|
347
|
+
export function moveSessionAttachmentToCase(dispatch, caseNumber, sessionId, localFile, fileIndex, apolloClient, caseSalesforceId) {
|
|
332
348
|
return __awaiter(this, void 0, void 0, function* () {
|
|
333
349
|
var _a, _b, _c, _d, _e;
|
|
334
350
|
if (!caseNumber || !sessionId || !localFile.attachmentId)
|
|
@@ -339,10 +355,10 @@ export function moveSessionAttachmentToCase(dispatch, caseNumber, sessionId, loc
|
|
|
339
355
|
};
|
|
340
356
|
updateUploadMetadata(dispatch, fileIndex, currentUploadPayload);
|
|
341
357
|
try {
|
|
342
|
-
let caseSalesforceId;
|
|
343
|
-
if (apolloClient) {
|
|
358
|
+
let resolvedCaseSalesforceId = caseSalesforceId;
|
|
359
|
+
if (apolloClient && !resolvedCaseSalesforceId) {
|
|
344
360
|
const caseDetails = yield fetchCaseDetailsByCaseNumber(apolloClient, caseNumber);
|
|
345
|
-
|
|
361
|
+
resolvedCaseSalesforceId = caseDetails === null || caseDetails === void 0 ? void 0 : caseDetails.id;
|
|
346
362
|
}
|
|
347
363
|
const totalChunks = Math.ceil(localFile.size / SCT_PART_SIZE);
|
|
348
364
|
const moveResponse = yield sessionAttachments.moveSessionAttachmentsToCaseSCT(sessionId, {
|
|
@@ -361,7 +377,7 @@ export function moveSessionAttachmentToCase(dispatch, caseNumber, sessionId, loc
|
|
|
361
377
|
if (!sctAttachmentId) {
|
|
362
378
|
throw new Error('Missing attachmentId from SCT move response');
|
|
363
379
|
}
|
|
364
|
-
if (!
|
|
380
|
+
if (!resolvedCaseSalesforceId || !apolloClient) {
|
|
365
381
|
updateUploadMetadata(dispatch, fileIndex, {
|
|
366
382
|
uploadStatus: UploadStatusConstants.uploadedOnCase,
|
|
367
383
|
});
|
|
@@ -369,7 +385,7 @@ export function moveSessionAttachmentToCase(dispatch, caseNumber, sessionId, loc
|
|
|
369
385
|
}
|
|
370
386
|
const { data: docLinkData } = yield apolloClient.query({
|
|
371
387
|
query: GET_CONTENT_DOCUMENT_IDS,
|
|
372
|
-
variables: { linkedEntityId: { eq:
|
|
388
|
+
variables: { linkedEntityId: { eq: resolvedCaseSalesforceId } },
|
|
373
389
|
fetchPolicy: 'network-only',
|
|
374
390
|
});
|
|
375
391
|
const contentDocumentIds = ((_e = (_d = (_c = (_b = docLinkData === null || docLinkData === void 0 ? void 0 : docLinkData.redhat_support_uiapi) === null || _b === void 0 ? void 0 : _b.query) === null || _c === void 0 ? void 0 : _c.RedHatSupportContentDocumentLink) === null || _d === void 0 ? void 0 : _d.edges) !== null && _e !== void 0 ? _e : []).map((edge) => edge.node.ContentDocumentId.value);
|
|
@@ -398,31 +414,6 @@ export function moveSessionAttachmentToCase(dispatch, caseNumber, sessionId, loc
|
|
|
398
414
|
}
|
|
399
415
|
});
|
|
400
416
|
}
|
|
401
|
-
function pollContentVersionStatus(apolloClient, contentDocumentIds, attachmentUUID) {
|
|
402
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
403
|
-
var _a, _b, _c, _d, _e, _f;
|
|
404
|
-
while (true) {
|
|
405
|
-
const { data } = yield apolloClient.query({
|
|
406
|
-
query: GET_CONTENT_VERSION_STATUS,
|
|
407
|
-
variables: {
|
|
408
|
-
contentDocumentIds: { in: contentDocumentIds },
|
|
409
|
-
attachmentUUID: { eq: attachmentUUID },
|
|
410
|
-
},
|
|
411
|
-
fetchPolicy: 'network-only',
|
|
412
|
-
});
|
|
413
|
-
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.RedHatSupportContentVersion) === null || _c === void 0 ? void 0 : _c.edges) !== null && _d !== void 0 ? _d : [];
|
|
414
|
-
const matchingEntry = edges.find((edge) => { var _a; return ((_a = edge.node.AttachmentUUID__c) === null || _a === void 0 ? void 0 : _a.value) === attachmentUUID; });
|
|
415
|
-
const uploadStatus = (_f = (_e = matchingEntry === null || matchingEntry === void 0 ? void 0 : matchingEntry.node) === null || _e === void 0 ? void 0 : _e.UploadStatus__c) === null || _f === void 0 ? void 0 : _f.value;
|
|
416
|
-
if (uploadStatus === SCTUploadStatus.COMPLETED) {
|
|
417
|
-
return;
|
|
418
|
-
}
|
|
419
|
-
if (uploadStatus === SCTUploadStatus.FAILED) {
|
|
420
|
-
throw new Error('Attachment move to case failed');
|
|
421
|
-
}
|
|
422
|
-
yield new Promise((resolve) => setTimeout(resolve, SCT_POLL_INTERVAL_MS));
|
|
423
|
-
}
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
417
|
export function restoreFilesFromSession(dispatch, sessionId) {
|
|
427
418
|
return __awaiter(this, void 0, void 0, function* () {
|
|
428
419
|
resetAttachment(dispatch);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export interface IFileUploaderCommonProps {
|
|
2
|
-
isSecureSupport: boolean;
|
|
3
2
|
idToUploadTo: string;
|
|
3
|
+
/** Salesforce case Id from caseDetails.state — avoids an extra GetCaseByCaseNumber on upload. */
|
|
4
|
+
caseSalesforceId?: string;
|
|
4
5
|
needsAnalyzing?: boolean;
|
|
5
6
|
isSessionId: boolean;
|
|
6
7
|
autoUploadOnSelect?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/shared/fileUpload/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,wBAAwB;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/shared/fileUpload/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,wBAAwB;IAGrC,YAAY,EAAE,MAAM,CAAC;IACrB,iGAAiG;IACjG,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,EAAE,OAAO,CAAC;IACrB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;CAC9B"}
|
|
@@ -2,11 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import { IFileLocal } from './reducer/AttachmentReducer';
|
|
3
3
|
import { IFileUploaderCommonProps } from './types';
|
|
4
4
|
export declare function useFileUploader(props: IFileUploaderCommonProps): {
|
|
5
|
-
retryUpload: (indexToRetry: number) => void
|
|
5
|
+
retryUpload: (indexToRetry: number) => Promise<void>;
|
|
6
6
|
editFile: (editedLocalFile: IFileLocal, fileIndexToEdit: number, changes: IFileLocal) => Promise<void>;
|
|
7
7
|
removeFile: (fileIndexToRemove: number, file: IFileLocal) => Promise<void>;
|
|
8
8
|
uploadAll: (event?: React.MouseEvent<HTMLButtonElement, MouseEvent>) => Promise<void>;
|
|
9
|
-
uploadFile: (fileIndex: number) => void
|
|
9
|
+
uploadFile: (fileIndex: number) => Promise<void>;
|
|
10
10
|
retryAnalysis: (indexToRetry: number) => void;
|
|
11
11
|
};
|
|
12
12
|
//# sourceMappingURL=useFileUploader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFileUploader.d.ts","sourceRoot":"","sources":["../../../../../src/components/shared/fileUpload/useFileUploader.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useFileUploader.d.ts","sourceRoot":"","sources":["../../../../../src/components/shared/fileUpload/useFileUploader.tsx"],"names":[],"mappings":"AAaA,OAAO,KAA8D,MAAM,OAAO,CAAC;AAenF,OAAO,EAAE,UAAU,EAAmD,MAAM,6BAA6B,CAAC;AAE1G,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEnD,wBAAgB,eAAe,CAAC,KAAK,EAAE,wBAAwB;gCAsEjB,MAAM;gCAYA,UAAU,mBAAmB,MAAM,WAAW,UAAU;oCAOpD,MAAM,QAAQ,UAAU;wBA0BzC,KAAK,CAAC,UAAU,CAAC,iBAAiB,EAAE,UAAU,CAAC;4BA8B3C,MAAM;kCAtEN,MAAM;EA+FhD"}
|