@rh-support/troubleshoot 0.2.84 → 0.2.87

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 (38) hide show
  1. package/lib/esm/components/CaseEditView/CaseOverview/index.d.ts.map +1 -1
  2. package/lib/esm/components/CaseEditView/CaseOverview/index.js +6 -3
  3. package/lib/esm/components/CaseEditView/ConfirmationModals/ReopenCaseModal.d.ts.map +1 -1
  4. package/lib/esm/components/CaseEditView/ConfirmationModals/ReopenCaseModal.js +4 -2
  5. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/Summary.d.ts.map +1 -1
  6. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/Summary.js +3 -1
  7. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useMarkdownFileUploader.d.ts +1 -0
  8. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useMarkdownFileUploader.d.ts.map +1 -1
  9. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useMarkdownFileUploader.js +25 -4
  10. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.d.ts.map +1 -1
  11. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.js +2 -1
  12. package/lib/esm/components/CaseManagement/Cep.d.ts.map +1 -1
  13. package/lib/esm/components/CaseManagement/Cep.js +13 -13
  14. package/lib/esm/components/Recommendations/AsideResults.d.ts +1 -4
  15. package/lib/esm/components/Recommendations/AsideResults.d.ts.map +1 -1
  16. package/lib/esm/components/Recommendations/AsideResults.js +17 -14
  17. package/lib/esm/components/Recommendations/ClusterRecommendationItems.d.ts.map +1 -1
  18. package/lib/esm/components/Recommendations/ClusterRecommendationItems.js +10 -5
  19. package/lib/esm/components/Recommendations/EARules/EARule.d.ts.map +1 -1
  20. package/lib/esm/components/Recommendations/EARules/EARule.js +10 -6
  21. package/lib/esm/components/Recommendations/EARules/EARuleInfoInline.d.ts.map +1 -1
  22. package/lib/esm/components/Recommendations/EARules/EARuleInfoInline.js +13 -2
  23. package/lib/esm/components/Recommendations/EARules/EARuleWidget.d.ts.map +1 -1
  24. package/lib/esm/components/Recommendations/EARules/EARuleWidget.js +26 -1
  25. package/lib/esm/components/Recommendations/InsightsRuleInfo.d.ts.map +1 -1
  26. package/lib/esm/components/Recommendations/InsightsRuleInfo.js +3 -5
  27. package/lib/esm/components/Recommendations/Recommendations.d.ts.map +1 -1
  28. package/lib/esm/components/Recommendations/Recommendations.js +8 -7
  29. package/lib/esm/components/Recommendations/RulesModal.d.ts.map +1 -1
  30. package/lib/esm/components/Recommendations/RulesModal.js +9 -2
  31. package/lib/esm/hooks/useS3Upload.d.ts +1 -1
  32. package/lib/esm/hooks/useS3Upload.d.ts.map +1 -1
  33. package/lib/esm/hooks/useS3Upload.js +3 -2
  34. package/lib/esm/reducers/SessionRestoreReducer.d.ts +3 -2
  35. package/lib/esm/reducers/SessionRestoreReducer.d.ts.map +1 -1
  36. package/lib/esm/reducers/SessionRestoreReducer.js +35 -52
  37. package/lib/esm/scss/_pf4-overrides.scss +10 -0
  38. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/CaseOverview/index.tsx"],"names":[],"mappings":"AAyCA,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAK,EAAE,MAAM,eA8cjD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/CaseOverview/index.tsx"],"names":[],"mappings":"AAyCA,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAK,EAAE,MAAM,eAidjD"}
@@ -222,10 +222,13 @@ export default function CaseOverview(props) {
222
222
  props.caseNumber),
223
223
  React.createElement("div", null,
224
224
  exportPDFButton(props.caseNumber),
225
- React.createElement(Button, { className: "pf-u-ml-md", isDisabled: !canManageCase || (caseOverviewState.caseStatusUpdating && isCaseUpdating), isLoading: caseOverviewState.caseStatusUpdating && isCaseUpdating, onClick: () => (isCaseInOpenState ? onCaseClose() : onCaseReopen()), variant: isCaseInOpenState ? ButtonVariant.secondary : ButtonVariant.tertiary, "data-tracking-id": isCaseInOpenState
225
+ React.createElement(Button, Object.assign({ className: "pf-u-ml-md", isDisabled: !canManageCase || (caseOverviewState.caseStatusUpdating && isCaseUpdating) }, (caseOverviewState.caseStatusUpdating &&
226
+ isCaseUpdating && {
227
+ isLoading: true,
228
+ }), { onClick: () => (isCaseInOpenState ? onCaseClose() : onCaseReopen()), variant: isCaseInOpenState ? ButtonVariant.secondary : ButtonVariant.tertiary, "data-tracking-id": isCaseInOpenState
226
229
  ? 'case-close-btn-case-details-overview'
227
- : 'case-reopen-btn-case-details-overview' },
228
- React.createElement(Trans, null, isCaseInOpenState ? 'Close case' : 'Re-open case')))),
230
+ : 'case-reopen-btn-case-details-overview' }),
231
+ React.createElement(Trans, null, isCaseInOpenState ? 'Close case' : 'Reopen case')))),
229
232
  React.createElement("div", { className: `case-details-header-secondary push-bottom-narrow ${isExportingPDF && !viewAsCustomer ? 'hide-in-pdf' : ''}` },
230
233
  React.createElement("span", { className: "case-support-level" }, computeSupportLink())),
231
234
  React.createElement("div", { className: "case-details-summary push-bottom-narrow" },
@@ -1 +1 @@
1
- {"version":3,"file":"ReopenCaseModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/ConfirmationModals/ReopenCaseModal.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAEzE,UAAU,MAAM;IACZ,SAAS,EAAE,CAAC,SAAS,KAAA,EAAE,WAAW,KAAA,KAAK,IAAI,CAAC;IAC5C,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,cAAc,CAAC;CAChC;AAMD,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,eA8K5C"}
1
+ {"version":3,"file":"ReopenCaseModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/ConfirmationModals/ReopenCaseModal.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAEzE,UAAU,MAAM;IACZ,SAAS,EAAE,CAAC,SAAS,KAAA,EAAE,WAAW,KAAA,KAAK,IAAI,CAAC;IAC5C,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,cAAc,CAAC;CAChC;AAMD,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,eAkL5C"}
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { Button, ButtonVariant, Form, FormGroup, Modal, ModalVariant, Select, SelectOption, TextArea, } from '@patternfly/react-core';
11
11
  import ExclamationCircleIcon from '@patternfly/react-icons/dist/js/icons/exclamation-circle-icon';
12
+ import { isEmpty } from 'lodash';
12
13
  import React, { useState } from 'react';
13
14
  import { Trans, useTranslation } from 'react-i18next';
14
15
  import { CaseStatusEnum } from '../../../constants/caseDetailsConstants';
@@ -62,8 +63,9 @@ export function ReopenCaseModal(props) {
62
63
  setSelectedStatus(status);
63
64
  onDropdownToggle(false);
64
65
  };
66
+ const isDescriptionEmpty = isEmpty(reopenDescription === null || reopenDescription === void 0 ? void 0 : reopenDescription.trim());
65
67
  return (React.createElement(Modal, { id: "case-reopen-modal", title: t(`Re-opening case ${props.caseNumber}`), "aria-describedby": "case-reopen-modal", isOpen: true, onClose: props.onClose, showClose: true, actions: [
66
- React.createElement(Button, { key: "submit-description", variant: ButtonVariant.primary, onClick: onSubmit, isLoading: props.isUpdating, isDisabled: showValidationError || props.isUpdating, "data-tracking-id": "reopen-case-description-modal-submit" },
68
+ React.createElement(Button, { key: "submit-description", variant: ButtonVariant.primary, onClick: onSubmit, isLoading: props.isUpdating, isDisabled: isDescriptionEmpty || showValidationError || props.isUpdating, "data-tracking-id": "reopen-case-description-modal-submit" },
67
69
  React.createElement(Trans, null, "Re-open case")),
68
70
  React.createElement(Button, { key: "close-modal", variant: ButtonVariant.secondary, onClick: props.onClose, isDisabled: props.isUpdating, "data-tracking-id": "reopen-case-description-modal-cancel" },
69
71
  React.createElement(Trans, null, "Cancel")),
@@ -79,5 +81,5 @@ export function ReopenCaseModal(props) {
79
81
  showTextArea && (React.createElement(FormGroup, { label: t('Please describe your reason'), type: "text", helperText: t(`Your comment will be visible${props.isInternal ? ' to the customers' : ''} under discussions after re-opening.`), isRequired: true, fieldId: "reopen-case-description" },
80
82
  React.createElement(TextArea, { placeholder: t(props.isInternal
81
83
  ? 'Describe the reason for re-opening with the selected status'
82
- : 'The better the description, the easier it will be for our support team to address your case.'), validated: showValidationError && !reopenDescription ? 'error' : 'default', isRequired: true, id: "reopen-case-description", name: "reopen-case-description", "aria-describedby": "reopen-case-description", value: reopenDescription, onChange: onDescriptionChange, isDisabled: props.isUpdating }))))));
84
+ : 'The better the description, the easier it will be for our support team to address your case.'), validated: showValidationError && isDescriptionEmpty && !reopenDescription ? 'error' : 'default', isRequired: true, id: "reopen-case-description", name: "reopen-case-description", "aria-describedby": "reopen-case-description", value: reopenDescription, onChange: onDescriptionChange, isDisabled: props.isUpdating }))))));
83
85
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Summary.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDetails/Summary.tsx"],"names":[],"mappings":"AAYA,UAAU,MAAM;IACZ,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAOD,iBAAS,OAAO,CAAC,KAAK,EAAE,MAAM,eA4H7B;kBA5HQ,OAAO;;;AA+HhB,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"Summary.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDetails/Summary.tsx"],"names":[],"mappings":"AAYA,UAAU,MAAM;IACZ,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAOD,iBAAS,OAAO,CAAC,KAAK,EAAE,MAAM,eAgI7B;kBAhIQ,OAAO;;;AAmIhB,eAAe,OAAO,CAAC"}
@@ -39,9 +39,11 @@ function Summary(props) {
39
39
  const [localSummaryChange, setLocalSummaryChange] = useState(false);
40
40
  const afterLocalChange = () => setLocalSummaryChange(false);
41
41
  const getSummaryChangedTT = () => React.createElement(Trans, null, "Summary has been updated");
42
+ // Function to check if Invalid when input is non-focused
42
43
  const onSummaryBlur = (e) => {
43
44
  setIsSummaryInValid(isEmpty(e.target.value));
44
45
  };
46
+ // Function to handle when summary changes
45
47
  const onSummaryChange = (e) => {
46
48
  if (canEditCase.alert())
47
49
  return;
@@ -93,7 +95,7 @@ function Summary(props) {
93
95
  React.createElement("span", { className: "form-required", "aria-hidden": true }, "*")), allowInlineEdit: props.inlineEditable, content: summary, onSave: onSave, onCancel: onCancel, saveDisabled: isSummaryInValid ||
94
96
  hasLargeSummary ||
95
97
  summaryState === summary ||
96
- (isSummaryUpdating && !isSummaryInValid), hideLabel: props.hideLabel, loadingIndicator: isSummaryUpdating && !isSummaryInValid ? React.createElement(LoadingIndicator, { isInline: true }) : null },
98
+ (isSummaryUpdating && !isSummaryInValid), hideLabel: props.hideLabel, loadingIndicator: isSummaryUpdating && !isSummaryInValid ? React.createElement(LoadingIndicator, { isInline: true }) : null, isSpaceAllowed: false, inputValue: summaryState },
97
99
  React.createElement("input", { type: "text", id: "case-details-summary", className: `form-control${isSummaryInValid || hasLargeSummary ? ' form-invalid' : ''}`, "aria-invalid": isSummaryInValid, "aria-required": true, required: true, name: "case-details-summary", value: summaryState, onChange: onSummaryChange, onBlur: onSummaryBlur, disabled: isSummaryUpdating, "data-tracking-id": "case-details-summary" }),
