@rh-support/manage 1.0.8 → 1.0.10
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/ManagePreferences/components/PreferenceSelect.d.ts +1 -1
- package/lib/esm/components/ManagePreferences/components/PreferenceSelect.d.ts.map +1 -1
- package/lib/esm/components/ManagePreferences/sections/PreferencesCaseCreate.d.ts.map +1 -1
- package/lib/esm/components/ManagePreferences/sections/PreferencesCaseCreate.js +27 -11
- package/lib/esm/components/ManagePreferences/sections/PreferencesCaseView.d.ts.map +1 -1
- package/lib/esm/components/ManagePreferences/sections/PreferencesCaseView.js +12 -6
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreferenceSelect.d.ts","sourceRoot":"","sources":["../../../../../src/components/ManagePreferences/components/PreferenceSelect.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,UAAU,MAAM;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"PreferenceSelect.d.ts","sourceRoot":"","sources":["../../../../../src/components/ManagePreferences/components/PreferenceSelect.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,UAAU,MAAM;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,GAAG,CAAC;IACX,UAAU,EAAE,GAAG,CAAC;IAChB,QAAQ,EAAE,CAAC,KAAK,KAAA,EAAE,SAAS,KAAA,EAAE,aAAa,KAAA,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5D,QAAQ,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC;CAClC;AACD,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,MAAM,eA6CrF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreferencesCaseCreate.d.ts","sourceRoot":"","sources":["../../../../../src/components/ManagePreferences/sections/PreferencesCaseCreate.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PreferencesCaseCreate.d.ts","sourceRoot":"","sources":["../../../../../src/components/ManagePreferences/sections/PreferencesCaseCreate.tsx"],"names":[],"mappings":"AAoBA,UAAU,MAAM;CAAG;AACnB,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,eA+JlD"}
|
|
@@ -8,19 +8,31 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { Card, CardBody, CardHeader, SelectOption } from '@patternfly/react-core';
|
|
11
|
-
import {
|
|
12
|
-
import { fetchCaseGroupsForSSO, GlobalMetadataDispatchContext, GlobalMetadataStateContext, } from '@rh-support/react-context';
|
|
13
|
-
import { haventLoadedMetadata } from '@rh-support/utils';
|
|
14
|
-
import
|
|
11
|
+
import { ToastNotification } from '@rh-support/components';
|
|
12
|
+
import { fetchCaseGroupsForSSO, fetchLanguageMetadata, GlobalMetadataDispatchContext, GlobalMetadataStateContext, } from '@rh-support/react-context';
|
|
13
|
+
import { haventLoadedMetadata, PreferredLanguages } from '@rh-support/utils';
|
|
14
|
+
import invert from 'lodash/invert';
|
|
15
15
|
import isEmpty from 'lodash/isEmpty';
|
|
16
|
+
import map from 'lodash/map';
|
|
16
17
|
import React, { useContext, useEffect, useState } from 'react';
|
|
17
18
|
import { Trans, useTranslation } from 'react-i18next';
|
|
18
19
|
import { useUserPreferences } from '../../../hooks/useUserPreferences';
|
|
19
20
|
import { PreferenceSelect } from '../components/PreferenceSelect';
|
|
20
21
|
export function PreferencesCaseCreate(props) {
|
|
21
22
|
const { t } = useTranslation();
|
|
22
|
-
const { globalMetadataState: { caseGroups, loggedInUserJwtToken }, } = useContext(GlobalMetadataStateContext);
|
|
23
|
+
const { globalMetadataState: { caseGroups, caseLanguages, loggedInUserJwtToken }, } = useContext(GlobalMetadataStateContext);
|
|
23
24
|
const dispatchToGlobalMetadataReducer = useContext(GlobalMetadataDispatchContext);
|
|
25
|
+
const languageConst = caseLanguages.data;
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (haventLoadedMetadata(caseLanguages)) {
|
|
28
|
+
fetchLanguageMetadata(dispatchToGlobalMetadataReducer);
|
|
29
|
+
}
|
|
30
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
31
|
+
}, [caseLanguages]);
|
|
32
|
+
const languagesList = map(languageConst, (cl) => ({
|
|
33
|
+
label: PreferredLanguages.languagesMap[cl] || cl,
|
|
34
|
+
value: cl,
|
|
35
|
+
}));
|
|
24
36
|
const [originalPreferredLanguage, setOriginalPreferredLanguage] = useState('');
|
|
25
37
|
const [originalDefaultGroup, setOriginalDefaultGroup] = useState('');
|
|
26
38
|
const [groupDictionary, setGroupDictionary] = useState({});
|
|
@@ -28,13 +40,16 @@ export function PreferencesCaseCreate(props) {
|
|
|
28
40
|
const { getPreferredLanguage, updatePreferredLanguage, updateDefaultGroup, getDefaultGroup } = useUserPreferences();
|
|
29
41
|
const preferredLangTitleId = 'preferred-language-select';
|
|
30
42
|
const defaultGroupTitleId = 'default-group-select';
|
|
31
|
-
const
|
|
32
|
-
return
|
|
43
|
+
const getLanguageKey = (selection) => {
|
|
44
|
+
return languagesList.find((language) => language.label === selection);
|
|
45
|
+
};
|
|
46
|
+
const getLanguageInitialLangValue = (label) => {
|
|
47
|
+
return languagesList.find((language) => language.value === label);
|
|
33
48
|
};
|
|
34
49
|
const onPreferredLanguageSelect = (event, selection, isPlaceholder) => __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
const selectedLanguageCode =
|
|
50
|
+
const selectedLanguageCode = getLanguageKey(selection);
|
|
36
51
|
try {
|
|
37
|
-
yield updatePreferredLanguage(selectedLanguageCode);
|
|
52
|
+
yield updatePreferredLanguage(selectedLanguageCode.value);
|
|
38
53
|
setOriginalPreferredLanguage(selection);
|
|
39
54
|
}
|
|
40
55
|
catch (error) {
|
|
@@ -92,7 +107,8 @@ export function PreferencesCaseCreate(props) {
|
|
|
92
107
|
const userOriginalPreferredLanguage = () => __awaiter(this, void 0, void 0, function* () {
|
|
93
108
|
try {
|
|
94
109
|
const retrievedLanguage = yield getPreferredLanguage();
|
|
95
|
-
|
|
110
|
+
const finalOriginalLanguage = getLanguageInitialLangValue(retrievedLanguage);
|
|
111
|
+
setOriginalPreferredLanguage(finalOriginalLanguage.label);
|
|
96
112
|
}
|
|
97
113
|
catch (_b) {
|
|
98
114
|
ToastNotification.addWarningMessage(t('Failed to fetch original preference'));
|
|
@@ -109,7 +125,7 @@ export function PreferencesCaseCreate(props) {
|
|
|
109
125
|
React.createElement(CardBody, null,
|
|
110
126
|
React.createElement("form", null,
|
|
111
127
|
React.createElement("div", { className: "form-group" },
|
|
112
|
-
React.createElement(PreferenceSelect, { label: t('i18nPreferredLanguage', 'Preferred case language'), id: preferredLangTitleId, onSelect: onPreferredLanguageSelect, selections: originalPreferredLanguage }, Object.keys(
|
|
128
|
+
React.createElement(PreferenceSelect, { label: t('i18nPreferredLanguage', 'Preferred case language'), id: preferredLangTitleId, onSelect: onPreferredLanguageSelect, selections: originalPreferredLanguage }, Object.keys(languagesList).map((option, index) => (React.createElement(SelectOption, { key: index, value: languagesList[index].label })))),
|
|
113
129
|
React.createElement("p", { className: "form-instructions" },
|
|
114
130
|
React.createElement(Trans, null, "Preferred language will impact future cases, not existing ones."))),
|
|
115
131
|
React.createElement("div", { className: "form-group" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreferencesCaseView.d.ts","sourceRoot":"","sources":["../../../../../src/components/ManagePreferences/sections/PreferencesCaseView.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PreferencesCaseView.d.ts","sourceRoot":"","sources":["../../../../../src/components/ManagePreferences/sections/PreferencesCaseView.tsx"],"names":[],"mappings":"AAyBA,UAAU,MAAM;CAAG;AAEnB,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,eA4QhD"}
|
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { accounts } from '@cee-eng/hydrajs';
|
|
11
|
-
import { Card, CardBody, CardHeader, SelectOption, Spinner, TextArea, Tooltip } from '@patternfly/react-core';
|
|
11
|
+
import { Card, CardBody, CardHeader, Popover, PopoverPosition, SelectOption, Spinner, TextArea, Tooltip, } from '@patternfly/react-core';
|
|
12
12
|
import InfoIcon from '@patternfly/react-icons/dist/js/icons/info-circle-icon';
|
|
13
13
|
import { EditorMode, ToastNotification, useFetch } from '@rh-support/components';
|
|
14
14
|
import { GlobalMetadataStateContext } from '@rh-support/react-context';
|
|
@@ -23,6 +23,7 @@ import { PreferenceSwitch } from '../components/PreferenceSwitch';
|
|
|
23
23
|
export function PreferencesCaseView(props) {
|
|
24
24
|
const { t } = useTranslation();
|
|
25
25
|
const { updateCommentType, getCommentTypeFromPreference, getCommentSignature, updateCommentSignature, getOriginalCaseView, updateOriginalCaseView, } = useUserPreferences();
|
|
26
|
+
const { globalMetadataState: { loggedInUsersAccount, loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
|
|
26
27
|
const [isSharingHostNames, setIsSharingHostNames] = useState(false);
|
|
27
28
|
const [localCommentSignature, setLocalCommentSignature] = useState('');
|
|
28
29
|
const [originalCommentType, setOriginalCommentType] = useState('');
|
|
@@ -34,7 +35,7 @@ export function PreferencesCaseView(props) {
|
|
|
34
35
|
const defaultCommentTitleID = 'default-comment-preference-select';
|
|
35
36
|
const defaultCaseViewID = 'default-case-view-select';
|
|
36
37
|
const canUseHostName = ability.can(resourceActions.PATCH, resources.CASE_CREATE, CaseListFields.HOSTNAME);
|
|
37
|
-
const
|
|
38
|
+
const isInternalUserPermission = ability.can(resourceActions.READ, resources.ACCOUNTS_FILTER);
|
|
38
39
|
const { request: fetchHostnameDefault } = useFetch(accounts.getIsSharingHostname);
|
|
39
40
|
const accountNumber = loggedInUsersAccount.data.accountNumber;
|
|
40
41
|
const { request: updateShareHostnames } = useFetch(accounts.updateIsSharingHostname);
|
|
@@ -51,7 +52,7 @@ export function PreferencesCaseView(props) {
|
|
|
51
52
|
try {
|
|
52
53
|
const retrievedCaseView = yield getOriginalCaseView();
|
|
53
54
|
if (!isEmpty(retrievedCaseView)) {
|
|
54
|
-
setOriginalCaseView(retrievedCaseView);
|
|
55
|
+
setOriginalCaseView(+retrievedCaseView);
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
catch (_a) {
|
|
@@ -156,15 +157,20 @@ export function PreferencesCaseView(props) {
|
|
|
156
157
|
setIsHostnamesLoading(false);
|
|
157
158
|
});
|
|
158
159
|
const prefHostnameCopy = 'Red Hat Support cannot currently access hostnames that have been entered on a case. You can share this information at any time to improve your support experience.';
|
|
160
|
+
const caseViewPrefSelection = caseViewTypes[originalCaseView].value || caseViewTypes[+originalAccountPermission].value;
|
|
161
|
+
const prefCasePopover = (React.createElement(React.Fragment, null,
|
|
162
|
+
React.createElement(Trans, null, "Default Case View"),
|
|
163
|
+
React.createElement(Popover, { "aria-label": "Preferred-default-case-view-popover", position: PopoverPosition.top, bodyContent: React.createElement("p", { className: 'pref-case-popover-text' },
|
|
164
|
+
React.createElement(Trans, null, "Choose the default view you want to see when looking at a case")), showClose: false },
|
|
165
|
+
React.createElement("i", { "aria-label": "Preferred-default-case-view-info-icon", className: "fa fa-question-circle" }))));
|
|
159
166
|
return (React.createElement(Card, { className: "preference-card" },
|
|
160
167
|
React.createElement(CardHeader, null,
|
|
161
168
|
React.createElement("h3", null,
|
|
162
169
|
React.createElement(Trans, null, "Case view"))),
|
|
163
170
|
React.createElement(CardBody, null,
|
|
164
171
|
React.createElement("form", null,
|
|
165
|
-
React.createElement("div", { className: "form-group" },
|
|
166
|
-
React.createElement(PreferenceSelect, { onSelect: onPrefCaseViewSelect, selections: (
|
|
167
|
-
caseViewTypes[+originalAccountPermission].value, id: defaultCaseViewID, label: "Default case view" }, caseViewTypes.map((option, index) => (React.createElement(SelectOption, Object.assign({ "data-index": index, key: index, value: option.value }, (option.description && { description: option.description }))))))),
|
|
172
|
+
isInternalUserPermission && (React.createElement("div", { className: "form-group" },
|
|
173
|
+
React.createElement(PreferenceSelect, { onSelect: onPrefCaseViewSelect, selections: caseViewPrefSelection, id: defaultCaseViewID, label: prefCasePopover }, caseViewTypes.map((option, index) => (React.createElement(SelectOption, Object.assign({ "data-index": index, key: index, value: option.value }, (option.description && { description: option.description })))))))),
|
|
168
174
|
React.createElement("div", { className: "form-group" },
|
|
169
175
|
React.createElement(PreferenceSelect, { onSelect: onCommentSelect, selections: originalCommentType, id: defaultCommentTitleID, label: "Default comment type" }, commentTypes.map((option, index) => (React.createElement(SelectOption, { key: index, value: option }))))),
|
|
170
176
|
React.createElement("div", { className: "form-group" },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/manage",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"description": "Customer Support Manage App",
|
|
5
5
|
"author": "Jordan Eudy <jeudy100@gmail.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -94,12 +94,12 @@
|
|
|
94
94
|
"@patternfly/pfe-tabs": "1.12.3",
|
|
95
95
|
"@patternfly/react-core": "4.202.16",
|
|
96
96
|
"@patternfly/react-table": "4.71.16",
|
|
97
|
-
"@rh-support/components": "1.2.
|
|
97
|
+
"@rh-support/components": "1.2.6",
|
|
98
98
|
"@rh-support/configs": "0.2.8",
|
|
99
|
-
"@rh-support/react-context": "1.0.
|
|
99
|
+
"@rh-support/react-context": "1.0.7",
|
|
100
100
|
"@rh-support/types": "0.2.0",
|
|
101
|
-
"@rh-support/user-permissions": "1.0.
|
|
102
|
-
"@rh-support/utils": "1.0.
|
|
101
|
+
"@rh-support/user-permissions": "1.0.6",
|
|
102
|
+
"@rh-support/utils": "1.0.4",
|
|
103
103
|
"@types/react-beautiful-dnd": "^13.0.0",
|
|
104
104
|
"i18next": ">=17.0.1",
|
|
105
105
|
"lodash": ">=4.17.15",
|
|
@@ -109,5 +109,5 @@
|
|
|
109
109
|
"react-i18next": ">=10.11.0",
|
|
110
110
|
"react-router-dom": ">=5.1.2"
|
|
111
111
|
},
|
|
112
|
-
"gitHead": "
|
|
112
|
+
"gitHead": "a6141b62e73e1d74ccf4f4075134da7091b8e96e"
|
|
113
113
|
}
|