@rh-support/cases 2.0.16 → 2.0.18
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":"useFilterStateOnLoad.d.ts","sourceRoot":"","sources":["../../../src/hooks/useFilterStateOnLoad.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useFilterStateOnLoad.d.ts","sourceRoot":"","sources":["../../../src/hooks/useFilterStateOnLoad.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAI1D,wBAAgB,oBAAoB;wBAkBd,MAAM,mBACH,MAAM,sBACH,MAAM,cACd,mBAAmB;;;;EA+DtC"}
|
|
@@ -11,23 +11,27 @@ export function useFilterStateOnLoad() {
|
|
|
11
11
|
const savesSearches = find(hydraUserPreferences.data, (pref) => pref.key === UserPreferencesKeys.caseSavedSearchFilters);
|
|
12
12
|
const savedSearchesObj = useMemo(() => ((savesSearches === null || savesSearches === void 0 ? void 0 : savesSearches.value) ? JSON.parse(savesSearches.value) : {}), [savesSearches]);
|
|
13
13
|
const set = (queryFromUrl, pageSizeFromUrl, currentPageFromUrl, searchType) => {
|
|
14
|
-
const filterStateFromURL = createFilterStateFromUrlQuery(queryFromUrl, globalMetadataState, pageSizeFromUrl, currentPageFromUrl, searchType);
|
|
15
14
|
let savedSearchFilterState = null;
|
|
16
15
|
const defaultSavedSearchKey = findKey(savedSearchesObj, { defaultChecked: true });
|
|
17
16
|
if (defaultSavedSearchKey) {
|
|
18
17
|
const { filterState: filterStateSaved, queryString, type, sortState, } = savedSearchesObj[defaultSavedSearchKey];
|
|
19
18
|
savedSearchFilterState = Object.assign(Object.assign({}, filterState), { sortInfo: sortState, filterQueryInfo: Object.assign(Object.assign({}, filterState.filterQueryInfo), { queryString, type }), filterInfo: Object.assign(Object.assign({}, initialCaseFilterState.filterInfo), filterStateSaved) });
|
|
20
19
|
}
|
|
21
|
-
let defaultFilterState = queryFromUrl
|
|
22
|
-
? filterStateFromURL
|
|
23
|
-
: savedSearchFilterState
|
|
24
|
-
? savedSearchFilterState
|
|
25
|
-
: filterState;
|
|
26
20
|
const defaultGroup = (caseGroups.data || []).find((group) => group.isDefault);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
const [urlQuery] = (queryFromUrl || '').split(/ orderBy /i);
|
|
22
|
+
/**
|
|
23
|
+
When user lands on page for the first time:
|
|
24
|
+
If we have any query in url(for example redirect from dashboard), we apply the query, if not
|
|
25
|
+
check if user has any saved search then we apply the save search, if not
|
|
26
|
+
check if user has default group the apply group filter,
|
|
27
|
+
non of the above, we apply default search values
|
|
28
|
+
*/
|
|
29
|
+
let defaultFilterState = urlQuery && urlQuery !== 'undefined'
|
|
30
|
+
? createFilterStateFromUrlQuery(queryFromUrl, globalMetadataState, pageSizeFromUrl, currentPageFromUrl, searchType)
|
|
31
|
+
: defaultSavedSearchKey
|
|
32
|
+
? savedSearchFilterState
|
|
33
|
+
: !!(defaultGroup === null || defaultGroup === void 0 ? void 0 : defaultGroup.name)
|
|
34
|
+
? Object.assign(Object.assign({}, filterState), { filterInfo: Object.assign(Object.assign({}, filterState.filterInfo), { [SolrKeys.group]: [{ key: defaultGroup.groupNum, value: defaultGroup.name }] }) }) : filterState;
|
|
31
35
|
return {
|
|
32
36
|
initFilterState: defaultFilterState,
|
|
33
37
|
defaultSearchName: defaultSavedSearchKey && !queryFromUrl ? defaultSavedSearchKey : '',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/cases",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.18",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"@patternfly/pfe-collapse": "1.12.3",
|
|
47
47
|
"@patternfly/react-core": "4.264.0",
|
|
48
48
|
"@patternfly/react-table": "4.111.33",
|
|
49
|
-
"@rh-support/components": "2.0.
|
|
50
|
-
"@rh-support/react-context": "2.0.
|
|
49
|
+
"@rh-support/components": "2.0.9",
|
|
50
|
+
"@rh-support/react-context": "2.0.9",
|
|
51
51
|
"@rh-support/types": "2.0.2",
|
|
52
|
-
"@rh-support/user-permissions": "2.0.
|
|
53
|
-
"@rh-support/utils": "2.0.
|
|
52
|
+
"@rh-support/user-permissions": "2.0.9",
|
|
53
|
+
"@rh-support/utils": "2.0.9",
|
|
54
54
|
"i18next": "^19.0.1",
|
|
55
55
|
"localforage": "^1.10.0",
|
|
56
56
|
"lodash": "^4.17.21",
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
"defaults and supports es6-module",
|
|
94
94
|
"maintained node versions"
|
|
95
95
|
],
|
|
96
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "c8c300debff17f7a569d204850217ab7dfed7fb6"
|
|
97
97
|
}
|