@rh-support/cases 0.2.93 → 0.2.96
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":"BookmarkedSearchesSelector.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-search/BookmarkedSearchesSelector.tsx"],"names":[],"mappings":"AAwBA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAWhE,UAAU,MAAM;IACZ,uBAAuB,EAAE,MAAM,CAAC;IAChC,iBAAiB,EAAE,mBAAmB,CAAC;IACvC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,sBAAsB,EAAE,MAAM,CAAC;CAClC;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"BookmarkedSearchesSelector.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-search/BookmarkedSearchesSelector.tsx"],"names":[],"mappings":"AAwBA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAWhE,UAAU,MAAM;IACZ,uBAAuB,EAAE,MAAM,CAAC;IAChC,iBAAiB,EAAE,mBAAmB,CAAC;IACvC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,sBAAsB,EAAE,MAAM,CAAC;CAClC;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,eAiRvD"}
|
|
@@ -1,8 +1,17 @@
|
|
|
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
|
+
};
|
|
1
10
|
import { Button, ButtonVariant, Dropdown, DropdownItem, DropdownSeparator, DropdownToggle, DropdownToggleAction, Split, SplitItem, } from '@patternfly/react-core';
|
|
2
11
|
import PencilAltIcon from '@patternfly/react-icons/dist/js/icons/pencil-alt-icon';
|
|
3
12
|
import StarIcon from '@patternfly/react-icons/dist/js/icons/star-icon';
|
|
4
13
|
import { ConfirmationServiceProvider } from '@rh-support/components';
|
|
5
|
-
import { GlobalMetadataStateContext, UserPreferencesKeys } from '@rh-support/react-context';
|
|
14
|
+
import { GlobalMetadataStateContext, UserPreferencesKeys, useUserPreferences } from '@rh-support/react-context';
|
|
6
15
|
import filter from 'lodash/filter';
|
|
7
16
|
import find from 'lodash/find';
|
|
8
17
|
import flatMap from 'lodash/flatMap';
|
|
@@ -29,6 +38,7 @@ export function BookmarkedSearchesSelector(props) {
|
|
|
29
38
|
const isUpdatingFilters = useRef(false);
|
|
30
39
|
const [isAddingBookmarkSearch, setIsAddingBookmarkSearch] = useState(false);
|
|
31
40
|
const [selectedSearchNameToEdit, setSelectedSearchNameToEdit] = useState('');
|
|
41
|
+
const [userPreferredSearch, setUserPreferredSearch] = useState('');
|
|
32
42
|
useEffect(() => {
|
|
33
43
|
// get saved searches from user preferences
|
|
34
44
|
const savedFiltrerKey = UserPreferencesKeys.caseSavedSearchFilters;
|
|
@@ -38,6 +48,47 @@ export function BookmarkedSearchesSelector(props) {
|
|
|
38
48
|
const recentSearch = find(hydraUserPreferences.data, (pref) => pref.key === mostRecentKey);
|
|
39
49
|
(recentSearch === null || recentSearch === void 0 ? void 0 : recentSearch.value) && setMostRecentSearch(JSON.parse(recentSearch.value));
|
|
40
50
|
}, [hydraUserPreferences.data]);
|
|
51
|
+
const { getAutoRestoreSavedSearchPreference } = useUserPreferences();
|
|
52
|
+
const userOriginalRestorePref = () => __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
try {
|
|
54
|
+
const userOriginalRestorePref = yield getAutoRestoreSavedSearchPreference();
|
|
55
|
+
setUserPreferredSearch(userOriginalRestorePref);
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
console.log(error);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
userOriginalRestorePref();
|
|
63
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
64
|
+
}, []);
|
|
65
|
+
const restoreLatestText = 'Restore latest';
|
|
66
|
+
const emptySearchPlaceholderText = 'Select an option';
|
|
67
|
+
const recentSearchLoaded = useRef(false);
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
switch (userPreferredSearch) {
|
|
70
|
+
case restoreLatestText:
|
|
71
|
+
if (!isEmpty(mostRecentSearch) && !recentSearchLoaded.current) {
|
|
72
|
+
onBookmarkSelectorChange('', mostRecentSearch, false)();
|
|
73
|
+
recentSearchLoaded.current = true;
|
|
74
|
+
}
|
|
75
|
+
break;
|
|
76
|
+
case emptySearchPlaceholderText:
|
|
77
|
+
if (!recentSearchLoaded.current) {
|
|
78
|
+
clearFilters(dispatch, true);
|
|
79
|
+
recentSearchLoaded.current = true;
|
|
80
|
+
}
|
|
81
|
+
break;
|
|
82
|
+
default:
|
|
83
|
+
if (!isEmpty(userPreferredSearch) && !recentSearchLoaded.current) {
|
|
84
|
+
bookmarkedSearches[userPreferredSearch] &&
|
|
85
|
+
onBookmarkSelectorChange(userPreferredSearch, bookmarkedSearches[userPreferredSearch], false)();
|
|
86
|
+
recentSearchLoaded.current = true;
|
|
87
|
+
}
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
91
|
+
}, [mostRecentSearch, userPreferredSearch]);
|
|
41
92
|
useEffect(() => {
|
|
42
93
|
var _a;
|
|
43
94
|
// enable save search button as soon as user changes something in the input search box
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/cases",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.96",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@cee-eng/hydrajs": "4.12.6",
|
|
30
30
|
"@patternfly/patternfly": "4.185.1",
|
|
31
31
|
"@patternfly/pfe-collapse": "1.12.3",
|
|
32
|
-
"@patternfly/react-core": "4.
|
|
32
|
+
"@patternfly/react-core": "4.202.16",
|
|
33
33
|
"@patternfly/react-table": "4.71.16",
|
|
34
34
|
"@rh-support/api": "0.3.9",
|
|
35
35
|
"@rh-support/components": "^0.1.3",
|
|
@@ -50,13 +50,13 @@
|
|
|
50
50
|
"@cee-eng/hydrajs": "4.12.6",
|
|
51
51
|
"@patternfly/patternfly": "4.185.1",
|
|
52
52
|
"@patternfly/pfe-collapse": "1.12.3",
|
|
53
|
-
"@patternfly/react-core": "4.
|
|
53
|
+
"@patternfly/react-core": "4.202.16",
|
|
54
54
|
"@patternfly/react-table": "4.71.16",
|
|
55
55
|
"@rh-support/api": "0.3.24",
|
|
56
|
-
"@rh-support/components": "1.1.
|
|
57
|
-
"@rh-support/react-context": "0.2.
|
|
56
|
+
"@rh-support/components": "1.1.76",
|
|
57
|
+
"@rh-support/react-context": "0.2.82",
|
|
58
58
|
"@rh-support/types": "0.2.0",
|
|
59
|
-
"@rh-support/user-permissions": "0.2.
|
|
59
|
+
"@rh-support/user-permissions": "0.2.63",
|
|
60
60
|
"@rh-support/utils": "0.2.46",
|
|
61
61
|
"i18next": "^19.0.1",
|
|
62
62
|
"localforage": "^1.7.3",
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
"not ie <= 11",
|
|
102
102
|
"not op_mini all"
|
|
103
103
|
],
|
|
104
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "1359173d6efb7ece2bd1d0760c001e053bc29893"
|
|
105
105
|
}
|