@rh-support/troubleshoot 1.0.38 → 1.0.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"CaseAlternateId.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDetails/CaseAlternateId.tsx"],"names":[],"mappings":"AAiBA,UAAU,MAAM;IACZ,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AAOD,iBAAS,eAAe,CAAC,KAAK,EAAE,MAAM,eAqIrC;kBArIQ,eAAe;;;AAwIxB,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"CaseAlternateId.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDetails/CaseAlternateId.tsx"],"names":[],"mappings":"AA2BA,UAAU,MAAM;IACZ,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AAOD,iBAAS,eAAe,CAAC,KAAK,EAAE,MAAM,eA0KrC;kBA1KQ,eAAe;;;AA6KxB,eAAe,eAAe,CAAC"}
@@ -7,11 +7,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { Tooltip, TooltipPosition } from '@patternfly/react-core';
10
+ import { InputGroupText, InputGroupTextVariant, Spinner, TextInput, TextInputGroup, Tooltip, TooltipPosition, ValidatedOptions, } from '@patternfly/react-core';
11
+ import CheckIcon from '@patternfly/react-icons/dist/js/icons/check-icon';
11
12
  import InfoIcon from '@patternfly/react-icons/dist/js/icons/info-circle-icon';
12
- import { InlineEdit, LoadingIndicator, ToastNotification, ValueChangedIcon } from '@rh-support/components';
13
+ import TimesIcon from '@patternfly/react-icons/dist/js/icons/times-icon';
14
+ import { NewInlineEdit, ToastNotification, ValueChangedIcon } from '@rh-support/components';
13
15
  import { useCanEditCase } from '@rh-support/react-context';
14
- import isEmpty from 'lodash/isEmpty';
15
16
  import isEqual from 'lodash/isEqual';
16
17
  import React, { useEffect, useState } from 'react';
17
18
  import { Trans, useTranslation } from 'react-i18next';
@@ -23,7 +24,7 @@ import { CaseValuesToWatch } from '../../../shared/Constants';
23
24
  import { getChangedValueTooltip } from '../../../shared/utils';
24
25
  const defaultProps = {
25
26
  inlineEditable: true,
26
- hideSaveCancel: false,
27
+ hideSaveCancel: true,
27
28
  };
