@rh-support/troubleshoot 1.0.35 → 1.0.36

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":"CaseGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/CaseGroup.tsx"],"names":[],"mappings":"AAkBA,UAAU,MAAM;IACZ,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB;AAID,iBAAS,SAAS,CAAC,KAAK,EAAE,MAAM,eAmO/B;AAED,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"CaseGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/CaseGroup.tsx"],"names":[],"mappings":"AAkBA,UAAU,MAAM;IACZ,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB;AAID,iBAAS,SAAS,CAAC,KAAK,EAAE,MAAM,eAgM/B;AAED,eAAe,SAAS,CAAC"}
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { Dropdown, ToastNotification, ValueChangedIcon } from '@rh-support/components';
11
- import { GlobalMetadataStateContext, useCanEditCase, useUserPreferences } from '@rh-support/react-context';
11
+ import { GlobalMetadataStateContext, useCanEditCase } from '@rh-support/react-context';
12
12
  import { toOption, toOptions } from '@rh-support/utils';
13
13
  import find from 'lodash/find';
14
14
  import isEmpty from 'lodash/isEmpty';
@@ -39,34 +39,6 @@ function CaseGroup(props) {
39
39
  const [isCaseGroupUpdating, setCaseGroupUpdating] = useState(false);
40
40
  const canEditCase = useCanEditCase();
41
41
  const { globalMetadataState: { loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
42
- const { getDefaultGroup } = useUserPreferences();
43
- // when user opens a case, sets group to the default group saved in preferences
44
- useEffect(() => {
45
- const userPreferredFilter = () => __awaiter(this, void 0, void 0, function* () {
46
- const fetchedDefaultGroupKey = yield getDefaultGroup();
47
- const groupObj = ownersCaseGroups.data
48
- ? ownersCaseGroups.data.map((group) => ({ value: group.name, key: group.groupNum }))
49
- : [];
50
- if (!isEmpty(groupObj)) {
51
- const preferredGroupObj = groupObj.find((group) => group.key === fetchedDefaultGroupKey);
52
- if (preferredGroupObj === null || preferredGroupObj === void 0 ? void 0 : preferredGroupObj.value) {
53
- const parsedFetchedDefaultGroup = {
54
- groupNum: preferredGroupObj.key,
55
- name: preferredGroupObj.value,
56
- isPrivate: false,
57
- isDefault: false,
58
- defaultMembers: [],
59
- members: [],
60
- };
61
- groupNumber === '-1' &&
62
- props.init &&
63
- onCaseGroupChange(toOption(parsedFetchedDefaultGroup, { labelKey: 'name' }));
64
- }
65
- }
66
- });
67
- isEmpty(caseNumber) && userPreferredFilter();
68
- // eslint-disable-next-line react-hooks/exhaustive-deps
69
- }, [ownersCaseGroups.data, caseNumber]);
70
42
  // value changed logic to show a non local group change
71
43
  const [localGroupChange, setLocalGroupChange] = useState(false);
72
44
  const afterGroupLocalChange = () => setLocalGroupChange(false);
@@ -1 +1 @@
1
- {"version":3,"file":"GlobalTroubleshootEffects.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/GlobalTroubleshootEffects.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAWvD,OAAO,EAAqB,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAQrF,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;CACpD;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,eAyYtD"}
1
+ {"version":3,"file":"GlobalTroubleshootEffects.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/GlobalTroubleshootEffects.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAWvD,OAAO,EAAqB,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAQrF,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;CACpD;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,eAoatD"}
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { useDebounce, usePrevious } from '@rh-support/components';
11
- import { GlobalMetadataStateContext } from '@rh-support/react-context';
11
+ import { GlobalMetadataStateContext, useUserPreferences } from '@rh-support/react-context';
12
12
  import { ability, CaseListFields, resourceActions, resources } from '@rh-support/user-permissions';
13
13
  import { getUrlParsedParams, getVersion, getVersionIfOnlyVersion, isOnlyVersion } from '@rh-support/utils';
14
14
  import findIndex from 'lodash/findIndex';
@@ -37,7 +37,7 @@ export function GlobalTroubleshootEffects(props) {
37
37
  const { routeState: { activeSection, appRouteSectionsSequence, appRouteConfugurations, sectionsToHide }, } = useContext(RouteContext);
38
38
  const { globalMetadataState: { allProducts, loggedInUser, managedAccounts, loggedInUserRights, loggedInUsersAccount }, } = useContext(GlobalMetadataStateContext);
39
39
  const { sessionRestore: { activeSessionId }, } = useContext(SessionRestoreStateContext);
40
- const { accountNumber, product, version, contactSsoUsername, summary, issue, environment, periodicityOfIssue, timeFramesAndUrgency, caseType, language, selectedAccountDetails, } = useCaseSelector((state) => ({
40
+ const { accountNumber, product, version, contactSsoUsername, summary, issue, environment, periodicityOfIssue, timeFramesAndUrgency, caseType, language, selectedAccountDetails, ownersCaseGroups, } = useCaseSelector((state) => ({
41
41
  accountNumber: state.caseDetails.accountNumberRef,
42
42
  product: state.caseDetails.product,
43
43
  version: state.caseDetails.version,
@@ -50,7 +50,9 @@ export function GlobalTroubleshootEffects(props) {
50
50
  caseType: state.caseDetails.caseType,
51
51
  language: state.caseDetails.caseLanguage,
52
52
  selectedAccountDetails: state.selectedAccountDetails,
53
+ ownersCaseGroups: state.ownersCaseGroups,
53
54
  }), isEqual);
55
+ const { getDefaultGroup } = useUserPreferences();
54
56
  const versionsDetails = useCaseSelector((state) => {
55
57
  if (isEmpty(state.versionsDetails.data))
56
58
  return [];
@@ -322,5 +324,25 @@ export function GlobalTroubleshootEffects(props) {
322
324
  }
323
325
  // eslint-disable-next-line react-hooks/exhaustive-deps
324
326
  }, [product, version, allProducts.data.productsResult, caseDispatch]);
327
+ // when user opens a case, sets group to the default group saved in preferences
328
+ useEffect(() => {
329
+ const userPreferredFilter = () => __awaiter(this, void 0, void 0, function* () {
330
+ const fetchedDefaultGroupKey = yield getDefaultGroup();
331
+ const groupObj = ownersCaseGroups.data
332
+ ? ownersCaseGroups.data.map((group) => ({ value: group.name, key: group.groupNum }))
333
+ : [];
334
+ if (!isEmpty(groupObj)) {
335
+ const preferredGroupObj = groupObj.find((group) => group.key === fetchedDefaultGroupKey);
336
+ if (preferredGroupObj === null || preferredGroupObj === void 0 ? void 0 : preferredGroupObj.value) {
337
+ setCaseDetails(caseDispatch, {
338
+ groupNumber: fetchedDefaultGroupKey,
339
+ groupName: preferredGroupObj.value,
340
+ });
341
+ }
342
+ }
343
+ });
344
+ userPreferredFilter();
345
+ // eslint-disable-next-line react-hooks/exhaustive-deps
346
+ }, [ownersCaseGroups.data]);
325
347
  return React.createElement(React.Fragment, null);
326
348
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/troubleshoot",
3
- "version": "1.0.35",
3
+ "version": "1.0.36",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -142,5 +142,5 @@
142
142
  "not ie <= 11",
143
143
  "not op_mini all"
144
144
  ],
145
- "gitHead": "ba8c19db472fb4f0af4bc6128cb8b1a49033e2ce"
145
+ "gitHead": "d4fbbe579089bd4548af29de257b62106e1ec9c6"
146
146
  }