@rh-support/troubleshoot 1.0.54 → 1.0.65

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":"ContactPhoneNumberAlert.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/ContactPhoneNumberAlert.tsx"],"names":[],"mappings":"AAWA,wBAAgB,uBAAuB,gBAyDtC"}
1
+ {"version":3,"file":"ContactPhoneNumberAlert.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/ContactPhoneNumberAlert.tsx"],"names":[],"mappings":"AAWA,wBAAgB,uBAAuB,gBAwDtC"}
@@ -29,5 +29,5 @@ export function ContactPhoneNumberAlert() {
29
29
  React.createElement(Button, { variant: ButtonVariant.link, isInline: true, onClick: () => onCaseDetailsChange({ suppliedPhoneNumberVerified: 'Deferred' }), "data-tracking-id": "case-contact-phone-number-dont-know" },
30
30
  React.createElement(Trans, null, "I don't know")),
31
31
  ] },
32
- React.createElement(Trans, null, "You are opening an urgent or high severity case, please confirm the phone number we have on file is correct.")));
32
+ React.createElement(Trans, null, "You are opening an urgent severity case, please confirm the phone number we have on file is correct.")));
33
33
  }
@@ -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,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
+ {"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,wEAyIlC,CAAC;AAEH,OAAO,EAAE,8BAA8B,EAAE,CAAC"}
@@ -1,48 +1,42 @@
1
- import { Select, SelectOption, SelectVariant } from '@patternfly/react-core';
1
+ import { Dropdown } from '@rh-support/components';
2
+ import { toOption, toOptions } from '@rh-support/utils';
2
3
  import isEmpty from 'lodash/isEmpty';
3
- import React, { forwardRef, useContext, useState } from 'react';
4
+ import isEqual from 'lodash/isEqual';
5
+ import React, { forwardRef, useContext, useEffect, useMemo, useState } from 'react';
4
6
  import { Trans, useTranslation } from 'react-i18next';
7
+ import { useCaseSelector } from '../../context/CaseContext';
5
8
  import { RouteContext } from '../../context/RouteContext';
6
9
  const defaultProps = {
7
10
  disabled: false,
8
11
  htmlForId: '',
9
12
  };
10
13
  const ProductVersionDropdownSelector = forwardRef((props, ref) => {
11
- var _a;
12
14
  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);
13
19
  const { routeState: { showValidationErrorAlert }, } = useContext(RouteContext);
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
- };
20
+ const versionsDetails = useCaseSelector((state) => state.versionsDetails, isEqual);
21
+ const productVersions = useMemo(() => versionsDetails.data
22
+ .map(({ name }) => name)
23
+ .sort()
24
+ .reverse(),
25
+ // eslint-disable-next-line react-hooks/exhaustive-deps
26
+ [props.selectedProduct.name, versionsDetails.data]);
27
+ // Here we are conditionally checking if selected product is having version and if not fallback to fetched version list ].
28
+ const selectedProductVersion = isEmpty(props.selectedProduct.versions)
29
+ ? productVersions
30
+ : props.selectedProduct.versions;
31
+ // On the basis of which version source we are using we need to use loading status of it.
32
+ const isLoadingList = isEmpty(props.selectedProduct.versions) ? versionsDetails.isFetching : props.isLoading;
41
33
  const onProductChange = (option) => {
42
- props.onProductChange(option);
34
+ props.onProductChange(option.value);
35
+ validateProduct(option);
43
36
  };
44
37
  const onVersionChange = (option) => {
45
- props.onVersionChange(option);
38
+ props.onVersionChange(option.value);
39
+ validateVersion(option);
46
40
  };
47
41
  const onProductClear = () => {
48
42
  const defaultSelectedProduct = {
@@ -53,7 +47,28 @@ const ProductVersionDropdownSelector = forwardRef((props, ref) => {
53
47
  isEntitledProduct: true,
54
48
  };
55
49
  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)));
