@reltio/components 1.4.1848 → 1.4.1850
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/cjs/SaveSegmentDialog/SaveSegmentDialog.d.ts +8 -0
- package/cjs/SaveSegmentDialog/SaveSegmentDialog.js +129 -0
- package/cjs/SaveSegmentDialog/SaveSegmentDialog.test.d.ts +1 -0
- package/cjs/SaveSegmentDialog/SaveSegmentDialog.test.js +214 -0
- package/cjs/SaveSegmentDialog/index.d.ts +1 -0
- package/cjs/SaveSegmentDialog/index.js +5 -0
- package/cjs/SaveSegmentDialog/styles.d.ts +1 -0
- package/cjs/SaveSegmentDialog/styles.js +15 -0
- package/cjs/features/graph/DataModelGraph/DataModelGraph.d.ts +2 -1
- package/cjs/features/graph/DataModelGraph/DataModelGraph.js +2 -2
- package/cjs/features/graph/DataModelGraph/DataModelGraph.test.js +1 -1
- package/cjs/features/graph/DataModelGraph/components/DataModelCircleLayout/DataModelCircleLayuot.d.ts +2 -1
- package/cjs/features/graph/DataModelGraph/components/DataModelCircleLayout/DataModelCircleLayuot.js +3 -2
- package/cjs/features/graph/DataModelGraph/hooks/useDataModelGraphAppearance.d.ts +2 -1
- package/cjs/features/graph/DataModelGraph/hooks/useDataModelGraphAppearance.js +5 -2
- package/cjs/features/graph/DataModelGraph/hooks/useDataModelGraphAppearance.test.js +7 -1
- package/cjs/hooks/useSavedSearchesRequest/index.d.ts +1 -0
- package/cjs/hooks/useSavedSearchesRequest/index.js +5 -0
- package/cjs/hooks/useSavedSearchesRequest/requests.d.ts +6 -0
- package/cjs/hooks/useSavedSearchesRequest/requests.js +72 -0
- package/cjs/hooks/useSavedSearchesRequest/useSavedSearchesRequest.d.ts +76 -0
- package/cjs/hooks/useSavedSearchesRequest/useSavedSearchesRequest.js +255 -0
- package/cjs/hooks/useSavedSearchesRequest/useSavedSearchesRequest.test.d.ts +1 -0
- package/cjs/hooks/useSavedSearchesRequest/useSavedSearchesRequest.test.js +743 -0
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +3 -1
- package/esm/SaveSegmentDialog/SaveSegmentDialog.d.ts +8 -0
- package/esm/SaveSegmentDialog/SaveSegmentDialog.js +99 -0
- package/esm/SaveSegmentDialog/SaveSegmentDialog.test.d.ts +1 -0
- package/esm/SaveSegmentDialog/SaveSegmentDialog.test.js +209 -0
- package/esm/SaveSegmentDialog/index.d.ts +1 -0
- package/esm/SaveSegmentDialog/index.js +1 -0
- package/esm/SaveSegmentDialog/styles.d.ts +1 -0
- package/esm/SaveSegmentDialog/styles.js +12 -0
- package/esm/features/graph/DataModelGraph/DataModelGraph.d.ts +2 -1
- package/esm/features/graph/DataModelGraph/DataModelGraph.js +2 -2
- package/esm/features/graph/DataModelGraph/DataModelGraph.test.js +1 -1
- package/esm/features/graph/DataModelGraph/components/DataModelCircleLayout/DataModelCircleLayuot.d.ts +2 -1
- package/esm/features/graph/DataModelGraph/components/DataModelCircleLayout/DataModelCircleLayuot.js +3 -2
- package/esm/features/graph/DataModelGraph/hooks/useDataModelGraphAppearance.d.ts +2 -1
- package/esm/features/graph/DataModelGraph/hooks/useDataModelGraphAppearance.js +5 -2
- package/esm/features/graph/DataModelGraph/hooks/useDataModelGraphAppearance.test.js +7 -1
- package/esm/hooks/useSavedSearchesRequest/index.d.ts +1 -0
- package/esm/hooks/useSavedSearchesRequest/index.js +1 -0
- package/esm/hooks/useSavedSearchesRequest/requests.d.ts +6 -0
- package/esm/hooks/useSavedSearchesRequest/requests.js +68 -0
- package/esm/hooks/useSavedSearchesRequest/useSavedSearchesRequest.d.ts +76 -0
- package/esm/hooks/useSavedSearchesRequest/useSavedSearchesRequest.js +251 -0
- package/esm/hooks/useSavedSearchesRequest/useSavedSearchesRequest.test.d.ts +1 -0
- package/esm/hooks/useSavedSearchesRequest/useSavedSearchesRequest.test.js +738 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/package.json +1 -1
- package/cjs/hooks/useSavedSearchesRequest.d.ts +0 -23
- package/cjs/hooks/useSavedSearchesRequest.js +0 -224
- package/esm/hooks/useSavedSearchesRequest.d.ts +0 -23
- package/esm/hooks/useSavedSearchesRequest.js +0 -220
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SavedSearchData, SavedSearchesOptions } from '@reltio/mdm-sdk';
|
|
3
|
+
import { RequestStates } from '../../types';
|
|
4
|
+
type RequestsStates = {
|
|
5
|
+
loading: RequestStates;
|
|
6
|
+
creating: RequestStates;
|
|
7
|
+
updating: RequestStates;
|
|
8
|
+
deleting: RequestStates;
|
|
9
|
+
};
|
|
10
|
+
type Props = {
|
|
11
|
+
options?: SavedSearchesOptions;
|
|
12
|
+
defaultRowsPerPage: number;
|
|
13
|
+
queryEstimatorEnabled?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare const useSavedSearchesRequest: ({ options, defaultRowsPerPage, queryEstimatorEnabled }: Props) => {
|
|
16
|
+
states: RequestsStates;
|
|
17
|
+
data: {
|
|
18
|
+
uri: string;
|
|
19
|
+
name: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
query: string;
|
|
22
|
+
isFavorite: boolean;
|
|
23
|
+
uiState: Record<string, any>;
|
|
24
|
+
createDate: number;
|
|
25
|
+
updateDate: number;
|
|
26
|
+
isPublic: boolean;
|
|
27
|
+
count: number;
|
|
28
|
+
owner: string;
|
|
29
|
+
type: import("@reltio/mdm-sdk").SavedSearchType;
|
|
30
|
+
isLoadingTotal?: boolean;
|
|
31
|
+
}[];
|
|
32
|
+
total: number;
|
|
33
|
+
page: number;
|
|
34
|
+
rowsPerPage: number;
|
|
35
|
+
updatePage: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
36
|
+
updateRowsPerPage: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
37
|
+
reload: () => Promise<void>;
|
|
38
|
+
loadTotalForSearchByUri: (uri: string) => Promise<void>;
|
|
39
|
+
createSearch: (savedSearch: Partial<SavedSearchData> & {
|
|
40
|
+
name: string;
|
|
41
|
+
query: string;
|
|
42
|
+
uiState: Record<string, any>;
|
|
43
|
+
}) => Promise<{
|
|
44
|
+
readonly success: true;
|
|
45
|
+
readonly result: SavedSearchData;
|
|
46
|
+
error?: undefined;
|
|
47
|
+
} | {
|
|
48
|
+
readonly success: false;
|
|
49
|
+
readonly error: any;
|
|
50
|
+
readonly result?: undefined;
|
|
51
|
+
}>;
|
|
52
|
+
updateSearch: (savedSearch: SavedSearchData) => Promise<{
|
|
53
|
+
success: boolean;
|
|
54
|
+
result: SavedSearchData;
|
|
55
|
+
error?: undefined;
|
|
56
|
+
} | {
|
|
57
|
+
success: boolean;
|
|
58
|
+
error: any;
|
|
59
|
+
readonly result?: undefined;
|
|
60
|
+
}>;
|
|
61
|
+
deleteSearch: (uri: string) => Promise<{
|
|
62
|
+
success: boolean;
|
|
63
|
+
result: {
|
|
64
|
+
success: true;
|
|
65
|
+
} | {
|
|
66
|
+
success: false;
|
|
67
|
+
error: unknown;
|
|
68
|
+
};
|
|
69
|
+
error?: undefined;
|
|
70
|
+
} | {
|
|
71
|
+
success: boolean;
|
|
72
|
+
error: any;
|
|
73
|
+
readonly result?: undefined;
|
|
74
|
+
}>;
|
|
75
|
+
};
|
|
76
|
+
export {};
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
49
|
+
var t = {};
|
|
50
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
51
|
+
t[p] = s[p];
|
|
52
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
53
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
54
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
55
|
+
t[p[i]] = s[p[i]];
|
|
56
|
+
}
|
|
57
|
+
return t;
|
|
58
|
+
};
|
|
59
|
+
import { createSavedSearch, deleteSavedSearch, getSavedSearches, getTotalsForQuery, isAbortError, replacePlaceholdersInQuery, updateSavedSearch } from '@reltio/mdm-sdk';
|
|
60
|
+
import { propEq, assocPath, isNil } from 'ramda';
|
|
61
|
+
import { useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
|
62
|
+
import { PageRequestsAbortingContext } from '../../contexts';
|
|
63
|
+
import { RequestStates } from '../../types';
|
|
64
|
+
import { showDefaultErrorMessage } from '../../core';
|
|
65
|
+
import { getTotalsForSavedSearches } from './requests';
|
|
66
|
+
export var useSavedSearchesRequest = function (_a) {
|
|
67
|
+
var options = _a.options, defaultRowsPerPage = _a.defaultRowsPerPage, queryEstimatorEnabled = _a.queryEstimatorEnabled;
|
|
68
|
+
var _b = useState(0), page = _b[0], setPage = _b[1];
|
|
69
|
+
var _c = useState(defaultRowsPerPage), rowsPerPage = _c[0], setRowsPerPage = _c[1];
|
|
70
|
+
var _d = useState([]), data = _d[0], setData = _d[1];
|
|
71
|
+
var _e = useState(0), total = _e[0], setTotal = _e[1];
|
|
72
|
+
var _f = useState({}), profilesCountMap = _f[0], setProfilesCountMap = _f[1];
|
|
73
|
+
var _g = useState({
|
|
74
|
+
loading: RequestStates.INIT,
|
|
75
|
+
creating: RequestStates.INIT,
|
|
76
|
+
updating: RequestStates.INIT,
|
|
77
|
+
deleting: RequestStates.INIT
|
|
78
|
+
}), requestsStates = _g[0], setRequestsStates = _g[1];
|
|
79
|
+
var signal = useContext(PageRequestsAbortingContext);
|
|
80
|
+
var allOptions = useMemo(function () { return (__assign(__assign({}, options), { max: rowsPerPage, offset: rowsPerPage * page })); }, [options, page, rowsPerPage]);
|
|
81
|
+
var savedSearchesWithCount = useMemo(function () {
|
|
82
|
+
return data.map(function (savedSearch) {
|
|
83
|
+
var _a;
|
|
84
|
+
var _b = (_a = profilesCountMap[savedSearch.uri]) !== null && _a !== void 0 ? _a : {}, count = _b.count, isLoading = _b.isLoading;
|
|
85
|
+
var savedSearchWithCount = __assign({}, savedSearch);
|
|
86
|
+
if (!isNil(count))
|
|
87
|
+
savedSearchWithCount.count = count;
|
|
88
|
+
if (!isNil(isLoading))
|
|
89
|
+
savedSearchWithCount.isLoadingTotal = isLoading;
|
|
90
|
+
return savedSearchWithCount;
|
|
91
|
+
});
|
|
92
|
+
}, [data, profilesCountMap]);
|
|
93
|
+
var updateRequestState = useCallback(function (type, state) {
|
|
94
|
+
setRequestsStates(function (prevRequestsStates) {
|
|
95
|
+
var _a;
|
|
96
|
+
return (__assign(__assign({}, prevRequestsStates), (_a = {}, _a[type] = state, _a)));
|
|
97
|
+
});
|
|
98
|
+
}, []);
|
|
99
|
+
var loadSavedSearches = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
100
|
+
var countResults, restOptions, _a, _b, savedSearches, total_1, totals, error_1;
|
|
101
|
+
return __generator(this, function (_c) {
|
|
102
|
+
switch (_c.label) {
|
|
103
|
+
case 0:
|
|
104
|
+
updateRequestState('loading', RequestStates.LOADING);
|
|
105
|
+
_c.label = 1;
|
|
106
|
+
case 1:
|
|
107
|
+
_c.trys.push([1, 5, , 6]);
|
|
108
|
+
countResults = allOptions.countResults, restOptions = __rest(allOptions, ["countResults"]);
|
|
109
|
+
return [4 /*yield*/, getSavedSearches(restOptions, signal)];
|
|
110
|
+
case 2:
|
|
111
|
+
_a = _c.sent(), _b = _a.result, savedSearches = _b === void 0 ? [] : _b, total_1 = _a.total;
|
|
112
|
+
if (!countResults) return [3 /*break*/, 4];
|
|
113
|
+
return [4 /*yield*/, getTotalsForSavedSearches(savedSearches, queryEstimatorEnabled, signal)];
|
|
114
|
+
case 3:
|
|
115
|
+
totals = _c.sent();
|
|
116
|
+
setProfilesCountMap(totals);
|
|
117
|
+
_c.label = 4;
|
|
118
|
+
case 4:
|
|
119
|
+
setData(savedSearches || []);
|
|
120
|
+
setTotal(total_1);
|
|
121
|
+
updateRequestState('loading', RequestStates.LOADED);
|
|
122
|
+
return [3 /*break*/, 6];
|
|
123
|
+
case 5:
|
|
124
|
+
error_1 = _c.sent();
|
|
125
|
+
console.warn(error_1); // eslint-disable-line
|
|
126
|
+
if (!isAbortError(error_1)) {
|
|
127
|
+
updateRequestState('loading', RequestStates.ERROR);
|
|
128
|
+
setData([]);
|
|
129
|
+
}
|
|
130
|
+
return [3 /*break*/, 6];
|
|
131
|
+
case 6: return [2 /*return*/];
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}); }, [allOptions, signal, queryEstimatorEnabled, updateRequestState]);
|
|
135
|
+
var loadTotalForUri = useCallback(function (uri) { return __awaiter(void 0, void 0, void 0, function () {
|
|
136
|
+
var savedSearch, total_2, e_1;
|
|
137
|
+
return __generator(this, function (_a) {
|
|
138
|
+
switch (_a.label) {
|
|
139
|
+
case 0:
|
|
140
|
+
savedSearch = data.find(propEq('uri', uri));
|
|
141
|
+
setProfilesCountMap(assocPath([uri, 'isLoading'], true));
|
|
142
|
+
_a.label = 1;
|
|
143
|
+
case 1:
|
|
144
|
+
_a.trys.push([1, 3, 4, 5]);
|
|
145
|
+
return [4 /*yield*/, getTotalsForQuery(replacePlaceholdersInQuery(savedSearch.query), false, signal)];
|
|
146
|
+
case 2:
|
|
147
|
+
total_2 = (_a.sent()).total;
|
|
148
|
+
setProfilesCountMap(assocPath([uri, 'count'], total_2));
|
|
149
|
+
return [3 /*break*/, 5];
|
|
150
|
+
case 3:
|
|
151
|
+
e_1 = _a.sent();
|
|
152
|
+
console.warn(e_1);
|
|
153
|
+
return [3 /*break*/, 5];
|
|
154
|
+
case 4:
|
|
155
|
+
setProfilesCountMap(assocPath([uri, 'isLoading'], false));
|
|
156
|
+
return [7 /*endfinally*/];
|
|
157
|
+
case 5: return [2 /*return*/];
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}); }, [data, signal]);
|
|
161
|
+
var createSearch = useCallback(function (savedSearch) { return __awaiter(void 0, void 0, void 0, function () {
|
|
162
|
+
var type, result, error_2;
|
|
163
|
+
return __generator(this, function (_a) {
|
|
164
|
+
switch (_a.label) {
|
|
165
|
+
case 0:
|
|
166
|
+
updateRequestState('creating', RequestStates.LOADING);
|
|
167
|
+
_a.label = 1;
|
|
168
|
+
case 1:
|
|
169
|
+
_a.trys.push([1, 3, , 4]);
|
|
170
|
+
type = allOptions.type;
|
|
171
|
+
return [4 /*yield*/, createSavedSearch([__assign(__assign({}, savedSearch), { type: type })])];
|
|
172
|
+
case 2:
|
|
173
|
+
result = _a.sent();
|
|
174
|
+
page === 0 ? loadSavedSearches() : setPage(0);
|
|
175
|
+
updateRequestState('creating', RequestStates.LOADED);
|
|
176
|
+
return [2 /*return*/, { success: true, result: result }];
|
|
177
|
+
case 3:
|
|
178
|
+
error_2 = _a.sent();
|
|
179
|
+
showDefaultErrorMessage(error_2);
|
|
180
|
+
updateRequestState('creating', RequestStates.ERROR);
|
|
181
|
+
return [2 /*return*/, { success: false, error: error_2 }];
|
|
182
|
+
case 4: return [2 /*return*/];
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
}); }, [allOptions, page, updateRequestState, loadSavedSearches]);
|
|
186
|
+
var updateSearch = useCallback(function (savedSearch) { return __awaiter(void 0, void 0, void 0, function () {
|
|
187
|
+
var result, error_3;
|
|
188
|
+
return __generator(this, function (_a) {
|
|
189
|
+
switch (_a.label) {
|
|
190
|
+
case 0:
|
|
191
|
+
updateRequestState('updating', RequestStates.LOADING);
|
|
192
|
+
_a.label = 1;
|
|
193
|
+
case 1:
|
|
194
|
+
_a.trys.push([1, 3, , 4]);
|
|
195
|
+
return [4 /*yield*/, updateSavedSearch(savedSearch)];
|
|
196
|
+
case 2:
|
|
197
|
+
result = _a.sent();
|
|
198
|
+
setData(function (prevData) { return prevData.map(function (item) { return (item.uri === savedSearch.uri ? savedSearch : item); }); });
|
|
199
|
+
updateRequestState('updating', RequestStates.LOADED);
|
|
200
|
+
return [2 /*return*/, { success: true, result: result }];
|
|
201
|
+
case 3:
|
|
202
|
+
error_3 = _a.sent();
|
|
203
|
+
showDefaultErrorMessage(error_3);
|
|
204
|
+
updateRequestState('updating', RequestStates.ERROR);
|
|
205
|
+
return [2 /*return*/, { success: false, error: error_3 }];
|
|
206
|
+
case 4: return [2 /*return*/];
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
}); }, [updateRequestState]);
|
|
210
|
+
var deleteSearch = useCallback(function (uri) { return __awaiter(void 0, void 0, void 0, function () {
|
|
211
|
+
var result, error_4;
|
|
212
|
+
return __generator(this, function (_a) {
|
|
213
|
+
switch (_a.label) {
|
|
214
|
+
case 0:
|
|
215
|
+
updateRequestState('deleting', RequestStates.LOADING);
|
|
216
|
+
_a.label = 1;
|
|
217
|
+
case 1:
|
|
218
|
+
_a.trys.push([1, 3, , 4]);
|
|
219
|
+
return [4 /*yield*/, deleteSavedSearch({ uri: uri })];
|
|
220
|
+
case 2:
|
|
221
|
+
result = _a.sent();
|
|
222
|
+
loadSavedSearches();
|
|
223
|
+
updateRequestState('deleting', RequestStates.LOADED);
|
|
224
|
+
return [2 /*return*/, { success: true, result: result }];
|
|
225
|
+
case 3:
|
|
226
|
+
error_4 = _a.sent();
|
|
227
|
+
showDefaultErrorMessage(error_4);
|
|
228
|
+
updateRequestState('deleting', RequestStates.ERROR);
|
|
229
|
+
return [2 /*return*/, { success: false, error: error_4 }];
|
|
230
|
+
case 4: return [2 /*return*/];
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
}); }, [updateRequestState, loadSavedSearches]);
|
|
234
|
+
useEffect(function () {
|
|
235
|
+
loadSavedSearches();
|
|
236
|
+
}, [loadSavedSearches]);
|
|
237
|
+
return {
|
|
238
|
+
states: requestsStates,
|
|
239
|
+
data: savedSearchesWithCount,
|
|
240
|
+
total: total,
|
|
241
|
+
page: page,
|
|
242
|
+
rowsPerPage: rowsPerPage,
|
|
243
|
+
updatePage: setPage,
|
|
244
|
+
updateRowsPerPage: setRowsPerPage,
|
|
245
|
+
reload: loadSavedSearches,
|
|
246
|
+
loadTotalForSearchByUri: loadTotalForUri,
|
|
247
|
+
createSearch: createSearch,
|
|
248
|
+
updateSearch: updateSearch,
|
|
249
|
+
deleteSearch: deleteSearch
|
|
250
|
+
};
|
|
251
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|