@rh-support/troubleshoot 0.2.70 → 0.2.73

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,gBAgRjC"}
1
+ {"version":3,"file":"OpenShiftClusterId.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseManagement/OpenShiftClusterId.tsx"],"names":[],"mappings":"AAwBA,eAAO,MAAM,oBAAoB,mBAShC,CAAC;AAqBF,wBAAgB,kBAAkB,gBAsRjC"}
@@ -16,7 +16,7 @@ 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
+ import { ClusterRecommendationsContext, ClusterRecommendationsDispatchContext, } from '../../context/ClusterRecommendationsContext';
20
20
  import { RouteContext } from '../../context/RouteContext';
21
21
  import { getUpdatedDescription } from '../../reducers/CaseHelpers';
22
22
  import { setCaseDetails, setCaseState } from '../../reducers/CaseReducer';
@@ -58,6 +58,7 @@ export function OpenShiftClusterId() {
58
58
  const { globalMetadataState: { pcmConfig, allProducts, loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
59
59
  const { routeState: { showValidationErrorAlert }, } = useContext(RouteContext);
60
60
  const clusterRecommendationsDispatch = useContext(ClusterRecommendationsDispatchContext);
61
+ const { clusterRecommendationsState: { clusterRecommendations }, } = useContext(ClusterRecommendationsContext);
61
62
  const majorVersion = (version && getVersion(version).major) || '';
62
63
  const isOpenShiftV3 = majorVersion === '3';
63
64
  const isCustomer = loggedInUserRights.data.isAccountSameAsLoggedInAccount(selectedAccountDetails.data.accountNumber);
@@ -154,7 +155,9 @@ export function OpenShiftClusterId() {
154
155
  setSelectedReason('dont-have-id');
155
156
  }
156
157
  const canFetchClusterRecommendation = isClusterRecommendationEnabled && !isClusterIdInvalid && !isEmpty(openshiftClusterID);
158
+ // To prevent refetching clusterRecommendations checking for clusterRecommendations data length
157
159
  canFetchClusterRecommendation &&
160
+ !clusterRecommendations.data.length &&
158
161
  fetchClusterRecommendations(clusterRecommendationsDispatch, openshiftClusterID);
159
162
  // eslint-disable-next-line react-hooks/exhaustive-deps
160
163
  }, [v3ClusterName, noClusterIdReason]);
@@ -1 +1 @@
1
- {"version":3,"file":"ClusterRecommendationToast.d.ts","sourceRoot":"","sources":["../../../../src/components/Recommendations/ClusterRecommendationToast.tsx"],"names":[],"mappings":"AAIA,OAAc,EAAE,EAAE,EAAmC,MAAM,OAAO,CAAC;AAUnE,UAAU,MAAM;CAAG;AAEnB,QAAA,MAAM,0BAA0B,EAAE,EAAE,CAAC,MAAM,CAwD1C,CAAC;AAEF,eAAe,0BAA0B,CAAC"}
1
+ {"version":3,"file":"ClusterRecommendationToast.d.ts","sourceRoot":"","sources":["../../../../src/components/Recommendations/ClusterRecommendationToast.tsx"],"names":[],"mappings":"AAGA,OAAc,EAAE,EAAE,EAAmC,MAAM,OAAO,CAAC;AAUnE,UAAU,MAAM;CAAG;AAEnB,QAAA,MAAM,0BAA0B,EAAE,EAAE,CAAC,MAAM,CAqD1C,CAAC;AAEF,eAAe,0BAA0B,CAAC"}
@@ -1,5 +1,4 @@
1
1
  import { Alert, AlertActionCloseButton, Button } from '@patternfly/react-core';
2
- import { usePrevious } from '@rh-support/components';
3
2
  import { GlobalMetadataStateContext } from '@rh-support/react-context';
4
3
  import { isEmpty, isEqual } from 'lodash';
5
4
  import React, { useContext, useEffect, useState } from 'react';
@@ -7,7 +6,7 @@ import { Trans, useTranslation } from 'react-i18next';
7
6
  import { useCaseSelector } from '../../context/CaseContext';
8
7
  import { ClusterRecommendationsContext, ClusterRecommendationsDispatchContext, } from '../../context/ClusterRecommendationsContext';
9
8
  import { toggleClusterRecommendationModal } from '../../reducers/ClusterRecommendationsReducer';
10
- import { isClusterIdEnabledForProduct } from '../../utils/caseOpenshiftClusterIdUtils';
9
+ import { getIsClusterIdInvalid, isClusterIdEnabledForProduct } from '../../utils/caseOpenshiftClusterIdUtils';
11
10
  const ClusterRecommendationToast = () => {
12
11
  var _a;
13
12
  const { t } = useTranslation();
@@ -19,21 +18,21 @@ const ClusterRecommendationToast = () => {
19
18
  product: state.caseDetails.product,
20
19
  }), isEqual);
