@rh-support/troubleshoot 0.2.25 → 0.2.29

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 (49) hide show
  1. package/lib/esm/components/CaseManagement/OpenShiftClusterId.d.ts.map +1 -1
  2. package/lib/esm/components/CaseManagement/OpenShiftClusterId.js +21 -6
  3. package/lib/esm/components/CaseManagement/OpenshiftDropdownV4.js +1 -1
  4. package/lib/esm/components/CaseManagement/SendNotifications/AddCustomEmailToAccountModal.js +2 -2
  5. package/lib/esm/components/CaseManagement/SendNotifications/CaseContactSelector.d.ts.map +1 -1
  6. package/lib/esm/components/CaseManagement/SendNotifications/CaseContactSelector.js +7 -6
  7. package/lib/esm/components/ImproveCase/KtQuestions.d.ts.map +1 -1
  8. package/lib/esm/components/ImproveCase/KtQuestions.js +6 -5
  9. package/lib/esm/components/Recommendations/ClusterRecommendationItems.d.ts +7 -0
  10. package/lib/esm/components/Recommendations/ClusterRecommendationItems.d.ts.map +1 -0
  11. package/lib/esm/components/Recommendations/ClusterRecommendationItems.js +40 -0
  12. package/lib/esm/components/Recommendations/ClusterRecommendations.d.ts +2 -0
  13. package/lib/esm/components/Recommendations/ClusterRecommendations.d.ts.map +1 -0
  14. package/lib/esm/components/Recommendations/ClusterRecommendations.js +24 -0
  15. package/lib/esm/components/Recommendations/ClusterRecommendationsModal.d.ts +9 -0
  16. package/lib/esm/components/Recommendations/ClusterRecommendationsModal.d.ts.map +1 -0
  17. package/lib/esm/components/Recommendations/ClusterRecommendationsModal.js +48 -0
  18. package/lib/esm/components/Recommendations/RulesModal.js +1 -1
  19. package/lib/esm/components/SessionRestore/SessionRestore.d.ts.map +1 -1
  20. package/lib/esm/components/SessionRestore/SessionRestore.js +4 -4
  21. package/lib/esm/components/shared/Constants.d.ts +18 -0
  22. package/lib/esm/components/shared/Constants.d.ts.map +1 -1
  23. package/lib/esm/components/shared/Constants.js +6 -0
  24. package/lib/esm/components/wizardLayout/GlobalTroubleshootEffects.d.ts.map +1 -1
  25. package/lib/esm/components/wizardLayout/GlobalTroubleshootEffects.js +9 -2
  26. package/lib/esm/components/wizardLayout/WizardAside.d.ts.map +1 -1
  27. package/lib/esm/components/wizardLayout/WizardAside.js +4 -1
  28. package/lib/esm/context/ClusterRecommendationsContext.d.ts +13 -0
  29. package/lib/esm/context/ClusterRecommendationsContext.d.ts.map +1 -0
  30. package/lib/esm/context/ClusterRecommendationsContext.js +13 -0
  31. package/lib/esm/context/RootTroubleshootProvider.d.ts.map +1 -1
  32. package/lib/esm/context/RootTroubleshootProvider.js +4 -2
  33. package/lib/esm/hooks/useParseRuleMarkdown.d.ts +7 -0
  34. package/lib/esm/hooks/useParseRuleMarkdown.d.ts.map +1 -0
  35. package/lib/esm/hooks/useParseRuleMarkdown.js +24 -0
  36. package/lib/esm/hooks/useResetCaseCreate.d.ts.map +1 -1
  37. package/lib/esm/hooks/useResetCaseCreate.js +4 -0
  38. package/lib/esm/reducers/ClusterRecommendationsReducer.d.ts +14 -0
  39. package/lib/esm/reducers/ClusterRecommendationsReducer.d.ts.map +1 -0
  40. package/lib/esm/reducers/ClusterRecommendationsReducer.js +57 -0
  41. package/lib/esm/reducers/RouteConstNTypes.d.ts +1 -0
  42. package/lib/esm/reducers/RouteConstNTypes.d.ts.map +1 -1
  43. package/lib/esm/reducers/RouteConstNTypes.js +6 -0
  44. package/lib/esm/reducers/SessionRestoreReducer.d.ts +4 -3
  45. package/lib/esm/reducers/SessionRestoreReducer.d.ts.map +1 -1
  46. package/lib/esm/reducers/SessionRestoreReducer.js +31 -34
  47. package/lib/esm/utils/routeUtils.d.ts.map +1 -1
  48. package/lib/esm/utils/routeUtils.js +3 -0
  49. package/package.json +9 -9
@@ -1 +1 @@
1
- {"version":3,"file":"OpenShiftClusterId.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseManagement/OpenShiftClusterId.tsx"],"names":[],"mappings":"AAkBA,eAAO,MAAM,oBAAoB,mBAShC,CAAC;AAqBF,wBAAgB,kBAAkB,gBAsPjC"}
1
+ {"version":3,"file":"OpenShiftClusterId.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseManagement/OpenShiftClusterId.tsx"],"names":[],"mappings":"AAqBA,eAAO,MAAM,oBAAoB,mBAShC,CAAC;AAqBF,wBAAgB,kBAAkB,gBAgRjC"}
@@ -9,16 +9,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import ExclamationCircleIcon from '@patternfly/react-icons/dist/js/icons/exclamation-circle-icon';
11
11
  import { GlobalMetadataStateContext } from '@rh-support/react-context';
12
- import { getUrlParsedParams, getVersion } from '@rh-support/utils';
12
+ import { getConfigField, getUrlParsedParams, getVersion, PCM_CONFIG_FIELD_TYPE } from '@rh-support/utils';
13
13
  import isEmpty from 'lodash/isEmpty';
14
14
  import isEqual from 'lodash/isEqual';
15
15
  import React, { useContext, useEffect, useState } from 'react';
16
16
  import { Trans } from 'react-i18next';
17
17
  import { useLocation } from 'react-router';
18
18
  import { useCaseDispatch, useCaseSelector } from '../../context/CaseContext';
19
+ import { ClusterRecommendationsDispatchContext } from '../../context/ClusterRecommendationsContext';
19
20
  import { RouteContext } from '../../context/RouteContext';
20
21
  import { getUpdatedDescription } from '../../reducers/CaseHelpers';
21
22
  import { setCaseDetails, setCaseState } from '../../reducers/CaseReducer';
23
+ import { fetchClusterRecommendations } from '../../reducers/ClusterRecommendationsReducer';
22
24
  import { getIsClusterIdInvalid, isClusterIdEnabledForProduct } from '../../utils/caseOpenshiftClusterIdUtils';
23
25
  import { NoClusterIDReasonSelector } from './NoClusterIDReasonSelector';
24
26
  import { fetchClusterIdDetails, OpenshiftDropdownV4 } from './OpenshiftDropdownV4';
