@rh-support/manage 0.2.99 → 0.3.1

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,7 +1,7 @@
1
1
  interface IProps {
2
2
  className: string;
3
3
  id: string;
4
- label: string;
4
+ label: any;
5
5
  onSwitchChange: (checked: boolean) => Promise<any>;
6
6
  isChecked: boolean;
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PreferenceSwitch.d.ts","sourceRoot":"","sources":["../../../../../src/components/ManagePreferences/components/PreferenceSwitch.tsx"],"names":[],"mappings":"AAKA,UAAU,MAAM;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IACnD,SAAS,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,gBAAgB,CAAC,EAAE,cAAc,EAAE,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,MAAM,eA+B3F"}
1
+ {"version":3,"file":"PreferenceSwitch.d.ts","sourceRoot":"","sources":["../../../../../src/components/ManagePreferences/components/PreferenceSwitch.tsx"],"names":[],"mappings":"AAKA,UAAU,MAAM;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,GAAG,CAAC;IACX,cAAc,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IACnD,SAAS,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,gBAAgB,CAAC,EAAE,cAAc,EAAE,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,MAAM,eA+B3F"}
@@ -30,5 +30,5 @@ export function PreferenceSwitch({ onSwitchChange, className, id, label, isCheck
30
30
  }
31
31
  });
32
32
  return (React.createElement("div", null,
33
- React.createElement(Switch, { className: className, id: id, label: t(label), isChecked: isCheckedLocal, onChange: onChangeLocal, isDisabled: isSwitchLoading })));
33
+ React.createElement(Switch, { className: className, id: id, label: label, isChecked: isCheckedLocal, onChange: onChangeLocal, isDisabled: isSwitchLoading })));
34
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PreferencesCaseCreate.d.ts","sourceRoot":"","sources":["../../../../../src/components/ManagePreferences/sections/PreferencesCaseCreate.tsx"],"names":[],"mappings":"AAkBA,UAAU,MAAM;CAAG;AACnB,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,eAgIlD"}
1
+ {"version":3,"file":"PreferencesCaseCreate.d.ts","sourceRoot":"","sources":["../../../../../src/components/ManagePreferences/sections/PreferencesCaseCreate.tsx"],"names":[],"mappings":"AAkBA,UAAU,MAAM;CAAG;AACnB,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,eA0IlD"}
@@ -33,11 +33,23 @@ export function PreferencesCaseCreate(props) {
33
33
  };
34
34
  const onPreferredLanguageSelect = (event, selection, isPlaceholder) => __awaiter(this, void 0, void 0, function* () {
35
35
  const selectedLanguageCode = getKeyByValue(languageConst, selection);
36
- yield updatePreferredLanguage(selectedLanguageCode);
36
+ try {
37
+ yield updatePreferredLanguage(selectedLanguageCode);
38
+ setOriginalPreferredLanguage(selection);
39
+ }
40
+ catch (error) {
41
+ console.log(error);
42
+ }
37
43
  });
38
44
  const onDefaultGroupSelect = (event, selection, isPlaceholder) => __awaiter(this, void 0, void 0, function* () {
39
45
  const selectionKey = invert(groupDictionary)[selection];
40
- yield updateDefaultGroup(selectionKey);
46
+ try {
47
+ yield updateDefaultGroup(selectionKey);
48
+ setOriginalDefaultGroup(selection);
49
+ }
50
+ catch (error) {
51
+ console.log(error);
52
+ }
41
53
  });
42
54
  const createCaseGroupStruct = (caseGroups) => {
43
55
  const defaultGroupDictionary = {};
@@ -46,31 +58,21 @@ export function PreferencesCaseCreate(props) {
46
58
  }
47
59
  return defaultGroupDictionary;
48
60
  };
49
- //use effect to retrieve original pref values.
61
+ //Set user default group after group obj built
50
62
  useEffect(() => {
51
- const userOriginalPreferredLanguage = () => __awaiter(this, void 0, void 0, function* () {
52
- try {
53
- const retrievedLanguage = yield getPreferredLanguage();
54
- setOriginalPreferredLanguage(languageConst[retrievedLanguage]);
55
- }
56
- catch (_a) {
57
- ToastNotification.addWarningMessage(t('Failed to fetch original preference'));
58
- }
59
- });
60
63
  const userOriginalDefaultGroup = () => __awaiter(this, void 0, void 0, function* () {
61
64
  try {
62
65
  const retrievedGroupId = yield getDefaultGroup();
63
66
  setOriginalDefaultGroup(groupDictionary[retrievedGroupId]);
64
67
  }
65
- catch (_b) {
68
+ catch (_a) {
66
69
  ToastNotification.addWarningMessage(t('Failed to fetch original preference'));
67
70
  }
68
71
  });
69
- userOriginalPreferredLanguage();
70
72
  userOriginalDefaultGroup();
71
73
  // eslint-disable-next-line react-hooks/exhaustive-deps
72
- }, []);
73
- // used to build the groups object
74
+ }, [groupDictionary]);
75
+ // used to build the groups object and fetch pref language
74
76
  useEffect(() => {
75
77
  const refreshParsedGroups = () => __awaiter(this, void 0, void 0, function* () {
76
78
  var _a;
@@ -87,7 +89,17 @@ export function PreferencesCaseCreate(props) {
87
89
  setUserDefaultGroupList(parsedDefaultGroupNames);
88
90
  }
89
91
  });
92
+ const userOriginalPreferredLanguage = () => __awaiter(this, void 0, void 0, function* () {
93
+ try {
94
+ const retrievedLanguage = yield getPreferredLanguage();
95
+ setOriginalPreferredLanguage(languageConst[retrievedLanguage]);
96
+ }
97
+ catch (_b) {
98
+ ToastNotification.addWarningMessage(t('Failed to fetch original preference'));
99
+ }
100
+ });
90
101
  refreshParsedGroups();
102
+ userOriginalPreferredLanguage();
91
103
  // eslint-disable-next-line react-hooks/exhaustive-deps
92
104
  }, [caseGroups, dispatchToGlobalMetadataReducer, loggedInUserJwtToken]);