21
20
  const { globalMetadataState: { allProducts }, } = useContext(GlobalMetadataStateContext);
22
- const previousOpenShiftClusterId = usePrevious(openshiftClusterID);
23
21
  const onViewRecommendations = () => {
24
22
  setToastVisibility(false);
25
23
  toggleClusterRecommendationModal(clusterRecommendationsDispatch, !isClusterRecommendationsModalOpen);
26
24
  };
27
- // To prevent toast to reopen even after user close it we need to check cluster id
25
+ // To open popover we check for cluster id and clusterRecommendations array length
28
26
  useEffect(() => {
29
- if (!isEmpty(openshiftClusterID) &&
30
- previousOpenShiftClusterId !== openshiftClusterID &&
31
- clusterRecommendations.data.length)
27
+ if (!isEmpty(openshiftClusterID) && clusterRecommendations.data.length)
32
28
  setToastVisibility(true);
33
29
  // eslint-disable-next-line react-hooks/exhaustive-deps
34
30
  }, [clusterRecommendations.data]);
31
+ /**
32
+ * Hide Popover on cluster id change
33
+ */
35
34
  useEffect(() => {
36
- if (!openshiftClusterID)
35
+ if (!openshiftClusterID || getIsClusterIdInvalid(openshiftClusterID))
37
36
  setToastVisibility(false);
38
37
  }, [openshiftClusterID]);
39
38
  const hasCluster = isClusterIdEnabledForProduct(product, (_a = allProducts.data) === null || _a === void 0 ? void 0 : _a.productsResult);
@@ -1 +1 @@
1
- {"version":3,"file":"EARule.d.ts","sourceRoot":"","sources":["../../../../../src/components/Recommendations/EARules/EARule.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqB,MAAM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zB;AAED,iBAAS,aAAa,CAAC,EAAE,SAA6B,EAAE,SAAc,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,eA4BnH;AAED,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,aAAa,EAAE,CAAC"}
@@ -1,5 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-unused-vars */
2
2
  import { pcm } from '@cee-eng/hydrajs';
3
+ import CaretRightIcon from '@patternfly/react-icons/dist/js/icons/caret-right-icon';
3
4
  import React, { useContext } from 'react';
4
5
  import { Trans } from 'react-i18next';
5
6
  import { SessionRestoreDispatchContext, SessionRestoreStateContext } from '../../../context/SessionRestoreContext';
@@ -50,7 +51,9 @@ function EARuleArticle({ linkTitle = 'Related Article', className = '' }) {
50
51
  const { getTrackingULRWithQueryParams } = useParseRuleMarkdown();
51
52
  if (!rule.cta)
52
53
  return null;
53
- return (React.createElement("a", { className: `se-recommended ts-known-vuln ${className}`, rel: "noopener noreferrer", target: "_blank", "data-tracking-id": "se-recommended-asa-rule", onClick: onCtaClick(rule.cta), href: getTrackingULRWithQueryParams(rule.cta, SessionResourceSource.EDMOUND_ABOTT) },
54
- React.createElement(Trans, null, linkTitle)));
54
+ return linkTitle === 'View details' ? (React.createElement("a", { className: `se-recommended ts-known-vuln anchor-tag-link-td-none ${className}`, rel: "noopener noreferrer", target: "_blank", "data-tracking-id": "se-recommended-asa-rule", onClick: onCtaClick(rule.cta), href: getTrackingULRWithQueryParams(rule.cta, SessionResourceSource.EDMOUND_ABOTT) },
55
+ React.createElement(Trans, null, linkTitle))) : (React.createElement("a", { className: `se-recommended pf-c-button pf-m-link anchor-tag-link-pl ts-known-vuln ${className}`, rel: "noopener noreferrer", target: "_blank", "data-tracking-id": "se-recommended-asa-rule", onClick: onCtaClick(rule.cta), href: getTrackingULRWithQueryParams(rule.cta, SessionResourceSource.EDMOUND_ABOTT) },
56
+ React.createElement(Trans, null, linkTitle),
57
+ React.createElement(CaretRightIcon, null)));
55
58
  }
56
59
  export { EARuleTitle, EARuleDescription, EARuleArticle };
@@ -75,7 +75,7 @@ export function InsightsRuleInfo({ doc, showNewTag, duplicateKeys }) {
75
75
  React.createElement(Trans, null, "Additional info")),
76
76
  React.createElement(AccordionContent, { isHidden: !isAdditionalExpanded },
77
77
  React.createElement("p", { onClick: onAdditionalInfoElemClick, dangerouslySetInnerHTML: parseMoreInfo(ruleData === null || ruleData === void 0 ? void 0 : ruleData.more_info, (_g = insightsReport === null || insightsReport === void 0 ? void 0 : insightsReport.current) === null || _g === void 0 ? void 0 : _g.details) }))))),
