@rh-support/troubleshoot 0.2.116 → 0.2.119

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.
Files changed (47) hide show
  1. package/lib/esm/components/CaseEditView/ActiveCustomerEscalation/ActiveCustomerEscalation.d.ts.map +1 -1
  2. package/lib/esm/components/CaseEditView/ActiveCustomerEscalation/ActiveCustomerEscalation.js +6 -4
  3. package/lib/esm/components/CaseEditView/ActiveCustomerEscalation/RequestEscalationModal.d.ts.map +1 -1
  4. package/lib/esm/components/CaseEditView/ActiveCustomerEscalation/RequestEscalationModal.js +114 -52
  5. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseOpenshiftClusterId/CaseOpenshiftClusterId.d.ts.map +1 -1
  6. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseOpenshiftClusterId/CaseOpenshiftClusterId.js +27 -44
  7. package/lib/esm/components/CaseEditView/Tabs/RMEEscalations/RMEEscalationList.d.ts.map +1 -1
  8. package/lib/esm/components/CaseEditView/Tabs/RMEEscalations/RMEEscalationList.js +10 -11
  9. package/lib/esm/components/CaseManagement/OpenShiftClusterId.d.ts.map +1 -1
  10. package/lib/esm/components/CaseManagement/OpenShiftClusterId.js +38 -52
  11. package/lib/esm/components/CaseManagement/OpenshiftDropdownV4.d.ts +2 -2
  12. package/lib/esm/components/CaseManagement/OpenshiftDropdownV4.d.ts.map +1 -1
  13. package/lib/esm/components/CaseManagement/OpenshiftDropdownV4.js +121 -80
  14. package/lib/esm/components/Recommendations/AlertToastWrapper.d.ts +1 -0
  15. package/lib/esm/components/Recommendations/AlertToastWrapper.d.ts.map +1 -1
  16. package/lib/esm/components/Recommendations/AlertToastWrapper.js +4 -2
  17. package/lib/esm/components/SessionRestore/RestoreLastSessionModal.d.ts +9 -0
  18. package/lib/esm/components/SessionRestore/RestoreLastSessionModal.d.ts.map +1 -0
  19. package/lib/esm/components/SessionRestore/RestoreLastSessionModal.js +43 -0
  20. package/lib/esm/components/SessionRestore/SessionRestore.d.ts.map +1 -1
  21. package/lib/esm/components/SessionRestore/SessionRestore.js +11 -5
  22. package/lib/esm/components/SubmitCase/ResubmitToast.d.ts +7 -0
  23. package/lib/esm/components/SubmitCase/ResubmitToast.d.ts.map +1 -0
  24. package/lib/esm/components/SubmitCase/ResubmitToast.js +25 -0
  25. package/lib/esm/components/wizardLayout/GlobalTroubleshootEffects.d.ts.map +1 -1
  26. package/lib/esm/components/wizardLayout/GlobalTroubleshootEffects.js +19 -8
  27. package/lib/esm/components/wizardLayout/WizardAside.d.ts +1 -0
  28. package/lib/esm/components/wizardLayout/WizardAside.d.ts.map +1 -1
  29. package/lib/esm/components/wizardLayout/WizardAside.js +1 -1
  30. package/lib/esm/components/wizardLayout/WizardLayout.d.ts.map +1 -1
  31. package/lib/esm/components/wizardLayout/WizardLayout.js +6 -5
  32. package/lib/esm/reducers/CaseConstNTypes.d.ts +4 -1
  33. package/lib/esm/reducers/CaseConstNTypes.d.ts.map +1 -1
  34. package/lib/esm/reducers/CaseConstNTypes.js +4 -0
  35. package/lib/esm/reducers/CaseReducer.d.ts +12 -0
  36. package/lib/esm/reducers/CaseReducer.d.ts.map +1 -1
  37. package/lib/esm/reducers/CaseReducer.js +35 -1
  38. package/lib/esm/reducers/ClusterRecommendationsReducer.d.ts +5 -2
  39. package/lib/esm/reducers/ClusterRecommendationsReducer.d.ts.map +1 -1
  40. package/lib/esm/reducers/ClusterRecommendationsReducer.js +19 -6
  41. package/lib/esm/reducers/SessionRestoreReducer.d.ts +5 -2
  42. package/lib/esm/reducers/SessionRestoreReducer.d.ts.map +1 -1
  43. package/lib/esm/reducers/SessionRestoreReducer.js +24 -1
  44. package/lib/esm/utils/caseOpenshiftClusterIdUtils.d.ts +4 -2
  45. package/lib/esm/utils/caseOpenshiftClusterIdUtils.d.ts.map +1 -1
  46. package/lib/esm/utils/caseOpenshiftClusterIdUtils.js +1 -9
  47. package/package.json +9 -9
@@ -1 +1 @@
1
- {"version":3,"file":"ActiveCustomerEscalation.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/ActiveCustomerEscalation/ActiveCustomerEscalation.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAMpD,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,wBAAwB,+EAuGnC,CAAC"}
1
+ {"version":3,"file":"ActiveCustomerEscalation.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/ActiveCustomerEscalation/ActiveCustomerEscalation.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAMpD,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,wBAAwB,+EAkHnC,CAAC"}
@@ -1,4 +1,4 @@
1
- import { Button } from '@patternfly/react-core';
1
+ import { Button, Popover } from '@patternfly/react-core';
2
2
  import InfoCircleIcon from '@patternfly/react-icons/dist/js/icons/info-circle-icon';