98
100
  hasLargeSummary && React.createElement("p", { className: "form-instructions" }, maxLengthErrorMessage)));
99
101
  }
@@ -12,6 +12,7 @@ export declare function useMarkdownFileUploader({ caseNumber, secureSupport, onA
12
12
  onFileSelect: (selectedImage: any) => void;
13
13
  onFileAttach: (files: any, isPublic: any) => Promise<void>;
14
14
  onFileDelete: (attachment: Partial<IAttachment>) => Promise<void>;
15
+ cancelFileUpload: () => void;
15
16
  };
16
17
  export {};
17
18
  //# sourceMappingURL=useMarkdownFileUploader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useMarkdownFileUploader.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useMarkdownFileUploader.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAcxE,UAAU,MAAM;IACZ,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;CAC1B;AAED,eAAO,MAAM,eAAe,QAAkB,CAAC;AAE/C,wBAAgB,uBAAuB,CAAC,EAAE,UAAU,EAAE,aAAa,EAAE,iBAAiB,EAAE,EAAE,MAAM;;;;;;+BAqCpD,QAAQ,WAAW,CAAC;EA0C/D"}
1
+ {"version":3,"file":"useMarkdownFileUploader.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useMarkdownFileUploader.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAcxE,UAAU,MAAM;IACZ,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;CAC1B;AAED,eAAO,MAAM,eAAe,QAAkB,CAAC;AAE/C,wBAAgB,uBAAuB,CAAC,EAAE,UAAU,EAAE,aAAa,EAAE,iBAAiB,EAAE,EAAE,MAAM;;;;;;+BAyDpD,QAAQ,WAAW,CAAC;;EA2C/D"}
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import { caseAttachments } from '@cee-eng/hydrajs';
11
11
  import { ToastNotification, useConfirmation, useFetch } from '@rh-support/components';
12
12
  import { pendoTrackEvent } from '@rh-support/utils';
13
- import React, { useState } from 'react';
13
+ import React, { useRef, useState } from 'react';
14
14
  import { Trans, useTranslation } from 'react-i18next';
15
15
  import { useCaseDiscussionTabDispatchContext, useCaseDiscussionTabStateContext, } from '../../../../../context/CaseDiscussionTabContext';
16
16
  import { useS3Upload } from '../../../../../hooks/useS3Upload';
@@ -19,6 +19,9 @@ import { markdownInlineFileSelectEvent } from '../../../../shared/Constants';
19
19
  export const FILE_SIZE_LIMIT = 2 * 1024 * 1000;
20
20
  export function useMarkdownFileUploader({ caseNumber, secureSupport, onAttachmentAdded }) {
21
21
  const [isMarkdownFileUploadInProgress, setIsMarkdownFileUploadinProgress] = useState(false);
22
+ // We need one more state to check if user canceled current upload
23
+ // Reason to use `useRef` as we need up to date state value in callback
24
+ const isMarkdownFileUploadCanceled = useRef(false);
22
25
  const { request: deleteAttachmentRequest, isFetching: isDeletingFile } = useFetch(caseAttachments.deleteAttachment, {
23
26
  propgateErrors: true,
24
27
  });
@@ -26,13 +29,23 @@ export function useMarkdownFileUploader({ caseNumber, secureSupport, onAttachmen
26
29
  const dispatchDiscussion = useCaseDiscussionTabDispatchContext();
27
30
  const confirm = useConfirmation();
28
31
  const { uploadFile, isUploadingFile } = useS3Upload(caseNumber, secureSupport);
29
- const markdownFileUploadListener = (progress) => {
30
- setIsMarkdownFileUploadinProgress(true);
32
+ const markdownFileUploadListener = (progress, abort) => {
33
+ // If user canceled upload then don't enable uploading label and abort
34
+ if (isMarkdownFileUploadCanceled.current) {
35
+ abort();
36
+ }
37
+ else {
38
+ setIsMarkdownFileUploadinProgress(true);
39
+ }
31
40
  };
32
41
  const { t } = useTranslation();
33
42
  const onImageUploadComplete = () => __awaiter(this, void 0, void 0, function* () {
34
- yield onAttachmentAdded();
43
+ // check if user canceled upload and if not start the upload sequence
44
+ if (!isMarkdownFileUploadCanceled.current) {
45
+ yield onAttachmentAdded();
46
+ }
35
47
  setIsMarkdownFileUploadinProgress(false);
48
+ isMarkdownFileUploadCanceled.current = false;
36
49
  });
37
50
  const onFileAttach = (files, isPublic) => __awaiter(this, void 0, void 0, function* () {
38
51
  setIsMarkdownFileUploadinProgress(true);
@@ -43,6 +56,13 @@ export function useMarkdownFileUploader({ caseNumber, secureSupport, onAttachmen
43
56
  });
44
57
  onImageUploadComplete();
45
58
  });
59
+ /**
60
+ * Cancel upload function which will take care to abort current operation and marking upload progress false
61
+ */
62
+ const cancelFileUpload = () => {
63
+ isMarkdownFileUploadCanceled.current = true;
64
+ setIsMarkdownFileUploadinProgress(false);
65
+ };
46
66
  const onFileSelect = (selectedImage) => {
47
67
  pendoTrackEvent(markdownInlineFileSelectEvent);
48
68
  };
@@ -77,5 +97,6 @@ export function useMarkdownFileUploader({ caseNumber, secureSupport, onAttachmen
77
97
  onFileSelect,
78
98
  onFileAttach,
79
99
  onFileDelete,
100
+ cancelFileUpload,
80
101
  };
81
102
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PostComment.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDiscussion/PostComment.tsx"],"names":[],"mappings":"AAoCA,OAAO,EAAkB,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAqB5F,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,WAAW,EAAE,CAAC;CACjC;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,eA2bxC"}
1
+ {"version":3,"file":"PostComment.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDiscussion/PostComment.tsx"],"names":[],"mappings":"AAoCA,OAAO,EAAkB,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAqB5F,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,WAAW,EAAE,CAAC;CACjC;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,eAkcxC"}
@@ -54,7 +54,7 @@ export function PostComment(props) {
54
54
  const [isProcessing, setIsProcessing] = useState(isPostingComment || isUploadingAttachments);
55
55
  const { globalMetadataState: { loggedInUser, loggedInUserRights, loggedInUsersAccount, pcmConfig }, } = useContext(GlobalMetadataStateContext);
56
56
  const allowInlineImagesInMarkdown = getConfigField(pcmConfig.data, 'allowInlineImagesInMarkdown', PCM_CONFIG_FIELD_TYPE.FEATURE_FLAG);
57
- const { onFileSelect, onFileAttach, onFileDelete, isUploadingFile, isMarkdownFileUploadInProgress } = useMarkdownFileUploader({
57
+ const { onFileSelect, onFileAttach, onFileDelete, isUploadingFile, isMarkdownFileUploadInProgress, cancelFileUpload, } = useMarkdownFileUploader({
58
58
  caseNumber,
59
59
  secureSupport: loggedInUsersAccount.data.secureSupport,
60
60
  onAttachmentAdded: props.onAttachmentAdded,
@@ -112,6 +112,7 @@ export function PostComment(props) {
112
112
  const onCancelClick = () => {
113
113
  resetCommentSection();
114
114
  resetAttachmentSection();
115
+ cancelFileUpload();
115
116
  };
116
117
  const loggedInUserSSO = loggedInUserRights.data.getSSOUsername();
117
118
  // https://github.com/facebook/react/issues/19240
@@ -1 +1 @@
1
- {"version":3,"file":"Cep.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseManagement/Cep.tsx"],"names":[],"mappings":"AAyBA,UAAU,MAAM;CAAG;AAEnB,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,eAkRhC"}
1
+ {"version":3,"file":"Cep.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseManagement/Cep.tsx"],"names":[],"mappings":"AAyBA,UAAU,MAAM;CAAG;AAEnB,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,eAuRhC"}
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { Modal, ModalVariant, Popover, PopoverPosition } from '@patternfly/react-core';
11
- import { LoadingIndicator, TextAreaAutosize, ToastNotification, useConfirmation } from '@rh-support/components';
11
+ import { Input, LoadingIndicator, TextAreaResizable, ToastNotification, useConfirmation } from '@rh-support/components';
12
12
  import { GlobalMetadataStateContext, useCanEditCase } from '@rh-support/react-context';
13
13
  import { AbilityContext, CaseListFields, resourceActions, resources } from '@rh-support/user-permissions';
14
14
  import isEmpty from 'lodash/isEmpty';
@@ -94,17 +94,17 @@ export function Cep(props) {
94
94
  setCaseState(caseDispatch, { cepDetails: cepDetailsLocal });
95
95
  }
96
96
  };
97
- const onCepContactNameChange = (e) => {
98
- setCepDetailsLocal(Object.assign(Object.assign({}, cepDetailsLocal), { contactName: e.target.value }));
97
+ const onCepContactNameChange = (value) => {
98
+ setCepDetailsLocal(Object.assign(Object.assign({}, cepDetailsLocal), { contactName: value }));
99
99
  };
100
- const onCepWorkingHoursChange = (e) => {
101
- setCepDetailsLocal(Object.assign(Object.assign({}, cepDetailsLocal), { workingHours: e.target.value }));
100
+ const onCepWorkingHoursChange = (value) => {
101
+ setCepDetailsLocal(Object.assign(Object.assign({}, cepDetailsLocal), { workingHours: value }));
102
102
  };
103
- const onCepContactInformationsChange = (e) => {
104
- setCepDetailsLocal(Object.assign(Object.assign({}, cepDetailsLocal), { contactInformation: e.target.value }));
103
+ const onCepContactInformationsChange = (value) => {
104
+ setCepDetailsLocal(Object.assign(Object.assign({}, cepDetailsLocal), { contactInformation: value }));
105
105
  };
106
- const onCepNotesChange = (e) => {
107
- setCepDetailsLocal(Object.assign(Object.assign({}, cepDetailsLocal), { notes: e.target.value }));
106
+ const onCepNotesChange = (value) => {
107
+ setCepDetailsLocal(Object.assign(Object.assign({}, cepDetailsLocal), { notes: value }));
108
108
  };
109
109
  const isSubmitButtonDisabled = isEmpty(cepDetailsLocal.contactName) ||
110
110
  isEmpty(cepDetailsLocal.workingHours) ||
@@ -136,7 +136,7 @@ export function Cep(props) {
136
136
  React.createElement(Trans, null, "Contact name"),
137
137
  "\u00A0",
138
138
  React.createElement("span", { className: "form-required", "aria-hidden": true }, "*")),
139
- React.createElement("input", { type: "text", id: "cep-contact-name", className: `form-control`, "aria-required": true, required: true, maxLength: 254, name: "cep-contact-name", value: cepDetailsLocal.contactName, onChange: onCepContactNameChange }),
139
+ React.createElement(Input, { type: "text", id: "cep-contact-name", className: `form-control`, "aria-required": true, isRequired: true, maxLength: 254, ariaLabel: t('cep-contact-name'), onChange: onCepContactNameChange, isSpaceAllowed: false }),
140
140
  React.createElement("p", { className: "form-instructions" },
141
141
  React.createElement(Trans, null, "Provide main contact(s) troubleshooting the issue."))),
142
142
  React.createElement("div", { className: "form-group" },
@@ -144,7 +144,7 @@ export function Cep(props) {
144
144
  React.createElement(Trans, null, "Availability/Working hours"),
145
145
  "\u00A0",
146
146
  React.createElement("span", { className: "form-required", "aria-hidden": true }, "*")),
147
- React.createElement("input", { type: "text", id: "cep-workingHours", className: `form-control`, "aria-required": true, required: true, maxLength: 254, placeholder: 'M-F 9:00am - 5:00pm EDT', name: "cep-workingHours", value: cepDetailsLocal.workingHours, onChange: onCepWorkingHoursChange }),
147
+ React.createElement(Input, { type: "text", id: "cep-workingHours", className: `form-control`, "aria-required": true, isRequired: true, maxLength: 254, placeholder: 'M-F 9:00am - 5:00pm EDT', ariaLabel: t('cep-workingHours'), onChange: onCepWorkingHoursChange, isSpaceAllowed: false }),
148
148
  React.createElement("p", { className: "form-instructions" },
149
149
  React.createElement(Trans, null, "Indicate working hours, time zone; specify if not available on certain dates (i.e. weekends, holidays)."))),
150
150
  React.createElement("div", { className: "form-group" },
@@ -152,13 +152,13 @@ export function Cep(props) {
152
152
  React.createElement(Trans, null, "Contact information"),
153
153
  "\u00A0",
154
154
  React.createElement("span", { className: "form-required", "aria-hidden": true }, "*")),
155
- React.createElement(TextAreaAutosize, { id: "cep-contactInformation", className: `form-control`, "aria-required": true, required: true, maxLength: 2000, name: "cep-contactInformation", value: cepDetailsLocal.contactInformation, onChange: onCepContactInformationsChange }),
155
+ React.createElement(TextAreaResizable, { id: "cep-contactInformation", className: `form-control`, "aria-required": true, required: true, maxLength: 2000, name: "cep-contactInformation", value: cepDetailsLocal.contactInformation, onChange: onCepContactInformationsChange, "aria-label": "auto resizing text area example", isSpaceAllowed: false, autoResize: true }),
156
156
  React.createElement("p", { className: "form-instructions" },
157
157
  React.createElement(Trans, null, "Please provide phone number, chat ID or email."))),
158
158
  React.createElement("div", { className: "form-group" },
159
159
  React.createElement("label", { htmlFor: "cep-notes" },
160
160
  React.createElement(Trans, null, "Notes")),
161
- React.createElement(TextAreaAutosize, { id: "cep-notes", className: `form-control`, "aria-required": true, required: true, maxLength: 2000, name: "cep-notese", value: cepDetailsLocal.notes, onChange: onCepNotesChange }),
161
+ React.createElement(TextAreaResizable, { id: "cep-notes", className: `form-control`, "aria-required": true, required: true, maxLength: 2000, name: "cep-notese", value: cepDetailsLocal.notes, onChange: onCepNotesChange, isSpaceAllowed: false, autoResize: true }),
162
162
  React.createElement("p", { className: "form-instructions" },
163
163
  React.createElement(Trans, null, "Provide any pertinent information that Red Hat Support should be aware of that's not already captured in the issue statement or comments.")))))));
164
164
  }
@@ -1,5 +1,2 @@
1
- interface IProps {
2
- }
3
- export declare function AsideResults(props: IProps): JSX.Element;
4
- export {};
1
+ export declare function AsideResults(): JSX.Element;
5
2
  //# sourceMappingURL=AsideResults.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AsideResults.d.ts","sourceRoot":"","sources":["../../../../src/components/Recommendations/AsideResults.tsx"],"names":[],"mappings":"AA4BA,UAAU,MAAM;CAAG;AAEnB,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,eAsKzC"}
1
+ {"version":3,"file":"AsideResults.d.ts","sourceRoot":"","sources":["../../../../src/components/Recommendations/AsideResults.tsx"],"names":[],"mappings":"AAgCA,wBAAgB,YAAY,gBAmL3B"}
@@ -12,7 +12,7 @@ import { useDebounce } from '@rh-support/components';
12
12
  import { computeRecommendationAbstract, computeRecommendationTitle, getSolrParams, replaceHighlightingData, } from '@rh-support/utils';
13
13
  import isEmpty from 'lodash/isEmpty';
14
14
  import isEqual from 'lodash/isEqual';
15
- import React, { useContext, useRef } from 'react';
15
+ import React, { useContext, useEffect, useRef } from 'react';
16
16
  import { Trans } from 'react-i18next';
17
17
  import { useCaseDispatch, useCaseSelector } from '../../context/CaseContext';
18
18
  import { RecommendationDispatchContext, RecommendationStateContext } from '../../context/RecommendationContext';
@@ -22,10 +22,10 @@ import { getDescriptionWOQues } from '../../reducers/CaseHelpers';
22
22
  import { setCaseRecommendations } from '../../reducers/CaseReducer';
23
23
  import { RecommendationsConstants } from '../../reducers/RecommendationsReducer';
24
24
  import { showSidebarRecommendationsSections } from '../../reducers/RouteConstNTypes';
25
- import { createOrUpdateSessionResources, getRecToSave } from '../../reducers/SessionRestoreReducer';
25
+ import { createOrUpdateSessionResources, getSessResFromRec, getSessResFromRecs, } from '../../reducers/SessionRestoreReducer';
26
26
  import RouteUtils from '../../utils/routeUtils';
27
- const { SessionResourceSource } = pcm.preCase.session;
28
- export function AsideResults(props) {
27
+ const { SessionResourceSource, SessionResourceVisibility } = pcm.preCase.session;
28
+ export function AsideResults() {
29
29
  /*
30
30
  * Sidebar recommendation logic
31
31
  */
@@ -48,6 +48,12 @@ export function AsideResults(props) {
48
48
  const sessionRestoreDispatch = useContext(SessionRestoreDispatchContext);
49
49
  const { routeState: { activeSection }, } = useContext(RouteContext);
50
50
  const PAGE_SIZE = 5;
51
+ const payload = JSON.stringify({
52
+ product: product,
53
+ version: version,
54
+ summary: summary,
55
+ description: getDescriptionWOQues(issue, environment, periodicityOfIssue, timeFramesAndUrgency),
56
+ });
51
57
  // abort controller ref
52
58
  const controllerRef = useRef(new AbortController());
53
59
  useDebounce(() => {
@@ -106,16 +112,13 @@ export function AsideResults(props) {
106
112
  const canShowSideRecommendations = () => showSidebarRecommendationsSections.includes(activeSection) &&
107
113
  recommendationState.sideRecommendation.length > 0 &&
108
114
  !recommendationState.sideRecommendationError;
109
- const onResourceClick = (doc) => (event) => {
110
- const payload = JSON.stringify({
111
- product: product,
112
- version: version,
113
- summary: summary,
114
- description: getDescriptionWOQues(issue, environment, periodicityOfIssue, timeFramesAndUrgency),
115
- });
116
- const resourcesToSave = getRecToSave(doc, recommendationState.sideRecommendation);
117
- createOrUpdateSessionResources(sessionRestoreDispatch, activeSessionId, sessionResourceTracking, SessionResourceSource.RECOMMENDATIONS_ASIDE, resourcesToSave, payload);
115
+ const onResourceClick = (doc, index) => (event) => {
116
+ createOrUpdateSessionResources(sessionRestoreDispatch, activeSessionId, sessionResourceTracking, SessionResourceSource.RECOMMENDATIONS_ASIDE, [getSessResFromRec(doc, SessionResourceVisibility.VISITED, index)], payload);
118
117
  };
118
+ useEffect(() => {
119
+ createOrUpdateSessionResources(sessionRestoreDispatch, activeSessionId, sessionResourceTracking, SessionResourceSource.RECOMMENDATIONS_ASIDE, getSessResFromRecs(recommendationState.sideRecommendation, SessionResourceVisibility.PRESENTED), JSON.stringify(payload));
120
+ // eslint-disable-next-line react-hooks/exhaustive-deps
121
+ }, [recommendationState.sideRecommendation, activeSessionId]);
119
122
  if (!canShowSideRecommendations())
120
123
  return React.createElement(React.Fragment, null);
121
124
  return (React.createElement("div", { className: "card card-white card-support top-recommendations" },
@@ -126,7 +129,7 @@ export function AsideResults(props) {
126
129
  var _a, _b;
127
130
  return (React.createElement("li", { className: "result", key: doc.id },
128
131
  React.createElement("header", { className: "result-header" },
129
- React.createElement("a", { href: `${doc.view_uri}?${RouteUtils.getSEResourceQueryParams(activeSessionId, (_b = (_a = sessionResourceTracking[SessionResourceSource.RECOMMENDATIONS_ASIDE]) === null || _a === void 0 ? void 0 : _a.resourceOriginId) !== null && _b !== void 0 ? _b : '', SessionResourceSource.RECOMMENDATIONS_ASIDE)}`, className: "se-recommended ts-result-aside", "data-tracking-id": `se-recommended-sidebar-recommendations-${index}`, rel: "noopener noreferrer", target: "_blank", onClick: onResourceClick(doc), dangerouslySetInnerHTML: computeRecommendationTitle(doc) })),
132
+ React.createElement("a", { href: `${doc.view_uri}?${RouteUtils.getSEResourceQueryParams(activeSessionId, (_b = (_a = sessionResourceTracking[SessionResourceSource.RECOMMENDATIONS_ASIDE]) === null || _a === void 0 ? void 0 : _a.resourceOriginId) !== null && _b !== void 0 ? _b : '', SessionResourceSource.RECOMMENDATIONS_ASIDE)}`, className: "se-recommended ts-result-aside", "data-tracking-id": `se-recommended-sidebar-recommendations-${index}`, rel: "noopener noreferrer", target: "_blank", onClick: onResourceClick(doc, index), dangerouslySetInnerHTML: computeRecommendationTitle(doc) })),
130
133
  React.createElement("p", { className: "result-body", dangerouslySetInnerHTML: computeRecommendationAbstract(doc, 150) })));
131
134
  })))));
132
135
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ClusterRecommendationItems.d.ts","sourceRoot":"","sources":["../../../../src/components/Recommendations/ClusterRecommendationItems.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oDAAoD,CAAC;AAW5F,UAAU,MAAM;IACZ,sBAAsB,EAAE,sBAAsB,EAAE,CAAC;CACpD;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,eAiFvD"}
1
+ {"version":3,"file":"ClusterRecommendationItems.d.ts","sourceRoot":"","sources":["../../../../src/components/Recommendations/ClusterRecommendationItems.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oDAAoD,CAAC;AAe5F,UAAU,MAAM;IACZ,sBAAsB,EAAE,sBAAsB,EAAE,CAAC;CACpD;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,eA8FvD"}
@@ -1,28 +1,33 @@
1
1
  import { pcm } from '@cee-eng/hydrajs';
2
2
  import { Label } from '@patternfly/react-core';
3
3
  import isEqual from 'lodash/isEqual';
4
- import React, { useContext } from 'react';
4
+ import React, { useContext, useEffect } from 'react';
5
5
  import { Trans } from 'react-i18next';
6
6
  import { useCaseSelector } from '../../context/CaseContext';
7
7
  import { SessionRestoreDispatchContext, SessionRestoreStateContext } from '../../context/SessionRestoreContext';
8
8
  import { useParseRuleMarkdown } from '../../hooks/useParseRuleMarkdown';
9
- import { createOrUpdateSessionResources, getRulesToSave } from '../../reducers/SessionRestoreReducer';
9
+ import { createOrUpdateSessionResources, getRulesToSave, getSessResFromRules, } from '../../reducers/SessionRestoreReducer';
10
10
  import { riskLabels } from '../shared/Constants';
11
11
  export function ClusterRecommendationItems(props) {
12
12
  const sessionRestoreDispatch = useContext(SessionRestoreDispatchContext);
13
13
  const { sessionRestore: { activeSessionId, sessionResourceTracking }, } = useContext(SessionRestoreStateContext);
14
- const { SessionResourceSource } = pcm.preCase.session;
15
- const { version, product } = useCaseSelector((state) => ({
14
+ const { SessionResourceSource, SessionResourceVisibility } = pcm.preCase.session;
15
+ const { version, product, openshiftClusterID } = useCaseSelector((state) => ({
16
16
  version: state.caseDetails.version,
17
17
  product: state.caseDetails.product,
18
+ openshiftClusterID: state.caseDetails.openshiftClusterID,
18
19
  }), isEqual);
19
20
  const { parseDotMarkdownWithTracking } = useParseRuleMarkdown();
20
21
  const onResourceClick = (e, rule) => {
21
22
  if (e.target.tagName.toLowerCase() === 'a') {
22
23
  const visitedUrl = e.target.href.split('?')[0];
23
- createOrUpdateSessionResources(sessionRestoreDispatch, activeSessionId, sessionResourceTracking, SessionResourceSource.CLUSTER_RECOMMENDATION, getRulesToSave(visitedUrl, rule, props.clusterRecommendations), JSON.stringify({ product, version }));
24
+ createOrUpdateSessionResources(sessionRestoreDispatch, activeSessionId, sessionResourceTracking, SessionResourceSource.CLUSTER_RECOMMENDATION, [getSessResFromRules(visitedUrl, SessionResourceVisibility.VISITED, rule.rule_id)], JSON.stringify({ product, version, openshiftClusterID }));
24
25
  }
25
26
  };
27
+ useEffect(() => {
28
+ createOrUpdateSessionResources(sessionRestoreDispatch, activeSessionId, sessionResourceTracking, SessionResourceSource.CLUSTER_RECOMMENDATION, getRulesToSave('', '', props.clusterRecommendations), JSON.stringify({ product, version, openshiftClusterID }));
29
+ // eslint-disable-next-line react-hooks/exhaustive-deps
30
+ }, [props.clusterRecommendations, activeSessionId]);
26
31
  return (React.createElement("pfe-accordion", null, props.clusterRecommendations.map((rule) => (React.createElement(React.Fragment, null,
27
32
  React.createElement("pfe-accordion-header", null,
28
33
  React.createElement("h3", null, rule.description)),
@@ -1 +1 @@
1
- {"version":3,"file":"EARule.d.ts","sourceRoot":"","sources":["../../../../../src/components/Recommendations/EARules/EARule.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAM1C,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D,UAAU,cAAc;IACpB,IAAI,EAAE,aAAa,CAAC;IACpB,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;CAClG;AAGD,eAAO,MAAM,aAAa,+BAGxB,CAAC;AAEH,wBAAgB,gBAAgB,mBAM/B;AACD,wBAAgB,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;;CAAA,eA0BxC;AAED,iBAAS,WAAW,gBAGnB;AAED,iBAAS,iBAAiB,gBAsBzB;AAED,iBAAS,aAAa,CAAC,EAAE,SAA6B,EAAE,SAAc,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,eA4BnH;AAED,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"EARule.d.ts","sourceRoot":"","sources":["../../../../../src/components/Recommendations/EARules/EARule.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAM1C,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D,UAAU,cAAc;IACpB,IAAI,EAAE,aAAa,CAAC;IACpB,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;CAClG;AAGD,eAAO,MAAM,aAAa,+BAGxB,CAAC;AAEH,wBAAgB,gBAAgB,mBAM/B;AACD,wBAAgB,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;;CAAA,eAmCxC;AAED,iBAAS,WAAW,gBAGnB;AAED,iBAAS,iBAAiB,gBAsBzB;AAED,iBAAS,aAAa,CAAC,EAAE,SAA6B,EAAE,SAAc,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,eA4BnH;AAED,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,aAAa,EAAE,CAAC"}
@@ -1,13 +1,14 @@
1
1
  /* eslint-disable @typescript-eslint/no-unused-vars */
2
2
  import { pcm } from '@cee-eng/hydrajs';
3
3
  import CaretRightIcon from '@patternfly/react-icons/dist/js/icons/caret-right-icon';
4
+ import isEqual from 'lodash/isEqual';
4
5
  import React, { useContext } from 'react';
5
6
  import { Trans } from 'react-i18next';
6
- import { RulesStateContext } from '../../../context/RulesContext';
7
+ import { useCaseSelector } from '../../../context/CaseContext';
7
8
  import { SessionRestoreDispatchContext, SessionRestoreStateContext } from '../../../context/SessionRestoreContext';
8
9
  import { useParseRuleMarkdown } from '../../../hooks/useParseRuleMarkdown';
9
- import { createOrUpdateSessionResources, getRulesToSave } from '../../../reducers/SessionRestoreReducer';
10
- const { SessionResourceSource } = pcm.preCase.session;
10
+ import { createOrUpdateSessionResources, getSessResFromEA } from '../../../reducers/SessionRestoreReducer';
11
+ const { SessionResourceSource, SessionResourceVisibility } = pcm.preCase.session;
11
12
  export const EARuleContext = React.createContext({
12
13
  rule: {},
13
14
  onCtaClick: null,
@@ -21,10 +22,13 @@ export function useEARuleContext() {
21
22
  }
22
23
  export function EARule({ children, rule }) {
23
24
  const { sessionRestore: { activeSessionId, sessionResourceTracking }, } = useContext(SessionRestoreStateContext);
25
+ const { product, version } = useCaseSelector((state) => ({
26
+ product: state.caseDetails.product,
27
+ version: state.caseDetails.version,
28
+ }), isEqual);
24
29
  const sessionRestoreDispatch = useContext(SessionRestoreDispatchContext);
25
- const { rulesState } = useContext(RulesStateContext);
26
- const onCtaClick = (link) => (event) => {
27
- createOrUpdateSessionResources(sessionRestoreDispatch, activeSessionId, sessionResourceTracking, SessionResourceSource.EDMOUND_ABOTT, getRulesToSave(link, rule, rulesState.EARules.rules));
30
+ const onCtaClick = (link) => () => {
31
+ createOrUpdateSessionResources(sessionRestoreDispatch, activeSessionId, sessionResourceTracking, SessionResourceSource.EDMOUND_ABOTT, [getSessResFromEA(link, SessionResourceVisibility.VISITED, rule.rule_id)], JSON.stringify({ product, version }));
28
32
  };
29
33
  return (React.createElement(EARuleContext.Provider, { value: {
30
34
  rule,
@@ -1 +1 @@
1
- {"version":3,"file":"EARuleInfoInline.d.ts","sourceRoot":"","sources":["../../../../../src/components/Recommendations/EARules/EARuleInfoInline.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,aAAa,EAAkD,MAAM,gCAAgC,CAAC;AAM/G,UAAU,MAAM;IACZ,OAAO,EAAE,aAAa,EAAE,CAAC;CAC5B;AACD,wBAAgB,gBAAgB,CAAC,EAAE,OAAY,EAAE,EAAE,MAAM,eAiIxD"}
1
+ {"version":3,"file":"EARuleInfoInline.d.ts","sourceRoot":"","sources":["../../../../../src/components/Recommendations/EARules/EARuleInfoInline.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,aAAa,EAAkD,MAAM,gCAAgC,CAAC;AAO/G,UAAU,MAAM;IACZ,OAAO,EAAE,aAAa,EAAE,CAAC;CAC5B;AAED,wBAAgB,gBAAgB,CAAC,EAAE,OAAY,EAAE,EAAE,MAAM,eAuJxD"}
@@ -15,15 +15,18 @@ import InfoCircleIcon from '@patternfly/react-icons/dist/js/icons/info-circle-ic
15
15
  import { PaginationCompact, useFetch } from '@rh-support/components';
16
16
  import { GlobalMetadataStateContext } from '@rh-support/react-context';
17
17
  import { getResTypeFromUrl, getStyleVariantColor, StyleVariants } from '@rh-support/utils';
18
+ import isEqual from 'lodash/isEqual';
18
19
  import some from 'lodash/some';
19
20
  import React, { useContext, useEffect, useState } from 'react';
20
21
  import { Trans, useTranslation } from 'react-i18next';
22
+ import { useCaseSelector } from '../../../context/CaseContext';
21
23
  import { RulesDispatchContext } from '../../../context/RulesContext';
22
- import { SessionRestoreStateContext } from '../../../context/SessionRestoreContext';
24
+ import { SessionRestoreDispatchContext, SessionRestoreStateContext } from '../../../context/SessionRestoreContext';
23
25
  import { markEARuleResolved, setEARulesVisibilityChange } from '../../../reducers/RulesReducer';
26
+ import { createOrUpdateSessionResources, getSessResFromRules } from '../../../reducers/SessionRestoreReducer';
24
27
  import { RecommendationFeedbackModal } from '../RecommendationFeedbackModal';
25
28
  import { EARule, EARuleArticle, EARuleDescription, EARuleTitle } from './EARule';
26
- const { SessionResourceSource } = pcm.preCase.session;
29
+ const { SessionResourceSource, SessionResourceVisibility } = pcm.preCase.session;
27
30
  export function EARuleInfoInline({ eaRules = [] }) {
28
31
  const { t } = useTranslation();
29
32
  const [currentPage, setCurrentPage] = useState(1);
@@ -32,6 +35,11 @@ export function EARuleInfoInline({ eaRules = [] }) {
32
35
  const { sessionRestore: { activeSessionId, sessionResourceTracking }, } = useContext(SessionRestoreStateContext);
33
36
  const [isModalVisible, setIsModalVisible] = useState(false);
34
37
  const { globalMetadataState: { loggedInUsersAccount }, } = useContext(GlobalMetadataStateContext);
38
+ const sessionRestoreDispatch = useContext(SessionRestoreDispatchContext);
39
+ const { product, version } = useCaseSelector((state) => ({
40
+ product: state.caseDetails.product,
41
+ version: state.caseDetails.version,
42
+ }), isEqual);
35
43
  const isSecureSupportAccount = loggedInUsersAccount.data.secureSupport;
36
44
  const validEARulesLength = eaRules.length;
37
45
  const isAnyRuleResolved = some(eaRules, (item) => item.resolved);
@@ -43,6 +51,9 @@ export function EARuleInfoInline({ eaRules = [] }) {
43
51
  // eslint-disable-next-line react-hooks/exhaustive-deps
44
52
  }, [validEARulesLength]);
45
53
  const onPaginationChange = (currentPage) => {
54
+ createOrUpdateSessionResources(sessionRestoreDispatch, activeSessionId, sessionResourceTracking, SessionResourceSource.EDMOUND_ABOTT, [
55
+ getSessResFromRules(null, SessionResourceVisibility.PRESENTED, eaRules[currentPage - 1].rule_id, currentPage),
56
+ ], JSON.stringify({ product, version }));
46
57
  setCurrentPage(currentPage);
47
58
  };
48
59
  const onIgnoreBtnClick = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"EARuleWidget.d.ts","sourceRoot":"","sources":["../../../../../src/components/Recommendations/EARules/EARuleWidget.tsx"],"names":[],"mappings":"AAOA,wBAAgB,YAAY,gBAO3B"}
1
+ {"version":3,"file":"EARuleWidget.d.ts","sourceRoot":"","sources":["../../../../../src/components/Recommendations/EARules/EARuleWidget.tsx"],"names":[],"mappings":"AAgBA,wBAAgB,YAAY,gBA2C3B"}
@@ -1,10 +1,35 @@
1
+ import { pcm } from '@cee-eng/hydrajs';
2
+ import differenceBy from 'lodash/differenceBy';
1
3
  import filter from 'lodash/filter';
2
- import React, { useContext } from 'react';
4
+ import isEmpty from 'lodash/isEmpty';
5
+ import isEqual from 'lodash/isEqual';
6
+ import React, { useContext, useEffect } from 'react';
7
+ import { useCaseSelector } from '../../../context/CaseContext';
3
8
  import { RulesStateContext } from '../../../context/RulesContext';
9
+ import { SessionRestoreDispatchContext, SessionRestoreStateContext } from '../../../context/SessionRestoreContext';
10
+ import { createOrUpdateSessionResources, getSessResFromRules } from '../../../reducers/SessionRestoreReducer';
4
11
  import { EARuleInfoInline } from './EARuleInfoInline';
12
+ const { SessionResourceSource, SessionResourceVisibility } = pcm.preCase.session;
5
13
  export function EARuleWidget() {
6
14
  const { rulesState: { isEARuleWidgetVisible, EARules }, } = useContext(RulesStateContext);
15
+ const { sessionRestore: { activeSessionId, sessionResourceTracking }, } = useContext(SessionRestoreStateContext);
16
+ const sessionRestoreDispatch = useContext(SessionRestoreDispatchContext);
17
+ const { product, version } = useCaseSelector((state) => ({
18
+ product: state.caseDetails.product,
19
+ version: state.caseDetails.version,
20
+ }), isEqual);
7
21
  const validEARules = filter(EARules.rules, (r) => r.visible && r.rule_sub_type !== 'attachment');
22
+ useEffect(() => {
23
+ var _a;
24
+ const presentedIds = (((_a = sessionResourceTracking[SessionResourceSource.EDMOUND_ABOTT]) === null || _a === void 0 ? void 0 : _a.presentedResources) || []).map((p) => p.resourceEntityId);
25
+ const visibleValidEARules = validEARules.find((r) => r.visible === true);
26
+ if (visibleValidEARules &&
27
+ differenceBy([visibleValidEARules === null || visibleValidEARules === void 0 ? void 0 : visibleValidEARules.rule_id], presentedIds).length > 0 &&
28
+ !isEmpty(activeSessionId)) {
29
+ createOrUpdateSessionResources(sessionRestoreDispatch, activeSessionId, sessionResourceTracking, SessionResourceSource.EDMOUND_ABOTT, [getSessResFromRules(null, SessionResourceVisibility.PRESENTED, visibleValidEARules.rule_id, 1)], JSON.stringify({ product, version }));
30
+ }
31
+ // eslint-disable-next-line react-hooks/exhaustive-deps
32
+ }, [validEARules, activeSessionId]);
8
33
  if (!isEARuleWidgetVisible || validEARules.length < 1)
9
34
  return null;
10
35
  return React.createElement(EARuleInfoInline, { eaRules: validEARules });
@@ -1 +1 @@
1
- {"version":3,"file":"InsightsRuleInfo.d.ts","sourceRoot":"","sources":["../../../../src/components/Recommendations/InsightsRuleInfo.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAI7D,UAAU,MAAM;IACZ,GAAG,EAAE,wBAAwB,CAAC;IAC9B,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,MAAM,EAAE,CAAC;CAC3B;AAOD,wBAAgB,gBAAgB,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,aAAa,EAAE,EAAE,MAAM,eA8J1E"}
1
+ {"version":3,"file":"InsightsRuleInfo.d.ts","sourceRoot":"","sources":["../../../../src/components/Recommendations/InsightsRuleInfo.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAI7D,UAAU,MAAM;IACZ,GAAG,EAAE,wBAAwB,CAAC;IAC9B,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,MAAM,EAAE,CAAC;CAC3B;AAOD,wBAAgB,gBAAgB,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,aAAa,EAAE,EAAE,MAAM,eA2J1E"}
@@ -6,12 +6,11 @@ import InfoCircleIcon from '@patternfly/react-icons/dist/js/icons/info-circle-ic
6
6
  import { getRuleReasonHtml } from '@rh-support/utils';
7
7
  import React, { useContext, useEffect, useRef, useState } from 'react';
8
8
  import { Trans } from 'react-i18next';
9
- import { RulesStateContext } from '../../context/RulesContext';
10
9
  import { SessionRestoreDispatchContext, SessionRestoreStateContext } from '../../context/SessionRestoreContext';
11
10
  import { useParseRuleMarkdown } from '../../hooks/useParseRuleMarkdown';
12
- import { createOrUpdateSessionResources, getInsightRulesToSave } from '../../reducers/SessionRestoreReducer';
11
+ import { createOrUpdateSessionResources, getSessResFromRules } from '../../reducers/SessionRestoreReducer';
13
12
  import { AttachmentStateContext } from '../shared/fileUpload/reducer/AttachmentReducerContext';
14
- const { SessionResourceSource } = pcm.preCase.session;
13
+ const { SessionResourceSource, SessionResourceVisibility } = pcm.preCase.session;
15
14
  export function InsightsRuleInfo({ doc, showNewTag, duplicateKeys }) {
16
15
  var _a, _b, _c, _d, _e, _f, _g;
17
16
  const [ruleData, setRuleData] = useState(null);
@@ -20,7 +19,6 @@ export function InsightsRuleInfo({ doc, showNewTag, duplicateKeys }) {
20
19
  const [isIssueExpanded, setIsIssueExpanded] = useState(true);
21
20
  const [isAdditionalExpanded, setIsAdditionalExpanded] = useState(false);
22
21
  const { sessionRestore: { activeSessionId, sessionResourceTracking }, } = useContext(SessionRestoreStateContext);
23
- const { rulesState: { insightRules }, } = useContext(RulesStateContext);
24
22
  const sessionRestoreDispatch = useContext(SessionRestoreDispatchContext);
25
23
  const { parseDotMarkdownWithTracking, getTrackingULRWithQueryParams } = useParseRuleMarkdown();
26
24
  const { attachmentState: { caseFiles: { selectedLocalFiles }, }, } = useContext(AttachmentStateContext);
@@ -38,7 +36,7 @@ export function InsightsRuleInfo({ doc, showNewTag, duplicateKeys }) {
38
36
  setRuleData(rules[ruleId]);
39
37
  }, [setRuleData, doc.attachmentId, doc.id, selectedLocalFiles, duplicateKeys]);
40
38
  const onCtaClick = (link) => (event) => {
41
- createOrUpdateSessionResources(sessionRestoreDispatch, activeSessionId, sessionResourceTracking, SessionResourceSource.INSIGHTS, getInsightRulesToSave(link, doc, insightRules.rules));
39
+ createOrUpdateSessionResources(sessionRestoreDispatch, activeSessionId, sessionResourceTracking, SessionResourceSource.INSIGHTS, [getSessResFromRules(link, SessionResourceVisibility.VISITED, ruleData.rule_id)]);
42
40
  };
43
41
  const parseMoreInfo = (moreInfo, reportDetails) => {
44
42
  return parseDotMarkdownWithTracking(moreInfo, reportDetails, SessionResourceSource.INSIGHTS, 'ts-result-insights', 'se-recommended-insights-rule');
@@ -1 +1 @@
1
- {"version":3,"file":"Recommendations.d.ts","sourceRoot":"","sources":["../../../../src/components/Recommendations/Recommendations.tsx"],"names":[],"mappings":"AA0CA,MAAM,CAAC,OAAO,UAAU,eAAe,gBAyNtC"}
1
+ {"version":3,"file":"Recommendations.d.ts","sourceRoot":"","sources":["../../../../src/components/Recommendations/Recommendations.tsx"],"names":[],"mappings":"AA8CA,MAAM,CAAC,OAAO,UAAU,eAAe,gBAmOtC"}
@@ -18,11 +18,11 @@ import { getRecommendationObject } from '../../reducers/CaseHelpers';
18
18
  import { setCaseRecommendations } from '../../reducers/CaseReducer';
19
19
  import { fetchRecommendations, RecommendationsConstants, setCurrentPage, setVisibleDocs, } from '../../reducers/RecommendationsReducer';
20
20
  import { AppRouteSections } from '../../reducers/RouteConstNTypes';
21
- import { createOrUpdateSessionResources, getRecToSave } from '../../reducers/SessionRestoreReducer';
21
+ import { createOrUpdateSessionResources, getSessResFromRec, getSessResFromRecs, } from '../../reducers/SessionRestoreReducer';
22
22
  import RouteUtils from '../../utils/routeUtils';
23
23
  import Issue from '../Issue/Issue';
24
24
  import { EARuleWidget } from './EARules/EARuleWidget';
25
- const { SessionResourceSource } = pcm.preCase.session;
25
+ const { SessionResourceSource, SessionResourceVisibility } = pcm.preCase.session;
26
26
  export default function Recommendations() {
27
27
  var _a, _b, _c;
28
28
  const { product, version, environment, summary, caseResourceLinks } = useCaseSelector((state) => ({
@@ -101,7 +101,9 @@ export default function Recommendations() {
101
101
  if (newRecommendations.length > 0) {
102
102
  setCaseRecommendations(caseDispatch, recommendationState.visibleDocs, caseResourceLinks);
103
103
  }
104
- }, [caseDispatch, recommendationState.visibleDocs, caseResourceLinks]);
104
+ createOrUpdateSessionResources(sessionRestoreDispatch, activeSessionId, sessionResourceTracking, SessionResourceSource.RECOMMENDATIONS, getSessResFromRecs(recommendationState.visibleDocs, SessionResourceVisibility.PRESENTED), JSON.stringify(payload));
105
+ // eslint-disable-next-line react-hooks/exhaustive-deps
106
+ }, [caseDispatch, recommendationState.visibleDocs, caseResourceLinks, activeSessionId]);
105
107
  useEffect(() => {
106
108
  // added the numFound !-==0 for when user click on back/continue button and we have no solution result
107
109
  // in this case we don't want to scroll to start of the solution result div
@@ -123,9 +125,8 @@ export default function Recommendations() {
123
125
  const onPageSizeChanged = (_, number) => {
124
126
  setPageSize(number);
125
127
  };
126
- const onResourceClick = (doc) => (event) => {
127
- const resourcesToSave = getRecToSave(doc, recommendationState.visibleDocs, recommendationState.allDocs);
128
- createOrUpdateSessionResources(sessionRestoreDispatch, activeSessionId, sessionResourceTracking, SessionResourceSource.RECOMMENDATIONS, resourcesToSave, JSON.stringify(payload));
128
+ const onResourceClick = (doc, index) => (event) => {
129
+ createOrUpdateSessionResources(sessionRestoreDispatch, activeSessionId, sessionResourceTracking, SessionResourceSource.RECOMMENDATIONS, [getSessResFromRec(doc, SessionResourceVisibility.VISITED, index)], JSON.stringify(payload));
129
130
  };
130
131
  return (React.createElement(React.Fragment, null,
131
132
  React.createElement(Issue, null),
@@ -136,7 +137,7 @@ export default function Recommendations() {
136
137
  var _a, _b;
137
138
  return (React.createElement("li", { className: "result", key: doc.id },
138
139
  React.createElement("header", { className: "result-header" },
139
- React.createElement("a", { href: `${doc.view_uri}?${RouteUtils.getSEResourceQueryParams(activeSessionId, (_b = (_a = sessionResourceTracking[SessionResourceSource.RECOMMENDATIONS]) === null || _a === void 0 ? void 0 : _a.resourceOriginId) !== null && _b !== void 0 ? _b : '', SessionResourceSource.RECOMMENDATIONS)}`, className: "se-recommended ts-result", "data-tracking-id": `se-recommended-main-recommendations-${i}`, rel: "noopener noreferrer", target: "_blank", onClick: onResourceClick(doc), dangerouslySetInnerHTML: computeRecommendationTitle(doc) }),
140
+ React.createElement("a", { href: `${doc.view_uri}?${RouteUtils.getSEResourceQueryParams(activeSessionId, (_b = (_a = sessionResourceTracking[SessionResourceSource.RECOMMENDATIONS]) === null || _a === void 0 ? void 0 : _a.resourceOriginId) !== null && _b !== void 0 ? _b : '', SessionResourceSource.RECOMMENDATIONS)}`, className: "se-recommended ts-result", "data-tracking-id": `se-recommended-main-recommendations-${i}`, rel: "noopener noreferrer", target: "_blank", onClick: onResourceClick(doc, i), dangerouslySetInnerHTML: computeRecommendationTitle(doc) }),
140
141
  React.createElement("div", { className: "header-meta" },
141
142
  doc.kcsState === 'verified' && (React.createElement(React.Fragment, null,
142
143
  React.createElement("span", { className: "status-verified" }, "verified"),
@@ -1 +1 @@
1
- {"version":3,"file":"RulesModal.d.ts","sourceRoot":"","sources":["../../../../src/components/Recommendations/RulesModal.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAG5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAG7D,UAAU,MAAM;IACZ,cAAc,EAAE,wBAAwB,EAAE,CAAC;IAC3C,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,aAAa,EAAE,MAAM,GAAG,CAAC;CAC5B;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,eAmI/C"}
1
+ {"version":3,"file":"RulesModal.d.ts","sourceRoot":"","sources":["../../../../src/components/Recommendations/RulesModal.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAI5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAG7D,UAAU,MAAM;IACZ,cAAc,EAAE,wBAAwB,EAAE,CAAC;IAC3C,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,aAAa,EAAE,MAAM,GAAG,CAAC;CAC5B;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,eAgJ/C"}
@@ -13,13 +13,15 @@ import { useFetch } from '@rh-support/components';
13
13
  import { getResTypeFromUrl } from '@rh-support/utils';
14
14
  import React, { useContext, useEffect, useState } from 'react';
15
15
  import { useTranslation } from 'react-i18next';
16
- import { SessionRestoreStateContext } from '../../context/SessionRestoreContext';
16
+ import { SessionRestoreDispatchContext, SessionRestoreStateContext } from '../../context/SessionRestoreContext';
17
+ import { createOrUpdateSessionResources, getSessResFromRecs } from '../../reducers/SessionRestoreReducer';
17
18
  import { AttachmentStateContext } from '../shared/fileUpload/reducer/AttachmentReducerContext';
18
19
  import { EARuleInfoAccordion } from './EARules/EARuleInfoAccordion';
19
20
  import { InsightsRuleInfo } from './InsightsRuleInfo';
20
21
  import { RecommendationFeedbackModal } from './RecommendationFeedbackModal';
21
22
  export function InsightResultModal(props) {
22
23
  const { t } = useTranslation();
24
+ const sessionRestoreDispatch = useContext(SessionRestoreDispatchContext);
23
25
  const potentialDuplicate = {};
24
26
  props.insightResults.map((value) => {
25
27
  if (potentialDuplicate.hasOwnProperty(value.id)) {
@@ -34,7 +36,7 @@ export function InsightResultModal(props) {
34
36
  });
35
37
  const { attachmentState: { caseFiles: { selectedLocalFiles }, }, } = useContext(AttachmentStateContext);
36
38
  const [canShowNewTag, setCanShowNewTag] = useState(false);
37
- const { SessionResourceSource } = pcm.preCase.session;
39
+ const { SessionResourceSource, SessionResourceVisibility } = pcm.preCase.session;
38
40
  const { request: resolveSessionRequest, isFetching } = useFetch(pcm.preCase.session.resolveSession);
39
41
  const { sessionRestore: { activeSessionId, sessionResourceTracking }, } = useContext(SessionRestoreStateContext);
40
42
  const [isModalVisible, setIsModalVisible] = useState(false);
@@ -57,6 +59,11 @@ export function InsightResultModal(props) {
57
59
  const onModalToggle = () => {
58
60
  setIsModalVisible((visible) => !visible);
59
61
  };
62
+ useEffect(() => {
63
+ props.isOpen &&
64
+ createOrUpdateSessionResources(sessionRestoreDispatch, activeSessionId, sessionResourceTracking, SessionResourceSource.INSIGHTS, getSessResFromRecs(props.insightResults, SessionResourceVisibility.PRESENTED));
65
+ // eslint-disable-next-line react-hooks/exhaustive-deps
66
+ }, [props.insightResults, activeSessionId, props.isOpen]);
60
67
  useEffect(() => {
61
68
  let total = props.EARule.length;
62
69
  let trueValues = 0;
@@ -3,7 +3,7 @@ export declare function useS3Upload(idToUploadTo: any, isSecureSupport: any): {
3
3
  file: any;
4
4
  description?: string;
5
5
  isPrivate?: boolean;
6
- listenerFn?: (percent: any) => void;
6
+ listenerFn?: (percent: any, abort: any) => void;
7
7
  }) => Promise<string>;
8
8
  isUploadingFile: boolean;
9
9
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useS3Upload.d.ts","sourceRoot":"","sources":["../../../src/hooks/useS3Upload.ts"],"names":[],"mappings":"AASA,wBAAgB,WAAW,CAAC,YAAY,KAAA,EAAE,eAAe,KAAA;;;;;;;;EAyExD"}
1
+ {"version":3,"file":"useS3Upload.d.ts","sourceRoot":"","sources":["../../../src/hooks/useS3Upload.ts"],"names":[],"mappings":"AASA,wBAAgB,WAAW,CAAC,YAAY,KAAA,EAAE,eAAe,KAAA;;;;;;;;EA0ExD"}
@@ -28,7 +28,7 @@ export function useS3Upload(idToUploadTo, isSecureSupport) {
28
28
  reader.readAsArrayBuffer(file.slice(0, 10));
29
29
  });
30
30
  });
31
- const uploadFile = ({ file, description = '', isPrivate = false, listenerFn = (percent) => { } }) => __awaiter(this, void 0, void 0, function* () {
31
+ const uploadFile = ({ file, description = '', isPrivate = false, listenerFn = (percent, abort) => { } }) => __awaiter(this, void 0, void 0, function* () {
32
32
  try {
33
33
  yield getFileAccessDetails(file);
34
34
  }
@@ -43,7 +43,8 @@ export function useS3Upload(idToUploadTo, isSecureSupport) {
43
43
  const percent = decimal * 100;
44
44
  // const verifyingUpdate = decimal === 1;
45
45
  const currentUploadProgress = Math.floor(percent);
46
- listenerFn(currentUploadProgress);
46
+ // Forwarding abort single to parent callback function
47
+ listenerFn(currentUploadProgress, abort);
47
48
  };
48
49
  const putObjectRequest = {
49
50
  Body: file,
@@ -13,6 +13,7 @@ export interface IResourceTracking {
13
13
  isCreating: boolean;
14
14
  isUpdating: boolean;
15
15
  visitedResources: ISessionResource[];
16
+ presentedResources: ISessionResource[];
16
17
  }
17
18
  export interface ISessionResourcesTracking {
18
19
  [source: string]: IResourceTracking;
@@ -32,9 +33,8 @@ export interface ISessionRestorePayloadType extends ISessionRestoreState {
32
33
  resourceSource: string;
33
34
  resourceOriginId: string;
34
35
  payload: string;
35
- isCreatingResourceOrigin: boolean;
36
- isUpdatingResourceOrigin: boolean;
37
36
  visitedResources: ISessionResource[];
37
+ presentedResources: ISessionResource[];
38
38
  }
39
39
  declare type IActionType = IAction<SessionRestoreConstants, ISessionRestorePayloadType>;
40
40
  export declare type SessionReducerDispatchType = (value: IActionType) => void;
@@ -70,6 +70,7 @@ export declare const getRulesToSave: (visiterUrl: any, visitedRec: any, allPrese
70
70
  export declare const getInsightRulesToSave: (visiterUrl: any, visitedRec: any, allPresentedRec: any) => ISessionResource[];
71
71
  export declare const getSessResFromEA: (cta: string, visibilityStatus: ISessionResourceVisibility, resourceEntityId?: any) => ISessionResource;
72
72
  export declare const getSessResFromClusterRecommendation: (cta: string, visibilityStatus: ISessionResourceVisibility, resourceEntityId?: any) => ISessionResource;
73
+ export declare function getSessResFromClusterRecommendations(recs: any, visibilityStatus: ISessionResourceVisibility): ISessionResource[];
73
74
  export declare const getRecToSave: (visitedRec: ISolrRecommendation, allPresentedRec: ISolrRecommendation[], allDocs?: ISolrRecommendation[]) => ISessionResource[];
74
75
  export {};
75
76
  //# sourceMappingURL=SessionRestoreReducer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SessionRestoreReducer.d.ts","sourceRoot":"","sources":["../../../src/reducers/SessionRestoreReducer.ts"],"names":[],"mappings":"AACA,OAAO,EACH,QAAQ,EACR,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,IAAI,sBAAsB,EAC/C,yBAAyB,IAAI,0BAA0B,EAC1D,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,2DAA2D,CAAC;AACzG,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AA0B1G,MAAM,WAAW,aAAa;IAC1B,CAAC,SAAS,EAAE,MAAM,GAAG,YAAY,CAAC;CACrC;AAED,MAAM,WAAW,iBAAiB;IAC9B,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,EAAE,gBAAgB,EAAE,CAAC;CACxC;AACD,MAAM,WAAW,yBAAyB;IACtC,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAAC;CACvC;AACD,MAAM,WAAW,oBAAoB;IACjC,gBAAgB,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC;IACrD,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0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gBAAgB,EAAE,iBA2ChC;AAED,wBAAgB,0BAA0B,CACtC,YAAY,EAAE,eAAe,EAAE,EAC/B,gBAAgB,EAAE,0BAA0B,GAC7C,gBAAgB,EAAE,CAIpB;AAED,eAAO,MAAM,oBAAoB,eACjB,eAAe,oBACT,0BAA0B,KAC7C,gBAAgB,EAIlB,CAAC;AAEF,eAAO,MAAM,YAAY,OACjB,WAAW,oBACG,0BAA0B,qBACzB,MAAM,SAClB,MAAM,KACd,gBAMD,CAAC;AAEH,wBAAgB,kBAAkB,CAC9B,IAAI,EAAE,mBAAmB,EAAE,EAC3B,gBAAgB,EAAE,0BAA0B,GAC7C,gBAAgB,EAAE,CAIpB;AAGD,eAAO,MAAM,iBAAiB,QACrB,mBAAmB,oBACN,0BAA0B,SACrC,MAAM,KACd,gBAMD,CAAC;AAEH,eAAO,MAAM,mBAAmB,QACvB,MAAM,oBACO,0BAA0B,iCAErC,MAAM,KACd,gBAMD,CAAC;AAEH,eAAO,MAAM,cAAc,gFAa1B,CAAC;AAEF,eAAO,MAAM,qBAAqB,gFAajC,CAAC;AAGF,eAAO,MAAM,gBAAgB,QACpB,MAAM,oBACO,0BAA0B,6BAE7C,gBAKD,CAAC;AAGH,eAAO,MAAM,mCAAmC,QACvC,MAAM,oBACO,0BAA0B,6BAE7C,gBAKD,CAAC;AAEH,wBAAgB,oCAAoC,CAChD,IAAI,KAAA,EACJ,gBAAgB,EAAE,0BAA0B,GAC7C,gBAAgB,EAAE,CAIpB;AAID,eAAO,MAAM,YAAY,eACT,mBAAmB,mBACd,mBAAmB,EAAE,YAC7B,mBAAmB,EAAE,uBAWjC,CAAC"}
@@ -16,6 +16,7 @@ import findIndex from 'lodash/findIndex';
16
16
  import forEach from 'lodash/forEach';
17
17
  import isEmpty from 'lodash/isEmpty';
18
18
  import map from 'lodash/map';
19
+ import uniqBy from 'lodash/uniqBy';
19
20
  const { getSessions, patchSession, createNewSession, createSessionResources, updateSessionResources, createSessionCepDetails, SessionResourceVisibility, } = pcm.preCase.session;
20
21
  // Constants
21
22
  export var SessionRestoreConstants;
@@ -40,7 +41,7 @@ export const initialSessionRestoreState = {
40
41
  };
41
42
  // Reducers
42
43
  export const sessionRestoreReducer = (state, action) => {
43
- var _a, _b, _c;
44
+ var _a, _b, _c, _d, _e, _f;
44
45
  switch (action.type) {
45
46
  case SessionRestoreConstants.getSessions: {
46
47
  return Object.assign(Object.assign({}, state), { previousSessions: action.payload.previousSessions, hasFetchedPreviousSessions: action.payload.hasFetchedPreviousSessions });
@@ -85,20 +86,12 @@ export const sessionRestoreReducer = (state, action) => {
85
86
  if (isEmpty(action.payload.resourceSource))
86
87
  return state;
87
88
  const resTemp = Object.assign({}, state.sessionResourceTracking[action.payload.resourceSource]);
88
- resTemp.isCreating = action.payload.hasOwnProperty('isCreatingResourceOrigin')
89
- ? action.payload.isCreatingResourceOrigin
90
- : !!resTemp.isCreating;
91
- resTemp.isUpdating = action.payload.hasOwnProperty('isUpdatingResourceOrigin')
92
- ? action.payload.isUpdatingResourceOrigin
93
- : !!resTemp.isUpdating;
94
89
  resTemp.resourceOriginId = action.payload.hasOwnProperty('resourceOriginId')
95
90
  ? action.payload.resourceOriginId
96
91
  : resTemp.resourceOriginId;
97
92
  resTemp.payload = action.payload.hasOwnProperty('payload') ? action.payload.payload : resTemp.payload;
98
- resTemp.visitedResources = [
99
- ...((_a = resTemp.visitedResources) !== null && _a !== void 0 ? _a : []),
100
- ...((_c = (_b = action.payload) === null || _b === void 0 ? void 0 : _b.visitedResources) !== null && _c !== void 0 ? _c : []),
101
- ];
93
+ resTemp.visitedResources = uniqBy([...((_a = resTemp.visitedResources) !== null && _a !== void 0 ? _a : []), ...((_c = (_b = action.payload) === null || _b === void 0 ? void 0 : _b.visitedResources) !== null && _c !== void 0 ? _c : [])], 'resourceEntityId');
94
+ resTemp.presentedResources = uniqBy([...((_d = resTemp.presentedResources) !== null && _d !== void 0 ? _d : []), ...((_f = (_e = action.payload) === null || _e === void 0 ? void 0 : _e.presentedResources) !== null && _f !== void 0 ? _f : [])], 'resourceEntityId');
102
95
  return Object.assign(Object.assign({}, state), { sessionResourceTracking: Object.assign(Object.assign({}, state.sessionResourceTracking), { [action.payload.resourceSource]: resTemp }) });
103
96
  }
104
97
  case SessionRestoreConstants.updatePreviousSessions: {
@@ -244,14 +237,16 @@ export function markAllSessionsUnresolved(dispatch, sessionData, userAgent) {
244
237
  // Create or Update Session Resource Helper
245
238
  export function createOrUpdateSessionResources(dispatch, activeSessionId, currentSessionResourceTracking, source, resources = [], payload = JSON.stringify({})) {
246
239
  return __awaiter(this, void 0, void 0, function* () {
247
- if (isEmpty(payload) || isEmpty(activeSessionId) || isEmpty(source))
240
+ if (isEmpty(payload) || isEmpty(activeSessionId) || isEmpty(source) || isEmpty(resources))
248
241
  return;
249
242
  const resourceTracking = currentSessionResourceTracking[source];
250
243
  if (isEmpty(resourceTracking) || (resourceTracking === null || resourceTracking === void 0 ? void 0 : resourceTracking.payload) !== payload) {
251
- createSessionResourcesLocal(dispatch, activeSessionId, currentSessionResourceTracking, source, payload, resources);
244
+ // adding presented resources or when we already have record but payload is changed
245
+ yield createSessionResourcesLocal(dispatch, activeSessionId, currentSessionResourceTracking, source, payload, resources);
252
246
  }
253
247
  else {
254
- updateSessionResourcesLocal(dispatch, activeSessionId, currentSessionResourceTracking, source, resources);
248
+ // updating resource tracking by adding visites resources
249
+ yield updateSessionResourcesLocal(dispatch, activeSessionId, currentSessionResourceTracking, source, resources);
255
250
  }
256
251
  });
257
252
  }
@@ -268,72 +263,55 @@ export function createSessionResourcesLocal(dispatch, activeSessionId, currentSe
268
263
  type: SessionRestoreConstants.updateSessionResourceTracking,
269
264
  payload: {
270
265
  resourceSource: source,
271
- isCreatingResourceOrigin: true,
272
- },
273
- });
274
- const response = yield createSessionResources(activeSessionId, { source, payload }, resources);
275
- dispatch({
276
- type: SessionRestoreConstants.updateSessionResourceTracking,
277
- payload: {
278
- resourceSource: source,
279
- resourceOriginId: response.resourceOrigin.id,
266
+ resourceOriginId: '',
280
267
  payload,
281
- isCreatingResourceOrigin: false,
282
268
  visitedResources: filter(resources, (res) => res.visibilityStatus === SessionResourceVisibility.VISITED),
269
+ presentedResources: filter(resources, (res) => res.visibilityStatus === SessionResourceVisibility.PRESENTED),
283
270
  },
284
271
  });
285
- }
286
- finally {
272
+ const response = yield createSessionResources(activeSessionId, { source, payload }, resources);
287
273
  dispatch({
288
274
  type: SessionRestoreConstants.updateSessionResourceTracking,
289
275
  payload: {
290
276
  resourceSource: source,
291
- isCreatingResourceOrigin: false,
277
+ resourceOriginId: response.resourceOrigin.id,
292
278
  },
293
279
  });
294
280
  }
281
+ catch (e) { }
295
282
  });
296
283
  }
297
284
  // Update Session Resource Helper
298
285
  export function updateSessionResourcesLocal(dispatch, activeSessionId, currentSessionResourceTracking, source, resources) {
299
- var _a;
286
+ var _a, _b;
300
287
  return __awaiter(this, void 0, void 0, function* () {
301
288
  if (isEmpty(activeSessionId) || isEmpty(source) || isEmpty(resources))
302
289
  return;
303
290
  const resourceTracking = currentSessionResourceTracking[source];
304
291
  if (isEmpty(resourceTracking === null || resourceTracking === void 0 ? void 0 : resourceTracking.resourceOriginId))
305
292
  return;
293
+ const newlyVisitedResources = filter(resources, (res) => res.visibilityStatus === SessionResourceVisibility.VISITED);
294
+ const newlyPresentedResources = filter(resources, (res) => res.visibilityStatus === SessionResourceVisibility.PRESENTED);
295
+ const previouslyVisitedResources = (_a = resourceTracking === null || resourceTracking === void 0 ? void 0 : resourceTracking.visitedResources) !== null && _a !== void 0 ? _a : [];
296
+ const previouslyPresentedResources = (_b = resourceTracking === null || resourceTracking === void 0 ? void 0 : resourceTracking.presentedResources) !== null && _b !== void 0 ? _b : [];
297
+ const nonPreviouslyVisitedResources = differenceBy(newlyVisitedResources, previouslyVisitedResources, 'resourceEntityId');
298
+ const nonPreviouslyPresentedResources = differenceBy(newlyPresentedResources, previouslyPresentedResources, 'resourceEntityId');
299
+ if (!nonPreviouslyVisitedResources.length && !nonPreviouslyPresentedResources.length)
300
+ return;
306
301
  try {
307
- dispatch({
308
- type: SessionRestoreConstants.updateSessionResourceTracking,
309
- payload: {
310
- resourceSource: source,
311
- isUpdatingResourceOrigin: true,
312
- },
313
- });
314
- const newlyVisitedResources = filter(resources, (res) => res.visibilityStatus === SessionResourceVisibility.VISITED);
315
- const previouslyVisitedResources = (_a = resourceTracking === null || resourceTracking === void 0 ? void 0 : resourceTracking.visitedResources) !== null && _a !== void 0 ? _a : [];
316
- const nonPreviouslyVisitedResources = differenceBy(resources, previouslyVisitedResources, 'url');
317
- if (isEmpty(nonPreviouslyVisitedResources))
318
- return;
319
- yield updateSessionResources(activeSessionId, { id: resourceTracking.resourceOriginId }, nonPreviouslyVisitedResources);
302
+ yield updateSessionResources(activeSessionId, { id: resourceTracking.resourceOriginId }, [
303
+ ...nonPreviouslyVisitedResources,
304
+ ...nonPreviouslyPresentedResources,
305
+ ]);
320
306
  const payloadToDispatch = {
321
307
  resourceSource: source,
322
- isUpdatingResourceOrigin: false,
323
308
  sessionResourceTracking: {},
324
- visitedResources: previouslyVisitedResources.concat(newlyVisitedResources),
309
+ visitedResources: previouslyVisitedResources.concat(nonPreviouslyVisitedResources),
310
+ presentedResources: previouslyPresentedResources.concat(nonPreviouslyPresentedResources),
325
311
  };
326
312
  dispatch({ type: SessionRestoreConstants.updateSessionResourceTracking, payload: payloadToDispatch });
327
313
  }
328
- finally {
329
- dispatch({
330
- type: SessionRestoreConstants.updateSessionResourceTracking,
331
- payload: {
332
- resourceSource: source,
333
- isUpdatingResourceOrigin: false,
334
- },
335
- });
336
- }
314
+ catch (e) { }
337
315
  });
338
316
  }
339
317
  export function getSessResFromTCCategories(tcCategories, visibilityStatus) {
@@ -392,6 +370,11 @@ export const getInsightRulesToSave = (visiterUrl, visitedRec, allPresentedRec) =
392
370
  export const getSessResFromEA = (cta, visibilityStatus, resourceEntityId) => (Object.assign(Object.assign({ visibilityStatus }, (resourceEntityId && { resourceEntityId })), { type: getResTypeFromUrl(`${window.location.origin}${cta}`), url: cta.startsWith('http') ? cta : `${window.location.origin}/${cta}` }));
393
371
  // Cluster Recommendation Helper Function
394
372
  export const getSessResFromClusterRecommendation = (cta, visibilityStatus, resourceEntityId) => (Object.assign(Object.assign({ visibilityStatus }, (resourceEntityId && { resourceEntityId })), { type: 'rule', url: cta }));
373
+ export function getSessResFromClusterRecommendations(recs, visibilityStatus) {
374
+ const toReturn = [];
375
+ forEach(recs, (rec) => toReturn.push(getSessResFromClusterRecommendation('', visibilityStatus, rec.rule_id)));
376
+ return toReturn;
377
+ }
395
378
  // Save Recommendations Helper Function
396
379
  export const getRecToSave = (visitedRec, allPresentedRec, allDocs = []) => {
397
380
  var _a, _b;
@@ -301,3 +301,13 @@ section.grid-aside-content pfe-accordion {
301
301
  --pfe-accordion--FontSize--header: 16px;
302
302
  --pfe-accordion--FontWeight--header: 600;
303
303
  }
304
+ // override added padding
305
+ div.pf-c-alert__description div.ea-rule p a.pf-c-button {
306
+ padding: 0;
307
+ }
308
+
309
+ //override pfe-accordion discloser for modal
310
+ div pfe-accordion {
311
+ --pfe-accordion--FontSize--header: 16px;
312
+ --pfe-accordion--FontWeight--header: 600;
313
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/troubleshoot",
3
- "version": "0.2.84",
3
+ "version": "0.2.87",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -74,11 +74,11 @@
74
74
  "@progress/kendo-drawing": "^1.6.0",
75
75
  "@progress/kendo-react-pdf": "^3.12.0",
76
76
  "@rh-support/api": "0.3.13",
77
- "@rh-support/components": "1.1.53",
78
- "@rh-support/react-context": "0.2.53",
77
+ "@rh-support/components": "1.1.55",
78
+ "@rh-support/react-context": "0.2.55",
79
79
  "@rh-support/types": "0.2.0",
80
- "@rh-support/user-permissions": "0.2.43",
81
- "@rh-support/utils": "0.2.32",
80
+ "@rh-support/user-permissions": "0.2.44",
81
+ "@rh-support/utils": "0.2.33",
82
82
  "@types/react-redux": "^7.1.12",
83
83
  "@types/redux": "^3.6.0",
84
84
  "@webcomponents/webcomponentsjs": "^2.2.10",
@@ -143,5 +143,5 @@
143
143
  "not ie <= 11",
144
144
  "not op_mini all"
145
145
  ],
146
- "gitHead": "4fce3da5901527ba41788f587ab1852eff161cee"
146
+ "gitHead": "a3df00d1fcf2e999400a0b17f5ac00f2a32d878d"
147
147
  }