28
29
  function CaseAlternateId(props) {
29
30
  const { t } = useTranslation();
@@ -39,18 +40,22 @@ function CaseAlternateId(props) {
39
40
  const [localAltIDChange, setLocalAltIDChange] = useState(false);
40
41
  const afterLocalChange = () => setLocalAltIDChange(false);
41
42
  const canEditCase = useCanEditCase();
43
+ // To keep track of Cancel button state to close InlineEdit input mode
44
+ const [isCancelClicked, setIsCancelClicked] = useState(false);
45
+ // To keep track of Save button state to close InlineEdit input mode
46
+ const [isSaveClicked, setIsSaveClicked] = useState(false);
42
47
  useEffect(() => {
43
48
  if (alternateId !== alternateIdState) {
44
49
  setAlternateIdState(alternateId);
45
50
  }
46
51
  // eslint-disable-next-line react-hooks/exhaustive-deps
47
52
  }, [alternateId]);
48
- const onAlternateIdChange = (e) => {
49
- var _a;
53
+ // Function to handle when Alternate ID changes
54
+ const onAlternateIdChange = (value) => {
50
55
  if (canEditCase.alert())
51
56
  return;
52
- setAlternateIdState(e.target.value);
53
- !caseNumber && setCaseDetails(caseDispatch, { alternateId: (_a = e.target.value) === null || _a === void 0 ? void 0 : _a.trim() });
57
+ setAlternateIdState(value);
58
+ !caseNumber && setCaseDetails(caseDispatch, { alternateId: value === null || value === void 0 ? void 0 : value.trim() });
54
59
  };
55
60
  const updateAlternateId = () => __awaiter(this, void 0, void 0, function* () {
56
61
  try {
@@ -71,32 +76,45 @@ function CaseAlternateId(props) {
71
76
  yield updateAlternateId();
72
77
  }
73
78
  setLocalAltIDChange(true);
79
+ setIsSaveClicked(!isSaveClicked);
74
80
  });
75
81
  const onCancel = () => {
76
82
  setAlternateIdState(alternateId);
83
+ setIsCancelClicked(!isCancelClicked);
77
84
  };
78
85
  const maxLengthErrorMessage = t('Alternate case ID cannot be more than {{limit}} characters.', {
79
86
  limit: ALTERNATE_CASE_ID_LIMIT,
80
87
  });
81
- // To check if alternate ID is empty
82
- const isAlternateIDEmpty = isEmpty(alternateIdState === null || alternateIdState === void 0 ? void 0 : alternateIdState.trim());
83
- // To populate the unsaved alternateId field with the previously saved value on onBlur event.
84
- const onBlur = () => {
85
- if (alternateId !== alternateIdState) {
86
- setAlternateIdState(alternateId);
88
+ // Conditions to disable save button
89
+ const saveDisabled = alternateIdState === alternateId || isUpdating || (alternateIdState === null || alternateIdState === void 0 ? void 0 : alternateIdState.length) > ALTERNATE_CASE_ID_LIMIT;
90
+ // Function to handle keyDown events
91
+ const handleKeyDown = (e) => __awaiter(this, void 0, void 0, function* () {
92
+ // Cancel on pressing esc
93
+ if (e.keyCode === 27) {
94
+ yield onCancel();
87
95
  }
88
- };
96
+ // Save on pressing enter
97
+ else if (!saveDisabled && e.keyCode === 13) {
98
+ yield onSave();
99
+ }
100
+ });
89
101
  return (React.createElement(React.Fragment, null,
90
- React.createElement(InlineEdit, { labelProps: { htmlFor: 'case-details-alternate-id' }, labelContent: React.createElement(React.Fragment, null,
102
+ React.createElement(NewInlineEdit, { labelProps: { htmlFor: 'case-details-alternate-id' }, labelContent: React.createElement(React.Fragment, null,
91
103
  React.createElement(Trans, null, "Alternate case ID"),
92
104
  React.createElement(ValueChangedIcon, { afterLocalChange: afterLocalChange, isLocalChange: localAltIDChange, value: alternateId, getTooltipContent: getChangedValueTooltip(() => CaseValuesToWatch.altID) }),
93
105
  ' ',
94
106
  React.createElement(Tooltip, { trigger: 'mouseenter focus', position: TooltipPosition.top, content: React.createElement(Trans, null, "Add your internal tracking ID to better identify and organize support issues.") },
95
- React.createElement(InfoIcon, { className: "pf-u-ml-sm", "aria-label": "Case Alternate ID" }))), allowInlineEdit: props.inlineEditable, content: alternateId, initialIsEditing: true, hideSaveCancel: props.hideSaveCancel, onSave: onSave, onCancel: onCancel, saveDisabled: isAlternateIDEmpty ||
96
- alternateIdState === alternateId ||
97
- isUpdating ||
98
- (alternateIdState === null || alternateIdState === void 0 ? void 0 : alternateIdState.length) > ALTERNATE_CASE_ID_LIMIT, loadingIndicator: isUpdating ? React.createElement(LoadingIndicator, { isInline: true }) : null },
99
- React.createElement("input", { value: alternateIdState, type: "text", className: "form-control", id: "case-details-alternate-id", placeholder: t(`Enter your case tracking number or internal incident ID`), onChange: onAlternateIdChange, disabled: isUpdating, "data-tracking-id": "case-details-alternate-id", onBlur: onBlur })),
107
+ React.createElement(InfoIcon, { className: "pf-u-ml-sm", "aria-label": "Case Alternate ID" }))), allowInlineEdit: props.inlineEditable, content: alternateId || t('No Alternate case ID to display.'), hideSaveCancel: props.hideSaveCancel, saveDisabled: saveDisabled, charCount: (alternateIdState === null || alternateIdState === void 0 ? void 0 : alternateIdState.length) || 0, charTotal: ALTERNATE_CASE_ID_LIMIT, cancelToggleState: isCancelClicked, saveToggleState: isSaveClicked },
108
+ React.createElement(TextInputGroup, null,
109
+ React.createElement(TextInput, { value: alternateIdState, type: "text", className: "form-control", id: "case-details-alternate-id", placeholder: t(`Enter your case tracking number or internal incident ID`), onChange: onAlternateIdChange, "data-tracking-id": "case-details-alternate-id", isDisabled: isUpdating, onKeyDown: handleKeyDown, validated: (alternateIdState === null || alternateIdState === void 0 ? void 0 : alternateIdState.length) > ALTERNATE_CASE_ID_LIMIT
110
+ ? ValidatedOptions.error
111
+ : ValidatedOptions.default }),
112
+ !isUpdating ? (React.createElement(InputGroupText, { variant: InputGroupTextVariant.plain },
113
+ React.createElement("button", { className: "btn btn-app btn-link pf-u-ml-sm", type: "button", disabled: saveDisabled, onClick: onSave },
114
+ React.createElement(CheckIcon, null)),
115
+ React.createElement("button", { className: "btn btn-app btn-link", type: "button", onClick: onCancel },
116
+ React.createElement(TimesIcon, { color: "#6A6E73" })))) : (React.createElement(InputGroupText, { variant: InputGroupTextVariant.plain },
117
+ React.createElement(Spinner, { isSVG: true, size: "lg", className: "pf-u-ml-2xl pf-u-mr-xl" }))))),
100
118
  (alternateIdState === null || alternateIdState === void 0 ? void 0 : alternateIdState.length) > ALTERNATE_CASE_ID_LIMIT && (React.createElement("div", { className: "pull-top" },
101
119
  React.createElement("p", { className: "form-instructions form-invalid" },
102
120
  React.createElement(Trans, null, maxLengthErrorMessage))))));
@@ -1 +1 @@
1
- {"version":3,"file":"CaseOpenshiftClusterId.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/CaseEditView/Tabs/CaseDetails/CaseOpenshiftClusterId/CaseOpenshiftClusterId.tsx"],"names":[],"mappings":"AA2BA,wBAAgB,sBAAsB,gBA8RrC"}
1
+ {"version":3,"file":"CaseOpenshiftClusterId.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/CaseEditView/Tabs/CaseDetails/CaseOpenshiftClusterId/CaseOpenshiftClusterId.tsx"],"names":[],"mappings":"AA2BA,wBAAgB,sBAAsB,gBAgSrC"}
@@ -50,6 +50,7 @@ export function CaseOpenshiftClusterId() {
50
50
  const displayName = useRef('');
51
51
  const previousLocalOpenshiftClusterIDState = usePrevious(localOpenshiftClusterIDState);
52
52
  const previousSelectedReason = usePrevious(selectedReason);
53
+ const previousProduct = usePrevious(product);
53
54
  const { t } = useTranslation();
54
55
  const clusterStateReset = () => {
55
56
  setSelectedReason('');
@@ -72,7 +73,8 @@ export function CaseOpenshiftClusterId() {
72
73
  const hasCluster = yield isClusterIdEnabledForProduct(product, (_b = allProducts.data) === null || _b === void 0 ? void 0 : _b.productsResult);
73
74
  setShowClusterId(hasCluster);
74
75
  // when product changes from a product with cluster to a product without cluster, reset the clusterId
75
- const isResetClusterID = !hasCluster || isOpenShiftV3;
76
+ const IsProductHasChanged = previousProduct && previousProduct !== product;
77
+ const isResetClusterID = (!hasCluster || isOpenShiftV3) && IsProductHasChanged;
76
78
  if (isResetClusterID) {
77
79
  const caseDetails = {
78
80
  openshiftClusterID: '',
@@ -1,6 +1,7 @@
1
1
  interface IProps {
2
2
  inlineEditable?: boolean;
3
3
  hideLabel?: boolean;
4
+ hideSaveCancel?: boolean;
4
5
  }
5
6
  declare function Summary(props: IProps): JSX.Element;
6
7
  declare namespace Summary {
@@ -1 +1 @@
1
- {"version":3,"file":"Summary.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDetails/Summary.tsx"],"names":[],"mappings":"AAaA,UAAU,MAAM;IACZ,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAOD,iBAAS,OAAO,CAAC,KAAK,EAAE,MAAM,eAiI7B;kBAjIQ,OAAO;;;AAoIhB,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"Summary.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDetails/Summary.tsx"],"names":[],"mappings":"AAuBA,UAAU,MAAM;IACZ,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AAQD,iBAAS,OAAO,CAAC,KAAK,EAAE,MAAM,eAwL7B;kBAxLQ,OAAO;;;AA2LhB,eAAe,OAAO,CAAC"}
@@ -7,7 +7,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { InlineEdit, LoadingIndicator, ToastNotification, ValueChangedIcon } from '@rh-support/components';
10
+ import { InputGroupText, InputGroupTextVariant, Spinner, TextInput, TextInputGroup, ValidatedOptions, } from '@patternfly/react-core';
11
+ import CheckIcon from '@patternfly/react-icons/dist/js/icons/check-icon';
12
+ import TimesIcon from '@patternfly/react-icons/dist/js/icons/times-icon';
13
+ import { NewInlineEdit, ToastNotification, ValueChangedIcon } from '@rh-support/components';
11
14
  import { useCanEditCase } from '@rh-support/react-context';
12
15
  import isEmpty from 'lodash/isEmpty';
13
16
  import isEqual from 'lodash/isEqual';
@@ -15,44 +18,37 @@ import React, { useEffect, useState } from 'react';
15
18
  import { Trans, useTranslation } from 'react-i18next';
16
19
  import { useCaseDispatch, useCaseSelector } from '../../../../context/CaseContext';
17
20
  import { useCaseUpdateErrorMessage } from '../../../../hooks/useCaseUpdateErrorMessage';
18
- import { SUMMARY_LENGTH_LIMIT, summaryMaxLengthErrorMessage } from '../../../../reducers/CaseConstNTypes';
21
+ import { SUMMARY_LENGTH_LIMIT } from '../../../../reducers/CaseConstNTypes';
19
22
  import { setCaseDetails, updateCaseDetails } from '../../../../reducers/CaseReducer';
20
23
  const defaultProps = {
21
- inlineEditable: false,
24
+ inlineEditable: true,
22
25
  hideLabel: false,
26
+ hideSaveCancel: true,
23
27
  };
24
28
  function Summary(props) {
25
29
  const { t } = useTranslation();
26
30
  const caseUpdateError = useCaseUpdateErrorMessage();
27
- const maxLengthErrorMessage = t(summaryMaxLengthErrorMessage, {
28
- limit: SUMMARY_LENGTH_LIMIT,
29
- });
30
31
  const { summary, caseNumber } = useCaseSelector((state) => ({
31
32
  summary: state.caseDetails.summary,
32
33
  caseNumber: state.caseDetails.caseNumber,
33
34
  }), isEqual);
34
35
  const caseDispatch = useCaseDispatch();
35
- const [isSummaryInValid, setIsSummaryInValid] = useState(false);
36
36
  const [summaryState, setSummaryState] = useState(summary);
37
37
  const [isSummaryUpdating, setIsSummaryUpdating] = useState(false);
38
- const [hasLargeSummary, setHasLargeSummary] = useState(false);
39
38
  const canEditCase = useCanEditCase();
40
39
  // value changed logic to show a none local severity change
41
40
  const [localSummaryChange, setLocalSummaryChange] = useState(false);
41
+ // To keep track of Cancel button state to close InlineEdit input mode
42
+ const [isCancelClicked, setIsCancelClicked] = useState(false);
43
+ // To keep track of Save button state to close InlineEdit input mode
44
+ const [isSaveClicked, setIsSaveClicked] = useState(false);
42
45
  const afterLocalChange = () => setLocalSummaryChange(false);
43
46
  const getSummaryChangedTT = () => React.createElement(Trans, null, "Summary has been updated");
44
- // Function to check if Invalid when input is non-focused
45
- const onSummaryBlur = (e) => {
46
- setIsSummaryInValid(isEmpty(e.target.value));
47
- };
48
47
  // Function to handle when summary changes
49
- const onSummaryChange = (e) => {
48
+ const onSummaryChange = (value) => {
50
49
  if (canEditCase.alert())
51
50
  return;
52
- const summaryLocal = e.target.value;
53
- summary.length > SUMMARY_LENGTH_LIMIT ? setHasLargeSummary(true) : setHasLargeSummary(false);
54
- setIsSummaryInValid(isEmpty(summaryLocal));
55
- setSummaryState(summaryLocal);
51
+ setSummaryState(value);
56
52
  };
57
53
  const onSummaryUpdate = (caseDetails) => __awaiter(this, void 0, void 0, function* () {
58
54
  setIsSummaryUpdating(true);
@@ -68,7 +64,6 @@ function Summary(props) {
68
64
  }
69
65
  });
70
66
  const onSave = (e) => __awaiter(this, void 0, void 0, function* () {
71
- setHasLargeSummary(false);
72
67
  const caseDetails = { summary: summaryState === null || summaryState === void 0 ? void 0 : summaryState.trim() };
73
68
  if (caseNumber) {
74
69
  // edit/view case
@@ -84,22 +79,64 @@ function Summary(props) {
84
79
  setCaseDetails(caseDispatch, caseDetails);
85
80
  }
86
81
  setLocalSummaryChange(true);
82
+ setIsSaveClicked(!isSaveClicked);
87
83
  });
88
84
  const onCancel = () => {
89
85
  setSummaryState(summary);
86
+ setIsCancelClicked(!isCancelClicked);
90
87
  };
91
88
  useEffect(() => {
92
89
  setSummaryState(summary);
93
90
  }, [summary]);
94
- return (React.createElement(InlineEdit, { labelProps: { htmlFor: 'case-details-summary' }, labelContent: React.createElement(React.Fragment, null,
95
- React.createElement(Trans, null, "Issue summary"),
96
- React.createElement(ValueChangedIcon, { afterLocalChange: afterLocalChange, isLocalChange: localSummaryChange, value: summary, getTooltipContent: getSummaryChangedTT }),
97
- React.createElement("span", { className: "form-required", "aria-hidden": true }, "*")), allowInlineEdit: props.inlineEditable, content: summary, onSave: onSave, onCancel: onCancel, saveDisabled: isSummaryInValid ||
98
- hasLargeSummary ||
99
- summaryState === summary ||
100
- (isSummaryUpdating && !isSummaryInValid), hideLabel: props.hideLabel, loadingIndicator: isSummaryUpdating && !isSummaryInValid ? React.createElement(LoadingIndicator, { isInline: true }) : null, isSpaceAllowed: false, inputValue: summaryState },
101
- React.createElement("input", { type: "text", id: "case-details-summary", className: `form-control${isSummaryInValid || hasLargeSummary ? ' form-invalid' : ''}`, "aria-invalid": isSummaryInValid, "aria-required": true, required: true, name: "case-details-summary", value: summaryState, onChange: onSummaryChange, onBlur: onSummaryBlur, disabled: isSummaryUpdating, "data-tracking-id": "case-details-summary" }),
102
- hasLargeSummary && React.createElement("p", { className: "form-instructions" }, maxLengthErrorMessage)));
91
+ // To check if summary is empty
92
+ const isSummaryEmpty = isEmpty(summaryState === null || summaryState === void 0 ? void 0 : summaryState.trim());
93
+ // Conditions to disable save button
94
+ const saveDisabled = isSummaryEmpty || (summaryState === null || summaryState === void 0 ? void 0 : summaryState.length) > SUMMARY_LENGTH_LIMIT || summaryState === summary || isSummaryUpdating;
95
+ // Error to show when input is empty.
96
+ const fieldEmptyErrorMessage = t('This field is required.');
97
+ // Function to handle keyDown events
98
+ const handleKeyDown = (e) => __awaiter(this, void 0, void 0, function* () {
99
+ // Cancel on pressing esc
100
+ if (e.keyCode === 27) {
101
+ yield onCancel();
102
+ }
103
+ // Save on pressing enter
104
+ else if (!saveDisabled && e.keyCode === 13) {
105
+ const caseDetails = { summary: summaryState === null || summaryState === void 0 ? void 0 : summaryState.trim() };
106
+ if (caseNumber) {
107
+ // edit/view case
108
+ try {
109
+ yield onSummaryUpdate(caseDetails);
110
+ }
111
+ catch (e) {
112
+ throw e;
113
+ }
114
+ }
115
+ else {
116
+ // create case
117
+ setCaseDetails(caseDispatch, caseDetails);
118
+ }
119
+ setLocalSummaryChange(true);
120
+ setIsSaveClicked(!isSaveClicked);
121
+ }
122
+ });
123
+ return (React.createElement(React.Fragment, null,
124
+ React.createElement(NewInlineEdit, { labelProps: { htmlFor: 'case-details-summary' }, labelContent: React.createElement(React.Fragment, null,
125
+ React.createElement(Trans, null, "Issue summary"),
126
+ React.createElement(ValueChangedIcon, { afterLocalChange: afterLocalChange, isLocalChange: localSummaryChange, value: summary, getTooltipContent: getSummaryChangedTT }),
127
+ React.createElement("span", { className: "form-required", "aria-hidden": true }, "*")), allowInlineEdit: props.inlineEditable, content: summary ? summary : t('No summary to display.'), saveDisabled: saveDisabled, hideLabel: props.hideLabel, hideSaveCancel: props.hideSaveCancel, charCount: (summaryState === null || summaryState === void 0 ? void 0 : summaryState.length) || 0, charTotal: SUMMARY_LENGTH_LIMIT, cancelToggleState: isCancelClicked, saveToggleState: isSaveClicked },
128
+ React.createElement(TextInputGroup, null,
129
+ React.createElement(TextInput, { type: "text", id: "case-details-summary", className: 'form-control', "aria-required": true, required: true, name: "case-details-summary", value: summaryState, onChange: onSummaryChange, isDisabled: isSummaryUpdating, "data-tracking-id": "case-details-summary", onKeyDown: handleKeyDown, validated: (summaryState === null || summaryState === void 0 ? void 0 : summaryState.length) > SUMMARY_LENGTH_LIMIT || isSummaryEmpty
130
+ ? ValidatedOptions.error
131
+ : ValidatedOptions.default }),
132
+ !isSummaryUpdating ? (React.createElement(InputGroupText, { variant: InputGroupTextVariant.plain },
133
+ React.createElement("button", { className: "btn btn-app btn-link pf-u-ml-sm", type: "button", disabled: saveDisabled, onClick: onSave },
134
+ React.createElement(CheckIcon, null)),
135
+ React.createElement("button", { className: "btn btn-app btn-link", type: "button", onClick: onCancel },
136
+ React.createElement(TimesIcon, { color: "#6A6E73" })))) : (React.createElement(InputGroupText, { variant: InputGroupTextVariant.plain },
137
+ React.createElement(Spinner, { isSVG: true, size: "lg", className: "pf-u-ml-2xl pf-u-mr-xl" }))))),
138
+ isSummaryEmpty && (React.createElement("p", { className: "form-instructions form-invalid" },
139
+ React.createElement(Trans, null, fieldEmptyErrorMessage)))));
103
140
  }
104
141
  Summary.defaultProps = defaultProps;
105
142
  export default Summary;
@@ -6,13 +6,13 @@ import { AppMetadataStateContext } from '../../context/AppMetadataContext';
6
6
  import { useCaseDispatch, useCaseSelector } from '../../context/CaseContext';
7
7
  import { getDescriptionWOQues } from '../../reducers/CaseHelpers';
8
8
  import { setCaseDetails, setDetectedLanguage } from '../../reducers/CaseReducer';
9
- import CaseAlternateId from '../CaseEditView/Tabs/CaseDetails/CaseAlternateId';
10
9
  import CaseGroup from '../CaseInformation/CaseGroup';
11
10
  import Fts from '../CaseInformation/Fts';
12
11
  import Severity from '../CaseInformation/Severity';
13
12
  import SupportLevel from '../CaseInformation/SupportLevel';
14
13
  import CaseLanguageSelector from './CaseLanguageSelector';
15
14
  import { Cep } from './Cep';
15
+ import OpenAlternateID from './OpenAlternateID';
16
16
  import { RHAssociatesSelector } from './RHAssociatesSelector';
17
17
  import CaseContactSelector from './SendNotifications/CaseContactSelector';
18
18
  export default function CaseManagement(props) {
@@ -62,6 +62,6 @@ export default function CaseManagement(props) {
62
62
  React.createElement(CaseLanguageSelector, null),
63
63
  canSeeEmailNotifications && React.createElement(CaseContactSelector, null),
64
64
  React.createElement(RHAssociatesSelector, null),
65
- React.createElement(CaseAlternateId, { inlineEditable: false, hideSaveCancel: true }),
65
+ React.createElement(OpenAlternateID, { inlineEditable: false, hideSaveCancel: true }),
66
66
  React.createElement(Cep, null)));
67
67
  }
@@ -0,0 +1,10 @@
1
+ interface IProps {
2
+ inlineEditable?: boolean;
3
+ hideSaveCancel?: boolean;
4
+ }
5
+ declare function OpenAlternateID(props: IProps): JSX.Element;
6
+ declare namespace OpenAlternateID {
7
+ var defaultProps: Partial<IProps>;
8
+ }
9
+ export default OpenAlternateID;
10
+ //# sourceMappingURL=OpenAlternateID.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenAlternateID.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseManagement/OpenAlternateID.tsx"],"names":[],"mappings":"AASA,UAAU,MAAM;IACZ,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AAOD,iBAAS,eAAe,CAAC,KAAK,EAAE,MAAM,eA8DrC;kBA9DQ,eAAe;;;AAiExB,eAAe,eAAe,CAAC"}
@@ -0,0 +1,44 @@
1
+ import { InlineEdit } from '@rh-support/components';
2
+ import isEqual from 'lodash/isEqual';
3
+ import React, { useEffect, useState } from 'react';
4
+ import { Trans, useTranslation } from 'react-i18next';
5
+ import { useCaseDispatch, useCaseSelector } from '../../context/CaseContext';
6
+ import { ALTERNATE_CASE_ID_LIMIT } from '../../reducers/CaseConstNTypes';
7
+ import { setCaseDetails } from '../../reducers/CaseReducer';
8
+ const defaultProps = {
9
+ inlineEditable: true,
10
+ hideSaveCancel: false,
11
+ };
12
+ function OpenAlternateID(props) {
13
+ const { t } = useTranslation();
14
+ const { alternateId, caseNumber } = useCaseSelector((state) => ({
15
+ alternateId: state.caseDetails.alternateId,
16
+ caseNumber: state.caseDetails.caseNumber,
17
+ }), isEqual);
18
+ const caseDispatch = useCaseDispatch();
19
+ const [alternateIdState, setAlternateIdState] = useState(alternateId);
20
+ useEffect(() => {
21
+ if (alternateId !== alternateIdState) {
22
+ setAlternateIdState(alternateId);
23
+ }
24
+ // eslint-disable-next-line react-hooks/exhaustive-deps
25
+ }, [alternateId]);
26
+ const onAlternateIdChange = (e) => {
27
+ var _a;
28
+ setAlternateIdState(e.target.value);
29
+ !caseNumber && setCaseDetails(caseDispatch, { alternateId: (_a = e.target.value) === null || _a === void 0 ? void 0 : _a.trim() });
30
+ };
31
+ const maxLengthErrorMessage = t('Alternate case ID cannot be more than {{limit}} characters.', {
32
+ limit: ALTERNATE_CASE_ID_LIMIT,
33
+ });
34
+ const isAlternateIDValid = (alternateIdState === null || alternateIdState === void 0 ? void 0 : alternateIdState.length) > ALTERNATE_CASE_ID_LIMIT;
35
+ return (React.createElement(React.Fragment, null,
36
+ React.createElement(InlineEdit, { labelProps: { htmlFor: 'open-case-alternate-id' }, labelContent: React.createElement(React.Fragment, null,
37
+ React.createElement(Trans, null, "Alternate case ID")), allowInlineEdit: props.inlineEditable, content: alternateId, hideSaveCancel: !!props.hideSaveCancel },
38
+ React.createElement("input", { value: alternateIdState, type: "text", className: `form-control${isAlternateIDValid ? ' form-invalid' : ''}`, id: "open-case-alternate-id", placeholder: t(`Enter your case tracking number or internal incident ID`), onChange: onAlternateIdChange, "data-tracking-id": "open-case-alternate-id" })),
39
+ isAlternateIDValid && (React.createElement("div", { className: "pull-top" },
40
+ React.createElement("p", { className: "form-instructions form-invalid" },
41
+ React.createElement(Trans, null, maxLengthErrorMessage))))));
42
+ }
43
+ OpenAlternateID.defaultProps = defaultProps;
44
+ export default OpenAlternateID;
@@ -42,7 +42,7 @@ export default function Issue() {
42
42
  React.createElement(OpenCaseIssue, { inlineEditable: true, hideSaveCancel: true, initialIsEditing: isEmpty(summary), required: true }),
43
43
  React.createElement(MoreOrLess, { maxHeight: 600, appStickyHeaderRef: navBarRef },
44
44
  React.createElement(InlineEdit, { labelProps: { htmlFor: 'issue-section-ktQ1-issue' }, labelContent: React.createElement(React.Fragment, null,
45
- React.createElement(Trans, null, "What are you experiencing? What are you expecting to happen?")), allowInlineEdit: true, hideSaveCancel: true, initialIsEditing: isEmpty(issue), usePreformattedTag: true, content: issue },
45
+ React.createElement(Trans, null, "What are you experiencing? What are you expecting to happen?")), allowInlineEdit: false, hideSaveCancel: true, initialIsEditing: isEmpty(issue), usePreformattedTag: true, content: issue },
46
46
  React.createElement(TextArea, { id: "issue-section-ktQ1-issue", name: "issue-section-ktQ1-issue", className: `form-control${hasLargeDescription ? ' form-invalid' : ''}`, "aria-invalid": (issue === null || issue === void 0 ? void 0 : issue.length) > CASE_DEATILS_ISSUE_LIMIT ? 'true' : 'false', value: issue, onChange: onKTQ1IssueChange, "data-tracking-id": "open-case-describe-ktQ1-issue", "aria-describedby": "describeIssueDesc", placeholder: t('Elaborate more on your issue') }),
47
47
  React.createElement("p", { className: "form-instructions", "data-tracking-id": "large-20k-warning-ktQ1-environment" }, `${(issue === null || issue === void 0 ? void 0 : issue.length) > CASE_DEATILS_ISSUE_LIMIT
48
48
  ? `Description cannot be more than ${CASE_DEATILS_ISSUE_LIMIT} characters`
@@ -6,7 +6,6 @@ import { useCaseDispatch, useCaseSelector } from '../../context/CaseContext';
6
6
  import { setCaseDetails } from '../../reducers/CaseReducer';
7
7
  import { AccountSelector } from '../AccountInfo/AccountSelector';
8
8
  import { OwnerSelector } from '../AccountInfo/OwnerSelector';
9
- import CaseAlternateId from '../CaseEditView/Tabs/CaseDetails/CaseAlternateId';
10
9
  import CaseGroup from '../CaseInformation/CaseGroup';
11
10
  import CaseType from '../CaseInformation/CaseType';
12
11
  import Description from '../CaseInformation/Description';
@@ -16,6 +15,7 @@ import Severity from '../CaseInformation/Severity';
16
15
  import SupportLevel from '../CaseInformation/SupportLevel';
17
16
  import CaseLanguageSelector from '../CaseManagement/CaseLanguageSelector';
18
17
  import { Cep } from '../CaseManagement/Cep';
18
+ import OpenAlternateID from '../CaseManagement/OpenAlternateID';
19
19
  import { OpenShiftClusterId } from '../CaseManagement/OpenShiftClusterId';
20
20
  import { RHAssociatesSelector } from '../CaseManagement/RHAssociatesSelector';
21
21
  import CaseContactSelector from '../CaseManagement/SendNotifications/CaseContactSelector';
@@ -53,6 +53,6 @@ export default function Review(props) {
53
53
  React.createElement(CaseLanguageSelector, null),
54
54
  canSeeEmailNotifications && React.createElement(CaseContactSelector, null),
55
55
  React.createElement(RHAssociatesSelector, null),
56
- React.createElement(CaseAlternateId, { hideSaveCancel: true }),
56
+ React.createElement(OpenAlternateID, { hideSaveCancel: true }),
57
57
  React.createElement(Cep, null))));
58
58
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/troubleshoot",
3
- "version": "1.0.38",
3
+ "version": "1.0.40",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -73,8 +73,8 @@
73
73
  "@patternfly/react-core": "4.264.0",
74
74
  "@progress/kendo-drawing": "^1.6.0",
75
75
  "@progress/kendo-react-pdf": "^3.12.0",
76
- "@rh-support/components": "1.2.15",
77
- "@rh-support/react-context": "1.0.22",
76
+ "@rh-support/components": "1.2.17",
77
+ "@rh-support/react-context": "1.0.24",
78
78
  "@rh-support/types": "0.2.0",
79
79
  "@rh-support/user-permissions": "1.0.11",
80
80
  "@rh-support/utils": "1.0.9",
@@ -142,5 +142,5 @@
142
142
  "not ie <= 11",
143
143
  "not op_mini all"
144
144
  ],
145
- "gitHead": "5bcb813517a4aff493587c48665551d4aeb1d00e"
145
+ "gitHead": "74b949fdce9ed569a0c7143e5272feb240aad73c"
146
146
  }