56
63
  };
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]);
57
72
  return (React.createElement(React.Fragment, null,
58
73
  React.createElement("div", { className: "product-selector-wrapper" },
59
74
  React.createElement("label", { htmlFor: "product-selector-dropdown-downshift-search", ref: ref },
@@ -61,16 +76,21 @@ const ProductVersionDropdownSelector = forwardRef((props, ref) => {
61
76
  React.createElement(Trans, null, "Product"),
62
77
  ' ',
63
78
  React.createElement("span", { className: "form-required", "aria-hidden": true }, "*"))),
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))),
79
+ React.createElement(Dropdown, { className: `product-dropdown`, id: "product-selector-dropdown", placeholder: t('Select a product'), list: props.products ? toOptions(props.products, { labelKey: 'product' }) : [], title: `Select a product`, selectedItem: toOption(props.selectedProduct, { labelKey: 'product' }), isInValid: !props.disabled &&
80
+ isProductInValid &&
81
+ showValidationErrorAlert &&
82
+ !props.selectedProduct.product, onChange: onProductChange, onOuterClick: onProductOuterClick, searchable: true, isLoadingList: props.isLoading, onClearSelection: onProductClear, "data-tracking-id": "product-dropdown-selector" })),
67
83
  React.createElement("div", { className: "version-selector-wrapper" },
68
84
  React.createElement("label", { htmlFor: "version-selector-dropdown-toggle" },
69
85
  React.createElement("h3", { className: "subheading subheading-sm" },
70
86
  React.createElement(Trans, null, "Version"),
71
87
  ' ',
72
88
  React.createElement("span", { className: "form-required", "aria-hidden": true }, "*"))),
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)))))));
89
+ 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 &&
90
+ isVersionInValid &&
91
+ showValidationErrorAlert &&
92
+ props.selectedProduct.product &&
93
+ !props.version, onChange: onVersionChange, onOuterClick: onVersionOuterClick, "data-tracking-id": "version-dropdown-selector" }))));
74
94
  });
75
95
  ProductVersionDropdownSelector.defaultProps = defaultProps;
76
96
  export { ProductVersionDropdownSelector };
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"FileLister.d.ts","sourceRoot":"","sources":["../../../../../src/components/shared/fileUpload/FileLister.tsx"],"names":[],"mappings":"AA0BA,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,eAgQ/C"}
@@ -6,7 +6,6 @@ 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';
10
9
  import { isAnalysingFile, isAnalysisFailed, isFileDeleted, isUploadAborted, isUploadedAndAnalysisFailed, isUploadedAndAnalysisSkipped, isUploadedAndAnalyzed, isUploadFailed, isUploading, isUploadingAttachment, isUploadingOnCase, isUploadingOnSession, isUploadOnTrack, isVerifyingUpload, shouldHideDescription, } from './reducer/AttachmentHelper';
11
10
  import { FileStatusHelper } from './reducer/FileStatusHelper';
12
11
  export const CaseDiagnosticsStatus = pcm.preCase.diag.CaseDiagnosticsStatus;
@@ -83,10 +82,6 @@ export default function FileLister(props) {
83
82
  return !(isUploading(fileUploadStatus) || (!props.isSessionId && isUploadedAndAnalyzed(localFile)));
84
83
  };
85
84
  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
- });
90
85
  return (React.createElement(React.Fragment, null,
91
86
  React.createElement("div", { className: "file-diag-selected" },
92
87
  React.createElement("span", { className: "sr-only" }, "Selected files"),
@@ -121,8 +116,6 @@ export default function FileLister(props) {
121
116
  ? ''
122
117
  : t('Enter a description')}`), hidden: shouldHideDescription(localFile, props.isSessionId) }),
123
118
  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,
126
119
  isUploadedAndAnalysisFailed(localFile) && (React.createElement("span", { className: "text-danger" },
127
120
  React.createElement(Trans, null, "Something went wrong during file analysis."),
128
121
  React.createElement(Button, { onClick: onRetryAnalysis(index), isInline: true, variant: ButtonVariant.link },
@@ -171,6 +171,7 @@
171
171
  border: 1px solid #d9d9d9;
172
172
  border-bottom: initial;
173
173
  border-left: initial;
174
+ z-index: 999;
174
175
 
175
176
  /* Layout - navigation section */
176
177
  button:first-child {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/troubleshoot",
3
- "version": "1.0.54",
3
+ "version": "1.0.65",
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.25",
77
- "@rh-support/react-context": "1.0.33",
76
+ "@rh-support/components": "1.2.24",
77
+ "@rh-support/react-context": "1.0.32",
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": "503c03f099f29076c7cbd553e53c6fe74bf2d749"
148
+ "gitHead": "2f8d4e4eb0e413056fd05afe5896a319d6dbbe50"
149
149
  }