@rh-support/troubleshoot 0.2.45 → 0.2.49-alpha.0
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.
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseComments.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseComments.js +6 -4
- package/lib/esm/components/Recommendations/AlertToastWrapper.d.ts +9 -0
- package/lib/esm/components/Recommendations/AlertToastWrapper.d.ts.map +1 -0
- package/lib/esm/components/Recommendations/AlertToastWrapper.js +13 -0
- package/lib/esm/components/Recommendations/ClusterRecommendationToast.d.ts +0 -2
- package/lib/esm/components/Recommendations/ClusterRecommendationToast.d.ts.map +1 -1
- package/lib/esm/components/Recommendations/ClusterRecommendationToast.js +39 -6
- package/lib/esm/components/Recommendations/ClusterRecommendations.d.ts.map +1 -1
- package/lib/esm/components/Recommendations/ClusterRecommendations.js +25 -19
- package/lib/esm/components/Recommendations/ClusterRecommendationsModal.d.ts +0 -4
- package/lib/esm/components/Recommendations/ClusterRecommendationsModal.d.ts.map +1 -1
- package/lib/esm/components/Recommendations/ClusterRecommendationsModal.js +11 -4
- package/lib/esm/components/Recommendations/CriticalSolutionsToast.d.ts +6 -0
- package/lib/esm/components/Recommendations/CriticalSolutionsToast.d.ts.map +1 -0
- package/lib/esm/components/Recommendations/CriticalSolutionsToast.js +39 -0
- package/lib/esm/components/Recommendations/InsightsResults.d.ts.map +1 -1
- package/lib/esm/components/Recommendations/InsightsResults.js +1 -21
- package/lib/esm/components/wizardLayout/GlobalTroubleshootEffects.d.ts.map +1 -1
- package/lib/esm/components/wizardLayout/GlobalTroubleshootEffects.js +4 -2
- package/lib/esm/components/wizardLayout/WizardAside.d.ts.map +1 -1
- package/lib/esm/components/wizardLayout/WizardAside.js +3 -1
- package/lib/esm/context/ClusterRecommendationsContext.d.ts +2 -4
- package/lib/esm/context/ClusterRecommendationsContext.d.ts.map +1 -1
- package/lib/esm/context/ClusterRecommendationsContext.js +6 -6
- package/lib/esm/reducers/ClusterRecommendationsReducer.d.ts +10 -3
- package/lib/esm/reducers/ClusterRecommendationsReducer.d.ts.map +1 -1
- package/lib/esm/reducers/ClusterRecommendationsReducer.js +21 -5
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseComments.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDiscussion/CaseComments.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AA6BvE,OAAO,KAA+B,MAAM,OAAO,CAAC;AAOpD,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAClF,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,kBAAkB,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CAChH;AAED,QAAA,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"CaseComments.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDiscussion/CaseComments.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AA6BvE,OAAO,KAA+B,MAAM,OAAO,CAAC;AAOpD,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAClF,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,kBAAkB,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CAChH;AAED,QAAA,MAAM,YAAY,4EAiThB,CAAC;AAEH,eAAe,YAAY,CAAC"}
|
|
@@ -147,8 +147,9 @@ const CaseComments = React.forwardRef((props, ref) => {
|
|
|
147
147
|
const parseCommentHtml = (commentText, contentType) => {
|
|
148
148
|
let text = commentText;
|
|
149
149
|
if (contentType === EditorMode.PLAIN) {
|
|
150
|
+
text = HTMLEntityChecker(commentText);
|
|
150
151
|
// fix issue something like this <h1>ajhdjaj<d</h1>
|
|
151
|
-
text = htmlEntitiesEncode(
|
|
152
|
+
text = htmlEntitiesEncode(text);
|
|
152
153
|
text = encodeAngularBrackets(text);
|
|
153
154
|
text = linkifyLinks(text);
|
|
154
155
|
text = linkifyWithCaseIDs(text);
|
|
@@ -160,6 +161,7 @@ const CaseComments = React.forwardRef((props, ref) => {
|
|
|
160
161
|
/* Purpose of this method is to break the default HTML Entity rendering on the UI when in plaintext mode.
|
|
161
162
|
This is achieved by directly swapping the '&' in any html entity to `&` in e.g. &euro swaps to &euro
|
|
162
163
|
so it is rendered -> &euro on the UI instead of '€' */
|
|
164
|
+
//PCM-10968
|
|
163
165
|
const HTMLEntityChecker = (comment) => {
|
|
164
166
|
if (comment.includes('&')) {
|
|
165
167
|
return comment.replace(/&/g, '&');
|
|
@@ -170,13 +172,13 @@ const CaseComments = React.forwardRef((props, ref) => {
|
|
|
170
172
|
const computeCommentText = (comment) => {
|
|
171
173
|
const parseComment = parseCommentHtml(comment.commentBody, comment.contentType);
|
|
172
174
|
if (!isEmpty(comment.commentBody) && comment.contentType === EditorMode.MARKDOWN) {
|
|
173
|
-
return (React.createElement("div", { className: "push-top-narrow comment-markdown-text", dangerouslySetInnerHTML: commentMarkdown(
|
|
175
|
+
return (React.createElement("div", { className: "push-top-narrow comment-markdown-text", dangerouslySetInnerHTML: commentMarkdown(comment.commentBody) }));
|
|
174
176
|
}
|
|
175
177
|
else if (!isEmpty(comment.commentBody) && comment.contentType === EditorMode.PLAIN) {
|
|
176
|
-
return (React.createElement("pre", { className: "push-top-narrow comment-plaintext reset-pre-text", dangerouslySetInnerHTML: commentText(
|
|
178
|
+
return (React.createElement("pre", { className: "push-top-narrow comment-plaintext reset-pre-text", dangerouslySetInnerHTML: commentText(parseComment) }));
|
|
177
179
|
}
|
|
178
180
|
else {
|
|
179
|
-
return (React.createElement("pre", { className: "push-top-narrow comment-plaintext reset-pre-text", dangerouslySetInnerHTML: commentText(
|
|
181
|
+
return (React.createElement("pre", { className: "push-top-narrow comment-plaintext reset-pre-text", dangerouslySetInnerHTML: commentText(parseComment) }));
|
|
180
182
|
}
|
|
181
183
|
};
|
|
182
184
|
if (!((_a = props.comment) === null || _a === void 0 ? void 0 : _a.isPublic) && !canSeePrivateComments)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* We need to wrap Critical solution toast notification and Cluster recommendation toast notification so they don't get overlapped.
|
|
3
|
+
*/
|
|
4
|
+
import { FC } from 'react';
|
|
5
|
+
interface IProps {
|
|
6
|
+
}
|
|
7
|
+
declare const AlertToastWrapper: FC<IProps>;
|
|
8
|
+
export default AlertToastWrapper;
|
|
9
|
+
//# sourceMappingURL=AlertToastWrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AlertToastWrapper.d.ts","sourceRoot":"","sources":["../../../../src/components/Recommendations/AlertToastWrapper.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAKlC,UAAU,MAAM;CAAG;AAEnB,QAAA,MAAM,iBAAiB,EAAE,EAAE,CAAC,MAAM,CAQjC,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* We need to wrap Critical solution toast notification and Cluster recommendation toast notification so they don't get overlapped.
|
|
3
|
+
*/
|
|
4
|
+
import { AlertGroup } from '@patternfly/react-core';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import ClusterRecommendationToast from './ClusterRecommendationToast';
|
|
7
|
+
import CriticalSolutionsToast from './CriticalSolutionsToast';
|
|
8
|
+
const AlertToastWrapper = () => {
|
|
9
|
+
return (React.createElement(AlertGroup, { isToast: true },
|
|
10
|
+
React.createElement(CriticalSolutionsToast, null),
|
|
11
|
+
React.createElement(ClusterRecommendationToast, null)));
|
|
12
|
+
};
|
|
13
|
+
export default AlertToastWrapper;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClusterRecommendationToast.d.ts","sourceRoot":"","sources":["../../../../src/components/Recommendations/ClusterRecommendationToast.tsx"],"names":[],"mappings":"
|
|
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,CAmD1C,CAAC;AAEF,eAAe,0BAA0B,CAAC"}
|
|
@@ -1,10 +1,43 @@
|
|
|
1
|
-
import { Alert, AlertActionCloseButton,
|
|
2
|
-
import
|
|
1
|
+
import { Alert, AlertActionCloseButton, Button } from '@patternfly/react-core';
|
|
2
|
+
import { usePrevious } from '@rh-support/components';
|
|
3
|
+
import { GlobalMetadataStateContext } from '@rh-support/react-context';
|
|
4
|
+
import { isEmpty, isEqual } from 'lodash';
|
|
5
|
+
import React, { useContext, useEffect, useState } from 'react';
|
|
3
6
|
import { Trans, useTranslation } from 'react-i18next';
|
|
4
|
-
|
|
7
|
+
import { useCaseSelector } from '../../context/CaseContext';
|
|
8
|
+
import { ClusterRecommendationsContext, ClusterRecommendationsDispatchContext, } from '../../context/ClusterRecommendationsContext';
|
|
9
|
+
import { toggleClusterRecommendationModal } from '../../reducers/ClusterRecommendationsReducer';
|
|
10
|
+
import { isClusterIdEnabledForProduct } from '../../utils/caseOpenshiftClusterIdUtils';
|
|
11
|
+
const ClusterRecommendationToast = () => {
|
|
12
|
+
var _a;
|
|
5
13
|
const { t } = useTranslation();
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
14
|
+
const { clusterRecommendationsState: { clusterRecommendations, isClusterRecommendationsModalOpen }, } = useContext(ClusterRecommendationsContext);
|
|
15
|
+
const clusterRecommendationsDispatch = useContext(ClusterRecommendationsDispatchContext);
|
|
16
|
+
const [isToastVisible, setToastVisibility] = useState(false);
|
|
17
|
+
const { openshiftClusterID, product } = useCaseSelector((state) => ({
|
|
18
|
+
openshiftClusterID: state.caseDetails.openshiftClusterID,
|
|
19
|
+
product: state.caseDetails.product,
|
|
20
|
+
}), isEqual);
|
|
21
|
+
const { globalMetadataState: { allProducts }, } = useContext(GlobalMetadataStateContext);
|
|
22
|
+
const previousOpenShiftClusterId = usePrevious(openshiftClusterID);
|
|
23
|
+
const onViewRecommendations = () => {
|
|
24
|
+
setToastVisibility(false);
|
|
25
|
+
toggleClusterRecommendationModal(clusterRecommendationsDispatch, !isClusterRecommendationsModalOpen);
|
|
26
|
+
};
|
|
27
|
+
// To prevent toast to reopen even after user close it we need to check cluster id
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (!isEmpty(openshiftClusterID) && previousOpenShiftClusterId !== openshiftClusterID)
|
|
30
|
+
setToastVisibility(true);
|
|
31
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
32
|
+
}, [clusterRecommendations.data]);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (!openshiftClusterID)
|
|
35
|
+
setToastVisibility(false);
|
|
36
|
+
}, [openshiftClusterID]);
|
|
37
|
+
const hasCluster = isClusterIdEnabledForProduct(product, (_a = allProducts.data) === null || _a === void 0 ? void 0 : _a.productsResult);
|
|
38
|
+
if (!isToastVisible || !hasCluster)
|
|
39
|
+
return null;
|
|
40
|
+
return (React.createElement(Alert, { isLiveRegion: true, variant: "success", title: t('Cluster recommendation has been triggered'), "data-tracking-id": "toast-view-cluster-sol", actionLinks: React.createElement(Button, { isInline: true, variant: "link", onClick: onViewRecommendations },
|
|
41
|
+
React.createElement(Trans, null, "View recommendations")), actionClose: React.createElement(AlertActionCloseButton, { variantLabel: "success alert", onClose: () => setToastVisibility(false) }) }));
|
|
9
42
|
};
|
|
10
43
|
export default ClusterRecommendationToast;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClusterRecommendations.d.ts","sourceRoot":"","sources":["../../../../src/components/Recommendations/ClusterRecommendations.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ClusterRecommendations.d.ts","sourceRoot":"","sources":["../../../../src/components/Recommendations/ClusterRecommendations.tsx"],"names":[],"mappings":"AAgBA,MAAM,CAAC,OAAO,UAAU,qBAAqB,gBAmD5C"}
|
|
@@ -1,35 +1,41 @@
|
|
|
1
1
|
import { Button } from '@patternfly/react-core';
|
|
2
|
-
import
|
|
2
|
+
import { GlobalMetadataStateContext } from '@rh-support/react-context';
|
|
3
|
+
import { isEqual } from 'lodash';
|
|
4
|
+
import React, { useContext } from 'react';
|
|
3
5
|
import { Trans } from 'react-i18next';
|
|
4
|
-
import {
|
|
6
|
+
import { useCaseSelector } from '../../context/CaseContext';
|
|
7
|
+
import { ClusterRecommendationsContext, ClusterRecommendationsDispatchContext, } from '../../context/ClusterRecommendationsContext';
|
|
8
|
+
import { toggleClusterRecommendationModal } from '../../reducers/ClusterRecommendationsReducer';
|
|
9
|
+
import { isClusterIdEnabledForProduct } from '../../utils/caseOpenshiftClusterIdUtils';
|
|
5
10
|
import { ClusterRecommendationItems } from './ClusterRecommendationItems';
|
|
6
11
|
import { ClusterRecommendationsModal } from './ClusterRecommendationsModal';
|
|
7
|
-
import ClusterRecommendationToast from './ClusterRecommendationToast';
|
|
8
12
|
export default function ClusteRecommendations() {
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
setToastVisibility(true);
|
|
18
|
-
}, [clusterRecommendations.data]);
|
|
13
|
+
var _a;
|
|
14
|
+
const { clusterRecommendationsState: { clusterRecommendations, isClusterRecommendationsModalOpen }, } = useContext(ClusterRecommendationsContext);
|
|
15
|
+
const clusterRecommendationsDispatch = useContext(ClusterRecommendationsDispatchContext);
|
|
16
|
+
const { openshiftClusterID, product } = useCaseSelector((state) => ({
|
|
17
|
+
openshiftClusterID: state.caseDetails.openshiftClusterID,
|
|
18
|
+
product: state.caseDetails.product,
|
|
19
|
+
}), isEqual);
|
|
20
|
+
const { globalMetadataState: { allProducts }, } = useContext(GlobalMetadataStateContext);
|
|
19
21
|
const NUMBER_OF_RULES_TO_DISPLAY = 3;
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
+
const onViewMoreRecommendation = () => {
|
|
23
|
+
toggleClusterRecommendationModal(clusterRecommendationsDispatch, !isClusterRecommendationsModalOpen);
|
|
22
24
|
};
|
|
23
|
-
|
|
25
|
+
const hasCluster = isClusterIdEnabledForProduct(product, (_a = allProducts.data) === null || _a === void 0 ? void 0 : _a.productsResult);
|
|
26
|
+
if (clusterRecommendations.data.length === 0 ||
|
|
27
|
+
clusterRecommendations.isError ||
|
|
28
|
+
clusterRecommendations.isFetching ||
|
|
29
|
+
!hasCluster ||
|
|
30
|
+
!openshiftClusterID)
|
|
24
31
|
return React.createElement(React.Fragment, null);
|
|
25
32
|
return (React.createElement(React.Fragment, null,
|
|
26
|
-
isToastVisible && (React.createElement(ClusterRecommendationToast, { onViewRecommendations: onViewRecommendations, onToastClose: () => setToastVisibility(false) })),
|
|
27
33
|
React.createElement("div", { className: "card card-white card-support top-recommendations" },
|
|
28
34
|
React.createElement("h3", { className: "card-heading" },
|
|
29
35
|
React.createElement(Trans, null, "Cluster recommendations")),
|
|
30
36
|
React.createElement("div", null,
|
|
31
37
|
React.createElement(ClusterRecommendationItems, { clusterRecommendations: clusterRecommendations.data.slice(0, NUMBER_OF_RULES_TO_DISPLAY) }),
|
|
32
|
-
clusterRecommendations.data.length > NUMBER_OF_RULES_TO_DISPLAY && (React.createElement(Button, { className: "pf-u-p-md", variant: "link", isBlock: true, onClick:
|
|
38
|
+
clusterRecommendations.data.length > NUMBER_OF_RULES_TO_DISPLAY && (React.createElement(Button, { className: "pf-u-p-md", variant: "link", isBlock: true, onClick: onViewMoreRecommendation },
|
|
33
39
|
React.createElement(Trans, null, "View more recommendations"))),
|
|
34
|
-
React.createElement(ClusterRecommendationsModal,
|
|
40
|
+
React.createElement(ClusterRecommendationsModal, null)))));
|
|
35
41
|
}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import { IClusterRecommendation } from '@cee-eng/hydrajs/@types/api/pcm/preCaseDiagnostics';
|
|
2
1
|
interface IProps {
|
|
3
|
-
clusterRecommendations: IClusterRecommendation[];
|
|
4
|
-
isOpen: boolean;
|
|
5
|
-
onModalClose: () => void;
|
|
6
2
|
}
|
|
7
3
|
export declare function ClusterRecommendationsModal(props: IProps): JSX.Element;
|
|
8
4
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClusterRecommendationsModal.d.ts","sourceRoot":"","sources":["../../../../src/components/Recommendations/ClusterRecommendationsModal.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ClusterRecommendationsModal.d.ts","sourceRoot":"","sources":["../../../../src/components/Recommendations/ClusterRecommendationsModal.tsx"],"names":[],"mappings":"AAeA,UAAU,MAAM;CAAG;AAEnB,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,eA2ExD"}
|
|
@@ -12,7 +12,9 @@ import { Button, Modal } from '@patternfly/react-core';
|
|
|
12
12
|
import { useFetch } from '@rh-support/components';
|
|
13
13
|
import React, { useContext, useState } from 'react';
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import { ClusterRecommendationsContext, ClusterRecommendationsDispatchContext, } from '../../context/ClusterRecommendationsContext';
|
|
15
16
|
import { SessionRestoreStateContext } from '../../context/SessionRestoreContext';
|
|
17
|
+
import { toggleClusterRecommendationModal } from '../../reducers/ClusterRecommendationsReducer';
|
|
16
18
|
import { ClusterRecommendationItems } from './ClusterRecommendationItems';
|
|
17
19
|
import { RecommendationFeedbackModal } from './RecommendationFeedbackModal';
|
|
18
20
|
export function ClusterRecommendationsModal(props) {
|
|
@@ -21,6 +23,8 @@ export function ClusterRecommendationsModal(props) {
|
|
|
21
23
|
const { request: resolveSessionRequest, isFetching } = useFetch(pcm.preCase.session.resolveSession);
|
|
22
24
|
const { SessionResourceSource } = pcm.preCase.session;
|
|
23
25
|
const [isModalVisible, setIsModalVisible] = useState(false);
|
|
26
|
+
const { clusterRecommendationsState: { clusterRecommendations, isClusterRecommendationsModalOpen }, } = useContext(ClusterRecommendationsContext);
|
|
27
|
+
const clusterRecommendationsDispatch = useContext(ClusterRecommendationsDispatchContext);
|
|
24
28
|
const handleSolvedIssue = () => __awaiter(this, void 0, void 0, function* () {
|
|
25
29
|
var _a, _b;
|
|
26
30
|
try {
|
|
@@ -31,18 +35,21 @@ export function ClusterRecommendationsModal(props) {
|
|
|
31
35
|
url: '',
|
|
32
36
|
});
|
|
33
37
|
setIsModalVisible(true);
|
|
34
|
-
|
|
38
|
+
onModalClose();
|
|
35
39
|
}
|
|
36
40
|
catch (e) { }
|
|
37
41
|
});
|
|
38
42
|
const onModalToggle = () => {
|
|
39
43
|
setIsModalVisible((visible) => !visible);
|
|
40
44
|
};
|
|
45
|
+
const onModalClose = () => {
|
|
46
|
+
toggleClusterRecommendationModal(clusterRecommendationsDispatch, !isClusterRecommendationsModalOpen);
|
|
47
|
+
};
|
|
41
48
|
return (React.createElement(React.Fragment, null,
|
|
42
49
|
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:
|
|
50
|
+
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: onModalClose, isOpen: isClusterRecommendationsModalOpen, actions: [
|
|
44
51
|
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:
|
|
52
|
+
React.createElement(Button, { onClick: onModalClose, key: "confirm", variant: "secondary", "data-tracking-id": "cancel-cluster-recommendations-modal" }, t('Cancel')),
|
|
46
53
|
] },
|
|
47
|
-
React.createElement(ClusterRecommendationItems, { clusterRecommendations:
|
|
54
|
+
React.createElement(ClusterRecommendationItems, { clusterRecommendations: clusterRecommendations.data }))));
|
|
48
55
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CriticalSolutionsToast.d.ts","sourceRoot":"","sources":["../../../../src/components/Recommendations/CriticalSolutionsToast.tsx"],"names":[],"mappings":"AACA,OAAc,EAAE,EAAE,EAAmC,MAAM,OAAO,CAAC;AAKnE,UAAU,MAAM;CAAG;AAEnB,QAAA,MAAM,sBAAsB,EAAE,EAAE,CAAC,MAAM,CA+CtC,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Alert, AlertActionCloseButton, Button } from '@patternfly/react-core';
|
|
2
|
+
import React, { useContext, useEffect, useState } from 'react';
|
|
3
|
+
import { Trans, useTranslation } from 'react-i18next';
|
|
4
|
+
import { RulesDispatchContext, RulesStateContext } from '../../context/RulesContext';
|
|
5
|
+
import { RulesReducerConstants } from '../../reducers/RulesReducer';
|
|
6
|
+
const CriticalSolutionsToast = () => {
|
|
7
|
+
const { t } = useTranslation();
|
|
8
|
+
const [showNotification, setShowNotification] = useState(false);
|
|
9
|
+
const { rulesState } = useContext(RulesStateContext);
|
|
10
|
+
const rulesDispatch = useContext(RulesDispatchContext);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (rulesState.triggerRuleNotification && !showNotification) {
|
|
13
|
+
setShowNotification(true);
|
|
14
|
+
}
|
|
15
|
+
// eslint-disable-next-line
|
|
16
|
+
}, [rulesState.triggerRuleNotification]);
|
|
17
|
+
const onClose = () => {
|
|
18
|
+
rulesDispatch({
|
|
19
|
+
type: RulesReducerConstants.triggerRuleNotification,
|
|
20
|
+
payload: { triggerRuleNotification: false },
|
|
21
|
+
});
|
|
22
|
+
setShowNotification(false);
|
|
23
|
+
};
|
|
24
|
+
const setEAModalVisibility = (isVisible) => {
|
|
25
|
+
rulesDispatch({
|
|
26
|
+
type: RulesReducerConstants.triggerEARulesModalVisibiltyChange,
|
|
27
|
+
payload: { isRuleModalVisible: isVisible },
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
const viewCriticalSolution = () => {
|
|
31
|
+
onClose();
|
|
32
|
+
setEAModalVisibility(true);
|
|
33
|
+
};
|
|
34
|
+
if (!showNotification && !rulesState.triggerRuleNotification)
|
|
35
|
+
return null;
|
|
36
|
+
return (React.createElement(Alert, { isLiveRegion: true, variant: "success", title: t('Critical solutions have been triggered'), "data-tracking-id": "toast-view-crit-sol", actionLinks: React.createElement(Button, { isInline: true, variant: "link", onClick: viewCriticalSolution },
|
|
37
|
+
React.createElement(Trans, null, "View recommendations")), actionClose: React.createElement(AlertActionCloseButton, { variantLabel: "success alert", onClose: onClose }) }));
|
|
38
|
+
};
|
|
39
|
+
export default CriticalSolutionsToast;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InsightsResults.d.ts","sourceRoot":"","sources":["../../../../src/components/Recommendations/InsightsResults.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAgC,MAAM,0CAA0C,CAAC;AAG7G,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAwB5D,UAAU,MAAO,SAAQ,gBAAgB;IACrC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B;AASD,MAAM,WAAW,wBAAyB,SAAQ,mBAAmB;IACjE,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,OAAO,CAAC;CAClB;AAED,iBAAS,eAAe,CAAC,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"InsightsResults.d.ts","sourceRoot":"","sources":["../../../../src/components/Recommendations/InsightsResults.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAgC,MAAM,0CAA0C,CAAC;AAG7G,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAwB5D,UAAU,MAAO,SAAQ,gBAAgB;IACrC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B;AASD,MAAM,WAAW,wBAAyB,SAAQ,mBAAmB;IACjE,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,OAAO,CAAC;CAClB;AAED,iBAAS,eAAe,CAAC,KAAK,EAAE,MAAM,eA+OrC;kBA/OQ,eAAe;;;AAkPxB,eAAe,eAAe,CAAC"}
|
|
@@ -19,7 +19,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
19
19
|
return t;
|
|
20
20
|
};
|
|
21
21
|
import { search } from '@cee-eng/hydrajs';
|
|
22
|
-
import { Alert,
|
|
22
|
+
import { Alert, Button } from '@patternfly/react-core';
|
|
23
23
|
import { usePrevious } from '@rh-support/components';
|
|
24
24
|
import { getSolrParams } from '@rh-support/utils';
|
|
25
25
|
import difference from 'lodash/difference';
|
|
@@ -49,7 +49,6 @@ const defaultProps = {
|
|
|
49
49
|
function InsightsResults(props) {
|
|
50
50
|
const recommendationDispatch = useContext(RecommendationDispatchContext);
|
|
51
51
|
const { attachmentState: { includeAnalysisResults, caseFiles: { selectedLocalFiles }, }, } = useContext(AttachmentStateContext);
|
|
52
|
-
const [showNotification, setShowNotification] = useState(false);
|
|
53
52
|
const { product, version, environment, summary, issue, periodicityOfIssue, timeFramesAndUrgency } = useCaseSelector((state) => ({
|
|
54
53
|
product: state.caseDetails.product,
|
|
55
54
|
version: state.caseDetails.version,
|
|
@@ -71,19 +70,6 @@ function InsightsResults(props) {
|
|
|
71
70
|
const insightResults = flatMap(insightResultsMap);
|
|
72
71
|
const allResults = [...recommendedResults, ...insightResults];
|
|
73
72
|
const validEARules = filter(rulesState.EARules.rules, (r) => r.visible && r.rule_sub_type !== 'attachment');
|
|
74
|
-
function onClose() {
|
|
75
|
-
rulesDispatch({
|
|
76
|
-
type: RulesReducerConstants.triggerRuleNotification,
|
|
77
|
-
payload: { triggerRuleNotification: false },
|
|
78
|
-
});
|
|
79
|
-
setShowNotification(false);
|
|
80
|
-
}
|
|
81
|
-
useEffect(() => {
|
|
82
|
-
if (rulesState.triggerRuleNotification && !showNotification) {
|
|
83
|
-
setShowNotification(true);
|
|
84
|
-
}
|
|
85
|
-
// eslint-disable-next-line
|
|
86
|
-
}, [rulesState.triggerRuleNotification]);
|
|
87
73
|
// to hide notification if modal is opened from somewhere else and notification toast is visible
|
|
88
74
|
useEffect(() => {
|
|
89
75
|
if (rulesState.isRuleModalVisible && rulesState.triggerRuleNotification) {
|
|
@@ -245,12 +231,6 @@ function InsightsResults(props) {
|
|
|
245
231
|
if (isEmpty(allResults))
|
|
246
232
|
return React.createElement(React.Fragment, null);
|
|
247
233
|
return (React.createElement(React.Fragment, null,
|
|
248
|
-
showNotification && rulesState.triggerRuleNotification && (React.createElement(AlertGroup, { isToast: true },
|
|
249
|
-
React.createElement(Alert, { isLiveRegion: true, variant: "success", title: t('Critical solutions have been triggered'), "data-tracking-id": "toast-view-crit-sol", actionLinks: React.createElement(Button, { isInline: true, variant: "link", onClick: () => {
|
|
250
|
-
onClose();
|
|
251
|
-
setEAModalVisibility(true);
|
|
252
|
-
} },
|
|
253
|
-
React.createElement(Trans, null, "View recommendations")), actionClose: React.createElement(AlertActionCloseButton, { variantLabel: "success alert", onClose: onClose }) }))),
|
|
254
234
|
!rulesState.triggerRuleNotification && (React.createElement(Alert, { isInline: true, title: t('Critical solutions have been triggered'), "data-tracking-id": "inline-view-crit-sol", actionLinks: React.createElement(Button, { isInline: true, className: "pf-c-alert__action", variant: "link", onClick: () => {
|
|
255
235
|
setEAModalVisibility(true);
|
|
256
236
|
} },
|
|
@@ -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;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,
|
|
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,eAkXtD"}
|
|
@@ -293,8 +293,10 @@ export function GlobalTroubleshootEffects(props) {
|
|
|
293
293
|
const oldMajorVersion = previousVersion && getVersion(previousVersion).major;
|
|
294
294
|
const newMajorVersion = getVersion(version).major;
|
|
295
295
|
const hasCluster = isClusterIdEnabledForProduct(product, (_a = allProducts.data) === null || _a === void 0 ? void 0 : _a.productsResult);
|
|
296
|
-
|
|
297
|
-
|
|
296
|
+
// Need to check `hasCluster` is empty as when product is changing from shift product to non-shift
|
|
297
|
+
// product new product will don't have any cluster
|
|
298
|
+
const isClusterInfoShouldBeReset = !hasCluster || (hasCluster && oldMajorVersion !== newMajorVersion);
|
|
299
|
+
if (isClusterInfoShouldBeReset) {
|
|
298
300
|
setCaseDetails(caseDispatch, {
|
|
299
301
|
openshiftClusterID: '',
|
|
300
302
|
openshiftClusterVersion: '',
|
|
@@ -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,EAGlB,MAAM,iCAAiC,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;AASzC,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;IACjD,2BAA2B,EAAE,OAAO,CAAC;CACxC;AAGD,iBAAS,WAAW,CAAC,KAAK,EAAE,MAAM,eA8CjC;kBA9CQ,WAAW;;;AAgDpB,eAAe,WAAW,CAAC"}
|
|
@@ -7,6 +7,7 @@ import { RouteContext } from '../../context/RouteContext';
|
|
|
7
7
|
import { SessionRestoreStateContext } from '../../context/SessionRestoreContext';
|
|
8
8
|
import { hideFileUploadSidebarWidgetSections, showSideBarClusterIdRuleWidgetSections, showSideBarEARuleWidgetSections, } from '../../reducers/RouteConstNTypes';
|
|
9
9
|
import { FileDiag } from '../CaseInformation/FileDiag';
|
|
10
|
+
import AlertToastWrapper from '../Recommendations/AlertToastWrapper';
|
|
10
11
|
import { AsideResults } from '../Recommendations/AsideResults';
|
|
11
12
|
import ClusterRecommendations from '../Recommendations/ClusterRecommendations';
|
|
12
13
|
import { EARuleWidget } from '../Recommendations/EARules/EARuleWidget';
|
|
@@ -40,7 +41,8 @@ function WizardAside(props) {
|
|
|
40
41
|
canShowClusterIdWidgets && React.createElement(ClusterRecommendations, null),
|
|
41
42
|
canUseSessionManagement && React.createElement(SessionRestore, { routeProps: props.routeProps }),
|
|
42
43
|
React.createElement(AsideResults, null),
|
|
43
|
-
canShowFileUploadWidget() && React.createElement(FileDiag, null)
|
|
44
|
+
canShowFileUploadWidget() && React.createElement(FileDiag, null),
|
|
45
|
+
React.createElement(AlertToastWrapper, null))));
|
|
44
46
|
}
|
|
45
47
|
WizardAside.defaultProps = defaultProps;
|
|
46
48
|
export default WizardAside;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { IClusterRecommendation } from '@cee-eng/hydrajs/@types/api/pcm/preCaseDiagnostics';
|
|
2
|
-
import { IApiResponseDetails } from '@rh-support/types/shared';
|
|
3
1
|
import React from 'react';
|
|
4
|
-
import { ClusterRecommendationsDispatchType } from '../reducers/ClusterRecommendationsReducer';
|
|
2
|
+
import { ClusterRecommendationsDispatchType, IInitialClusterRecommendationsStateType } from '../reducers/ClusterRecommendationsReducer';
|
|
5
3
|
export interface IRulesStateContext {
|
|
6
|
-
|
|
4
|
+
clusterRecommendationsState: IInitialClusterRecommendationsStateType;
|
|
7
5
|
}
|
|
8
6
|
export declare const ClusterRecommendationsContext: React.Context<IRulesStateContext>;
|
|
9
7
|
export declare const ClusterRecommendationsDispatchContext: React.Context<ClusterRecommendationsDispatchType>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClusterRecommendationsContext.d.ts","sourceRoot":"","sources":["../../../src/context/ClusterRecommendationsContext.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ClusterRecommendationsContext.d.ts","sourceRoot":"","sources":["../../../src/context/ClusterRecommendationsContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,EACH,kCAAkC,EAElC,uCAAuC,EAE1C,MAAM,2CAA2C,CAAC;AAEnD,MAAM,WAAW,kBAAkB;IAC/B,2BAA2B,EAAE,uCAAuC,CAAC;CACxE;AAMD,eAAO,MAAM,6BAA6B,mCAAoD,CAAC;AAC/F,eAAO,MAAM,qCAAqC,mDAA8C,CAAC;AAEjG,wBAAgB,qCAAqC,CAAC,EAAE,QAAQ,EAAE;;CAAA,eAUjE"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React, { useReducer } from 'react';
|
|
2
|
-
import { clusterRecommendationsReducer,
|
|
2
|
+
import { clusterRecommendationsReducer, initialState, } from '../reducers/ClusterRecommendationsReducer';
|
|
3
3
|
const initialClusterIdStateContext = {
|
|
4
|
-
|
|
4
|
+
clusterRecommendationsState: initialState,
|
|
5
5
|
};
|
|
6
|
-
const
|
|
6
|
+
const initialDispatchContext = null;
|
|
7
7
|
export const ClusterRecommendationsContext = React.createContext(initialClusterIdStateContext);
|
|
8
|
-
export const ClusterRecommendationsDispatchContext = React.createContext(
|
|
8
|
+
export const ClusterRecommendationsDispatchContext = React.createContext(initialDispatchContext);
|
|
9
9
|
export function ClusterRecommendationsContextProvider({ children }) {
|
|
10
|
-
const [
|
|
11
|
-
return (React.createElement(ClusterRecommendationsContext.Provider, { value: {
|
|
10
|
+
const [clusterRecommendationsState, dispatch] = useReducer(clusterRecommendationsReducer, initialState);
|
|
11
|
+
return (React.createElement(ClusterRecommendationsContext.Provider, { value: { clusterRecommendationsState } },
|
|
12
12
|
React.createElement(ClusterRecommendationsDispatchContext.Provider, { value: dispatch }, children)));
|
|
13
13
|
}
|
|
@@ -2,13 +2,20 @@ import { IClusterRecommendation } from '@cee-eng/hydrajs/@types/api/pcm/preCaseD
|
|
|
2
2
|
import { IAction, IApiResponseDetails } from '@rh-support/types/shared';
|
|
3
3
|
export declare enum RulesReducerConstants {
|
|
4
4
|
requestClusterRecommendations = "requestClusterRecommendations",
|
|
5
|
-
resetClusterRecommendations = "resetClusterRecommendations"
|
|
5
|
+
resetClusterRecommendations = "resetClusterRecommendations",
|
|
6
|
+
toggleClusterRecommendationModal = "toggleClusterRecommendationModal"
|
|
6
7
|
}
|
|
7
|
-
declare type IActionType = IAction<RulesReducerConstants,
|
|
8
|
+
declare type IActionType = IAction<RulesReducerConstants, IInitialClusterRecommendationsStateType>;
|
|
8
9
|
export declare type ClusterRecommendationsDispatchType = (value: IActionType) => void;
|
|
9
10
|
export declare const initialClusterRecommendations: IApiResponseDetails<IClusterRecommendation[]>;
|
|
10
|
-
export
|
|
11
|
+
export interface IInitialClusterRecommendationsStateType {
|
|
12
|
+
clusterRecommendations: IApiResponseDetails<IClusterRecommendation[]>;
|
|
13
|
+
isClusterRecommendationsModalOpen: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const initialState: IInitialClusterRecommendationsStateType;
|
|
16
|
+
export declare const clusterRecommendationsReducer: (state: IInitialClusterRecommendationsStateType, action: IActionType) => IInitialClusterRecommendationsStateType;
|
|
11
17
|
export declare const resetClusterRecommendations: (dispatch: ClusterRecommendationsDispatchType) => void;
|
|
12
18
|
export declare const fetchClusterRecommendations: (dispatch: ClusterRecommendationsDispatchType, clusterId: string) => Promise<void>;
|
|
19
|
+
export declare const toggleClusterRecommendationModal: (dispatch: ClusterRecommendationsDispatchType, newModalVisibilityValue: boolean) => void;
|
|
13
20
|
export {};
|
|
14
21
|
//# sourceMappingURL=ClusterRecommendationsReducer.d.ts.map
|
|
@@ -1 +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;
|
|
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;IAC3D,gCAAgC,qCAAqC;CACxE;AAED,aAAK,WAAW,GAAG,OAAO,CAAC,qBAAqB,EAAE,uCAAuC,CAAC,CAAC;AAC3F,oBAAY,kCAAkC,GAAG,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;AAE9E,eAAO,MAAM,6BAA6B,EAAE,mBAAmB,CAAC,sBAAsB,EAAE,CAA4B,CAAC;AAErH,MAAM,WAAW,uCAAuC;IACpD,sBAAsB,EAAE,mBAAmB,CAAC,sBAAsB,EAAE,CAAC,CAAC;IACtE,iCAAiC,EAAE,OAAO,CAAC;CAC9C;AAED,eAAO,MAAM,YAAY,EAAE,uCAG1B,CAAC;AAEF,eAAO,MAAM,6BAA6B,UAC/B,uCAAuC,0BAE/C,uCAgBF,CAAC;AAGF,eAAO,MAAM,2BAA2B,aAAc,kCAAkC,SAEvF,CAAC;AACF,eAAO,MAAM,2BAA2B,aAAoB,kCAAkC,aAAa,MAAM,kBAyBhH,CAAC;AACF,eAAO,MAAM,gCAAgC,aAC/B,kCAAkC,2BACnB,OAAO,SAMnC,CAAC"}
|
|
@@ -13,16 +13,24 @@ export var RulesReducerConstants;
|
|
|
13
13
|
(function (RulesReducerConstants) {
|
|
14
14
|
RulesReducerConstants["requestClusterRecommendations"] = "requestClusterRecommendations";
|
|
15
15
|
RulesReducerConstants["resetClusterRecommendations"] = "resetClusterRecommendations";
|
|
16
|
+
RulesReducerConstants["toggleClusterRecommendationModal"] = "toggleClusterRecommendationModal";
|
|
16
17
|
})(RulesReducerConstants || (RulesReducerConstants = {}));
|
|
17
18
|
export const initialClusterRecommendations = getApiResourceObject([]);
|
|
19
|
+
export const initialState = {
|
|
20
|
+
clusterRecommendations: initialClusterRecommendations,
|
|
21
|
+
isClusterRecommendationsModalOpen: false,
|
|
22
|
+
};
|
|
18
23
|
export const clusterRecommendationsReducer = (state, action) => {
|
|
19
24
|
switch (action.type) {
|
|
20
25
|
case RulesReducerConstants.requestClusterRecommendations: {
|
|
21
|
-
return Object.assign(Object.assign({}, state), action.payload);
|
|
26
|
+
return Object.assign(Object.assign({}, state), { clusterRecommendations: action.payload.clusterRecommendations });
|
|
22
27
|
}
|
|
23
28
|
// used for reseting the rules when reseting on a new troubleshoot issue.
|
|
24
29
|
case RulesReducerConstants.resetClusterRecommendations: {
|
|
25
|
-
return Object.assign({}, initialClusterRecommendations);
|
|
30
|
+
return Object.assign(Object.assign({}, state), { clusterRecommendations: initialClusterRecommendations });
|
|
31
|
+
}
|
|
32
|
+
case RulesReducerConstants.toggleClusterRecommendationModal: {
|
|
33
|
+
return Object.assign(Object.assign({}, state), { isClusterRecommendationsModalOpen: action.payload.isClusterRecommendationsModalOpen });
|
|
26
34
|
}
|
|
27
35
|
default: {
|
|
28
36
|
return state;
|
|
@@ -37,21 +45,29 @@ export const fetchClusterRecommendations = (dispatch, clusterId) => __awaiter(vo
|
|
|
37
45
|
var _a;
|
|
38
46
|
dispatch({
|
|
39
47
|
type: RulesReducerConstants.requestClusterRecommendations,
|
|
40
|
-
payload:
|
|
48
|
+
payload: {
|
|
49
|
+
clusterRecommendations: getApiResourceObject([], true),
|
|
50
|
+
},
|
|
41
51
|
});
|
|
42
52
|
try {
|
|
43
53
|
const clusterInsight = yield pcm.preCase.diag.getClusterRecommendations(clusterId);
|
|
44
54
|
const rules = ((_a = clusterInsight === null || clusterInsight === void 0 ? void 0 : clusterInsight.report) === null || _a === void 0 ? void 0 : _a.data) || [];
|
|
45
55
|
dispatch({
|
|
46
56
|
type: RulesReducerConstants.requestClusterRecommendations,
|
|
47
|
-
payload: getApiResourceObject(rules),
|
|
57
|
+
payload: { clusterRecommendations: getApiResourceObject(rules) },
|
|
48
58
|
});
|
|
49
59
|
}
|
|
50
60
|
catch (e) {
|
|
51
61
|
console.log(e.message);
|
|
52
62
|
dispatch({
|
|
53
63
|
type: RulesReducerConstants.requestClusterRecommendations,
|
|
54
|
-
payload: getApiResourceObject([], false, true, e.message),
|
|
64
|
+
payload: { clusterRecommendations: getApiResourceObject([], false, true, e.message) },
|
|
55
65
|
});
|
|
56
66
|
}
|
|
57
67
|
});
|
|
68
|
+
export const toggleClusterRecommendationModal = (dispatch, newModalVisibilityValue) => {
|
|
69
|
+
dispatch({
|
|
70
|
+
type: RulesReducerConstants.toggleClusterRecommendationModal,
|
|
71
|
+
payload: { isClusterRecommendationsModalOpen: newModalVisibilityValue },
|
|
72
|
+
});
|
|
73
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/troubleshoot",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.49-alpha.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"@progress/kendo-react-pdf": "^3.12.0",
|
|
75
75
|
"@rh-support/api": "0.3.9",
|
|
76
76
|
"@rh-support/components": "1.1.23",
|
|
77
|
-
"@rh-support/react-context": "0.2.
|
|
77
|
+
"@rh-support/react-context": "0.2.26",
|
|
78
78
|
"@rh-support/types": "0.2.0",
|
|
79
79
|
"@rh-support/user-permissions": "0.2.17",
|
|
80
80
|
"@rh-support/utils": "0.2.15",
|
|
@@ -142,5 +142,5 @@
|
|
|
142
142
|
"not ie <= 11",
|
|
143
143
|
"not op_mini all"
|
|
144
144
|
],
|
|
145
|
-
"gitHead": "
|
|
145
|
+
"gitHead": "23944a283d785859c0a72beb4baac0d13732490f"
|
|
146
146
|
}
|