@rh-support/troubleshoot 0.2.73 → 0.2.81
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/ProductSelector/ProductVersionDropdownSelector.d.ts.map +1 -1
- package/lib/esm/components/ProductSelector/ProductVersionDropdownSelector.js +14 -3
- package/lib/esm/components/wizardLayout/GlobalTroubleshootEffects.d.ts.map +1 -1
- package/lib/esm/components/wizardLayout/GlobalTroubleshootEffects.js +12 -3
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductVersionDropdownSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/ProductSelector/ProductVersionDropdownSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AAEpE,OAAO,EAAE,gBAAgB,EAAW,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"ProductVersionDropdownSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/ProductSelector/ProductVersionDropdownSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AAEpE,OAAO,EAAE,gBAAgB,EAAW,MAAM,0BAA0B,CAAC;AAIrE,OAAO,KAA+D,MAAM,OAAO,CAAC;AAMpF,UAAU,MAAO,SAAQ,gBAAgB;IACrC,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;IAChC,eAAe,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IACrC,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,GAAG,CAAC;IACvD,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,GAAG,CAAC;IAC1C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACnB;AAOD,QAAA,MAAM,8BAA8B,wEAqIlC,CAAC;AAEH,OAAO,EAAE,8BAA8B,EAAE,CAAC"}
|
|
@@ -1,21 +1,32 @@
|
|
|
1
1
|
import { Dropdown } from '@rh-support/components';
|
|
2
2
|
import { toOption, toOptions } from '@rh-support/utils';
|
|
3
3
|
import isEmpty from 'lodash/isEmpty';
|
|
4
|
-
import
|
|
4
|
+
import isEqual from 'lodash/isEqual';
|
|
5
|
+
import React, { forwardRef, useContext, useEffect, useMemo, useState } from 'react';
|
|
5
6
|
import { Trans, useTranslation } from 'react-i18next';
|
|
7
|
+
import { useCaseSelector } from '../../context/CaseContext';
|
|
6
8
|
import { RouteContext } from '../../context/RouteContext';
|
|
7
9
|
const defaultProps = {
|
|
8
10
|
disabled: false,
|
|
9
11
|
htmlForId: '',
|
|
10
12
|
};
|
|
11
13
|
const ProductVersionDropdownSelector = forwardRef((props, ref) => {
|
|
12
|
-
var _a;
|
|
13
14
|
const { t } = useTranslation();
|
|
14
15
|
const [isProductInValid, setIsProductInValid] = useState(true);
|
|
15
16
|
const [isVersionInValid, setIsVersionInValid] = useState(false);
|
|
16
17
|
const [isProductBlured, setIsProductBlured] = useState(false);
|
|
17
18
|
const [isVersionBlured, setIsVersionBlured] = useState(false);
|
|
18
19
|
const { routeState: { showValidationErrorAlert }, } = useContext(RouteContext);
|
|
20
|
+
const versionsDetails = useCaseSelector((state) => state.versionsDetails, isEqual);
|
|
21
|
+
const productVenisons = useMemo(() => versionsDetails.data.map(({ name }) => name),
|
|
22
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
23
|
+
[props.selectedProduct.name, versionsDetails.data]);
|
|
24
|
+
// Here we are conditionally checking if selected product is having version and if not fallback to fetched version list ].
|
|
25
|
+
const selectedProductVersion = isEmpty(props.selectedProduct.versions)
|
|
26
|
+
? productVenisons
|
|
27
|
+
: props.selectedProduct.versions;
|
|
28
|
+
// On the basis of which version source we are using we need to use loading status of it.
|
|
29
|
+
const isLoadingList = isEmpty(props.selectedProduct.versions) ? versionsDetails.isFetching : props.isLoading;
|
|
19
30
|
const onProductChange = (option) => {
|
|
20
31
|
props.onProductChange(option.value);
|
|
21
32
|
validateProduct(option);
|
|
@@ -72,7 +83,7 @@ const ProductVersionDropdownSelector = forwardRef((props, ref) => {
|
|
|
72
83
|
React.createElement(Trans, null, "Version"),
|
|
73
84
|
' ',
|
|
74
85
|
React.createElement("span", { className: "form-required", "aria-hidden": true }, "*"))),
|
|
75
|
-
React.createElement(Dropdown, { selectedItem: toOption(props.version), list:
|
|
86
|
+
React.createElement(Dropdown, { selectedItem: toOption(props.version), list: toOptions(selectedProductVersion !== null && selectedProductVersion !== void 0 ? selectedProductVersion : []), id: "version-selector-dropdown", placeholder: t('Select a version'), isLoadingList: isLoadingList, title: `Versions for ${props.selectedProduct.product}`, disabled: props.disabled || isEmpty(selectedProductVersion), isInValid: !props.disabled &&
|
|
76
87
|
isVersionInValid &&
|
|
77
88
|
showValidationErrorAlert &&
|
|
78
89
|
props.selectedProduct.product &&
|
|
@@ -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;AAOrF,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;AAOrF,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;CACpD;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,eA2XtD"}
|
|
@@ -50,6 +50,11 @@ export function GlobalTroubleshootEffects(props) {
|
|
|
50
50
|
language: state.caseDetails.caseLanguage,
|
|
51
51
|
selectedAccountDetails: state.selectedAccountDetails,
|
|
52
52
|
}), isEqual);
|
|
53
|
+
const versionsDetails = useCaseSelector((state) => {
|
|
54
|
+
if (isEmpty(state.versionsDetails.data))
|
|
55
|
+
return [];
|
|
56
|
+
return state.versionsDetails.data.map(({ name }) => name);
|
|
57
|
+
}, isEqual);
|
|
53
58
|
const caseDispatch = useCaseDispatch();
|
|
54
59
|
const isCaseCreate = RouteUtils.getQueryParams(props.routeProps).caseCreate === 'true';
|
|
55
60
|
const urlQueryParams = RouteUtils.getQueryParams(props.routeProps);
|
|
@@ -84,9 +89,13 @@ export function GlobalTroubleshootEffects(props) {
|
|
|
84
89
|
RouteUtils.updateQueryParams(props.routeProps, newParams);
|
|
85
90
|
}
|
|
86
91
|
else {
|
|
92
|
+
// Check if product information it self is having version list or fallback to version list from different source.
|
|
93
|
+
const productVersions = isEmpty(allProducts.data.productsResult[index].versions)
|
|
94
|
+
? versionsDetails
|
|
95
|
+
: allProducts.data.productsResult[index].versions;
|
|
87
96
|
// product in url is valid
|
|
88
|
-
const isVersionFromURLValid = !isEmpty(versionFromUrl) && includes(
|
|
89
|
-
const isMultiVersionProduct = !isOnlyVersion(
|
|
97
|
+
const isVersionFromURLValid = !isEmpty(versionFromUrl) && includes(productVersions, versionFromUrl);
|
|
98
|
+
const isMultiVersionProduct = !isOnlyVersion(productVersions);
|
|
90
99
|
if (isVersionFromURLValid || isMultiVersionProduct) {
|
|
91
100
|
// version is also valid
|
|
92
101
|
const versionToSet = isVersionFromURLValid ? versionFromUrl : undefined;
|
|
@@ -96,7 +105,7 @@ export function GlobalTroubleshootEffects(props) {
|
|
|
96
105
|
}
|
|
97
106
|
else if (!isMultiVersionProduct) {
|
|
98
107
|
// 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
|
|
99
|
-
const defaultVersion = getVersionIfOnlyVersion(
|
|
108
|
+
const defaultVersion = getVersionIfOnlyVersion(productVersions);
|
|
100
109
|
const newParams = { product: productFromUrl, version: defaultVersion };
|
|
101
110
|
RouteUtils.updateQueryParams(props.routeProps, newParams);
|
|
102
111
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/troubleshoot",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.81",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -74,11 +74,11 @@
|
|
|
74
74
|
"@progress/kendo-drawing": "^1.6.0",
|
|
75
75
|
"@progress/kendo-react-pdf": "^3.12.0",
|
|
76
76
|
"@rh-support/api": "0.3.10",
|
|
77
|
-
"@rh-support/components": "1.1.
|
|
78
|
-
"@rh-support/react-context": "0.2.
|
|
77
|
+
"@rh-support/components": "1.1.51",
|
|
78
|
+
"@rh-support/react-context": "0.2.51",
|
|
79
79
|
"@rh-support/types": "0.2.0",
|
|
80
|
-
"@rh-support/user-permissions": "0.2.
|
|
81
|
-
"@rh-support/utils": "0.2.
|
|
80
|
+
"@rh-support/user-permissions": "0.2.41",
|
|
81
|
+
"@rh-support/utils": "0.2.31",
|
|
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": "
|
|
146
|
+
"gitHead": "274324da926ca7deeaeba9fe702cacd0129941a1"
|
|
147
147
|
}
|