@rh-support/troubleshoot 2.6.107 → 2.6.118
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/AccountInfo/AccountSelector.js +1 -1
- package/lib/esm/components/AccountInfo/css/accountSelector.css +2 -3
- package/lib/esm/components/CaseEditView/Case.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Case.js +1 -1
- package/lib/esm/components/CaseEditView/CaseOverview/CaseOwnerInfo.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/CaseOverview/CaseOwnerInfo.js +1 -1
- package/lib/esm/components/CaseEditView/CaseOverview/CaseType.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/CaseOverview/CaseType.js +4 -2
- package/lib/esm/components/CaseEditView/CaseOverview/index.js +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseOpenshiftClusterId/CaseOpenShiftPopover.js +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/ProductVersion.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/ProductVersion.js +2 -4
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.js +1 -2
- package/lib/esm/components/CaseEditView/Tabs/CaseHistory/Timeline.css +33 -13
- package/lib/esm/components/CaseEditView/Tabs/CaseSummary/CaseSummary.js +3 -3
- package/lib/esm/components/CaseEditView/Tabs/CaseSummary/CaseSummaryErrorMessage.js +1 -1
- package/lib/esm/components/CaseInformation/Description.d.ts.map +1 -1
- package/lib/esm/components/CaseInformation/Description.js +3 -1
- package/lib/esm/components/CaseInformation/Severity.d.ts.map +1 -1
- package/lib/esm/components/CaseInformation/Severity.js +1 -1
- package/lib/esm/components/CaseInformation/SupportLevel.d.ts.map +1 -1
- package/lib/esm/components/CaseInformation/SupportLevel.js +1 -1
- package/lib/esm/components/CaseManagement/OpenshiftDropdownV4.d.ts.map +1 -1
- package/lib/esm/components/CaseManagement/OpenshiftDropdownV4.js +6 -12
- package/lib/esm/components/OpenCase/OpenCase.d.ts.map +1 -1
- package/lib/esm/components/OpenCase/OpenCase.js +2 -8
- package/lib/esm/components/ProductSelector/AllProductsSelector.d.ts.map +1 -1
- package/lib/esm/components/ProductSelector/AllProductsSelector.js +6 -18
- package/lib/esm/components/ProductSelector/ProductSelector.d.ts.map +1 -1
- package/lib/esm/components/ProductSelector/ProductSelector.js +5 -12
- package/lib/esm/components/Recommendations/ClusterRecommendationItems.d.ts +0 -2
- package/lib/esm/components/Recommendations/ClusterRecommendationItems.d.ts.map +1 -1
- package/lib/esm/components/Recommendations/ClusterRecommendationItems.js +13 -16
- package/lib/esm/components/Recommendations/ClusterRecommendations.d.ts.map +1 -1
- package/lib/esm/components/Recommendations/ClusterRecommendations.js +4 -1
- package/lib/esm/components/Recommendations/Recommendations.d.ts.map +1 -1
- package/lib/esm/components/Recommendations/Recommendations.js +38 -38
- package/lib/esm/components/RemoteRider/RemoteRiderAcceptanceModal.d.ts.map +1 -1
- package/lib/esm/components/Review/Review.d.ts.map +1 -1
- package/lib/esm/components/Review/Review.js +1 -5
- package/lib/esm/components/Suggestions/TopContentSidebar.d.ts +3 -0
- package/lib/esm/components/Suggestions/TopContentSidebar.d.ts.map +1 -0
- package/lib/esm/components/Suggestions/TopContentSidebar.js +26 -0
- package/lib/esm/components/TroubleshootSection/AskRedHat.js +1 -1
- package/lib/esm/components/TroubleshootSection/TroubleshootSection.d.ts +9 -0
- package/lib/esm/components/TroubleshootSection/TroubleshootSection.d.ts.map +1 -1
- package/lib/esm/components/TroubleshootSection/TroubleshootSection.js +150 -44
- package/lib/esm/components/shared/useIsSectionValid.d.ts.map +1 -1
- package/lib/esm/components/shared/useIsSectionValid.js +26 -65
- package/lib/esm/components/wizardLayout/WizardAside.d.ts.map +1 -1
- package/lib/esm/components/wizardLayout/WizardAside.js +18 -9
- package/lib/esm/components/wizardLayout/WizardMain.d.ts.map +1 -1
- package/lib/esm/components/wizardLayout/WizardMain.js +110 -64
- package/lib/esm/components/wizardLayout/WizardNavigation.d.ts.map +1 -1
- package/lib/esm/components/wizardLayout/WizardNavigation.js +59 -53
- package/lib/esm/css/AskRedHat.css +9 -2
- package/lib/esm/css/app.css +1 -1
- package/lib/esm/hooks/useAB.d.ts +22 -0
- package/lib/esm/hooks/useAB.d.ts.map +1 -0
- package/lib/esm/hooks/useAB.js +37 -0
- package/lib/esm/hooks/useWizard.d.ts +4 -0
- package/lib/esm/hooks/useWizard.d.ts.map +1 -1
- package/lib/esm/hooks/useWizard.js +20 -6
- package/lib/esm/reducers/AIResponseConstNTypes.d.ts +17 -2
- package/lib/esm/reducers/AIResponseConstNTypes.d.ts.map +1 -1
- package/lib/esm/reducers/AIResponseConstNTypes.js +3 -0
- package/lib/esm/reducers/AIResponseReducer.d.ts +2 -0
- package/lib/esm/reducers/AIResponseReducer.d.ts.map +1 -1
- package/lib/esm/reducers/AIResponseReducer.js +17 -0
- package/lib/esm/reducers/CaseConstNTypes.js +3 -3
- package/lib/esm/reducers/CaseDiscussionTabReducer.js +1 -1
- package/lib/esm/reducers/CaseHelpers.d.ts +1 -2
- package/lib/esm/reducers/CaseHelpers.d.ts.map +1 -1
- package/lib/esm/reducers/CaseHelpers.js +1 -11
- package/lib/esm/reducers/RouteConstNTypes.d.ts.map +1 -1
- package/lib/esm/reducers/RouteConstNTypes.js +0 -1
- package/lib/esm/scss/_pf-overrides.scss +2 -23
- package/package.json +9 -7
|
@@ -18,6 +18,7 @@ import { useCaseSelector } from '../../context/CaseContext';
|
|
|
18
18
|
import { RecommendationStateContext } from '../../context/RecommendationContext';
|
|
19
19
|
import { RouteContext, useRouteDispatchContext } from '../../context/RouteContext';
|
|
20
20
|
import { TCStateContext } from '../../context/TopContentContext';
|
|
21
|
+
import { useAB } from '../../hooks/useAB';
|
|
21
22
|
import { CASE_DEATILS_ENVIRONMENT_LIMIT, CASE_REFERENCE_NUMBER_LIMIT, CONTACT_INFO_24X7_LIMIT, HOSTNAME_LENGTH_LIMIT, ISSUE_SUMMARY_LENGTH_LIMIT, KTQUESTION_MAX_LIMIT, TITLE_SUMMARY_LENGTH_LIMIT, } from '../../reducers/CaseConstNTypes';
|
|
22
23
|
import { isCaseInformationSectionValid, isCaseManagementStateValid, isCaseStateValid, isClusterIDValid, isIdeaCaseStateValid, } from '../../reducers/CaseHelpers';
|
|
23
24
|
import { AppRouteSections } from '../../reducers/RouteConstNTypes';
|
|
@@ -25,7 +26,8 @@ import { setNoValidEntitlement } from '../../reducers/RouteReducer';
|
|
|
25
26
|
import { AttachmentStateContext } from './fileUpload/reducer/AttachmentReducerContext';
|
|
26
27
|
export function useIsSectionValid(sectionName) {
|
|
27
28
|
var _a, _b;
|
|
28
|
-
const {
|
|
29
|
+
const { isVariationA } = useAB();
|
|
30
|
+
const { caseState, caseType, product, version, contactSSOName, accountNumber, summary, hostname, contactInfo24x7, alternateId, selectedAccountDetails, issue, environment, timeFramesAndUrgency, periodicityOfIssue, ssoUsername, manageSupportCases, } = useCaseSelector((state) => ({
|
|
29
31
|
caseState: state,
|
|
30
32
|
caseType: state.caseDetails.caseType,
|
|
31
33
|
product: state.caseDetails.product,
|
|
@@ -41,7 +43,6 @@ export function useIsSectionValid(sectionName) {
|
|
|
41
43
|
environment: state.caseDetails.environment,
|
|
42
44
|
timeFramesAndUrgency: state.caseDetails.timeFramesAndUrgency,
|
|
43
45
|
periodicityOfIssue: state.caseDetails.periodicityOfIssue,
|
|
44
|
-
ABTestVariation: state.ABTestVariation,
|
|
45
46
|
ssoUsername: state.selectedOwner.data.ssoUsername,
|
|
46
47
|
manageSupportCases: state.selectedOwner.data.manageSupportCases,
|
|
47
48
|
}), isEqual);
|
|
@@ -66,8 +67,6 @@ export function useIsSectionValid(sectionName) {
|
|
|
66
67
|
fetchContactDetails();
|
|
67
68
|
}, [ssoUsername, routeDispatch]);
|
|
68
69
|
//&seSessionId=8e8960ac-680b-443e-bf67-9e13f2acd64e
|
|
69
|
-
const isATestvariation = ABTestVariation === 'A';
|
|
70
|
-
const isBTestvariation = ABTestVariation === 'B' || isEmpty(ABTestVariation);
|
|
71
70
|
const { routeState: { isCaseCreate }, } = useContext(RouteContext);
|
|
72
71
|
const { globalMetadataState: { allProducts, loggedInUserJwtToken }, } = useContext(GlobalMetadataStateContext);
|
|
73
72
|
const { topContentState: { topContent }, } = useContext(TCStateContext);
|
|
@@ -92,54 +91,34 @@ export function useIsSectionValid(sectionName) {
|
|
|
92
91
|
!isEmpty(contactSSOName) &&
|
|
93
92
|
!selectedAccountDetails.data.subscriptionAbuse &&
|
|
94
93
|
(manageSupportCases !== null && manageSupportCases !== void 0 ? manageSupportCases : true) &&
|
|
95
|
-
(isEntitlement !== null && isEntitlement !== void 0 ? isEntitlement : true)
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
94
|
+
(isEntitlement !== null && isEntitlement !== void 0 ? isEntitlement : true) &&
|
|
95
|
+
!isEmpty(product) &&
|
|
96
|
+
!isEmpty(version);
|
|
99
97
|
return isValid;
|
|
100
98
|
};
|
|
101
99
|
const isSummarizeSectionValid = () => {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
!isEmpty(version) &&
|
|
111
|
-
!isEmpty(summary) &&
|
|
112
|
-
!isEmpty(issue);
|
|
113
|
-
return isValid;
|
|
114
|
-
}
|
|
115
|
-
if (isATestvariation) {
|
|
116
|
-
let isValid = !allProducts.isFetching &&
|
|
117
|
-
!allProducts.isError &&
|
|
118
|
-
!topContent.isFetching &&
|
|
119
|
-
!recommendationState.isLoadingRecommendations &&
|
|
120
|
-
(summary === null || summary === void 0 ? void 0 : summary.length) <= TITLE_SUMMARY_LENGTH_LIMIT &&
|
|
121
|
-
(issue === null || issue === void 0 ? void 0 : issue.length) <= ISSUE_SUMMARY_LENGTH_LIMIT &&
|
|
122
|
-
!isEmpty(summary) &&
|
|
123
|
-
!isEmpty(issue);
|
|
124
|
-
return isValid;
|
|
125
|
-
}
|
|
100
|
+
let isValid = !allProducts.isFetching &&
|
|
101
|
+
!allProducts.isError &&
|
|
102
|
+
!topContent.isFetching &&
|
|
103
|
+
!recommendationState.isLoadingRecommendations &&
|
|
104
|
+
(summary === null || summary === void 0 ? void 0 : summary.length) <= TITLE_SUMMARY_LENGTH_LIMIT &&
|
|
105
|
+
(issue === null || issue === void 0 ? void 0 : issue.length) <= ISSUE_SUMMARY_LENGTH_LIMIT &&
|
|
106
|
+
!isEmpty(summary) &&
|
|
107
|
+
!isEmpty(issue);
|
|
126
108
|
if (isCaseCreate) {
|
|
127
109
|
//because on the summarize page for troubleshoot flow we have only product version and owner
|
|
128
|
-
|
|
129
|
-
!allProducts.
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
!isEmpty(accountNumber) &&
|
|
136
|
-
!isEmpty(contactSSOName) &&
|
|
137
|
-
!isEmpty(version);
|
|
138
|
-
return isValid;
|
|
110
|
+
isValid =
|
|
111
|
+
!allProducts.isFetching &&
|
|
112
|
+
!allProducts.isError &&
|
|
113
|
+
!isEmpty(product) &&
|
|
114
|
+
!isEmpty(accountNumber) &&
|
|
115
|
+
!isEmpty(contactSSOName) &&
|
|
116
|
+
!isEmpty(version);
|
|
139
117
|
}
|
|
140
118
|
else if (!isCaseCreate) {
|
|
141
119
|
return !isEmpty(product) && !isEmpty(version) && !isEmpty(accountNumber) && !isEmpty(contactSSOName);
|
|
142
120
|
}
|
|
121
|
+
return isValid;
|
|
143
122
|
};
|
|
144
123
|
const isCaseConfigurationSectionValid = () => {
|
|
145
124
|
const hasContactInfo24x7ValidLength = contactInfo24x7
|
|
@@ -151,30 +130,12 @@ export function useIsSectionValid(sectionName) {
|
|
|
151
130
|
hasAlternateCaseIdValidLength);
|
|
152
131
|
};
|
|
153
132
|
const isResourcesSectionValid = () => {
|
|
154
|
-
var _a
|
|
155
|
-
if (isBTestvariation) {
|
|
156
|
-
//if we are in the new experience and user is troubleshoot we give them those validity fields
|
|
157
|
-
if (!isCaseCreate) {
|
|
158
|
-
let isValid = !allProducts.isFetching &&
|
|
159
|
-
!allProducts.isError &&
|
|
160
|
-
!topContent.isFetching &&
|
|
161
|
-
!recommendationState.isLoadingRecommendations &&
|
|
162
|
-
(summary === null || summary === void 0 ? void 0 : summary.length) <= TITLE_SUMMARY_LENGTH_LIMIT &&
|
|
163
|
-
(issue === null || issue === void 0 ? void 0 : issue.length) <= ISSUE_SUMMARY_LENGTH_LIMIT &&
|
|
164
|
-
!isEmpty(product) &&
|
|
165
|
-
!isEmpty(version) &&
|
|
166
|
-
!isEmpty(summary) &&
|
|
167
|
-
!isEmpty(issue) &&
|
|
168
|
-
isEntitlement === true &&
|
|
169
|
-
isClusterIDValid(caseState, (_a = allProducts.data) === null || _a === void 0 ? void 0 : _a.productsResult);
|
|
170
|
-
return isValid;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
133
|
+
var _a;
|
|
173
134
|
// don't check for entitled product if user is on search intent flow
|
|
174
135
|
const isEntitledProductLocal = isSearchIntent ? true : isEntitledProduct;
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
136
|
+
// Skip cluster ID validation for Variant A
|
|
137
|
+
const clusterIdValid = isVariationA ? true : isClusterIDValid(caseState, (_a = allProducts.data) === null || _a === void 0 ? void 0 : _a.productsResult);
|
|
138
|
+
return !recommendationState.isLoadingRecommendations && isEntitledProductLocal && clusterIdValid;
|
|
178
139
|
};
|
|
179
140
|
const isReviewSectionValid = () => {
|
|
180
141
|
var _a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardAside.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/WizardAside.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"WizardAside.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/WizardAside.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAMvD,OAAO,EAGH,eAAe,EAIlB,MAAM,iCAAiC,CAAC;AASzC,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;IACjD,2BAA2B,EAAE,OAAO,CAAC;CACxC;AAED,iBAAS,WAAW,CAAC,KAAK,EAAE,MAAM,qBAgEjC;kBAhEQ,WAAW;;;AAkEpB,eAAe,WAAW,CAAC"}
|
|
@@ -5,7 +5,9 @@ import isUndefined from 'lodash/isUndefined';
|
|
|
5
5
|
import React, { useContext } from 'react';
|
|
6
6
|
import { useCaseSelector } from '../../context/CaseContext';
|
|
7
7
|
import { RouteContext } from '../../context/RouteContext';
|
|
8
|
-
import {
|
|
8
|
+
import { TCStateContext } from '../../context/TopContentContext';
|
|
9
|
+
import { useAB } from '../../hooks/useAB';
|
|
10
|
+
import { AppRouteSections, hideFileUploadSidebarWidgetSections, showSideBarClusterIdRuleWidgetSections, showSideBarEARuleWidgetSectionsExperienceA, showSideBarFileRecommendationSections, } from '../../reducers/RouteConstNTypes';
|
|
9
11
|
import { FileDiag } from '../CaseInformation/FileDiag';
|
|
10
12
|
import { CveSidebar } from '../Cve/CveSidebar';
|
|
11
13
|
import { AsideResults } from '../Recommendations/AsideResults';
|
|
@@ -13,28 +15,34 @@ import ClusterRecommendations from '../Recommendations/ClusterRecommendations';
|
|
|
13
15
|
import { EARuleWidget } from '../Recommendations/EARules/EARuleWidget';
|
|
14
16
|
import InsightsResults from '../Recommendations/InsightsResults';
|
|
15
17
|
import { SessionRestore } from '../SessionRestore';
|
|
18
|
+
import TopContentSidebar from '../Suggestions/TopContentSidebar';
|
|
16
19
|
const defaultProps = {};
|
|
17
20
|
function WizardAside(props) {
|
|
21
|
+
const { isVariationA } = useAB();
|
|
18
22
|
const { routeState: { activeSection, isCaseCreate }, } = useContext(RouteContext);
|
|
23
|
+
const { topContentState: { topContent }, } = useContext(TCStateContext);
|
|
19
24
|
const canAddAttachments = ability.can(resourceActions.PATCH, resources.CASE_CREATE, CaseListFields.ATTACHMENTS);
|
|
20
|
-
const { isCreatingCase, caseType, isCveModalOpened
|
|
25
|
+
const { isCreatingCase, caseType, isCveModalOpened } = useCaseSelector((state) => ({
|
|
21
26
|
isCreatingCase: state.isCreatingCase,
|
|
22
27
|
caseType: state.caseDetails.caseType,
|
|
23
28
|
isCveModalOpened: state.isCveModalOpened,
|
|
24
|
-
ABTestVariation: state.ABTestVariation,
|
|
25
29
|
}), isEqual);
|
|
26
|
-
const isATestvariation = ABTestVariation === 'A';
|
|
27
30
|
const isIdea = caseType === PreviousCaseTypes.FEATURE_ENHANCEMENT;
|
|
28
31
|
const canUseSessionManagement = ability.can(resourceActions.CREATE, resources.SESSION_TRACKING);
|
|
29
32
|
const canShowFileUploadWidget = () => canAddAttachments &&
|
|
30
33
|
!props.isAttachmentUploadModalOpen &&
|
|
31
34
|
!isUndefined(activeSection) &&
|
|
32
35
|
!hideFileUploadSidebarWidgetSections.includes(activeSection);
|
|
33
|
-
const canShowEARuleWidget =
|
|
36
|
+
const canShowEARuleWidget = activeSection
|
|
34
37
|
? showSideBarEARuleWidgetSectionsExperienceA.includes(activeSection)
|
|
35
|
-
:
|
|
36
|
-
const canShowClusterIdReportWidget =
|
|
37
|
-
|
|
38
|
+
: false;
|
|
39
|
+
const canShowClusterIdReportWidget = activeSection
|
|
40
|
+
? showSideBarClusterIdRuleWidgetSections.includes(activeSection)
|
|
41
|
+
: false;
|
|
42
|
+
const canShowFileRecommendationSectionsWidget = activeSection
|
|
43
|
+
? showSideBarFileRecommendationSections.includes(activeSection)
|
|
44
|
+
: false;
|
|
45
|
+
const showTopContentSidebar = isVariationA && activeSection === AppRouteSections.RESOURCES && topContent.data.length === 0;
|
|
38
46
|
return (React.createElement("aside", null,
|
|
39
47
|
React.createElement("section", { className: "grid-aside-content" },
|
|
40
48
|
canUseSessionManagement && !isCreatingCase && activeSection !== AppRouteSections.SUBMIT_CASE && (React.createElement(SessionRestore, { routeProps: props.routeProps })),
|
|
@@ -46,7 +54,8 @@ function WizardAside(props) {
|
|
|
46
54
|
canShowEARuleWidget && React.createElement(EARuleWidget, null),
|
|
47
55
|
!(isIdea && activeSection === 'submit-case') && (React.createElement(AsideResults, { routeProps: props.routeProps, className: "pf-v6-u-mb-md" })),
|
|
48
56
|
canShowFileRecommendationSectionsWidget && React.createElement(InsightsResults, { isDisplayOnMain: true }),
|
|
49
|
-
React.createElement(ClusterRecommendations, { showClusterRecommendationsList: canShowClusterIdReportWidget, className: "pf-v6-u-mb-md" })
|
|
57
|
+
React.createElement(ClusterRecommendations, { showClusterRecommendationsList: canShowClusterIdReportWidget, className: "pf-v6-u-mb-md" }),
|
|
58
|
+
showTopContentSidebar && React.createElement(TopContentSidebar, null))));
|
|
50
59
|
}
|
|
51
60
|
WizardAside.defaultProps = defaultProps;
|
|
52
61
|
export default WizardAside;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardMain.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/WizardMain.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WizardMain.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/WizardMain.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,cAAc,EAAkE,MAAM,OAAO,CAAC;AAExH,OAAO,EAAS,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAY9D,OAAO,EAAoB,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAcpF,eAAO,MAAM,iBAAiB,aAAc,MAAM,KAAG,MAEpD,CAAC;AAEF,eAAO,MAAM,sBAAsB,kBAAmB,MAAM,YAAY,MAAM,QAAQ,MAAM,KAAG,MAqB9F,CAAC;AAGF,eAAO,MAAM,kBAAkB,kBACZ,MAAM,WACZ,MAAM,GAAG,SAAS,WAClB,MAAM,GAAG,SAAS,WAClB,MAAM,GAAG,SAAS,SACpB,MAAM,GAAG,SAAS,YACf,MAAM,QACV,MAAM,KACb,MAwCF,CAAC;AACF,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;IACjD,qBAAqB,EAAE,CAAC,cAAc,EAAE,OAAO,KAAK,IAAI,CAAC;IACzD,mBAAmB,EAAE,CAAC,gCAAgC,EAAE,OAAO,KAAK,IAAI,CAAC;IACzE,YAAY,EAAE,OAAO,CAAC;IACtB,eAAe,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACnD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,sBAAsB,CAAC,EAAE,OAAO,CAAC;CACpC;AAED,iBAAS,UAAU,CAAC,KAAK,EAAE,MAAM,qBA8ZhC;AACD,eAAe,UAAU,CAAC"}
|
|
@@ -22,9 +22,10 @@ import { Env } from '@cee-eng/hydrajs';
|
|
|
22
22
|
import { getRHDirectHealthCheck, getRHDirectStatusCheck, } from '@ifd-ui/ask-redhat-core';
|
|
23
23
|
import { Wizard, WizardNav, WizardNavItem, WizardStep, } from '@patternfly/react-core';
|
|
24
24
|
import { LoadingIndicator } from '@rh-support/components';
|
|
25
|
+
import isEmpty from 'lodash/isEmpty';
|
|
25
26
|
import isEqual from 'lodash/isEqual';
|
|
26
27
|
import trim from 'lodash/trim';
|
|
27
|
-
import React, { Suspense, useContext, useEffect, useRef, useState } from 'react';
|
|
28
|
+
import React, { Suspense, useCallback, useContext, useEffect, useRef, useState } from 'react';
|
|
28
29
|
import { useTranslation } from 'react-i18next';
|
|
29
30
|
import { Route } from 'react-router-dom';
|
|
30
31
|
import { useAIResponseState } from '../../context/AIResponseContext';
|
|
@@ -32,6 +33,7 @@ import { useCaseSelector } from '../../context/CaseContext';
|
|
|
32
33
|
import { RecommendationDispatchContext } from '../../context/RecommendationContext';
|
|
33
34
|
import { RouteContext, RouteDispatchContext } from '../../context/RouteContext';
|
|
34
35
|
import { SessionRestoreDispatchContext, SessionRestoreStateContext } from '../../context/SessionRestoreContext';
|
|
36
|
+
import { useAB } from '../../hooks/useAB';
|
|
35
37
|
import { useARHResponse } from '../../hooks/useARHResponse';
|
|
36
38
|
import { useWizard } from '../../hooks/useWizard';
|
|
37
39
|
import { appSourceId_ARH, excludedCaseTypesforARH } from '../../reducers/CaseConstNTypes';
|
|
@@ -88,7 +90,8 @@ export const generateAIQuestion = (activeSection, product, version, summary, iss
|
|
|
88
90
|
return `${prefix} ${baseMessageMap[lang] || baseMessageMap.en}`;
|
|
89
91
|
};
|
|
90
92
|
function WizardMain(props) {
|
|
91
|
-
var _a, _b, _c;
|
|
93
|
+
var _a, _b, _c, _d;
|
|
94
|
+
const { isVariationA } = useAB();
|
|
92
95
|
const [showRestFlag, setShowRestFlag] = useState(false);
|
|
93
96
|
const [aiServicesAvailable, setAIServicesAvailable] = useState(false); // default to false until services are confirmed available
|
|
94
97
|
const recommendationDispatch = useContext(RecommendationDispatchContext);
|
|
@@ -101,24 +104,6 @@ function WizardMain(props) {
|
|
|
101
104
|
}), isEqual);
|
|
102
105
|
const { routeState: { isCaseCreate, activeSection }, } = useContext(RouteContext);
|
|
103
106
|
const aiResponseState = useAIResponseState();
|
|
104
|
-
const config = {
|
|
105
|
-
appSourceId: appSourceId_ARH,
|
|
106
|
-
authToken: (_b = (_a = window === null || window === void 0 ? void 0 : window.sessionjs) === null || _a === void 0 ? void 0 : _a.getEncodedToken()) !== null && _b !== void 0 ? _b : '',
|
|
107
|
-
packageVersion: (_c = window === null || window === void 0 ? void 0 : window.supportVersionInfo) === null || _c === void 0 ? void 0 : _c.packageVersion,
|
|
108
|
-
appEnv: Env.getEnvName(),
|
|
109
|
-
};
|
|
110
|
-
const { fetchARHResponse } = useARHResponse({
|
|
111
|
-
activeSection,
|
|
112
|
-
product: caseDetails.product,
|
|
113
|
-
version: caseDetails.version,
|
|
114
|
-
summary: caseDetails.summary,
|
|
115
|
-
issue: caseDetails.issue,
|
|
116
|
-
caseType: caseDetails.caseType,
|
|
117
|
-
config,
|
|
118
|
-
});
|
|
119
|
-
const isTroubleshootSection = activeSection === AppRouteSections.TROUBLESHOOT;
|
|
120
|
-
const isResourcesSection = activeSection === AppRouteSections.RESOURCES;
|
|
121
|
-
const isSummarizeSection = activeSection === AppRouteSections.SUMMARIZE;
|
|
122
107
|
const [userSeenRecommendations, setUserSeenRecommendations] = useState(false);
|
|
123
108
|
const [userClickedNextonRecommendations, setUserClickedNextonRecommendations] = useState(false);
|
|
124
109
|
const [userScrolledLabel, setUserScrolledLabel] = useState(false);
|
|
@@ -127,17 +112,68 @@ function WizardMain(props) {
|
|
|
127
112
|
const isNextButtonClickedRef = useRef(false);
|
|
128
113
|
const isBackButtonClickedRef = useRef(false);
|
|
129
114
|
const resultsRowRef = useRef(null);
|
|
115
|
+
const goToPrevStepRef = useRef(null);
|
|
116
|
+
//to track the previous ARH fields
|
|
130
117
|
const previousARHFieldsRef = useRef({
|
|
131
|
-
product:
|
|
132
|
-
version:
|
|
133
|
-
summary:
|
|
134
|
-
issue:
|
|
135
|
-
caseType:
|
|
118
|
+
product: '',
|
|
119
|
+
version: '',
|
|
120
|
+
summary: '',
|
|
121
|
+
issue: '',
|
|
122
|
+
caseType: '',
|
|
136
123
|
});
|
|
137
124
|
const haveARHFieldsChangedRef = useRef(false);
|
|
138
125
|
const handleChatWithAIClick = () => {
|
|
139
126
|
props.setIsAIChatMode(true);
|
|
140
127
|
};
|
|
128
|
+
const handleOnBackForExpandedARH = (e) => {
|
|
129
|
+
if (goToPrevStepRef.current) {
|
|
130
|
+
isBackButtonClickedRef.current = true;
|
|
131
|
+
goToPrevStepRef.current(e);
|
|
132
|
+
focusWizardMainPanel();
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
// Callback for TroubleshootSection to reset the flag on unmount
|
|
136
|
+
const resetARHFieldsChanged = useCallback(() => {
|
|
137
|
+
haveARHFieldsChangedRef.current = false;
|
|
138
|
+
}, []);
|
|
139
|
+
// Check if any of the ARH-related fields have changed
|
|
140
|
+
useEffect(() => {
|
|
141
|
+
var _a;
|
|
142
|
+
const prev = previousARHFieldsRef.current;
|
|
143
|
+
const curr = {
|
|
144
|
+
product: caseDetails.product,
|
|
145
|
+
version: caseDetails.version,
|
|
146
|
+
summary: trim(caseDetails.summary),
|
|
147
|
+
issue: trim(caseDetails.issue),
|
|
148
|
+
caseType: caseDetails.caseType,
|
|
149
|
+
};
|
|
150
|
+
const hasChanged = prev.product !== curr.product ||
|
|
151
|
+
prev.version !== curr.version ||
|
|
152
|
+
prev.summary !== curr.summary ||
|
|
153
|
+
prev.issue !== curr.issue ||
|
|
154
|
+
prev.caseType !== curr.caseType;
|
|
155
|
+
if (hasChanged) {
|
|
156
|
+
const previousHadValues = !isEmpty(prev.product) || !isEmpty(prev.version) || !isEmpty(prev.summary) || !isEmpty(prev.issue);
|
|
157
|
+
const hasExistingConversation = !isEmpty((_a = aiResponseState.aiResponse) === null || _a === void 0 ? void 0 : _a.conversationId);
|
|
158
|
+
if (previousHadValues && hasExistingConversation) {
|
|
159
|
+
haveARHFieldsChangedRef.current = true;
|
|
160
|
+
}
|
|
161
|
+
previousARHFieldsRef.current = {
|
|
162
|
+
product: curr.product,
|
|
163
|
+
version: curr.version,
|
|
164
|
+
summary: curr.summary,
|
|
165
|
+
issue: curr.issue,
|
|
166
|
+
caseType: curr.caseType,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
}, [
|
|
170
|
+
caseDetails.product,
|
|
171
|
+
caseDetails.version,
|
|
172
|
+
caseDetails.summary,
|
|
173
|
+
caseDetails.issue,
|
|
174
|
+
caseDetails.caseType,
|
|
175
|
+
(_a = aiResponseState.aiResponse) === null || _a === void 0 ? void 0 : _a.conversationId,
|
|
176
|
+
]);
|
|
141
177
|
const { getStepsSequece } = useWizard(props.routeProps, {
|
|
142
178
|
userSeenRecommendationsfn: setUserSeenRecommendations,
|
|
143
179
|
userSeenRecommendationsValue: userSeenRecommendations,
|
|
@@ -151,47 +187,15 @@ function WizardMain(props) {
|
|
|
151
187
|
aiServicesAvailable: aiServicesAvailable,
|
|
152
188
|
isSecureSupport: props.isSecureSupport,
|
|
153
189
|
hasConfirmedStatesideSupport: props.hasConfirmedStatesideSupport,
|
|
190
|
+
onBack: handleOnBackForExpandedARH,
|
|
191
|
+
haveARHFieldsChanged: haveARHFieldsChangedRef.current,
|
|
192
|
+
resetARHFieldsChanged,
|
|
154
193
|
});
|
|
155
194
|
const dispatchToRouteReducer = useContext(RouteDispatchContext);
|
|
156
195
|
const { t } = useTranslation();
|
|
157
196
|
useEffect(() => {
|
|
158
197
|
setActiveSectionChanged(dispatchToRouteReducer, isCaseCreate ? AppRouteSections.GET_SUPPORT : AppRouteSections.TROUBLESHOOT, '');
|
|
159
198
|
}, [isCaseCreate, dispatchToRouteReducer]);
|
|
160
|
-
const shouldEnableARHServices = () => {
|
|
161
|
-
// Check if the current section is relevant for AI services
|
|
162
|
-
const isRelevantSection = isTroubleshootSection || isSummarizeSection || isResourcesSection;
|
|
163
|
-
// Check if the case type is allowed (not in the excluded list)
|
|
164
|
-
const isCaseTypeAllowed = !excludedCaseTypesforARH.includes(caseDetails.caseType || '');
|
|
165
|
-
// Check if user is not a secure support or confirmed stateside support user
|
|
166
|
-
const isNotSecureOrStatesideUser = !props.isSecureSupport && !props.hasConfirmedStatesideSupport;
|
|
167
|
-
// Check if the ARH fields have changed
|
|
168
|
-
const isARHFieldsChanged = haveARHFieldsChangedRef.current;
|
|
169
|
-
// Check if user is external and has invalid entitlements
|
|
170
|
-
const isNotUnentitledExternalUser = !(props.isUserExternal && props.hasInvalidEntitlements);
|
|
171
|
-
return (isRelevantSection &&
|
|
172
|
-
isCaseTypeAllowed &&
|
|
173
|
-
isNotSecureOrStatesideUser &&
|
|
174
|
-
isARHFieldsChanged &&
|
|
175
|
-
isNotUnentitledExternalUser);
|
|
176
|
-
};
|
|
177
|
-
// Check if any of the ARH-related fields have changed
|
|
178
|
-
useEffect(() => {
|
|
179
|
-
const hasChanged = previousARHFieldsRef.current.product !== caseDetails.product ||
|
|
180
|
-
previousARHFieldsRef.current.version !== caseDetails.version ||
|
|
181
|
-
previousARHFieldsRef.current.summary !== trim(caseDetails.summary) ||
|
|
182
|
-
previousARHFieldsRef.current.issue !== trim(caseDetails.issue) ||
|
|
183
|
-
previousARHFieldsRef.current.caseType !== caseDetails.caseType;
|
|
184
|
-
if (hasChanged) {
|
|
185
|
-
previousARHFieldsRef.current = {
|
|
186
|
-
product: caseDetails.product,
|
|
187
|
-
version: caseDetails.version,
|
|
188
|
-
summary: caseDetails.summary,
|
|
189
|
-
issue: caseDetails.issue,
|
|
190
|
-
caseType: caseDetails.caseType,
|
|
191
|
-
};
|
|
192
|
-
haveARHFieldsChangedRef.current = true;
|
|
193
|
-
}
|
|
194
|
-
}, [caseDetails.product, caseDetails.version, caseDetails.summary, caseDetails.issue, caseDetails.caseType]);
|
|
195
199
|
useEffect(() => {
|
|
196
200
|
if (!activeSection) {
|
|
197
201
|
return;
|
|
@@ -247,10 +251,10 @@ function WizardMain(props) {
|
|
|
247
251
|
RouteUtils.navigateToSection(props.routeProps, `${props.routeProps.location.pathname}/${step.id}`, false);
|
|
248
252
|
};
|
|
249
253
|
const onBack = (step, prevStep) => {
|
|
250
|
-
// isLoadingRecommendations needs to be set to false
|
|
251
|
-
//
|
|
254
|
+
// isLoadingRecommendations needs to be set to false when going back TO the summary step
|
|
255
|
+
// because it can cause the next button to be permanently disabled if the debounce is not called
|
|
252
256
|
// before going back a step. This can be caused if navigating quickly to then away from the recommendations page.
|
|
253
|
-
if (
|
|
257
|
+
if (step.id === AppRouteSections.SUMMARIZE) {
|
|
254
258
|
recommendationDispatch({
|
|
255
259
|
type: RecommendationsConstants.setIsLoadingRecommendations,
|
|
256
260
|
payload: { isLoadingRecommendations: false },
|
|
@@ -264,6 +268,47 @@ function WizardMain(props) {
|
|
|
264
268
|
props.submitCaseAndNavigate(false);
|
|
265
269
|
return;
|
|
266
270
|
};
|
|
271
|
+
const config = {
|
|
272
|
+
appSourceId: appSourceId_ARH,
|
|
273
|
+
authToken: (_c = (_b = window === null || window === void 0 ? void 0 : window.sessionjs) === null || _b === void 0 ? void 0 : _b.getEncodedToken()) !== null && _c !== void 0 ? _c : '',
|
|
274
|
+
packageVersion: (_d = window === null || window === void 0 ? void 0 : window.supportVersionInfo) === null || _d === void 0 ? void 0 : _d.packageVersion,
|
|
275
|
+
appEnv: Env.getEnvName(),
|
|
276
|
+
};
|
|
277
|
+
const { fetchARHResponse } = useARHResponse({
|
|
278
|
+
activeSection,
|
|
279
|
+
product: caseDetails.product,
|
|
280
|
+
version: caseDetails.version,
|
|
281
|
+
summary: caseDetails.summary,
|
|
282
|
+
issue: caseDetails.issue,
|
|
283
|
+
caseType: caseDetails.caseType,
|
|
284
|
+
config,
|
|
285
|
+
});
|
|
286
|
+
const isTroubleshootSection = activeSection === AppRouteSections.TROUBLESHOOT;
|
|
287
|
+
const isResourcesSection = activeSection === AppRouteSections.RESOURCES;
|
|
288
|
+
const isSummarizeSection = activeSection === AppRouteSections.SUMMARIZE;
|
|
289
|
+
const shouldEnableARHServices = () => {
|
|
290
|
+
// Check if the current section is relevant for AI services
|
|
291
|
+
const isRelevantSection = isTroubleshootSection || isSummarizeSection || isResourcesSection;
|
|
292
|
+
// Check if the case type is allowed (not in the excluded list)
|
|
293
|
+
const isCaseTypeAllowed = !excludedCaseTypesforARH.includes(caseDetails.caseType || '');
|
|
294
|
+
// Check if user is not a secure support or confirmed stateside support user
|
|
295
|
+
const isNotSecureOrStatesideUser = !props.isSecureSupport && !props.hasConfirmedStatesideSupport;
|
|
296
|
+
// Check if the ARH fields have changed
|
|
297
|
+
const isARHFieldsChanged = haveARHFieldsChangedRef.current;
|
|
298
|
+
// Check if user is external and has invalid entitlements
|
|
299
|
+
const isNotUnentitledExternalUser = !(props.isUserExternal && props.hasInvalidEntitlements);
|
|
300
|
+
// For variation B, check if we have valid fields to make the API call (even if fields haven't changed)
|
|
301
|
+
const hasValidFieldsForVariationB = !isVariationA &&
|
|
302
|
+
!isEmpty(caseDetails.product) &&
|
|
303
|
+
!isEmpty(caseDetails.version) &&
|
|
304
|
+
!isEmpty(trim(caseDetails.summary)) &&
|
|
305
|
+
!isEmpty(trim(caseDetails.issue));
|
|
306
|
+
return (isRelevantSection &&
|
|
307
|
+
isCaseTypeAllowed &&
|
|
308
|
+
isNotSecureOrStatesideUser &&
|
|
309
|
+
(isARHFieldsChanged || hasValidFieldsForVariationB) &&
|
|
310
|
+
isNotUnentitledExternalUser);
|
|
311
|
+
};
|
|
267
312
|
const onCurrentStepChanged = (event, currentStep, prevStep, scope) => {
|
|
268
313
|
if (isNextButtonClickedRef.current) {
|
|
269
314
|
onNext(currentStep);
|
|
@@ -292,6 +337,7 @@ function WizardMain(props) {
|
|
|
292
337
|
return (React.createElement(WizardNavItem, { key: step.id, id: step.id, content: step.name, isCurrent: activeStep.id === step.id, isDisabled: !step.canJumpTo, stepIndex: step.index, onClick: () => goToStepByIndex(step.index) }));
|
|
293
338
|
})));
|
|
294
339
|
const CustomFooter = (activeStep, goToNextStep, goToPrevStep) => {
|
|
340
|
+
goToPrevStepRef.current = goToPrevStep;
|
|
295
341
|
useEffect(() => {
|
|
296
342
|
if (steps.length > 2 && (activeStep === null || activeStep === void 0 ? void 0 : activeStep.index) === 2 && isNextButtonClicked) {
|
|
297
343
|
goToNextStep({});
|
|
@@ -305,7 +351,7 @@ function WizardMain(props) {
|
|
|
305
351
|
goToNextStep({});
|
|
306
352
|
focusWizardMainPanel();
|
|
307
353
|
// Fetch ARH response if conditions are met
|
|
308
|
-
if (shouldEnableARHServices() && aiServicesAvailable) {
|
|
354
|
+
if (shouldEnableARHServices() && aiServicesAvailable && !isVariationA) {
|
|
309
355
|
yield fetchARHResponse();
|
|
310
356
|
haveARHFieldsChangedRef.current = false;
|
|
311
357
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardNavigation.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/WizardNavigation.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAEvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"WizardNavigation.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/WizardNavigation.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAEvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAUvD,OAAO,EAAoB,eAAe,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAM3G,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;IACjD,MAAM,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACzD,MAAM,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACzD,UAAU,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC3C,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,mBAAmB,EAAE,CAAC,gCAAgC,EAAE,OAAO,KAAK,IAAI,CAAC;IACzE,gBAAgB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC1C,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,0BAA0B,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IAC5E,kCAAkC,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IACpF,qCAAqC,CAAC,EAAE,OAAO,CAAC;IAChD,gCAAgC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IACjF,aAAa,CAAC,EAAE,GAAG,CAAC;IACpB,oBAAoB,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IACrE,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C,sBAAsB,CAAC,EAAE,MAAM,IAAI,CAAC;IACpC,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B;AAGD,iBAAS,gBAAgB,CAAC,KAAK,EAAE,MAAM,qBAqatC;kBAraQ,gBAAgB;;;AAuazB,eAAe,gBAAgB,CAAC"}
|