@rh-support/troubleshoot 1.0.53 → 1.0.54
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 +36 -56
- package/lib/esm/components/shared/fileUpload/FileLister.d.ts.map +1 -1
- package/lib/esm/components/shared/fileUpload/FileLister.js +7 -0
- package/lib/esm/scss/_main.scss +0 -1
- package/package.json +4 -4
|
@@ -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,
|
|
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,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,KAA2C,MAAM,OAAO,CAAC;AAKhE,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,wEA6HlC,CAAC;AAEH,OAAO,EAAE,8BAA8B,EAAE,CAAC"}
|
|
@@ -1,42 +1,48 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { toOption, toOptions } from '@rh-support/utils';
|
|
1
|
+
import { Select, SelectOption, SelectVariant } from '@patternfly/react-core';
|
|
3
2
|
import isEmpty from 'lodash/isEmpty';
|
|
4
|
-
import
|
|
5
|
-
import React, { forwardRef, useContext, useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import React, { forwardRef, useContext, useState } from 'react';
|
|
6
4
|
import { Trans, useTranslation } from 'react-i18next';
|
|
7
|
-
import { useCaseSelector } from '../../context/CaseContext';
|
|
8
5
|
import { RouteContext } from '../../context/RouteContext';
|
|
9
6
|
const defaultProps = {
|
|
10
7
|
disabled: false,
|
|
11
8
|
htmlForId: '',
|
|
12
9
|
};
|
|
13
10
|
const ProductVersionDropdownSelector = forwardRef((props, ref) => {
|
|
11
|
+
var _a;
|
|
14
12
|
const { t } = useTranslation();
|
|
15
|
-
const [isProductInValid, setIsProductInValid] = useState(true);
|
|
16
|
-
const [isVersionInValid, setIsVersionInValid] = useState(false);
|
|
17
|
-
const [isProductBlured, setIsProductBlured] = useState(false);
|
|
18
|
-
const [isVersionBlured, setIsVersionBlured] = useState(false);
|
|
19
13
|
const { routeState: { showValidationErrorAlert }, } = useContext(RouteContext);
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
14
|
+
const [isProductOpen, setIsProductOpen] = useState(false);
|
|
15
|
+
const [isVersionOpen, setIsVersionOpen] = useState(false);
|
|
16
|
+
const getProductOptions = (options) => {
|
|
17
|
+
return options.map((product, id) => (React.createElement(SelectOption, { key: id, value: product }, product.name)));
|
|
18
|
+
};
|
|
19
|
+
const onProductToggle = (isExpanded) => {
|
|
20
|
+
setIsProductOpen(isExpanded);
|
|
21
|
+
};
|
|
22
|
+
const onVersionToggle = (isExpanded) => {
|
|
23
|
+
setIsVersionOpen(isExpanded);
|
|
24
|
+
};
|
|
25
|
+
const onProductSelect = (event, selection, isPlaceholder) => {
|
|
26
|
+
onProductChange(selection);
|
|
27
|
+
onProductToggle(false);
|
|
28
|
+
};
|
|
29
|
+
const onProductFilter = (_, value) => {
|
|
30
|
+
var _a;
|
|
31
|
+
if (!value)
|
|
32
|
+
return getProductOptions(props.products);
|
|
33
|
+
const input = new RegExp(value, 'i');
|
|
34
|
+
const newOptions = (_a = props.products) === null || _a === void 0 ? void 0 : _a.filter((product) => input.test(product.name));
|
|
35
|
+
return getProductOptions(newOptions);
|
|
36
|
+
};
|
|
37
|
+
const onVersionSelect = (e, selection, isPlaceholder) => {
|
|
38
|
+
onVersionChange(selection);
|
|
39
|
+
onVersionToggle(false);
|
|
40
|
+
};
|
|
33
41
|
const onProductChange = (option) => {
|
|
34
|
-
props.onProductChange(option
|
|
35
|
-
validateProduct(option);
|
|
42
|
+
props.onProductChange(option);
|
|
36
43
|
};
|
|
37
44
|
const onVersionChange = (option) => {
|
|
38
|
-
props.onVersionChange(option
|
|
39
|
-
validateVersion(option);
|
|
45
|
+
props.onVersionChange(option);
|
|
40
46
|
};
|
|
41
47
|
const onProductClear = () => {
|
|
42
48
|
const defaultSelectedProduct = {
|
|
@@ -47,28 +53,7 @@ const ProductVersionDropdownSelector = forwardRef((props, ref) => {
|
|
|
47
53
|
isEntitledProduct: true,
|
|
48
54
|
};
|
|
49
55
|
props.onProductChange(defaultSelectedProduct);
|
|
50
|
-
validateProduct(toOption(defaultSelectedProduct, { labelKey: 'product' }));
|
|
51
|
-
};
|
|
52
|
-
const onProductOuterClick = (selectedItem) => {
|
|
53
|
-
setIsProductBlured(true);
|
|
54
|
-
};
|
|
55
|
-
const onVersionOuterClick = (selectedItem) => {
|
|
56
|
-
setIsVersionBlured(true);
|
|
57
|
-
};
|
|
58
|
-
const validateProduct = (selectedItem) => {
|
|
59
|
-
setIsProductInValid(!props.disabled && (isEmpty(selectedItem) || isEmpty(selectedItem.label)));
|
|
60
|
-
};
|
|
61
|
-
const validateVersion = (selectedItem) => {
|
|
62
|
-
setIsVersionInValid(!props.disabled && (isEmpty(selectedItem) || isEmpty(selectedItem.label)));
|
|
63
56
|
};
|
|
64
|
-
useEffect(() => {
|
|
65
|
-
if (props.disabled) {
|
|
66
|
-
setIsProductInValid(false);
|
|
67
|
-
setIsVersionInValid(false);
|
|
68
|
-
}
|
|
69
|
-
isProductBlured && setIsProductInValid(!props.disabled && isEmpty(props.selectedProduct.product));
|
|
70
|
-
setIsVersionInValid(!props.disabled && !isEmpty(props.selectedProduct.product) && isEmpty(props.version));
|
|
71
|
-
}, [props.disabled, props.selectedProduct.product, isProductBlured, isVersionBlured, props.version]);
|
|
72
57
|
return (React.createElement(React.Fragment, null,
|
|
73
58
|
React.createElement("div", { className: "product-selector-wrapper" },
|
|
74
59
|
React.createElement("label", { htmlFor: "product-selector-dropdown-downshift-search", ref: ref },
|
|
@@ -76,21 +61,16 @@ const ProductVersionDropdownSelector = forwardRef((props, ref) => {
|
|
|
76
61
|
React.createElement(Trans, null, "Product"),
|
|
77
62
|
' ',
|
|
78
63
|
React.createElement("span", { className: "form-required", "aria-hidden": true }, "*"))),
|
|
79
|
-
React.createElement(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
!props.selectedProduct.product, onChange: onProductChange, onOuterClick: onProductOuterClick, searchable: true, isLoadingList: props.isLoading, onClearSelection: onProductClear, "data-tracking-id": "product-dropdown-selector" })),
|
|
64
|
+
React.createElement(Select, { className: `product-dropdown`, id: "product-selector-dropdown", variant: SelectVariant.typeahead, onFilter: onProductFilter, "aria-label": "Select Input", onToggle: onProductToggle, onSelect: onProductSelect, selections: props.selectedProduct.name, placeholderText: t('Select a product'), isOpen: isProductOpen, onClear: onProductClear, validated: !props.disabled && showValidationErrorAlert && !props.selectedProduct.product
|
|
65
|
+
? 'warning'
|
|
66
|
+
: 'default', "data-tracking-id": "product-dropdown-selector" }, getProductOptions(props.products))),
|
|
83
67
|
React.createElement("div", { className: "version-selector-wrapper" },
|
|
84
68
|
React.createElement("label", { htmlFor: "version-selector-dropdown-toggle" },
|
|
85
69
|
React.createElement("h3", { className: "subheading subheading-sm" },
|
|
86
70
|
React.createElement(Trans, null, "Version"),
|
|
87
71
|
' ',
|
|
88
72
|
React.createElement("span", { className: "form-required", "aria-hidden": true }, "*"))),
|
|
89
|
-
React.createElement(
|
|
90
|
-
isVersionInValid &&
|
|
91
|
-
showValidationErrorAlert &&
|
|
92
|
-
props.selectedProduct.product &&
|
|
93
|
-
!props.version, onChange: onVersionChange, onOuterClick: onVersionOuterClick, "data-tracking-id": "version-dropdown-selector" }))));
|
|
73
|
+
React.createElement(Select, { variant: SelectVariant.single, id: "version-selector-dropdown", onToggle: onVersionToggle, onSelect: onVersionSelect, selections: props.version, isOpen: isVersionOpen, placeholderText: t('Select a version'), isDisabled: isEmpty(props.selectedProduct.product) ? true : false, "data-tracking-id": "version-dropdown-selector" }, (_a = props.selectedProduct.versions) === null || _a === void 0 ? void 0 : _a.map((version, id) => (React.createElement(SelectOption, { key: id, value: version }, version)))))));
|
|
94
74
|
});
|
|
95
75
|
ProductVersionDropdownSelector.defaultProps = defaultProps;
|
|
96
76
|
export { ProductVersionDropdownSelector };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileLister.d.ts","sourceRoot":"","sources":["../../../../../src/components/shared/fileUpload/FileLister.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FileLister.d.ts","sourceRoot":"","sources":["../../../../../src/components/shared/fileUpload/FileLister.tsx"],"names":[],"mappings":"AA2BA,OAAO,EAAiB,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAGxE,eAAO,MAAM,qBAAqB,2FAAyC,CAAC;AAiB5E,UAAU,MAAM;IACZ,kBAAkB,EAAE,UAAU,EAAE,CAAC;IACjC,UAAU,EAAE,CAAC,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IACtG,YAAY,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IACtE,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,eAAe,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,KAAK,EAAE,MAAM,eAgR/C"}
|
|
@@ -6,6 +6,7 @@ import { capitalize, isEmpty } from 'lodash';
|
|
|
6
6
|
import map from 'lodash/map';
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { Trans, useTranslation } from 'react-i18next';
|
|
9
|
+
import { ATTACHMENT_DESCRIPTION_LENGTH_LIMIT } from '../../../reducers/CaseConstNTypes';
|
|
9
10
|
import { isAnalysingFile, isAnalysisFailed, isFileDeleted, isUploadAborted, isUploadedAndAnalysisFailed, isUploadedAndAnalysisSkipped, isUploadedAndAnalyzed, isUploadFailed, isUploading, isUploadingAttachment, isUploadingOnCase, isUploadingOnSession, isUploadOnTrack, isVerifyingUpload, shouldHideDescription, } from './reducer/AttachmentHelper';
|
|
10
11
|
import { FileStatusHelper } from './reducer/FileStatusHelper';
|
|
11
12
|
export const CaseDiagnosticsStatus = pcm.preCase.diag.CaseDiagnosticsStatus;
|
|
@@ -82,6 +83,10 @@ export default function FileLister(props) {
|
|
|
82
83
|
return !(isUploading(fileUploadStatus) || (!props.isSessionId && isUploadedAndAnalyzed(localFile)));
|
|
83
84
|
};
|
|
84
85
|
const canShowAbortBtn = (status) => isUploadingOnSession(status) || isUploadingOnCase(status);
|
|
86
|
+
// Attachment description length message
|
|
87
|
+
const maxCaseAttachmentDescription = t('You have reached the {{limit}} characters limit. The attachment description cannot be more than {{limit}} characters.', {
|
|
88
|
+
limit: ATTACHMENT_DESCRIPTION_LENGTH_LIMIT,
|
|
89
|
+
});
|
|
85
90
|
return (React.createElement(React.Fragment, null,
|
|
86
91
|
React.createElement("div", { className: "file-diag-selected" },
|
|
87
92
|
React.createElement("span", { className: "sr-only" }, "Selected files"),
|
|
@@ -116,6 +121,8 @@ export default function FileLister(props) {
|
|
|
116
121
|
? ''
|
|
117
122
|
: t('Enter a description')}`), hidden: shouldHideDescription(localFile, props.isSessionId) }),
|
|
118
123
|
isUploadedAndAnalysisSkipped(localFile) && (React.createElement("span", { className: "text-muted" }, localFile.analysisMetadata.analysisErrorMesssage)),
|
|
124
|
+
localFile.description.length === ATTACHMENT_DESCRIPTION_LENGTH_LIMIT ? (React.createElement("p", { className: "form-instructions" },
|
|
125
|
+
React.createElement(Trans, null, maxCaseAttachmentDescription))) : null,
|
|
119
126
|
isUploadedAndAnalysisFailed(localFile) && (React.createElement("span", { className: "text-danger" },
|
|
120
127
|
React.createElement(Trans, null, "Something went wrong during file analysis."),
|
|
121
128
|
React.createElement(Button, { onClick: onRetryAnalysis(index), isInline: true, variant: ButtonVariant.link },
|
package/lib/esm/scss/_main.scss
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/troubleshoot",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.54",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
"@patternfly/react-core": "4.264.0",
|
|
74
74
|
"@progress/kendo-drawing": "^1.6.0",
|
|
75
75
|
"@progress/kendo-react-pdf": "^3.12.0",
|
|
76
|
-
"@rh-support/components": "1.2.
|
|
77
|
-
"@rh-support/react-context": "1.0.
|
|
76
|
+
"@rh-support/components": "1.2.25",
|
|
77
|
+
"@rh-support/react-context": "1.0.33",
|
|
78
78
|
"@rh-support/types": "0.2.0",
|
|
79
79
|
"@rh-support/user-permissions": "1.0.14",
|
|
80
80
|
"@rh-support/utils": "1.0.12",
|
|
@@ -145,5 +145,5 @@
|
|
|
145
145
|
"not ie <= 11",
|
|
146
146
|
"not op_mini all"
|
|
147
147
|
],
|
|
148
|
-
"gitHead": "
|
|
148
|
+
"gitHead": "503c03f099f29076c7cbd553e53c6fe74bf2d749"
|
|
149
149
|
}
|