3
3
  import { useCanEditCase } from '@rh-support/react-context';
4
4
  import { Can, resourceActions, resources } from '@rh-support/user-permissions';
@@ -37,9 +37,11 @@ export const ActiveCustomerEscalation = forwardRef((props, ref) => {
37
37
  };
38
38
  const isNotInternalElements = (React.createElement("div", { className: "card card-white card-support escalations", ref: ref },
39
39
  React.createElement("h3", { className: "card-heading" },
40
- t('Case escalation'),
41
- React.createElement("a", { href: "/support/escalation", target: "_blank" },
42
- React.createElement(InfoCircleIcon, null))),
40
+ t('Request an escalation'),
41
+ React.createElement("div", { style: { marginLeft: 'auto' } },
42
+ React.createElement(Popover, { showClose: false, position: 'left', hasAutoWidth: true, bodyContent: (hide) => (React.createElement("a", { href: "/support/escalation", target: "_blank" },
43
+ React.createElement(Trans, null, "Learn more about escalation cases."))) },
44
+ React.createElement(InfoCircleIcon, { title: t('Learn more about escalation cases popover') })))),
43
45
  React.createElement("div", { className: "card-body" },
44
46
  React.createElement("p", null,
45
47
  React.createElement("strong", null, `${t('Request a management escalation if your issue')}`),
@@ -1 +1 @@
1
- {"version":3,"file":"RequestEscalationModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/ActiveCustomerEscalation/RequestEscalationModal.tsx"],"names":[],"mappings":"AAwBA,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAID,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,eAqNnD"}
1
+ {"version":3,"file":"RequestEscalationModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/ActiveCustomerEscalation/RequestEscalationModal.tsx"],"names":[],"mappings":"AAwCA,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAID,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,eA+VnD"}
@@ -8,11 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { escalations, publicApi } from '@cee-eng/hydrajs';
11
- import { Button, Modal, Select, SelectDirection, SelectOption } from '@patternfly/react-core';
11
+ import { Button, Form, FormGroup, Grid, GridItem, Modal, Popover, Select, SelectOption, TextArea, TextInput, Title, ValidatedOptions, } from '@patternfly/react-core';
12
+ import ExclamationCircleIcon from '@patternfly/react-icons/dist/js/icons/exclamation-circle-icon';
13
+ import InfoCircleIcon from '@patternfly/react-icons/dist/js/icons/info-circle-icon';
12
14
  import { AlertMessage, AlertType, LoadingIndicator, ToastNotification, useFetch } from '@rh-support/components';
13
15
  import { useGlobalStateContext } from '@rh-support/react-context';
14
16
  import isEmpty from 'lodash/isEmpty';
15
- import React, { useState } from 'react';
17
+ import React, { useEffect, useState } from 'react';
16
18
  import { Trans, useTranslation } from 'react-i18next';
17
19
  import { useCaseDispatch } from '../../../context/CaseContext';
18
20
  import { useCaseDetailsPageDispatchContext, useCaseDetailsPageStateContext, } from '../../../context/CaseDetailsPageContext';
@@ -26,23 +28,31 @@ const customerGEOKeys = Object.keys(CustomerGEOs);
26
28
  export function RequestEscalationModal(props) {
27
29
  const { globalMetadataState: { loggedInUser, loggedInUserRights }, } = useGlobalStateContext();
28
30
  const { t } = useTranslation();
29
- const [showDropdown, setShowDropdown] = useState(false);
30
- const onDropdownToggle = (toggle) => setShowDropdown(toggle);
31
- const [formState, setFormState] = useState({
31
+ const [showGeoDropdown, setGeoShowDropdown] = useState(false);
32
+ const onGeoDropdownToggle = (toggle) => setGeoShowDropdown(toggle);
33
+ const [showCategoryDropdown, setCategoryShowDropdown] = useState(false);
34
+ const onCategoryDropdownToggle = (toggle) => setCategoryShowDropdown(toggle);
35
+ const [categories, setCategories] = useState([]);
36
+ const initialState = {
32
37
  subject: '',
33
38
  description: '',
34
39
  expectations: '',
35
40
  geo: '',
36
- });
41
+ businessImpactDescription: '',
42
+ rmeCategory: '',
43
+ };
44
+ const [formState, setFormState] = useState(initialState);
37
45
  const [hasLargeSubject, setHasLargeSubject] = useState(false);
46
+ const [submitButtonIsClicked, setSubmitSaveButtonIsClicked] = useState(false);
38
47
  // checks if all the fields have values.
39
48
  const hasRequiredInfo = () => Object.keys(formState).reduce((accumulator, currentValue) => { var _a; return !accumulator ? accumulator : formState[currentValue].length > 0 && ((_a = formState[currentValue]) === null || _a === void 0 ? void 0 : _a.trim()); }, true);
40
- const setFormStateThunk = (key) => (event) => setFormState(Object.assign(Object.assign({}, formState), { [key]: event.target.value }));
49
+ const setFormStateValue = (key) => (value) => setFormState(Object.assign(Object.assign({}, formState), { [key]: value }));
41
50
  const createEscalationFetch = useFetch(escalations.createIceEscalation, { propgateErrors: true });
42
51
  const { request: postCommentRequest, isFetching: isPostingComment } = useFetch(publicApi.kase.postComment, {
43
52
  propgateErrors: true,
44
53
  });
45
54
  const { request: updateCaseRequest, isFetching: isUpdatingCase } = useFetch(publicApi.kase.updateCase);
55
+ const { request: getRmeCategories, isFetching: isCategoriesFetching } = useFetch(escalations.getEscalationCategories, { propgateErrors: true });
46
56
  const { sort, allDiscussions, discussionFiltersListState } = useCaseDiscussionTabStateContext();
47
57
  const dispatchDiscussion = useCaseDiscussionTabDispatchContext();
48
58
  const { caseDetailsPageState: { caseFeedbacksHydra }, } = useCaseDetailsPageStateContext();
@@ -52,7 +62,11 @@ export function RequestEscalationModal(props) {
52
62
  const onErrorClose = () => setCreationError(false);
53
63
  const setGeoState = (event, selection) => {
54
64
  setFormState(Object.assign(Object.assign({}, formState), { geo: selection }));
55
- onDropdownToggle(false);
65
+ onGeoDropdownToggle(false);
66
+ };
67
+ const setCategoryState = (event, selection) => {
68
+ setFormState(Object.assign(Object.assign({}, formState), { rmeCategory: selection }));
69
+ onCategoryDropdownToggle(false);
56
70
  };
57
71
  const submitEscalationComment = (escalationNum, comment) => __awaiter(this, void 0, void 0, function* () {
58
72
  escalationNum &&
@@ -63,60 +77,108 @@ export function RequestEscalationModal(props) {
63
77
  checkForCaseStatusToggleOnAttachOrComment(caseDispatch, loggedInUserRights.data.isInternal(), props.caseStatus);
64
78
  escalationNum &&
65
79
  ToastNotification.addSuccessMessage(t('Your escalation request has been successfully submitted.'));
66
- props.onClose();
67
80
  });
68
- const onSubjectChange = (e) => {
69
- var _a;
70
- const subject = isEmpty((_a = e.target.value) === null || _a === void 0 ? void 0 : _a.trim()) ? '' : e.target.value;
81
+ const onSubjectChange = (subject) => {
71
82
  const isSubjectLarge = subject.length > ESCALATION_SUBJECT_LENGTH_LIMIT;
72
83
  setHasLargeSubject(isSubjectLarge);
73
- isSubjectLarge ? setFormState(Object.assign(Object.assign({}, formState), { subject: '' })) : setFormState(Object.assign(Object.assign({}, formState), { subject }));
84
+ setFormState(Object.assign(Object.assign({}, formState), { subject }));
85
+ };
86
+ const onCancel = () => {
87
+ if (isPostingComment || isUpdatingCase || createEscalationFetch.isFetching)
88
+ return;
89
+ setSubmitSaveButtonIsClicked(false);
90
+ setFormState(initialState);
91
+ setHasLargeSubject(false);
92
+ props.onClose();
74
93
  };
75
- const onCancel = () => props.onClose();
76
94
  const onSubmit = () => __awaiter(this, void 0, void 0, function* () {
95
+ setSubmitSaveButtonIsClicked(true);
96
+ if (!hasRequiredInfo() || hasLargeSubject)
97
+ return;
77
98
  try {
78
99
  const res = yield createEscalationFetch.request(Object.assign(Object.assign({}, formState), { recordType: 'Active Customer Escalation', escalationSource: 'RME Escalation', status: 'New', accountNumber: loggedInUserRights.data.getAccountNumber(), caseNumber: props.caseNumber, requestor: `${loggedInUser.data.firstName} ${loggedInUser.data.lastName}`, requestorEmail: loggedInUser.data.email, requestorPhone: loggedInUser.data.phone, alreadyEscalated: false, severity: props.severity ? props.severity.charAt(0) : '3' }));
79
- const fullComment = t('### Request Management Escalation:\n\n**Subject**\n{{subject}}\n\n**Description**\n{{description}}\n\n**Expectations**\n{{expectations}}', { subject: formState.subject, description: formState.description, expectations: formState.expectations });
80
- yield submitEscalationComment(res.name, fullComment);
100
+ const fullComment = t('### Request Management Escalation:\n\n**Subject**\n{{subject}}\n\n**Category**\n{{rmeCategory}}\n\n**Description**\n{{description}}\n\n**Expectations**\n{{expectations}}\n\n**Business Impact**\n{{businessImpactDescription}}', {
101
+ category: formState.rmeCategory,
102
+ subject: formState.subject,
103
+ description: formState.description,
104
+ expectations: formState.expectations,
105
+ businessImpactDescription: formState.businessImpactDescription,
106
+ rmeCategory: formState.rmeCategory,
107
+ });
108
+ try {
109
+ yield submitEscalationComment(res.name, fullComment);
110
+ }
111
+ catch (e) {
112
+ // silently fails, escalation is created but adding comment fails
113
+ }
114
+ props.onClose();
81
115
  }
82
116
  catch (error) {
117
+ //=> handle error
83
118
  setCreationError(true);
84
119
  }
85
120
  });
86
- const modalActions = isPostingComment || isUpdatingCase || createEscalationFetch.isFetching
87
- ? [React.createElement(LoadingIndicator, { key: "loading", isInline: true })]
88
- : [
89
- React.createElement(Button, { key: "submit", variant: "primary", onClick: onSubmit, "data-tracking-id": "request-rme-submit", isDisabled: createEscalationFetch.isFetching || !hasRequiredInfo() }, t('Submit request')),
90
- React.createElement(Button, { key: "cancel", variant: "link", onClick: onCancel, "data-tracking-id": "request-rme-cancel", isDisabled: createEscalationFetch.isFetching }, t('Cancel')),
91
- ];
92
- return (React.createElement(Modal, { title: t('Request an escalation'), isOpen: props.show, onClose: onCancel, actions: modalActions },
93
- React.createElement("p", null,
94
- React.createElement(Trans, { i18nKey: "i18RequestEscalationLearnMore" },
95
- "If you feel the issue has become more severe or the case should be a higher priority, please provide a detailed comment, and the case will be reviewed by a support manager.",
96
- ' ',
97
- React.createElement("a", { href: "https://access.redhat.com/site/support/policy/mgt_escalation", target: "_blank", rel: "noopener noreferrer" }, "Learn more."))),
98
- React.createElement("p", { className: "rha-bold" },
99
- React.createElement("b", null,
100
- React.createElement(Trans, null, "* All fields are mandatory."))),
101
- React.createElement(AlertMessage, { variant: AlertType.DANGER, title: t('Could not create case escalation'), show: creationError, onClose: onErrorClose }),
102
- React.createElement("form", { "aria-label": t('form') },
103
- React.createElement("div", { className: "form-group" },
104
- React.createElement("label", { htmlFor: "subject-input" },
105
- React.createElement(Trans, null, "Subject")),
106
- React.createElement("input", { type: "text", id: "subject-input", className: `form-control ${hasLargeSubject ? 'form-invalid' : ''}`, onChange: onSubjectChange }),
107
- hasLargeSubject && (React.createElement("p", { className: "form-instructions" }, t('Subject cannot be more than {{limit}} characters', {
108
- limit: ESCALATION_SUBJECT_LENGTH_LIMIT,
109
- })))),
110
- React.createElement("div", { className: "form-group" },
111
- React.createElement("label", { htmlFor: "description-textarea" },
112
- React.createElement(Trans, null, "Description")),
113
- React.createElement("textarea", { id: "description-textarea", className: "form-control", onChange: setFormStateThunk('description') })),
114
- React.createElement("div", { className: "form-group" },
115
- React.createElement("label", { htmlFor: "expectations-textarea" },
116
- React.createElement(Trans, null, "Expectations")),
117
- React.createElement("textarea", { id: "expectations-textarea", className: "form-control", onChange: setFormStateThunk('expectations') })),
118
- React.createElement("div", { className: "form-group" },
119
- React.createElement("label", { htmlFor: "customer-geo-select" },
120
- React.createElement(Trans, null, "Customer GEO")),
121
- React.createElement(Select, { "aria-label": t('Select an option'), id: "customer-geo-select", selections: formState.geo, onSelect: setGeoState, isOpen: showDropdown, direction: SelectDirection.up, placeholderText: t('Select an option'), onToggle: onDropdownToggle }, customerGEOKeys.map((key, index) => (React.createElement(SelectOption, { key: index, value: CustomerGEOs[key].value }, t(CustomerGEOs[key].label)))))))));
121
+ const modalActions = [
122
+ React.createElement(Button, { key: "submit", variant: "primary", onClick: onSubmit, "data-tracking-id": "request-rme-submit", isDisabled: submitButtonIsClicked &&
123
+ (isPostingComment || isUpdatingCase || createEscalationFetch.isFetching || !hasRequiredInfo()) },
124
+ (isPostingComment || isUpdatingCase || createEscalationFetch.isFetching) && (React.createElement(LoadingIndicator, { key: "loading", isInline: true })),
125
+ ' ',
126
+ t('Submit')),
127
+ React.createElement(Button, { key: "cancel", variant: "link", onClick: onCancel, "data-tracking-id": "request-rme-cancel", isDisabled: createEscalationFetch.isFetching || isPostingComment || isUpdatingCase }, t('Cancel')),
128
+ ];
129
+ const header = (React.createElement(Title, { id: "custom-header-label", headingLevel: "h1" },
130
+ React.createElement(Trans, null, "Request an escalation"),
131
+ React.createElement(Popover, { showClose: false, position: 'top', hasAutoWidth: true, bodyContent: () => (React.createElement("a", { href: "/support/escalation", target: "_blank" },
132
+ React.createElement(Trans, null, "Learn more about escalation cases."))) },
133
+ React.createElement(InfoCircleIcon, { className: "pf-u-ml-sm" }))));
134
+ // load rme categories as soon as user opens the modal
135
+ useEffect(() => {
136
+ if (!props.show || categories.length !== 0)
137
+ return;
138
+ const fetchCategories = () => __awaiter(this, void 0, void 0, function* () {
139
+ try {
140
+ const categories = yield getRmeCategories();
141
+ setCategories((categories === null || categories === void 0 ? void 0 : categories.items) || []);
142
+ }
143
+ catch (e) {
144
+ console.log(e);
145
+ }
146
+ });
147
+ fetchCategories();
148
+ // eslint-disable-next-line react-hooks/exhaustive-deps
149
+ }, [props.show]);
150
+ return (React.createElement(Modal, { isOpen: props.show, onClose: onCancel, actions: modalActions, header: header },
151
+ React.createElement("p", { className: "pf-u-mb-md" },
152
+ React.createElement(Trans, { i18nKey: "i18RequestEscalationDescription" }, "Submit an escalation if an issue has become more severe or you feel the case needs a higher priority. A support manager will review yor escalation request.")),
153
+ React.createElement(AlertMessage, { variant: AlertType.DANGER, title: t('Could not create case escalation'), show: creationError, onClose: onErrorClose, isInline: true, className: "pf-u-mb-md" }),
154
+ React.createElement(Form, { "aria-label": t('form') },
155
+ React.createElement(Grid, { hasGutter: true, md: 12 },
156
+ React.createElement(GridItem, { span: 6 },
157
+ React.createElement(FormGroup, { isRequired: true, label: t('Category'), fieldId: "escalation-category" },
158
+ React.createElement(Select, Object.assign({ "aria-label": t('Category'), id: "customer-category-select", selections: formState.rmeCategory, validated: submitButtonIsClicked && isEmpty(formState.rmeCategory)
159
+ ? ValidatedOptions.error
160
+ : ValidatedOptions.default, "aria-invalid": submitButtonIsClicked && isEmpty(formState.rmeCategory), onSelect: setCategoryState, isOpen: showCategoryDropdown, placeholderText: t('Select an option that best fits'), onToggle: onCategoryDropdownToggle }, (isCategoriesFetching && { loadingVariant: 'spinner' })), categories.map((value, index) => (React.createElement(SelectOption, { key: index, value: value }, value)))))),
161
+ React.createElement(GridItem, { span: 6 },
162
+ React.createElement(FormGroup, { isRequired: true, label: t('My region'), fieldId: "escalation-region" },
163
+ React.createElement(Select, { "aria-label": t('My region'), id: "customer-geo-select", selections: formState.geo, onSelect: setGeoState, isOpen: showGeoDropdown, validated: submitButtonIsClicked && isEmpty(formState.geo)
164
+ ? ValidatedOptions.error
165
+ : ValidatedOptions.default, placeholderText: t('Select a location'), onToggle: onGeoDropdownToggle, "aria-invalid": submitButtonIsClicked && isEmpty(formState.geo) }, customerGEOKeys.map((key, index) => (React.createElement(SelectOption, { key: index, value: CustomerGEOs[key].value }, t(CustomerGEOs[key].label))))))),
166
+ React.createElement(FormGroup, { isRequired: true, validated: submitButtonIsClicked && hasLargeSubject ? ValidatedOptions.error : ValidatedOptions.default, helperTextInvalid: t('Subject cannot be more than {{limit}} characters', {
167
+ limit: ESCALATION_SUBJECT_LENGTH_LIMIT,
168
+ }), helperTextInvalidIcon: React.createElement(ExclamationCircleIcon, null), label: t('Subject'), fieldId: "escalation-subject" },
169
+ React.createElement(TextInput, { isRequired: true, validated: (submitButtonIsClicked && isEmpty(formState.subject)) || hasLargeSubject
170
+ ? ValidatedOptions.error
171
+ : ValidatedOptions.default, type: "text", placeholder: t('Enter a subject for your request'), id: "subject-input", name: "subject-input", value: formState.subject, onChange: onSubjectChange, "aria-label": t('Subject') })),
172
+ React.createElement(FormGroup, { isRequired: true, label: t('Description'), fieldId: "escalation-description" },
173
+ React.createElement(TextArea, { value: formState.description, onChange: setFormStateValue('description'), isRequired: true, validated: submitButtonIsClicked && isEmpty(formState.description)
174
+ ? ValidatedOptions.error
175
+ : ValidatedOptions.default, "aria-label": t('Description'), id: "description-textarea", placeholder: t('Provide a detailed comment for us to best assist you') })),
176
+ React.createElement(FormGroup, { isRequired: true, label: t('Expectations'), fieldId: "escalation-expectations" },
177
+ React.createElement(TextArea, { onChange: setFormStateValue('expectations'), isRequired: true, validated: submitButtonIsClicked && isEmpty(formState.expectations)
178
+ ? ValidatedOptions.error
179
+ : ValidatedOptions.default, placeholder: t('What do you expect to happen with this escalation?'), id: "expectations-input", value: formState.expectations, "aria-label": t('Expectations') })),
180
+ React.createElement(FormGroup, { isRequired: true, label: t('Business impact'), fieldId: "escalation-business-impact" },
181
+ React.createElement(TextArea, { onChange: setFormStateValue('businessImpactDescription'), isRequired: true, validated: submitButtonIsClicked && isEmpty(formState.businessImpactDescription)
182
+ ? ValidatedOptions.error
183
+ : ValidatedOptions.default, placeholder: t('Does your business impact change with this escalation? Please describe how it changed.'), id: "business-impact-input", value: formState.businessImpactDescription, "aria-label": t('Business impact') }))))));
122
184
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CaseOpenshiftClusterId.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/CaseEditView/Tabs/CaseDetails/CaseOpenshiftClusterId/CaseOpenshiftClusterId.tsx"],"names":[],"mappings":"AAuBA,wBAAgB,sBAAsB,gBA4RrC"}
1
+ {"version":3,"file":"CaseOpenshiftClusterId.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/CaseEditView/Tabs/CaseDetails/CaseOpenshiftClusterId/CaseOpenshiftClusterId.tsx"],"names":[],"mappings":"AA0BA,wBAAgB,sBAAsB,gBA4QrC"}
@@ -13,14 +13,14 @@ import { getVersion } from '@rh-support/utils';
13
13
  import debounce from 'lodash/debounce';
14
14
  import isEmpty from 'lodash/isEmpty';
15
15
  import isEqual from 'lodash/isEqual';
16
- import React, { useCallback, useContext, useEffect, useState } from 'react';
16
+ import React, { useContext, useEffect, useRef, useState } from 'react';
17
17
  import { useTranslation } from 'react-i18next';
18
18
  import { useCaseDispatch, useCaseSelector } from '../../../../../context/CaseContext';
19
19
  import { setCaseDetails, updateCaseDetails } from '../../../../../reducers/CaseReducer';
20
- import { getIsClusterIdInvalid, isClusterIdEnabledForProduct } from '../../../../../utils/caseOpenshiftClusterIdUtils';
20
+ import { getIsClusterIdInvalid, isClusterIdEnabledForProduct, } from '../../../../../utils/caseOpenshiftClusterIdUtils';
21
21
  import { NoClusterIDReasonSelector } from '../../../../CaseManagement/NoClusterIDReasonSelector';
22
22
  import { discoverV4ClusterIdLink, discoverV4ClusterIdLinkError, isInvalidErrorMessage, v3Tov4TransitionLink, } from '../../../../CaseManagement/OpenShiftClusterId';
23
- import { fetchClusterIdDetails, OpenshiftDropdownV4 } from '../../../../CaseManagement/OpenshiftDropdownV4';
23
+ import { OpenshiftDropdownV4 } from '../../../../CaseManagement/OpenshiftDropdownV4';
24
24
  export function CaseOpenshiftClusterId() {
25
25
  const { openshiftClusterID, product, version, caseNumber, openshiftClusterVersion, noClusterIdReason, noClusterIdReasonExplanation, selectedAccountDetails, description, } = useCaseSelector((state) => ({
26
26
  openshiftClusterID: state.caseDetails.openshiftClusterID,
@@ -42,30 +42,25 @@ export function CaseOpenshiftClusterId() {
42
42
  const [isClusterIdInvalid, setIsClusterIdInValid] = useState(false);
43
43
  const [dontKnowSelected, setDontKnowSelected] = useState(false);
44
44
  const [selectedReason, setSelectedReason] = useState('');
45
- const [isFetchingClusterDetails, setIsFetchingClusterDetails] = useState(false);
46
45
  const [localOpenshiftClusterIDState, setLocalOpenshiftClusterIDState] = useState(openshiftClusterID);
47
46
  const [isClusterIdUpdating, setIsClusterIdUpdating] = useState(false);
48
47
  const [isReasonUpdating, setIsReasonUpdating] = useState(false);
48
+ const displayName = useRef('');
49
49
  const { t } = useTranslation();
50
50
  const clusterStateReset = () => {
51
51
  setSelectedReason('');
52
52
  setDontKnowSelected(false);
53
53
  };
54
- const setClusterVersion = (openshiftClusterID, clusterDetails) => __awaiter(this, void 0, void 0, function* () {
55
- if (!openshiftClusterID || getIsClusterIdInvalid(openshiftClusterID))
56
- return;
57
- let openshiftClusterVersion;
58
- if (clusterDetails &&
59
- clusterDetails.external_cluster_id === openshiftClusterID &&
60
- clusterDetails.openshift_version) {
61
- openshiftClusterVersion = clusterDetails.openshift_version;
62
- }
63
- else {
64
- const clusterDetails = yield fetchClusterIdDetails(openshiftClusterID);
65
- openshiftClusterVersion = clusterDetails === null || clusterDetails === void 0 ? void 0 : clusterDetails.openshift_version;
66
- }
67
- setCaseDetails(caseDispatch, { openshiftClusterVersion });
68
- });
54
+ const resetClusterData = () => {
55
+ setLocalOpenshiftClusterIDState('');
56
+ clusterStateReset();
57
+ setCaseDetails(caseDispatch, {
58
+ openshiftClusterID: '',
59
+ openshiftClusterVersion: '',
60
+ noClusterIdReasonExplanation: '',
61
+ noClusterIdReason: '',
62
+ });
63
+ };
69
64
  useEffect(() => {
70
65
  var _a;
71
66
  const isClusterVisible = () => __awaiter(this, void 0, void 0, function* () {
@@ -103,9 +98,6 @@ export function CaseOpenshiftClusterId() {
103
98
  useEffect(() => {
104
99
  const isClusterIdInvalid = getIsClusterIdInvalid(openshiftClusterID);
105
100
  setIsClusterIdInValid(isClusterIdInvalid);
106
- if (openshiftClusterID && !isClusterIdInvalid && isEmpty(openshiftClusterVersion)) {
107
- setClusterVersion(openshiftClusterID);
108
- }
109
101
  if (!isEmpty(noClusterIdReason)) {
110
102
  setDontKnowSelected(true);
111
103
  setSelectedReason('dont-have-id');
@@ -138,13 +130,6 @@ export function CaseOpenshiftClusterId() {
138
130
  setDontKnowSelected(true);
139
131
  setSelectedReason(selectedClusterId);
140
132
  setIsClusterIdInValid(false);
141
- const caseDetails = {
142
- openshiftClusterID: '',
143
- noClusterIdReasonExplanation: '',
144
- noClusterIdReason: '',
145
- openshiftClusterVersion: '',
146
- };
147
- yield clusterIdUpdate(caseDetails);
148
133
  }
149
134
  else if (selectedClusterId === 'v3-cluster') {
150
135
  setSelectedReason('dont-have-id');
@@ -160,25 +145,18 @@ export function CaseOpenshiftClusterId() {
160
145
  else {
161
146
  const isClusterIdInvalid = getIsClusterIdInvalid(selectedClusterId);
162
147
  setIsClusterIdInValid(isClusterIdInvalid);
148
+ setDontKnowSelected(false);
149
+ setSelectedReason('');
150
+ displayName.current = selectedCluster.display_name;
163
151
  if (isClusterIdInvalid || selectedClusterId === openshiftClusterID)
164
152
  return;
165
153
  const caseDetails = {
166
154
  openshiftClusterID: selectedClusterId,
167
155
  noClusterIdReasonExplanation: '',
168
156
  noClusterIdReason: '',
157
+ openshiftClusterVersion: selectedCluster.openshift_version,
169
158
  };
170
- if (selectedCluster === null || selectedCluster === void 0 ? void 0 : selectedCluster.openshift_version) {
171
- caseDetails.openshiftClusterVersion = selectedCluster.openshift_version;
172
- }
173
- else {
174
- setIsFetchingClusterDetails(true);
175
- const clusterDetails = yield fetchClusterIdDetails(selectedClusterId);
176
- caseDetails.openshiftClusterVersion = (clusterDetails === null || clusterDetails === void 0 ? void 0 : clusterDetails.openshift_version) || '';
177
- setIsFetchingClusterDetails(false);
178
- }
179
159
  yield clusterIdUpdate(caseDetails);
180
- setDontKnowSelected(false);
181
- setSelectedReason('');
182
160
  }
183
161
  });
184
162
  const isDedicatedV3 = () => noClusterIdReason === 'Other' && noClusterIdReasonExplanation === 'v3-cluster';
@@ -212,13 +190,18 @@ export function CaseOpenshiftClusterId() {
212
190
  }
213
191
  });
214
192
  // eslint-disable-next-line react-hooks/exhaustive-deps
215
- const debounceFn = useCallback(debounce(onReasonExplanationInputBoxChanged, 1000), []);
193
+ const debounceFn = debounce(onReasonExplanationInputBoxChanged, 1000);
216
194
  const onReasonChange = (reason) => __awaiter(this, void 0, void 0, function* () {
217
195
  if (!reason || reason === noClusterIdReason)
218
196
  return;
219
197
  try {
220
198
  setIsReasonUpdating(true);
221
- const caseDetails = { openshiftClusterID: '', noClusterIdReason: reason, noClusterIdReasonExplanation: '' };
199
+ const caseDetails = {
200
+ openshiftClusterID: '',
201
+ openshiftClusterVersion: '',
202
+ noClusterIdReason: reason,
203
+ noClusterIdReasonExplanation: '',
204
+ };
222
205
  setCaseDetails(caseDispatch, { noClusterIdReason: reason });
223
206
  yield clusterIdUpdate(caseDetails);
224
207
  }
@@ -236,9 +219,9 @@ export function CaseOpenshiftClusterId() {
236
219
  }
237
220
  else {
238
221
  return (React.createElement(React.Fragment, null,
239
- React.createElement(OpenshiftDropdownV4, { openshiftClusterIDState: localOpenshiftClusterIDState || selectedReason, onClusterIdStateUpdate: onClusterIdSave, isClusterIdInvalid: (isEmpty(localOpenshiftClusterIDState) && isEmpty(selectedReason)) || isClusterIdInvalid, clusterIdDropdownFormInstructions: clusterIdDropdownFormInstructions(), onClusterClear: () => setLocalOpenshiftClusterIDState(''), isV4: majorVersion === '4', isDisabled: isClusterIdUpdating || isFetchingClusterDetails, noClusterIdReasonExplanation: noClusterIdReasonExplanation }),
222
+ React.createElement(OpenshiftDropdownV4, { openshiftDisplayName: displayName.current, openshiftClusterIDState: localOpenshiftClusterIDState || selectedReason, onClusterIdStateUpdate: onClusterIdSave, isClusterIdInvalid: (isEmpty(localOpenshiftClusterIDState) && isEmpty(selectedReason)) || isClusterIdInvalid, clusterIdDropdownFormInstructions: clusterIdDropdownFormInstructions(), onClusterClear: resetClusterData, isV4: majorVersion === '4', isDisabled: isClusterIdUpdating, noClusterIdReasonExplanation: noClusterIdReasonExplanation }),
240
223
  noClusterIdReasonExplanation !== 'v3-cluster' &&
241
- (dontKnowSelected || noClusterIdReasonExplanation || noClusterIdReason) && (React.createElement(NoClusterIDReasonSelector, { noClusterIdReasonExplanation: noClusterIdReasonExplanation, noClusterIdReason: noClusterIdReason, onReasonInputBoxChanged: debounceFn, onReasonChange: onReasonChange, isInValid: isInVaidNoClusterIdReason, isCustomer: isCustomer, isDisabled: isReasonUpdating || isFetchingClusterDetails })),
224
+ (dontKnowSelected || noClusterIdReasonExplanation || noClusterIdReason) && (React.createElement(NoClusterIDReasonSelector, { noClusterIdReasonExplanation: noClusterIdReasonExplanation, noClusterIdReason: noClusterIdReason, onReasonInputBoxChanged: debounceFn, onReasonChange: onReasonChange, isInValid: isInVaidNoClusterIdReason, isCustomer: isCustomer, isDisabled: isReasonUpdating })),
242
225
  React.createElement(LoadingIndicator, { show: isClusterIdUpdating, size: "xs" })));
243
226
  }
244
227
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RMEEscalationList.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/RMEEscalations/RMEEscalationList.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAqB,MAAM,2CAA2C,CAAC;AAwB/F,UAAU,MAAM;IACZ,WAAW,EAAE,eAAe,EAAE,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACtB;AAOD,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,KAAK,EAAE,MAAM,eAoMtD"}
1
+ {"version":3,"file":"RMEEscalationList.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/RMEEscalations/RMEEscalationList.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAqB,MAAM,2CAA2C,CAAC;AAwB/F,UAAU,MAAM;IACZ,WAAW,EAAE,eAAe,EAAE,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACtB;AAOD,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,KAAK,EAAE,MAAM,eAsMtD"}
@@ -8,10 +8,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { escalations, publicApi } from '@cee-eng/hydrajs';
11
- import { Button, ButtonVariant } from '@patternfly/react-core';
11
+ import { Button, ButtonVariant, Flex, FlexItem } from '@patternfly/react-core';
12
12
  import { LoadingIndicator, PFTable, Table, ToastNotification, useFetch } from '@rh-support/components';
13
13
  import { ability, resourceActions, resources } from '@rh-support/user-permissions';
14
- import { formatDate } from '@rh-support/utils';
14
+ import { formatDate, sendToSentry } from '@rh-support/utils';
15
15
  import find from 'lodash/find';
16
16
  import isEmpty from 'lodash/isEmpty';
17
17
  import React, { useEffect, useRef, useState } from 'react';
@@ -71,10 +71,7 @@ export default function RMEEscalationList(props) {
71
71
  }
72
72
  catch (e) {
73
73
  ToastNotification.addDangerMessage(e);
74
- window === null || window === void 0 ? void 0 : window.Raven.captureException(e);
75
- window === null || window === void 0 ? void 0 : window.Raven.captureMessage('RME form submit error', {
76
- level: 'error',
77
- });
74
+ sendToSentry(e, {}, 'RME form submit error');
78
75
  }
79
76
  finally {
80
77
  escalationUpdateInProgessIds.current = escalationUpdateInProgessIds.current.filter((item) => item !== escalationNum);
@@ -119,11 +116,13 @@ export default function RMEEscalationList(props) {
119
116
  React.createElement(Trans, null, "Request Re-Open")));
120
117
  }
121
118
  else {
122
- return (React.createElement(React.Fragment, null,
123
- React.createElement(Button, { variant: ButtonVariant.secondary, onClick: () => requestUpdateRMEEscalation(escalation.name), "data-tracking-id": "case-details-rme-req-update" },
124
- React.createElement(Trans, null, "Request Update")),
125
- React.createElement(Button, { variant: ButtonVariant.secondary, className: "pf-u-mt-sm", onClick: () => requestClosureRMEEscalation(escalation.name), "data-tracking-id": "case-details-rme-req-closure" },
126
- React.createElement(Trans, null, "Request Closure"))));
119
+ return (React.createElement(Flex, null,
120
+ React.createElement(FlexItem, null,
121
+ React.createElement(Button, { variant: ButtonVariant.secondary, onClick: () => requestUpdateRMEEscalation(escalation.name), "data-tracking-id": "case-details-rme-req-update", className: "" },
122
+ React.createElement(Trans, null, "Request Update"))),
123
+ React.createElement(FlexItem, null,
124
+ React.createElement(Button, { variant: ButtonVariant.secondary, className: "pf-u-mt-sm", onClick: () => requestClosureRMEEscalation(escalation.name), "data-tracking-id": "case-details-rme-req-closure" },
125
+ React.createElement(Trans, null, "Request Closure")))));
127
126
  }
128
127
  };
129
128
  const canSeeClosedColumn = !isEmpty(find(escalationList, (e) => e.status === escalationStatus.closed));
@@ -1 +1 @@
1
- {"version":3,"file":"OpenShiftClusterId.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseManagement/OpenShiftClusterId.tsx"],"names":[],"mappings":"AAwBA,eAAO,MAAM,oBAAoB,mBAShC,CAAC;AAEF,eAAO,MAAM,uBAAuB,mBAInC,CAAC;AAEF,eAAO,MAAM,4BAA4B,mBAKxC,CAAC;AAEF,eAAO,MAAM,qBAAqB,mBAIjC,CAAC;AAEF,wBAAgB,kBAAkB,gBAoSjC"}
1
+ {"version":3,"file":"OpenShiftClusterId.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseManagement/OpenShiftClusterId.tsx"],"names":[],"mappings":"AA2BA,eAAO,MAAM,oBAAoB,mBAShC,CAAC;AAEF,eAAO,MAAM,uBAAuB,mBAInC,CAAC;AAEF,eAAO,MAAM,4BAA4B,mBAKxC,CAAC;AAEF,eAAO,MAAM,qBAAqB,mBAIjC,CAAC;AAEF,wBAAgB,kBAAkB,gBAkRjC"}