@rh-support/troubleshoot 0.2.123 → 0.2.126

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":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/CaseOverview/index.tsx"],"names":[],"mappings":"AAyCA,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAK,EAAE,MAAM,eA+ejD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/CaseOverview/index.tsx"],"names":[],"mappings":"AAyCA,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAK,EAAE,MAAM,eAgfjD"}
@@ -281,7 +281,7 @@ export default function CaseOverview(props) {
281
281
  React.createElement("div", { className: "form-wrapper" },
282
282
  React.createElement(CaseType, { selectedType: caseType, onTypeChange: onTypeChange, isDisabled: !canManageCase || allCaseTypes.isFetching, allTypes: allCaseTypes.data, isFetching: caseOverviewState.caseTypeUpdating && isCaseUpdating, hasError: allCaseTypes.isError })),
283
283
  React.createElement("div", { className: "form-wrapper" },
284
- React.createElement(Severity, { onSeverityChange: onSeverityChange, isDisabled: !canManageCase, isFetching: caseOverviewState.caseSeverityUpdating && isCaseUpdating })))),
284
+ React.createElement(Severity, { onCaseDetailsPage: true, onSeverityChange: onSeverityChange, isDisabled: !canManageCase, isFetching: caseOverviewState.caseSeverityUpdating && isCaseUpdating })))),
285
285
  React.createElement(ExpandableSection, { className: "case-details-main", toggleText: t('Case information'), isExpanded: isDetailsExpanded, onToggle: onToggleDetails },
286
286
  React.createElement(CaseInformation, null))),
