@rh-support/troubleshoot 0.2.107-beta.1 → 0.2.111

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":"ManagedAccountsDropdown.d.ts","sourceRoot":"","sources":["../../../../src/components/AccountInfo/ManagedAccountsDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAGhF,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAM7G,UAAU,MAAO,SAAQ,gBAAgB;IACrC,qBAAqB,EAAE,MAAM,CAAC;IAC9B,eAAe,EAAE,mBAAmB,CAAC,OAAO,CAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC;IACxE,sBAAsB,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,iBAAiB,CAAC,sBAAsB,CAAC,CAAC,KAAK,IAAI,CAAC;IAChG,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAOD,iBAAS,uBAAuB,CAAC,KAAK,EAAE,MAAM,eAyD7C;kBAzDQ,uBAAuB;;;AA2DhC,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
1
+ {"version":3,"file":"ManagedAccountsDropdown.d.ts","sourceRoot":"","sources":["../../../../src/components/AccountInfo/ManagedAccountsDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAGhF,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAM7G,UAAU,MAAO,SAAQ,gBAAgB;IACrC,qBAAqB,EAAE,MAAM,CAAC;IAC9B,eAAe,EAAE,mBAAmB,CAAC,OAAO,CAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC;IACxE,sBAAsB,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,iBAAiB,CAAC,sBAAsB,CAAC,CAAC,KAAK,IAAI,CAAC;IAChG,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAOD,iBAAS,uBAAuB,CAAC,KAAK,EAAE,MAAM,eA4D7C;kBA5DQ,uBAAuB;;;AA8DhC,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
@@ -24,7 +24,10 @@ function ManagedAccountsDropdown(props) {
24
24
  };
25
25
  setSelectedItem(toOption(item, { labelKey: getLabelForAccountOption }));
26
26
  }, [props.managedAccounts.data, props.selectedAccountNumber]);
