@rh-support/troubleshoot 1.0.36 → 1.0.37
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.
- package/lib/esm/components/CaseInformation/CaseGroup.d.ts.map +1 -1
- package/lib/esm/components/CaseInformation/CaseGroup.js +44 -3
- package/lib/esm/components/wizardLayout/GlobalTroubleshootEffects.d.ts.map +1 -1
- package/lib/esm/components/wizardLayout/GlobalTroubleshootEffects.js +21 -29
- package/package.json +2 -2
|
@@ -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;
|
|
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;AAWD,iBAAS,SAAS,CAAC,KAAK,EAAE,MAAM,eA4O/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 } from '@rh-support/react-context';
|
|
11
|
+
import { GlobalMetadataStateContext, useCanEditCase, useUserPreferences } 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';
|
|
@@ -20,7 +20,14 @@ import { useCaseUpdateErrorMessage } from '../../hooks/useCaseUpdateErrorMessage
|
|
|
20
20
|
import { setCaseDetails, setSelectedCaseGroupUsers, updateCaseDetails } from '../../reducers/CaseReducer';
|
|
21
21
|
import { CaseValuesToWatch } from '../shared/Constants';
|
|
22
22
|
import { getChangedValueTooltip } from '../shared/utils';
|
|
23
|
-
const emptyCaseGroup = {
|
|
23
|
+
const emptyCaseGroup = {
|
|
24
|
+
groupNum: '',
|
|
25
|
+
name: '',
|
|
26
|
+
isPrivate: false,
|
|
27
|
+
isDefault: false,
|
|
28
|
+
defaultMembers: [],
|
|
29
|
+
members: [],
|
|
30
|
+
};
|
|
24
31
|
function CaseGroup(props) {
|
|
25
32
|
const { t } = useTranslation();
|
|
26
33
|
const caseUpdateError = useCaseUpdateErrorMessage();
|
|
@@ -39,6 +46,37 @@ function CaseGroup(props) {
|
|
|
39
46
|
const [isCaseGroupUpdating, setCaseGroupUpdating] = useState(false);
|
|
40
47
|
const canEditCase = useCanEditCase();
|
|
41
48
|
const { globalMetadataState: { loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
|
|
49
|
+
const { getDefaultGroup } = useUserPreferences();
|
|
50
|
+
// when user opens a case, sets group to the default group saved in preferences
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
const userPreferredFilter = () => __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
const fetchedDefaultGroupKey = yield getDefaultGroup();
|
|
54
|
+
const groupObj = ownersCaseGroups.data
|
|
55
|
+
? ownersCaseGroups.data.map((group) => ({
|
|
56
|
+
value: group.name,
|
|
57
|
+
key: group.groupNum,
|
|
58
|
+
}))
|
|
59
|
+
: [];
|
|
60
|
+
if (!isEmpty(groupObj)) {
|
|
61
|
+
const preferredGroupObj = groupObj.find((group) => group.key === fetchedDefaultGroupKey);
|
|
62
|
+
if (preferredGroupObj === null || preferredGroupObj === void 0 ? void 0 : preferredGroupObj.value) {
|
|
63
|
+
const parsedFetchedDefaultGroup = {
|
|
64
|
+
groupNum: preferredGroupObj.key,
|
|
65
|
+
name: preferredGroupObj.value,
|
|
66
|
+
isPrivate: false,
|
|
67
|
+
isDefault: false,
|
|
68
|
+
defaultMembers: [],
|
|
69
|
+
members: [],
|
|
70
|
+
};
|
|
71
|
+
groupNumber === '-1' &&
|
|
72
|
+
props.init &&
|
|
73
|
+
onCaseGroupChange(toOption(parsedFetchedDefaultGroup, { labelKey: 'name' }));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
isEmpty(caseNumber) && userPreferredFilter();
|
|
78
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
79
|
+
}, [ownersCaseGroups.data, caseNumber]);
|
|
42
80
|
// value changed logic to show a non local group change
|
|
43
81
|
const [localGroupChange, setLocalGroupChange] = useState(false);
|
|
44
82
|
const afterGroupLocalChange = () => setLocalGroupChange(false);
|
|
@@ -95,7 +133,10 @@ function CaseGroup(props) {
|
|
|
95
133
|
if (isGroupMandatory) {
|
|
96
134
|
// having group selected for case is mandatory, make 'UnGrouped Case' option disabled
|
|
97
135
|
const listItems = list.map((item) => (Object.assign(Object.assign({}, item), { disabled: item.groupNum === '-1' })));
|
|
98
|
-
return toOptions(listItems, {
|
|
136
|
+
return toOptions(listItems, {
|
|
137
|
+
labelKey: 'name',
|
|
138
|
+
disabledKey: 'disabled',
|
|
139
|
+
});
|
|
99
140
|
}
|
|
100
141
|
else {
|
|
101
142
|
return toOptions(list, { labelKey: 'name' });
|
|
@@ -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,
|
|
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,eAuZtD"}
|
|
@@ -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
|
|
11
|
+
import { GlobalMetadataStateContext } 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,
|
|
40
|
+
const { accountNumber, product, version, contactSsoUsername, summary, issue, environment, periodicityOfIssue, timeFramesAndUrgency, caseType, language, selectedAccountDetails, } = useCaseSelector((state) => ({
|
|
41
41
|
accountNumber: state.caseDetails.accountNumberRef,
|
|
42
42
|
product: state.caseDetails.product,
|
|
43
43
|
version: state.caseDetails.version,
|
|
@@ -50,9 +50,7 @@ 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,
|
|
54
53
|
}), isEqual);
|
|
55
|
-
const { getDefaultGroup } = useUserPreferences();
|
|
56
54
|
const versionsDetails = useCaseSelector((state) => {
|
|
57
55
|
if (isEmpty(state.versionsDetails.data))
|
|
58
56
|
return [];
|
|
@@ -82,14 +80,20 @@ export function GlobalTroubleshootEffects(props) {
|
|
|
82
80
|
const productFromUrl = parsedUrlParams.product || initialCaseState.caseDetails.product;
|
|
83
81
|
if (isEmpty(productFromUrl)) {
|
|
84
82
|
// Reset case state
|
|
85
|
-
setCaseDetails(caseDispatch, {
|
|
83
|
+
setCaseDetails(caseDispatch, {
|
|
84
|
+
product: productFromUrl,
|
|
85
|
+
version: undefined,
|
|
86
|
+
});
|
|
86
87
|
return;
|
|
87
88
|
}
|
|
88
89
|
const versionFromUrl = parsedUrlParams.version || initialCaseState.caseDetails.version;
|
|
89
90
|
const index = findIndex(allProducts.data.productsResult, (p) => p.product === productFromUrl);
|
|
90
91
|
if (index === -1) {
|
|
91
92
|
// invalid product, reset url
|
|
92
|
-
const newParams = {
|
|
93
|
+
const newParams = {
|
|
94
|
+
product: undefined,
|
|
95
|
+
version: undefined,
|
|
96
|
+
};
|
|
93
97
|
RouteUtils.updateQueryParams(props.routeProps, newParams);
|
|
94
98
|
}
|
|
95
99
|
else {
|
|
@@ -104,13 +108,19 @@ export function GlobalTroubleshootEffects(props) {
|
|
|
104
108
|
// version is also valid
|
|
105
109
|
const versionToSet = isVersionFromURLValid ? versionFromUrl : undefined;
|
|
106
110
|
if (product !== productFromUrl || version !== versionToSet) {
|
|
107
|
-
setCaseDetails(caseDispatch, {
|
|
111
|
+
setCaseDetails(caseDispatch, {
|
|
112
|
+
product: productFromUrl,
|
|
113
|
+
version: versionToSet,
|
|
114
|
+
});
|
|
108
115
|
}
|
|
109
116
|
}
|
|
110
117
|
else if (!isMultiVersionProduct) {
|
|
111
118
|
// no version or invalid version and there is only 1 version we set default version in url that will trigger the flow with valid version this time
|
|
112
119
|
const defaultVersion = getVersionIfOnlyVersion(productVersions);
|
|
113
|
-
const newParams = {
|
|
120
|
+
const newParams = {
|
|
121
|
+
product: productFromUrl,
|
|
122
|
+
version: defaultVersion,
|
|
123
|
+
};
|
|
114
124
|
RouteUtils.updateQueryParams(props.routeProps, newParams);
|
|
115
125
|
}
|
|
116
126
|
}
|
|
@@ -251,7 +261,9 @@ export function GlobalTroubleshootEffects(props) {
|
|
|
251
261
|
language,
|
|
252
262
|
accountNumber,
|
|
253
263
|
session_id: activeSessionId,
|
|
254
|
-
}, accountType: {
|
|
264
|
+
}, accountType: {
|
|
265
|
+
isSecure: selectedAccountDetails.data.securedEnvironment || false,
|
|
266
|
+
}, userType: { canAddAttachments }, fields: ['title', 'cta', 'description', 'rule_type', 'rule_sub_type', 'rule_id'] }, ((selectedLocalFiles === null || selectedLocalFiles === void 0 ? void 0 : selectedLocalFiles.length) && {
|
|
255
267
|
attachment: selectedLocalFiles.map((file) => ({
|
|
256
268
|
uuid: file.attachmentId,
|
|
257
269
|
fileName: file.name,
|
|
@@ -324,25 +336,5 @@ export function GlobalTroubleshootEffects(props) {
|
|
|
324
336
|
}
|
|
325
337
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
326
338
|
}, [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]);
|
|
347
339
|
return React.createElement(React.Fragment, null);
|
|
348
340
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/troubleshoot",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.37",
|
|
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": "
|
|
145
|
+
"gitHead": "4399821556d8466ddbfc02c44e3954047c9ae1e7"
|
|
146
146
|
}
|