@rh-support/troubleshoot 1.0.3 → 1.0.5

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.
@@ -72,7 +72,7 @@ function AccountSelector(props) {
72
72
  canUseFindMyAccount && (React.createElement("button", { role: "link", className: "btn btn-link btn-app find-my-account pf-u-ml-auto", onClick: onFindMyAccountClick, disabled: selectedAccountDetails.isFetching, "data-tracking-id": "open-case-find-my-account" },
73
73
  React.createElement(Trans, null, "Find my account")))),
74
74
  React.createElement("div", { className: "account-selector-wrapper" },
75
- React.createElement(AccountSelectorInternal, { selectedAccounts: [selectedAccount], canBookmarkAccount: canBookmarkAccounts, bookmarkedAccounts: bookmarkedGroupAccounts.data, id: "account-or-bookmark-selector", className: "account-selector", name: "account-or-bookmark-selector", placeholder: t(`Search for an account ${loggedInUserRights.data.isExternal() ? '' : 'or select a bookmark'} `), onSelect: onInternalAccountSelect, disabled: loggedInUserRights.data.isExternal() || selectedAccountDetails.isFetching, isInValid: isSelectedAccountSubscriptionAbused, restrictedOnSubscriptionAbuse: true })),
75
+ React.createElement(AccountSelectorInternal, { selectedAccounts: [selectedAccount], canBookmarkAccount: canBookmarkAccounts, bookmarkedAccounts: bookmarkedGroupAccounts.data, id: "account-or-bookmark-selector", className: "account-selector", name: "account-or-bookmark-selector", placeholder: t(`Search for an account ${loggedInUserRights.data.isExternal() ? 'or select a bookmark' : ''} `), onSelect: onInternalAccountSelect, disabled: loggedInUserRights.data.isExternal() || selectedAccountDetails.isFetching, isInValid: isSelectedAccountSubscriptionAbused, restrictedOnSubscriptionAbuse: true })),
76
76
  canAccessManagedAccounts && (React.createElement(ManagedAccountsDropdown, { className: "managed-account-selector", onManagedAccountChange: onManagedAccountChange, managedAccounts: managedAccounts, selectedAccountNumber: accountNumber, disabled: selectedAccountDetails.isFetching })),
77
77
  isSelectedAccountSubscriptionAbused && (React.createElement("p", { className: "form-instructions form-invalid" },
78
78
  React.createElement(InfoCircleIcon, null),
@@ -1 +1 @@
1
- {"version":3,"file":"CaseDetailsAside.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseEditView/CaseDetailsAside.tsx"],"names":[],"mappings":"AAwBA,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;CACtB;AAMD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,eAsL7C"}
1
+ {"version":3,"file":"CaseDetailsAside.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseEditView/CaseDetailsAside.tsx"],"names":[],"mappings":"AA0BA,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;CACtB;AAMD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,eAkQ7C"}
@@ -1,15 +1,25 @@
1
- import { Button, Switch, Tooltip } from '@patternfly/react-core';
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
+ };
10
+ import { Button, Checkbox, Switch, Tooltip } from '@patternfly/react-core';
2
11
  import AngleDoubleLeftIcon from '@patternfly/react-icons/dist/js/icons/angle-double-left-icon';
3
12
  import AngleDoubleRightIcon from '@patternfly/react-icons/dist/js/icons/angle-double-right-icon';
4
13
  import ListIcon from '@patternfly/react-icons/dist/js/icons/list-icon';
5
14
  import LockIcon from '@patternfly/react-icons/dist/js/icons/lock-icon';
6
15
  import TrendUpIcon from '@patternfly/react-icons/dist/js/icons/trend-up-icon';
7
- import { ErrorBoundary, useBreakpoint, useForceUpdate } from '@rh-support/components';
8
- import { GlobalMetadataDispatchContext, toggleViewAsCustomerFlag, useGlobalStateContext, } from '@rh-support/react-context';
16
+ import { ErrorBoundary, ToastNotification, useBreakpoint, useForceUpdate } from '@rh-support/components';
17
+ import { GlobalMetadataDispatchContext, toggleViewAsCustomerFlag, useGlobalStateContext, useUserPreferences, } from '@rh-support/react-context';
9
18
  import { ability, CaseDetailsFields, resourceActions, resources } from '@rh-support/user-permissions';
10
19
  import { scrollIntoView } from '@rh-support/utils';
20
+ import { isEmpty } from 'lodash';
11
21
  import isEqual from 'lodash/isEqual';
12
- import React, { useContext, useEffect, useRef } from 'react';
22
+ import React, { useContext, useEffect, useRef, useState } from 'react';
13
23
  import { Trans, useTranslation } from 'react-i18next';
