@rh-support/troubleshoot 2.2.90-beta.2 → 2.2.90-beta.3
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/CaseDetails/Summary.js +2 -2
- package/lib/esm/components/CaseInformation/OpenCaseIssue.d.ts.map +1 -1
- package/lib/esm/components/CaseInformation/OpenCaseIssue.js +10 -7
- package/lib/esm/components/shared/useIsSectionValid.d.ts.map +1 -1
- package/lib/esm/components/shared/useIsSectionValid.js +6 -2
- package/lib/esm/reducers/CaseHelpers.d.ts.map +1 -1
- package/lib/esm/reducers/CaseHelpers.js +11 -0
- package/package.json +2 -2
|
@@ -57,11 +57,11 @@ function Summary(props) {
|
|
|
57
57
|
try {
|
|
58
58
|
yield updateCaseDetails(caseDispatch, caseNumber, caseDetails);
|
|
59
59
|
setIsSummaryUpdating(false);
|
|
60
|
-
ToastNotification.addSuccessMessage(t(`
|
|
60
|
+
ToastNotification.addSuccessMessage(t(`Problem statement has been successfully updated`));
|
|
61
61
|
}
|
|
62
62
|
catch (e) {
|
|
63
63
|
setIsSummaryUpdating(false);
|
|
64
|
-
caseUpdateError.showError(e, t(`
|
|
64
|
+
caseUpdateError.showError(e, t(`Problem statement failed to updated`));
|
|
65
65
|
throw e;
|
|
66
66
|
}
|
|
67
67
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenCaseIssue.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/OpenCaseIssue.tsx"],"names":[],"mappings":"AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"OpenCaseIssue.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/OpenCaseIssue.tsx"],"names":[],"mappings":"AAKA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAQ/D,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;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AASD,iBAAS,aAAa,CAAC,KAAK,EAAE,MAAM,qBAgInC;kBAhIQ,aAAa;;;AAmItB,eAAe,aAAa,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { Progress, ProgressMeasureLocation, ProgressSize, ProgressVariant } from
|
|
|
2
2
|
import { InlineEdit } from '@rh-support/components';
|
|
3
3
|
import { PreviousCaseTypes } from '@rh-support/utils';
|
|
4
4
|
import isEmpty from 'lodash/isEmpty';
|
|
5
|
-
import React, { useContext, useState } from 'react';
|
|
5
|
+
import React, { useContext, useEffect, useState } from 'react';
|
|
6
6
|
import { Trans, useTranslation } from 'react-i18next';
|
|
7
7
|
import { useCaseDispatch, useCaseSelector } from '../../context/CaseContext';
|
|
8
8
|
import { RouteContext } from '../../context/RouteContext';
|
|
@@ -22,12 +22,12 @@ function OpenCaseIssue(props) {
|
|
|
22
22
|
supportType: state.caseDetails.caseType,
|
|
23
23
|
}));
|
|
24
24
|
const caseDispatch = useCaseDispatch();
|
|
25
|
-
const [
|
|
25
|
+
const [isSummaryEmpty, setIsSummaryEmpty] = useState(false);
|
|
26
26
|
const [hasLargeSummary, setHasLargeSummary] = useState(false);
|
|
27
27
|
const { routeState: { isNextBtnClickedToShowValidationError }, } = useContext(RouteContext);
|
|
28
28
|
const onSummaryBlur = (e) => {
|
|
29
29
|
var _a;
|
|
30
|
-
|
|
30
|
+
setIsSummaryEmpty(isEmpty((_a = e.target.value) === null || _a === void 0 ? void 0 : _a.trim()));
|
|
31
31
|
};
|
|
32
32
|
const onCaseDetailsChange = (caseDetails) => {
|
|
33
33
|
setCaseDetails(caseDispatch, caseDetails);
|
|
@@ -37,7 +37,6 @@ function OpenCaseIssue(props) {
|
|
|
37
37
|
const summaryLocal = isEmpty((_a = e.target.value) === null || _a === void 0 ? void 0 : _a.trim()) ? '' : e.target.value;
|
|
38
38
|
setHasLargeSummary(summaryLocal.length > SUMMARY_LENGTH_LIMIT);
|
|
39
39
|
onCaseDetailsChange({ summary: summaryLocal });
|
|
40
|
-
setIsSummaryInValid(isEmpty(summaryLocal === null || summaryLocal === void 0 ? void 0 : summaryLocal.trim()));
|
|
41
40
|
};
|
|
42
41
|
const getVariant = () => {
|
|
43
42
|
if (getIsSummaryInvalid())
|
|
@@ -54,7 +53,11 @@ function OpenCaseIssue(props) {
|
|
|
54
53
|
return ProgressVariant.success;
|
|
55
54
|
}
|
|
56
55
|
};
|
|
57
|
-
const getIsSummaryInvalid = () =>
|
|
56
|
+
const getIsSummaryInvalid = () => hasLargeSummary || (isNextBtnClickedToShowValidationError && isSummaryEmpty);
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
setIsSummaryEmpty(summary ? isEmpty(summary.trim()) : true);
|
|
59
|
+
// @ts-ignore
|
|
60
|
+
}, [summary]);
|
|
58
61
|
return (React.createElement(React.Fragment, null,
|
|
59
62
|
React.createElement(InlineEdit, { labelProps: {
|
|
60
63
|
htmlFor: supportType === PreviousCaseTypes.FEATURE_ENHANCEMENT
|
|
@@ -63,10 +66,10 @@ function OpenCaseIssue(props) {
|
|
|
63
66
|
}, labelContent: React.createElement(React.Fragment, null,
|
|
64
67
|
React.createElement(Trans, null, supportType === PreviousCaseTypes.FEATURE_ENHANCEMENT ? 'Title' : 'Problem statement'),
|
|
65
68
|
' ',
|
|
66
|
-
!!props.required && (React.createElement("span", { className: "form-required", "aria-hidden": true }, "*"))), allowInlineEdit: props.inlineEditable, hideSaveCancel: !!props.hideSaveCancel, initialIsEditing: !!props.initialIsEditing, saveOnBlur: true, collapseOnBlur: !!props.collapseOnBlur && !
|
|
69
|
+
!!props.required && (React.createElement("span", { className: "form-required", "aria-hidden": true }, "*"))), allowInlineEdit: props.inlineEditable, hideSaveCancel: !!props.hideSaveCancel, initialIsEditing: !!props.initialIsEditing, saveOnBlur: true, collapseOnBlur: !!props.collapseOnBlur && !isSummaryEmpty, content: summary },
|
|
67
70
|
React.createElement("textarea", { id: supportType === PreviousCaseTypes.FEATURE_ENHANCEMENT
|
|
68
71
|
? 'get-support-title'
|
|
69
|
-
: 'get-support-summary', className: `form-control${getIsSummaryInvalid() ? ' form-invalid' : ''}`, "aria-invalid":
|
|
72
|
+
: 'get-support-summary', className: `form-control${getIsSummaryInvalid() ? ' form-invalid' : ''}`, "aria-invalid": getIsSummaryInvalid(), "aria-required": !!props.required, required: !!props.required, name: supportType === PreviousCaseTypes.FEATURE_ENHANCEMENT
|
|
70
73
|
? 'get-support-title'
|
|
71
74
|
: 'get-support-summary', placeholder: t('i18nkeySummarizeExperience', "Please describe the problem you are facing, including any specific steps you've taken or error messages."), value: summary, onChange: onSummaryChange, onBlur: onSummaryBlur, autoFocus: !!props.autoFocus, "data-tracking-id": supportType === PreviousCaseTypes.FEATURE_ENHANCEMENT
|
|
72
75
|
? 'get-support-title'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIsSectionValid.d.ts","sourceRoot":"","sources":["../../../../src/components/shared/useIsSectionValid.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAqB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useIsSectionValid.d.ts","sourceRoot":"","sources":["../../../../src/components/shared/useIsSectionValid.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAqB1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAInE,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,gBAAgB;;;;;EAiM9D"}
|
|
@@ -8,13 +8,13 @@ import { useCaseSelector } from '../../context/CaseContext';
|
|
|
8
8
|
import { RecommendationStateContext } from '../../context/RecommendationContext';
|
|
9
9
|
import { RouteContext } from '../../context/RouteContext';
|
|
10
10
|
import { TCStateContext } from '../../context/TopContentContext';
|
|
11
|
-
import { CASE_REFERENCE_NUMBER_LIMIT, CONTACT_INFO_24X7_LIMIT, HOSTNAME_LENGTH_LIMIT, SUMMARY_LENGTH_LIMIT, } from '../../reducers/CaseConstNTypes';
|
|
11
|
+
import { CASE_REFERENCE_NUMBER_LIMIT, CONTACT_INFO_24X7_LIMIT, DESCRIPTION_LENGTH_LIMIT, HOSTNAME_LENGTH_LIMIT, SUMMARY_LENGTH_LIMIT, } from '../../reducers/CaseConstNTypes';
|
|
12
12
|
import { isCaseInformationSectionValid, isCaseManagementStateValid, isCaseStateValid, isClusterIDValid, isIdeaCaseStateValid, } from '../../reducers/CaseHelpers';
|
|
13
13
|
import { AppRouteSections } from '../../reducers/RouteConstNTypes';
|
|
14
14
|
import { AttachmentStateContext } from './fileUpload/reducer/AttachmentReducerContext';
|
|
15
15
|
export function useIsSectionValid(sectionName) {
|
|
16
16
|
var _a, _b;
|
|
17
|
-
const { caseState, caseType, product, version, contactSSOName, accountNumber, summary, hostname, contactInfo24x7, alternateId, selectedAccountDetails, } = useCaseSelector((state) => ({
|
|
17
|
+
const { caseState, caseType, product, version, contactSSOName, accountNumber, summary, description, hostname, contactInfo24x7, alternateId, selectedAccountDetails, } = useCaseSelector((state) => ({
|
|
18
18
|
caseState: state,
|
|
19
19
|
caseType: state.caseDetails.caseType,
|
|
20
20
|
product: state.caseDetails.product,
|
|
@@ -22,6 +22,7 @@ export function useIsSectionValid(sectionName) {
|
|
|
22
22
|
contactSSOName: state.caseDetails.contactSSOName,
|
|
23
23
|
accountNumber: state.caseDetails.accountNumberRef,
|
|
24
24
|
summary: state.caseDetails.summary,
|
|
25
|
+
description: state.caseDetails.description,
|
|
25
26
|
hostname: state.caseDetails.hostname,
|
|
26
27
|
contactInfo24x7: state.caseDetails.contactInfo24x7,
|
|
27
28
|
alternateId: state.caseDetails.alternateId,
|
|
@@ -74,7 +75,10 @@ export function useIsSectionValid(sectionName) {
|
|
|
74
75
|
// don't check for entitled product if user is on search intent flow
|
|
75
76
|
const isEntitledProductLocal = isSearchIntent ? true : isEntitledProduct;
|
|
76
77
|
return (!recommendationState.isLoadingRecommendations &&
|
|
78
|
+
!isEmpty(summary) &&
|
|
77
79
|
isEntitledProductLocal &&
|
|
80
|
+
(summary === null || summary === void 0 ? void 0 : summary.length) <= SUMMARY_LENGTH_LIMIT &&
|
|
81
|
+
(description === null || description === void 0 ? void 0 : description.length) <= DESCRIPTION_LENGTH_LIMIT &&
|
|
78
82
|
isClusterIDValid(caseState, (_a = allProducts.data) === null || _a === void 0 ? void 0 : _a.productsResult));
|
|
79
83
|
};
|
|
80
84
|
const isReviewSectionValid = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseHelpers.d.ts","sourceRoot":"","sources":["../../../src/reducers/CaseHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,qDAAqD,CAAC;AACpG,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AACvG,OAAO,EAAE,YAAY,EAAE,MAAM,iDAAiD,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAmB3D,OAAO,EAUH,UAAU,EAeb,MAAM,mBAAmB,CAAC;AAE3B,eAAO,MAAM,sBAAsB,SAAU,mBAAmB,EAAE,wBAMjE,CAAC;AAEF,eAAO,MAAM,2BAA2B,eAAgB,WAAW,KAAG,MAOrE,CAAC;AAEF,eAAO,MAAM,uBAAuB,QAAS,mBAAmB,SAAS,MAAM,sBAyB9E,CAAC;AAIF,eAAO,MAAM,qBAAqB,UACvB,MAAM,gBACC,MAAM,uBACC,MAAM,yBACJ,MAAM,kBACb,MAAM,YACZ,MAAM,YACN,MAAM,KACjB,MAyBF,C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,gCACJ,QAAQ,EAAE,KACzC,eAiDF,CAAC"}
|
|
@@ -183,6 +183,13 @@ export const isIdeaCaseStateValid = (caseState, loggedInUserJwtToken) => {
|
|
|
183
183
|
export const isCaseManagementStateValid = (caseState, loggedInUserJwtToken) => {
|
|
184
184
|
const case_details = caseState.caseDetails;
|
|
185
185
|
return (isEmpty(case_details.caseNumber) &&
|
|
186
|
+
!caseState.hasLargeCaseDescription &&
|
|
187
|
+
!isEmpty(case_details.product) &&
|
|
188
|
+
!isEmpty(case_details.version) &&
|
|
189
|
+
!isEmpty(case_details.summary) &&
|
|
190
|
+
case_details.summary.length <= SUMMARY_LENGTH_LIMIT &&
|
|
191
|
+
!isEmpty(case_details.description) &&
|
|
192
|
+
case_details.description.length <= DESCRIPTION_LENGTH_LIMIT &&
|
|
186
193
|
!isEmpty(case_details.severity) &&
|
|
187
194
|
(caseState.selectedAccountDetails.data.requireCGroupOnCreate
|
|
188
195
|
? !isEmpty(case_details.groupNumber) && case_details.groupNumber !== '-1'
|
|
@@ -196,6 +203,10 @@ export const isCaseInformationSectionValid = (caseState, loggedInUserJwtToken) =
|
|
|
196
203
|
//checks to ensure the ktquestion section is valid
|
|
197
204
|
return (isEmpty(case_details.caseNumber) &&
|
|
198
205
|
!caseState.hasLargeCaseDescription &&
|
|
206
|
+
!isEmpty(case_details.product) &&
|
|
207
|
+
!isEmpty(case_details.version) &&
|
|
208
|
+
!isEmpty(case_details.summary) &&
|
|
209
|
+
case_details.summary.length <= SUMMARY_LENGTH_LIMIT &&
|
|
199
210
|
!isEmpty(case_details.description) &&
|
|
200
211
|
case_details.description.length <= DESCRIPTION_LENGTH_LIMIT &&
|
|
201
212
|
!isEmpty(case_details.timeFramesAndUrgency) &&
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/troubleshoot",
|
|
3
|
-
"version": "2.2.90-beta.
|
|
3
|
+
"version": "2.2.90-beta.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -132,5 +132,5 @@
|
|
|
132
132
|
"defaults and supports es6-module",
|
|
133
133
|
"maintained node versions"
|
|
134
134
|
],
|
|
135
|
-
"gitHead": "
|
|
135
|
+
"gitHead": "e6e54f44311de3872889f6ced4e5af9f5f8dacc5"
|
|
136
136
|
}
|