287
287
  showCloseCaseModal && (React.createElement(CloseCaseModal, { onConfirm: (commentBody) => __awaiter(this, void 0, void 0, function* () {
@@ -1 +1 @@
1
- {"version":3,"file":"PostComment.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDiscussion/PostComment.tsx"],"names":[],"mappings":"AAqCA,OAAO,EAAkB,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAqB5F,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,WAAW,EAAE,CAAC;CACjC;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,eA2exC"}
1
+ {"version":3,"file":"PostComment.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDiscussion/PostComment.tsx"],"names":[],"mappings":"AAqCA,OAAO,EAAkB,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAqB5F,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,WAAW,EAAE,CAAC;CACjC;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,eA8exC"}
@@ -60,6 +60,9 @@ export function PostComment(props) {
60
60
  setCommentType(defaultCommentType);
61
61
  const defaultCommentSignature = retrievedCommentSignature || '';
62
62
  setCommentSignature(defaultCommentSignature);
63
+ if (isEmpty(commentText)) {
64
+ setCommentText(`\n ${defaultCommentSignature}` || '');
65
+ }
63
66
  }
64
67
  catch (error) {
65
68
  console.log(error);
@@ -68,7 +71,7 @@ export function PostComment(props) {
68
71
  useEffect(() => {
69
72
  userOriginalCommentPrefs();
70
73
  // eslint-disable-next-line react-hooks/exhaustive-deps
71
- });
74
+ }, []);
72
75
  const [isModalOpen, setIsModalOpen] = useState(false);
73
76
  const [isProcessing, setIsProcessing] = useState(isPostingComment || isUploadingAttachments);
74
77
  const { globalMetadataState: { loggedInUser, loggedInUserRights, loggedInUsersAccount, pcmConfig }, } = useContext(GlobalMetadataStateContext);
@@ -5,6 +5,7 @@ interface IProps extends IDClassNameProps {
5
5
  isFetching?: boolean;
6
6
  onSeverityChange: (casePayload: Partial<ICasePayload>) => void;
7
7
  showSeverityInfoIcon: boolean;
8
+ onCaseDetailsPage?: boolean;
8
9
  }
9
10
  export interface ISeverityOptions {
10
11
  disabled: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"Severity.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/Severity.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAKvE,OAAO,EAAE,gBAAgB,EAAW,MAAM,0BAA0B,CAAC;AAsBrE,UAAU,MAAO,SAAQ,gBAAgB;IACrC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gBAAgB,EAAE,CAAC,WAAW,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;IAC/D,oBAAoB,EAAE,OAAO,CAAC;CACjC;AASD,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,GAAG,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;CACxD;AAED,iBAAS,QAAQ,CAAC,KAAK,EAAE,MAAM,eA4N9B;kBA5NQ,QAAQ;;;AA8NjB,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"Severity.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/Severity.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAKvE,OAAO,EAAE,gBAAgB,EAAW,MAAM,0BAA0B,CAAC;AAuBrE,UAAU,MAAO,SAAQ,gBAAgB;IACrC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gBAAgB,EAAE,CAAC,WAAW,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;IAC/D,oBAAoB,EAAE,OAAO,CAAC;IAC9B,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC/B;AASD,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,GAAG,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;CACxD;AAED,iBAAS,QAAQ,CAAC,KAAK,EAAE,MAAM,eAyQ9B;kBAzQQ,QAAQ;;;AA2QjB,eAAe,QAAQ,CAAC"}
@@ -15,6 +15,7 @@ import { useCaseSelector } from '../../context/CaseContext';
15
15
  import { getIrtForSLAAndSeverity, getOrtForSLAAndSeverity, getSeverityDescription } from '../../reducers/CaseHelpers';
16
16
  import { CaseValuesToWatch } from '../shared/Constants';
17
17
  import { getChangedValueTooltip } from '../shared/utils';
18
+ import UpdateSeverityModal from '../UpdateSeverityModal/UpdateSeverityModal';
18
19
  const defaultProps = {
19
20
  id: '',
20
21
  className: '',
@@ -36,6 +37,7 @@ function Severity(props) {
36
37
  const [isSeverityInValid, setIsSeverityInValid] = useState(false);
37
38
  const [seviritiesOptions, setSeveritiesOptions] = useState([]);
38
39
  const [doNotShowIRT, setDoNotShowIRT] = useState(false);
40
+ const [openUpdateSeverityModal, setOpenUpdateSeverityModal] = useState(false);
39
41
  const updateState = (value) => {
40
42
  const casePayload = { severity: value };
41
43
  // .. change fts on sev change only while creating case or wchen we change to sev1
@@ -104,6 +106,9 @@ function Severity(props) {
104
106
  label: `${severity} - ${getSeverityDescription(severity)}`,
105
107
  additionalInfo: getAdditionalInfo(slaLocal, severity),
106
108
  };
109
+ const toggleModal = () => {
110
+ setOpenUpdateSeverityModal((openUpdateSeverityModal) => !openUpdateSeverityModal);
111
+ };
107
112
  useEffect(() => {
108
113
  var _a, _b, _c;
109
114
  if (!product ||
@@ -149,7 +154,24 @@ function Severity(props) {
149
154
  "\u00A0",
150
155
  filteredSeverities.filter((s) => s.disabled).length !== 0 && (React.createElement(Tooltip, { position: TooltipPosition.top, content: React.createElement(Trans, null, "Only the enabled severity levels are supported for selected product and version.") },
151
156
  React.createElement(WarningTriangleIcon, { color: "#ec7a08", size: "sm", title: "Support Severity Level warning" })))),
152
- React.createElement(Dropdown, { name: "open-case-severity", placeholder: t(`Select a severity`), title: t(`Select a severity`), list: allCaseSeverities.data
157
+ props.onCaseDetailsPage === true ? (React.createElement(React.Fragment, null,
158
+ React.createElement("div", { onClick: toggleModal },
159
+ React.createElement(Dropdown, { name: "open-case-severity", placeholder: t(`Select a severity`), title: t(`Select a severity`), list: allCaseSeverities.data
160
+ ? toOptions(filteredSeverities, {
161
+ labelKey: 'label',
162
+ additionalInfoKey: 'additionalInfo',
163
+ disabledKey: 'disabled',
164
+ })
165
+ : [], selectedItem: toOption(selectedSeverity, {
166
+ labelKey: 'label',
167
+ additionalInfoKey: 'additionalInfo',
168
+ disabledKey: 'disabled',
169
+ }), disabled: allCaseSeverities.isError ||
170
+ props.isDisabled ||
171
+ allCaseSeverities.isFetching ||
172
+ ownersEntitlements.isFetching ||
173
+ versionsDetails.isFetching, isLoadingList: props.isFetching || versionsDetails.isFetching, isInValid: allCaseSeverities.isError || isSeverityInValid, required: true, onChange: onSeverityChange, onOuterClick: setIsSeverityInValidLocal, "data-tracking-id": "open-case-severity" })),
174
+ React.createElement(UpdateSeverityModal, { show: openUpdateSeverityModal, onClose: toggleModal }))) : (React.createElement(Dropdown, { name: "open-case-severity", placeholder: t(`Select a severity`), title: t(`Select a severity`), list: allCaseSeverities.data
153
175
  ? toOptions(filteredSeverities, {
154
176
  labelKey: 'label',
155
177
  additionalInfoKey: 'additionalInfo',
@@ -163,7 +185,7 @@ function Severity(props) {
163
185
  props.isDisabled ||
164
186
  allCaseSeverities.isFetching ||
165
187
  ownersEntitlements.isFetching ||
166
- versionsDetails.isFetching, isLoadingList: props.isFetching || versionsDetails.isFetching, isInValid: allCaseSeverities.isError || isSeverityInValid, required: true, onChange: onSeverityChange, onOuterClick: setIsSeverityInValidLocal, "data-tracking-id": "open-case-severity" })));
188
+ versionsDetails.isFetching, isLoadingList: props.isFetching || versionsDetails.isFetching, isInValid: allCaseSeverities.isError || isSeverityInValid, required: true, onChange: onSeverityChange, onOuterClick: setIsSeverityInValidLocal, "data-tracking-id": "open-case-severity" }))));
167
189
  }
168
190
  Severity.defaultProps = defaultProps;
169
191
  export default Severity;
@@ -1 +1 @@
1
- {"version":3,"file":"OpenshiftDropdownV4.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseManagement/OpenshiftDropdownV4.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAG5E,OAAO,EAAE,gBAAgB,EAAuB,MAAM,0BAA0B,CAAC;AAUjF,UAAU,MAAO,SAAQ,gBAAgB;IACrC,uBAAuB,EAAE,MAAM,CAAC;IAChC,sBAAsB,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,oBAAoB,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACzF,kBAAkB,EAAE,OAAO,CAAC;IAC5B,iCAAiC,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IAChD,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACjC;AAuBD,iBAAS,mBAAmB,CAAC,KAAK,EAAE,MAAM,eA6WzC;kBA7WQ,mBAAmB;;;AAgX5B,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
1
+ {"version":3,"file":"OpenshiftDropdownV4.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseManagement/OpenshiftDropdownV4.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAG5E,OAAO,EAAE,gBAAgB,EAAuB,MAAM,0BAA0B,CAAC;AAUjF,UAAU,MAAO,SAAQ,gBAAgB;IACrC,uBAAuB,EAAE,MAAM,CAAC;IAChC,sBAAsB,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,oBAAoB,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACzF,kBAAkB,EAAE,OAAO,CAAC;IAC5B,iCAAiC,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IAChD,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACjC;AAuBD,iBAAS,mBAAmB,CAAC,KAAK,EAAE,MAAM,eA4WzC;kBA5WQ,mBAAmB;;;AA+W5B,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
@@ -174,14 +174,16 @@ function OpenshiftDropdownV4(props) {
174
174
  // recreate a new AbortController for each call
175
175
  let controller = new AbortController();
176
176
  abortControllerRef.current = controller;
177
+ const archived = !showArchivedClusters ? " AND status!='Archived'" : '';
178
+ const searchPhrase = search
179
+ ? ` AND (external_cluster_id ILIKE '%${search}%' OR display_name ILIKE '%${search}%' OR console_url ILIKE '%${search}%')`
180
+ : '';
177
181
  // query language: https://github.com/yaacov/tree-search-language
178
182
  clustersResponse = yield cloud.getAccountClustersSubscription({
179
183
  order: 'display_name asc',
180
184
  page,
181
185
  size: PER_PAGE,
182
- search: `external_cluster_id!='' AND ${showArchivedClusters ? '' : "status!='Archived'"} ${search && !showArchivedClusters ? 'AND' : ''} ${search
183
- ? `(external_cluster_id ILIKE '%${search}%' OR display_name ILIKE '%${search}%' OR console_url ILIKE '%${search}%')`
184
- : ''}`,
186
+ search: `external_cluster_id!='' ${archived} ${searchPhrase}`,
185
187
  fields: 'external_cluster_id,display_name,status,metrics.openshift_version,console_url',
186
188
  }, controller.signal);
187
189
  setInCache(`showArchived=${showArchivedClusters}input=${search}p=${page}`, clustersResponse);
@@ -71,7 +71,7 @@ export function NoAttachmentSelectedModal(props) {
71
71
  actionButtons = [
72
72
  React.createElement(FileSelectorButton, { key: "file-selector-btn", buttonLabel: t('Upload a file'), className: "pf-m-primary", "data-tracking-id": "no-attachment-file-selector-button", isSessionId: true }),
73
73
  React.createElement(Button, { key: "skip-file", onClick: props.onConfirm, className: "pf-u-ml-sm", "data-tracking-id": "submit-without-attachment", variant: ButtonVariant.secondary },
74
- React.createElement(Trans, null, "Yes, I'm, sure")),
74
+ React.createElement(Trans, null, "Yes, I'm sure")),
75
75
  ];
76
76
  }
77
77
  return actionButtons;
@@ -1 +1 @@
1
- {"version":3,"file":"Hostname.d.ts","sourceRoot":"","sources":["../../../../src/components/ImproveCase/Hostname.tsx"],"names":[],"mappings":"AASA,UAAU,MAAM;CAAG;AAEnB,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,eA6CrC"}
1
+ {"version":3,"file":"Hostname.d.ts","sourceRoot":"","sources":["../../../../src/components/ImproveCase/Hostname.tsx"],"names":[],"mappings":"AASA,UAAU,MAAM;CAAG;AAEnB,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,eA+CrC"}
@@ -29,5 +29,8 @@ export function Hostname(props) {
29
29
  `${HOSTNAME_LENGTH_LIMIT}`,
30
30
  " characters are not allowed."))),
31
31
  React.createElement("p", { className: "form-instructions" },
32
- React.createElement(Trans, null, "Hostname is not visible to Red Hat Support professionals."))));
32
+ React.createElement(Trans, null,
33
+ "Change visibility for hostnames under ",
34
+ React.createElement("a", { href: "/support/cases/#/manage/preferences" }, "Preferences"),
35
+ "."))));
33
36
  }
@@ -33,7 +33,7 @@ export function ClusterRecommendationItems(props) {
33
33
  React.createElement("h3", null, rule.description)),
34
34
  React.createElement("pfe-accordion-panel", null,
35
35
  React.createElement("p", null,
36
- React.createElement(Label, { icon: riskLabels[rule.total_risk].icon, color: riskLabels[rule.total_risk].color },
36
+ React.createElement(Label, { color: riskLabels[rule.total_risk].color },
37
37
  React.createElement(Trans, null, riskLabels[rule.total_risk].label))),
38
38
  React.createElement("p", null, rule.details || ''),
39
39
  rule.reason && (React.createElement(React.Fragment, null,
@@ -0,0 +1,7 @@
1
+ interface IProps {
2
+ show: boolean;
3
+ onClose: () => void;
4
+ }
5
+ export default function UpdateSeverityModal(props: IProps): JSX.Element;
6
+ export {};
7
+ //# sourceMappingURL=UpdateSeverityModal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UpdateSeverityModal.d.ts","sourceRoot":"","sources":["../../../../src/components/UpdateSeverityModal/UpdateSeverityModal.tsx"],"names":[],"mappings":"AA0BA,UAAU,MAAM;IACZ,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,KAAK,EAAE,MAAM,eA8NxD"}
@@ -0,0 +1,170 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { publicApi } from '@cee-eng/hydrajs';
11
+ import { Button, Modal, TextArea } from '@patternfly/react-core';
12
+ import { ToastNotification, useFetch } from '@rh-support/components';
13
+ import { GlobalMetadataStateContext, useCanEditCase } from '@rh-support/react-context';
14
+ import { ability, resourceActions, resources } from '@rh-support/user-permissions';
15
+ import isEmpty from 'lodash/isEmpty';
16
+ import isEqual from 'lodash/isEqual';
17
+ import React, { useContext, useReducer, useState } from 'react';
18
+ import { Trans, useTranslation } from 'react-i18next';
19
+ import { useCaseDispatch, useCaseSelector } from '../../context/CaseContext';
20
+ import { useCaseDetailsPageStateContext } from '../../context/CaseDetailsPageContext';
21
+ import { useCaseDiscussionTabDispatchContext, useCaseDiscussionTabStateContext, } from '../../context/CaseDiscussionTabContext';
22
+ import { updateDiscussionStateComments } from '../../reducers/CaseDiscussionTabReducer';
23
+ import { caseOverviewReducer, initialCaseViewState, setSeverityUpdating } from '../../reducers/CaseOverviewReducer';
24
+ import { checkForCaseStatusToggleOnAttachOrComment, setCaseDetails, updateCaseDetails, } from '../../reducers/CaseReducer';
25
+ import Severity from '../CaseInformation/Severity';
26
+ export default function UpdateSeverityModal(props) {
27
+ const { show, onClose } = props;
28
+ const { t } = useTranslation();
29
+ const [descriptionValue, setDescriptionValue] = useState('');
30
+ const [caseOverviewState, caseOverviewDispatch] = useReducer(caseOverviewReducer, initialCaseViewState);
31
+ const canManageCase = ability.can(resourceActions.UPDATE, resources.CASE_DETAILS);
32
+ const caseDispatch = useCaseDispatch();
33
+ const canEditCase = useCanEditCase();
34
+ const [updatedSeverity, setUpdatedSeverity] = useState();
35
+ const [newSeverityValue, setNewSeverityValue] = useState([]);
36
+ const { request: postCommentRequest, isFetching: isPostingComment } = useFetch(publicApi.kase.postComment, {
37
+ propgateErrors: true,
38
+ });
39
+ const { caseDetailsPageState: { caseFeedbacksHydra }, } = useCaseDetailsPageStateContext();
40
+ const dispatchDiscussion = useCaseDiscussionTabDispatchContext();
41
+ const { sort, allDiscussions, discussionFiltersListState } = useCaseDiscussionTabStateContext();
42
+ const { globalMetadataState: { loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
43
+ const caseState = useCaseSelector((state) => ({
44
+ caseDetails: {
45
+ caseNumber: state.caseDetails.caseNumber,
46
+ caseSeverity: state.caseDetails.severity,
47
+ },
48
+ isCaseUpdating: state.isCaseUpdating,
49
+ }), isEqual);
50
+ const { caseDetails, isCaseUpdating } = caseState;
51
+ const [currentSeverity, setCurrentSeverity] = useState(caseDetails.caseSeverity);
52
+ // Modal cancel function which resets the field
53
+ const onCancel = () => {
54
+ onClose();
55
+ setSeverityUpdating(caseOverviewDispatch, false);
56
+ setCaseDetails(caseDispatch, { severity: currentSeverity });
57
+ setDescriptionValue('');
58
+ };
59
+ // To handle description change
60
+ const handleTextAreaChange = (value) => {
61
+ setDescriptionValue(value);
62
+ };
63
+ const onSubmit = () => __awaiter(this, void 0, void 0, function* () {
64
+ // Severity update successful comment body
65
+ const severityUpdateComment = t('#### Severity update \n Severity changed from {{oldSeverity}} to {{newSeverity}}\n\n #### Description \n{{description}}', {
66
+ oldSeverity: currentSeverity,
67
+ newSeverity: newSeverityValue,
68
+ description: descriptionValue === null || descriptionValue === void 0 ? void 0 : descriptionValue.trim(),
69
+ });
70
+ // Severity update failed comment body
71
+ const severityUpdateFailedComment = t('#### Severity update \n Failed to change severity from {{oldSeverity}} to {{newSeverity}}\n\n #### Description \n{{description}}', {
72
+ oldSeverity: currentSeverity,
73
+ newSeverity: newSeverityValue,
74
+ description: descriptionValue === null || descriptionValue === void 0 ? void 0 : descriptionValue.trim(),
75
+ });
76
+ try {
77
+ setSeverityUpdating(caseOverviewDispatch, true);
78
+ yield updateCaseDetails(caseDispatch, caseDetails.caseNumber, updatedSeverity);
79
+ try {
80
+ yield postCommentRequest({
81
+ caseNumber: caseDetails.caseNumber,
82
+ commentBody: severityUpdateComment === null || severityUpdateComment === void 0 ? void 0 : severityUpdateComment.trim(),
83
+ contentType: 'markdown',
84
+ });
85
+ try {
86
+ yield checkForCaseStatusToggleOnAttachOrComment(caseDispatch, loggedInUserRights.data.isInternal(), caseDetails.caseSeverity);
87
+ ToastNotification.addSuccessMessage(t('Severity has been successfully updated'));
88
+ setCurrentSeverity(newSeverityValue);
89
+ onCancel();
90
+ }
91
+ catch (e) {
92
+ yield updateCaseDetails(caseDispatch, caseDetails.caseNumber, {
93
+ severity: currentSeverity,
94
+ });
95
+ yield postCommentRequest({
96
+ caseNumber: caseDetails.caseNumber,
97
+ commentBody: severityUpdateFailedComment === null || severityUpdateFailedComment === void 0 ? void 0 : severityUpdateFailedComment.trim(),
98
+ contentType: 'markdown',
99
+ });
100
+ ToastNotification.addDangerMessage(t(`Failed to check case status. Please try again.`));
101
+ }
102
+ }
103
+ catch (e) {
104
+ yield updateCaseDetails(caseDispatch, caseDetails.caseNumber, {
105
+ severity: currentSeverity,
106
+ });
107
+ ToastNotification.addDangerMessage(t(`Couldn't post severity update comment. Please try again.`));
108
+ }
109
+ }
110
+ catch (e) {
111
+ setSeverityUpdating(caseOverviewDispatch, false);
112
+ ToastNotification.addDangerMessage(t('Severity failed to update'));
113
+ onCancel();
114
+ }
115
+ finally {
116
+ yield updateDiscussionStateComments(dispatchDiscussion, caseDetails.caseNumber, allDiscussions, sort, caseFeedbacksHydra.data, discussionFiltersListState);
117
+ }
118
+ });
119
+ // To check if description is valid
120
+ const isTextAreaValid = () => {
121
+ if (isEmpty(descriptionValue === null || descriptionValue === void 0 ? void 0 : descriptionValue.trim())) {
122
+ return true;
123
+ }
124
+ else
125
+ return false;
126
+ };
127
+ // To compare previous and current severity values
128
+ const checkSeverity = () => {
129
+ const checkForUndefined = newSeverityValue['severity'] === undefined;
130
+ if (isEqual(currentSeverity, newSeverityValue['severity'])) {
131
+ return false;
132
+ }
133
+ else if (checkForUndefined) {
134
+ return false;
135
+ }
136
+ else {
137
+ return true;
138
+ }
139
+ };
140
+ // To disable submit button wrt above conditions
141
+ const isSubmitButtonDisabled = isTextAreaValid() || checkSeverity() ? true : false;
142
+ // Update severity modal buttons
143
+ const modalActions = [
144
+ React.createElement(Button, { key: "submit", variant: "primary", onClick: onSubmit, isLoading: isCaseUpdating || isPostingComment, "data-tracking-id": "update-severity-submit", isDisabled: isSubmitButtonDisabled }, t('Submit')),
145
+ React.createElement(Button, { key: "back", variant: "link", onClick: onCancel, "data-tracking-id": "update-severity-cancel" }, t('Cancel')),
146
+ ];
147
+ // To handle severity change in the modal
148
+ const onSeverityChange = (payload) => __awaiter(this, void 0, void 0, function* () {
149
+ if (canEditCase.alert())
150
+ return;
151
+ yield setUpdatedSeverity(payload);
152
+ yield setNewSeverityValue(payload['severity']);
153
+ setCaseDetails(caseDispatch, payload);
154
+ });
155
+ // Returns the modal body with its contents
156
+ const modalBody = () => {
157
+ return (React.createElement(React.Fragment, null,
158
+ React.createElement("form", { "aria-label": t('form') },
159
+ React.createElement("div", { className: "form-group pf-u-mt-xs" },
160
+ React.createElement("div", null,
161
+ React.createElement(Severity, { onCaseDetailsPage: false, onSeverityChange: onSeverityChange, isDisabled: !canManageCase && isCaseUpdating, isFetching: (caseOverviewState.caseSeverityUpdating && isCaseUpdating) || isPostingComment })),
162
+ React.createElement("div", null,
163
+ React.createElement("label", { htmlFor: "date-input", className: "pf-u-mt-md" },
164
+ React.createElement(Trans, null, "Describe update"),
165
+ React.createElement("span", { className: "form-required", "aria-hidden": "true" }, "*")),
166
+ React.createElement(TextArea, { placeholder: "Please identify any changes in the case's business impact", isDisabled: (caseOverviewState.caseSeverityUpdating && isCaseUpdating) || isPostingComment, value: descriptionValue, onChange: handleTextAreaChange, resizeOrientation: "vertical", "aria-label": "summary", isRequired: true }))))));
167
+ };
168
+ // Main modal and its headings
169
+ return (React.createElement(Modal, { title: t('Update severity'), description: t('Describing your update helps us better assist you.'), isOpen: show, onClose: onCancel, actions: modalActions }, modalBody()));
170
+ }
@@ -52,22 +52,18 @@ export declare const markdownInlineFileSelectEvent = "PCM-Next > Markdown-toolba
52
52
  export declare const markdownFilePasteEvent = "PCM-Next > Markdown-toolbar-file-paste";
53
53
  export declare const riskLabels: {
54
54
  1: {
55
- icon: JSX.Element;
56
55
  label: string;
57
56
  color: string;
58
57
  };
59
58
  2: {
60
- icon: JSX.Element;
61
59
  label: string;
62
60
  color: string;
63
61
  };
64
62
  3: {
65
- icon: JSX.Element;
66
63
  label: string;
67
64
  color: string;
68
65
  };
69
66
  4: {
70
- icon: JSX.Element;
71
67
  label: string;
72
68
  color: string;
73
69
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Constants.d.ts","sourceRoot":"","sources":["../../../../src/components/shared/Constants.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,wBA+BE;AAEF;;GAEG;AACH,oBAAY,iBAAiB;IACzB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,IAAI,cAAc;IAClB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,KAAK,sBAAsB;IAC3B,KAAK,UAAU;IACf,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,kBAAkB,yBAAyB;CAC9C;AAED,eAAO,MAAM,8BAA8B,oDAAoD,CAAC;AAEhG,eAAO,MAAM,oCAAoC,wDAAwD,CAAC;AAC1G,eAAO,MAAM,6BAA6B,4CAA4C,CAAC;AACvF,eAAO,MAAM,sBAAsB,2CAA2C,CAAC;AAE/E,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;CAKtB,CAAC"}
1
+ {"version":3,"file":"Constants.d.ts","sourceRoot":"","sources":["../../../../src/components/shared/Constants.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wBA+BE;AAEF;;GAEG;AACH,oBAAY,iBAAiB;IACzB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,IAAI,cAAc;IAClB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,KAAK,sBAAsB;IAC3B,KAAK,UAAU;IACf,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,kBAAkB,yBAAyB;CAC9C;AAED,eAAO,MAAM,8BAA8B,oDAAoD,CAAC;AAEhG,eAAO,MAAM,oCAAoC,wDAAwD,CAAC;AAC1G,eAAO,MAAM,6BAA6B,4CAA4C,CAAC;AACvF,eAAO,MAAM,sBAAsB,2CAA2C,CAAC;AAE/E,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;CAKtB,CAAC"}
@@ -1,8 +1,3 @@
1
- import AngleDoubleDownIcon from '@patternfly/react-icons/dist/js/icons/angle-double-down-icon';
2
- import AngleDoubleUpIcon from '@patternfly/react-icons/dist/js/icons/angle-double-up-icon';
3
- import CriticalRiskIcon from '@patternfly/react-icons/dist/js/icons/critical-risk-icon';
4
- import EqualsIcon from '@patternfly/react-icons/dist/js/icons/equals-icon';
5
- import React from 'react';
6
1
  export default {
7
2
  languagesMap: {
8
3
  en: 'English',
@@ -56,8 +51,8 @@ export const recsViewedFromNoAttachmentModalEvent = 'PCM-Next > No-Attachment-mo
56
51
  export const markdownInlineFileSelectEvent = 'PCM-Next > Markdown-toolbar-file-select';
57
52
  export const markdownFilePasteEvent = 'PCM-Next > Markdown-toolbar-file-paste';
58
53
  export const riskLabels = {
59
- 1: { icon: React.createElement(AngleDoubleDownIcon, null), label: 'Low', color: 'blue' },
60
- 2: { icon: React.createElement(EqualsIcon, null), label: 'Moderate', color: 'gold' },
61
- 3: { icon: React.createElement(AngleDoubleUpIcon, null), label: 'Important', color: 'orange' },
62
- 4: { icon: React.createElement(CriticalRiskIcon, null), label: 'Critical', color: 'red' },
54
+ 1: { label: 'Low', color: 'blue' },
55
+ 2: { label: 'Moderate', color: 'orange' },
56
+ 3: { label: 'Important', color: 'red' },
57
+ 4: { label: 'Critical', color: 'red' },
63
58
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/troubleshoot",
3
- "version": "0.2.123",
3
+ "version": "0.2.126",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -32,7 +32,7 @@
32
32
  "@patternfly/pfe-accordion": "1.12.3",
33
33
  "@patternfly/pfe-collapse": "1.12.3",
34
34
  "@patternfly/pfe-tabs": "1.12.3",
35
- "@patternfly/react-core": "4.224.1",
35
+ "@patternfly/react-core": "4.202.16",
36
36
  "@rh-support/api": "0.3.9",
37
37
  "@rh-support/components": "^0.1.3",
38
38
  "@rh-support/react-context": "^0.1.3",
@@ -70,12 +70,12 @@
70
70
  "@patternfly/pfe-collapse": "1.12.3",
71
71
  "@patternfly/pfe-icon": "^1.12.3",
72
72
  "@patternfly/pfe-tabs": "1.12.3",
73
- "@patternfly/react-core": "4.224.1",
73
+ "@patternfly/react-core": "4.202.16",
74
74
  "@progress/kendo-drawing": "^1.6.0",
75
75
  "@progress/kendo-react-pdf": "^3.12.0",
76
76
  "@rh-support/api": "0.3.24",
77
- "@rh-support/components": "1.1.74",
78
- "@rh-support/react-context": "0.2.80",
77
+ "@rh-support/components": "1.1.75",
78
+ "@rh-support/react-context": "0.2.81",
79
79
  "@rh-support/types": "0.2.0",
80
80
  "@rh-support/user-permissions": "0.2.62",
81
81
  "@rh-support/utils": "0.2.46",
@@ -143,5 +143,5 @@
143
143
  "not ie <= 11",
144
144
  "not op_mini all"
145
145
  ],
146
- "gitHead": "92d0e7c14067d191a4b8d1a12df459c61deca4c0"
146
+ "gitHead": "16100828f404296b3dfb26fbb9fde4c5920ab94e"
147
147
  }