@rh-support/cases 2.1.84 → 2.1.86
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/case-list/case-list-filters/VersionsFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/VersionsFilter.js +33 -2
- package/lib/esm/components/case-list/case-list-table/CloseCaseBtn.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-table/CloseCaseBtn.js +4 -0
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VersionsFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/VersionsFilter.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"VersionsFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/VersionsFilter.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAI7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAgB,MAAM,0BAA0B,CAAC;AAoCxE,UAAU,MAAM;IACZ,WAAW,EAAE,cAAc,CAAC;IAC5B,mBAAmB,EAAE,uBAAuB,EAAE,CAAC;CAClD;AAED,wBAAgB,cAAc,CAAC,EAAE,WAAW,EAAE,mBAAmB,EAAE,EAAE,MAAM,qBA+D1E"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Select, SelectOption, SelectVariant } from '@patternfly/react-core/deprecated';
|
|
2
2
|
import isEmpty from 'lodash/isEmpty';
|
|
3
|
-
import React, { useContext, useState } from 'react';
|
|
3
|
+
import React, { useContext, useMemo, useState } from 'react';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { SolrKeys, SolrPivotKeys } from '../../../enums/filters';
|
|
6
6
|
import { CaseListFilterDispatchContext, CaseListFilterStateContext } from '../CaseListFilterContext';
|
|
@@ -8,6 +8,34 @@ import { updateFilter } from '../CaseListFilterReducer';
|
|
|
8
8
|
function getVersionValuesForProduct(productPivot = [], productName) {
|
|
9
9
|
return (productPivot.find((item) => item.value === productName) || {}).case_version;
|
|
10
10
|
}
|
|
11
|
+
//split version into parts
|
|
12
|
+
function parseVersionIntoParts(version) {
|
|
13
|
+
//keep unknown version at last
|
|
14
|
+
if (version === 'Unknown')
|
|
15
|
+
return [Infinity];
|
|
16
|
+
//split dots and spaces
|
|
17
|
+
return version.split(/[.\s]/).map((p) => (isNaN(Number(p)) ? p : Number(p)));
|
|
18
|
+
}
|
|
19
|
+
function compareVersions(versionA, versionB) {
|
|
20
|
+
var _a, _b;
|
|
21
|
+
const pA = parseVersionIntoParts(versionA), pB = parseVersionIntoParts(versionB);
|
|
22
|
+
//compare each part
|
|
23
|
+
for (let i = 0; i < Math.max(pA.length, pB.length); i++) {
|
|
24
|
+
const a = (_a = pA[i]) !== null && _a !== void 0 ? _a : 0, b = (_b = pB[i]) !== null && _b !== void 0 ? _b : 0; //undefined as 0
|
|
25
|
+
if (a == b)
|
|
26
|
+
continue;
|
|
27
|
+
if (typeof a === 'number' && typeof b === 'number')
|
|
28
|
+
return a - b;
|
|
29
|
+
if (typeof a === 'string' && typeof b === 'string')
|
|
30
|
+
return a.localeCompare(b);
|
|
31
|
+
//one is string and other is number => string takes precendence
|
|
32
|
+
if (typeof a === 'string')
|
|
33
|
+
return -1;
|
|
34
|
+
if (typeof b == 'string')
|
|
35
|
+
return 1;
|
|
36
|
+
}
|
|
37
|
+
return 0;
|
|
38
|
+
}
|
|
11
39
|
export function VersionsFilter({ productInfo, productVersionPivot }) {
|
|
12
40
|
const { t } = useTranslation();
|
|
13
41
|
const { filterInfo } = useContext(CaseListFilterStateContext);
|
|
@@ -29,7 +57,10 @@ export function VersionsFilter({ productInfo, productVersionPivot }) {
|
|
|
29
57
|
};
|
|
30
58
|
updateFilter(dispatch, { filterKey: SolrPivotKeys.product_version, values: productNewState });
|
|
31
59
|
};
|
|
32
|
-
const versions =
|
|
60
|
+
const versions = useMemo(() => {
|
|
61
|
+
const versionValues = getVersionValuesForProduct(productVersionPivot, productInfo.value);
|
|
62
|
+
return versionValues === null || versionValues === void 0 ? void 0 : versionValues.sort((a, b) => compareVersions(a.value, b.value));
|
|
63
|
+
}, [productVersionPivot, productInfo.value]);
|
|
33
64
|
const titleId = 'case-list-versions-filter';
|
|
34
65
|
return (React.createElement(React.Fragment, null, !isEmpty(versions) && (React.createElement(React.Fragment, null,
|
|
35
66
|
React.createElement("label", { hidden: true, htmlFor: titleId }, t('Open versions dropdown')),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CloseCaseBtn.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-table/CloseCaseBtn.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CloseCaseBtn.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-table/CloseCaseBtn.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,UAAU,MAAM;IACZ,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;CACpC;AAUD,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EAAE,aAAa,EAAE,QAAQ,EAAE,mBAAmB,EAAE,EAAE,MAAM,qBAmF5F"}
|
|
@@ -11,6 +11,7 @@ import { publicApi } from '@cee-eng/hydrajs';
|
|
|
11
11
|
import { Button } from '@patternfly/react-core';
|
|
12
12
|
import { ToastNotification, useFetch } from '@rh-support/components';
|
|
13
13
|
import { CloseCaseModal, useCanCreateCase } from '@rh-support/react-context';
|
|
14
|
+
import { dtmTrackEvent } from '@rh-support/utils';
|
|
14
15
|
import React, { useState } from 'react';
|
|
15
16
|
import { Trans, useTranslation } from 'react-i18next';
|
|
16
17
|
const MAX_ALLOWED_CASES = 5;
|
|
@@ -43,6 +44,7 @@ export default function CloseCaseBtn({ selectedCases, caseList, onCasesCloseSucc
|
|
|
43
44
|
setIsModalOpen(false);
|
|
44
45
|
const toastId = ToastNotification.addSuccessMessage(t(`Closing selected cases`));
|
|
45
46
|
selectedCases.forEach((caseNumber) => {
|
|
47
|
+
var _a;
|
|
46
48
|
const p = request(caseNumber, { status: 'Closed' });
|
|
47
49
|
promiseArr.push(p);
|
|
48
50
|
p.then((res) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -58,6 +60,8 @@ export default function CloseCaseBtn({ selectedCases, caseList, onCasesCloseSucc
|
|
|
58
60
|
ToastNotification.clearToast(toastId);
|
|
59
61
|
ToastNotification.addDangerMessage(t('Could not close case {{caseNumber}}', { caseNumber }));
|
|
60
62
|
});
|
|
63
|
+
const caseDetails = caseList.find((caseObj) => caseObj['case_number'] === caseNumber);
|
|
64
|
+
dtmTrackEvent('case closed - case list page', caseNumber, (_a = caseDetails === null || caseDetails === void 0 ? void 0 : caseDetails.case_product) === null || _a === void 0 ? void 0 : _a[0]);
|
|
61
65
|
});
|
|
62
66
|
yield Promise.all(promiseArr.map(reflect));
|
|
63
67
|
onCasesCloseSuccess && onCasesCloseSuccess();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/cases",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.86",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"@patternfly/patternfly": "5.1.0",
|
|
44
44
|
"@patternfly/react-core": "5.1.1",
|
|
45
45
|
"@patternfly/react-table": "5.1.1",
|
|
46
|
-
"@rh-support/components": "2.1.
|
|
47
|
-
"@rh-support/react-context": "2.1.
|
|
46
|
+
"@rh-support/components": "2.1.66",
|
|
47
|
+
"@rh-support/react-context": "2.1.74",
|
|
48
48
|
"@rh-support/types": "2.0.4",
|
|
49
|
-
"@rh-support/user-permissions": "2.1.
|
|
50
|
-
"@rh-support/utils": "2.1.
|
|
49
|
+
"@rh-support/user-permissions": "2.1.47",
|
|
50
|
+
"@rh-support/utils": "2.1.36",
|
|
51
51
|
"localforage": "^1.10.0",
|
|
52
52
|
"lodash": "^4.17.21",
|
|
53
53
|
"pegjs": "^0.10.0",
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"defaults and supports es6-module",
|
|
97
97
|
"maintained node versions"
|
|
98
98
|
],
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "fc8601c40a613c50ddac01f11fc79c9f26544aa5"
|
|
100
100
|
}
|