@rh-support/troubleshoot 0.2.120 → 0.2.123

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":"CaseDetailsErrorMessage.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseEditView/CaseDetailsErrorMessage.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAKrD,UAAU,MAAM;IACZ,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,SAAS,CAAC;IACxB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,eAsDpD"}
1
+ {"version":3,"file":"CaseDetailsErrorMessage.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseEditView/CaseDetailsErrorMessage.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAKrD,UAAU,MAAM;IACZ,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,SAAS,CAAC;IACxB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B;AAID,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,eAqEpD"}
@@ -3,14 +3,24 @@ import { GlobalMetadataStateContext } from '@rh-support/react-context';
3
3
  import { getSFDCSecureSupportCaseLink } from '@rh-support/utils';
4
4
  import React, { useContext } from 'react';
5
5
  import { Trans, useTranslation } from 'react-i18next';
6
+ // Here we need to use 'detailMessage' from case API if user is not authorized to see case details
7
+ const INVALID_CASE_GROUP_API_ERROR_DEFAULT_MESSAGE = 'Invalid group access';
6
8
  export function CaseDetailsErrorMessage(props) {
7
9
  const { globalMetadataState: { loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
8
10
  const { t } = useTranslation();
9
11
  // Initialize Default Props Below
10
12
  const { isInlineError = false, canReadCase, caseNumber, errorDetails } = props;
13
+ const invalidCaseGroupErrorTitle = t('This case can only be viewed by a specific group');
14
+ /* There can be two condition for HTTP 403 error
15
+ 1. Account mismatch.
16
+ 2. Invalid case group
17
+ */
18
+ const isCaseGroupError = errorDetails['detailMessage'] === INVALID_CASE_GROUP_API_ERROR_DEFAULT_MESSAGE;
11
19
  const getErrorMessage = () => {
12
20
  const { status, message = '' } = errorDetails || {};
13
- const customDefaultErrorMessage403 = t('You are not authorized to see this case.');
21
+ const customDefaultErrorMessage403 = isCaseGroupError
22
+ ? t('Please contact your organization’s admin to request access to this case’s group.')
23
+ : t('You are not authorized to see this case.');
14
24
  const errorMessage404 = t("Case number doesn't exist");
15
25
  let errorMessage403;
16
26
  if (!canReadCase) {
@@ -36,6 +46,10 @@ export function CaseDetailsErrorMessage(props) {
36
46
  '404': { message: errorMessage404 },
37
47
  });
38
48
  };
39
- return (React.createElement(AlertMessage, { variant: AlertType.DANGER, className: "pf-u-mb-lg", show: true, title: errorMessageTitle(errorDetails), isInline: isInlineError },
49
+ return (React.createElement(AlertMessage, { variant: AlertType.DANGER, className: "pf-u-mb-lg", show: true,
50
+ // Here customizing title of alert based on case group error.
51
+ title: errorMessageTitle(errorDetails, Object.assign({}, (isCaseGroupError && {
52
+ '403': { title: invalidCaseGroupErrorTitle },
53
+ }))), isInline: isInlineError },
40
54
  React.createElement(Trans, null, getErrorMessage())));
41
55
  }
@@ -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,eAgfjD"}
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,eA+ejD"}
@@ -285,9 +285,8 @@ export default function CaseOverview(props) {
285
285
  React.createElement(ExpandableSection, { className: "case-details-main", toggleText: t('Case information'), isExpanded: isDetailsExpanded, onToggle: onToggleDetails },
286
286
  React.createElement(CaseInformation, null))),
287
287
  showCloseCaseModal && (React.createElement(CloseCaseModal, { onConfirm: (commentBody) => __awaiter(this, void 0, void 0, function* () {
288
- yield updateStatusState(CaseStatusEnum.CLOSED, () => __awaiter(this, void 0, void 0, function* () {
289
- yield postCommentAfterStatusUpdate(commentBody);
290
- }));
288
+ yield updateStatusState(CaseStatusEnum.CLOSED);
289
+ yield postCommentAfterStatusUpdate(commentBody);
291
290
  setShowCaseCloseModal(false);
292
291
  }), isUpdating: (caseOverviewState.caseStatusUpdating && isCaseUpdating) || isPostingComment, onClose: () => {
293
292
  setShowCaseCloseModal(false);
@@ -1 +1 @@
1
- {"version":3,"file":"PostComment.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDiscussion/PostComment.tsx"],"names":[],"mappings":"AAqCA,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,eAmdxC"}
1
+ {"version":3,"file":"PostComment.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDiscussion/PostComment.tsx"],"names":[],"mappings":"AAqCA,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,eA2exC"}
@@ -11,7 +11,7 @@ import { publicApi } from '@cee-eng/hydrajs';
11
11
  import { Button, ButtonVariant, Checkbox, debounce, Tooltip } from '@patternfly/react-core';
12
12
  import PlusIcon from '@patternfly/react-icons/dist/js/icons/plus-icon';
13
13
  import { EditorMode, LoadingIndicator, MarkdownEditor, ToastNotification, useFetch, usePrevious, } from '@rh-support/components';
14
- import { FeatureAnnouncementKeys, GlobalMetadataStateContext, NewFeaturePopoverAnnouncement, useCanEditCase, } from '@rh-support/react-context';
14
+ import { FeatureAnnouncementKeys, GlobalMetadataStateContext, NewFeaturePopoverAnnouncement, useCanEditCase, useUserPreferences, } from '@rh-support/react-context';
15
15
  import { ability, CaseDiscussionFields, CaseListFields, resourceActions, resources, } from '@rh-support/user-permissions';
16
16
  import { getConfigField, PCM_CONFIG_FIELD_TYPE, pendoTrackEvent } from '@rh-support/utils';
17
17
  import isEmpty from 'lodash/isEmpty';
@@ -22,7 +22,6 @@ import { useDropzone } from 'react-dropzone';
22
22
  import { Trans, useTranslation } from 'react-i18next';
23
23
  import { useCaseDispatch, useCaseSelector } from '../../../../context/CaseContext';
24
24
  import { CaseDetailsCacheNamespaces } from '../../../../enums/cache';
25
- import { useUserPreference } from '../../../../hooks/useUserPreference';
26
25
  import { DiscussionType } from '../../../../reducers/CaseDiscussionTabReducer';
27
26
  import { addingNotifiedUsers, checkForCaseStatusToggleOnAttachOrComment, setNotifiedUser, } from '../../../../reducers/CaseReducer';
28
27
  import { CaseDetailsCacheUtils } from '../../../../utils/caseDetailsCacheUtils';
@@ -51,6 +50,25 @@ export function PostComment(props) {
51
50
  const hasSomeUnUploadedFiles = hasSomeUnUploadedAttachments(attachmentState.caseFiles.selectedLocalFiles);
52
51
  const hasSomeSelectedFilesLocal = hasSomeSelectedFiles(attachmentState.caseFiles.selectedLocalFiles);
53
52
  const [commentType, setCommentType] = useState(EditorMode.PLAIN);
53
+ const [commentSignature, setCommentSignature] = useState('');
54
+ const { getCommentTypeFromPreference, getCommentSignature } = useUserPreferences();
55
+ const userOriginalCommentPrefs = () => __awaiter(this, void 0, void 0, function* () {
56
+ try {
57
+ const retrievedComment = yield getCommentTypeFromPreference();
58
+ const retrievedCommentSignature = yield getCommentSignature();
59
+ const defaultCommentType = retrievedComment ? retrievedComment : EditorMode.PLAIN;
60
+ setCommentType(defaultCommentType);
61
+ const defaultCommentSignature = retrievedCommentSignature || '';
62
+ setCommentSignature(defaultCommentSignature);
63
+ }
64
+ catch (error) {
65
+ console.log(error);
66
+ }
67
+ });
68
+ useEffect(() => {
69
+ userOriginalCommentPrefs();
70
+ // eslint-disable-next-line react-hooks/exhaustive-deps
71
+ });
54
72
  const [isModalOpen, setIsModalOpen] = useState(false);
55
73
  const [isProcessing, setIsProcessing] = useState(isPostingComment || isUploadingAttachments);
56
74
  const { globalMetadataState: { loggedInUser, loggedInUserRights, loggedInUsersAccount, pcmConfig }, } = useContext(GlobalMetadataStateContext);
@@ -66,7 +84,6 @@ export function PostComment(props) {
66
84
  selectedNotificationContacts: state.selectedNotificationContacts,
67
85
  }), isEqual);
68
86
  const caseDispatch = useCaseDispatch();
69
- const { updateCommentType, getCommentTypeFromPreference } = useUserPreference();
70
87
  const [isCommentTooLong, setIsCommentTooLong] = useState(false);
71
88
  const canEditCase = useCanEditCase();
72
89
  const componentRef = useRef(null);
@@ -142,12 +159,6 @@ export function PostComment(props) {
142
159
  setNotifiedUser(caseDispatch, uniqBy([...selectedNotificationContacts, loggedInUser.data], 'ssoUsername'));
143
160
  }
144
161
  });
145
- const saveCommentTypeInPreference = () => {
146
- const commentTypeFromPreference = getCommentTypeFromPreference();
147
- if (!commentTypeFromPreference || commentTypeFromPreference !== commentType) {
148
- updateCommentType(commentType);
149
- }
150
- };
151
162
  useEffect(() => {
152
163
  isPublicRef.current = isPublic;
153
164
  }, [isPublic]);
@@ -172,7 +183,6 @@ export function PostComment(props) {
172
183
  yield props.onCommentAdded();
173
184
  resetCommentSection();
174
185
  ToastNotification.addSuccessMessage(t('Comment submitted'));
175
- saveCommentTypeInPreference();
176
186
  }
177
187
  catch (e) {
178
188
  ToastNotification.addDangerMessage(t('Could not submit comment'));
@@ -197,12 +207,23 @@ export function PostComment(props) {
197
207
  .reduce((acc, line) => (acc += '> ' + line + '\n'), person);
198
208
  return reply;
199
209
  };
210
+ const addCommentSignature = (preSigCommemnt) => {
211
+ if (!isEmpty(commentSignature)) {
212
+ let signedComment = preSigCommemnt + '\n' + commentSignature;
213
+ setCommentText(signedComment);
214
+ }
215
+ };
200
216
  useEffect(() => {
201
217
  if (!props.commentText || !props.commentCreator) {
202
218
  return;
203
219
  }
204
220
  const reply = getReplyText(props.commentText, props.commentCreator);
205
- setCommentText(reply);
221
+ if (reply.includes(commentSignature)) {
222
+ setCommentText(reply);
223
+ }
224
+ else {
225
+ addCommentSignature(reply);
226
+ }
206
227
  // eslint-disable-next-line react-hooks/exhaustive-deps
207
228
  }, [props.commentText, props.commentCreator]);
208
229
  useEffect(() => {
@@ -222,21 +243,17 @@ export function PostComment(props) {
222
243
  const { value: draftComments = {} } = (yield CaseDetailsCacheUtils.get(CaseDetailsCacheNamespaces.COMMENTS_DRAFT.name, loggedInUserRights.data.getSSOUsername())) || {};
223
244
  if (draftComments[caseNumber]) {
224
245
  const { text, privateFlag, type } = draftComments[caseNumber];
225
- setCommentText(text);
226
- privateFlag === true && setIsPublic(false);
227
- setCommentType(type);
228
- }
229
- else {
230
- const commentTypeFromPreference = getCommentTypeFromPreference();
231
- if (commentTypeFromPreference) {
232
- setCommentType(commentTypeFromPreference);
246
+ if (text.trim()) {
247
+ addCommentSignature(text);
248
+ privateFlag === true && setIsPublic(false);
249
+ setCommentType(type);
233
250
  }
234
251
  }
235
252
  });
236
253
  }
237
254
  getDraftComments();
238
255
  // eslint-disable-next-line react-hooks/exhaustive-deps
239
- }, []);
256
+ }, [commentSignature]);
240
257
  const onTextAreaBlur = () => {
241
258
  !commentText && setIsTextAreaFocused(false);
242
259
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CaseGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/CaseGroup.tsx"],"names":[],"mappings":"AAiBA,UAAU,MAAM;CAAG;AAInB,iBAAS,SAAS,CAAC,KAAK,EAAE,MAAM,eA8L/B;AAED,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"CaseGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/CaseGroup.tsx"],"names":[],"mappings":"AAiBA,UAAU,MAAM;CAAG;AAInB,iBAAS,SAAS,CAAC,KAAK,EAAE,MAAM,eAsN/B;AAED,eAAe,SAAS,CAAC"}
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { Dropdown, ToastNotification, ValueChangedIcon } from '@rh-support/components';
11
- import { GlobalMetadataStateContext, useCanEditCase } from '@rh-support/react-context';
11
+ import { GlobalMetadataStateContext, useCanEditCase, useUserPreferences } from '@rh-support/react-context';
12
12
  import { toOption, toOptions } from '@rh-support/utils';
