@rh-support/troubleshoot 1.0.8 → 1.0.9

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":"ProductVersion.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDetails/ProductVersion.tsx"],"names":[],"mappings":"AAuBA,UAAU,MAAM;IACZ,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACvC;AAYD,iBAAS,eAAe,CAAC,KAAK,EAAE,MAAM,eAoQrC;AAED,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"ProductVersion.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDetails/ProductVersion.tsx"],"names":[],"mappings":"AA4BA,UAAU,MAAM;IACZ,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACvC;AAYD,iBAAS,eAAe,CAAC,KAAK,EAAE,MAAM,eA2QrC;AAED,eAAe,eAAe,CAAC"}
@@ -10,12 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import { Alert, AlertVariant } from '@patternfly/react-core';
11
11
  import { AlertMessage, AlertType, Dropdown, ToastNotification, usePrevious } from '@rh-support/components';
12
12
  import { fetchProducts, GlobalMetadataDispatchContext, GlobalMetadataStateContext, useCanEditCase, } from '@rh-support/react-context';
13
- import { haventLoadedMetadata, toOption, toOptions } from '@rh-support/utils';
13
+ import { getUniqueSortedVersions, haventLoadedMetadata, toOption, toOptions, } from '@rh-support/utils';
14
14
  import filter from 'lodash/filter';
15
15
  import findIndex from 'lodash/findIndex';
16
16
  import isEmpty from 'lodash/isEmpty';
17
17
  import isEqual from 'lodash/isEqual';
18
- import uniq from 'lodash/uniq';
19
18
  import React, { useContext, useEffect, useMemo, useState } from 'react';
20
19
  import { Trans, useTranslation } from 'react-i18next';
21
20
  import { useCaseDispatch, useCaseSelector } from '../../../../context/CaseContext';
@@ -192,6 +191,11 @@ function ProductNVersion(props) {
192
191
  }, [caseDispatch, product]);
193
192
  // To check if version in invalid
194
193
  const checkIfVersionIsInvalid = isVersionInvalid && isEmpty(selectedVersionLocal);
194
+ const versionsListMemo = useMemo(() => {
195
+ return getUniqueSortedVersions(versions);
196
+ }, [versions]);
197
+ // Versions List
198
+ const versionsList = toOptions(versionsListMemo);
195
199
  return (React.createElement(React.Fragment, null,
196
200
  React.createElement(AlertMessage, { show: !allProducts.isFetching && allProducts.isError, title: t('There was an error loading products.'), variant: AlertType.DANGER }),
197
201
  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") })),
@@ -211,6 +215,6 @@ function ProductNVersion(props) {
211
215
  React.createElement("div", { className: "version-selector-wrapper" },
212
216
  React.createElement("label", { htmlFor: "version-dropdown" },
213
217
  React.createElement(Trans, null, "Version")),
214
- React.createElement(Dropdown, { className: "open-case-version", id: "version-dropdown", selectedItem: toOption(selectedVersionLocal), list: toOptions(uniq(versions)), title: t(`Select a version`), isInValid: checkIfVersionIsInvalid, disabled: isVersionUpdating || (allProducts.isFetching && !allProducts.isError), onChange: onVersionChange, isLoadingList: isVersionUpdating, "data-tracking-id": "case-details-version-selector" }))))));
218
+ React.createElement(Dropdown, { className: "open-case-version", id: "version-dropdown", selectedItem: toOption(selectedVersionLocal), list: versionsList, title: t(`Select a version`), isInValid: checkIfVersionIsInvalid, disabled: isVersionUpdating || (allProducts.isFetching && !allProducts.isError), onChange: onVersionChange, isLoadingList: isVersionUpdating, "data-tracking-id": "case-details-version-selector" }))))));
215
219
  }
216
220
  export default ProductNVersion;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/troubleshoot",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -73,11 +73,11 @@
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/components": "1.2.5",
77
- "@rh-support/react-context": "1.0.6",
76
+ "@rh-support/components": "1.2.6",
77
+ "@rh-support/react-context": "1.0.7",
78
78
  "@rh-support/types": "0.2.0",
79
- "@rh-support/user-permissions": "1.0.5",
80
- "@rh-support/utils": "1.0.3",
79
+ "@rh-support/user-permissions": "1.0.6",
80
+ "@rh-support/utils": "1.0.4",
81
81
  "@types/react-redux": "^7.1.12",
82
82
  "@types/redux": "^3.6.0",
83
83
  "@webcomponents/webcomponentsjs": "^2.2.10",
@@ -142,5 +142,5 @@
142
142
  "not ie <= 11",
143
143
  "not op_mini all"
144
144
  ],
145
- "gitHead": "99871945be699eeae0ed20023dd6708b2a0d422d"
145
+ "gitHead": "a6141b62e73e1d74ccf4f4075134da7091b8e96e"
146
146
  }