@rh-support/troubleshoot 0.3.3 → 0.3.4

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":"CaseHostname.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDetails/CaseHostname.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAY5D,UAAU,MAAO,SAAQ,gBAAgB;IACrC,cAAc,EAAE,OAAO,CAAC;CAC3B;AAMD,iBAAS,YAAY,CAAC,KAAK,EAAE,MAAM,eAgKlC;kBAhKQ,YAAY;;;AAmKrB,OAAO,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"CaseHostname.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDetails/CaseHostname.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAY5D,UAAU,MAAO,SAAQ,gBAAgB;IACrC,cAAc,EAAE,OAAO,CAAC;CAC3B;AAMD,iBAAS,YAAY,CAAC,KAAK,EAAE,MAAM,eAuKlC;kBAvKQ,YAAY;;;AA0KrB,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -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 { Popover, PopoverPosition, Switch } from '@patternfly/react-core';
11
+ import { Popover, PopoverPosition, Spinner, Switch } from '@patternfly/react-core';
12
12
  import { InlineEdit, LoadingIndicator, ToastNotification, useFetch, ValueChangedIcon } from '@rh-support/components';
13
13
  import { GlobalMetadataStateContext, useCanEditCase } from '@rh-support/react-context';
14
14
  import { ability, CaseListFields, resourceActions, resources } from '@rh-support/user-permissions';
@@ -35,11 +35,13 @@ function CaseHostname(props) {
35
35
  const [isHostnameUpdating, setIsHostnameUpdating] = useState(false);
36
36
  const canUseHostName = ability.can(resourceActions.PATCH, resources.CASE_CREATE, CaseListFields.HOSTNAME);
37
37
  const [isShareHostNamesChecked, setIsShareHostNamesChecked] = useState(false);
38
+ const [isHostnamesLoading, setIsHostnamesLoading] = useState(true);
38
39
  const { globalMetadataState: { loggedInUsersAccount }, } = useContext(GlobalMetadataStateContext);
39
40
  const { request: fetchHostnameDefault } = useFetch(accounts.getIsSharingHostname);
40
41
  const userOriginalHostnameValue = () => __awaiter(this, void 0, void 0, function* () {
41
42
  const fetchedHostnameStatus = yield fetchHostnameDefault(accountNumber);
42
43
  setIsShareHostNamesChecked(fetchedHostnameStatus.shareHostnameWithRHT);
44
+ setIsHostnamesLoading(false);
43
45
  });
44
46
  // value changed logic to show a none local status change
45
47
  const [localHostnameChange, setLocalHostnameChange] = useState(false);
@@ -83,17 +85,20 @@ function CaseHostname(props) {
83
85
  const { request: updateShareHostnames } = useFetch(accounts.updateIsSharingHostname);
84
86
  const onShareHostnameCheck = () => __awaiter(this, void 0, void 0, function* () {
85
87
  try {
88
+ setIsHostnamesLoading(true);
86
89
  yield updateShareHostnames(!isShareHostNamesChecked, accountNumber);
87
90
  setIsShareHostNamesChecked(!isShareHostNamesChecked);
88
91
  }
89
92
  catch (error) {
90
93
  console.log(error);
91
94
  }
95
+ setIsHostnamesLoading(false);
92
96
  });
93
97
  const shareHostnameLabel = 'Share hostnames';
94
98
  const hostNameVisibilityContent = (React.createElement("div", null,
95
99
  React.createElement("p", null, "You can share this information at any time to improve your support experience."),
96
- React.createElement(Switch, { label: shareHostnameLabel, isChecked: isShareHostNamesChecked, onChange: onShareHostnameCheck })));
100
+ React.createElement(Switch, { label: shareHostnameLabel, isChecked: isShareHostNamesChecked, onChange: onShareHostnameCheck }),
101
+ isHostnamesLoading && (React.createElement(Spinner, { isSVG: true, size: "lg", className: "pf-u-ml-sm hostnameSpinner", "aria-label": "Hostname loading" }))));
97
102
  if (!canUseHostName) {
98
103
  return React.createElement(React.Fragment, null);
99
104
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/troubleshoot",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -73,7 +73,7 @@
73
73
  "@progress/kendo-drawing": "^1.6.0",
74
74
  "@progress/kendo-react-pdf": "^3.12.0",
75
75
  "@rh-support/components": "1.1.83",
76
- "@rh-support/react-context": "0.3.3",
76
+ "@rh-support/react-context": "0.3.4",
77
77
  "@rh-support/types": "0.2.0",
78
78
  "@rh-support/user-permissions": "0.2.67",
79
79
  "@rh-support/utils": "0.2.49",
@@ -141,5 +141,5 @@
141
141
  "not ie <= 11",
142
142
  "not op_mini all"
143
143
  ],
144
- "gitHead": "8ad6dda321ad690b179be7346240345a57f1749b"
144
+ "gitHead": "cd70b3e8d05162414bc78e541020c3de692d892b"
145
145
  }