14
24
  import { useCaseSelector } from '../../context/CaseContext';
15
25
  import { useCaseDetailsPageStateContext } from '../../context/CaseDetailsPageContext';
@@ -53,6 +63,30 @@ export function CaseDetailsAside(props) {
53
63
  sectionToScrollRef.current = null;
54
64
  }
55
65
  };
66
+ const { getOriginalCaseView, updateOriginalCaseView } = useUserPreferences();
67
+ const [viewAsInternalPref, setViewAsInternalPref] = useState();
68
+ const [isDefaultBoxChecked, setIsDefaultBoxChecked] = useState(false);
69
+ useEffect(() => {
70
+ const userPreferredCaseView = () => __awaiter(this, void 0, void 0, function* () {
71
+ try {
72
+ const isRetrievedInternal = yield getOriginalCaseView(); // retrieving as string.
73
+ const finalIsRetrievedInternal = !!+isRetrievedInternal; // converting backend string -> num -> bool
74
+ if (finalIsRetrievedInternal != null) {
75
+ setViewAsInternalPref(finalIsRetrievedInternal);
76
+ !finalIsRetrievedInternal && setIsDefaultBoxChecked(true);
77
+ }
78
+ if (finalIsRetrievedInternal === false) {
79
+ !preferredOrDefaultCaseView() && toggleViewAsCustomerFlag(globalMetadataDispatchContext);
80
+ }
81
+ }
82
+ catch (_a) {
83
+ ToastNotification.addWarningMessage(t('Failed to fetch original preference'));
84
+ setIsDefaultBoxChecked(false);
85
+ }
86
+ });
87
+ userPreferredCaseView();
88
+ // eslint-disable-next-line react-hooks/exhaustive-deps
89
+ }, []);
56
90
  const setSectionToScollRef = (sectionRef) => {
57
91
  sectionToScrollRef.current = sectionRef;
58
92
  };
@@ -62,6 +96,14 @@ export function CaseDetailsAside(props) {
62
96
  caseDetailsAsidePanelRef.current.expanded = isExpanded;
63
97
  forceUpdate();
64
98
  };
99
+ const preferredOrDefaultCaseView = () => {
100
+ if (isEmpty(viewAsInternalPref)) {
101
+ return viewAsCustomer; // This is the default var used by the component we only want this if value is null meaning user made no preference.
102
+ }
103
+ else if (!isEmpty(viewAsInternalPref)) {
104
+ return !viewAsInternalPref;
105
+ }
106
+ };
65
107
  useEffect(() => {
66
108
  if (isFetchingCaseDetails || !isFirstMountRef.current || isFetchingCaseDetailsError)
67
109
  return;
@@ -73,6 +115,25 @@ export function CaseDetailsAside(props) {
73
115
  !isXLScreen && toggleAside(false);
74
116
  // eslint-disable-next-line react-hooks/exhaustive-deps
75
117
  }, [breakPoint]);
118
+ const onDefaultCheckboxChange = (e) => {
119
+ try {
120
+ //if user is unchecking the box we look for it being checked
121
+ if (isDefaultBoxChecked) {
122
+ updateOriginalCaseView(+viewAsCustomer);
123
+ setIsDefaultBoxChecked(!isDefaultBoxChecked);
124
+ }
125
+ else if (isDefaultBoxChecked === false) {
126
+ updateOriginalCaseView(0);
127
+ setIsDefaultBoxChecked(true);
128
+ }
129
+ }
130
+ catch (error) {
131
+ setIsDefaultBoxChecked(isDefaultBoxChecked);
132
+ }
133
+ };
134
+ const onCaseSwitchChange = (e) => {
135
+ toggleViewAsCustomerFlag(globalMetadataDispatchContext);
136
+ };
76
137
  const isSideBarExpanded = (_a = caseDetailsAsidePanelRef.current) === null || _a === void 0 ? void 0 : _a.expanded;
77
138
  if (isFetchingCaseDetails || isFetchingCaseDetailsError)
78
139
  return null;
@@ -96,9 +157,16 @@ export function CaseDetailsAside(props) {
96
157
  React.createElement(TrendUpIcon, { size: "md" }))))))),
