@rh-support/troubleshoot 0.4.0 → 1.0.0

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.
@@ -219,7 +219,7 @@ export function CaseOpenshiftClusterId() {
219
219
  }
220
220
  else {
221
221
  return (React.createElement(React.Fragment, null,
222
- React.createElement(OpenshiftDropdownV4, { openshiftDisplayName: displayName.current, openshiftClusterIDState: localOpenshiftClusterIDState || selectedReason, onClusterIdStateUpdate: onClusterIdSave, isClusterIdInvalid: (isEmpty(localOpenshiftClusterIDState) && isEmpty(selectedReason)) || isClusterIdInvalid, clusterIdDropdownFormInstructions: clusterIdDropdownFormInstructions(), onClusterClear: resetClusterData, isNotV3: majorVersion !== '3', isDisabled: isClusterIdUpdating, noClusterIdReasonExplanation: noClusterIdReasonExplanation }),
222
+ React.createElement(OpenshiftDropdownV4, { openshiftDisplayName: displayName.current, openshiftClusterIDState: localOpenshiftClusterIDState || selectedReason, onClusterIdStateUpdate: onClusterIdSave, isClusterIdInvalid: (isEmpty(localOpenshiftClusterIDState) && isEmpty(selectedReason)) || isClusterIdInvalid, clusterIdDropdownFormInstructions: clusterIdDropdownFormInstructions(), onClusterClear: resetClusterData, isV3: majorVersion === '3' || isNaN(parseInt(majorVersion)), isDisabled: isClusterIdUpdating, noClusterIdReasonExplanation: noClusterIdReasonExplanation }),
223
223
  noClusterIdReasonExplanation !== 'v3-cluster' &&
224
224
  (dontKnowSelected || noClusterIdReasonExplanation || noClusterIdReason) && (React.createElement(NoClusterIDReasonSelector, { noClusterIdReasonExplanation: noClusterIdReasonExplanation, noClusterIdReason: noClusterIdReason, onReasonInputBoxChanged: debounceFn, onReasonChange: onReasonChange, isInValid: isInVaidNoClusterIdReason, isCustomer: isCustomer, isDisabled: isReasonUpdating })),
225
225
  React.createElement(LoadingIndicator, { show: isClusterIdUpdating, size: "xs" })));
@@ -1 +1 @@
1
- {"version":3,"file":"CaseExternalTrackerUpdate.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDiscussion/CaseExternalTrackerUpdate.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AAMjF,OAAO,KAAqB,MAAM,OAAO,CAAC;AAO1C,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,sBAAsB,CAAC;IACtC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,eAAe,CAAC,EAAE,CAAC,iBAAiB,EAAE,MAAM,KAAK,IAAI,CAAC;CACzD;AAID,QAAA,MAAM,yBAAyB,4EA4D7B,CAAC;AAEH,eAAe,yBAAyB,CAAC"}
1
+ {"version":3,"file":"CaseExternalTrackerUpdate.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDiscussion/CaseExternalTrackerUpdate.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AAMjF,OAAO,KAAqB,MAAM,OAAO,CAAC;AAO1C,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,sBAAsB,CAAC;IACtC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,eAAe,CAAC,EAAE,CAAC,iBAAiB,EAAE,MAAM,KAAK,IAAI,CAAC;CACzD;AAID,QAAA,MAAM,yBAAyB,4EAsF7B,CAAC;AAEH,eAAe,yBAAyB,CAAC"}
@@ -17,13 +17,14 @@ const CaseExternalTrackerUpdate = React.forwardRef((props, ref) => {
17
17
  return { __html: markdownToHTML(markdown, { openLinksInNewTab: true }) };
18
18
  };
19
19
  const onJumpToComment = (externalTrackerId) => () => props.showJumpToComment && props.onJumpToComment && props.onJumpToComment(externalTrackerId);
20
- const isPrivateUpdate = () => includes(privateVisibilityStatuses, props.trackerUpdate.visibility);
20
+ // To check and set if a comment is private or not
21
+ const isPrivateUpdate = () => includes(privateVisibilityStatuses, props.trackerUpdate.visibility) || !props.trackerUpdate.customerVisible;
21
22
  if (isPrivateUpdate() && !canSeePrivateComments)
22
23
  return React.createElement(React.Fragment, null);
23
24
  return (React.createElement("section", { ref: ref, id: props.trackerUpdate.id, className: `prevent-split support-comment ${isPrivateUpdate() ? 'private ' : ''}comment-external-tracker ${ref ? 'selected-case-comment' : ''}` },
24
25
  React.createElement("header", null,
25
26
  React.createElement("h4", null,
26
- React.createElement(TopologyIcon, { size: "sm" }),
27
+ React.createElement(TopologyIcon, { title: "Comment from external tracker", size: "sm" }),
27
28
  " ",
28
29
  props.trackerUpdate.updateBy),
29
30
  React.createElement("time", null, formatDateTime(props.trackerUpdate.createdDate))),
@@ -31,7 +32,16 @@ const CaseExternalTrackerUpdate = React.forwardRef((props, ref) => {
31
32
  props.trackerUpdate.originatingSystem,
32
33
  React.createElement("pre", { className: "push-top-narrow", dangerouslySetInnerHTML: sanetize(props.trackerUpdate.body) })),
33
34
  React.createElement("footer", null,
34
- React.createElement("div", { className: "comment-note" }, isPrivateUpdate() && React.createElement(Trans, null, "Private comment")),
35
+ isPrivateUpdate() && (React.createElement("div", { className: "comment-note" },
36
+ React.createElement(Trans, null,
37
+ "Private comment",
38
+ ' ',
39
+ !props.trackerUpdate.customerVisible && (React.createElement(React.Fragment, null,
40
+ React.createElement("span", { className: "external-tracker-label" },
41
+ "\u00B7 ",
42
+ React.createElement(Trans, null, " External tracker"))))))),
43
+ !isPrivateUpdate() && props.trackerUpdate.customerVisible && (React.createElement("div", { className: "comment-note external-tracker-label" },
44
+ React.createElement(Trans, null, "External tracker"))),
35
45
  React.createElement("span", { className: "pull-right pf-l-flex pf-m-align-items-center" },
36
46
  props.showJumpToComment && (React.createElement(DiscussionItemLink, { onClick: onJumpToComment(props.trackerUpdate.id), discussionType: DiscussionType.EXTERNAL_TRACKER, itemId: props.trackerUpdate.id, caseNumber: caseNumber, isCopyLink: false },
37
47
  React.createElement(Trans, null, "Jump to comment"))),
@@ -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;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"}
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,eA8Q9B;kBA9QQ,QAAQ;;;AAgRjB,eAAe,QAAQ,CAAC"}
@@ -171,7 +171,7 @@ function Severity(props) {
171
171
  allCaseSeverities.isFetching ||
172
172
  ownersEntitlements.isFetching ||
173
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
174
+ React.createElement(UpdateSeverityModal, { isDisabled: props.isFetching, isFetching: props.isFetching, show: openUpdateSeverityModal, onClose: toggleModal }))) : (React.createElement(Dropdown, { name: "open-case-severity", placeholder: t(`Select a severity`), title: t(`Select a severity`), list: allCaseSeverities.data
175
175
  ? toOptions(filteredSeverities, {
176
176
  labelKey: 'label',
177
177
  additionalInfoKey: 'additionalInfo',
@@ -206,7 +206,7 @@ export function OpenShiftClusterId() {
206
206
  return null;
207
207
  return (React.createElement(React.Fragment, null,
208
208
  !isOpenShiftV3 && (React.createElement(OpenshiftDropdownV4, { openshiftDisplayName: openshiftDisplayName, openshiftClusterIDState: openshiftClusterID || selectedReason, onClusterIdStateUpdate: onClusterIdStateUpdate, isClusterIdInvalid: showValidationErrorAlert &&
209
- ((isEmpty(openshiftClusterID) && isEmpty(selectedReason)) || isClusterIdInvalid), clusterIdDropdownFormInstructions: clusterIdDropdownFormInstructions(), onClusterClear: resetClusterData, isNotV3: majorVersion !== '3' })),
209
+ ((isEmpty(openshiftClusterID) && isEmpty(selectedReason)) || isClusterIdInvalid), clusterIdDropdownFormInstructions: clusterIdDropdownFormInstructions(), onClusterClear: resetClusterData, isV3: majorVersion === '3' || isNaN(parseInt(majorVersion)) })),
210
210
  noClusterIdReasonExplanation !== 'v3-cluster' && dontKnowSelected && !isOpenShiftV3 && (React.createElement(NoClusterIDReasonSelector, { noClusterIdReasonExplanation: noClusterIdReasonExplanation, noClusterIdReason: noClusterIdReason, onReasonInputBoxChanged: onReasonExplanationInputBoxChanged, onReasonChange: onReasonChange, isInValid: isInVaidNoClusterIdReason, isCustomer: isCustomer })),
211
211
  (v3Selected || isOpenShiftV3) && (React.createElement(OpenShiftV3Inputbox, { v3ClusterName: v3ClusterName, onReasonInputBoxChanged: v3ClusterNameInputBoxChanged, isInValid: isEmpty(v3ClusterName.trim()) && showValidationErrorAlert, v3Selected: v3Selected }))));
212
212
  }
@@ -6,7 +6,7 @@ interface IProps extends IDClassNameProps {
6
6
  isClusterIdInvalid: boolean;
7
7
  clusterIdDropdownFormInstructions?: JSX.Element;
8
8
  onClusterClear: () => void;
9
- isNotV3: boolean;
9
+ isV3: boolean;
10
10
  isDisabled?: boolean;
11
11
  noClusterIdReasonExplanation?: string;
12
12
  openshiftDisplayName?: string;
@@ -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,OAAO,EAAE,OAAO,CAAC;IACjB,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"}
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"}
@@ -99,7 +99,7 @@ function OpenshiftDropdownV4(props) {
99
99
  React.createElement(Checkbox, { label: t('Show archived clusters'), key: "show-archived-clusters", "aria-label": t('Show archived clusters'), id: "show-archived-clusters", "data-tracking-id": "show-hide-archived-clusters", isChecked: showArchivedClusters, className: "archived-clusters-checkbox" })),
100
100
  React.createElement(Divider, { component: "div", key: 'cluster-id-options-divider-e' }),
101
101
  React.createElement(SelectOption, { key: 'dont-have-id', value: createState('dont-have-id', t("I don't have my Cluster ID")) }),
102
- ...(!props.isNotV3
102
+ ...(props.isV3
103
103
  ? [
104
104
  React.createElement(SelectOption, { key: 'v3-cluster', value: createState('v3-cluster', t('The case is for a v3 cluster')) }),
105
105
  ]
@@ -231,7 +231,7 @@ function OpenshiftDropdownV4(props) {
231
231
  }, []);
232
232
  // need to get clusters when user opens the dropdown
233
233
  // as the api response is cached np extra call is made on open/close
234
- // added observing props.isNotV3 because re-render
234
+ // added observing props.isV3 because re-render
235
235
  // is needed when user on overview page changing version
236
236
  useEffect(() => {
237
237
  if (!isOpen)
@@ -251,7 +251,7 @@ function OpenshiftDropdownV4(props) {
251
251
  isUnmounted = true;
252
252
  };
253
253
  // eslint-disable-next-line react-hooks/exhaustive-deps
254
- }, [props.isNotV3, showArchivedClusters, isOpen, inputVal]);
254
+ }, [props.isV3, showArchivedClusters, isOpen, inputVal]);
255
255
  useEffect(() => {
256
256
  if (props.isClusterIdInvalid) {
257
257
  setValidated('error');
@@ -1,4 +1,6 @@
1
1
  interface IProps {
2
+ isDisabled?: boolean;
3
+ isFetching?: boolean;
2
4
  show: boolean;
3
5
  onClose: () => void;
4
6
  }
@@ -1 +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,eAwPxD"}
1
+ {"version":3,"file":"UpdateSeverityModal.d.ts","sourceRoot":"","sources":["../../../../src/components/UpdateSeverityModal/UpdateSeverityModal.tsx"],"names":[],"mappings":"AAsCA,UAAU,MAAM;IACZ,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,KAAK,EAAE,MAAM,eA4YxD"}
@@ -9,62 +9,128 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { publicApi } from '@cee-eng/hydrajs';
11
11
  import { Button, Modal, TextArea } from '@patternfly/react-core';
12
- import { ToastNotification, useFetch } from '@rh-support/components';
12
+ import { Dropdown, ToastNotification, useFetch } from '@rh-support/components';
13
13
  import { GlobalMetadataStateContext, useCanEditCase } from '@rh-support/react-context';
14
- import { ability, resourceActions, resources } from '@rh-support/user-permissions';
14
+ import { autoEnableFtsOnCaseViewEditPage, severitySort, showFtsOnCreateCasePage, toOption, toOptions, } from '@rh-support/utils';
15
+ import find from 'lodash/find';
16
+ import includes from 'lodash/includes';
15
17
  import isEmpty from 'lodash/isEmpty';
16
18
  import isEqual from 'lodash/isEqual';
17
- import React, { useContext, useReducer, useState } from 'react';
19
+ import map from 'lodash/map';
20
+ import React, { useContext, useEffect, useReducer, useState } from 'react';
18
21
  import { Trans, useTranslation } from 'react-i18next';
19
22
  import { useCaseDispatch, useCaseSelector } from '../../context/CaseContext';
20
23
  import { useCaseDetailsPageStateContext } from '../../context/CaseDetailsPageContext';
21
24
  import { useCaseDiscussionTabDispatchContext, useCaseDiscussionTabStateContext, } from '../../context/CaseDiscussionTabContext';
22
25
  import { updateDiscussionStateComments } from '../../reducers/CaseDiscussionTabReducer';
26
+ import { getIrtForSLAAndSeverity, getOrtForSLAAndSeverity, getSeverityDescription } from '../../reducers/CaseHelpers';
23
27
  import { caseOverviewReducer, initialCaseViewState, setSeverityUpdating } from '../../reducers/CaseOverviewReducer';
24
28
  import { checkForCaseStatusToggleOnAttachOrComment, setCaseDetails, updateCaseDetails, } from '../../reducers/CaseReducer';
25
- import Severity from '../CaseInformation/Severity';
26
29
  export default function UpdateSeverityModal(props) {
27
- const { show, onClose } = props;
30
+ const { show, onClose, isDisabled, isFetching } = props;
28
31
  const { t } = useTranslation();
29
32
  const [descriptionValue, setDescriptionValue] = useState('');
30
33
  const [caseOverviewState, caseOverviewDispatch] = useReducer(caseOverviewReducer, initialCaseViewState);
31
- const canManageCase = ability.can(resourceActions.UPDATE, resources.CASE_DETAILS);
32
34
  const caseDispatch = useCaseDispatch();
33
35
  const canEditCase = useCanEditCase();
34
- const [updatedSeverity, setUpdatedSeverity] = useState();
35
- const [newSeverityValue, setNewSeverityValue] = useState([]);
36
+ const [updatedSeverity, setUpdatedSeverity] = useState({});
37
+ const [isSeverityInValid, setIsSeverityInValid] = useState(false);
38
+ const [seviritiesOptions, setSeveritiesOptions] = useState([]);
39
+ const [doNotShowIRT, setDoNotShowIRT] = useState(false);
36
40
  const { request: postCommentRequest, isFetching: isPostingComment } = useFetch(publicApi.kase.postComment, {
37
41
  propgateErrors: true,
38
42
  });
39
43
  const { caseDetailsPageState: { caseFeedbacksHydra }, } = useCaseDetailsPageStateContext();
40
44
  const dispatchDiscussion = useCaseDiscussionTabDispatchContext();
41
45
  const { sort, allDiscussions, discussionFiltersListState } = useCaseDiscussionTabStateContext();
42
- const { globalMetadataState: { loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
46
+ const { globalMetadataState: { allCaseSeverities, allProducts, loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
43
47
  const caseState = useCaseSelector((state) => ({
44
48
  caseDetails: {
45
49
  caseNumber: state.caseDetails.caseNumber,
46
50
  caseSeverity: state.caseDetails.severity,
47
51
  caseStatus: state.caseDetails.status,
52
+ product: state.caseDetails.product,
53
+ version: state.caseDetails.version,
54
+ entitlementSla: state.caseDetails.entitlementSla,
48
55
  },
49
56
  isCaseUpdating: state.isCaseUpdating,
57
+ versionsDetails: state.versionsDetails,
58
+ ownersEntitlements: state.ownersEntitlements,
50
59
  }), isEqual);
51
- const { caseDetails, isCaseUpdating } = caseState;
60
+ const { caseDetails, isCaseUpdating, ownersEntitlements, versionsDetails } = caseState;
52
61
  const [currentSeverity, setCurrentSeverity] = useState(caseDetails.caseSeverity);
62
+ const getAdditionalInfo = (sla, severity) => {
63
+ if (doNotShowIRT)
64
+ return React.createElement(React.Fragment, null);
65
+ const irt = getIrtForSLAAndSeverity(sla, severity);
66
+ const ort = getOrtForSLAAndSeverity(sla, severity);
67
+ return isEmpty(irt) ? undefined : irt === ort ? (React.createElement(React.Fragment, null,
68
+ React.createElement("strong", null, irt),
69
+ " ",
70
+ React.createElement(Trans, null, "initial and ongoing response time."))) : (React.createElement(React.Fragment, null,
71
+ React.createElement("strong", null, irt),
72
+ " ",
73
+ React.createElement(Trans, null, "initial and"),
74
+ " ",
75
+ React.createElement("strong", null, ort),
76
+ ' ',
77
+ React.createElement(Trans, null, "ongoing response time.")));
78
+ };
79
+ const slaLocal = caseDetails.entitlementSla;
80
+ // To set the filtered severities from data
81
+ const filteredSeverities = map(allCaseSeverities.data, (s) => {
82
+ const sevItem = {
83
+ name: s,
84
+ disabled: isEmpty(find(seviritiesOptions, (severity) => s === severity)),
85
+ label: `${s} - ${getSeverityDescription(s)}`,
86
+ additionalInfo: getAdditionalInfo(slaLocal, s),
87
+ };
88
+ return sevItem;
89
+ });
90
+ // To set the current selected severity
91
+ let selectedSeverity = {
92
+ name: currentSeverity,
93
+ disabled: false,
94
+ label: `${currentSeverity} - ${getSeverityDescription(currentSeverity)}`,
95
+ additionalInfo: getAdditionalInfo(slaLocal, currentSeverity),
96
+ };
97
+ // To reupdate the severity value when successfully submitted
98
+ const reUpdateSeverity = (severity) => {
99
+ selectedSeverity = {
100
+ name: severity,
101
+ disabled: false,
102
+ label: `${severity} - ${getSeverityDescription(severity)}`,
103
+ additionalInfo: getAdditionalInfo(slaLocal, severity),
104
+ };
105
+ };
106
+ // To check if severity is valid
107
+ const setIsSeverityInValidLocal = (selectedItem) => {
108
+ const isInvalid = isEmpty(selectedItem) || isEmpty(selectedItem.label);
109
+ setIsSeverityInValid(isInvalid);
110
+ };
111
+ // To update the state when severity changes
112
+ const updateState = (value) => {
113
+ const casePayload = { severity: value };
114
+ // .. change fts on sev change only while creating case or wchen we change to sev1
115
+ isEmpty(caseDetails.caseNumber) &&
116
+ (casePayload.fts = showFtsOnCreateCasePage(caseDetails.entitlementSla, value));
117
+ !isEmpty(caseDetails.caseNumber) &&
118
+ autoEnableFtsOnCaseViewEditPage(caseDetails.entitlementSla, value) &&
119
+ (casePayload.fts = true);
120
+ };
53
121
  // Modal cancel function which resets the field
54
- const onCancel = () => {
122
+ const onCancel = () => __awaiter(this, void 0, void 0, function* () {
55
123
  if (isCaseUpdating || isPostingComment)
56
124
  return;
57
- onClose();
58
125
  setSeverityUpdating(caseOverviewDispatch, false);
59
- setCaseDetails(caseDispatch, { severity: currentSeverity });
60
- setNewSeverityValue([]);
126
+ setCurrentSeverity(caseDetails.caseSeverity);
61
127
  setDescriptionValue('');
62
- };
128
+ onClose();
129
+ });
63
130
  // To handle on successful submit
64
131
  const onSuccessfulSubmit = () => {
65
132
  onClose();
66
133
  setSeverityUpdating(caseOverviewDispatch, false);
67
- setNewSeverityValue([]);
68
134
  setDescriptionValue('');
69
135
  };
70
136
  // To handle description change
@@ -74,14 +140,14 @@ export default function UpdateSeverityModal(props) {
74
140
  const onSubmit = () => __awaiter(this, void 0, void 0, function* () {
75
141
  // Severity update successful comment body
76
142
  const severityUpdateComment = t('#### Severity update \n Severity changed from {{oldSeverity}} to {{newSeverity}}\n\n #### Description \n{{description}}', {
77
- oldSeverity: currentSeverity,
78
- newSeverity: newSeverityValue,
143
+ oldSeverity: caseDetails.caseSeverity,
144
+ newSeverity: updatedSeverity['severity'],
79
145
  description: descriptionValue === null || descriptionValue === void 0 ? void 0 : descriptionValue.trim(),
80
146
  });
81
147
  // Severity update failed comment body
82
148
  const severityUpdateFailedComment = t('#### Severity update \n Failed to change severity from {{oldSeverity}} to {{newSeverity}}. Please try again\n', {
83
- oldSeverity: currentSeverity,
84
- newSeverity: newSeverityValue,
149
+ oldSeverity: caseDetails.caseSeverity,
150
+ newSeveritay: updatedSeverity['severity'],
85
151
  });
86
152
  try {
87
153
  setSeverityUpdating(caseOverviewDispatch, true);
@@ -94,7 +160,7 @@ export default function UpdateSeverityModal(props) {
94
160
  });
95
161
  try {
96
162
  checkForCaseStatusToggleOnAttachOrComment(caseDispatch, loggedInUserRights.data.isInternal(), caseDetails.caseStatus);
97
- setCurrentSeverity(newSeverityValue);
163
+ setCurrentSeverity(updatedSeverity['severity']);
98
164
  onSuccessfulSubmit();
99
165
  ToastNotification.addSuccessMessage(t('Severity has been successfully updated'));
100
166
  }
@@ -115,9 +181,10 @@ export default function UpdateSeverityModal(props) {
115
181
  }
116
182
  catch (e) {
117
183
  yield updateCaseDetails(caseDispatch, caseDetails.caseNumber, {
118
- severity: currentSeverity,
184
+ severity: caseDetails.caseSeverity,
119
185
  });
120
- setDescriptionValue('');
186
+ setDescriptionValue(descriptionValue === null || descriptionValue === void 0 ? void 0 : descriptionValue.trim());
187
+ reUpdateSeverity(caseDetails.caseSeverity);
121
188
  onClose();
122
189
  setSeverityUpdating(caseOverviewDispatch, false);
123
190
  ToastNotification.addDangerMessage(t(`Couldn't post severity update comment. Please try again`));
@@ -144,11 +211,10 @@ export default function UpdateSeverityModal(props) {
144
211
  };
145
212
  // To compare previous and current severity values
146
213
  const checkSeverityValid = () => {
147
- const checkForUndefined = newSeverityValue.length === 0;
148
- if (isEqual(currentSeverity, newSeverityValue)) {
214
+ if (isEqual(caseDetails.caseSeverity, updatedSeverity['severity'])) {
149
215
  return false;
150
216
  }
151
- else if (checkForUndefined) {
217
+ else if (isEmpty(updatedSeverity)) {
152
218
  return false;
153
219
  }
154
220
  else {
@@ -162,21 +228,77 @@ export default function UpdateSeverityModal(props) {
162
228
  React.createElement(Button, { key: "submit", variant: "primary", onClick: onSubmit, isLoading: isCaseUpdating || isPostingComment, "data-tracking-id": "update-severity-submit", isDisabled: isSubmitButtonDisabled || isCaseUpdating || isPostingComment }, t('Submit')),
163
229
  React.createElement(Button, { key: "back", variant: "link", onClick: onCancel, "data-tracking-id": "update-severity-cancel", isDisabled: isCaseUpdating || isPostingComment }, t('Cancel')),
164
230
  ];
165
- // To handle severity change in the modal
166
- const onSeverityChange = (payload) => __awaiter(this, void 0, void 0, function* () {
231
+ // To handle the severity change
232
+ const onSeverityChange = (option) => {
167
233
  if (canEditCase.alert())
168
234
  return;
169
- setUpdatedSeverity(payload);
170
- setNewSeverityValue(payload['severity']);
171
- setCaseDetails(caseDispatch, payload);
172
- });
235
+ setUpdatedSeverity({ severity: option.value.name });
236
+ setCurrentSeverity(option.value.name);
237
+ updateState(option.value.name);
238
+ setIsSeverityInValidLocal(option);
239
+ };
240
+ // To set severity options
241
+ useEffect(() => {
242
+ var _a, _b, _c;
243
+ if (!caseDetails.product ||
244
+ !caseDetails.version ||
245
+ allProducts.data.productsResult.length === 0 ||
246
+ ((_a = allCaseSeverities.data) === null || _a === void 0 ? void 0 : _a.length) === 0 ||
247
+ versionsDetails.isFetching)
248
+ return;
249
+ const productObj = find((_b = allProducts === null || allProducts === void 0 ? void 0 : allProducts.data) === null || _b === void 0 ? void 0 : _b.productsResult, (productItem) => productItem.name === caseDetails.product);
250
+ const versionDetail = find(versionsDetails === null || versionsDetails === void 0 ? void 0 : versionsDetails.data, (spec) => spec.name === caseDetails.version);
251
+ setDoNotShowIRT(versionDetail === null || versionDetail === void 0 ? void 0 : versionDetail.doNotShowIRT);
252
+ let availableSeverities;
253
+ if (versionDetail === null || versionDetail === void 0 ? void 0 : versionDetail.severities) {
254
+ //first check if at version level, do we have any severity limit
255
+ availableSeverities = versionDetail.severities;
256
+ }
257
+ else if (productObj === null || productObj === void 0 ? void 0 : productObj.severities) {
258
+ // second check if at product level, do we have any severity limit
259
+ availableSeverities = productObj.severities;
260
+ }
261
+ else {
262
+ // we have no limit, we show all severity options
263
+ availableSeverities = (_c = allCaseSeverities.data) !== null && _c !== void 0 ? _c : [];
264
+ }
265
+ setSeveritiesOptions(availableSeverities.sort((sevA, sevB) => severitySort(sevA, sevB)));
266
+ const shouldUpdateSeverityOnCaseCreate = !caseDetails.caseNumber &&
267
+ (!caseDetails.caseSeverity || !includes(availableSeverities, caseDetails.caseSeverity));
268
+ if (shouldUpdateSeverityOnCaseCreate) {
269
+ updateState(availableSeverities[0]);
270
+ }
271
+ // eslint-disable-next-line react-hooks/exhaustive-deps
272
+ }, [
273
+ caseDetails.product,
274
+ caseDetails.version,
275
+ allProducts,
276
+ allCaseSeverities,
277
+ versionsDetails,
278
+ seviritiesOptions,
279
+ caseDetails.caseSeverity,
280
+ ]);
173
281
  // Returns the modal body with its contents
174
282
  const modalBody = () => {
175
283
  return (React.createElement(React.Fragment, null,
176
284
  React.createElement("form", { "aria-label": t('form') },
177
285
  React.createElement("div", { className: "form-group pf-u-mt-xs" },
178
286
  React.createElement("div", null,
179
- React.createElement(Severity, { onCaseDetailsPage: false, onSeverityChange: onSeverityChange, isDisabled: !canManageCase && isCaseUpdating, isFetching: (caseOverviewState.caseSeverityUpdating && isCaseUpdating) || isPostingComment })),
287
+ React.createElement(Dropdown, { name: "open-case-severity", placeholder: t(`Select a severity`), title: t(`Select a severity`), list: allCaseSeverities.data
288
+ ? toOptions(filteredSeverities, {
289
+ labelKey: 'label',
290
+ additionalInfoKey: 'additionalInfo',
291
+ disabledKey: 'disabled',
292
+ })
293
+ : [], selectedItem: toOption(selectedSeverity, {
294
+ labelKey: 'label',
295
+ additionalInfoKey: 'additionalInfo',
296
+ disabledKey: 'disabled',
297
+ }), disabled: allCaseSeverities.isError ||
298
+ isDisabled ||
299
+ allCaseSeverities.isFetching ||
300
+ ownersEntitlements.isFetching ||
301
+ versionsDetails.isFetching, isLoadingList: isFetching || versionsDetails.isFetching, isInValid: allCaseSeverities.isError || isSeverityInValid, required: true, onChange: onSeverityChange, onOuterClick: setIsSeverityInValidLocal, "data-tracking-id": "open-case-severity" })),
180
302
  React.createElement("div", null,
181
303
  React.createElement("label", { htmlFor: "date-input", className: "pf-u-mt-md" },
182
304
  React.createElement(Trans, null, "Describe update"),
@@ -931,3 +931,17 @@ div.pf-c-alert.ea-rule-alert > div.pf-c-alert__description > p {
931
931
  .anchor-tag-link-td-none {
932
932
  text-decoration: none;
933
933
  }
934
+
935
+ // Text color for external tracker text on comments
936
+ .prevent-split.support-comment {
937
+ footer {
938
+ .comment-note {
939
+ span.external-tracker-label {
940
+ color: #151515 !important;
941
+ }
942
+ }
943
+ .comment-note.external-tracker-label {
944
+ color: #151515 !important;
945
+ }
946
+ }
947
+ }
@@ -6,6 +6,5 @@ export interface IClusterSubscriptionExtended extends IClusterSubscription {
6
6
  export declare const getDisplayNameForCluster: (cluster: Partial<IClusterSubscriptionExtended>) => string;
7
7
  export declare const invalidGuidHelperText = "Please enter a valid Cluster ID (For example: d3aa88e2-c754-41e0-8ba6-4198a34aa0a2)";
8
8
  export declare const isClusterIdEnabledForProduct: (selectedProduct: string, allProducts: Partial<ISEProduct>[]) => boolean;
9
- export declare const isOpenShiftV3Product: (product: string, pcmConfig: any) => boolean;
10
9
  export declare const getIsClusterIdInvalid: (openshiftClusterID: any) => boolean;
11
10
  //# sourceMappingURL=caseOpenshiftClusterIdUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"caseOpenshiftClusterIdUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/caseOpenshiftClusterIdUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AAIpE,MAAM,WAAW,4BAA6B,SAAQ,oBAAoB;IACtE,iBAAiB,EAAE,MAAM,CAAC;CAC7B;AAED,eAAO,MAAM,wBAAwB,YAAa,QAAQ,4BAA4B,CAAC,WAKtF,CAAC;AAEF,eAAO,MAAM,qBAAqB,wFACuD,CAAC;AAE1F,eAAO,MAAM,4BAA4B,oBAAqB,MAAM,eAAe,QAAQ,UAAU,CAAC,EAAE,YAIvG,CAAC;AAEF,eAAO,MAAM,oBAAoB,YAAa,MAAM,4BAenD,CAAC;AAEF,eAAO,MAAM,qBAAqB,sCACkC,CAAC"}
1
+ {"version":3,"file":"caseOpenshiftClusterIdUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/caseOpenshiftClusterIdUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AAIpE,MAAM,WAAW,4BAA6B,SAAQ,oBAAoB;IACtE,iBAAiB,EAAE,MAAM,CAAC;CAC7B;AAED,eAAO,MAAM,wBAAwB,YAAa,QAAQ,4BAA4B,CAAC,WAKtF,CAAC;AAEF,eAAO,MAAM,qBAAqB,wFACuD,CAAC;AAE1F,eAAO,MAAM,4BAA4B,oBAAqB,MAAM,eAAe,QAAQ,UAAU,CAAC,EAAE,YAIvG,CAAC;AAEF,eAAO,MAAM,qBAAqB,sCACkC,CAAC"}
@@ -1,4 +1,4 @@
1
- import { getConfigField, isValidGuid } from '@rh-support/utils';
1
+ import { isValidGuid } from '@rh-support/utils';
2
2
  import isEmpty from 'lodash/isEmpty';
3
3
  export const getDisplayNameForCluster = (cluster) => {
4
4
  if (isEmpty(cluster))
@@ -15,18 +15,4 @@ export const isClusterIdEnabledForProduct = (selectedProduct, allProducts) => {
15
15
  return false;
16
16
  return productDetails.openShiftClusterIdRelevantInCases;
17
17
  };
18
- export const isOpenShiftV3Product = (product, pcmConfig) => {
19
- var _a;
20
- if (isEmpty(product)) {
21
- return false;
22
- }
23
- let _isOpenShiftV3Product = false;
24
- const openShiftV3InfoTextProducts = getConfigField(pcmConfig.data, 'openShiftV3InfoTextProducts');
25
- if (openShiftV3InfoTextProducts) {
26
- ((_a = JSON.parse(openShiftV3InfoTextProducts[0])) === null || _a === void 0 ? void 0 : _a.products.findIndex((osProduct) => osProduct.toLowerCase() === product.toLowerCase())) > -1
27
- ? (_isOpenShiftV3Product = true)
28
- : (_isOpenShiftV3Product = false);
29
- }
30
- return _isOpenShiftV3Product;
31
- };
32
18
  export const getIsClusterIdInvalid = (openshiftClusterID) => !isEmpty(openshiftClusterID) && !isValidGuid(openshiftClusterID);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/troubleshoot",
3
- "version": "0.4.0",
3
+ "version": "1.0.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -26,7 +26,7 @@
26
26
  "lib/**/*"
27
27
  ],
28
28
  "peerDependencies": {
29
- "@cee-eng/hydrajs": "4.12.7",
29
+ "@cee-eng/hydrajs": "4.13.0",
30
30
  "@cee-eng/ui-toolkit": "1.1.6",
31
31
  "@patternfly/patternfly": "4.196.7",
32
32
  "@patternfly/pfe-accordion": "1.12.3",
@@ -63,7 +63,7 @@
63
63
  "react-virtualized": "^9.21.2"
64
64
  },
65
65
  "dependencies": {
66
- "@cee-eng/hydrajs": "4.12.7",
66
+ "@cee-eng/hydrajs": "4.13.0",
67
67
  "@cee-eng/ui-toolkit": "1.1.6",
68
68
  "@patternfly/patternfly": "4.196.7",
69
69
  "@patternfly/pfe-accordion": "1.12.3",
@@ -73,11 +73,11 @@
73
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
- "@rh-support/components": "1.1.83",
77
- "@rh-support/react-context": "0.3.4",
76
+ "@rh-support/components": "1.2.0",
77
+ "@rh-support/react-context": "1.0.0",
78
78
  "@rh-support/types": "0.2.0",
79
- "@rh-support/user-permissions": "0.2.67",
80
- "@rh-support/utils": "0.2.49",
79
+ "@rh-support/user-permissions": "1.0.0",
80
+ "@rh-support/utils": "1.0.0",
81
81
  "@types/react-redux": "^7.1.12",
82
82
  "@types/redux": "^3.6.0",
83
83
  "@webcomponents/webcomponentsjs": "^2.2.10",
@@ -142,5 +142,5 @@
142
142
  "not ie <= 11",
143
143
  "not op_mini all"
144
144
  ],
145
- "gitHead": "a8d923cd016218bdddc33eb00705340cb6f63d57"
145
+ "gitHead": "8c4eecd9b17607a5b010dc65d079327167650bee"
146
146
  }