@rh-support/troubleshoot 2.0.5 → 2.0.7
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.d.ts.map +1 -1
- package/lib/esm/components/AccountInfo/AccountSelector.js +44 -5
- package/lib/esm/components/AccountInfo/OwnerSelector.js +2 -2
- package/lib/esm/components/CaseEditView/CaseDetailsAside.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/CaseDetailsAside.js +5 -3
- package/lib/esm/components/CaseEditView/CaseOverview/index.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/CaseOverview/index.js +1 -1
- package/lib/esm/components/CaseEditView/CaseSolutions/CaseSolutions.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/CaseSolutions/CaseSolutions.js +38 -36
- package/lib/esm/components/CaseEditView/CaseSolutions/CaseSolutionsItem.d.ts +2 -1
- package/lib/esm/components/CaseEditView/CaseSolutions/CaseSolutionsItem.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/CaseSolutions/CaseSolutionsItem.js +4 -3
- package/lib/esm/components/CaseEditView/CaseSolutions/HandpickedItem.d.ts +12 -0
- package/lib/esm/components/CaseEditView/CaseSolutions/HandpickedItem.d.ts.map +1 -0
- package/lib/esm/components/CaseEditView/CaseSolutions/HandpickedItem.js +14 -0
- package/lib/esm/components/CaseEditView/ConfirmationModals/ReopenCaseModal.js +1 -1
- package/lib/esm/components/CaseEditView/ShareCase/PartnerShare.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/ShareCase/PartnerShare.js +6 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseDetailsManagement.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseDetailsManagement.js +1 -2
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseInformation.js +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/useCustomEmails.js +1 -1
- package/lib/esm/components/CaseInformation/CaseGroup.js +2 -2
- package/lib/esm/components/CaseInformation/CaseInformation.d.ts.map +1 -1
- package/lib/esm/components/CaseInformation/CaseInformation.js +1 -8
- package/lib/esm/components/CaseInformation/Description.d.ts.map +1 -1
- package/lib/esm/components/CaseInformation/Description.js +4 -2
- package/lib/esm/components/CaseInformation/OpenCaseIssue.js +2 -2
- package/lib/esm/components/CaseInformation/Severity.js +1 -1
- package/lib/esm/components/CaseManagement/CaseManagement.d.ts.map +1 -1
- package/lib/esm/components/CaseManagement/CaseManagement.js +2 -9
- package/lib/esm/components/CaseManagement/OpenShiftClusterId.d.ts +5 -1
- package/lib/esm/components/CaseManagement/OpenShiftClusterId.d.ts.map +1 -1
- package/lib/esm/components/CaseManagement/OpenShiftClusterId.js +7 -7
- package/lib/esm/components/CaseManagement/SendNotifications/CaseContactSelector.d.ts.map +1 -1
- package/lib/esm/components/CaseManagement/SendNotifications/CaseContactSelector.js +4 -1
- package/lib/esm/components/IdeaInformation/IdeaInformtion.d.ts.map +1 -1
- package/lib/esm/components/IdeaInformation/IdeaInformtion.js +1 -8
- package/lib/esm/components/ImproveCase/KtQuestions.js +2 -2
- package/lib/esm/components/Issue/Issue.d.ts.map +1 -1
- package/lib/esm/components/Issue/Issue.js +1 -2
- package/lib/esm/components/OpenCase/OpenCase.d.ts.map +1 -1
- package/lib/esm/components/OpenCase/OpenCase.js +2 -9
- package/lib/esm/components/OpenCase/SupportTypeSelectorPage.js +2 -2
- package/lib/esm/components/ProductSelector/AllProductsSelector.d.ts.map +1 -1
- package/lib/esm/components/ProductSelector/AllProductsSelector.js +1 -1
- package/lib/esm/components/ProductSelector/NewProductDropdownSelector.d.ts +1 -1
- package/lib/esm/components/ProductSelector/NewProductDropdownSelector.d.ts.map +1 -1
- package/lib/esm/components/ProductSelector/NewProductDropdownSelector.js +3 -3
- package/lib/esm/components/ProductSelector/NewProductVersionSelector.d.ts +1 -1
- package/lib/esm/components/ProductSelector/NewProductVersionSelector.d.ts.map +1 -1
- package/lib/esm/components/ProductSelector/NewProductVersionSelector.js +3 -3
- package/lib/esm/components/ProductSelector/ProductSelector.js +1 -2
- package/lib/esm/components/ProductSelector/ProductSelectorLoader.d.ts +1 -2
- package/lib/esm/components/ProductSelector/ProductSelectorLoader.d.ts.map +1 -1
- package/lib/esm/components/ProductSelector/ProductSelectorLoader.js +12 -19
- package/lib/esm/components/ProductSelector/ProductVersionDropdownSelector.js +3 -3
- package/lib/esm/components/Recommendations/AlertToastWrapper.js +4 -5
- package/lib/esm/components/Recommendations/ClusterRecommendationToast.d.ts.map +1 -1
- package/lib/esm/components/Recommendations/ClusterRecommendationToast.js +2 -1
- package/lib/esm/components/Recommendations/ClusterRecommendations.js +1 -1
- package/lib/esm/components/Recommendations/CriticalSolutionsToast.d.ts.map +1 -1
- package/lib/esm/components/SessionRestore/RestoreLastSessionModal.js +1 -1
- package/lib/esm/components/SessionRestore/SessionRestore.d.ts.map +1 -1
- package/lib/esm/components/SessionRestore/SessionRestore.js +4 -9
- package/lib/esm/components/SubmitCase/ResubmitToast.js +1 -1
- package/lib/esm/components/SubmitCase/SubmitCase.d.ts.map +1 -1
- package/lib/esm/components/SubmitCase/SubmitCase.js +8 -5
- package/lib/esm/components/Suggestions/TopContent.js +1 -1
- package/lib/esm/components/TroubleshootSection/TroubleshootSection.d.ts.map +1 -1
- package/lib/esm/components/TroubleshootSection/TroubleshootSection.js +4 -3
- package/lib/esm/components/shared/useIsSectionValid.d.ts +1 -1
- package/lib/esm/components/shared/useIsSectionValid.d.ts.map +1 -1
- package/lib/esm/components/shared/useIsSectionValid.js +5 -24
- package/lib/esm/components/wizardLayout/GlobalTroubleshootEffects.d.ts.map +1 -1
- package/lib/esm/components/wizardLayout/GlobalTroubleshootEffects.js +40 -80
- package/lib/esm/components/wizardLayout/MainSection.d.ts +5 -3
- package/lib/esm/components/wizardLayout/MainSection.d.ts.map +1 -1
- package/lib/esm/components/wizardLayout/MainSection.js +4 -4
- package/lib/esm/components/wizardLayout/WizardAside.d.ts.map +1 -1
- package/lib/esm/components/wizardLayout/WizardAside.js +3 -10
- package/lib/esm/components/wizardLayout/WizardLayout.d.ts.map +1 -1
- package/lib/esm/components/wizardLayout/WizardLayout.js +31 -42
- package/lib/esm/components/wizardLayout/WizardMain.d.ts +2 -3
- package/lib/esm/components/wizardLayout/WizardMain.d.ts.map +1 -1
- package/lib/esm/components/wizardLayout/WizardMain.js +43 -163
- package/lib/esm/components/wizardLayout/WizardNavigation.d.ts +7 -3
- package/lib/esm/components/wizardLayout/WizardNavigation.d.ts.map +1 -1
- package/lib/esm/components/wizardLayout/WizardNavigation.js +46 -90
- package/lib/esm/components/wizardLayout/index.d.ts.map +1 -1
- package/lib/esm/components/wizardLayout/index.js +2 -10
- package/lib/esm/context/RootTroubleshootProvider.d.ts.map +1 -1
- package/lib/esm/context/RootTroubleshootProvider.js +7 -9
- package/lib/esm/css/app.css +0 -450
- package/lib/esm/hooks/useResetCaseCreate.d.ts.map +1 -1
- package/lib/esm/hooks/useResetCaseCreate.js +0 -4
- package/lib/esm/hooks/useWizard.d.ts +4 -0
- package/lib/esm/hooks/useWizard.d.ts.map +1 -0
- package/lib/esm/hooks/useWizard.js +128 -0
- package/lib/esm/reducers/RouteConstNTypes.d.ts +21 -1
- package/lib/esm/reducers/RouteConstNTypes.d.ts.map +1 -1
- package/lib/esm/reducers/RouteConstNTypes.js +43 -0
- package/lib/esm/reducers/RouteReducer.d.ts +13 -47
- package/lib/esm/reducers/RouteReducer.d.ts.map +1 -1
- package/lib/esm/reducers/RouteReducer.js +36 -165
- package/lib/esm/scss/_main.scss +112 -791
- package/lib/esm/utils/routeUtils.d.ts +3 -9
- package/lib/esm/utils/routeUtils.d.ts.map +1 -1
- package/lib/esm/utils/routeUtils.js +14 -41
- package/package.json +14 -25
- package/lib/esm/components/wizardLayout/WizardProgress.d.ts +0 -13
- package/lib/esm/components/wizardLayout/WizardProgress.d.ts.map +0 -1
- package/lib/esm/components/wizardLayout/WizardProgress.js +0 -108
- package/lib/esm/context/AppMetadataContext.d.ts +0 -11
- package/lib/esm/context/AppMetadataContext.d.ts.map +0 -1
- package/lib/esm/context/AppMetadataContext.js +0 -13
- package/lib/esm/reducers/AppMetadataReducer.d.ts +0 -28
- package/lib/esm/reducers/AppMetadataReducer.d.ts.map +0 -1
- package/lib/esm/reducers/AppMetadataReducer.js +0 -28
|
@@ -81,7 +81,8 @@ export default function SubmitCase() {
|
|
|
81
81
|
const viewDisabled = isEmpty(attachmentState.caseFiles.selectedLocalFiles)
|
|
82
82
|
? false
|
|
83
83
|
: attachmentState.caseFiles.selectedLocalFiles.every((localFile) => !isUploadedAndAnalyzed(localFile));
|
|
84
|
-
|
|
84
|
+
const isNotAnIdea = caseType !== PreviousCaseTypes.FEATURE_ENHANCEMENT;
|
|
85
|
+
return (React.createElement("article", { className: "gird-main" },
|
|
85
86
|
React.createElement(AlertMessage, { className: "push-top", title: t('Failed to add user.'), variant: AlertType.DANGER, show: addNotifiedUserError }),
|
|
86
87
|
React.createElement(AlertMessage, { className: "push-top", variant: AlertType.DANGER, show: caseCreationError, title: t("Sorry, we're experiencing an error"), isInline: true },
|
|
87
88
|
React.createElement(React.Fragment, null, caseCreationErrorMessage)),
|
|
@@ -139,8 +140,10 @@ export default function SubmitCase() {
|
|
|
139
140
|
(!isEmpty(topContent.data) || !rulesState.EARules.rules || !clusterRecommendations) &&
|
|
140
141
|
!isIdea && (React.createElement(Text, { className: "pf-u-mt-2xl pf-u-font-weight-light", component: TextVariants.h2 },
|
|
141
142
|
React.createElement(Trans, null, "Troubleshoot this case"))),
|
|
142
|
-
React.createElement(
|
|
143
|
-
React.createElement(
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
isNotAnIdea && (React.createElement(React.Fragment, null,
|
|
144
|
+
React.createElement("div", { className: isIdea ? 'pf-u-mt-lg' : '' },
|
|
145
|
+
React.createElement(InsightsResults, { isDisplayOnMain: true })),
|
|
146
|
+
React.createElement(ClusterRecommendations, { showClusterRecommendationsModal: false }))),
|
|
147
|
+
React.createElement("div", { className: "pf-u-mt-lg" }, isIdea ? (React.createElement(AsideResults, null)) : (!isEmpty(topContent.data) &&
|
|
148
|
+
isNotAnIdea && (React.createElement(Suggestions, { title: isIdea ? t('Search recommendations') : t('Product recommendations'), showTitleDescription: true, showMax: 6 })))))))));
|
|
146
149
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '@patternfly/pfe-accordion';
|
|
2
2
|
import { pcm } from '@cee-eng/hydrajs';
|
|
3
3
|
import { Tooltip } from '@patternfly/react-core';
|
|
4
|
-
import
|
|
4
|
+
import map from 'lodash/map';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import RouteUtils from '../../utils/routeUtils';
|
|
7
7
|
const { SessionResourceSource } = pcm.preCase.session;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TroubleshootSection.d.ts","sourceRoot":"","sources":["../../../../src/components/TroubleshootSection/TroubleshootSection.tsx"],"names":[],"mappings":"AAiBA,UAAU,MAAM;IACZ,cAAc,EAAE,OAAO,CAAC;IACxB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AASD,iBAAS,mBAAmB,CAAC,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"TroubleshootSection.d.ts","sourceRoot":"","sources":["../../../../src/components/TroubleshootSection/TroubleshootSection.tsx"],"names":[],"mappings":"AAiBA,UAAU,MAAM;IACZ,cAAc,EAAE,OAAO,CAAC;IACxB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AASD,iBAAS,mBAAmB,CAAC,KAAK,EAAE,MAAM,eAyFzC;kBAzFQ,mBAAmB;;;AA4F5B,eAAe,mBAAmB,CAAC"}
|
|
@@ -35,9 +35,10 @@ function TroubleshootSection(props) {
|
|
|
35
35
|
const canShowTopProducts = isEmpty(product);
|
|
36
36
|
const canShowTopContent = !canShowTopProducts && ((_a = topContent === null || topContent === void 0 ? void 0 : topContent.data) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
37
37
|
const canAddAttachments = ability.can(resourceActions.PATCH, resources.CASE_CREATE, CaseListFields.ATTACHMENTS);
|
|
38
|
+
const isNotAnIdea = caseType !== PreviousCaseTypes.FEATURE_ENHANCEMENT;
|
|
38
39
|
return (React.createElement(React.Fragment, null,
|
|
39
|
-
!isCreatingCase && (React.createElement("section",
|
|
40
|
-
React.createElement(OpenShiftClusterId,
|
|
40
|
+
!isCreatingCase && (React.createElement("section", null,
|
|
41
|
+
React.createElement(OpenShiftClusterId, { className: "push-bottom" }))),
|
|
41
42
|
React.createElement("section", null,
|
|
42
43
|
React.createElement("header", null,
|
|
43
44
|
React.createElement("h3", null,
|
|
@@ -54,7 +55,7 @@ function TroubleshootSection(props) {
|
|
|
54
55
|
React.createElement(ErrorBoundary, { errorMsgInfo: { message: t('There was an error loading suggestions') } }, canShowTopContent && !isEmpty(version) && React.createElement(Suggestions, null)),
|
|
55
56
|
!isCreatingCase && React.createElement(ClusterRecommendations, { className: "push-top" }))),
|
|
56
57
|
React.createElement("section", { className: "pf-u-mt-lg" },
|
|
57
|
-
React.createElement(InsightsResults, { isDisplayOnMain: true }),
|
|
58
|
+
isNotAnIdea && React.createElement(InsightsResults, { isDisplayOnMain: true }),
|
|
58
59
|
React.createElement("div", { className: "push-top" }, canAddAttachments ? (React.createElement(FileDiag, null)) : (React.createElement("div", { className: "card card-white card-support file-diag" },
|
|
59
60
|
React.createElement("h3", { className: "card-heading" }, isIdea || loggedInUsersAccount.data.secureSupport ? (React.createElement(Trans, null, "File uploader")) : (React.createElement(Trans, null, "Upload file to analyze"))),
|
|
60
61
|
React.createElement("div", { className: "card-body" },
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AppRouteSections } from '../../reducers/RouteConstNTypes';
|
|
2
|
-
export declare function useIsSectionValid(sectionName
|
|
2
|
+
export declare function useIsSectionValid(sectionName: AppRouteSections): {
|
|
3
3
|
isSectionValid: boolean;
|
|
4
4
|
isSectionValidFn: (sectionNameLocal: any) => boolean;
|
|
5
5
|
isActiveSectionValid: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIsSectionValid.d.ts","sourceRoot":"","sources":["../../../../src/components/shared/useIsSectionValid.tsx"],"names":[],"mappings":"AAyBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"useIsSectionValid.d.ts","sourceRoot":"","sources":["../../../../src/components/shared/useIsSectionValid.tsx"],"names":[],"mappings":"AAyBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,gBAAgB;;;;;EA4K9D"}
|
|
@@ -2,16 +2,15 @@ import { GlobalMetadataStateContext } from '@rh-support/react-context';
|
|
|
2
2
|
import find from 'lodash/find';
|
|
3
3
|
import isEmpty from 'lodash/isEmpty';
|
|
4
4
|
import isEqual from 'lodash/isEqual';
|
|
5
|
-
import { useContext
|
|
5
|
+
import { useContext } from 'react';
|
|
6
6
|
import { useCaseSelector } from '../../context/CaseContext';
|
|
7
7
|
import { RecommendationStateContext } from '../../context/RecommendationContext';
|
|
8
|
-
import { RouteContext
|
|
8
|
+
import { RouteContext } from '../../context/RouteContext';
|
|
9
9
|
import { TCStateContext } from '../../context/TopContentContext';
|
|
10
10
|
import { CASE_REFERENCE_NUMBER_LIMIT, CONTACT_INFO_24X7_LIMIT, DESCRIPTION_LENGTH_LIMIT, HOSTNAME_LENGTH_LIMIT, PHONE_LIMIT, SUMMARY_LENGTH_LIMIT, } from '../../reducers/CaseConstNTypes';
|
|
11
11
|
import { isCaseInformationSectionValid, isCaseManagementStateValid, isCaseStateValid, isClusterIDValid, isIdeaCaseStateValid, } from '../../reducers/CaseHelpers';
|
|
12
12
|
import { AppRouteSections } from '../../reducers/RouteConstNTypes';
|
|
13
|
-
|
|
14
|
-
export function useIsSectionValid(sectionName = null) {
|
|
13
|
+
export function useIsSectionValid(sectionName) {
|
|
15
14
|
var _a, _b;
|
|
16
15
|
const { caseState, caseType, product, version, contactSSOName, accountNumber, summary, description, hostname, contactInfo24x7, alternateId, selectedAccountDetails, phone, } = useCaseSelector((state) => ({
|
|
17
16
|
caseState: state,
|
|
@@ -34,7 +33,6 @@ export function useIsSectionValid(sectionName = null) {
|
|
|
34
33
|
const { recommendationState } = useContext(RecommendationStateContext);
|
|
35
34
|
const isEntitledProduct = (_b = find((_a = allProducts === null || allProducts === void 0 ? void 0 : allProducts.data) === null || _a === void 0 ? void 0 : _a.productsResult, (p) => p.product === caseState.caseDetails.product)) === null || _b === void 0 ? void 0 : _b.isEntitledProduct;
|
|
36
35
|
const { routeState: { activeSection, isSearchIntent }, } = useContext(RouteContext);
|
|
37
|
-
const dispatchToRouteReducer = useContext(RouteDispatchContext);
|
|
38
36
|
const isGetSupportSectionValidLocal = () => {
|
|
39
37
|
return (!isEmpty(caseType) &&
|
|
40
38
|
!isEmpty(accountNumber) &&
|
|
@@ -110,6 +108,8 @@ export function useIsSectionValid(sectionName = null) {
|
|
|
110
108
|
return isReviewSectionValid();
|
|
111
109
|
case AppRouteSections.DESCRIBE_IDEA:
|
|
112
110
|
return isDescribeIdeaSectionValid();
|
|
111
|
+
case AppRouteSections.SUBMIT_CASE:
|
|
112
|
+
return true;
|
|
113
113
|
default:
|
|
114
114
|
return false;
|
|
115
115
|
}
|
|
@@ -130,25 +130,6 @@ export function useIsSectionValid(sectionName = null) {
|
|
|
130
130
|
return '';
|
|
131
131
|
}
|
|
132
132
|
};
|
|
133
|
-
useEffect(() => {
|
|
134
|
-
if (isSectionValid(sectionName)) {
|
|
135
|
-
dispatchToRouteReducer({
|
|
136
|
-
type: RouteReducerConstants.setShowValidationErrorAlert,
|
|
137
|
-
payload: {
|
|
138
|
-
showValidationErrorAlert: true,
|
|
139
|
-
},
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
dispatchToRouteReducer({
|
|
144
|
-
type: RouteReducerConstants.setShowValidationErrorAlert,
|
|
145
|
-
payload: {
|
|
146
|
-
showValidationErrorAlert: false,
|
|
147
|
-
},
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
151
|
-
}, [sectionName, dispatchToRouteReducer]);
|
|
152
133
|
return {
|
|
153
134
|
isSectionValid: isSectionValid(sectionName),
|
|
154
135
|
isSectionValidFn: isSectionValid,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GlobalTroubleshootEffects.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/GlobalTroubleshootEffects.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GlobalTroubleshootEffects.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/GlobalTroubleshootEffects.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAWvD,OAAO,EAAqB,eAAe,EAAE,MAAM,iCAAiC,CAAC;AASrF,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;CACpD;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,eA+VtD"}
|
|
@@ -8,16 +8,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { useDebounce, usePrevious } from '@rh-support/components';
|
|
11
|
-
import { GlobalMetadataStateContext } from '@rh-support/react-context';
|
|
11
|
+
import { GlobalMetadataStateContext, useUserPreferences } from '@rh-support/react-context';
|
|
12
12
|
import { ability, CaseListFields, resourceActions, resources } from '@rh-support/user-permissions';
|
|
13
|
-
import { getUrlParsedParams, getVersion, getVersionIfOnlyVersion, isOnlyVersion
|
|
13
|
+
import { getUrlParsedParams, getVersion, getVersionIfOnlyVersion, isOnlyVersion } from '@rh-support/utils';
|
|
14
14
|
import findIndex from 'lodash/findIndex';
|
|
15
15
|
import includes from 'lodash/includes';
|
|
16
16
|
import isEmpty from 'lodash/isEmpty';
|
|
17
17
|
import isEqual from 'lodash/isEqual';
|
|
18
18
|
import React, { useContext, useEffect, useRef, useState } from 'react';
|
|
19
19
|
import { useCaseDispatch, useCaseSelector } from '../../context/CaseContext';
|
|
20
|
-
import {
|
|
20
|
+
import { RouteDispatchContext } from '../../context/RouteContext';
|
|
21
21
|
import { RulesDispatchContext } from '../../context/RulesContext';
|
|
22
22
|
import { SessionRestoreStateContext } from '../../context/SessionRestoreContext';
|
|
23
23
|
import { TCDispatchContext, TCStateContext } from '../../context/TopContentContext';
|
|
@@ -25,16 +25,16 @@ import { useResetCaseCreate } from '../../hooks/useResetCaseCreate';
|
|
|
25
25
|
import { initialCaseState } from '../../reducers/CaseConstNTypes';
|
|
26
26
|
import { getDescriptionWOQues } from '../../reducers/CaseHelpers';
|
|
27
27
|
import { setCaseAccountNumber, setCaseDetails, setCaseOwner, setCaseState } from '../../reducers/CaseReducer';
|
|
28
|
-
import {
|
|
28
|
+
import { setRouteFlags } from '../../reducers/RouteReducer';
|
|
29
29
|
import { fetchEdmundAbbottRules } from '../../reducers/RulesReducer';
|
|
30
30
|
import { fetchTopContent } from '../../reducers/TopContentReducer';
|
|
31
31
|
import { isClusterIdEnabledForProduct } from '../../utils/caseOpenshiftClusterIdUtils';
|
|
32
32
|
import RouteUtils from '../../utils/routeUtils';
|
|
33
|
+
import Constants from '../shared/Constants';
|
|
33
34
|
import { AttachmentStateContext } from '../shared/fileUpload/reducer/AttachmentReducerContext';
|
|
34
35
|
export function GlobalTroubleshootEffects(props) {
|
|
35
36
|
const [initDefaultSection, setInitDefaultSection] = useState(false);
|
|
36
37
|
const dispatchToRouteReducer = useContext(RouteDispatchContext);
|
|
37
|
-
const { routeState: { activeSection, sectionsToHide, visitedSections }, } = useContext(RouteContext);
|
|
38
38
|
const { globalMetadataState: { allProducts, loggedInUser, managedAccounts, loggedInUserRights, loggedInUsersAccount }, } = useContext(GlobalMetadataStateContext);
|
|
39
39
|
const { sessionRestore: { activeSessionId }, } = useContext(SessionRestoreStateContext);
|
|
40
40
|
const { accountNumber, product, version, contactSsoUsername, summary, issue, environment, periodicityOfIssue, timeFramesAndUrgency, caseType, language, selectedAccountDetails, } = useCaseSelector((state) => ({
|
|
@@ -60,6 +60,7 @@ export function GlobalTroubleshootEffects(props) {
|
|
|
60
60
|
const isCaseCreate = RouteUtils.getQueryParams(props.routeProps).caseCreate === 'true';
|
|
61
61
|
const urlQueryParams = RouteUtils.getQueryParams(props.routeProps);
|
|
62
62
|
const isFirstMount = useRef(true);
|
|
63
|
+
const { getPreferredLanguage } = useUserPreferences();
|
|
63
64
|
const rulesDispatch = useContext(RulesDispatchContext);
|
|
64
65
|
const canAddAttachments = ability.can(resourceActions.PATCH, resources.CASE_CREATE, CaseListFields.ATTACHMENTS);
|
|
65
66
|
// top content state
|
|
@@ -67,11 +68,8 @@ export function GlobalTroubleshootEffects(props) {
|
|
|
67
68
|
const tcDispatch = useContext(TCDispatchContext);
|
|
68
69
|
const { attachmentState: { caseFiles: { selectedLocalFiles }, }, } = useContext(AttachmentStateContext);
|
|
69
70
|
const { resetCaseCreateState } = useResetCaseCreate();
|
|
70
|
-
const prevSectionsToHide = usePrevious(sectionsToHide);
|
|
71
71
|
const hasSummaryInUrl = !isEmpty(urlQueryParams.summary);
|
|
72
72
|
const isSearchIntent = !isCaseCreate && hasSummaryInUrl;
|
|
73
|
-
const isIdea = caseType === PreviousCaseTypes.FEATURE_ENHANCEMENT;
|
|
74
|
-
const appRouteConfugurations = getAppRouteConfugurations(isCaseCreate, isIdea, product);
|
|
75
73
|
/**
|
|
76
74
|
* Setting product version on case details from url.
|
|
77
75
|
*/
|
|
@@ -130,95 +128,37 @@ export function GlobalTroubleshootEffects(props) {
|
|
|
130
128
|
}, [allProducts, allProducts.data.productsResult, caseDispatch, props.routeProps]);
|
|
131
129
|
// if you want to hide any section on page load then the logic will go here..
|
|
132
130
|
useEffect(() => {
|
|
133
|
-
if (!isFirstMount.current &&
|
|
134
|
-
isEqual(sectionsToHide, prevSectionsToHide) &&
|
|
135
|
-
loggedInUser.data &&
|
|
136
|
-
managedAccounts.data)
|
|
131
|
+
if (!isFirstMount.current && loggedInUser.data && managedAccounts.data)
|
|
137
132
|
return;
|
|
138
|
-
let sectionsToHideLocal = [...sectionsToHide];
|
|
139
|
-
// currently there is no section to hide and determine on page load but if you need to hide any section based on the logged in user and account
|
|
140
|
-
// then just update the sectionsToHideLocal with the required section and next line will update it in the state
|
|
141
|
-
dispatchToRouteReducer({
|
|
142
|
-
type: RouteReducerConstants.updateSectionsToHide,
|
|
143
|
-
payload: { sectionsToHide: sectionsToHideLocal, isIdea, product, isCaseCreate },
|
|
144
|
-
});
|
|
145
133
|
if (isFirstMount.current) {
|
|
146
134
|
// set the summary if redirected from portal with url query param "summary"
|
|
147
135
|
if (!isEmpty(urlQueryParams.summary)) {
|
|
148
136
|
setCaseDetails(caseDispatch, { summary: urlQueryParams.summary });
|
|
149
137
|
}
|
|
150
|
-
dispatchToRouteReducer
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
dispatchToRouteReducer({
|
|
155
|
-
type: RouteReducerConstants.setIsSearchIntent,
|
|
156
|
-
payload: { isSearchIntent: isSearchIntent },
|
|
138
|
+
setRouteFlags(dispatchToRouteReducer, isCaseCreate, isSearchIntent);
|
|
139
|
+
const navigateToDefaultSection = () => __awaiter(this, void 0, void 0, function* () {
|
|
140
|
+
RouteUtils.navigateToDefaltSection(props.routeProps, isCaseCreate, isSearchIntent, false);
|
|
141
|
+
setInitDefaultSection(false);
|
|
157
142
|
});
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
143
|
+
if (initDefaultSection) {
|
|
144
|
+
// navigate to the default section if the local section is the default section or
|
|
145
|
+
// if the redirect is just the base bath /troubleshoot.
|
|
146
|
+
navigateToDefaultSection();
|
|
147
|
+
}
|
|
161
148
|
isFirstMount.current = false;
|
|
162
149
|
}
|
|
163
150
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
164
|
-
}, [
|
|
165
|
-
// this useEffect navigates to the default section when the
|
|
166
|
-
// initDefaultSection flag is true and the sectionsToHide has been updated correctly.
|
|
167
|
-
useEffect(() => {
|
|
168
|
-
const navigateToDefaultSection = () => __awaiter(this, void 0, void 0, function* () {
|
|
169
|
-
const defaultSection = getDefaultSection(isCaseCreate, isSearchIntent, isIdea);
|
|
170
|
-
const routeSequence = getRouteSequence(isCaseCreate, isSearchIntent, isIdea);
|
|
171
|
-
dispatchToRouteReducer({
|
|
172
|
-
type: RouteReducerConstants.updateAppRouteSectionSequence,
|
|
173
|
-
payload: {
|
|
174
|
-
activeSection: defaultSection,
|
|
175
|
-
isIdea,
|
|
176
|
-
sectionsToHide,
|
|
177
|
-
isCaseCreate,
|
|
178
|
-
isSearchIntent,
|
|
179
|
-
},
|
|
180
|
-
});
|
|
181
|
-
RouteUtils.navigateToSection(props.routeProps, defaultSection, routeSequence, isCaseCreate, isSearchIntent, isIdea, false);
|
|
182
|
-
setInitDefaultSection(false);
|
|
183
|
-
});
|
|
184
|
-
if (initDefaultSection) {
|
|
185
|
-
// navigate to the default section if the local section is the default section or
|
|
186
|
-
// if the redirect is just the base bath /troubleshoot.
|
|
187
|
-
navigateToDefaultSection();
|
|
188
|
-
}
|
|
189
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
190
|
-
}, [initDefaultSection, isCaseCreate, isIdea, isSearchIntent, props.routeProps, sectionsToHide]);
|
|
191
|
-
// Hidden Section Related
|
|
192
|
-
useEffect(() => {
|
|
193
|
-
if (includes(sectionsToHide, activeSection)) {
|
|
194
|
-
RouteUtils.navigateToSection(props.routeProps, appRouteConfugurations[activeSection].nextSection, getAppRouteSectionsSequence(sectionsToHide, isCaseCreate, isSearchIntent, isIdea), isCaseCreate, isSearchIntent, isIdea, false);
|
|
195
|
-
}
|
|
196
|
-
}, [sectionsToHide, activeSection, props.routeProps, appRouteConfugurations, isCaseCreate, isSearchIntent, isIdea]);
|
|
151
|
+
}, [managedAccounts.data, loggedInUser.data, initDefaultSection, isCaseCreate, isSearchIntent, props.routeProps]);
|
|
197
152
|
/**
|
|
198
153
|
* Navigation and hiding/showing section related
|
|
199
154
|
*/
|
|
200
155
|
useEffect(() => {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
const defaultSection = getDefaultSection(isCaseCreate, isSearchIntent, isIdea);
|
|
204
|
-
RouteUtils.navigateToSection(props.routeProps, defaultSection, getAppRouteSectionsSequence(sectionsToHide, isCaseCreate, isSearchIntent, isIdea), isCaseCreate, isSearchIntent, isIdea, false);
|
|
156
|
+
if (props.routeProps.location.pathname === RouteUtils.seBasePath) {
|
|
157
|
+
RouteUtils.navigateToDefaltSection(props.routeProps, isCaseCreate, isSearchIntent, false);
|
|
205
158
|
!isSearchIntent && resetCaseCreateState();
|
|
206
159
|
}
|
|
207
|
-
else {
|
|
208
|
-
dispatchToRouteReducer({
|
|
209
|
-
type: RouteReducerConstants.activeSectionChanged,
|
|
210
|
-
payload: {
|
|
211
|
-
activeSection: activeSectionLocal,
|
|
212
|
-
isIdea,
|
|
213
|
-
sectionsToHide,
|
|
214
|
-
isCaseCreate,
|
|
215
|
-
isSearchIntent,
|
|
216
|
-
visitedSections,
|
|
217
|
-
},
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
160
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
221
|
-
}, [dispatchToRouteReducer, props.routeProps,
|
|
161
|
+
}, [dispatchToRouteReducer, props.routeProps, isCaseCreate, isSearchIntent]);
|
|
222
162
|
/**
|
|
223
163
|
* Setting Default AccountNumber and ContactSsoUsername from loggedInUsersAccount
|
|
224
164
|
* Disabling exhaustive-deps rule as we don't want to reset default values if user manually clears these from UI.
|
|
@@ -249,6 +189,26 @@ export function GlobalTroubleshootEffects(props) {
|
|
|
249
189
|
return;
|
|
250
190
|
fetchTopContent(tcDispatch, { product, version });
|
|
251
191
|
}, [product, tcDispatch, topContentPayload, version]);
|
|
192
|
+
// set case language to preferred language
|
|
193
|
+
useEffect(() => {
|
|
194
|
+
const userOriginalPreferredLanguage = () => __awaiter(this, void 0, void 0, function* () {
|
|
195
|
+
try {
|
|
196
|
+
const retrievedLanguage = yield getPreferredLanguage();
|
|
197
|
+
if (!isEmpty(retrievedLanguage)) {
|
|
198
|
+
const preferredLanguage = {
|
|
199
|
+
label: Constants.languagesMap[retrievedLanguage] || retrievedLanguage,
|
|
200
|
+
value: retrievedLanguage,
|
|
201
|
+
};
|
|
202
|
+
setCaseDetails(caseDispatch, { caseLanguage: preferredLanguage.value });
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
catch (error) {
|
|
206
|
+
console.log(error);
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
userOriginalPreferredLanguage();
|
|
210
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
211
|
+
}, []);
|
|
252
212
|
/**
|
|
253
213
|
* Fetching EA Rules on details change related
|
|
254
214
|
*/
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { AppRouteSections } from '../../reducers/RouteConstNTypes';
|
|
3
2
|
interface IProps {
|
|
4
3
|
section: AppRouteSections;
|
|
5
|
-
activeSection: AppRouteSections;
|
|
6
4
|
title: string | JSX.Element | JSX.Element[];
|
|
7
5
|
children: JSX.Element | JSX.Element[];
|
|
8
6
|
isLoading?: boolean;
|
|
9
7
|
description?: string | JSX.Element | JSX.Element[];
|
|
10
8
|
descriptionClassName?: string;
|
|
9
|
+
className?: string;
|
|
11
10
|
}
|
|
12
|
-
declare const MainSection:
|
|
11
|
+
declare const MainSection: {
|
|
12
|
+
(props: any): JSX.Element;
|
|
13
|
+
defaultProps: Partial<IProps>;
|
|
14
|
+
};
|
|
13
15
|
export default MainSection;
|
|
14
16
|
//# sourceMappingURL=MainSection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MainSection.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/MainSection.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MainSection.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/MainSection.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,UAAU,MAAM;IACZ,OAAO,EAAE,gBAAgB,CAAC;IAC1B,KAAK,EAAE,MAAM,GAAG,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;IAC5C,QAAQ,EAAE,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;IACtC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;IACnD,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAKD,QAAA,MAAM,WAAW;;;CA8BhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { ErrorBoundary, LoadingIndicator } from '@rh-support/components';
|
|
2
|
-
import React
|
|
2
|
+
import React from 'react';
|
|
3
3
|
const defaultProps = {
|
|
4
4
|
isLoading: false,
|
|
5
5
|
};
|
|
6
|
-
const MainSection =
|
|
6
|
+
const MainSection = (props) => {
|
|
7
7
|
return (React.createElement(ErrorBoundary, { isPageLevelError: true },
|
|
8
|
-
React.createElement("section", {
|
|
8
|
+
React.createElement("section", { id: `${props.section}`, tabIndex: -1, "aria-labelledby": `${props.section}-heading`, "aria-describedby": `${props.section}-description`, className: `${props.className ? props.className : ''}` },
|
|
9
9
|
React.createElement(LoadingIndicator, { show: props.isLoading, size: "lg" }),
|
|
10
10
|
!props.isLoading && (React.createElement(React.Fragment, null,
|
|
11
11
|
React.createElement("header", { className: "pf-u-display-none-on-sm" },
|
|
12
12
|
props.title && React.createElement("h2", { id: `${props.section}-heading` }, props.title),
|
|
13
13
|
props.description && (React.createElement("p", { id: `${props.section}-description`, className: `${props.descriptionClassName ? props.descriptionClassName : ''}` }, props.description))),
|
|
14
14
|
props.children)))));
|
|
15
|
-
}
|
|
15
|
+
};
|
|
16
16
|
MainSection.defaultProps = defaultProps;
|
|
17
17
|
export default MainSection;
|
|
@@ -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;AAInD,OAAO,EAEH,eAAe,EAIlB,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;AAInD,OAAO,EAEH,eAAe,EAIlB,MAAM,iCAAiC,CAAC;AAQzC,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;IACjD,2BAA2B,EAAE,OAAO,CAAC;CACxC;AAGD,iBAAS,WAAW,CAAC,KAAK,EAAE,MAAM,eAwCjC;kBAxCQ,WAAW;;;AA0CpB,eAAe,WAAW,CAAC"}
|
|
@@ -5,7 +5,6 @@ import React, { useContext } from 'react';
|
|
|
5
5
|
import { useCaseSelector } from '../../context/CaseContext';
|
|
6
6
|
import { RouteContext } from '../../context/RouteContext';
|
|
7
7
|
import { hideFileUploadSidebarWidgetSections, showSideBarClusterIdRuleWidgetSections, showSideBarEARuleWidgetSections, showSideBarFileRecommendationSections, } from '../../reducers/RouteConstNTypes';
|
|
8
|
-
import { getAppRouteConfugurations } from '../../reducers/RouteReducer';
|
|
9
8
|
import { FileDiag } from '../CaseInformation/FileDiag';
|
|
10
9
|
import { AsideResults } from '../Recommendations/AsideResults';
|
|
11
10
|
import ClusterRecommendations from '../Recommendations/ClusterRecommendations';
|
|
@@ -14,16 +13,13 @@ import InsightsResults from '../Recommendations/InsightsResults';
|
|
|
14
13
|
import { SessionRestore } from '../SessionRestore';
|
|
15
14
|
const defaultProps = {};
|
|
16
15
|
function WizardAside(props) {
|
|
17
|
-
const { routeState: { activeSection
|
|
16
|
+
const { routeState: { activeSection }, } = useContext(RouteContext);
|
|
18
17
|
const canAddAttachments = ability.can(resourceActions.PATCH, resources.CASE_CREATE, CaseListFields.ATTACHMENTS);
|
|
19
|
-
const { isCreatingCase, caseType
|
|
18
|
+
const { isCreatingCase, caseType } = useCaseSelector((state) => ({
|
|
20
19
|
isCreatingCase: state.isCreatingCase,
|
|
21
|
-
caseNumber: state.caseDetails.caseNumber,
|
|
22
20
|
caseType: state.caseDetails.caseType,
|
|
23
|
-
product: state.caseDetails.product,
|
|
24
21
|
}), isEqual);
|
|
25
22
|
const isIdea = caseType === PreviousCaseTypes.FEATURE_ENHANCEMENT;
|
|
26
|
-
const appRouteConfugurations = getAppRouteConfugurations(isCaseCreate, isIdea, product);
|
|
27
23
|
const canUseSessionManagement = ability.can(resourceActions.CREATE, resources.SESSION_TRACKING);
|
|
28
24
|
const canShowFileUploadWidget = () => canAddAttachments &&
|
|
29
25
|
!props.isAttachmentUploadModalOpen &&
|
|
@@ -31,10 +27,7 @@ function WizardAside(props) {
|
|
|
31
27
|
const canshowEARuleWidget = showSideBarEARuleWidgetSections.includes(activeSection);
|
|
32
28
|
const canShowClusterIdReportWidget = showSideBarClusterIdRuleWidgetSections.includes(activeSection);
|
|
33
29
|
const canShowFileRecommendationSectionsWidget = showSideBarFileRecommendationSections.includes(activeSection);
|
|
34
|
-
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
return (React.createElement("aside", { className: "grid-aside" },
|
|
30
|
+
return (React.createElement("aside", null,
|
|
38
31
|
React.createElement("section", { className: "grid-aside-content" },
|
|
39
32
|
canshowEARuleWidget && React.createElement(EARuleWidget, null),
|
|
40
33
|
React.createElement(InsightsResults, null),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardLayout.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/WizardLayout.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WizardLayout.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/WizardLayout.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAMvD,OAAO,EAAuC,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAavG,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;CACpD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,eAqIzC"}
|
|
@@ -1,8 +1,18 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { Grid, GridItem } from '@patternfly/react-core';
|
|
1
11
|
import { SupportFeedbackForm } from '@rh-support/components';
|
|
2
|
-
import { GlobalMetadataStateContext
|
|
12
|
+
import { GlobalMetadataStateContext } from '@rh-support/react-context';
|
|
3
13
|
import { ability, CaseListFields, resourceActions, resources } from '@rh-support/user-permissions';
|
|
4
14
|
import { getVersionIfOnlyVersion, pendoTrackEvent, PreviousCaseTypes } from '@rh-support/utils';
|
|
5
|
-
import
|
|
15
|
+
import findIndex from 'lodash/findIndex';
|
|
6
16
|
import isEqual from 'lodash/isEqual';
|
|
7
17
|
import React, { useContext, useRef, useState } from 'react';
|
|
8
18
|
import { Trans } from 'react-i18next';
|
|
@@ -11,32 +21,26 @@ import { RouteContext } from '../../context/RouteContext';
|
|
|
11
21
|
import { SessionRestoreStateContext } from '../../context/SessionRestoreContext';
|
|
12
22
|
import { submitCase } from '../../reducers/CaseReducer';
|
|
13
23
|
import { AppRouteSections } from '../../reducers/RouteConstNTypes';
|
|
14
|
-
import { getAppRouteConfugurations, getAppRouteSectionsSequence, isNextSectionCaseCreation, } from '../../reducers/RouteReducer';
|
|
15
24
|
import RouteUtils from '../../utils/routeUtils';
|
|
16
25
|
import PreCaseConfirmationModals, { PreCaseConfirmationModalsEnum, } from '../ConfirmationModals/PreCaseConfirmationModals';
|
|
17
26
|
import AlertToastWrapper from '../Recommendations/AlertToastWrapper';
|
|
18
27
|
import { preferredSSModalOpenPendoEvent } from '../shared/Constants';
|
|
19
28
|
import { AttachmentStateContext } from '../shared/fileUpload';
|
|
20
29
|
import { isAnyFileAttached } from '../shared/fileUpload/reducer/AttachmentHelper';
|
|
30
|
+
import { GlobalTroubleshootEffects } from './GlobalTroubleshootEffects';
|
|
21
31
|
import WizardAside from './WizardAside';
|
|
22
32
|
import WizardMain from './WizardMain';
|
|
23
|
-
import WizardNavigation from './WizardNavigation';
|
|
24
|
-
import WizardProgress from './WizardProgress';
|
|
25
33
|
export function WizardLayout(props) {
|
|
26
|
-
|
|
27
|
-
const { routeState: { activeSection, isCaseCreate, isSearchIntent, sectionsToHide }, } = useContext(RouteContext);
|
|
34
|
+
const { routeState: { activeSection, isCaseCreate }, } = useContext(RouteContext);
|
|
28
35
|
const caseState = useCaseSelector((state) => state, isEqual);
|
|
29
36
|
const caseDispatch = useCaseDispatch();
|
|
30
37
|
const { sessionRestore: { activeSessionId, previousSessions }, } = useContext(SessionRestoreStateContext);
|
|
31
|
-
const { globalMetadataState: {
|
|
38
|
+
const { globalMetadataState: { allProducts }, } = useContext(GlobalMetadataStateContext);
|
|
32
39
|
const canAddAttachments = ability.can(resourceActions.PATCH, resources.CASE_CREATE, CaseListFields.ATTACHMENTS);
|
|
33
40
|
const { attachmentState } = useContext(AttachmentStateContext);
|
|
34
41
|
const isAnyFileAttachedLocal = isAnyFileAttached(attachmentState.caseFiles.selectedLocalFiles);
|
|
35
42
|
const [confirmationModalType, setConfirmationModalType] = useState(null);
|
|
36
43
|
const viewedConfirmationModalsList = useRef([]);
|
|
37
|
-
const canCreateCase = useCanCreateCase();
|
|
38
|
-
const isIdea = ((_a = caseState === null || caseState === void 0 ? void 0 : caseState.caseDetails) === null || _a === void 0 ? void 0 : _a.caseType) === PreviousCaseTypes.FEATURE_ENHANCEMENT;
|
|
39
|
-
const appRouteConfugurations = getAppRouteConfugurations(isCaseCreate, isIdea, caseState.caseDetails.product);
|
|
40
44
|
const closeROCMProductModal = () => {
|
|
41
45
|
const productName = 'OpenShift Container Platform';
|
|
42
46
|
// if user click on Cancel then change product selection.
|
|
@@ -68,7 +72,7 @@ export function WizardLayout(props) {
|
|
|
68
72
|
}
|
|
69
73
|
return isModalPresent;
|
|
70
74
|
};
|
|
71
|
-
const submitCaseAndNavigate = (isReSubmitting) => {
|
|
75
|
+
const submitCaseAndNavigate = (isReSubmitting) => __awaiter(this, void 0, void 0, function* () {
|
|
72
76
|
confirmationModalType && setConfirmationModalType(null);
|
|
73
77
|
// if a confirmation modal exists, show it and don't submit the case as
|
|
74
78
|
// it will be handled by the confirmation modal itself
|
|
@@ -84,34 +88,17 @@ export function WizardLayout(props) {
|
|
|
84
88
|
// reset viewedModals on case submit
|
|
85
89
|
viewedConfirmationModalsList.current = [];
|
|
86
90
|
!isReSubmitting &&
|
|
87
|
-
RouteUtils.navigateToSection(props.routeProps,
|
|
88
|
-
};
|
|
89
|
-
const
|
|
90
|
-
var _a;
|
|
91
|
-
if (appRouteConfugurations[activeSection].nextSection === AppRouteSections.SUBMIT_CASE) {
|
|
92
|
-
submitCaseAndNavigate(false);
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
91
|
+
RouteUtils.navigateToSection(props.routeProps, `${RouteUtils.seBasePath}/${AppRouteSections.SUBMIT_CASE}`, false);
|
|
92
|
+
});
|
|
93
|
+
const confirmSupportModal = (isConfirmedStateSideSupport, hasPreferredSecureSupportAccount) => {
|
|
95
94
|
// confirmed state side support show modal logic
|
|
96
|
-
if (
|
|
97
|
-
|
|
98
|
-
return;
|
|
99
|
-
const isConfirmedStateSideSupport = loggedInUsersAccount.data && loggedInUsersAccount.data.hasConfirmedStatesideSupport;
|
|
100
|
-
const hasPreferredSecureSupportAccount = (_a = loggedInUsersAccount === null || loggedInUsersAccount === void 0 ? void 0 : loggedInUsersAccount.data) === null || _a === void 0 ? void 0 : _a.hasPreferredSecureSupportAccount;
|
|
101
|
-
if (isConfirmedStateSideSupport) {
|
|
102
|
-
setConfirmationModalType(PreCaseConfirmationModalsEnum.CSS_MODAL);
|
|
103
|
-
}
|
|
104
|
-
else if (hasPreferredSecureSupportAccount) {
|
|
105
|
-
setConfirmationModalType(PreCaseConfirmationModalsEnum.PREFERRED_GS4_Modal);
|
|
106
|
-
// track pendo event
|
|
107
|
-
pendoTrackEvent(preferredSSModalOpenPendoEvent);
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
RouteUtils.navigateToSection(props.routeProps, appRouteConfugurations[activeSection].nextSection, getAppRouteSectionsSequence(sectionsToHide, isCaseCreate, isSearchIntent, isIdea), isCaseCreate, isSearchIntent, isIdea, false);
|
|
111
|
-
}
|
|
95
|
+
if (isConfirmedStateSideSupport) {
|
|
96
|
+
setConfirmationModalType(PreCaseConfirmationModalsEnum.CSS_MODAL);
|
|
112
97
|
}
|
|
113
|
-
else {
|
|
114
|
-
|
|
98
|
+
else if (hasPreferredSecureSupportAccount) {
|
|
99
|
+
setConfirmationModalType(PreCaseConfirmationModalsEnum.PREFERRED_GS4_Modal);
|
|
100
|
+
// track pendo event
|
|
101
|
+
pendoTrackEvent(preferredSSModalOpenPendoEvent);
|
|
115
102
|
}
|
|
116
103
|
};
|
|
117
104
|
const onModalClose = () => {
|
|
@@ -121,10 +108,12 @@ export function WizardLayout(props) {
|
|
|
121
108
|
setConfirmationModalType(null);
|
|
122
109
|
};
|
|
123
110
|
return (React.createElement(React.Fragment, null,
|
|
111
|
+
React.createElement(GlobalTroubleshootEffects, { routeProps: props.routeProps }),
|
|
124
112
|
activeSection !== AppRouteSections.DESCRIBE_IDEA && (React.createElement(PreCaseConfirmationModals, { onModalClose: onModalClose, confirmationModalType: confirmationModalType, onConfirm: () => submitCaseAndNavigate(caseState.caseCreationError) })),
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
113
|
+
React.createElement(Grid, { style: { height: '100%' } },
|
|
114
|
+
React.createElement(GridItem, { sm: 12, md: 12, lg: 8, xl2: 8 },
|
|
115
|
+
React.createElement(WizardMain, { routeProps: props.routeProps, submitCaseAndNavigate: submitCaseAndNavigate, confirmSupportModal: confirmSupportModal })),
|
|
116
|
+
React.createElement(GridItem, { span: 4, className: "grid-wizard-aside-content" },
|
|
117
|
+
React.createElement(WizardAside, { isAttachmentUploadModalOpen: confirmationModalType === PreCaseConfirmationModalsEnum.NO_ATTACHMENT_MODAL, routeProps: props.routeProps }))),
|
|
129
118
|
React.createElement(AlertToastWrapper, { submitCaseAndNavigate: submitCaseAndNavigate })));
|
|
130
119
|
}
|
|
@@ -2,10 +2,9 @@ import { RouteComponentProps } from 'react-router-dom';
|
|
|
2
2
|
import { IRouteUrlParams } from '../../reducers/RouteConstNTypes';
|
|
3
3
|
interface IProps {
|
|
4
4
|
routeProps: RouteComponentProps<IRouteUrlParams>;
|
|
5
|
+
submitCaseAndNavigate: (isReSubmitting: boolean) => void;
|
|
6
|
+
confirmSupportModal: (isConfirmedStateSideSupport: boolean, hasPreferredSecureSupportAccount: boolean) => void;
|
|
5
7
|
}
|
|
6
8
|
declare function WizardMain(props: IProps): JSX.Element;
|
|
7
|
-
declare namespace WizardMain {
|
|
8
|
-
var defaultProps: Partial<IProps>;
|
|
9
|
-
}
|
|
10
9
|
export default WizardMain;
|
|
11
10
|
//# sourceMappingURL=WizardMain.d.ts.map
|
|
@@ -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":"AAKA,OAAO,EAAS,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAK9D,OAAO,EAAoB,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAOpF,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;IACjD,qBAAqB,EAAE,CAAC,cAAc,EAAE,OAAO,KAAK,IAAI,CAAC;IACzD,mBAAmB,EAAE,CAAC,2BAA2B,EAAE,OAAO,EAAE,gCAAgC,EAAE,OAAO,KAAK,IAAI,CAAC;CAClH;AAED,iBAAS,UAAU,CAAC,KAAK,EAAE,MAAM,eAmGhC;AACD,eAAe,UAAU,CAAC"}
|