97
158
  React.createElement("pfe-collapse-panel", { className: "sidebar-content", "pfe-animation": "false", id: "case-details-aside-content", ref: caseDetailsAsidePanelRef },
98
159
  React.createElement("div", { className: "grid-aside-content" },
99
- canSeeToggleCustomerView && (React.createElement("div", { className: "pf-u-display-flex customer-view-toggle", ref: toggleCustomerViewRef },
100
- React.createElement("span", { className: "customer-view-switch-label" }, viewAsCustomer ? t('Customer view') : t('Internal view')),
101
- React.createElement(Switch, { title: viewAsCustomer ? t('Customer view') : t('Internal view'), "data-tracking-id": viewAsCustomer ? 'disable-view-as-customer' : 'enable-view-as-customer', "aria-label": viewAsCustomer ? 'disable view as customer' : 'enable view as customer', id: "customer-view-switch", className: "pf-u-ml-auto", isChecked: viewAsCustomer, onChange: () => toggleViewAsCustomerFlag(globalMetadataDispatchContext) }))),
160
+ React.createElement("div", null,
161
+ canSeeToggleCustomerView && (React.createElement("div", { className: "pf-u-display-flex customer-view-toggle", ref: toggleCustomerViewRef },
162
+ React.createElement("span", { className: "customer-view-switch-label" }, preferredOrDefaultCaseView() ? t('Customer view') : t('Internal view')),
163
+ React.createElement(Switch, { title: preferredOrDefaultCaseView() ? t('Customer view') : t('Internal view'), "data-tracking-id": preferredOrDefaultCaseView()
164
+ ? 'disable-view-as-customer'
165
+ : 'enable-view-as-customer', "aria-label": preferredOrDefaultCaseView()
166
+ ? 'disable view as customer'
167
+ : 'enable view as customer', id: "customer-view-switch", className: "pf-u-ml-auto", isChecked: preferredOrDefaultCaseView(), onChange: onCaseSwitchChange }))),
168
+ canSeeToggleCustomerView && (React.createElement("div", null,
169
+ React.createElement(Checkbox, { label: t('Set to default'), isChecked: isDefaultBoxChecked, onChange: onDefaultCheckboxChange, id: "set-default-view-checkbox", name: "default-view-checkbox", isDisabled: !viewAsCustomer, className: 'defaultViewCheckbox' })))),
102
170
  React.createElement(ErrorBoundary, { errorMsgInfo: { message: t('There was an error loading top solutions') } },
103
171
  React.createElement(CaseSolutions, { caseNumber: caseNumber, ref: topSolutionsRef, isSecureSupportAccount: isSecureSupportAccount })),
104
172
  !caseEscalations.isFetching && canViewACESection && (React.createElement(ErrorBoundary, null,
@@ -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":"AAwCA,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAK,EAAE,MAAM,eAmejD"}
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { Alert, AlertVariant, Button, ButtonVariant, ExpandableSection, Label } from '@patternfly/react-core';
11
11
  import { ToastNotification, useConfirmation } from '@rh-support/components';
12
- import { AddRemoveBookmarkWrapper, CloseCaseModal, fetchCaseSeverities, fetchCaseTypes, GlobalMetadataDispatchContext, GlobalMetadataStateContext, useCanEditCase, } from '@rh-support/react-context';
12
+ import { CloseCaseModal, fetchCaseSeverities, fetchCaseTypes, GlobalMetadataDispatchContext, GlobalMetadataStateContext, useCanEditCase, } from '@rh-support/react-context';
13
13
  import { AbilityContext, CaseDetailsFields, resourceActions, resources } from '@rh-support/user-permissions';
14
14
  import { haventLoadedMetadata, isOpenShiftOnlineProduct } from '@rh-support/utils';
15
15
  import isEqual from 'lodash/isEqual';
@@ -35,7 +35,6 @@ export default function CaseOverview(props) {
35
35
  const { t } = useTranslation();
36
36
  const canManageCase = ability.can(resourceActions.UPDATE, resources.CASE_DETAILS);
37
37
  const canSeeCaseOwnerInfo = ability.can(resourceActions.PATCH, resources.CASE_DETAILS, CaseDetailsFields.CASE_DETAILS_OWNER);
38
- const canAccessBookmark = ability.can(resourceActions.READ, resources.BOOKMARK_ACCOUNTS);
39
38
  const canSeeInactivityWarning = ability.can(resourceActions.PATCH, resources.CASE_DETAILS, CaseDetailsFields.CASE_DETAILS_ACTIVITY_WARNING);
40
39
  const [caseOverviewState, caseOverviewDispatch] = useReducer(caseOverviewReducer, initialCaseViewState);
41
40
  const [isDetailsExpanded, setIsDetailsExpanded] = useState(true);
@@ -261,12 +260,7 @@ export default function CaseOverview(props) {
261
260
  React.createElement("div", { className: "account" },
262
261
  React.createElement("h3", { className: "subheading subheading-sm" },
263
262
  React.createElement(Trans, null, "Account")),
264
- React.createElement("div", null,
265
- accountNumber,
266
- canAccessBookmark && accountNumber && (React.createElement(AddRemoveBookmarkWrapper, { selectedAccount: {
267
- accountNumber: accountNumber,
268
- name: selectedAccountDetails.data.name,
269
- }, removeBookmarkTitle: t('Remove bookmark'), addBookmarkTitle: t('Bookmark account') }))),
263
+ React.createElement("div", null, accountNumber),
270
264
  React.createElement("div", null, selectedAccountDetails.data.name)),
271
265
  React.createElement("div", { className: "created-by" },
272
266
  React.createElement("h3", { className: "subheading subheading-sm" },
@@ -17,6 +17,6 @@ export function CaseSecureSupportAlert(props) {
17
17
  "to access secure support cases."));
18
18
  }
19
19
  };
20
- return (React.createElement(AlertMessage, { variant: AlertType.WARNING, show: isSecureSupportTechViewingSecureCase },
20
+ return (React.createElement(AlertMessage, { variant: AlertType.WARNING, show: isSecureSupportTechViewingSecureCase, isInline: true },
21
21
  React.createElement(Trans, null, getWarningMsg())));
22
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CaseOpenshiftClusterId.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/CaseEditView/Tabs/CaseDetails/CaseOpenshiftClusterId/CaseOpenshiftClusterId.tsx"],"names":[],"mappings":"AA0BA,wBAAgB,sBAAsB,gBA4QrC"}
1
+ {"version":3,"file":"CaseOpenshiftClusterId.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/CaseEditView/Tabs/CaseDetails/CaseOpenshiftClusterId/CaseOpenshiftClusterId.tsx"],"names":[],"mappings":"AA0BA,wBAAgB,sBAAsB,gBAmRrC"}
@@ -36,7 +36,7 @@ export function CaseOpenshiftClusterId() {
36
36
  const caseDispatch = useCaseDispatch();
37
37
  const { globalMetadataState: { allProducts, loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
38
38
  const majorVersion = (version && getVersion(version).major) || '';
39
- const isOpenShiftV3 = majorVersion === '3';
39
+ const isOpenShiftV3 = product === 'OpenShift Container Platform' && majorVersion === '3';
40
40
  const isCustomer = loggedInUserRights.data.isAccountSameAsLoggedInAccount(selectedAccountDetails.data.accountNumber);
41
41
  const [showClusterId, setShowClusterId] = useState(false);
42
42
  const [isClusterIdInvalid, setIsClusterIdInValid] = useState(false);
@@ -127,6 +127,13 @@ export function CaseOpenshiftClusterId() {
127
127
  return;
128
128
  setLocalOpenshiftClusterIDState(selectedClusterId);
129
129
  if (selectedClusterId === 'dont-have-id') {
130
+ const caseDetails = {
131
+ openshiftClusterID: '',
132
+ noClusterIdReasonExplanation: '',
133
+ noClusterIdReason: '',
134
+ openshiftClusterVersion: '',
135
+ };
136
+ yield clusterIdUpdate(caseDetails);
130
137
  setDontKnowSelected(true);
131
138
  setSelectedReason(selectedClusterId);
132
139
  setIsClusterIdInValid(false);
@@ -219,7 +226,7 @@ export function CaseOpenshiftClusterId() {
219
226
  }
220
227
  else {
221
228
  return (React.createElement(React.Fragment, null,
222
- React.createElement(OpenshiftDropdownV4, { openshiftDisplayName: displayName.current, openshiftClusterIDState: localOpenshiftClusterIDState || selectedReason, onClusterIdStateUpdate: onClusterIdSave, isClusterIdInvalid: (isEmpty(localOpenshiftClusterIDState) && isEmpty(selectedReason)) || isClusterIdInvalid, clusterIdDropdownFormInstructions: clusterIdDropdownFormInstructions(), onClusterClear: resetClusterData, isV3: majorVersion === '3' || isNaN(parseInt(majorVersion)), isDisabled: isClusterIdUpdating, noClusterIdReasonExplanation: noClusterIdReasonExplanation }),
229
+ React.createElement(OpenshiftDropdownV4, { openshiftDisplayName: displayName.current, openshiftClusterIDState: localOpenshiftClusterIDState || selectedReason, onClusterIdStateUpdate: onClusterIdSave, isClusterIdInvalid: (isEmpty(localOpenshiftClusterIDState) && isEmpty(selectedReason)) || isClusterIdInvalid, clusterIdDropdownFormInstructions: clusterIdDropdownFormInstructions(), onClusterClear: resetClusterData, isV3: product !== 'OpenShift Container Platform', isDisabled: isClusterIdUpdating, noClusterIdReasonExplanation: noClusterIdReasonExplanation }),
223
230
  noClusterIdReasonExplanation !== 'v3-cluster' &&
224
231
  (dontKnowSelected || noClusterIdReasonExplanation || noClusterIdReason) && (React.createElement(NoClusterIDReasonSelector, { noClusterIdReasonExplanation: noClusterIdReasonExplanation, noClusterIdReason: noClusterIdReason, onReasonInputBoxChanged: debounceFn, onReasonChange: onReasonChange, isInValid: isInVaidNoClusterIdReason, isCustomer: isCustomer, isDisabled: isReasonUpdating })),
225
232
  React.createElement(LoadingIndicator, { show: isClusterIdUpdating, size: "xs" })));
@@ -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,eA8exC"}
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,eAwexC"}
@@ -13,7 +13,7 @@ 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
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
- import { getConfigField, PCM_CONFIG_FIELD_TYPE, pendoTrackEvent } from '@rh-support/utils';
16
+ import { pendoTrackEvent } from '@rh-support/utils';
17
17
  import isEmpty from 'lodash/isEmpty';
18
18
  import isEqual from 'lodash/isEqual';
19
19
  import uniqBy from 'lodash/uniqBy';
@@ -74,8 +74,7 @@ export function PostComment(props) {
74
74
  }, []);
75
75
  const [isModalOpen, setIsModalOpen] = useState(false);
76
76
  const [isProcessing, setIsProcessing] = useState(isPostingComment || isUploadingAttachments);
77
- const { globalMetadataState: { loggedInUser, loggedInUserRights, loggedInUsersAccount, pcmConfig }, } = useContext(GlobalMetadataStateContext);
78
- const allowInlineImagesInMarkdown = getConfigField(pcmConfig.data, 'allowInlineImagesInMarkdown', PCM_CONFIG_FIELD_TYPE.FEATURE_FLAG);
77
+ const { globalMetadataState: { loggedInUser, loggedInUserRights, loggedInUsersAccount }, } = useContext(GlobalMetadataStateContext);
79
78
  const { onFileSelect, onFileAttach, onFileDelete, isUploadingFile, isMarkdownFileUploadInProgress, cancelFileUpload, } = useMarkdownFileUploader({
80
79
  caseNumber,
81
80
  secureSupport: loggedInUsersAccount.data.secureSupport,
@@ -302,7 +301,7 @@ export function PostComment(props) {
302
301
  };
303
302
  return (React.createElement("div", { className: "pf-u-mb-md hide-in-pdf", ref: componentRef },
304
303
  React.createElement(MarkdownEditor, { className: `${!isPublic ? 'is-private' : ''}`, disabled: isProcessing || canEditCase.isCaseNotEditable, "aria-label": "comment text area", showMarkdownPlainTextToggle: true, editorMode: commentType, onFocus: () => setIsTextAreaFocused(true), onBlur: onTextAreaBlur, onChange: onCommentTextChange, value: commentText, rows: isTextAreaFocused ? 12 : 4, bindTextArea: textAreaRef, onCommentExceedCharsLimit: onCommentExceedCharsLimit, mdPlaceholder: isPublic ? 'Add a comment using markdown' : 'Add a comment or attach a file privately', plainTextPlaceholder: isPublic ? 'Add a comment to this case' : 'Add a comment or attach a file privately', fileSelectorProps: {
305
- showFileSelectorInToolbar: allowInlineImagesInMarkdown && !loggedInUsersAccount.data.secureSupport,
304
+ showFileSelectorInToolbar: !loggedInUsersAccount.data.secureSupport,
306
305
  filesList: getAllAttachments(),
307
306
  onFileSelect: onFileSelect,
308
307
  onFileDelete: onFileDelete,
@@ -324,6 +323,6 @@ export function PostComment(props) {
324
323
  React.createElement(FileUpload, { className: `file-upload-section ${hasSomeSelectedFilesLocal ? 'card card-white pf-u-mt-lg pf-u-p-lg' : ''}`, idToUploadTo: caseNumber, onUploadClick: onFileUploadClick, isSessionId: false, isSecureSupport: loggedInUsersAccount.data.secureSupport, isPrivate: !isPublic, autoUploadOnSelect: true, showDescriptionInfoMsg: true }),
325
324
  React.createElement("span", Object.assign({}, getRootProps()),
326
325
  React.createElement("input", Object.assign({ style: { display: 'none !important' } }, getInputProps()))),
327
- allowInlineImagesInMarkdown && !loggedInUsersAccount.data.secureSupport && (React.createElement(NewFeaturePopoverAnnouncement, { "aria-label": "Attach and embed images! You'll find all of your uploaded images here.", featureName: FeatureAnnouncementKeys.MARKDOWN_INLINE_IMAGES, sectionRef: componentRef, bodyContent: React.createElement("div", null,
326
+ !loggedInUsersAccount.data.secureSupport && (React.createElement(NewFeaturePopoverAnnouncement, { "aria-label": "Attach and embed images! You'll find all of your uploaded images here.", featureName: FeatureAnnouncementKeys.MARKDOWN_INLINE_IMAGES, sectionRef: componentRef, bodyContent: React.createElement("div", null,
328
327
  React.createElement(Trans, null, "Attach and embed images! You'll find all of your uploaded images here.")), reference: () => document.getElementById('md-editor-toolbar-file-selector') }))));
329
328
  }
@@ -60,7 +60,7 @@ export function OpenShiftClusterId() {
60
60
  const clusterRecommendationsDispatch = useContext(ClusterRecommendationsDispatchContext);
61
61
  const { clusterRecommendationsState: { clusterRecommendationsCache }, } = useContext(ClusterRecommendationsContext);
62
62
  const majorVersion = (version && getVersion(version).major) || '';
63
- const isOpenShiftV3 = majorVersion === '3';
63
+ const isOpenShiftV3 = product === 'OpenShift Container Platform' && majorVersion === '3';
64
64
  const isCustomer = loggedInUserRights.data.isAccountSameAsLoggedInAccount(selectedAccountDetails.data.accountNumber);
65
65
  const [showClusterId, setShowClusterId] = useState(false);
66
66
  const [isClusterIdInvalid, setIsClusterIdInValid] = useState(false);
@@ -206,7 +206,7 @@ export function OpenShiftClusterId() {
206
206
  return null;
207
207
  return (React.createElement(React.Fragment, null,
208
208
  !isOpenShiftV3 && (React.createElement(OpenshiftDropdownV4, { openshiftDisplayName: openshiftDisplayName, openshiftClusterIDState: openshiftClusterID || selectedReason, onClusterIdStateUpdate: onClusterIdStateUpdate, isClusterIdInvalid: showValidationErrorAlert &&
209
- ((isEmpty(openshiftClusterID) && isEmpty(selectedReason)) || isClusterIdInvalid), clusterIdDropdownFormInstructions: clusterIdDropdownFormInstructions(), onClusterClear: resetClusterData, isV3: majorVersion === '3' || isNaN(parseInt(majorVersion)) })),
209
+ ((isEmpty(openshiftClusterID) && isEmpty(selectedReason)) || isClusterIdInvalid), clusterIdDropdownFormInstructions: clusterIdDropdownFormInstructions(), onClusterClear: resetClusterData, isV3: product !== 'OpenShift Container Platform' })),
210
210
  noClusterIdReasonExplanation !== 'v3-cluster' && dontKnowSelected && !isOpenShiftV3 && (React.createElement(NoClusterIDReasonSelector, { noClusterIdReasonExplanation: noClusterIdReasonExplanation, noClusterIdReason: noClusterIdReason, onReasonInputBoxChanged: onReasonExplanationInputBoxChanged, onReasonChange: onReasonChange, isInValid: isInVaidNoClusterIdReason, isCustomer: isCustomer })),
211
211
  (v3Selected || isOpenShiftV3) && (React.createElement(OpenShiftV3Inputbox, { v3ClusterName: v3ClusterName, onReasonInputBoxChanged: v3ClusterNameInputBoxChanged, isInValid: isEmpty(v3ClusterName.trim()) && showValidationErrorAlert, v3Selected: v3Selected }))));
212
212
  }
@@ -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;AAe5F,UAAU,MAAM;IACZ,sBAAsB,EAAE,sBAAsB,EAAE,CAAC;CACpD;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,eAiGvD"}
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,eA0EvD"}
@@ -1,11 +1,11 @@
1
1
  import { pcm } from '@cee-eng/hydrajs';
2
2
  import { Label } from '@patternfly/react-core';
3
+ import ArrowRightIcon from '@patternfly/react-icons/dist/js/icons/arrow-right-icon';
3
4
  import isEqual from 'lodash/isEqual';
4
5
  import React, { useContext, useEffect } from 'react';
5
6
  import { Trans } from 'react-i18next';
6
7
  import { useCaseSelector } from '../../context/CaseContext';
7
8
  import { SessionRestoreDispatchContext, SessionRestoreStateContext } from '../../context/SessionRestoreContext';
8
- import { useParseRuleMarkdown } from '../../hooks/useParseRuleMarkdown';
9
9
  import { createOrUpdateSessionResources, getRulesToSave, getSessResFromRules, } from '../../reducers/SessionRestoreReducer';
10
10
  import { riskLabels } from '../shared/Constants';
11
11
  export function ClusterRecommendationItems(props) {
@@ -17,12 +17,8 @@ export function ClusterRecommendationItems(props) {
17
17
  product: state.caseDetails.product,
18
18
  openshiftClusterID: state.caseDetails.openshiftClusterID,
19
19
  }), isEqual);
20
- const { parseDotMarkdownWithTracking } = useParseRuleMarkdown();
21
20
  const onResourceClick = (e, rule) => {
22
- if (e.target.tagName.toLowerCase() === 'a') {
23
- const visitedUrl = e.target.href.split('?')[0];
24
- createOrUpdateSessionResources(sessionRestoreDispatch, activeSessionId, sessionResourceTracking, SessionResourceSource.CLUSTER_RECOMMENDATION, [getSessResFromRules(visitedUrl, SessionResourceVisibility.VISITED, rule.rule_id)], JSON.stringify({ product, version, openshiftClusterID }));
25
- }
21
+ createOrUpdateSessionResources(sessionRestoreDispatch, activeSessionId, sessionResourceTracking, SessionResourceSource.CLUSTER_RECOMMENDATION, [getSessResFromRules('', SessionResourceVisibility.VISITED, rule.rule_id)], JSON.stringify({ product, version, openshiftClusterID }));
26
22
  };
27
23
  useEffect(() => {
28
24
  createOrUpdateSessionResources(sessionRestoreDispatch, activeSessionId, sessionResourceTracking, SessionResourceSource.CLUSTER_RECOMMENDATION, getRulesToSave('', '', props.clusterRecommendations), JSON.stringify({ product, version, openshiftClusterID }));
@@ -36,10 +32,8 @@ export function ClusterRecommendationItems(props) {
36
32
  React.createElement(Label, { icon: riskLabels[rule.total_risk].icon, className: riskLabels[rule.total_risk].className },
37
33
  React.createElement(Trans, null, riskLabels[rule.total_risk].label))),
38
34
  React.createElement("p", null, rule.details || ''),
39
- rule.reason && (React.createElement(React.Fragment, null,
40
- React.createElement("h3", { className: "subheading subheading-sm" }, "Reason: "),
41
- React.createElement("p", { onClick: (e) => onResourceClick(e, rule), dangerouslySetInnerHTML: parseDotMarkdownWithTracking(rule.reason, rule.extra_data, SessionResourceSource.CLUSTER_RECOMMENDATION, 'ts-cluster-recommendation', 'se-cluster-recommendation-rule') }))),
42
- rule.resolution && (React.createElement(React.Fragment, null,
43
- React.createElement("h3", { className: "subheading subheading-sm" }, "Resolution: "),
44
- React.createElement("p", { onClick: (e) => onResourceClick(e, rule), dangerouslySetInnerHTML: parseDotMarkdownWithTracking(rule.resolution, rule.extra_data, SessionResourceSource.CLUSTER_RECOMMENDATION, 'ts-cluster-recommendation', 'se-cluster-recommendation-rule') })))))))));
35
+ React.createElement("a", { onClick: (e) => onResourceClick(e, rule), className: "pf-u-font-weight-bold", "data-tracking-id": "cluster-recommendations", href: `https://console.redhat.com/openshift/insights/advisor/clusters/${openshiftClusterID}`, target: "_blank", rel: "noopener noreferrer" },
36
+ React.createElement(Trans, null,
37
+ "View details and remediation steps ",
38
+ React.createElement(ArrowRightIcon, { "aria-hidden": "true" })))))))));
45
39
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CaseHelpers.d.ts","sourceRoot":"","sources":["../../../src/reducers/CaseHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,qDAAqD,CAAC;AACpG,OAAO,EAAE,Y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C,MAAM,uBACC,MAAM,yBACJ,MAAM,KAC9B,MAQF,CAAC;AAEF,eAAO,MAAM,uBAAuB,iBAAkB,MAAM,YAAY,MAAM,KAAG,MAQhF,CAAC;AAEF,eAAO,MAAM,uBAAuB,iBAAkB,MAAM,YAAY,MAAM,KAAG,MAQhF,CAAC;AAEF,eAAO,MAAM,sBAAsB,aAAc,MAAM,KAAG,MAKzD,CAAC;AAEF,eAAO,MAAM,gBAAgB,+CAmC5B,CAAC;AAIF,eAAO,MAAM,gBAAgB,cAAe,UAAU,wBAAwB,QAAQ,eAAe,CAAC,KAAG,OA2BxG,CAAC;AAEF,eAAO,MAAM,0BAA0B,cACxB,UAAU,wBACC,QAAQ,eAAe,CAAC,KAC/C,OAiBF,CAAC;AAIF,eAAO,MAAM,6BAA6B,cAC3B,UAAU,wBACC,QAAQ,eAAe,CAAC,KAC/C,OAuBF,CAAC;AAEF,eAAO,MAAM,iBAAiB,cACf,UAAU,gBACP,YAAY,iBACZ,OAAO,KACtB,QAAQ,YAAY,CAiEtB,CAAC;AAEF,eAAO,MAAM,wBAAwB,qBAAsB,YAAY,EAAE,KAAG,YAAY,EAEvF,CAAC;AACF,eAAO,MAAM,yBAAyB,qBAAsB,YAAY,EAAE,KAAG,OAE5E,CAAC;AAEF,eAAO,MAAM,yBAAyB,gBACrB,YAAY,6BACE,MAAM,mBAChB,MAAM,KACxB,QAAQ,YAAY,CA6BtB,CAAC;AACF,eAAO,MAAM,yBAAyB,gBACrB,QAAQ,YAAY,CAAC,gCACJ,QAAQ,EAAE,KACzC,eAyCF,CAAC"}
@@ -1,4 +1,4 @@
1
- import { canManageCase, getAppVersion, getUserAgentForCaseMode, isPremiumEntitlement, showFtsOnCreateCasePage, } from '@rh-support/utils';
1
+ import { canManageCase, getAppVersion, getUserAgentForCaseMode, getVersion, isPremiumEntitlement, showFtsOnCreateCasePage, } from '@rh-support/utils';
2
2
  import filter from 'lodash/filter';
3
3
  import forEach from 'lodash/forEach';
4
4
  import isEmpty from 'lodash/isEmpty';
@@ -102,6 +102,8 @@ export const getSeverityDescription = (severity) => {
102
102
  export const isClusterIDValid = (caseState, allProducts) => {
103
103
  const case_details = caseState.caseDetails;
104
104
  const productHasClusterID = isClusterIdEnabledForProduct(case_details.product, allProducts);
105
+ const majorVersion = (case_details.version && getVersion(case_details.version).major) || '';
106
+ const isOpenShiftV3 = case_details.product === 'OpenShift Container Platform' && majorVersion === '3';
105
107
  const hasValidClusterId = () => !isEmpty(case_details.openshiftClusterID) &&
106
108
  isEmpty(case_details.noClusterIdReason) &&
107
109
  isEmpty(case_details.noClusterIdReasonExplanation) &&
@@ -119,7 +121,7 @@ export const isClusterIDValid = (caseState, allProducts) => {
119
121
  case_details.noClusterIdReasonExplanation !== 'v3-cluster';
120
122
  const hasValidV3ClusterName = () => isEmpty(case_details.openshiftClusterID) &&
121
123
  !isEmpty(caseState.v3ClusterName) &&
122
- case_details.noClusterIdReasonExplanation === 'v3-cluster';
124
+ (case_details.noClusterIdReasonExplanation === 'v3-cluster' || isOpenShiftV3);
123
125
  return productHasClusterID
124
126
  ? hasValidClusterId() || hasValidReason() || hasValidReasonExplanation() || hasValidV3ClusterName()
125
127
  : true;
@@ -945,3 +945,7 @@ div.pf-c-alert.ea-rule-alert > div.pf-c-alert__description > p {
945
945
  }
946
946
  }
947
947
  }
948
+
949
+ div.defaultViewCheckbox {
950
+ grid-gap: 0px;
951
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/troubleshoot",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -73,11 +73,11 @@
73
73
  "@patternfly/react-core": "4.202.16",
74
74
  "@progress/kendo-drawing": "^1.6.0",
75
75
  "@progress/kendo-react-pdf": "^3.12.0",
76
- "@rh-support/components": "1.2.1",
77
- "@rh-support/react-context": "1.0.2",
76
+ "@rh-support/components": "1.2.3",
77
+ "@rh-support/react-context": "1.0.4",
78
78
  "@rh-support/types": "0.2.0",
79
- "@rh-support/user-permissions": "1.0.1",
80
- "@rh-support/utils": "1.0.1",
79
+ "@rh-support/user-permissions": "1.0.3",
80
+ "@rh-support/utils": "1.0.2",
81
81
  "@types/react-redux": "^7.1.12",
82
82
  "@types/redux": "^3.6.0",
83
83
  "@webcomponents/webcomponentsjs": "^2.2.10",
@@ -142,5 +142,5 @@
142
142
  "not ie <= 11",
143
143
  "not op_mini all"
144
144
  ],
145
- "gitHead": "4c44ec177438ff8e09a761a4f38ce3fbd83c7aaa"
145
+ "gitHead": "8891e192aa5a3aef7b3b456fed64ef5ad68afa47"
146
146
  }