@rh-support/troubleshoot 0.2.132 → 0.2.135

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":"CaseInformation.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDetails/CaseInformation.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAW5D,UAAU,MAAO,SAAQ,gBAAgB;CAAG;AAE5C,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,eA8C5C"}
1
+ {"version":3,"file":"CaseInformation.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDetails/CaseInformation.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAa5D,UAAU,MAAO,SAAQ,gBAAgB;CAAG;AAE5C,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,eAsD5C"}
@@ -2,16 +2,22 @@ import { encodeAngularBrackets, linkifyBZIDs, linkifyWithCaseIDs } from '@cee-en
2
2
  import { MoreOrLess } from '@rh-support/components';
3
3
  import { useGlobalStateContext } from '@rh-support/react-context';
4
4
  import { ability, CaseDetailsFields, resourceActions, resources } from '@rh-support/user-permissions';
5
+ import { isEqual } from 'lodash';
5
6
  import React from 'react';
6
7
  import { Trans } from 'react-i18next';
7
8
  import { useCaseSelector } from '../../../../context/CaseContext';
9
+ import { isClusterIdEnabledForProduct } from '../../../../utils/caseOpenshiftClusterIdUtils';
8
10
  import EditDescription from '../../../EditDescription/EditDescription';
9
11
  import { CaseHostname } from './CaseHostname';
10
12
  import { CaseOpenshiftClusterId } from './CaseOpenshiftClusterId/CaseOpenshiftClusterId';
11
13
  import ProductVersion from './ProductVersion';
