@rh-support/troubleshoot 1.0.37 → 1.0.39

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":"Case.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseEditView/Case.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAS,mBAAmB,EAAiD,MAAM,kBAAkB,CAAC;AAmB7G,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC;CACnC;AAED,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,KAAK,EAAE,MAAM,eAmLzC"}
1
+ {"version":3,"file":"Case.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseEditView/Case.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAS,mBAAmB,EAAiD,MAAM,kBAAkB,CAAC;AAmB7G,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC;CACnC;AAED,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,KAAK,EAAE,MAAM,eAuLzC"}
@@ -114,7 +114,7 @@ export default function Case(props) {
114
114
  canReadCase &&
115
115
  (!isFetchingCaseDetails || !isEmpty(product)) &&
116
116
  !isFetchingCaseDetailsError && (React.createElement(React.Fragment, null,
117
- React.createElement(ErrorBoundary, null,
117
+ React.createElement(ErrorBoundary, { errorMsgInfo: t('There was an error loading cases. Please try refreshing the page.') },
118
118
  React.createElement(CaseOverview, { caseNumber: caseNumber })),
119
119
  React.createElement(Switch, null,
120
120
  React.createElement(Route, { path: `${path}/:activeTab?` },
@@ -196,7 +196,7 @@ export function CaseDetailsAside(props) {
196
196
  React.createElement(Checkbox, { label: t('Set to default'), isChecked: isDefaultBoxChecked, onChange: onDefaultCheckboxChange, id: "set-default-view-checkbox", name: "default-view-checkbox", isDisabled: isDefaultBoxChecked, className: 'defaultViewCheckbox' })))),
197
197
  React.createElement(ErrorBoundary, { errorMsgInfo: { message: t('There was an error loading top solutions') } },
198
198
  React.createElement(CaseSolutions, { caseNumber: caseNumber, ref: topSolutionsRef, isSecureSupportAccount: isSecureSupportAccount })),
199
- !caseEscalations.isFetching && canViewACESection && (React.createElement(ErrorBoundary, null,
199
+ !caseEscalations.isFetching && canViewACESection && (React.createElement(ErrorBoundary, { errorMsgInfo: { message: t('There was an error loading customer escalation') } },
200
200
  React.createElement(ActiveCustomerEscalation, { caseNumber: caseNumber, caseSeverity: severity, caseStatus: status, ref: createEscalationRef }))),
201
201
  isExternal && (React.createElement(ErrorBoundary, { errorMsgInfo: { message: t('There was an error loading remote session agreement') } },
202
202
  React.createElement(RemoteSessionAgreement, { caseNumber: caseNumber, caseSeverity: severity, caseStatus: status, ref: createEscalationRef, acceptedRemoteSessionTerms: acceptedRemoteSessionTerms, readOnly: canReadCase })))))));
@@ -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":"AA4BA,UAAU,MAAM;IACZ,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AAOD,iBAAS,eAAe,CAAC,KAAK,EAAE,MAAM,eAgLrC;kBAhLQ,eAAe;;;AAmLxB,eAAe,eAAe,CAAC"}
@@ -7,9 +7,11 @@ 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 { InlineEdit, ToastNotification, ValueChangedIcon } from '@rh-support/components';
13
15
  import { useCanEditCase } from '@rh-support/react-context';
14
16
  import isEmpty from 'lodash/isEmpty';
15
17
  import isEqual from 'lodash/isEqual';
@@ -23,7 +25,7 @@ import { CaseValuesToWatch } from '../../../shared/Constants';
23
25
  import { getChangedValueTooltip } from '../../../shared/utils';
24
26
  const defaultProps = {
25
27
  inlineEditable: true,
26
- hideSaveCancel: false,
28
+ hideSaveCancel: true,
27
29
  };
28
30
  function CaseAlternateId(props) {
29
31
  const { t } = useTranslation();
@@ -39,18 +41,22 @@ function CaseAlternateId(props) {
39
41
  const [localAltIDChange, setLocalAltIDChange] = useState(false);
40
42
  const afterLocalChange = () => setLocalAltIDChange(false);
41
43
  const canEditCase = useCanEditCase();
44
+ // To keep track of Cancel button state to close InlineEdit input mode
45
+ const [isCancelClicked, setIsCancelClicked] = useState(false);
46
+ // To keep track of Save button state to close InlineEdit input mode
47
+ const [isSaveClicked, setIsSaveClicked] = useState(false);
42
48
  useEffect(() => {
43
49
  if (alternateId !== alternateIdState) {
44
50
  setAlternateIdState(alternateId);
45
51
  }
46
52
  // eslint-disable-next-line react-hooks/exhaustive-deps
47
53
  }, [alternateId]);
48
- const onAlternateIdChange = (e) => {
49
- var _a;
54
+ // Function to handle when Alternate ID changes
55
+ const onAlternateIdChange = (value) => {
50
56
  if (canEditCase.alert())
51
57
  return;
52
- setAlternateIdState(e.target.value);
53
- !caseNumber && setCaseDetails(caseDispatch, { alternateId: (_a = e.target.value) === null || _a === void 0 ? void 0 : _a.trim() });
58
+ setAlternateIdState(value);
59
+ !caseNumber && setCaseDetails(caseDispatch, { alternateId: value === null || value === void 0 ? void 0 : value.trim() });
54
60
  };
55
61
  const updateAlternateId = () => __awaiter(this, void 0, void 0, function* () {
56
62
  try {
@@ -71,32 +77,50 @@ function CaseAlternateId(props) {
71
77
  yield updateAlternateId();
72
78
  }
73
79
  setLocalAltIDChange(true);
80
+ setIsSaveClicked(!isSaveClicked);
74
81
  });
75
82
  const onCancel = () => {
76
83
  setAlternateIdState(alternateId);
84
+ setIsCancelClicked(!isCancelClicked);
77
85
  };
78
86
  const maxLengthErrorMessage = t('Alternate case ID cannot be more than {{limit}} characters.', {
79
87
  limit: ALTERNATE_CASE_ID_LIMIT,
80
88
  });
81
89
  // To check if alternate ID is empty
82
90
  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);
91
+ // Conditions to disable save button
92
+ const saveDisabled = isAlternateIDEmpty ||
93
+ alternateIdState === alternateId ||
94
+ isUpdating ||
95
+ (alternateIdState === null || alternateIdState === void 0 ? void 0 : alternateIdState.length) > ALTERNATE_CASE_ID_LIMIT;
96
+ // Function to handle keyDown events
97
+ const handleKeyDown = (e) => __awaiter(this, void 0, void 0, function* () {
98
+ // Cancel on pressing esc
99
+ if (e.keyCode === 27) {
100
+ yield onCancel();
87
101
  }
88
- };
102
+ // Save on pressing enter
103
+ else if (!saveDisabled && e.keyCode === 13) {
104
+ yield onSave();
105
+ }
106
+ });
89
107
  return (React.createElement(React.Fragment, null,
90
108
  React.createElement(InlineEdit, { labelProps: { htmlFor: 'case-details-alternate-id' }, labelContent: React.createElement(React.Fragment, null,
91
109
  React.createElement(Trans, null, "Alternate case ID"),
92
110
  React.createElement(ValueChangedIcon, { afterLocalChange: afterLocalChange, isLocalChange: localAltIDChange, value: alternateId, getTooltipContent: getChangedValueTooltip(() => CaseValuesToWatch.altID) }),
93
111
  ' ',
94
112
  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 })),
113
+ 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 },
114
+ React.createElement(TextInputGroup, null,
115
+ 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 || isAlternateIDEmpty
116
+ ? ValidatedOptions.error
117
+ : ValidatedOptions.default }),
118
+ !isUpdating ? (React.createElement(InputGroupText, { variant: InputGroupTextVariant.plain },
119
+ React.createElement("button", { className: "btn btn-app btn-link pf-u-ml-sm", type: "button", disabled: saveDisabled, onClick: onSave },
120
+ React.createElement(CheckIcon, null)),
121
+ React.createElement("button", { className: "btn btn-app btn-link", type: "button", onClick: onCancel },
122
+ React.createElement(TimesIcon, { color: "#6A6E73" })))) : (React.createElement(InputGroupText, { variant: InputGroupTextVariant.plain },
123
+ React.createElement(Spinner, { isSVG: true, size: "lg", className: "pf-u-ml-2xl pf-u-mr-xl" }))))),
100
124
  (alternateIdState === null || alternateIdState === void 0 ? void 0 : alternateIdState.length) > ALTERNATE_CASE_ID_LIMIT && (React.createElement("div", { className: "pull-top" },
101
125
  React.createElement("p", { className: "form-instructions form-invalid" },
102
126
  React.createElement(Trans, null, maxLengthErrorMessage))))));
