@rh-support/troubleshoot 0.2.83 → 0.2.86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"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" },
@@ -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
@@ -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,
@@ -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.83",
3
+ "version": "0.2.86",
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.52",
78
- "@rh-support/react-context": "0.2.52",
77
+ "@rh-support/components": "1.1.54",
78
+ "@rh-support/react-context": "0.2.54",
79
79
  "@rh-support/types": "0.2.0",
80
- "@rh-support/user-permissions": "0.2.42",
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": "3d97efe5cebb4e398f73d61326cad31e087aa63f"
146
+ "gitHead": "5797cf1fd9b2d2406fa93933f91fcc0b0729e7a8"
147
147
  }