93
105
  return (React.createElement(Card, { className: "preference-card" },
@@ -1 +1 @@
1
- {"version":3,"file":"PreferencesCaseView.d.ts","sourceRoot":"","sources":["../../../../../src/components/ManagePreferences/sections/PreferencesCaseView.tsx"],"names":[],"mappings":"AAcA,UAAU,MAAM;CAAG;AAEnB,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,eAiKhD"}
1
+ {"version":3,"file":"PreferencesCaseView.d.ts","sourceRoot":"","sources":["../../../../../src/components/ManagePreferences/sections/PreferencesCaseView.tsx"],"names":[],"mappings":"AAeA,UAAU,MAAM;CAAG;AAEnB,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,eA2KhD"}
@@ -8,7 +8,8 @@ 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 } from '@patternfly/react-core';
11
+ import { Card, CardBody, CardHeader, SelectOption, Spinner, TextArea, Tooltip } from '@patternfly/react-core';
12
+ import InfoIcon from '@patternfly/react-icons/dist/js/icons/info-circle-icon';
12
13
  import { EditorMode, ToastNotification, useFetch } from '@rh-support/components';
13
14
  import { GlobalMetadataStateContext } from '@rh-support/react-context';
14
15
  import { ability, CaseListFields, resourceActions, resources } from '@rh-support/user-permissions';
@@ -112,6 +113,7 @@ export function PreferencesCaseView(props) {
112
113
  console.log(error);
113
114
  }
114
115
  });
116
+ 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.';
115
117
  return (React.createElement(Card, { className: "preference-card" },
116
118
  React.createElement(CardHeader, null,
117
119
  React.createElement("h3", null,
@@ -130,5 +132,9 @@ export function PreferencesCaseView(props) {
130
132
  canUseHostName && (React.createElement("div", { className: "form-group" },
131
133
  React.createElement("label", { htmlFor: "share-hostnames-switch" },
132
134
  React.createElement(Trans, null, "Case information")),
133
- React.createElement(PreferenceSwitch, { className: "switches", id: "share-hostnames-switch", label: "Share hostnames with Red Hat", isChecked: isSharingHostNames, onSwitchChange: onShareHostNamesSwitch })))))));
135
+ React.createElement("div", null,
136
+ React.createElement(PreferenceSwitch, { className: "switches hostnameSwitch", id: "share-hostnames-switch", label: 'Share hostnames', isChecked: isSharingHostNames, onSwitchChange: onShareHostNamesSwitch }),
137
+ React.createElement("div", { className: "prefhostnameTooltip" },
138
+ React.createElement(Tooltip, { content: prefHostnameCopy, position: "right" },
139
+ React.createElement(InfoIcon, { className: "pf-u-ml-sm" }))))))))));
134
140
  }
@@ -295,3 +295,11 @@
295
295
  .preference-page-switches {
296
296
  padding: 0.5rem;
297
297
  }
298
+
299
+ div label.hostnameSwitch {
300
+ position: absolute !important;
301
+ }
302
+
303
+ div.prefhostnameTooltip {
304
+ margin-left: 11.25rem !important;
305
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/manage",
3
- "version": "0.2.99",
3
+ "version": "0.3.1",
4
4
  "description": "Customer Support Manage App",
5
5
  "author": "Jordan Eudy <jeudy100@gmail.com>",
6
6
  "homepage": "",
@@ -98,7 +98,7 @@
98
98
  "@rh-support/api": "0.3.25",
99
99
  "@rh-support/components": "1.1.80",
100
100
  "@rh-support/configs": "0.2.5",
101
- "@rh-support/react-context": "0.2.86",
101
+ "@rh-support/react-context": "0.3.0",
102
102
  "@rh-support/types": "0.2.0",
103
103
  "@rh-support/user-permissions": "0.2.64",
104
104
  "@rh-support/utils": "0.2.47",
@@ -111,5 +111,5 @@
111
111
  "react-i18next": ">=10.11.0",
112
112
  "react-router-dom": ">=5.1.2"
113
113
  },
114
- "gitHead": "d0acd5aa52cbe047dd35da3e11118827ae427f26"
114
+ "gitHead": "dd4051ce0899b1ecd8b3475628d1f8ea84b734a0"
115
115
  }