@@ -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 { InlineEdit, 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(InlineEdit, { 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;
@@ -1 +1 @@
1
- {"version":3,"file":"CaseGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/CaseGroup.tsx"],"names":[],"mappings":"AAkBA,UAAU,MAAM;IACZ,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB;AAWD,iBAAS,SAAS,CAAC,KAAK,EAAE,MAAM,eA4O/B;AAED,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"CaseGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/CaseGroup.tsx"],"names":[],"mappings":"AAkBA,UAAU,MAAM;IACZ,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB;AAWD,iBAAS,SAAS,CAAC,KAAK,EAAE,MAAM,eAsM/B;AAED,eAAe,SAAS,CAAC"}
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { Dropdown, ToastNotification, ValueChangedIcon } from '@rh-support/components';
11
- import { GlobalMetadataStateContext, useCanEditCase, useUserPreferences } from '@rh-support/react-context';
11
+ import { GlobalMetadataStateContext, useCanEditCase } from '@rh-support/react-context';
12
12
  import { toOption, toOptions } from '@rh-support/utils';
13
13
  import find from 'lodash/find';
14
14
  import isEmpty from 'lodash/isEmpty';
@@ -46,37 +46,6 @@ function CaseGroup(props) {
46
46
  const [isCaseGroupUpdating, setCaseGroupUpdating] = useState(false);
47
47
  const canEditCase = useCanEditCase();
48
48
  const { globalMetadataState: { loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
49
- const { getDefaultGroup } = useUserPreferences();
50
- // when user opens a case, sets group to the default group saved in preferences
51
- useEffect(() => {
52
- const userPreferredFilter = () => __awaiter(this, void 0, void 0, function* () {
53
- const fetchedDefaultGroupKey = yield getDefaultGroup();
54
- const groupObj = ownersCaseGroups.data
55
- ? ownersCaseGroups.data.map((group) => ({
56
- value: group.name,
57
- key: group.groupNum,
58
- }))
59
- : [];
60
- if (!isEmpty(groupObj)) {
61
- const preferredGroupObj = groupObj.find((group) => group.key === fetchedDefaultGroupKey);
62
- if (preferredGroupObj === null || preferredGroupObj === void 0 ? void 0 : preferredGroupObj.value) {
63
- const parsedFetchedDefaultGroup = {
64
- groupNum: preferredGroupObj.key,
65
- name: preferredGroupObj.value,
66
- isPrivate: false,
67
- isDefault: false,
68
- defaultMembers: [],
69
- members: [],
70
- };
71
- groupNumber === '-1' &&
72
- props.init &&
73
- onCaseGroupChange(toOption(parsedFetchedDefaultGroup, { labelKey: 'name' }));
74
- }
75
- }
76
- });
77
- isEmpty(caseNumber) && userPreferredFilter();
78
- // eslint-disable-next-line react-hooks/exhaustive-deps
79
- }, [ownersCaseGroups.data, caseNumber]);
80
49
  // value changed logic to show a non local group change
81
50
  const [localGroupChange, setLocalGroupChange] = useState(false);
82
51
  const afterGroupLocalChange = () => setLocalGroupChange(false);
@@ -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;
@@ -39,10 +39,10 @@ export default function Issue() {
39
39
  const handleFormSubmit = (e) => e.preventDefault();
40
40
  return (React.createElement(React.Fragment, null,
41
41
  React.createElement("form", { onSubmit: handleFormSubmit, className: "push-bottom" },
42
- React.createElement(OpenCaseIssue, { inlineEditable: true, hideSaveCancel: true, initialIsEditing: isEmpty(summary), required: true }),
42
+ React.createElement(OpenCaseIssue, { inlineEditable: false, 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';
@@ -42,8 +42,8 @@ export default function Review(props) {
42
42
  React.createElement(AllProductsSelector, { isDropdownSelected: true, routeProps: props.routeProps, loadTCOnChange: true, showTCAfterButtonClicked: true, checkEntitledProduct: true }),
43
43
  React.createElement(OpenShiftClusterId, null),
44
44
  React.createElement(Hostname, null),
45
- React.createElement(OpenCaseIssue, { inlineEditable: true, required: true, initialIsEditing: isEmpty(summary), hideSaveCancel: true }),
46
- React.createElement(Description, { inlineEditable: true, hideSaveCancel: true }),
45
+ React.createElement(OpenCaseIssue, { inlineEditable: false, required: true, initialIsEditing: isEmpty(summary), hideSaveCancel: true }),
46
+ React.createElement(Description, { inlineEditable: false, hideSaveCancel: true }),
47
47
  React.createElement(KtQuestions, { inlineEditable: true, hideSaveCancel: true }),
48
48
  React.createElement(CaseType, null),
49
49
  React.createElement(SupportLevel, null),
@@ -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, { inlineEditable: true, 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.37",
3
+ "version": "1.0.39",
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.14",
77
- "@rh-support/react-context": "1.0.21",
76
+ "@rh-support/components": "1.2.16",
77
+ "@rh-support/react-context": "1.0.23",
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": "4399821556d8466ddbfc02c44e3954047c9ae1e7"
145
+ "gitHead": "af45effefff4d9434a171992428c249f80fc84ce"
146
146
  }