12
14
  export function CaseInformation(props) {
13
- const description = useCaseSelector((state) => state.caseDetails.description);
14
- const { globalMetadataState: { navBarRef }, } = useGlobalStateContext();
15
+ var _a;
16
+ const { product, description } = useCaseSelector((state) => ({
17
+ product: state.caseDetails.product,
18
+ description: state.caseDetails.description,
19
+ }), isEqual);
20
+ const { globalMetadataState: { navBarRef, allProducts }, } = useGlobalStateContext();
15
21
  const linkifiedDescription = (text) => {
16
22
  text = encodeAngularBrackets(text);
17
23
  text = linkifyWithCaseIDs(text);
@@ -19,10 +25,11 @@ export function CaseInformation(props) {
19
25
  return { __html: text };
20
26
  };
21
27
  const canEditDescription = ability.can(resourceActions.PATCH, resources.CASE_DETAILS, CaseDetailsFields.CASE_DETAILS_DESCRIPTION);
28
+ const hasCluster = isClusterIdEnabledForProduct(product, (_a = allProducts.data) === null || _a === void 0 ? void 0 : _a.productsResult);
22
29
  return (React.createElement("section", { className: "card card-sm card-white" },
23
30
  React.createElement("form", null,
24
31
  React.createElement(ProductVersion, null),
25
- React.createElement(CaseOpenshiftClusterId, null),
32
+ hasCluster && React.createElement(CaseOpenshiftClusterId, null),
26
33
  React.createElement(CaseHostname, { inlineEditable: true }),
27
34
  React.createElement("div", { className: "form-group" }, !canEditDescription ? (React.createElement(React.Fragment, null,
28
35
  React.createElement("label", { htmlFor: "case-description" },
@@ -34,7 +34,7 @@ export function CaseOpenshiftClusterId() {
34
34
  description: state.caseDetails.description,
35
35
  }), isEqual);
36
36
  const caseDispatch = useCaseDispatch();
37
- const { globalMetadataState: { pcmConfig, allProducts, loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
37
+ const { globalMetadataState: { allProducts, loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
38
38
  const majorVersion = (version && getVersion(version).major) || '';
39
39
  const isOpenShiftV3 = majorVersion === '3';
40
40
  const isCustomer = loggedInUserRights.data.isAccountSameAsLoggedInAccount(selectedAccountDetails.data.accountNumber);
@@ -85,7 +85,7 @@ export function CaseOpenshiftClusterId() {
85
85
  isClusterVisible();
86
86
  }
87
87
  // eslint-disable-next-line react-hooks/exhaustive-deps
88
- }, [product, version, pcmConfig, allProducts.data]);
88
+ }, [product, version]);
89
89
  // user may change product and version we need to reset internal state
90
90
  // context api state will be reset on parent component each time user changes product and version
91
91
  useEffect(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"CaseGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/CaseGroup.tsx"],"names":[],"mappings":"AAiBA,UAAU,MAAM;CAAG;AAInB,iBAAS,SAAS,CAAC,KAAK,EAAE,MAAM,eAsN/B;AAED,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"CaseGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/CaseGroup.tsx"],"names":[],"mappings":"AAiBA,UAAU,MAAM;CAAG;AAInB,iBAAS,SAAS,CAAC,KAAK,EAAE,MAAM,eA0N/B;AAED,eAAe,SAAS,CAAC"}
@@ -38,30 +38,31 @@ function CaseGroup(props) {
38
38
  const canEditCase = useCanEditCase();
39
39
  const { globalMetadataState: { loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
40
40
  const { getDefaultGroup } = useUserPreferences();
41
- const userPreferredFilter = () => __awaiter(this, void 0, void 0, function* () {
42
- const fetchedDefaultGroupKey = yield getDefaultGroup();
43
- const groupObj = ownersCaseGroups.data
44
- ? ownersCaseGroups.data.map((group) => ({ value: group.name, key: group.groupNum }))
45
- : [];
46
- if (!isEmpty(groupObj)) {
47
- const preferredGroupObj = groupObj.find((group) => group.key === fetchedDefaultGroupKey);
48
- if (preferredGroupObj === null || preferredGroupObj === void 0 ? void 0 : preferredGroupObj.value) {
49
- const parsedFetchedDefaultGroup = {
50
- groupNum: preferredGroupObj.key,
51
- name: preferredGroupObj.value,
52
- isPrivate: false,
53
- isDefault: false,
54
- defaultMembers: [],
55
- members: [],
56
- };
57
- onCaseGroupChange(toOption(parsedFetchedDefaultGroup, { labelKey: 'name' }));
58
- }
59
- }
60
- });
41
+ // when user opens a case, sets group to the default group saved in preferences
61
42
  useEffect(() => {
62
- userPreferredFilter();
43
+ const userPreferredFilter = () => __awaiter(this, void 0, void 0, function* () {
44
+ const fetchedDefaultGroupKey = yield getDefaultGroup();
45
+ const groupObj = ownersCaseGroups.data
46
+ ? ownersCaseGroups.data.map((group) => ({ value: group.name, key: group.groupNum }))
47
+ : [];
48
+ if (!isEmpty(groupObj)) {
49
+ const preferredGroupObj = groupObj.find((group) => group.key === fetchedDefaultGroupKey);
50
+ if (preferredGroupObj === null || preferredGroupObj === void 0 ? void 0 : preferredGroupObj.value) {
51
+ const parsedFetchedDefaultGroup = {
52
+ groupNum: preferredGroupObj.key,
53
+ name: preferredGroupObj.value,
54
+ isPrivate: false,
55
+ isDefault: false,
56
+ defaultMembers: [],
57
+ members: [],
58
+ };
59
+ onCaseGroupChange(toOption(parsedFetchedDefaultGroup, { labelKey: 'name' }));
60
+ }
61
+ }
62
+ });
63
+ isEmpty(caseNumber) && userPreferredFilter();
63
64
  // eslint-disable-next-line react-hooks/exhaustive-deps
64
- }, [ownersCaseGroups.data]);
65
+ }, [ownersCaseGroups.data, caseNumber]);
65
66
  // value changed logic to show a non local group change
66
67
  const [localGroupChange, setLocalGroupChange] = useState(false);
67
68
  const afterGroupLocalChange = () => setLocalGroupChange(false);
@@ -124,7 +124,7 @@ export default function UpdateSeverityModal(props) {
124
124
  }
125
125
  }
126
126
  catch (e) {
127
- yield updateCaseDetails(caseDispatch, caseDetails.caseNumber, {
127
+ setCaseDetails(caseDispatch, {
128
128
  severity: currentSeverity,
129
129
  });
130
130
  onSuccessfulSubmit();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/troubleshoot",
3
- "version": "0.2.132",
3
+ "version": "0.2.135",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -143,5 +143,5 @@
143
143
  "not ie <= 11",
144
144
  "not op_mini all"
145
145
  ],
146
- "gitHead": "33e34e81bbe7407a38cbbca6fa03125bad491706"
146
+ "gitHead": "041d064511ec35854672181af3596ba968f3211a"
147
147
  }