13
13
  import find from 'lodash/find';
14
14
  import isEmpty from 'lodash/isEmpty';
@@ -22,7 +22,7 @@ import { getChangedValueTooltip } from '../shared/utils';
22
22
  const emptyCaseGroup = { groupNum: '', name: '', isPrivate: false, isDefault: false, defaultMembers: [], members: [] };
23
23
  function CaseGroup(props) {
24
24
  const { t } = useTranslation();
25
- const { groupNumber, caseNumber, accountNumber, selectedAccountDetails, ownersCaseGroups, groupName, } = useCaseSelector((state) => ({
25
+ const { groupNumber, caseNumber, accountNumber, selectedAccountDetails, ownersCaseGroups, groupName } = useCaseSelector((state) => ({
26
26
  caseNumber: state.caseDetails.caseNumber,
27
27
  groupNumber: state.caseDetails.groupNumber,
28
28
  accountNumber: state.caseDetails.accountNumberRef,
@@ -37,6 +37,31 @@ function CaseGroup(props) {
37
37
  const [isCaseGroupUpdating, setCaseGroupUpdating] = useState(false);
38
38
  const canEditCase = useCanEditCase();
39
39
  const { globalMetadataState: { loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
40
+ const { getDefaultGroup } = useUserPreferences();
41
+ const userPreferredFilter = () => __awaiter(this, void 0, void 0, function* () {
42
+ const fetchedDefaultGroupKey = yield getDefaultGroup();
43
+ const groupObj = ownersCaseGroups.data
44
+ ? ownersCaseGroups.data.map((group) => ({ value: group.name, key: group.groupNum }))
45
+ : [];
46
+ if (!isEmpty(groupObj)) {
47
+ const preferredGroupObj = groupObj.find((group) => group.key === fetchedDefaultGroupKey);
48
+ if (preferredGroupObj === null || preferredGroupObj === void 0 ? void 0 : preferredGroupObj.value) {
49
+ const parsedFetchedDefaultGroup = {
50
+ groupNum: preferredGroupObj.key,
51
+ name: preferredGroupObj.value,
52
+ isPrivate: false,
53
+ isDefault: false,
54
+ defaultMembers: [],
55
+ members: [],
56
+ };
57
+ onCaseGroupChange(toOption(parsedFetchedDefaultGroup, { labelKey: 'name' }));
58
+ }
59
+ }
60
+ });
61
+ useEffect(() => {
62
+ userPreferredFilter();
63
+ // eslint-disable-next-line react-hooks/exhaustive-deps
64
+ }, [ownersCaseGroups.data]);
40
65
  // value changed logic to show a non local group change
41
66
  const [localGroupChange, setLocalGroupChange] = useState(false);
42
67
  const afterGroupLocalChange = () => setLocalGroupChange(false);
@@ -33,7 +33,7 @@ export function ClusterRecommendationItems(props) {
33
33
  React.createElement("h3", null, rule.description)),
34
34
  React.createElement("pfe-accordion-panel", null,
35
35
  React.createElement("p", null,
36
- React.createElement(Label, { color: riskLabels[rule.total_risk].color },
36
+ React.createElement(Label, { icon: riskLabels[rule.total_risk].icon, color: riskLabels[rule.total_risk].color },
37
37
  React.createElement(Trans, null, riskLabels[rule.total_risk].label))),
38
38
  React.createElement("p", null, rule.details || ''),
39
39
  rule.reason && (React.createElement(React.Fragment, null,
@@ -52,18 +52,22 @@ export declare const markdownInlineFileSelectEvent = "PCM-Next > Markdown-toolba
52
52
  export declare const markdownFilePasteEvent = "PCM-Next > Markdown-toolbar-file-paste";
53
53
  export declare const riskLabels: {
54
54
  1: {
55
+ icon: JSX.Element;
55
56
  label: string;
56
57
  color: string;
57
58
  };
58
59
  2: {
60
+ icon: JSX.Element;
59
61
  label: string;
60
62
  color: string;
61
63
  };
62
64
  3: {
65
+ icon: JSX.Element;
63
66
  label: string;
64
67
  color: string;
65
68
  };
66
69
  4: {
70
+ icon: JSX.Element;
67
71
  label: string;
68
72
  color: string;
69
73
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Constants.d.ts","sourceRoot":"","sources":["../../../../src/components/shared/Constants.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wBA+BE;AAEF;;GAEG;AACH,oBAAY,iBAAiB;IACzB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,IAAI,cAAc;IAClB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,KAAK,sBAAsB;IAC3B,KAAK,UAAU;IACf,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,kBAAkB,yBAAyB;CAC9C;AAED,eAAO,MAAM,8BAA8B,oDAAoD,CAAC;AAEhG,eAAO,MAAM,oCAAoC,wDAAwD,CAAC;AAC1G,eAAO,MAAM,6BAA6B,4CAA4C,CAAC;AACvF,eAAO,MAAM,sBAAsB,2CAA2C,CAAC;AAE/E,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;CAKtB,CAAC"}
1
+ {"version":3,"file":"Constants.d.ts","sourceRoot":"","sources":["../../../../src/components/shared/Constants.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,wBA+BE;AAEF;;GAEG;AACH,oBAAY,iBAAiB;IACzB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,IAAI,cAAc;IAClB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,KAAK,sBAAsB;IAC3B,KAAK,UAAU;IACf,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,kBAAkB,yBAAyB;CAC9C;AAED,eAAO,MAAM,8BAA8B,oDAAoD,CAAC;AAEhG,eAAO,MAAM,oCAAoC,wDAAwD,CAAC;AAC1G,eAAO,MAAM,6BAA6B,4CAA4C,CAAC;AACvF,eAAO,MAAM,sBAAsB,2CAA2C,CAAC;AAE/E,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;CAKtB,CAAC"}
@@ -1,3 +1,8 @@
1
+ import AngleDoubleDownIcon from '@patternfly/react-icons/dist/js/icons/angle-double-down-icon';
2
+ import AngleDoubleUpIcon from '@patternfly/react-icons/dist/js/icons/angle-double-up-icon';
3
+ import CriticalRiskIcon from '@patternfly/react-icons/dist/js/icons/critical-risk-icon';
4
+ import EqualsIcon from '@patternfly/react-icons/dist/js/icons/equals-icon';
5
+ import React from 'react';
1
6
  export default {
2
7
  languagesMap: {
3
8
  en: 'English',
@@ -51,8 +56,8 @@ export const recsViewedFromNoAttachmentModalEvent = 'PCM-Next > No-Attachment-mo
51
56
  export const markdownInlineFileSelectEvent = 'PCM-Next > Markdown-toolbar-file-select';
52
57
  export const markdownFilePasteEvent = 'PCM-Next > Markdown-toolbar-file-paste';
53
58
  export const riskLabels = {
54
- 1: { label: 'Low', color: 'blue' },
55
- 2: { label: 'Moderate', color: 'orange' },
56
- 3: { label: 'Important', color: 'red' },
57
- 4: { label: 'Critical', color: 'red' },
59
+ 1: { icon: React.createElement(AngleDoubleDownIcon, null), label: 'Low', color: 'blue' },
60
+ 2: { icon: React.createElement(EqualsIcon, null), label: 'Moderate', color: 'gold' },
61
+ 3: { icon: React.createElement(AngleDoubleUpIcon, null), label: 'Important', color: 'orange' },
62
+ 4: { icon: React.createElement(CriticalRiskIcon, null), label: 'Critical', color: 'red' },
58
63
  };
@@ -1 +1 @@
1
- {"version":3,"file":"WizardMain.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/WizardMain.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAS,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAM9D,OAAO,EAAoB,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAapF,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;CACpD;AAGD,iBAAS,UAAU,CAAC,KAAK,EAAE,MAAM,eAoOhC;kBApOQ,UAAU;;;AAsOnB,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"WizardMain.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/WizardMain.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAS,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAO9D,OAAO,EAAoB,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAcpF,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;CACpD;AAGD,iBAAS,UAAU,CAAC,KAAK,EAAE,MAAM,eAoQhC;kBApQQ,UAAU;;;AAsQnB,eAAe,UAAU,CAAC"}
@@ -1,4 +1,14 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  import { AlertMessage, AlertType, LoadingIndicator, usePrevious } from '@rh-support/components';
11
+ import { useUserPreferences } from '@rh-support/react-context';
2
12
  import isEmpty from 'lodash/isEmpty';
3
13
  import isEqual from 'lodash/isEqual';
4
14
  import isFunction from 'lodash/isFunction';
@@ -6,10 +16,11 @@ import map from 'lodash/map';
6
16
  import React, { Suspense, useContext, useEffect, useRef } from 'react';
7
17
  import { Trans, useTranslation } from 'react-i18next';
8
18
  import { Route } from 'react-router-dom';
9
- import { useCaseSelector } from '../../context/CaseContext';
19
+ import { useCaseDispatch, useCaseSelector } from '../../context/CaseContext';
10
20
  import { RecommendationStateContext } from '../../context/RecommendationContext';
11
21
  import { RouteContext } from '../../context/RouteContext';
12
22
  import { TCStateContext } from '../../context/TopContentContext';
23
+ import { setCaseDetails } from '../../reducers/CaseReducer';
13
24
  import { AppRouteSections } from '../../reducers/RouteConstNTypes';
14
25
  import RouteUtils from '../../utils/routeUtils';
15
26
  import CaseInformation from '../CaseInformation/CaseInformation';
@@ -19,6 +30,7 @@ import OpenCase from '../OpenCase/OpenCase';
19
30
  import ProductSelector from '../ProductSelector/ProductSelector';
20
31
  import Recommendations from '../Recommendations/Recommendations';
21
32
  import Review from '../Review/Review';
33
+ import Constants from '../shared/Constants';
22
34
  import { useIsSectionValid } from '../shared/useIsSectionValid';
23
35
  import SubmitCase from '../SubmitCase/SubmitCase';
24
36
  import { GlobalTroubleshootEffects } from './GlobalTroubleshootEffects';
@@ -26,6 +38,33 @@ import MainSection from './MainSection';
26
38
  const defaultProps = {};
27
39
  function WizardMain(props) {
28
40
  const { isActiveSectionValid } = useIsSectionValid();
41
+ const caseDispatch = useCaseDispatch();
42
+ const { getPreferredLanguage } = useUserPreferences();
43
+ const userOriginalPreferredLanguage = () => __awaiter(this, void 0, void 0, function* () {
44
+ try {
45
+ const retrievedLanguage = yield getPreferredLanguage();
46
+ if (!isEmpty(retrievedLanguage)) {
47
+ const preferredLanguage = {
48
+ label: Constants.languagesMap[retrievedLanguage] || retrievedLanguage,
49
+ value: retrievedLanguage,
50
+ };
51
+ onLanguageChange(preferredLanguage);
52
+ }
53
+ }
54
+ catch (error) {
55
+ console.log(error);
56
+ }
57
+ });
58
+ const onCaseDetailsChange = (caseDetails) => {
59
+ setCaseDetails(caseDispatch, caseDetails);
60
+ };
61
+ const onLanguageChange = (selection) => {
62
+ onCaseDetailsChange({ caseLanguage: selection.value });
63
+ };
64
+ useEffect(() => {
65
+ userOriginalPreferredLanguage();
66
+ // eslint-disable-next-line react-hooks/exhaustive-deps
67
+ }, []);
29
68
  const { t } = useTranslation();
30
69
  const allSectionRefs = {
31
70
  [AppRouteSections.PRODUCT_SELECTOR]: useRef(null),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/troubleshoot",
3
- "version": "0.2.120",
3
+ "version": "0.2.123",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -28,11 +28,11 @@
28
28
  "peerDependencies": {
29
29
  "@cee-eng/hydrajs": "4.12.6",
30
30
  "@cee-eng/ui-toolkit": "1.1.6",
31
- "@patternfly/patternfly": "4.185.1",
31
+ "@patternfly/patternfly": "4.202.1",
32
32
  "@patternfly/pfe-accordion": "1.12.3",
33
33
  "@patternfly/pfe-collapse": "1.12.3",
34
34
  "@patternfly/pfe-tabs": "1.12.3",
35
- "@patternfly/react-core": "4.202.16",
35
+ "@patternfly/react-core": "4.224.1",
36
36
  "@rh-support/api": "0.3.9",
37
37
  "@rh-support/components": "^0.1.3",
38
38
  "@rh-support/react-context": "^0.1.3",
@@ -70,14 +70,14 @@
70
70
  "@patternfly/pfe-collapse": "1.12.3",
71
71
  "@patternfly/pfe-icon": "^1.12.3",
72
72
  "@patternfly/pfe-tabs": "1.12.3",
73
- "@patternfly/react-core": "4.202.16",
73
+ "@patternfly/react-core": "4.224.1",
74
74
  "@progress/kendo-drawing": "^1.6.0",
75
75
  "@progress/kendo-react-pdf": "^3.12.0",
76
76
  "@rh-support/api": "0.3.24",
77
- "@rh-support/components": "1.1.72",
78
- "@rh-support/react-context": "0.2.77",
77
+ "@rh-support/components": "1.1.74",
78
+ "@rh-support/react-context": "0.2.80",
79
79
  "@rh-support/types": "0.2.0",
80
- "@rh-support/user-permissions": "0.2.61",
80
+ "@rh-support/user-permissions": "0.2.62",
81
81
  "@rh-support/utils": "0.2.46",
82
82
  "@types/react-redux": "^7.1.12",
83
83
  "@types/redux": "^3.6.0",
@@ -143,5 +143,5 @@
143
143
  "not ie <= 11",
144
144
  "not op_mini all"
145
145
  ],
146
- "gitHead": "403aee29c2ee4be4cadb20fb74753c495803d387"
146
+ "gitHead": "92d0e7c14067d191a4b8d1a12df459c61deca4c0"
147
147
  }