27
- const managedAccountsOptions = props.managedAccounts.data.map((account) => (Object.assign({ actionItem: (React.createElement(React.Fragment, null, account.subscriptionAbuse && (React.createElement("span", { className: "form-instructions form-invalid pf-u-text-nowrap pf-u-pr-sm" },
27
+ // Only accounts that have granted access permission to partner should be listed
28
+ const managedAccountsOptions = props.managedAccounts.data
29
+ .filter((account) => account.partnerCaseAccess === 'All')
30
+ .map((account) => (Object.assign({ actionItem: (React.createElement(React.Fragment, null, account.subscriptionAbuse && (React.createElement("span", { className: "form-instructions form-invalid pf-u-text-nowrap pf-u-pr-sm" },
28
31
  ' ',
29
32
  React.createElement(InfoCircleIcon, null),
30
33
  " ",
@@ -1 +1 @@
1
- {"version":3,"file":"ProductVersion.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDetails/ProductVersion.tsx"],"names":[],"mappings":"AAsBA,UAAU,MAAM;IACZ,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACvC;AAYD,iBAAS,eAAe,CAAC,KAAK,EAAE,MAAM,eAkOrC;AAED,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"ProductVersion.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDetails/ProductVersion.tsx"],"names":[],"mappings":"AAsBA,UAAU,MAAM;IACZ,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACvC;AAYD,iBAAS,eAAe,CAAC,KAAK,EAAE,MAAM,eA0PrC;AAED,eAAe,eAAe,CAAC"}
@@ -16,7 +16,7 @@ import findIndex from 'lodash/findIndex';
16
16
  import isEmpty from 'lodash/isEmpty';
17
17
  import isEqual from 'lodash/isEqual';
18
18
  import uniq from 'lodash/uniq';
19
- import React, { useContext, useEffect, useState } from 'react';
19
+ import React, { useContext, useEffect, useMemo, useState } from 'react';
20
20
  import { Trans, useTranslation } from 'react-i18next';
21
21
  import { useCaseDispatch, useCaseSelector } from '../../../../context/CaseContext';
22
22
  import { getVersionsDetails, updateCaseDetails } from '../../../../reducers/CaseReducer';
@@ -33,19 +33,29 @@ function ProductNVersion(props) {
33
33
  const [versions, setVersions] = useState([]);
34
34
  const [isProductUpdating, setIsProductUpdating] = useState(false);
35
35
  const [isVersionUpdating, setIsVersionUpdating] = useState(false);
36
- const { product, version, caseNumber, contactSSOName } = useCaseSelector((state) => ({
36
+ const { product, version, caseNumber, contactSSOName, versionsDetails } = useCaseSelector((state) => ({
37
37
  product: state.caseDetails.product,
38
38
  version: state.caseDetails.version,
39
39
  contactSSOName: state.caseDetails.contactSSOName,
40
40
  caseNumber: state.caseDetails.caseNumber,
41
+ versionsDetails: state.versionsDetails,
41
42
  }), isEqual);
43
+ const productVenisons = useMemo(() => versionsDetails.data.map(({ name }) => name),
44
+ // eslint-disable-next-line react-hooks/exhaustive-deps
45
+ [product, versionsDetails.data]);
42
46
  const caseDispatch = useCaseDispatch();
43
47
  const dispatchToGlobalMetadataReducer = useContext(GlobalMetadataDispatchContext);
44
48
  const { globalMetadataState: { allProducts }, } = useContext(GlobalMetadataStateContext);
49
+ const productSEVersions = useMemo(() => getVersions(allProducts.data.productsResult, product), [allProducts.data.productsResult, product]);
45
50
  const [isProductInValid, setIsProductInValid] = useState(false);
46
51
  const [selectedProductLocal, setSelectedProductLocal] = useState(product);
47
52
  const [selectedVersionLocal, setSelectedVersionLocal] = useState(version);
48
53
  const canEditCase = useCanEditCase();
54
+ useEffect(() => {
55
+ setVersions(productVenisons);
56
+ if ((productVenisons === null || productVenisons === void 0 ? void 0 : productVenisons.length) && !selectedVersionLocal)
57
+ setSelectedVersionLocal(productVenisons[0]);
58
+ }, [productVenisons, selectedVersionLocal]);
49
59
  /**
50
60
  * Sync local version from global state if they change from someplace else
51
61
  */
@@ -53,17 +63,20 @@ function ProductNVersion(props) {
53
63
  setSelectedVersionLocal(version);
54
64
  }, [version]);
55
65
  useEffect(() => {
66
+ var _a;
56
67
  if (haventLoadedMetadata(allProducts, (data) => isEmpty(data.productsResult))) {
57
68
  fetchProducts(dispatchToGlobalMetadataReducer, contactSSOName);
58
69
  }
59
- if (allProducts.data && allProducts.data.productsResult.length !== 0) {
60
- const versions = getVersions(allProducts.data.productsResult, product);
70
+ if (allProducts.data && ((_a = allProducts.data.productsResult) === null || _a === void 0 ? void 0 : _a.length) !== 0) {
71
+ const productSEVersions = getVersions(allProducts.data.productsResult, product);
72
+ const versions = (productSEVersions === null || productSEVersions === void 0 ? void 0 : productSEVersions.length) ? productSEVersions : productVenisons;
61
73
  setVersions(versions);
62
74
  }
63
75
  setSelectedProductLocal(product);
64
76
  // eslint-disable-next-line react-hooks/exhaustive-deps
65
77
  }, [allProducts, product, dispatchToGlobalMetadataReducer, contactSSOName]);
66
78
  const onProductChange = (option) => __awaiter(this, void 0, void 0, function* () {
79
+ var _a, _b, _c;
67
80
  if (canEditCase.alert())
68
81
  return;
69
82
  validateProduct(option);
@@ -72,8 +85,8 @@ function ProductNVersion(props) {
72
85
  if (!option.value.product) {
73
86
  return;
74
87
  }
75
- const hasSingleVersion = option.value.versions.length < 2;
76
- setVersions(option.value.versions);
88
+ const hasSingleVersion = ((_b = (_a = option === null || option === void 0 ? void 0 : option.value) === null || _a === void 0 ? void 0 : _a.versions) === null || _b === void 0 ? void 0 : _b.length) < 2;
89
+ setVersions((_c = option === null || option === void 0 ? void 0 : option.value) === null || _c === void 0 ? void 0 : _c.versions);
77
90
  if (hasSingleVersion) {
78
91
  setIsProductUpdating(true);
79
92
  setIsVersionUpdating(true);
@@ -95,6 +108,14 @@ function ProductNVersion(props) {
95
108
  ToastNotification.addDangerMessage(t(`Product and Version failed to update`));
96
109
  }
97
110
  }
111
+ else {
112
+ setIsVersionUpdating(true);
113
+ try {
114
+ yield getVersionsDetails(caseDispatch, option.value.product);
115
+ }
116
+ catch (e) { }
117
+ setIsVersionUpdating(false);
118
+ }
98
119
  });
99
120
  let previousProduct = usePrevious(selectedProductLocal);
100
121
  const onVersionChange = (option) => __awaiter(this, void 0, void 0, function* () {
@@ -161,7 +182,7 @@ function ProductNVersion(props) {
161
182
  }, [caseDispatch, product]);
162
183
  return (React.createElement(React.Fragment, null,
163
184
  React.createElement(AlertMessage, { show: !allProducts.isFetching && allProducts.isError, title: t('There was an error loading products.'), variant: AlertType.DANGER }),
164
- isEmpty(selectedVersionLocal) && !(versions.length < 2) && (React.createElement(Alert, { isInline: true, className: "pf-u-mb-md", variant: AlertVariant.danger, title: React.createElement(Trans, null, "Please clear the errors to change the product on your case") })),
185
+ isEmpty(selectedVersionLocal) && !((selectedVersionLocal === null || selectedVersionLocal === void 0 ? void 0 : selectedVersionLocal.length) < 2) && (React.createElement(Alert, { isInline: true, className: "pf-u-mb-md", variant: AlertVariant.danger, title: React.createElement(Trans, null, "Please clear the errors to change the product on your case") })),
165
186
  React.createElement(React.Fragment, null,
166
187
  React.createElement("div", { className: "form-group all-product-selector-dropdown" },
167
188
  React.createElement("div", { className: "product-selector-wrapper" },
@@ -169,7 +190,7 @@ function ProductNVersion(props) {
169
190
  React.createElement(Trans, null, "Product")),
170
191
  React.createElement(Dropdown, { className: "open-case-product", placeholder: t('Select a product'), id: "case-details-product-selector", selectedItem: toOption({
171
192
  product: selectedProductLocal,
172
- versions: getVersions(allProducts.data.productsResult, product),
193
+ versions: (productSEVersions === null || productSEVersions === void 0 ? void 0 : productSEVersions.length) ? productSEVersions : productVenisons,
173
194
  featuredVersion: '',
174
195
  selectedVersion: selectedVersionLocal,
175
196
  isTopProduct: checkIsTopProduct(allProducts.data.productsResult, product),
@@ -179,7 +200,7 @@ function ProductNVersion(props) {
179
200
  React.createElement("label", { htmlFor: "version-dropdown" },
180
201
  React.createElement(Trans, null, "Version")),
181
202
  React.createElement(Dropdown, { className: "open-case-version", id: "version-dropdown", selectedItem: toOption(selectedVersionLocal), list: toOptions(uniq(versions)), title: t(`Select a version`), isInValid: isEmpty(selectedVersionLocal), disabled: isVersionUpdating ||
182
- versions.length < 2 ||
203
+ (selectedVersionLocal === null || selectedVersionLocal === void 0 ? void 0 : selectedVersionLocal.length) < 2 ||
183
204
  (allProducts.isFetching && !allProducts.isError), onChange: onVersionChange, isLoadingList: isVersionUpdating, "data-tracking-id": "case-details-version-selector" }))))));
184
205
  }
185
206
  export default ProductNVersion;
@@ -1 +1 @@
1
- {"version":3,"file":"OpenshiftDropdownV4.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseManagement/OpenshiftDropdownV4.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAgC,MAAM,sCAAsC,CAAC;AAE1G,OAAO,EAAE,gBAAgB,EAAuB,MAAM,0BAA0B,CAAC;AAWjF,UAAU,MAAO,SAAQ,gBAAgB;IACrC,uBAAuB,EAAE,MAAM,CAAC;IAChC,sBAAsB,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,oBAAoB,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACzF,kBAAkB,EAAE,OAAO,CAAC;IAC5B,iCAAiC,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IAChD,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,4BAA4B,CAAC,EAAE,MAAM,CAAC;CACzC;AAQD,QAAA,MAAM,qBAAqB,cAAqB,MAAM,qEASrD,CAAC;AAeF,iBAAS,mBAAmB,CAAC,KAAK,EAAE,MAAM,eAqTzC;kBArTQ,mBAAmB;;;AAwT5B,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,CAAC"}
1
+ {"version":3,"file":"OpenshiftDropdownV4.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseManagement/OpenshiftDropdownV4.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAgC,MAAM,sCAAsC,CAAC;AAE1G,OAAO,EAAE,gBAAgB,EAAuB,MAAM,0BAA0B,CAAC;AAWjF,UAAU,MAAO,SAAQ,gBAAgB;IACrC,uBAAuB,EAAE,MAAM,CAAC;IAChC,sBAAsB,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,oBAAoB,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACzF,kBAAkB,EAAE,OAAO,CAAC;IAC5B,iCAAiC,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IAChD,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,4BAA4B,CAAC,EAAE,MAAM,CAAC;CACzC;AAQD,QAAA,MAAM,qBAAqB,cAAqB,MAAM,qEASrD,CAAC;AAeF,iBAAS,mBAAmB,CAAC,KAAK,EAAE,MAAM,eAwTzC;kBAxTQ,mBAAmB;;;AA2T5B,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,CAAC"}
@@ -75,10 +75,15 @@ function OpenshiftDropdownV4(props) {
75
75
  setIsOpen(false);
76
76
  setInputVal('');
77
77
  props.onClusterClear();
78
+ const fetchedClusters = yield fetchAccountClusters();
79
+ setClustersRawResponse(fetchedClusters.items);
80
+ setTotalResultsNo(fetchedClusters.total);
81
+ setClustersSelectOptions(getClusterOptions(fetchedClusters.items));
78
82
  });
79
83
  const onToggle = (isOpen) => setIsOpen(isOpen);
80
84
  const onViewMoreClick = () => __awaiter(this, void 0, void 0, function* () {
81
- const fetchedClusters = yield fetchAccountClusters(inputVal);
85
+ const page = Math.floor(clustersRawResponse.length / PER_PAGE) + 1;
86
+ const fetchedClusters = yield fetchAccountClusters(inputVal, page);
82
87
  const clusterResponse = [...clustersRawResponse, ...((fetchedClusters === null || fetchedClusters === void 0 ? void 0 : fetchedClusters.items) || [])];
83
88
  setClustersRawResponse(clusterResponse);
84
89
  setTotalResultsNo(fetchedClusters.total);
@@ -133,8 +138,7 @@ function OpenshiftDropdownV4(props) {
133
138
  ...clusterOptions,
134
139
  ];
135
140
  };
136
- const fetchAccountClusters = (search = '') => __awaiter(this, void 0, void 0, function* () {
137
- const page = Math.floor(clustersRawResponse.length / PER_PAGE) + 1;
141
+ const fetchAccountClusters = (search = '', page = 0) => __awaiter(this, void 0, void 0, function* () {
138
142
  setIsFetchingClusters(true);
139
143
  try {
140
144
  if (abortControllerRef.current !== undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/troubleshoot",
3
- "version": "0.2.107-beta.1",
3
+ "version": "0.2.111",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -26,7 +26,7 @@
26
26
  "lib/**/*"
27
27
  ],
28
28
  "peerDependencies": {
29
- "@cee-eng/hydrajs": "4.9.1",
29
+ "@cee-eng/hydrajs": "4.10.2",
30
30
  "@cee-eng/ui-toolkit": "1.1.6",
31
31
  "@patternfly/patternfly": "4.185.1",
32
32
  "@patternfly/pfe-accordion": "1.12.3",
@@ -63,7 +63,7 @@
63
63
  "react-virtualized": "^9.21.2"
64
64
  },
65
65
  "dependencies": {
66
- "@cee-eng/hydrajs": "4.9.1",
66
+ "@cee-eng/hydrajs": "4.10.2",
67
67
  "@cee-eng/ui-toolkit": "1.1.6",
68
68
  "@patternfly/patternfly": "4.185.1",
69
69
  "@patternfly/pfe-accordion": "1.12.3",
@@ -73,12 +73,12 @@
73
73
  "@patternfly/react-core": "4.202.16",
74
74
  "@progress/kendo-drawing": "^1.6.0",
75
75
  "@progress/kendo-react-pdf": "^3.12.0",
76
- "@rh-support/api": "0.3.16-beta.0",
77
- "@rh-support/components": "1.1.61-beta.0",
78
- "@rh-support/react-context": "0.2.63-beta.0",
76
+ "@rh-support/api": "0.3.21",
77
+ "@rh-support/components": "1.1.67",
78
+ "@rh-support/react-context": "0.2.71",
79
79
  "@rh-support/types": "0.2.0",
80
- "@rh-support/user-permissions": "0.2.49-beta.0",
81
- "@rh-support/utils": "0.2.37-beta.0",
80
+ "@rh-support/user-permissions": "0.2.57",
81
+ "@rh-support/utils": "0.2.43",
82
82
  "@types/react-redux": "^7.1.12",
83
83
  "@types/redux": "^3.6.0",
84
84
  "@webcomponents/webcomponentsjs": "^2.2.10",
@@ -143,5 +143,5 @@
143
143
  "not ie <= 11",
144
144
  "not op_mini all"
145
145
  ],
146
- "gitHead": "e3cc0ce5728cf4aceb226e7d9f6327def34b7c06"
146
+ "gitHead": "072b28907d0e79329f03ba2779242fb5c9384cac"
147
147
  }