@rh-support/troubleshoot 0.2.28 → 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.
@@ -1 +1 @@
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,gBAqQjC"}
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,7 +9,7 @@ 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';
@@ -66,6 +66,7 @@ export function OpenShiftClusterId() {
66
66
  const [v3Selected, setV3Selected] = useState(false);
67
67
  const [dontKnowSelected, setDontKnowSelected] = useState(false);
68
68
  const [selectedReason, setSelectedReason] = useState('');
69
+ const isClusterRecommendationEnabled = getConfigField(pcmConfig.data, 'isClusterRecommendationEnabled', PCM_CONFIG_FIELD_TYPE.FEATURE_FLAG);
69
70
  const resetClusterData = () => {
70
71
  clusterStateReset();
71
72
  setCaseDetails(caseDispatch, {
@@ -152,8 +153,8 @@ export function OpenShiftClusterId() {
152
153
  setDontKnowSelected(true);
153
154
  setSelectedReason('dont-have-id');
154
155
  }
155
- !isClusterIdInvalid &&
156
- !isEmpty(openshiftClusterID) &&
156
+ const canFetchClusterRecommendation = isClusterRecommendationEnabled && !isClusterIdInvalid && !isEmpty(openshiftClusterID);
157
+ canFetchClusterRecommendation &&
157
158
  fetchClusterRecommendations(clusterRecommendationsDispatch, openshiftClusterID);
158
159
  // eslint-disable-next-line react-hooks/exhaustive-deps
159
160
  }, [v3ClusterName, noClusterIdReason]);
@@ -173,9 +174,10 @@ export function OpenShiftClusterId() {
173
174
  return;
174
175
  }
175
176
  const isClusterInvalid = getIsClusterIdInvalid(selectedId);
177
+ const canFetchClusterRecommendation = !isClusterInvalid && isClusterRecommendationEnabled;
176
178
  setIsClusterIdInValid(isClusterInvalid);
177
179
  setCusterId(selectedId, selectedCluster);
178
- !isClusterInvalid && fetchClusterRecommendations(clusterRecommendationsDispatch, selectedId);
180
+ canFetchClusterRecommendation && fetchClusterRecommendations(clusterRecommendationsDispatch, selectedId);
179
181
  };
180
182
  const clusterIdDropdownFormInstructions = () => {
181
183
  const errorMessage = isClusterIdInvalid
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/troubleshoot",
3
- "version": "0.2.28",
3
+ "version": "0.2.29",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -142,5 +142,5 @@
142
142
  "not ie <= 11",
143
143
  "not op_mini all"
144
144
  ],
145
- "gitHead": "6e0c6103e776d314540f06fffa80be12601c08d3"
145
+ "gitHead": "aca44c9ef3cf47dc247b30e894d076304af2f5ce"
146
146
  }