@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,8 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
isOpen: boolean;
|
|
3
|
+
isSaving: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
onSave: (name: string, description: string, isPublic: boolean) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare const SaveSegmentDialog: ({ isOpen, isSaving, onClose, onSave }: Props) => JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
+
function step(op) {
|
|
39
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
41
|
+
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;
|
|
42
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
+
switch (op[0]) {
|
|
44
|
+
case 0: case 1: t = op; break;
|
|
45
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
+
default:
|
|
49
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
+
if (t[2]) _.ops.pop();
|
|
54
|
+
_.trys.pop(); continue;
|
|
55
|
+
}
|
|
56
|
+
op = body.call(thisArg, _);
|
|
57
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
62
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
63
|
+
};
|
|
64
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
|
+
exports.SaveSegmentDialog = void 0;
|
|
66
|
+
var react_1 = __importStar(require("react"));
|
|
67
|
+
var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
68
|
+
var Dialog_1 = __importDefault(require("@mui/material/Dialog"));
|
|
69
|
+
var DialogTitle_1 = __importDefault(require("@mui/material/DialogTitle"));
|
|
70
|
+
var DialogContent_1 = __importDefault(require("@mui/material/DialogContent"));
|
|
71
|
+
var DialogActions_1 = __importDefault(require("@mui/material/DialogActions"));
|
|
72
|
+
var Button_1 = __importDefault(require("@mui/material/Button"));
|
|
73
|
+
var DropDownEditor_1 = require("../DropDownEditor");
|
|
74
|
+
var TextEditor_1 = require("../TextEditor");
|
|
75
|
+
var styles_1 = require("./styles");
|
|
76
|
+
var SharingOption;
|
|
77
|
+
(function (SharingOption) {
|
|
78
|
+
SharingOption["Public"] = "public";
|
|
79
|
+
SharingOption["Private"] = "private";
|
|
80
|
+
})(SharingOption || (SharingOption = {}));
|
|
81
|
+
var SHARING_OPTIONS = [
|
|
82
|
+
{ label: ui_i18n_1.default.text('Only me'), value: SharingOption.Private },
|
|
83
|
+
{ label: ui_i18n_1.default.text('All users'), value: SharingOption.Public }
|
|
84
|
+
];
|
|
85
|
+
var SaveSegmentDialog = function (_a) {
|
|
86
|
+
var isOpen = _a.isOpen, isSaving = _a.isSaving, onClose = _a.onClose, onSave = _a.onSave;
|
|
87
|
+
var styles = (0, styles_1.useStyles)();
|
|
88
|
+
var _b = (0, react_1.useState)(''), name = _b[0], setName = _b[1];
|
|
89
|
+
var _c = (0, react_1.useState)(''), description = _c[0], setDescription = _c[1];
|
|
90
|
+
var _d = (0, react_1.useState)(SharingOption.Private), share = _d[0], setShare = _d[1];
|
|
91
|
+
var isValid = name.trim() !== '';
|
|
92
|
+
var handleChangeName = (0, react_1.useCallback)(function (event) {
|
|
93
|
+
setName(event.target.value);
|
|
94
|
+
}, []);
|
|
95
|
+
var handleChangeDescription = (0, react_1.useCallback)(function (event) {
|
|
96
|
+
setDescription(event.target.value);
|
|
97
|
+
}, []);
|
|
98
|
+
var handleChangeShareWith = (0, react_1.useCallback)(function (newValue) {
|
|
99
|
+
setShare(newValue);
|
|
100
|
+
}, []);
|
|
101
|
+
var handleSave = (0, react_1.useCallback)(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
102
|
+
return __generator(this, function (_a) {
|
|
103
|
+
onSave(name, description, share === SharingOption.Public);
|
|
104
|
+
return [2 /*return*/];
|
|
105
|
+
});
|
|
106
|
+
}); }, [onSave, name, description, share]);
|
|
107
|
+
(0, react_1.useEffect)(function () {
|
|
108
|
+
if (isOpen) {
|
|
109
|
+
setName('');
|
|
110
|
+
setDescription('');
|
|
111
|
+
setShare(SharingOption.Private);
|
|
112
|
+
}
|
|
113
|
+
}, [isOpen]);
|
|
114
|
+
return (react_1.default.createElement(Dialog_1.default, { onClose: onClose, open: isOpen, PaperProps: { classes: { root: styles.root } } },
|
|
115
|
+
react_1.default.createElement(DialogTitle_1.default, null, ui_i18n_1.default.text('Save segment')),
|
|
116
|
+
react_1.default.createElement(DialogContent_1.default, { className: styles.dialogContent },
|
|
117
|
+
react_1.default.createElement(TextEditor_1.TextEditor, { label: ui_i18n_1.default.text('Name'), required: true, variant: "filled", onInput: handleChangeName, value: name, size: "small", autoFocus: true }),
|
|
118
|
+
react_1.default.createElement(TextEditor_1.TextEditor, { label: ui_i18n_1.default.text('Description (optional)'), multiline: true, variant: "filled", value: description, onInput: handleChangeDescription, size: "small", rows: 5 }),
|
|
119
|
+
react_1.default.createElement(DropDownEditor_1.DropDownEditor, { entries: SHARING_OPTIONS, TextFieldProps: {
|
|
120
|
+
required: true,
|
|
121
|
+
label: ui_i18n_1.default.text('Share with'),
|
|
122
|
+
variant: 'filled',
|
|
123
|
+
size: 'small'
|
|
124
|
+
}, value: share, onChange: handleChangeShareWith })),
|
|
125
|
+
react_1.default.createElement(DialogActions_1.default, null,
|
|
126
|
+
react_1.default.createElement(Button_1.default, { onClick: onClose }, ui_i18n_1.default.text('Cancel')),
|
|
127
|
+
react_1.default.createElement(Button_1.default, { color: "primary", onClick: handleSave, disabled: isSaving || !isValid }, ui_i18n_1.default.text('Save')))));
|
|
128
|
+
};
|
|
129
|
+
exports.SaveSegmentDialog = SaveSegmentDialog;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
+
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;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
+
};
|
|
52
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
+
var react_1 = __importDefault(require("react"));
|
|
54
|
+
var react_2 = require("@testing-library/react");
|
|
55
|
+
var user_event_1 = __importDefault(require("@testing-library/user-event"));
|
|
56
|
+
var SaveSegmentDialog_1 = require("../SaveSegmentDialog");
|
|
57
|
+
var defaultProps = {
|
|
58
|
+
isOpen: true,
|
|
59
|
+
isSaving: false,
|
|
60
|
+
onClose: jest.fn(),
|
|
61
|
+
onSave: jest.fn()
|
|
62
|
+
};
|
|
63
|
+
var setUp = function (props) {
|
|
64
|
+
if (props === void 0) { props = defaultProps; }
|
|
65
|
+
var user = user_event_1.default.setup();
|
|
66
|
+
var result = (0, react_2.render)(react_1.default.createElement(SaveSegmentDialog_1.SaveSegmentDialog, __assign({}, props)));
|
|
67
|
+
var rerender = function (props) { return result.rerender(react_1.default.createElement(SaveSegmentDialog_1.SaveSegmentDialog, __assign({}, defaultProps, props))); };
|
|
68
|
+
return __assign(__assign({}, result), { user: user, rerender: rerender });
|
|
69
|
+
};
|
|
70
|
+
describe('SaveSegmentDialog tests', function () {
|
|
71
|
+
beforeEach(function () {
|
|
72
|
+
jest.clearAllMocks();
|
|
73
|
+
});
|
|
74
|
+
it('should not render dialog if isOpen prop is false', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
75
|
+
var props, container;
|
|
76
|
+
return __generator(this, function (_a) {
|
|
77
|
+
props = __assign(__assign({}, defaultProps), { isOpen: false });
|
|
78
|
+
container = setUp(props).container;
|
|
79
|
+
expect(container).toBeEmptyDOMElement();
|
|
80
|
+
return [2 /*return*/];
|
|
81
|
+
});
|
|
82
|
+
}); });
|
|
83
|
+
it('should render main parts correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
84
|
+
return __generator(this, function (_a) {
|
|
85
|
+
setUp();
|
|
86
|
+
expect(react_2.screen.getByText('Save segment')).toBeInTheDocument();
|
|
87
|
+
expect(react_2.screen.getByText('Name')).toBeInTheDocument();
|
|
88
|
+
expect(react_2.screen.getByText('Description (optional)')).toBeInTheDocument();
|
|
89
|
+
expect(react_2.screen.getByText('Share with')).toBeInTheDocument();
|
|
90
|
+
expect(react_2.screen.getByText('Cancel')).toBeInTheDocument();
|
|
91
|
+
expect(react_2.screen.getByText('Save')).toBeInTheDocument();
|
|
92
|
+
return [2 /*return*/];
|
|
93
|
+
});
|
|
94
|
+
}); });
|
|
95
|
+
it('should clear all fields on close dialog', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
96
|
+
var _a, user, rerender;
|
|
97
|
+
return __generator(this, function (_b) {
|
|
98
|
+
switch (_b.label) {
|
|
99
|
+
case 0:
|
|
100
|
+
_a = setUp(), user = _a.user, rerender = _a.rerender;
|
|
101
|
+
return [4 /*yield*/, user.click(react_2.screen.getByText('Name'))];
|
|
102
|
+
case 1:
|
|
103
|
+
_b.sent();
|
|
104
|
+
return [4 /*yield*/, user.keyboard('test name')];
|
|
105
|
+
case 2:
|
|
106
|
+
_b.sent();
|
|
107
|
+
return [4 /*yield*/, user.click(react_2.screen.getByText('Description (optional)'))];
|
|
108
|
+
case 3:
|
|
109
|
+
_b.sent();
|
|
110
|
+
return [4 /*yield*/, user.keyboard('test description')];
|
|
111
|
+
case 4:
|
|
112
|
+
_b.sent();
|
|
113
|
+
return [4 /*yield*/, user.click(react_2.screen.getByText('Only me'))];
|
|
114
|
+
case 5:
|
|
115
|
+
_b.sent();
|
|
116
|
+
return [4 /*yield*/, user.click(react_2.screen.getByText('All users'))];
|
|
117
|
+
case 6:
|
|
118
|
+
_b.sent();
|
|
119
|
+
rerender({ isOpen: false });
|
|
120
|
+
rerender({ isOpen: true });
|
|
121
|
+
expect(react_2.screen.queryByText('test name')).not.toBeInTheDocument();
|
|
122
|
+
expect(react_2.screen.queryByText('test description')).not.toBeInTheDocument();
|
|
123
|
+
react_2.screen.getByText('Only me');
|
|
124
|
+
return [2 /*return*/];
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}); });
|
|
128
|
+
it('should disable "Save" button in case of name field is empty', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
129
|
+
var user;
|
|
130
|
+
return __generator(this, function (_a) {
|
|
131
|
+
switch (_a.label) {
|
|
132
|
+
case 0:
|
|
133
|
+
user = setUp().user;
|
|
134
|
+
expect(react_2.screen.getByText('Save')).toBeDisabled();
|
|
135
|
+
return [4 /*yield*/, user.click(react_2.screen.getByText('Name'))];
|
|
136
|
+
case 1:
|
|
137
|
+
_a.sent();
|
|
138
|
+
return [4 /*yield*/, user.keyboard(' ')];
|
|
139
|
+
case 2:
|
|
140
|
+
_a.sent();
|
|
141
|
+
expect(react_2.screen.getByText('Save')).toBeDisabled();
|
|
142
|
+
return [4 /*yield*/, user.keyboard('test')];
|
|
143
|
+
case 3:
|
|
144
|
+
_a.sent();
|
|
145
|
+
expect(react_2.screen.getByText('Save')).toBeEnabled();
|
|
146
|
+
return [2 /*return*/];
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}); });
|
|
150
|
+
it('should disable "Save" button in case of isSaving prop is true', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
151
|
+
var props, user;
|
|
152
|
+
return __generator(this, function (_a) {
|
|
153
|
+
switch (_a.label) {
|
|
154
|
+
case 0:
|
|
155
|
+
props = __assign(__assign({}, defaultProps), { isSaving: true });
|
|
156
|
+
user = setUp(props).user;
|
|
157
|
+
return [4 /*yield*/, user.click(react_2.screen.getByText('Name'))];
|
|
158
|
+
case 1:
|
|
159
|
+
_a.sent();
|
|
160
|
+
return [4 /*yield*/, user.keyboard('test')];
|
|
161
|
+
case 2:
|
|
162
|
+
_a.sent();
|
|
163
|
+
expect(react_2.screen.getByText('Save')).toBeDisabled();
|
|
164
|
+
return [2 /*return*/];
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
}); });
|
|
168
|
+
it('should call onSave callback with correct props on "Save" button click', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
169
|
+
var user;
|
|
170
|
+
return __generator(this, function (_a) {
|
|
171
|
+
switch (_a.label) {
|
|
172
|
+
case 0:
|
|
173
|
+
user = setUp().user;
|
|
174
|
+
return [4 /*yield*/, user.click(react_2.screen.getByText('Name'))];
|
|
175
|
+
case 1:
|
|
176
|
+
_a.sent();
|
|
177
|
+
return [4 /*yield*/, user.keyboard('test name')];
|
|
178
|
+
case 2:
|
|
179
|
+
_a.sent();
|
|
180
|
+
return [4 /*yield*/, user.click(react_2.screen.getByText('Description (optional)'))];
|
|
181
|
+
case 3:
|
|
182
|
+
_a.sent();
|
|
183
|
+
return [4 /*yield*/, user.keyboard('test description')];
|
|
184
|
+
case 4:
|
|
185
|
+
_a.sent();
|
|
186
|
+
return [4 /*yield*/, user.click(react_2.screen.getByText('Only me'))];
|
|
187
|
+
case 5:
|
|
188
|
+
_a.sent();
|
|
189
|
+
return [4 /*yield*/, user.click(react_2.screen.getByText('All users'))];
|
|
190
|
+
case 6:
|
|
191
|
+
_a.sent();
|
|
192
|
+
return [4 /*yield*/, user.click(react_2.screen.getByText('Save'))];
|
|
193
|
+
case 7:
|
|
194
|
+
_a.sent();
|
|
195
|
+
expect(defaultProps.onSave).toHaveBeenCalledWith('test name', 'test description', true);
|
|
196
|
+
return [2 /*return*/];
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
}); });
|
|
200
|
+
it('should call onClose callback on "Cancel" button click', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
201
|
+
var user;
|
|
202
|
+
return __generator(this, function (_a) {
|
|
203
|
+
switch (_a.label) {
|
|
204
|
+
case 0:
|
|
205
|
+
user = setUp().user;
|
|
206
|
+
return [4 /*yield*/, user.click(react_2.screen.getByText('Cancel'))];
|
|
207
|
+
case 1:
|
|
208
|
+
_a.sent();
|
|
209
|
+
expect(defaultProps.onClose).toHaveBeenCalled();
|
|
210
|
+
return [2 /*return*/];
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
}); });
|
|
214
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SaveSegmentDialog } from './SaveSegmentDialog';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SaveSegmentDialog = void 0;
|
|
4
|
+
var SaveSegmentDialog_1 = require("./SaveSegmentDialog");
|
|
5
|
+
Object.defineProperty(exports, "SaveSegmentDialog", { enumerable: true, get: function () { return SaveSegmentDialog_1.SaveSegmentDialog; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"root" | "dialogContent">;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useStyles = void 0;
|
|
4
|
+
var styles_1 = require("@mui/styles");
|
|
5
|
+
exports.useStyles = (0, styles_1.makeStyles)({
|
|
6
|
+
root: {
|
|
7
|
+
minWidth: '600px',
|
|
8
|
+
minHeight: '280px'
|
|
9
|
+
},
|
|
10
|
+
dialogContent: {
|
|
11
|
+
display: 'flex',
|
|
12
|
+
flexDirection: 'column',
|
|
13
|
+
gap: '20px'
|
|
14
|
+
}
|
|
15
|
+
});
|
|
@@ -7,6 +7,7 @@ type Props = {
|
|
|
7
7
|
onNodeClick: (nodeId: string) => void;
|
|
8
8
|
selectedEdge: string;
|
|
9
9
|
onEdgeLabelClick: (edgeId: string, event: MouseEvent) => void;
|
|
10
|
+
hideInteractionTypes?: boolean;
|
|
10
11
|
};
|
|
11
|
-
export declare const DataModelGraph: ({ graph, children, selectedNode, onNodeClick, selectedEdge, onEdgeLabelClick }: Props) => JSX.Element;
|
|
12
|
+
export declare const DataModelGraph: ({ graph, children, selectedNode, onNodeClick, selectedEdge, onEdgeLabelClick, hideInteractionTypes }: Props) => JSX.Element;
|
|
12
13
|
export default DataModelGraph;
|
|
@@ -14,12 +14,12 @@ var settings = {
|
|
|
14
14
|
zIndex: true
|
|
15
15
|
};
|
|
16
16
|
var DataModelGraph = function (_a) {
|
|
17
|
-
var graph = _a.graph, children = _a.children, selectedNode = _a.selectedNode, onNodeClick = _a.onNodeClick, selectedEdge = _a.selectedEdge, onEdgeLabelClick = _a.onEdgeLabelClick;
|
|
17
|
+
var graph = _a.graph, children = _a.children, selectedNode = _a.selectedNode, onNodeClick = _a.onNodeClick, selectedEdge = _a.selectedEdge, onEdgeLabelClick = _a.onEdgeLabelClick, hideInteractionTypes = _a.hideInteractionTypes;
|
|
18
18
|
var styles = (0, styles_1.useStyles)();
|
|
19
19
|
return (react_1.default.createElement("div", { className: styles.wrapper },
|
|
20
20
|
react_1.default.createElement("div", { className: styles.graph }, graph && (react_1.default.createElement(SigmaGraphContainer_1.SigmaGraphContainer, { initialSettings: settings },
|
|
21
21
|
react_1.default.createElement(react_1.default.Fragment, null,
|
|
22
|
-
react_1.default.createElement(DataModelCircleLayuot_1.DataModelCircleLayuot, { graph: graph, selectedNode: selectedNode, onNodeClick: onNodeClick, selectedEdge: selectedEdge, onEdgeLabelClick: onEdgeLabelClick }),
|
|
22
|
+
react_1.default.createElement(DataModelCircleLayuot_1.DataModelCircleLayuot, { graph: graph, selectedNode: selectedNode, onNodeClick: onNodeClick, selectedEdge: selectedEdge, onEdgeLabelClick: onEdgeLabelClick, hideInteractionTypes: hideInteractionTypes }),
|
|
23
23
|
react_1.default.createElement("div", { className: styles.rightBottomControls },
|
|
24
24
|
react_1.default.createElement(ZoomSlider_1.ZoomSlider, { className: styles.zoomSlider, min: 30, max: 300 })))))),
|
|
25
25
|
children));
|
|
@@ -42,7 +42,7 @@ describe('DataModelGraph tests', function () {
|
|
|
42
42
|
var selectedEdge = 'edge1';
|
|
43
43
|
var onEdgeLabelClick = jest.fn();
|
|
44
44
|
var setUp = function () {
|
|
45
|
-
(0, react_2.render)(react_1.default.createElement(DataModelGraph_1.DataModelGraph, { graph: graph, selectedNode: selectedNode, onNodeClick: onNodeClick, selectedEdge: selectedEdge, onEdgeLabelClick: onEdgeLabelClick }));
|
|
45
|
+
(0, react_2.render)(react_1.default.createElement(DataModelGraph_1.DataModelGraph, { graph: graph, selectedNode: selectedNode, onNodeClick: onNodeClick, selectedEdge: selectedEdge, onEdgeLabelClick: onEdgeLabelClick, hideInteractionTypes: false }));
|
|
46
46
|
};
|
|
47
47
|
afterEach(function () {
|
|
48
48
|
jest.clearAllMocks();
|
|
@@ -5,7 +5,8 @@ type Props = {
|
|
|
5
5
|
onNodeClick: (nodeId: string) => void;
|
|
6
6
|
selectedEdge: string;
|
|
7
7
|
onEdgeLabelClick: (edgeId: string, event: MouseEvent) => void;
|
|
8
|
+
hideInteractionTypes?: boolean;
|
|
8
9
|
};
|
|
9
10
|
export declare const LAYOUT_ANIMATION_DURATION = 3000;
|
|
10
|
-
export declare const DataModelCircleLayuot: ({ graph, selectedNode, onNodeClick, selectedEdge, onEdgeLabelClick }: Props) => any;
|
|
11
|
+
export declare const DataModelCircleLayuot: ({ graph, selectedNode, onNodeClick, selectedEdge, onEdgeLabelClick, hideInteractionTypes }: Props) => any;
|
|
11
12
|
export {};
|
package/cjs/features/graph/DataModelGraph/components/DataModelCircleLayout/DataModelCircleLayuot.js
CHANGED
|
@@ -6,7 +6,7 @@ var useFakeCenterNode_1 = require("../../hooks/useFakeCenterNode");
|
|
|
6
6
|
var useDataModelGraphAppearance_1 = require("../../hooks/useDataModelGraphAppearance");
|
|
7
7
|
exports.LAYOUT_ANIMATION_DURATION = 3000;
|
|
8
8
|
var DataModelCircleLayuot = function (_a) {
|
|
9
|
-
var graph = _a.graph, selectedNode = _a.selectedNode, onNodeClick = _a.onNodeClick, selectedEdge = _a.selectedEdge, onEdgeLabelClick = _a.onEdgeLabelClick;
|
|
9
|
+
var graph = _a.graph, selectedNode = _a.selectedNode, onNodeClick = _a.onNodeClick, selectedEdge = _a.selectedEdge, onEdgeLabelClick = _a.onEdgeLabelClick, hideInteractionTypes = _a.hideInteractionTypes;
|
|
10
10
|
(0, useFakeCenterNode_1.useFakeCenterNode)({ graph: graph, timeout: exports.LAYOUT_ANIMATION_DURATION + 100 });
|
|
11
11
|
(0, useCircleLayout_1.useCircleLayout)({ graph: graph, animationDuration: exports.LAYOUT_ANIMATION_DURATION });
|
|
12
12
|
(0, useDataModelGraphAppearance_1.useDataModelGraphAppearance)({
|
|
@@ -14,7 +14,8 @@ var DataModelCircleLayuot = function (_a) {
|
|
|
14
14
|
selectedNode: selectedNode,
|
|
15
15
|
selectedEdge: selectedEdge,
|
|
16
16
|
onNodeClick: onNodeClick,
|
|
17
|
-
onEdgeLabelClick: onEdgeLabelClick
|
|
17
|
+
onEdgeLabelClick: onEdgeLabelClick,
|
|
18
|
+
hideInteractionTypes: hideInteractionTypes
|
|
18
19
|
});
|
|
19
20
|
return null;
|
|
20
21
|
};
|
|
@@ -12,6 +12,7 @@ type Props = {
|
|
|
12
12
|
selectedEdge: string;
|
|
13
13
|
onNodeClick: (node: string) => void;
|
|
14
14
|
onEdgeLabelClick: (edgeId: string, event: MouseEvent) => void;
|
|
15
|
+
hideInteractionTypes?: boolean;
|
|
15
16
|
};
|
|
16
|
-
export declare const useDataModelGraphAppearance: ({ graph, selectedNode, selectedEdge, onNodeClick, onEdgeLabelClick }: Props) => void;
|
|
17
|
+
export declare const useDataModelGraphAppearance: ({ graph, selectedNode, selectedEdge, onNodeClick, onEdgeLabelClick, hideInteractionTypes }: Props) => void;
|
|
17
18
|
export {};
|
|
@@ -46,7 +46,7 @@ exports.RELATED_EDGE_COLOR = 'rgba(130, 130, 130, 1)';
|
|
|
46
46
|
exports.RELATED_DASHED_EDGE_COLOR = 'rgba(79, 79, 79, 1)';
|
|
47
47
|
exports.INACTIVE_LABEL_COLOR = 'rgba(0, 0, 0, 0.38)';
|
|
48
48
|
var useDataModelGraphAppearance = function (_a) {
|
|
49
|
-
var graph = _a.graph, selectedNode = _a.selectedNode, selectedEdge = _a.selectedEdge, onNodeClick = _a.onNodeClick, onEdgeLabelClick = _a.onEdgeLabelClick;
|
|
49
|
+
var graph = _a.graph, selectedNode = _a.selectedNode, selectedEdge = _a.selectedEdge, onNodeClick = _a.onNodeClick, onEdgeLabelClick = _a.onEdgeLabelClick, hideInteractionTypes = _a.hideInteractionTypes;
|
|
50
50
|
var sigma = (0, core_2.useSigma)();
|
|
51
51
|
var container = (0, core_1.useSigmaContext)().container;
|
|
52
52
|
var _b = (0, react_1.useState)(null), hoveredNode = _b[0], setHoveredNode = _b[1];
|
|
@@ -107,6 +107,9 @@ var useDataModelGraphAppearance = function (_a) {
|
|
|
107
107
|
if (hoveredNode !== node && !isSelectedNode) {
|
|
108
108
|
delete newData.secondaryLabel;
|
|
109
109
|
}
|
|
110
|
+
if (data.nodeType === graphDataTypes_1.DataModelGraphNodeType.interactionType && hideInteractionTypes) {
|
|
111
|
+
newData.hidden = true;
|
|
112
|
+
}
|
|
110
113
|
return newData;
|
|
111
114
|
},
|
|
112
115
|
edgeReducer: function (edge, data) {
|
|
@@ -134,6 +137,6 @@ var useDataModelGraphAppearance = function (_a) {
|
|
|
134
137
|
return newData;
|
|
135
138
|
}
|
|
136
139
|
});
|
|
137
|
-
}, [sigma, setSettings, selectedNode, selectedEdge, hoveredEdge, hoveredNode]);
|
|
140
|
+
}, [sigma, setSettings, selectedNode, selectedEdge, hoveredEdge, hoveredNode, hideInteractionTypes]);
|
|
138
141
|
};
|
|
139
142
|
exports.useDataModelGraphAppearance = useDataModelGraphAppearance;
|
|
@@ -88,7 +88,7 @@ describe('useDataModelGraphAppearance tests', function () {
|
|
|
88
88
|
getGraph: function () { return graph; }
|
|
89
89
|
});
|
|
90
90
|
return __assign({ graph: graph }, (0, react_hooks_1.renderHook)(useDataModelGraphAppearance_1.useDataModelGraphAppearance, {
|
|
91
|
-
initialProps: __assign({ graph: graph, selectedNode: null, onNodeClick: jest.fn(), selectedEdge: null, onEdgeLabelClick: jest.fn() }, props)
|
|
91
|
+
initialProps: __assign({ graph: graph, selectedNode: null, onNodeClick: jest.fn(), selectedEdge: null, onEdgeLabelClick: jest.fn(), hideInteractionTypes: false }, props)
|
|
92
92
|
}));
|
|
93
93
|
};
|
|
94
94
|
var setSettings = jest.fn();
|
|
@@ -159,6 +159,12 @@ describe('useDataModelGraphAppearance tests', function () {
|
|
|
159
159
|
expect(nodeReducer('prescriptions', graph.getNodeAttributes('prescriptions'))).toEqual(__assign(__assign({}, getDefaultNodeAttributes(graph.getNodeAttributes('prescriptions'))), { hasBorder: true, image: expect.stringContaining('data:image/svg+xml'), label: 'Prescriptions', nodeType: graphDataTypes_1.DataModelGraphNodeType.interactionType, inactive: true, labelColor: useDataModelGraphAppearance_1.INACTIVE_LABEL_COLOR, secondaryLabelColor: useDataModelGraphAppearance_1.INACTIVE_LABEL_COLOR }));
|
|
160
160
|
expect(result.error).toBeUndefined();
|
|
161
161
|
});
|
|
162
|
+
it('should hide interaction types when hideInteractionTypes is true', function () {
|
|
163
|
+
var _a = setUp({ hideInteractionTypes: true }), graph = _a.graph, result = _a.result;
|
|
164
|
+
var nodeReducer = getNodeReducer();
|
|
165
|
+
expect(nodeReducer('prescriptions', graph.getNodeAttributes('prescriptions'))).toEqual(__assign(__assign({}, getDefaultNodeAttributes(graph.getNodeAttributes('prescriptions'))), { hasBorder: true, image: expect.stringContaining('data:image/svg+xml'), label: 'Prescriptions', nodeType: graphDataTypes_1.DataModelGraphNodeType.interactionType, hidden: true }));
|
|
166
|
+
expect(result.error).toBeUndefined();
|
|
167
|
+
});
|
|
162
168
|
});
|
|
163
169
|
describe('edges reducer behavior', function () {
|
|
164
170
|
var defaultEdgeStyle = {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useSavedSearchesRequest } from './useSavedSearchesRequest';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSavedSearchesRequest = void 0;
|
|
4
|
+
var useSavedSearchesRequest_1 = require("./useSavedSearchesRequest");
|
|
5
|
+
Object.defineProperty(exports, "useSavedSearchesRequest", { enumerable: true, get: function () { return useSavedSearchesRequest_1.useSavedSearchesRequest; } });
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.getTotalsForSavedSearches = void 0;
|
|
40
|
+
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
41
|
+
var getTotalsForSavedSearches = function (savedSearches, queryEstimatorEnabled, signal) { return __awaiter(void 0, void 0, void 0, function () {
|
|
42
|
+
var totalRequests, totalResults, entries;
|
|
43
|
+
return __generator(this, function (_a) {
|
|
44
|
+
switch (_a.label) {
|
|
45
|
+
case 0:
|
|
46
|
+
totalRequests = savedSearches.map(function (search) {
|
|
47
|
+
return (0, mdm_sdk_1.getTotalsForQuery)((0, mdm_sdk_1.replacePlaceholdersInQuery)(search.query), queryEstimatorEnabled, signal);
|
|
48
|
+
});
|
|
49
|
+
return [4 /*yield*/, (0, mdm_sdk_1.promiseAllSettled)(totalRequests)];
|
|
50
|
+
case 1:
|
|
51
|
+
totalResults = _a.sent();
|
|
52
|
+
entries = totalResults
|
|
53
|
+
.map(function (_a, index) {
|
|
54
|
+
var status = _a.status, value = _a.value, reason = _a.reason;
|
|
55
|
+
switch (status) {
|
|
56
|
+
case 'fulfilled': {
|
|
57
|
+
var uri = savedSearches[index].uri;
|
|
58
|
+
return [uri, { count: value.total }];
|
|
59
|
+
}
|
|
60
|
+
case 'rejected': {
|
|
61
|
+
console.warn(reason);
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
})
|
|
67
|
+
.filter(Boolean);
|
|
68
|
+
return [2 /*return*/, Object.fromEntries(entries)];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}); };
|
|
72
|
+
exports.getTotalsForSavedSearches = getTotalsForSavedSearches;
|