@@ -55,6 +57,7 @@ export function OpenShiftClusterId() {
55
57
  const caseDispatch = useCaseDispatch();
56
58
  const { globalMetadataState: { pcmConfig, allProducts, loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
57
59
  const { routeState: { showValidationErrorAlert }, } = useContext(RouteContext);
60
+ const clusterRecommendationsDispatch = useContext(ClusterRecommendationsDispatchContext);
58
61
  const majorVersion = (version && getVersion(version).major) || '';
59
62
  const isOpenShiftV3 = majorVersion === '3';
60
63
  const isCustomer = loggedInUserRights.data.isAccountSameAsLoggedInAccount(selectedAccountDetails.data.accountNumber);
@@ -63,6 +66,7 @@ export function OpenShiftClusterId() {
63
66
  const [v3Selected, setV3Selected] = useState(false);
64
67
  const [dontKnowSelected, setDontKnowSelected] = useState(false);
65
68
  const [selectedReason, setSelectedReason] = useState('');
69
+ const isClusterRecommendationEnabled = getConfigField(pcmConfig.data, 'isClusterRecommendationEnabled', PCM_CONFIG_FIELD_TYPE.FEATURE_FLAG);
66
70
  const resetClusterData = () => {
67
71
  clusterStateReset();
68
72
  setCaseDetails(caseDispatch, {
@@ -135,7 +139,9 @@ export function OpenShiftClusterId() {
135
139
  * we also fetch the details for the cluster id so that we can have fields like cluster version while creating the case
136
140
  */
137
141
  useEffect(() => {
138
- if (openshiftClusterID && !getIsClusterIdInvalid(openshiftClusterID) && isEmpty(openshiftClusterVersion)) {
142
+ const isClusterIdInvalid = getIsClusterIdInvalid(openshiftClusterID);
143
+ setIsClusterIdInValid(isClusterIdInvalid);
144
+ if (openshiftClusterID && !isClusterIdInvalid && isEmpty(openshiftClusterVersion)) {
139
145
  setClusterVersion(openshiftClusterID);
140
146
  }
141
147
  // when user click on back and continue button, need to show v3 text box or reasons dropdown
@@ -147,10 +153,15 @@ export function OpenShiftClusterId() {
147
153
  setDontKnowSelected(true);
148
154
  setSelectedReason('dont-have-id');
149
155
  }
156
+ const canFetchClusterRecommendation = isClusterRecommendationEnabled && !isClusterIdInvalid && !isEmpty(openshiftClusterID);
157
+ canFetchClusterRecommendation &&
158
+ fetchClusterRecommendations(clusterRecommendationsDispatch, openshiftClusterID);
150
159
  // eslint-disable-next-line react-hooks/exhaustive-deps
151
160
  }, [v3ClusterName, noClusterIdReason]);
152
161
  const onClusterIdStateUpdate = (selectedCluster) => {
153
162
  const selectedId = selectedCluster.external_id;
163
+ if (isEmpty(selectedId))
164
+ return;
154
165
  resetClusterData();
155
166
  if (selectedId === 'dont-have-id') {
156
167
  setDontKnowSelected(true);
@@ -162,8 +173,11 @@ export function OpenShiftClusterId() {
162
173
  setSelectedReason(selectedId);
163
174
  return;
164
175
  }
165
- setIsClusterIdInValid(getIsClusterIdInvalid(selectedId));
176
+ const isClusterInvalid = getIsClusterIdInvalid(selectedId);
177
+ const canFetchClusterRecommendation = !isClusterInvalid && isClusterRecommendationEnabled;
178
+ setIsClusterIdInValid(isClusterInvalid);
166
179
  setCusterId(selectedId, selectedCluster);
180
+ canFetchClusterRecommendation && fetchClusterRecommendations(clusterRecommendationsDispatch, selectedId);
167
181
  };
168
182
  const clusterIdDropdownFormInstructions = () => {
169
183
  const errorMessage = isClusterIdInvalid
@@ -176,10 +190,11 @@ export function OpenShiftClusterId() {
176
190
  };
177
191
  const onReasonExplanationInputBoxChanged = (noClusterIdReasonExplanation) => {
178
192
  if (noClusterIdReason === 'Other') {
179
- setCaseDetails(caseDispatch, { noClusterIdReasonExplanation });
193
+ setCaseDetails(caseDispatch, { noClusterIdReasonExplanation: noClusterIdReasonExplanation.trim() });
180
194
  }
181
195
  };
182
- const v3ClusterNameInputBoxChanged = (v3ClusterName) => {
196
+ const v3ClusterNameInputBoxChanged = (v3Cluster) => {
197
+ const v3ClusterName = isEmpty(v3Cluster.trim()) ? '' : v3Cluster;
183
198
  const description = getUpdatedDescription(issue, environment, periodicityOfIssue, timeFramesAndUrgency, v3ClusterName);
184
199
  setCaseState(caseDispatch, { v3ClusterName });
185
200
  setCaseDetails(caseDispatch, { description });
@@ -195,5 +210,5 @@ export function OpenShiftClusterId() {
195
210
  !isOpenShiftV3 && (React.createElement(OpenshiftDropdownV4, { openshiftClusterIDState: openshiftClusterID || selectedReason, onClusterIdStateUpdate: onClusterIdStateUpdate, isClusterIdInvalid: showValidationErrorAlert &&
196
211
  ((isEmpty(openshiftClusterID) && isEmpty(selectedReason)) || isClusterIdInvalid), clusterIdDropdownFormInstructions: clusterIdDropdownFormInstructions(), onClusterClear: resetClusterData, isV4: majorVersion === '4' })),
197
212
  dontKnowSelected && !isOpenShiftV3 && (React.createElement(NoClusterIDReasonSelector, { noClusterIdReasonExplanation: noClusterIdReasonExplanation, noClusterIdReason: noClusterIdReason, onReasonInputBoxChanged: onReasonExplanationInputBoxChanged, onReasonChange: onReasonChange, isInValid: isInVaidNoClusterIdReason, isCustomer: isCustomer })),
198
- (v3Selected || isOpenShiftV3) && (React.createElement(OpenShiftV3Inputbox, { v3ClusterName: v3ClusterName, onReasonInputBoxChanged: v3ClusterNameInputBoxChanged, isInValid: isEmpty(v3ClusterName) && showValidationErrorAlert, v3Selected: v3Selected }))));
213
+ (v3Selected || isOpenShiftV3) && (React.createElement(OpenShiftV3Inputbox, { v3ClusterName: v3ClusterName, onReasonInputBoxChanged: v3ClusterNameInputBoxChanged, isInValid: isEmpty(v3ClusterName.trim()) && showValidationErrorAlert, v3Selected: v3Selected }))));
199
214
  }
@@ -176,10 +176,10 @@ function OpenshiftDropdownV4(props) {
176
176
  }, [props.isClusterIdInvalid]);
177
177
  const onTypeaheadInputChanged = (input) => __awaiter(this, void 0, void 0, function* () {
178
178
  setInputVal(input);
179
+ props.onClusterIdStateUpdate(createState(input, input));
179
180
  const fetchedClusters = yield fetchAccountClusters(input);
180
181
  setClustersSelectOptions(getClusterOptions(fetchedClusters.items));
181
182
  setClustersRawResponse(fetchedClusters.items);
182
- props.onClusterIdStateUpdate(createState(input, input));
183
183
  });
184
184
  const getSelectedItem = () => {
185
185
  if (!isEmpty(inputVal)) {
@@ -21,7 +21,7 @@ export function AddCustomEmailToAccount(props) {
21
21
  const [isSaveButtonClicked, setIsSaveButtonClicked] = useState(false);
22
22
  const onAdd = () => __awaiter(this, void 0, void 0, function* () {
23
23
  setIsSaveButtonClicked(true);
24
- if (isEmpty(firstName))
24
+ if (isEmpty(firstName.trim()))
25
25
  return;
26
26
  try {
27
27
  yield request(props.accountNumber, props.customEmailAddress, firstName, lastName);
@@ -41,7 +41,7 @@ export function AddCustomEmailToAccount(props) {
41
41
  props.onClose && props.onClose();
42
42
  };
43
43
  return (React.createElement(Modal, { variant: ModalVariant.medium, title: t('Add a notification email to your account'), isOpen: true, onClose: handleClose, onEscapePress: handleClose, actions: [
44
- React.createElement(Button, { spinnerAriaValueText: isFetching ? t('Adding') : undefined, isLoading: isFetching, key: "confirm", variant: "primary", onClick: onAdd, isDisabled: isFetching || (isSaveButtonClicked && isEmpty(firstName)) },
44
+ React.createElement(Button, { spinnerAriaValueText: isFetching ? t('Adding') : undefined, isLoading: isFetching, key: "confirm", variant: "primary", onClick: onAdd, isDisabled: isFetching || (isSaveButtonClicked && isEmpty(firstName.trim())) },
45
45
  React.createElement(Trans, null, "Add to account")),
46
46
  React.createElement(Button, { key: "cancel", variant: "link", onClick: handleClose, isDisabled: isFetching },
47
47
  React.createElement(Trans, null, "Cancel")),
@@ -1 +1 @@
1
- {"version":3,"file":"CaseContactSelector.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseManagement/SendNotifications/CaseContactSelector.tsx"],"names":[],"mappings":"AA4CA,MAAM,WAAW,MAAM;CAAG;AAG1B,iBAAS,mBAAmB,CAAC,KAAK,EAAE,MAAM,eA4azC;AAED,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"CaseContactSelector.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseManagement/SendNotifications/CaseContactSelector.tsx"],"names":[],"mappings":"AA4CA,MAAM,WAAW,MAAM;CAAG;AAG1B,iBAAS,mBAAmB,CAAC,KAAK,EAAE,MAAM,eA8bzC;AAED,eAAe,mBAAmB,CAAC"}
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { Button } from '@patternfly/react-core';
10
+ import { Button, Tooltip, TooltipPosition } from '@patternfly/react-core';
11
11
  import { CaseContactsSelectorExternal, getHydraContactLabel, PromisifyModal, ToastNotification, usePrevious, } from '@rh-support/components';
12
12
  import { FeatureAnnouncementKeys, GlobalMetadataStateContext, NewFeatureLabel, useCanEditCase, } from '@rh-support/react-context';
13
13
  import { filter, find, map, remove } from 'lodash';
@@ -55,6 +55,7 @@ function CaseContactSelector(props) {
55
55
  const [emailToAdd, setEmailToAdd] = useState('');
56
56
  const nonOrgTypeaheadRef = useRef(null);
57
57
  const canEditCase = useCanEditCase();
58
+ const toolTipRef = useRef();
58
59
  const onCaseContactAdded = (addedUsers) => __awaiter(this, void 0, void 0, function* () {
59
60
  const addesUsersSso = map(addedUsers, (u) => ({ ssoUsername: u.ssoUsername }));
60
61
  setIsAssociatesUpdating(true);
@@ -269,11 +270,11 @@ function CaseContactSelector(props) {
269
270
  React.createElement(Button, { variant: "link", isInline: true, component: "span", onClick: onAddEmailToAccountBtnClick }, "add them at the account level"))))),
270
271
  caseNumber && showAddWatchButton() && (React.createElement(Button, { variant: "secondary", onClick: addCurrentUser, type: "button", "data-tracking-id": "case-add-me-watcher" },
271
272
  React.createElement(Trans, null, "Add me as a watcher"))),
272
- caseNumber && showRemoveWatchButton() && (React.createElement("span", { title: isCurrentUserCaseContact
273
- ? t('You are case contact and therefore you cannot be removed as watcher')
274
- : '' },
275
- React.createElement(Button, { variant: isCurrentUserCaseContact ? 'tertiary' : 'secondary', onClick: removeCurrentUser, type: "button", isDisabled: isCurrentUserCaseContact, "data-tracking-id": "case-remove-me-watcher" },
276
- React.createElement(Trans, null, "Remove me as a watcher")))))) : (React.createElement(NonOrgCaseNotifyeesSelector, { id: "open-case-notifications", placeholder: "Enter an email address or username for the person you want to notify", isDisabled: isAssociatesUpdating || customEmailsList.isFetching || isUpdatingCustomEmails, selectedItems: [
273
+ caseNumber && showRemoveWatchButton() && (React.createElement("div", { ref: toolTipRef, className: "remove-me-as-watcher pf-u-display-inline-block" }, isCurrentUserCaseContact ? (React.createElement(React.Fragment, null,
274
+ React.createElement(Tooltip, { trigger: 'mouseenter focus', reference: toolTipRef, position: TooltipPosition.top, content: React.createElement(Trans, null, "You are case contact and therefore you cannot be removed as watcher") }),
275
+ React.createElement(Button, { variant: "tertiary", onClick: removeCurrentUser, type: "button", isDisabled: true, "data-tracking-id": "case-remove-me-watcher" },
276
+ React.createElement(Trans, null, "Remove me as a watcher")))) : (React.createElement(Button, { variant: "secondary", onClick: removeCurrentUser, type: "button", "data-tracking-id": "case-remove-me-watcher" },
277
+ React.createElement(Trans, null, "Remove me as a watcher"))))))) : (React.createElement(NonOrgCaseNotifyeesSelector, { id: "open-case-notifications", placeholder: "Enter an email address or username for the person you want to notify", isDisabled: isAssociatesUpdating || customEmailsList.isFetching || isUpdatingCustomEmails, selectedItems: [
277
278
  ...customEmailsList.data,
278
279
  ...filter(selectedNotificationContacts, (c) => !c.isInternal),
279
280
  ], dataTrackingId: "non-org-admin-contact-selector", onChange: onNotifiedUserChange, isChipDisabled: !isCurrentUserCaseCreator && !!caseNumber, accountNumber: accountNumber, groupNumber: groupNumber, typeaheadRef: nonOrgTypeaheadRef, contactSsoUsername: contactSsoUsername }))));
@@ -1 +1 @@
1
- {"version":3,"file":"KtQuestions.d.ts","sourceRoot":"","sources":["../../../../src/components/ImproveCase/KtQuestions.tsx"],"names":[],"mappings":"AAiBA,UAAU,MAAM;IACZ,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AAGD,iBAAS,WAAW,CAAC,KAAK,EAAE,MAAM,eAyNjC;kBAzNQ,WAAW;;;AA2NpB,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"KtQuestions.d.ts","sourceRoot":"","sources":["../../../../src/components/ImproveCase/KtQuestions.tsx"],"names":[],"mappings":"AAiBA,UAAU,MAAM;IACZ,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AAGD,iBAAS,WAAW,CAAC,KAAK,EAAE,MAAM,eA+NjC;kBA/NQ,WAAW;;;AAiOpB,eAAe,WAAW,CAAC"}
@@ -54,23 +54,24 @@ function KtQuestions(props) {
54
54
  const onCaseDetailsChange = (caseDetails) => {
55
55
  setCaseDetails(caseDispatch, caseDetails);
56
56
  };
57
+ // Troubleshoot Page Question 3
57
58
  const onKtQ2Change = (e) => {
58
59
  var _a;
59
60
  const ktQ2Local = isEmpty((_a = e.target.value) === null || _a === void 0 ? void 0 : _a.trim()) ? '' : e.target.value;
60
61
  const newDescription = getUpdatedDescription(issue, ktQ2Local, periodicityOfIssue, timeFramesAndUrgency, v3ClusterName);
61
- onCaseDetailsChange({ timeFramesAndUrgency, environment: ktQ2Local, description: newDescription });
62
+ onCaseDetailsChange({ environment: ktQ2Local, description: newDescription });
62
63
  };
64
+ // Troubleshoot Page Question 4
63
65
  const onKtQ3Change = (e) => {
64
- var _a, _b;
66
+ var _a;
65
67
  const ktQ3Local = isEmpty((_a = e.target.value) === null || _a === void 0 ? void 0 : _a.trim()) ? '' : e.target.value;
66
- const ktQ4Local = isEmpty((_b = e.target.value) === null || _b === void 0 ? void 0 : _b.trim()) ? '' : e.target.value;
67
68
  const newDescription = getUpdatedDescription(issue, environment, ktQ3Local, timeFramesAndUrgency, v3ClusterName);
68
69
  onCaseDetailsChange({
69
- timeFramesAndUrgency: ktQ4Local,
70
- periodicityOfIssue,
70
+ periodicityOfIssue: ktQ3Local,
71
71
  description: newDescription,
72
72
  });
73
73
  };
74
+ // Troubleshoot Page Question 2
74
75
  const onKtQ4Change = (e) => {
75
76
  var _a;
76
77
  const ktQ4Local = isEmpty((_a = e.target.value) === null || _a === void 0 ? void 0 : _a.trim()) ? '' : e.target.value;
@@ -0,0 +1,7 @@
1
+ import { IClusterRecommendation } from '@cee-eng/hydrajs/@types/api/pcm/preCaseDiagnostics';
2
+ interface IProps {
3
+ clusterRecommendations: IClusterRecommendation[];
4
+ }
5
+ export declare function ClusterRecommendationItems(props: IProps): JSX.Element;
6
+ export {};
7
+ //# sourceMappingURL=ClusterRecommendationItems.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,40 @@
1
+ import { pcm } from '@cee-eng/hydrajs';
2
+ import { Label } from '@patternfly/react-core';
3
+ import isEqual from 'lodash/isEqual';
4
+ import React, { useContext } from 'react';
5
+ import { Trans } from 'react-i18next';
6
+ import { useCaseSelector } from '../../context/CaseContext';
7
+ import { SessionRestoreDispatchContext, SessionRestoreStateContext } from '../../context/SessionRestoreContext';
8
+ import { useParseRuleMarkdown } from '../../hooks/useParseRuleMarkdown';
9
+ import { createOrUpdateSessionResources, getSessResFromInsights } from '../../reducers/SessionRestoreReducer';
10
+ import { riskLabels } from '../shared/Constants';
11
+ export function ClusterRecommendationItems(props) {
12
+ const sessionRestoreDispatch = useContext(SessionRestoreDispatchContext);
13
+ const { sessionRestore: { activeSessionId, sessionResourceTracking }, } = useContext(SessionRestoreStateContext);
14
+ const { SessionResourceSource, SessionResourceVisibility } = pcm.preCase.session;
15
+ const { version, product } = useCaseSelector((state) => ({
16
+ version: state.caseDetails.version,
17
+ product: state.caseDetails.product,
18
+ }), isEqual);
19
+ const { parse } = useParseRuleMarkdown();
20
+ const onResourceClick = (e, rule) => {
21
+ if (e.target.tagName.toLowerCase() === 'a') {
22
+ const url = e.target.href.split('?')[0];
23
+ createOrUpdateSessionResources(sessionRestoreDispatch, activeSessionId, sessionResourceTracking, SessionResourceSource.CLUSTER_RECOMMENDATION, [getSessResFromInsights(url, SessionResourceVisibility.VISITED, rule.rule_id)], JSON.stringify({ product, version }));
24
+ }
25
+ };
26
+ return (React.createElement("pfe-accordion", null, props.clusterRecommendations.map((rule) => (React.createElement(React.Fragment, null,
27
+ React.createElement("pfe-accordion-header", null,
28
+ React.createElement("h3", null, rule.description)),
29
+ React.createElement("pfe-accordion-panel", null,
30
+ React.createElement("p", null,
31
+ React.createElement(Label, { color: riskLabels[rule.total_risk].color },
32
+ React.createElement(Trans, null, riskLabels[rule.total_risk].label))),
33
+ React.createElement("p", null, rule.details || ''),
34
+ rule.reason && (React.createElement(React.Fragment, null,
35
+ React.createElement("h3", { className: "subheading subheading-sm" }, "Reason: "),
36
+ React.createElement("p", { onClick: (e) => onResourceClick(e, rule), dangerouslySetInnerHTML: parse(rule.reason, rule.extra_data, SessionResourceSource.CLUSTER_RECOMMENDATION, 'cluster-recommendation', 'cluster-recommendation') }))),
37
+ rule.resolution && (React.createElement(React.Fragment, null,
38
+ React.createElement("h3", { className: "subheading subheading-sm" }, "Resolution: "),
39
+ React.createElement("p", { onClick: (e) => onResourceClick(e, rule), dangerouslySetInnerHTML: parse(rule.resolution, rule.extra_data, SessionResourceSource.CLUSTER_RECOMMENDATION, 'cluster-recommendation', 'cluster-recommendation') })))))))));
40
+ }
@@ -0,0 +1,2 @@
1
+ export default function ClusteRecommendations(): JSX.Element;
2
+ //# sourceMappingURL=ClusterRecommendations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClusterRecommendations.d.ts","sourceRoot":"","sources":["../../../../src/components/Recommendations/ClusterRecommendations.tsx"],"names":[],"mappings":"AAQA,MAAM,CAAC,OAAO,UAAU,qBAAqB,gBAkC5C"}
@@ -0,0 +1,24 @@
1
+ import { Button } from '@patternfly/react-core';
2
+ import React, { useContext, useState } from 'react';
3
+ import { Trans } from 'react-i18next';
4
+ import { ClusterRecommendationsContext } from '../../context/ClusterRecommendationsContext';
5
+ import { ClusterRecommendationItems } from './ClusterRecommendationItems';
6
+ import { ClusterRecommendationsModal } from './ClusterRecommendationsModal';
7
+ export default function ClusteRecommendations() {
8
+ const { clusterRecommendations } = useContext(ClusterRecommendationsContext);
9
+ const [showModal, setShowModal] = useState(false);
10
+ const NUMBER_OF_RULES_TO_DISPLAY = 3;
11
+ const onModalClose = () => {
12
+ setShowModal(false);
13
+ };
14
+ if (clusterRecommendations.data.length === 0 || clusterRecommendations.isError || clusterRecommendations.isFetching)
15
+ return React.createElement(React.Fragment, null);
16
+ return (React.createElement("div", { className: "card card-white card-support top-recommendations" },
17
+ React.createElement("h3", { className: "card-heading" },
18
+ React.createElement(Trans, null, "Cluster recommendations")),
19
+ React.createElement("div", null,
20
+ React.createElement(ClusterRecommendationItems, { clusterRecommendations: clusterRecommendations.data.slice(0, NUMBER_OF_RULES_TO_DISPLAY) }),
21
+ clusterRecommendations.data.length > NUMBER_OF_RULES_TO_DISPLAY && (React.createElement(Button, { className: "pf-u-p-md", variant: "link", isBlock: true, onClick: () => setShowModal(true) },
22
+ React.createElement(Trans, null, "View more recommendations"))),
23
+ React.createElement(ClusterRecommendationsModal, { clusterRecommendations: clusterRecommendations.data, isOpen: showModal, onModalClose: onModalClose }))));
24
+ }
@@ -0,0 +1,9 @@
1
+ import { IClusterRecommendation } from '@cee-eng/hydrajs/@types/api/pcm/preCaseDiagnostics';
2
+ interface IProps {
3
+ clusterRecommendations: IClusterRecommendation[];
4
+ isOpen: boolean;
5
+ onModalClose: () => void;
6
+ }
7
+ export declare function ClusterRecommendationsModal(props: IProps): JSX.Element;
8
+ export {};
9
+ //# sourceMappingURL=ClusterRecommendationsModal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClusterRecommendationsModal.d.ts","sourceRoot":"","sources":["../../../../src/components/Recommendations/ClusterRecommendationsModal.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oDAAoD,CAAC;AAU5F,UAAU,MAAM;IACZ,sBAAsB,EAAE,sBAAsB,EAAE,CAAC;IACjD,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,MAAM,IAAI,CAAC;CAC5B;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,eAkExD"}
@@ -0,0 +1,48 @@
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 { pcm } from '@cee-eng/hydrajs';
11
+ import { Button, Modal } from '@patternfly/react-core';
12
+ import { useFetch } from '@rh-support/components';
13
+ import React, { useContext, useState } from 'react';
14
+ import { useTranslation } from 'react-i18next';
15
+ import { SessionRestoreStateContext } from '../../context/SessionRestoreContext';
16
+ import { ClusterRecommendationItems } from './ClusterRecommendationItems';
17
+ import { RecommendationFeedbackModal } from './RecommendationFeedbackModal';
18
+ export function ClusterRecommendationsModal(props) {
19
+ const { t } = useTranslation();
20
+ const { sessionRestore: { activeSessionId, sessionResourceTracking }, } = useContext(SessionRestoreStateContext);
21
+ const { request: resolveSessionRequest, isFetching } = useFetch(pcm.preCase.session.resolveSession);
22
+ const { SessionResourceSource } = pcm.preCase.session;
23
+ const [isModalVisible, setIsModalVisible] = useState(false);
24
+ const handleSolvedIssue = () => __awaiter(this, void 0, void 0, function* () {
25
+ var _a, _b;
26
+ try {
27
+ yield resolveSessionRequest(activeSessionId, {
28
+ sessionId: activeSessionId,
29
+ sessionResourceOriginId: (_b = (_a = sessionResourceTracking[SessionResourceSource.CLUSTER_RECOMMENDATION]) === null || _a === void 0 ? void 0 : _a.resourceOriginId) !== null && _b !== void 0 ? _b : '',
30
+ type: SessionResourceSource.CLUSTER_RECOMMENDATION,
31
+ url: '',
32
+ });
33
+ setIsModalVisible(true);
34
+ props.onModalClose();
35
+ }
36
+ catch (e) { }
37
+ });
38
+ const onModalToggle = () => {
39
+ setIsModalVisible((visible) => !visible);
40
+ };
41
+ return (React.createElement(React.Fragment, null,
42
+ React.createElement(RecommendationFeedbackModal, { isModalOpen: isModalVisible, handleModalToggle: onModalToggle, modalContent: t(`Great, we're glad that resolved your issue`) }),
43
+ React.createElement(Modal, { className: "critical-solutions-modal", title: t('Cluster recommendations'), description: t('Recommendations have been triggered for your cluster.'), "data-tracking-id": "cluster-recommendations-modal-body", onClose: props.onModalClose, isOpen: props.isOpen, actions: [
44
+ React.createElement(Button, { isDisabled: isFetching, isLoading: isFetching, onClick: handleSolvedIssue, key: "solved-my-issue", variant: "primary", "data-tracking-id": "cluster-recommendations-solutions-modal" }, t('I solved my issue')),
45
+ React.createElement(Button, { onClick: props.onModalClose, key: "confirm", variant: "secondary", "data-tracking-id": "cancel-cluster-recommendations-modal" }, t('Cancel')),
46
+ ] },
47
+ React.createElement(ClusterRecommendationItems, { clusterRecommendations: props.clusterRecommendations }))));
48
+ }
@@ -81,7 +81,7 @@ export function InsightResultModal(props) {
81
81
  React.createElement(Button, { isDisabled: isFetching, isLoading: isFetching, onClick: handleSolvedIssue, key: "solved-my-issue", variant: "primary", "data-tracking-id": "solved-my-issue-critical-solutions-modal" }, t('I solved my issue')),
82
82
  React.createElement(Button, { onClick: props.onModalToggle, key: "confirm", variant: "secondary", "data-tracking-id": "cancel-critical-solutions-modal" }, t('Cancel')),
83
83
  ] },
84
- React.createElement(Accordion, { className: "push-top-narrow pf-m-bordered", headingLevel: "h2", asDefinitionList: false },
84
+ React.createElement(Accordion, { className: "push-top-narrow", headingLevel: "h2", asDefinitionList: false },
85
85
  props.insightResults.map((doc) => (React.createElement(InsightsRuleInfo, { duplicateKeys: duplicateKeys, showNewTag: canShowNewTag, key: doc.id + doc.attachmentId, doc: doc }))),
86
86
  props.EARule.length > 0 &&
87
87
  props.EARule.map((rule, index) => (React.createElement(EARuleInfoAccordion, { showNewTag: canShowNewTag, key: `${index}_eaRule`, rule: rule })))))));
@@ -1 +1 @@
1
- {"version":3,"file":"SessionRestore.d.ts","sourceRoot":"","sources":["../../../../src/components/SessionRestore/SessionRestore.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAQvD,OAAO,EAGH,eAAe,EAElB,MAAM,iCAAiC,CAAC;AAgBzC,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;CACpD;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,eAqU3C"}
1
+ {"version":3,"file":"SessionRestore.d.ts","sourceRoot":"","sources":["../../../../src/components/SessionRestore/SessionRestore.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAQvD,OAAO,EAGH,eAAe,EAElB,MAAM,iCAAiC,CAAC;AAgBzC,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;CACpD;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,eAmU3C"}
@@ -88,10 +88,10 @@ export function SessionRestore(props) {
88
88
  }
89
89
  else if (!isEmpty(relevantSession)) {
90
90
  // Checking if session needs to be restored based on found relevant session
91
- if (currentRelevantSession === currentUrlSeSessionId ||
92
- currentRelevantSession === sessionRestore.activeSessionId)
93
- return;
94
- !isRestoring && restoreSession(relevantSession, true);
91
+ // Found relevent session is not same as activeSessionId and is not being restored
92
+ if (currentRelevantSession !== sessionRestore.activeSessionId && !isRestoring) {
93
+ restoreSession(relevantSession, true);
94
+ }
95
95
  }
96
96
  else if (isEmpty(relevantSession) && !isEmpty(currentUrlSeSessionId)) {
97
97
  updateActiveSessionId(sessionRestoreDispatch, undefined);
@@ -50,4 +50,22 @@ export declare const preferredSSModalOpenPendoEvent = "PCM-Next > Preferred-secu
50
50
  export declare const recsViewedFromNoAttachmentModalEvent = "PCM-Next > No-Attachment-modal-view-recommendations";
51
51
  export declare const markdownInlineFileSelectEvent = "PCM-Next > Markdown-toolbar-file-select";
52
52
  export declare const markdownFilePasteEvent = "PCM-Next > Markdown-toolbar-file-paste";
53
+ export declare const riskLabels: {
54
+ 1: {
55
+ label: string;
56
+ color: string;
57
+ };
58
+ 2: {
59
+ label: string;
60
+ color: string;
61
+ };
62
+ 3: {
63
+ label: string;
64
+ color: string;
65
+ };
66
+ 4: {
67
+ label: string;
68
+ color: string;
69
+ };
70
+ };
53
71
  //# sourceMappingURL=Constants.d.ts.map
@@ -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"}
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"}
@@ -50,3 +50,9 @@ export const preferredSSModalOpenPendoEvent = 'PCM-Next > Preferred-secured-supp
50
50
  export const recsViewedFromNoAttachmentModalEvent = 'PCM-Next > No-Attachment-modal-view-recommendations';
51
51
  export const markdownInlineFileSelectEvent = 'PCM-Next > Markdown-toolbar-file-select';
52
52
  export const markdownFilePasteEvent = 'PCM-Next > Markdown-toolbar-file-paste';
53
+ 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' },
58
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"GlobalTroubleshootEffects.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/GlobalTroubleshootEffects.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAUvD,OAAO,EAAqB,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAOrF,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;CACpD;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,eAoWtD"}
1
+ {"version":3,"file":"GlobalTroubleshootEffects.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/GlobalTroubleshootEffects.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAWvD,OAAO,EAAqB,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAOrF,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;CACpD;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,eAgXtD"}
@@ -19,6 +19,7 @@ import React, { useContext, useEffect, useRef, useState } from 'react';
19
19
  import { useCaseDispatch, useCaseSelector } from '../../context/CaseContext';
20
20
  import { RouteContext, RouteDispatchContext } from '../../context/RouteContext';
21
21
  import { RulesDispatchContext } from '../../context/RulesContext';
22
+ import { SessionRestoreStateContext } from '../../context/SessionRestoreContext';
22
23
  import { TCDispatchContext, TCStateContext } from '../../context/TopContentContext';
23
24
  import { useResetCaseCreate } from '../../hooks/useResetCaseCreate';
24
25
  import { initialCaseState } from '../../reducers/CaseConstNTypes';
@@ -34,6 +35,7 @@ export function GlobalTroubleshootEffects(props) {
34
35
  const dispatchToRouteReducer = useContext(RouteDispatchContext);
35
36
  const { routeState: { activeSection, appRouteSectionsSequence, appRouteConfugurations, sectionsToHide }, } = useContext(RouteContext);
36
37
  const { globalMetadataState: { allProducts, loggedInUser, managedAccounts, loggedInUserRights, loggedInUsersAccount }, } = useContext(GlobalMetadataStateContext);
38
+ const { sessionRestore: { activeSessionId }, } = useContext(SessionRestoreStateContext);
37
39
  const { accountNumber, product, version, contactSsoUsername, summary, issue, environment, periodicityOfIssue, timeFramesAndUrgency, caseType, language, selectedAccountDetails, } = useCaseSelector((state) => ({
38
40
  accountNumber: state.caseDetails.accountNumberRef,
39
41
  product: state.caseDetails.product,
@@ -275,12 +277,17 @@ export function GlobalTroubleshootEffects(props) {
275
277
  // eslint-disable-next-line react-hooks/exhaustive-deps
276
278
  }, [loggedInUsersAccount.data]);
277
279
  /**
278
- * When user change product/version need to reset clusterID states
280
+ * When user change version (on product component page or preview page) need to reset clusterID states
281
+ * If version change happens because od session restore, need to skip this otherwise restored value will be reset
279
282
  */
280
283
  const previousVersion = usePrevious(version);
284
+ const previousActiveSessionId = usePrevious(activeSessionId);
281
285
  useEffect(() => {
282
286
  var _a;
283
- if (isEmpty(product) || isEmpty(version))
287
+ if (isEmpty(product) ||
288
+ isEmpty(version) ||
289
+ isEmpty(previousVersion) ||
290
+ activeSessionId !== previousActiveSessionId)
284
291
  return;
285
292
  // we need to reset openshift cluster states only when major version is different
286
293
  const oldMajorVersion = previousVersion && getVersion(previousVersion).major;
@@ -1 +1 @@
1
- {"version":3,"file":"WizardAside.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/WizardAside.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAKnD,OAAO,EAEH,eAAe,EAElB,MAAM,iCAAiC,CAAC;AAOzC,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;IACjD,2BAA2B,EAAE,OAAO,CAAC;CACxC;AAGD,iBAAS,WAAW,CAAC,KAAK,EAAE,MAAM,eA2CjC;kBA3CQ,WAAW;;;AA6CpB,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"WizardAside.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/WizardAside.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAKnD,OAAO,EAEH,eAAe,EAGlB,MAAM,iCAAiC,CAAC;AAQzC,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;IACjD,2BAA2B,EAAE,OAAO,CAAC;CACxC;AAGD,iBAAS,WAAW,CAAC,KAAK,EAAE,MAAM,eA6CjC;kBA7CQ,WAAW;;;AA+CpB,eAAe,WAAW,CAAC"}
@@ -5,9 +5,10 @@ import React, { useContext } from 'react';
5
5
  import { useCaseSelector } from '../../context/CaseContext';
6
6
  import { RouteContext } from '../../context/RouteContext';
7
7
  import { SessionRestoreStateContext } from '../../context/SessionRestoreContext';
8
- import { hideFileUploadSidebarWidgetSections, showSideBarEARuleWidgetSections, } from '../../reducers/RouteConstNTypes';
8
+ import { hideFileUploadSidebarWidgetSections, showSideBarClusterIdRuleWidgetSections, showSideBarEARuleWidgetSections, } from '../../reducers/RouteConstNTypes';
9
9
  import { FileDiag } from '../CaseInformation/FileDiag';
10
10
  import { AsideResults } from '../Recommendations/AsideResults';
11
+ import ClusterRecommendations from '../Recommendations/ClusterRecommendations';
11
12
  import { EARuleWidget } from '../Recommendations/EARules/EARuleWidget';
12
13
  import InsightsResults from '../Recommendations/InsightsResults';
13
14
  import { SessionRestore } from '../SessionRestore';
@@ -27,6 +28,7 @@ function WizardAside(props) {
27
28
  (!isEmpty(product) || !isEmpty(summary)) &&
28
29
  (!canUseSessionManagement || !isEmpty(activeSessionId));
29
30
  const canshowEARuleWidget = showSideBarEARuleWidgetSections.includes(activeSection);
31
+ const canShowClusterIdWidgets = showSideBarClusterIdRuleWidgetSections.includes(activeSection);
30
32
  const { sessionRestore: { activeSessionId }, } = useContext(SessionRestoreStateContext);
31
33
  if (appRouteConfugurations[activeSection].hideAside) {
32
34
  return null;
@@ -34,6 +36,7 @@ function WizardAside(props) {
34
36
  return (React.createElement("aside", { className: "grid-aside" },
35
37
  React.createElement("section", { className: "grid-aside-content" },
36
38
  canshowEARuleWidget && React.createElement(EARuleWidget, null),
39
+ canShowClusterIdWidgets && React.createElement(ClusterRecommendations, null),
37
40
  React.createElement(InsightsResults, null),
38
41
  canUseSessionManagement && React.createElement(SessionRestore, { routeProps: props.routeProps }),
39
42
  React.createElement(AsideResults, null),
@@ -0,0 +1,13 @@
1
+ import { IClusterRecommendation } from '@cee-eng/hydrajs/@types/api/pcm/preCaseDiagnostics';
2
+ import { IApiResponseDetails } from '@rh-support/types/shared';
3
+ import React from 'react';
4
+ import { ClusterRecommendationsDispatchType } from '../reducers/ClusterRecommendationsReducer';
5
+ export interface IRulesStateContext {
6
+ clusterRecommendations: IApiResponseDetails<IClusterRecommendation[]>;
7
+ }
8
+ export declare const ClusterRecommendationsContext: React.Context<IRulesStateContext>;
9
+ export declare const ClusterRecommendationsDispatchContext: React.Context<ClusterRecommendationsDispatchType>;
10
+ export declare function ClusterRecommendationsContextProvider({ children }: {
11
+ children: any;
12
+ }): JSX.Element;
13
+ //# sourceMappingURL=ClusterRecommendationsContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClusterRecommendationsContext.d.ts","sourceRoot":"","sources":["../../../src/context/ClusterRecommendationsContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oDAAoD,CAAC;AAC5F,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,EACH,kCAAkC,EAGrC,MAAM,2CAA2C,CAAC;AAEnD,MAAM,WAAW,kBAAkB;IAC/B,sBAAsB,EAAE,mBAAmB,CAAC,sBAAsB,EAAE,CAAC,CAAC;CACzE;AAMD,eAAO,MAAM,6BAA6B,mCAAoD,CAAC;AAC/F,eAAO,MAAM,qCAAqC,mDAA6C,CAAC;AAEhG,wBAAgB,qCAAqC,CAAC,EAAE,QAAQ,EAAE;;CAAA,eAUjE"}
@@ -0,0 +1,13 @@
1
+ import React, { useReducer } from 'react';
2
+ import { clusterRecommendationsReducer, initialClusterRecommendations, } from '../reducers/ClusterRecommendationsReducer';
3
+ const initialClusterIdStateContext = {
4
+ clusterRecommendations: initialClusterRecommendations,
5
+ };
6
+ const initalDispatchContext = null;
7
+ export const ClusterRecommendationsContext = React.createContext(initialClusterIdStateContext);
8
+ export const ClusterRecommendationsDispatchContext = React.createContext(initalDispatchContext);
9
+ export function ClusterRecommendationsContextProvider({ children }) {
10
+ const [clusterRecommendations, dispatch] = useReducer(clusterRecommendationsReducer, initialClusterRecommendations);
11
+ return (React.createElement(ClusterRecommendationsContext.Provider, { value: { clusterRecommendations } },
12
+ React.createElement(ClusterRecommendationsDispatchContext.Provider, { value: dispatch }, children)));
13
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"RootTroubleshootProvider.d.ts","sourceRoot":"","sources":["../../../src/context/RootTroubleshootProvider.tsx"],"names":[],"mappings":"AAWA,UAAU,MAAM;IACZ,QAAQ,EAAE,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;CACzC;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,eAkBrD"}
1
+ {"version":3,"file":"RootTroubleshootProvider.d.ts","sourceRoot":"","sources":["../../../src/context/RootTroubleshootProvider.tsx"],"names":[],"mappings":"AAYA,UAAU,MAAM;IACZ,QAAQ,EAAE,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;CACzC;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,eAoBrD"}
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { AttachmentContextProvider } from '../components/shared/fileUpload/reducer/AttachmentReducerContext';
3
3
  import { AppMetadataContextProvider } from './AppMetadataContext';
4
4
  import { CaseContextProvider } from './CaseContext';
5
+ import { ClusterRecommendationsContextProvider } from './ClusterRecommendationsContext';
5
6
  import { RecommendationContextProvider } from './RecommendationContext';
6
7
  import { RouteContextProvider } from './RouteContext';
7
8
  import { RulesContextProvider } from './RulesContext';
@@ -14,6 +15,7 @@ export function RootTroubleshootProvider(props) {
14
15
  React.createElement(RecommendationContextProvider, null,
15
16
  React.createElement(AttachmentContextProvider, null,
16
17
  React.createElement(RulesContextProvider, null,
17
- React.createElement(TCContextProvider, null,
18
- React.createElement(SessionRestoreContextProvider, null, props.children)))))))));
18
+ React.createElement(ClusterRecommendationsContextProvider, null,
19
+ React.createElement(TCContextProvider, null,
20
+ React.createElement(SessionRestoreContextProvider, null, props.children))))))))));
19
21
  }
@@ -0,0 +1,7 @@
1
+ import { SessionResourceSource } from '@cee-eng/hydrajs/@types/api/pcm/troubleshootSession';
2
+ export declare const useParseRuleMarkdown: () => {
3
+ parse: (dotString: string, reportDetails: any, source: SessionResourceSource, trackingClassName: string, trackingId: string) => {
4
+ __html: string;
5
+ };
6
+ };
7
+ //# sourceMappingURL=useParseRuleMarkdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useParseRuleMarkdown.d.ts","sourceRoot":"","sources":["../../../src/hooks/useParseRuleMarkdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qDAAqD,CAAC;AAQ5F,eAAO,MAAM,oBAAoB;uBAed,MAAM,8BAET,qBAAqB,qBACV,MAAM,cACb,MAAM;;;CAmBzB,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { markdownToHTML } from '@cee-eng/ui-toolkit';
2
+ import { parseDotTemplate } from '@rh-support/utils';
3
+ import { useContext } from 'react';
4
+ import { SessionRestoreStateContext } from '../context/SessionRestoreContext';
5
+ import RouteUtils from '../utils/routeUtils';
6
+ export const useParseRuleMarkdown = () => {
7
+ const { sessionRestore: { activeSessionId, sessionResourceTracking }, } = useContext(SessionRestoreStateContext);
8
+ const getTrackingQueryParams = (source) => {
9
+ var _a, _b;
10
+ return RouteUtils.getSEResourceQueryParams(activeSessionId, (_b = (_a = sessionResourceTracking[source]) === null || _a === void 0 ? void 0 : _a.resourceOriginId) !== null && _b !== void 0 ? _b : '', source, 'se');
11
+ };
12
+ function parse(dotString, reportDetails, source, trackingClassName, trackingId) {
13
+ const markdown = parseDotTemplate(dotString, reportDetails);
14
+ const anchorHrefRegex = /href="(.*?)"/g;
15
+ return {
16
+ __html: markdownToHTML(markdown, {
17
+ openLinksInNewTab: true,
18
+ })
19
+ .replace(anchorHrefRegex, `href="$1?${getTrackingQueryParams(source)}"`)
20
+ .replace('target="blank"', `target="blank" class="se-recommended ts-${trackingClassName} data-tracking-id="se-${trackingId}-rule"`),
21
+ };
22
+ }
23
+ return { parse };
24
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"useResetCaseCreate.d.ts","sourceRoot":"","sources":["../../../src/hooks/useResetCaseCreate.tsx"],"names":[],"mappings":"AAoBA,wBAAgB,kBAAkB;;EAoCjC"}
1
+ {"version":3,"file":"useResetCaseCreate.d.ts","sourceRoot":"","sources":["../../../src/hooks/useResetCaseCreate.tsx"],"names":[],"mappings":"AAsBA,wBAAgB,kBAAkB;;EAsCjC"}
@@ -2,12 +2,14 @@ import { fetchLoggedInUsersAccount, GlobalMetadataDispatchContext, GlobalMetadat
2
2
  import { useContext } from 'react';
3
3
  import { AttachmentDispatchContext, resetAttachment } from '../components/shared/fileUpload';
4
4
  import { useCaseDispatch } from '../context/CaseContext';
5
+ import { ClusterRecommendationsDispatchContext } from '../context/ClusterRecommendationsContext';
5
6
  import { useRecommendationDispatchContext } from '../context/RecommendationContext';
6
7
  import { RouteDispatchContext } from '../context/RouteContext';
7
8
  import { RulesDispatchContext } from '../context/RulesContext';
8
9
  import { TCDispatchContext } from '../context/TopContentContext';
9
10
  import { CaseReducerConstants } from '../reducers/CaseConstNTypes';
10
11
  import { setCaseAccountNumber, setCaseOwner } from '../reducers/CaseReducer';
12
+ import { resetClusterRecommendations } from '../reducers/ClusterRecommendationsReducer';
11
13
  import { resetRecommendations } from '../reducers/RecommendationsReducer';
12
14
  import { RouteReducerConstants } from '../reducers/RouteReducer';
13
15
  import { resetEARules } from '../reducers/RulesReducer';
@@ -20,6 +22,7 @@ export function useResetCaseCreate() {
20
22
  const dispatchToGlobalMetadataReducer = useContext(GlobalMetadataDispatchContext);
21
23
  const dispatchToRouteReducer = useContext(RouteDispatchContext);
22
24
  const rulesDispatch = useContext(RulesDispatchContext);
25
+ const clusterRecommendationsDispatch = useContext(ClusterRecommendationsDispatchContext);
23
26
  const { globalMetadataState: { loggedInUsersAccount, loggedInUserRights, loggedInUserJwtToken }, } = useContext(GlobalMetadataStateContext);
24
27
  const resetCaseCreateState = () => {
25
28
  resetAttachment(dispatchToAttachmentReducer);
@@ -33,6 +36,7 @@ export function useResetCaseCreate() {
33
36
  setCaseOwner(caseDispatch, loggedInUserRights.data.getHydraContactFromLoggedInUser(), '', undefined, undefined, true);
34
37
  dispatchToRouteReducer({ type: RouteReducerConstants.resetRouteState });
35
38
  resetEARules(rulesDispatch);
39
+ resetClusterRecommendations(clusterRecommendationsDispatch);
36
40
  };
37
41
  return {
38
42
  resetCaseCreateState,
@@ -0,0 +1,14 @@
1
+ import { IClusterRecommendation } from '@cee-eng/hydrajs/@types/api/pcm/preCaseDiagnostics';
2
+ import { IAction, IApiResponseDetails } from '@rh-support/types/shared';
3
+ export declare enum RulesReducerConstants {
4
+ requestClusterRecommendations = "requestClusterRecommendations",
5
+ resetClusterRecommendations = "resetClusterRecommendations"
6
+ }
7
+ declare type IActionType = IAction<RulesReducerConstants, IApiResponseDetails<IClusterRecommendation[]>>;
8
+ export declare type ClusterRecommendationsDispatchType = (value: IActionType) => void;
9
+ export declare const initialClusterRecommendations: IApiResponseDetails<IClusterRecommendation[]>;
10
+ export declare const clusterRecommendationsReducer: (state: IApiResponseDetails<IClusterRecommendation[]>, action: IActionType) => IApiResponseDetails<IClusterRecommendation[]>;
11
+ export declare const resetClusterRecommendations: (dispatch: ClusterRecommendationsDispatchType) => void;
12
+ export declare const fetchClusterRecommendations: (dispatch: ClusterRecommendationsDispatchType, clusterId: string) => Promise<void>;
13
+ export {};
14
+ //# sourceMappingURL=ClusterRecommendationsReducer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClusterRecommendationsReducer.d.ts","sourceRoot":"","sources":["../../../src/reducers/ClusterRecommendationsReducer.ts"],"names":[],"mappings":"AACA,OAAO,EACH,sBAAsB,EAEzB,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAGxE,oBAAY,qBAAqB;IAC7B,6BAA6B,kCAAkC;IAC/D,2BAA2B,gCAAgC;CAC9D;AAED,aAAK,WAAW,GAAG,OAAO,CAAC,qBAAqB,EAAE,mBAAmB,CAAC,sBAAsB,EAAE,CAAC,CAAC,CAAC;AACjG,oBAAY,kCAAkC,GAAG,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;AAE9E,eAAO,MAAM,6BAA6B,EAAE,mBAAmB,CAAC,sBAAsB,EAAE,CAA4B,CAAC;AAErH,eAAO,MAAM,6BAA6B,UAC/B,oBAAoB,sBAAsB,EAAE,CAAC,0BAErD,oBAAoB,sBAAsB,EAAE,CAa9C,CAAC;AAGF,eAAO,MAAM,2BAA2B,aAAc,kCAAkC,SAEvF,CAAC;AACF,eAAO,MAAM,2BAA2B,aAAoB,kCAAkC,aAAa,MAAM,kBAuBhH,CAAC"}
@@ -0,0 +1,57 @@
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 { pcm } from '@cee-eng/hydrajs';
11
+ import { getApiResourceObject } from '@rh-support/utils';
12
+ export var RulesReducerConstants;
13
+ (function (RulesReducerConstants) {
14
+ RulesReducerConstants["requestClusterRecommendations"] = "requestClusterRecommendations";
15
+ RulesReducerConstants["resetClusterRecommendations"] = "resetClusterRecommendations";
16
+ })(RulesReducerConstants || (RulesReducerConstants = {}));
17
+ export const initialClusterRecommendations = getApiResourceObject([]);
18
+ export const clusterRecommendationsReducer = (state, action) => {
19
+ switch (action.type) {
20
+ case RulesReducerConstants.requestClusterRecommendations: {
21
+ return Object.assign(Object.assign({}, state), action.payload);
22
+ }
23
+ // used for reseting the rules when reseting on a new troubleshoot issue.
24
+ case RulesReducerConstants.resetClusterRecommendations: {
25
+ return Object.assign({}, initialClusterRecommendations);
26
+ }
27
+ default: {
28
+ return state;
29
+ }
30
+ }
31
+ };
32
+ // Actions
33
+ export const resetClusterRecommendations = (dispatch) => {
34
+ dispatch({ type: RulesReducerConstants.resetClusterRecommendations });
35
+ };
36
+ export const fetchClusterRecommendations = (dispatch, clusterId) => __awaiter(void 0, void 0, void 0, function* () {
37
+ var _a;
38
+ dispatch({
39
+ type: RulesReducerConstants.requestClusterRecommendations,
40
+ payload: getApiResourceObject([], true),
41
+ });
42
+ try {
43
+ const clusterInsight = yield pcm.preCase.diag.getClusterRecommendations(clusterId);
44
+ const rules = ((_a = clusterInsight === null || clusterInsight === void 0 ? void 0 : clusterInsight.report) === null || _a === void 0 ? void 0 : _a.data) || [];
45
+ dispatch({
46
+ type: RulesReducerConstants.requestClusterRecommendations,
47
+ payload: getApiResourceObject(rules),
48
+ });
49
+ }
50
+ catch (e) {
51
+ console.log(e.message);
52
+ dispatch({
53
+ type: RulesReducerConstants.requestClusterRecommendations,
54
+ payload: getApiResourceObject([], false, true, e.message),
55
+ });
56
+ }
57
+ });
@@ -21,4 +21,5 @@ export declare const sessionRestoreCardSections: AppRouteSections[];
21
21
  export declare const hideFileUploadSidebarWidgetSections: AppRouteSections[];
22
22
  export declare const showSidebarRecommendationsSections: AppRouteSections[];
23
23
  export declare const showSideBarEARuleWidgetSections: AppRouteSections[];
24
+ export declare const showSideBarClusterIdRuleWidgetSections: AppRouteSections[];
24
25
  //# sourceMappingURL=RouteConstNTypes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RouteConstNTypes.d.ts","sourceRoot":"","sources":["../../../src/reducers/RouteConstNTypes.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IAIrB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AACD,MAAM,WAAW,eAAe;CAAG;AACnC,oBAAY,gBAAgB;IACxB,SAAS,cAAc;IACvB,gBAAgB,mBAAmB;IACnC,eAAe,oBAAoB;IACnC,gBAAgB,qBAAqB;IACrC,QAAQ,oBAAoB;IAC5B,MAAM,WAAW;IACjB,WAAW,gBAAgB;CAC9B;AAED,eAAO,MAAM,0BAA0B,oBAItC,CAAC;AACF,eAAO,MAAM,mCAAmC,oBAAoE,CAAC;AACrH,eAAO,MAAM,kCAAkC,oBAK9C,CAAC;AAEF,eAAO,MAAM,+BAA+B,oBAI3C,CAAC"}
1
+ {"version":3,"file":"RouteConstNTypes.d.ts","sourceRoot":"","sources":["../../../src/reducers/RouteConstNTypes.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IAIrB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AACD,MAAM,WAAW,eAAe;CAAG;AACnC,oBAAY,gBAAgB;IACxB,SAAS,cAAc;IACvB,gBAAgB,mBAAmB;IACnC,eAAe,oBAAoB;IACnC,gBAAgB,qBAAqB;IACrC,QAAQ,oBAAoB;IAC5B,MAAM,WAAW;IACjB,WAAW,gBAAgB;CAC9B;AAED,eAAO,MAAM,0BAA0B,oBAItC,CAAC;AACF,eAAO,MAAM,mCAAmC,oBAAoE,CAAC;AACrH,eAAO,MAAM,kCAAkC,oBAK9C,CAAC;AAEF,eAAO,MAAM,+BAA+B,oBAI3C,CAAC;AAEF,eAAO,MAAM,sCAAsC,oBAKlD,CAAC"}
@@ -25,3 +25,9 @@ export const showSideBarEARuleWidgetSections = [
25
25
  AppRouteSections.CASE_MGM,
26
26
  AppRouteSections.OPEN_CASE,
27
27
  ];
28
+ export const showSideBarClusterIdRuleWidgetSections = [
29
+ AppRouteSections.CASE_INFORMATION,
30
+ AppRouteSections.CASE_MGM,
31
+ AppRouteSections.REVIEW,
32
+ AppRouteSections.SUBMIT_CASE,
33
+ ];
@@ -62,13 +62,14 @@ export declare function createOrUpdateSessionResources(dispatch: SessionReducerD
62
62
  export declare function createSessionResourcesLocal(dispatch: SessionReducerDispatchType, activeSessionId: string, currentSessionResourceTracking: ISessionResourcesTracking, source: ISessionResourceSource, payload: string, resources?: ISessionResource[]): Promise<void>;
63
63
  export declare function updateSessionResourcesLocal(dispatch: SessionReducerDispatchType, activeSessionId: string, currentSessionResourceTracking: ISessionResourcesTracking, source: ISessionResourceSource, resources: ISessionResource[]): Promise<void>;
64
64
  export declare function getSessResFromTCCategories(tcCategories: ITopContentList[], visibilityStatus: ISessionResourceVisibility): ISessionResource[];
65
- export declare const getSessResTCCategory: (tcCategory: ITopContentList, visibilityStatus: ISessionResourceVisibility, resourceEntityId?: any) => ISessionResource[];
66
- export declare function getSessResFromRecs(recs: ISolrRecommendation[], visibilityStatus: ISessionResourceVisibility): ISessionResource[];
65
+ export declare const getSessResTCCategory: (tcCategory: ITopContentList, visibilityStatus: ISessionResourceVisibility) => ISessionResource[];
67
66
  export declare const getSessResTC: (tc: ITopContent, visibilityStatus: ISessionResourceVisibility, resourceEntityId?: any) => ISessionResource;
68
- export declare const getSessResFromRec: (rec: ISolrRecommendation, visibilityStatus: ISessionResourceVisibility, resourceEntityId?: any, rank?: number) => ISessionResource;
67
+ export declare function getSessResFromRecs(recs: ISolrRecommendation[], visibilityStatus: ISessionResourceVisibility): ISessionResource[];
68
+ export declare const getSessResFromRec: (rec: ISolrRecommendation, visibilityStatus: ISessionResourceVisibility, rank?: number) => ISessionResource;
69
69
  export declare const getSessResFromInsights: (url: string, visibilityStatus: ISessionResourceVisibility, resourceEntityId?: any) => ISessionResource;
70
70
  export declare const getSessResFromEARules: (rules: IRule[], visibilityStatus: ISessionResourceVisibility) => ISessionResource[];
71
71
  export declare const getSessResFromEA: (cta: string, visibilityStatus: ISessionResourceVisibility, resourceEntityId?: any) => ISessionResource;
72
+ export declare const getSessResFromClusterRecommendation: (cta: string, visibilityStatus: ISessionResourceVisibility, resourceEntityId?: any) => ISessionResource;
72
73
  export declare const getRecToSave: (visitedRec: ISolrRecommendation, allPresentedRec: ISolrRecommendation[], allDocs?: ISolrRecommendation[]) => ISessionResource[];
73
74
  export {};
74
75
  //# sourceMappingURL=SessionRestoreReducer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SessionRestoreReducer.d.ts","sourceRoot":"","sources":["../../../src/reducers/SessionRestoreReducer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,8CAA8C,CAAC;AACrE,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,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,EAAE,0BAA0B,EACpC,eAAe,EAAE,MAAM,EACvB,8BAA8B,EAAE,yBAAyB,EACzD,MAAM,EAAE,sBAAsB,EAC9B,SAAS,EAAE,gBAAgB,EAAE,iBAyChC;AAMD,wBAAgB,0BAA0B,CACtC,YAAY,EAAE,eAAe,EAAE,EAC/B,gBAAgB,EAAE,0BAA0B,GAC7C,gBAAgB,EAAE,CAIpB;AAID,eAAO,MAAM,oBAAoB,eACjB,eAAe,oBACT,0BAA0B,KAC7C,gBAAgB,EAIlB,CAAC;AAIF,eAAO,MAAM,YAAY,OACjB,WAAW,oBACG,0BAA0B,6BAE7C,gBAMD,CAAC;AAIH,wBAAgB,kBAAkB,CAC9B,IAAI,EAAE,mBAAmB,EAAE,EAC3B,gBAAgB,EAAE,0BAA0B,GAC7C,gBAAgB,EAAE,CAIpB;AAID,eAAO,MAAM,iBAAiB,QACrB,mBAAmB,oBACN,0BAA0B,SACrC,MAAM,KACd,gBAMD,CAAC;AAIH,eAAO,MAAM,sBAAsB,QAC1B,MAAM,oBACO,0BAA0B,6BAE7C,gBAKD,CAAC;AAIH,eAAO,MAAM,qBAAqB,UACvB,KAAK,EAAE,oBACI,0BAA0B,KAC7C,gBAAgB,EAIlB,CAAC;AAIF,eAAO,MAAM,gBAAgB,QACpB,MAAM,oBACO,0BAA0B,6BAE7C,gBAKD,CAAC;AAIH,eAAO,MAAM,mCAAmC,QACvC,MAAM,oBACO,0BAA0B,6BAE7C,gBAKD,CAAC;AAIH,eAAO,MAAM,YAAY,eACT,mBAAmB,mBACd,mBAAmB,EAAE,YAC7B,mBAAmB,EAAE,uBAWjC,CAAC"}
@@ -113,6 +113,7 @@ export const sessionRestoreReducer = (state, action) => {
113
113
  }
114
114
  }
115
115
  };
116
+ // Function to Load Previous Session
116
117
  export const loadPreviousSessions = (dispatch) => __awaiter(void 0, void 0, void 0, function* () {
117
118
  dispatch({
118
119
  type: SessionRestoreConstants.getSessions,
@@ -143,6 +144,7 @@ export const loadPreviousSessions = (dispatch) => __awaiter(void 0, void 0, void
143
144
  });
144
145
  }
145
146
  });
147
+ // Function to Create Session
146
148
  export const createSession = (dispatch, sessionDetails, session) => __awaiter(void 0, void 0, void 0, function* () {
147
149
  try {
148
150
  dispatch({
@@ -161,6 +163,7 @@ export const createSession = (dispatch, sessionDetails, session) => __awaiter(vo
161
163
  console.error(error);
162
164
  }
163
165
  });
166
+ // Function to Update Session
164
167
  export const updateSession = (dispatch, sessionId, sessionDetails, session) => __awaiter(void 0, void 0, void 0, function* () {
165
168
  try {
166
169
  dispatch({
@@ -178,6 +181,7 @@ export const updateSession = (dispatch, sessionId, sessionDetails, session) => _
178
181
  console.error(error);
179
182
  }
180
183
  });
184
+ // Function to Update Active SessionID
181
185
  export const updateActiveSessionId = (dispatch, activeSessionId) => {
182
186
  dispatch({ type: SessionRestoreConstants.setActiveSessionId, payload: { activeSessionId } });
183
187
  };
@@ -210,6 +214,7 @@ export function getRelevantSessionFromSessions(dispatch, currentRelevantSessionI
210
214
  }
211
215
  }
212
216
  }
217
+ // Mark All Sessions UnResolved
213
218
  export function markAllSessionsUnresolved(dispatch, sessionData, userAgent) {
214
219
  return __awaiter(this, void 0, void 0, function* () {
215
220
  const updatedSessionObj = {};
@@ -236,6 +241,7 @@ export function markAllSessionsUnresolved(dispatch, sessionData, userAgent) {
236
241
  });
237
242
  });
238
243
  }
244
+ // Create or Update Session Resource Helper
239
245
  export function createOrUpdateSessionResources(dispatch, activeSessionId, currentSessionResourceTracking, source, resources = [], payload = JSON.stringify({})) {
240
246
  return __awaiter(this, void 0, void 0, function* () {
241
247
  if (isEmpty(payload) || isEmpty(activeSessionId) || isEmpty(source))
@@ -249,6 +255,7 @@ export function createOrUpdateSessionResources(dispatch, activeSessionId, curren
249
255
  }
250
256
  });
251
257
  }
258
+ // Create Session Resource Helper
252
259
  export function createSessionResourcesLocal(dispatch, activeSessionId, currentSessionResourceTracking, source, payload, resources = []) {
253
260
  return __awaiter(this, void 0, void 0, function* () {
254
261
  if (isEmpty(payload) || isEmpty(activeSessionId) || isEmpty(source))
@@ -287,6 +294,7 @@ export function createSessionResourcesLocal(dispatch, activeSessionId, currentSe
287
294
  }
288
295
  });
289
296
  }
297
+ // Update Session Resource Helper
290
298
  export function updateSessionResourcesLocal(dispatch, activeSessionId, currentSessionResourceTracking, source, resources) {
291
299
  var _a;
292
300
  return __awaiter(this, void 0, void 0, function* () {
@@ -328,56 +336,45 @@ export function updateSessionResourcesLocal(dispatch, activeSessionId, currentSe
328
336
  }
329
337
  });
330
338
  }
331
- // session resource helper functions
339
+ // Session Resource Helper Functions
340
+ // Top Content Category Helper Function
332
341
  export function getSessResFromTCCategories(tcCategories, visibilityStatus) {
333
342
  const toReturn = [];
334
- forEach(tcCategories, (tcCategory) => toReturn.push(...getSessResTCCategory(tcCategory, visibilityStatus, tcCategory.id)));
343
+ forEach(tcCategories, (tcCategory) => toReturn.push(...getSessResTCCategory(tcCategory, visibilityStatus)));
335
344
  return toReturn;
336
345
  }
337
- export const getSessResTCCategory = (tcCategory, visibilityStatus, resourceEntityId) => {
346
+ // Top Content Helper Function Call
347
+ export const getSessResTCCategory = (tcCategory, visibilityStatus) => {
338
348
  const toReturn = [];
339
- forEach(tcCategory.content, (tc) => toReturn.push(getSessResTC(tc, visibilityStatus, resourceEntityId)));
349
+ forEach(tcCategory.content, (tc) => toReturn.push(getSessResTC(tc, visibilityStatus)));
340
350
  return toReturn;
341
351
  };
352
+ // Top Content Helper Function
353
+ export const getSessResTC = (tc, visibilityStatus, resourceEntityId) => {
354
+ var _a, _b, _c, _d;
355
+ return (Object.assign(Object.assign({ visibilityStatus }, ((tc === null || tc === void 0 ? void 0 : tc.topContentId) && { resourceEntityId: `${(_a = tc === null || tc === void 0 ? void 0 : tc.topContentId) !== null && _a !== void 0 ? _a : null}` })), { type: getResTypeFromUrl((_b = tc === null || tc === void 0 ? void 0 : tc.contentUrl) !== null && _b !== void 0 ? _b : ''), url: (_c = tc === null || tc === void 0 ? void 0 : tc.contentUrl) !== null && _c !== void 0 ? _c : '', rank: (_d = tc === null || tc === void 0 ? void 0 : tc.contentRank) !== null && _d !== void 0 ? _d : 0 }));
356
+ };
357
+ // Recommendations Helper Function Call
342
358
  export function getSessResFromRecs(recs, visibilityStatus) {
343
359
  const toReturn = [];
344
- forEach(recs, (rec) => toReturn.push(getSessResFromRec(rec, visibilityStatus, rec.id)));
360
+ forEach(recs, (rec) => toReturn.push(getSessResFromRec(rec, visibilityStatus)));
345
361
  return toReturn;
346
362
  }
347
- export const getSessResTC = (tc, visibilityStatus, resourceEntityId) => {
348
- var _a, _b, _c, _d;
349
- return ({
350
- visibilityStatus,
351
- resourceEntityId: (_a = tc === null || tc === void 0 ? void 0 : tc.topContentId) !== null && _a !== void 0 ? _a : 0,
352
- type: getResTypeFromUrl((_b = tc === null || tc === void 0 ? void 0 : tc.contentUrl) !== null && _b !== void 0 ? _b : ''),
353
- url: (_c = tc === null || tc === void 0 ? void 0 : tc.contentUrl) !== null && _c !== void 0 ? _c : '',
354
- rank: (_d = tc === null || tc === void 0 ? void 0 : tc.contentRank) !== null && _d !== void 0 ? _d : 0,
355
- });
356
- };
357
- export const getSessResFromRec = (rec, visibilityStatus, resourceEntityId, rank) => ({
358
- visibilityStatus,
359
- resourceEntityId,
360
- type: getResTypeFromUrl(rec.view_uri),
361
- url: rec.view_uri,
362
- rank,
363
- });
364
- export const getSessResFromInsights = (url, visibilityStatus, resourceEntityId) => ({
365
- visibilityStatus,
366
- resourceEntityId,
367
- type: getResTypeFromUrl(url),
368
- url: url,
369
- });
363
+ // Recommendations Helper Function
364
+ export const getSessResFromRec = (rec, visibilityStatus, rank) => (Object.assign(Object.assign({ visibilityStatus }, (rec.id && { resourceEntityId: rec.id })), { type: getResTypeFromUrl(rec.view_uri), url: rec.view_uri, rank }));
365
+ // Insights Helper Function
366
+ export const getSessResFromInsights = (url, visibilityStatus, resourceEntityId) => (Object.assign(Object.assign({ visibilityStatus }, (resourceEntityId && { resourceEntityId })), { type: getResTypeFromUrl(url), url: url }));
367
+ // EARules Helper Function Call
370
368
  export const getSessResFromEARules = (rules, visibilityStatus) => {
371
369
  const toReturn = [];
372
370
  forEach(rules, (rule) => toReturn.push(getSessResFromEA(rule.cta, visibilityStatus, rule.rule_id)));
373
371
  return toReturn;
374
372
  };
375
- export const getSessResFromEA = (cta, visibilityStatus, resourceEntityId) => ({
376
- visibilityStatus,
377
- resourceEntityId,
378
- type: getResTypeFromUrl(`${window.location.origin}${cta}`),
379
- url: cta.startsWith('http') ? cta : `${window.location.origin}/${cta}`,
380
- });
373
+ // EARules Helper Function
374
+ 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}` }));
375
+ // Cluster Recommendation Helper Function
376
+ export const getSessResFromClusterRecommendation = (cta, visibilityStatus, resourceEntityId) => (Object.assign(Object.assign({ visibilityStatus }, (resourceEntityId && { resourceEntityId })), { type: 'rule', url: cta }));
377
+ // Save Recommendations Helper Function
381
378
  export const getRecToSave = (visitedRec, allPresentedRec, allDocs = []) => {
382
379
  var _a, _b;
383
380
  const isNotOnFirstPage = ((_a = allDocs === null || allDocs === void 0 ? void 0 : allDocs[0]) === null || _a === void 0 ? void 0 : _a.view_uri) !== ((_b = allPresentedRec === null || allPresentedRec === void 0 ? void 0 : allPresentedRec[0]) === null || _b === void 0 ? void 0 : _b.view_uri);
@@ -1 +1 @@
1
- {"version":3,"file":"routeUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/routeUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qDAAqD,CAAC;AAM5F,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAGpG,MA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EAAE,MAAM,EAC1B,QAAQ,EAAE,qBAAqB,EAC/B,IAAI,SAAO;CAMlB"}
@@ -83,6 +83,9 @@ export default class RouteUtils {
83
83
  const navigationObj = { pathname: routeProps.location.pathname, search: getStringifiedParams(params) };
84
84
  routeProps.history.replace(navigationObj);
85
85
  }
86
+ // a rule has two seactions: reason and resolution.
87
+ // when user click on a link in the rule, we add couple of params and
88
+ // only when link is in the resolution section we add se band
86
89
  static getSEResourceQueryParams(seSessionId, seResourceOriginID, seSource, band = 'se') {
87
90
  return isEmpty(seSessionId)
88
91
  ? `band=${band}`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/troubleshoot",
3
- "version": "0.2.25",
3
+ "version": "0.2.29",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -26,7 +26,7 @@
26
26
  "lib/**/*"
27
27
  ],
28
28
  "peerDependencies": {
29
- "@cee-eng/hydrajs": "4.5.6",
29
+ "@cee-eng/hydrajs": "4.6.0",
30
30
  "@cee-eng/ui-toolkit": "1.1.3",
31
31
  "@patternfly/patternfly": "4.102.2",
32
32
  "@patternfly/pfe-accordion": "1.1.0",
@@ -63,7 +63,7 @@
63
63
  "react-virtualized": "^9.21.2"
64
64
  },
65
65
  "dependencies": {
66
- "@cee-eng/hydrajs": "4.5.6",
66
+ "@cee-eng/hydrajs": "4.6.0",
67
67
  "@cee-eng/ui-toolkit": "1.1.3",
68
68
  "@patternfly/patternfly": "4.102.2",
69
69
  "@patternfly/pfe-accordion": "1.1.0",
@@ -72,12 +72,12 @@
72
72
  "@patternfly/react-core": "4.128.2",
73
73
  "@progress/kendo-drawing": "^1.6.0",
74
74
  "@progress/kendo-react-pdf": "^3.12.0",
75
- "@rh-support/api": "0.3.6",
76
- "@rh-support/components": "1.1.12",
77
- "@rh-support/react-context": "0.2.14",
75
+ "@rh-support/api": "0.3.7",
76
+ "@rh-support/components": "1.1.13",
77
+ "@rh-support/react-context": "0.2.15",
78
78
  "@rh-support/types": "0.2.0",
79
- "@rh-support/user-permissions": "0.2.8",
80
- "@rh-support/utils": "0.2.8",
79
+ "@rh-support/user-permissions": "0.2.9",
80
+ "@rh-support/utils": "0.2.9",
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": "24638b4dd648b8e1faae3b0bdf0f24d2c2bfc4fa"
145
+ "gitHead": "aca44c9ef3cf47dc247b30e894d076304af2f5ce"
146
146
  }