@rh-support/cases 0.2.101 → 0.3.2
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/CaseList.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseList.js +0 -4
- package/lib/esm/components/case-list/case-list-filters/CaseListFilters.js +2 -2
- package/package.json +11 -13
- package/lib/esm/components/case-list/case-list-filters/AccountsFilterWrapper.d.ts +0 -3
- package/lib/esm/components/case-list/case-list-filters/AccountsFilterWrapper.d.ts.map +0 -1
- package/lib/esm/components/case-list/case-list-filters/AccountsFilterWrapper.js +0 -10
- package/lib/esm/hooks/useMoveCacheToUserPref.d.ts +0 -4
- package/lib/esm/hooks/useMoveCacheToUserPref.d.ts.map +0 -1
- package/lib/esm/hooks/useMoveCacheToUserPref.js +0 -83
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseList.d.ts","sourceRoot":"","sources":["../../../../src/components/case-list/CaseList.tsx"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAC;AAChC,OAAO,0BAA0B,CAAC;AA4BlC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAKH,0BAA0B,EAI7B,MAAM,mBAAmB,CAAC;AAO3B,OAAO,EAAE,mBAAmB,EAAe,MAAM,cAAc,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"CaseList.d.ts","sourceRoot":"","sources":["../../../../src/components/case-list/CaseList.tsx"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAC;AAChC,OAAO,0BAA0B,CAAC;AA4BlC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAKH,0BAA0B,EAI7B,MAAM,mBAAmB,CAAC;AAO3B,OAAO,EAAE,mBAAmB,EAAe,MAAM,cAAc,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,IAAI,CAAC;AAK1C,OAAO,EAAgB,WAAW,EAA2B,MAAM,uBAAuB,CAAC;AAmC3F,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,oBAAoB,CAAC,CAAC;CACzD;AAED,MAAM,WAAW,uBAAwB,SAAQ,cAAc;IAC3D,YAAY,EAAE,cAAc,EAAE,CAAC;CAClC;AAED,oBAAY,YAAY,GAAG,0BAA0B,CAAC,WAAW,EAAE,uBAAuB,CAAC,CAAC;AAM5F,MAAM,WAAW,gBAAgB;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAC;CAChC;AAED,MAAM,WAAW,aAAa;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,eAkfrC"}
|
|
@@ -28,7 +28,6 @@ import { CaseSearchQueryType } from '../../enums/caseSearch';
|
|
|
28
28
|
import { SolrPivotKeys } from '../../enums/filters';
|
|
29
29
|
import { PageTitle } from '../../enums/pageTitle';
|
|
30
30
|
import { useFilterStateOnLoad } from '../../hooks/useFilterStateOnLoad';
|
|
31
|
-
import { useMoveCacheToUserPref } from '../../hooks/useMoveCacheToUserPref';
|
|
32
31
|
import { getCaseList } from '../../utils/caseListUtils';
|
|
33
32
|
import { createFilterStateFromUrlQuery, createURLQueryFromFilterState, FILTER_URL_CURRENT_PAGE_SEARCH_PARAM, FILTER_URL_PAGE_SIZE_SEARCH_PARAM, FILTER_URL_QUERY_SEARCH_PARAM, FILTER_URL_QUERY_TYPE, } from '../../utils/caseSearchUtils';
|
|
34
33
|
import { UpdatedCaseDataEvent } from '../../utils/constants';
|
|
@@ -66,7 +65,6 @@ export function CaseList(props) {
|
|
|
66
65
|
const filterDispatch = useContext(CaseListFilterDispatchContext);
|
|
67
66
|
const forceUpdate = useForceUpdate();
|
|
68
67
|
const isCaseListFilterPanelExanded = userPreferences.data.isCaseListFilterPanelExanded;
|
|
69
|
-
const useMoveCache = useMoveCacheToUserPref();
|
|
70
68
|
const useFilterStateInit = useFilterStateOnLoad();
|
|
71
69
|
const isBasicSearchMode = filterState.filterQueryInfo.type === CaseSearchQueryType.BASIC;
|
|
72
70
|
const prevSearchType = usePrevious(filterState.filterQueryInfo.type);
|
|
@@ -278,8 +276,6 @@ export function CaseList(props) {
|
|
|
278
276
|
// this is to check if rhcd is passed on first load
|
|
279
277
|
setRHCDValue(queryParams.rhcd);
|
|
280
278
|
}
|
|
281
|
-
// move saved user data in localstorage to user preferences db - needs to be removed after a while
|
|
282
|
-
useMoveCache.save();
|
|
283
279
|
// set filter state based on url or default saved search
|
|
284
280
|
const { initFilterState, defaultSearchName } = useFilterStateInit.set(queryFromUrl, pageSizeFromUrl, currentPageFromUrl, searchType);
|
|
285
281
|
setDefaultSavedSearchName(defaultSearchName);
|
|
@@ -2,8 +2,8 @@ import { AbilityContext, CaseListFields, resourceActions, resources } from '@rh-
|
|
|
2
2
|
import get from 'lodash/get';
|
|
3
3
|
import React, { useContext } from 'react';
|
|
4
4
|
import { SolrKeys } from '../../../enums/filters';
|
|
5
|
+
import { AccountsBookmarkedGroupFilter } from './AccountsBookmarkedGroupFilter';
|
|
5
6
|
import { AccountsFilter } from './AccountsFilter';
|
|
6
|
-
import { AccountsFilterWrapper } from './AccountsFilterWrapper';
|
|
7
7
|
import { AdditionalFilters } from './AdditionalFilters';
|
|
8
8
|
import { CreatorSsoNameFilter } from './CreatorSsoNameFilter';
|
|
9
9
|
import { GroupsFilter } from './GroupsFilter';
|
|
@@ -30,7 +30,7 @@ export const CaseListFilters = ({ filterValues, allCaseTypes, allCaseSeverities,
|
|
|
30
30
|
return (React.createElement(React.Fragment, null,
|
|
31
31
|
React.createElement("div", { className: "filter-group" },
|
|
32
32
|
!isSolrSearchDown && canReadAccountFilter && (React.createElement(AccountsFilter, { canReadBookmarkAccounts: canReadAccountFilter })),
|
|
33
|
-
!isSolrSearchDown && (canReadBookmarkAccounts || canAccessManagedAccounts) && (React.createElement(
|
|
33
|
+
!isSolrSearchDown && (canReadBookmarkAccounts || canAccessManagedAccounts) && (React.createElement(AccountsBookmarkedGroupFilter, { canManageBookmarkAccounts: canManageBookmarkAccounts, canReadBookmarkAccounts: canReadBookmarkAccounts, canAccessManagedAccounts: canAccessManagedAccounts })),
|
|
34
34
|
canAccessGroupsFilter && React.createElement(GroupsFilter, null),
|
|
35
35
|
canAccessProductsFilter && (React.createElement(ProductsFilter, { filterValues: get(filterValues, SolrKeys.product, []), isSolrSearchDown: isSolrSearchDown, allProducts: ((_a = allProducts.data) === null || _a === void 0 ? void 0 : _a.productsResult.map((p) => p.product)) || [] })),
|
|
36
36
|
canAccessSeverityFilter && (React.createElement(SeverityFilter, { filterValues: get(filterValues, SolrKeys.severity, []), isSolrSearchDown: isSolrSearchDown, allCaseSeverities: allCaseSeverities.data })),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/cases",
|
|
3
|
-
"version": "0.2
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -27,11 +27,10 @@
|
|
|
27
27
|
],
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"@cee-eng/hydrajs": "4.12.7",
|
|
30
|
-
"@patternfly/patternfly": "4.
|
|
30
|
+
"@patternfly/patternfly": "4.196.7",
|
|
31
31
|
"@patternfly/pfe-collapse": "1.12.3",
|
|
32
32
|
"@patternfly/react-core": "4.202.16",
|
|
33
33
|
"@patternfly/react-table": "4.71.16",
|
|
34
|
-
"@rh-support/api": "0.3.9",
|
|
35
34
|
"@rh-support/components": "^0.1.3",
|
|
36
35
|
"@rh-support/react-context": "^0.1.3",
|
|
37
36
|
"@rh-support/types": "^0.1.3",
|
|
@@ -39,7 +38,7 @@
|
|
|
39
38
|
"@rh-support/utils": "^0.1.3",
|
|
40
39
|
"i18next": "^19.0.1",
|
|
41
40
|
"localforage": "^1.7.3",
|
|
42
|
-
"lodash": "^4.17.
|
|
41
|
+
"lodash": "^4.17.21",
|
|
43
42
|
"react": "17.0.2",
|
|
44
43
|
"react-dom": "17.0.2",
|
|
45
44
|
"react-i18next": "^11.2.5",
|
|
@@ -48,19 +47,18 @@
|
|
|
48
47
|
},
|
|
49
48
|
"dependencies": {
|
|
50
49
|
"@cee-eng/hydrajs": "4.12.7",
|
|
51
|
-
"@patternfly/patternfly": "4.
|
|
50
|
+
"@patternfly/patternfly": "4.196.7",
|
|
52
51
|
"@patternfly/pfe-collapse": "1.12.3",
|
|
53
52
|
"@patternfly/react-core": "4.202.16",
|
|
54
53
|
"@patternfly/react-table": "4.71.16",
|
|
55
|
-
"@rh-support/
|
|
56
|
-
"@rh-support/
|
|
57
|
-
"@rh-support/react-context": "0.2.87",
|
|
54
|
+
"@rh-support/components": "1.1.82",
|
|
55
|
+
"@rh-support/react-context": "0.3.2",
|
|
58
56
|
"@rh-support/types": "0.2.0",
|
|
59
|
-
"@rh-support/user-permissions": "0.2.
|
|
60
|
-
"@rh-support/utils": "0.2.
|
|
57
|
+
"@rh-support/user-permissions": "0.2.66",
|
|
58
|
+
"@rh-support/utils": "0.2.49",
|
|
61
59
|
"i18next": "^19.0.1",
|
|
62
60
|
"localforage": "^1.7.3",
|
|
63
|
-
"lodash": "^4.17.
|
|
61
|
+
"lodash": "^4.17.21",
|
|
64
62
|
"pegjs": "^0.10.0",
|
|
65
63
|
"react": "17.0.2",
|
|
66
64
|
"react-dom": "17.0.2",
|
|
@@ -78,7 +76,7 @@
|
|
|
78
76
|
"@types/react-dom": "^17.0.9",
|
|
79
77
|
"@types/react-i18next": "^8.1.0",
|
|
80
78
|
"@types/react-router-dom": "^5.1.2",
|
|
81
|
-
"faker": "^
|
|
79
|
+
"faker": "^5.5.3"
|
|
82
80
|
},
|
|
83
81
|
"scripts": {
|
|
84
82
|
"build:watch": "../../node_modules/.bin/tsc -w -p config/tsconfig.json & npm run watch:css",
|
|
@@ -101,5 +99,5 @@
|
|
|
101
99
|
"not ie <= 11",
|
|
102
100
|
"not op_mini all"
|
|
103
101
|
],
|
|
104
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "f69fb5ac2a9d8561d300a9e7f02456268d1e2fc7"
|
|
105
103
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AccountsFilterWrapper.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/AccountsFilterWrapper.tsx"],"names":[],"mappings":"AAMA,iBAAS,qBAAqB,CAAC,KAAK,KAAA,eAYnC;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { useGlobalStateContext } from '@rh-support/react-context';
|
|
2
|
-
import { getConfigField, PCM_CONFIG_FIELD_TYPE } from '@rh-support/utils';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { AccountsBookmarkedGroupFilter } from './AccountsBookmarkedGroupFilter';
|
|
5
|
-
function AccountsFilterWrapper(props) {
|
|
6
|
-
const { globalMetadataState: { pcmConfig }, } = useGlobalStateContext();
|
|
7
|
-
const isGroupBookmarkEnabled = getConfigField(pcmConfig.data, 'isGroupBookmarkEnabled', PCM_CONFIG_FIELD_TYPE.FEATURE_FLAG);
|
|
8
|
-
return isGroupBookmarkEnabled ? React.createElement(AccountsBookmarkedGroupFilter, Object.assign({}, props)) : React.createElement(React.Fragment, null);
|
|
9
|
-
}
|
|
10
|
-
export { AccountsFilterWrapper };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useMoveCacheToUserPref.d.ts","sourceRoot":"","sources":["../../../src/hooks/useMoveCacheToUserPref.ts"],"names":[],"mappings":"AAiBA,wBAAgB,sBAAsB;;EAqHrC"}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { updateUserPreferences, useGlobalDispatchContext, useGlobalStateContext, UserPreferencesKeys, } from '@rh-support/react-context';
|
|
11
|
-
import find from 'lodash/find';
|
|
12
|
-
import { CaseCacheNamespaces } from '../enums/cache';
|
|
13
|
-
import { CaseCacheUtils } from '../utils/caseCacheUtils';
|
|
14
|
-
import { createFilterStateFromUrlQuery } from '../utils/caseSearchUtils';
|
|
15
|
-
export function useMoveCacheToUserPref() {
|
|
16
|
-
const { globalMetadataState, globalMetadataState: { loggedInUserRights, hydraUserPreferences }, } = useGlobalStateContext();
|
|
17
|
-
const dispatchToGlobalMetadataReducer = useGlobalDispatchContext();
|
|
18
|
-
const moveSelectedColumns = () => __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
const SelectedColumns = yield CaseCacheUtils.get(CaseCacheNamespaces.CASE_LIST_SELECTED_COLUMNS.name, loggedInUserRights.data.getSSOUsername());
|
|
20
|
-
if (SelectedColumns === null || SelectedColumns === void 0 ? void 0 : SelectedColumns.value) {
|
|
21
|
-
try {
|
|
22
|
-
yield updateUserPreferences(dispatchToGlobalMetadataReducer, loggedInUserRights.data.getSSOUsername(), [
|
|
23
|
-
{
|
|
24
|
-
key: UserPreferencesKeys.caseListSelectedColumns,
|
|
25
|
-
value: JSON.stringify(SelectedColumns.value),
|
|
26
|
-
},
|
|
27
|
-
], 'add');
|
|
28
|
-
CaseCacheUtils.delete(CaseCacheNamespaces.CASE_LIST_SELECTED_COLUMNS.name, loggedInUserRights.data.getSSOUsername());
|
|
29
|
-
}
|
|
30
|
-
catch (e) {
|
|
31
|
-
console.error('Could not save case list selected columns in user preferences');
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
const moveBookmarkSearches = () => __awaiter(this, void 0, void 0, function* () {
|
|
36
|
-
const bookmarkedSearchInCache = yield CaseCacheUtils.get(CaseCacheNamespaces.BOOKMARKED_CASE_SEARCHES.name, loggedInUserRights.data.getSSOUsername());
|
|
37
|
-
if (bookmarkedSearchInCache === null || bookmarkedSearchInCache === void 0 ? void 0 : bookmarkedSearchInCache.value) {
|
|
38
|
-
try {
|
|
39
|
-
const key = UserPreferencesKeys.caseSavedSearchFilters;
|
|
40
|
-
const previousBookmarkedSearches = find(hydraUserPreferences.data, (pref) => pref.key === key);
|
|
41
|
-
const previousBookmarkedSearchesObj = previousBookmarkedSearches
|
|
42
|
-
? JSON.parse(previousBookmarkedSearches.value)
|
|
43
|
-
: {};
|
|
44
|
-
yield updateUserPreferences(dispatchToGlobalMetadataReducer, loggedInUserRights.data.getSSOUsername(), [
|
|
45
|
-
{
|
|
46
|
-
key: UserPreferencesKeys.caseSavedSearchFilters,
|
|
47
|
-
value: JSON.stringify(Object.assign(Object.assign({}, bookmarkedSearchInCache.value), previousBookmarkedSearchesObj)),
|
|
48
|
-
},
|
|
49
|
-
], 'add');
|
|
50
|
-
CaseCacheUtils.delete(CaseCacheNamespaces.BOOKMARKED_CASE_SEARCHES.name, loggedInUserRights.data.getSSOUsername());
|
|
51
|
-
}
|
|
52
|
-
catch (e) {
|
|
53
|
-
console.error('Could not save filter query in user preferences');
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
const moveMostRecentSearch = () => __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
const mostRecentSearchInCache = yield CaseCacheUtils.get(CaseCacheNamespaces.CASE_LIST_FILTER_QUERY.name, loggedInUserRights.data.getSSOUsername());
|
|
59
|
-
if (mostRecentSearchInCache === null || mostRecentSearchInCache === void 0 ? void 0 : mostRecentSearchInCache.value) {
|
|
60
|
-
const recentSearchObj = createFilterStateFromUrlQuery(mostRecentSearchInCache.value, globalMetadataState);
|
|
61
|
-
try {
|
|
62
|
-
yield updateUserPreferences(dispatchToGlobalMetadataReducer, loggedInUserRights.data.getSSOUsername(), [
|
|
63
|
-
{
|
|
64
|
-
key: UserPreferencesKeys.mostRecentSearch,
|
|
65
|
-
value: JSON.stringify(recentSearchObj),
|
|
66
|
-
},
|
|
67
|
-
], 'add');
|
|
68
|
-
CaseCacheUtils.delete(CaseCacheNamespaces.CASE_LIST_FILTER_QUERY.name, loggedInUserRights.data.getSSOUsername());
|
|
69
|
-
}
|
|
70
|
-
catch (e) {
|
|
71
|
-
console.error('Could not save most recent in user preferences');
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
const save = () => {
|
|
76
|
-
moveBookmarkSearches();
|
|
77
|
-
moveMostRecentSearch();
|
|
78
|
-
moveSelectedColumns();
|
|
79
|
-
};
|
|
80
|
-
return {
|
|
81
|
-
save,
|
|
82
|
-
};
|
|
83
|
-
}
|