78
- React.createElement("a", { className: "se-recommended pf-c-button pf-m-link ts-result-insights cta-link", rel: "noopener noreferrer", target: "_blank", onClick: onCtaClick(doc.view_uri), "data-tracking-id": "se-recommended-insights-rule", "aria-label": "Related article", role: "button", href: getTrackingULRWithQueryParams(doc.view_uri, SessionResourceSource.INSIGHTS) },
78
+ React.createElement("a", { className: "se-recommended pf-c-button pf-m-link anchor-tag-link-pl ts-result-insights cta-link", rel: "noopener noreferrer", target: "_blank", onClick: onCtaClick(doc.view_uri), "data-tracking-id": "se-recommended-insights-rule", "aria-label": "Related article", role: "button", href: getTrackingULRWithQueryParams(doc.view_uri, SessionResourceSource.INSIGHTS) },
79
79
  React.createElement(Trans, null, "Related article"),
80
80
  React.createElement(CaretRightIcon, null)))))));
81
81
  }
@@ -923,5 +923,15 @@ div.pf-c-alert.ea-rule-alert > div.pf-c-alert__description > p {
923
923
  }
924
924
 
925
925
  .anchor-tag-button {
926
- padding: 0;
926
+ padding: 0px;
927
+ }
928
+
929
+ .anchor-tag-link-pl {
930
+ padding-left: 0px;
931
+ font-size: 14px;
932
+ display: inline-block;
933
+ }
934
+
935
+ .anchor-tag-link-td-none {
936
+ text-decoration: none;
927
937
  }
@@ -295,3 +295,9 @@ div.common-suggestions pfe-accordion {
295
295
  --pfe-accordion--FontSize--header: 16px;
296
296
  --pfe-accordion--FontWeight--header: 600;
297
297
  }
298
+
299
+ // Override PFE Collapse discloser = false
300
+ section.grid-aside-content pfe-accordion {
301
+ --pfe-accordion--FontSize--header: 16px;
302
+ --pfe-accordion--FontWeight--header: 600;
303
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/troubleshoot",
3
- "version": "0.2.70",
3
+ "version": "0.2.73",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -143,5 +143,5 @@
143
143
  "not ie <= 11",
144
144
  "not op_mini all"
145
145
  ],
146
- "gitHead": "6e960efbc60f233479ef0c92bc1b3b8e2c5b8d31"
146
+ "gitHead": "05cc1373c1aadf41446d868520cb642065014b6e"
147
147
  }