@dexteel/mesf-core 4.5.5 → 4.5.7
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/CHANGELOG.md +2 -0
- package/dist/index.esm.js +452 -217
- package/dist/pages/trendings/components/chart/TableComponent.d.ts +2 -0
- package/dist/pages/trendings/components/chart/Trending.d.ts +6 -1
- package/dist/pages/trendings/components/chart/components/DraggableLineControl.d.ts +10 -0
- package/dist/pages/trendings/components/chart/components/modals/addTagModal/AddTagModal.d.ts +9 -0
- package/dist/pages/trendings/components/chart/{TagSelectionModal.d.ts → components/modals/addTagModal/TagSelectionModal.d.ts} +1 -1
- package/dist/pages/trendings/components/chart/context/TrendingContext.d.ts +7 -1
- package/dist/pages/trendings/components/chart/repository/TrendingRepository.d.ts +6 -0
- package/dist/pages/trendings/components/chart/styles/TagsTableStyles.d.ts +1 -1
- package/dist/pages/trendings/reducers/trendings.reducer.d.ts +7 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Typography, TextField, makeStyles as makeStyles$1, Button as Button$1, Grid as Grid$1, Dialog as Dialog$1, DialogTitle as DialogTitle$2, DialogContent as DialogContent$2, DialogContentText, DialogActions as DialogActions$2, FormHelperText, CircularProgress as CircularProgress$1, Badge, FormControlLabel, Checkbox, Snackbar as Snackbar$1, Paper as Paper$1, MenuItem as MenuItem$1, useTheme as useTheme$1,
|
|
2
|
-
import { values, get, isNil as isNil$1, isEmpty } from 'lodash-es';
|
|
1
|
+
import { Typography, TextField, makeStyles as makeStyles$1, Button as Button$1, Grid as Grid$1, Dialog as Dialog$1, DialogTitle as DialogTitle$2, DialogContent as DialogContent$2, DialogContentText, DialogActions as DialogActions$2, FormHelperText, CircularProgress as CircularProgress$1, Badge, FormControlLabel, Checkbox, Snackbar as Snackbar$1, Paper as Paper$1, MenuItem as MenuItem$1, useTheme as useTheme$1, Box, Tooltip, IconButton as IconButton$1, FormControl as FormControl$1, Select as Select$1, createStyles as createStyles$1, List, ListItem, ListItemText } from '@material-ui/core';
|
|
2
|
+
import { values, get, isNil as isNil$1, isEmpty, debounce } from 'lodash-es';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import React__default, { useState, useRef, useEffect, Component, createContext, useContext, useMemo, useCallback, lazy, Suspense } from 'react';
|
|
5
5
|
import { Alert as Alert$1, Modal as Modal$1, Navbar, Container, Nav, NavDropdown } from 'react-bootstrap';
|
|
@@ -26,11 +26,11 @@ import { _adapters, Chart, CategoryScale, LinearScale, PointElement, LineElement
|
|
|
26
26
|
import moment from 'moment';
|
|
27
27
|
import zoomPlugin from 'chartjs-plugin-zoom';
|
|
28
28
|
import { Line } from 'react-chartjs-2';
|
|
29
|
+
import Popover from '@material-ui/core/Popover';
|
|
29
30
|
import { Alert as Alert$3, TreeView as TreeView$1, TreeItem as TreeItem$1 } from '@material-ui/lab';
|
|
30
31
|
import ArrowDropDownIcon from '@material-ui/icons/ArrowDropDown';
|
|
31
32
|
import FolderIcon from '@material-ui/icons/Folder';
|
|
32
33
|
import InsertDriveFileIcon from '@material-ui/icons/InsertDriveFile';
|
|
33
|
-
import Popover from '@material-ui/core/Popover';
|
|
34
34
|
import PersonPinCircleIcon from '@material-ui/icons/PersonPinCircle';
|
|
35
35
|
import PropTypes from 'prop-types';
|
|
36
36
|
import { ResponsiveBar } from '@nivo/bar';
|
|
@@ -8013,7 +8013,7 @@ function Login(_a) {
|
|
|
8013
8013
|
var _c = useState(""), message = _c[0], setMessage = _c[1];
|
|
8014
8014
|
var useEmailAndPassword = get(authConfig, "useEmailAndPassword", true);
|
|
8015
8015
|
var useAzureAD = get(authConfig, "useAzureAD", false);
|
|
8016
|
-
get(authConfig, "useWindowsAuth", false);
|
|
8016
|
+
var useWindowsAuth = get(authConfig, "useWindowsAuth", false);
|
|
8017
8017
|
var guestIsEnabled = get(authConfig, "guestIsEnabled", false);
|
|
8018
8018
|
var handleClose = function () {
|
|
8019
8019
|
setOpen(false);
|
|
@@ -8037,7 +8037,7 @@ function Login(_a) {
|
|
|
8037
8037
|
React__default.createElement(Paper$1, { elevation: 2 },
|
|
8038
8038
|
React__default.createElement("div", { className: "card-header text-center" },
|
|
8039
8039
|
React__default.createElement("b", null, "LOGIN")),
|
|
8040
|
-
React__default.createElement(Grid$1, { container: true, justifyContent: "space-between", alignItems: "center" }, (!useAzureAD && !guestIsEnabled) ? (React__default.createElement(Grid$1, { item: true, xs: 12 },
|
|
8040
|
+
React__default.createElement(Grid$1, { container: true, justifyContent: "space-between", alignItems: "center" }, (!useAzureAD && !guestIsEnabled && !useWindowsAuth) ? (React__default.createElement(Grid$1, { item: true, xs: 12 },
|
|
8041
8041
|
React__default.createElement(Paper$1, { elevation: 2, style: { padding: 40, margin: "40px 40px 40px 40px" } }, useEmailAndPassword && React__default.createElement(LoginWithEmailAndPassword, null)))) : (React__default.createElement(React__default.Fragment, null,
|
|
8042
8042
|
React__default.createElement(Grid$1, { item: true, md: 5, xs: 5 },
|
|
8043
8043
|
React__default.createElement(Paper$1, { elevation: 2, style: { padding: 40, margin: "40px -40px 40px 40px" } }, useEmailAndPassword && React__default.createElement(LoginWithEmailAndPassword, null))),
|
|
@@ -8348,6 +8348,23 @@ _adapters._date.override(typeof moment === 'function' ? {
|
|
|
8348
8348
|
var css$1 = "/* ContextMenu.css */\n.context-menu {\n position: absolute;\n z-index: 1000;\n background-color: #fff;\n border: 1px solid #ddd;\n box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);\n border-radius: 4px;\n overflow: hidden;\n}\n\n .context-menu ul {\n list-style: none;\n margin: 0;\n padding: 0;\n }\n\n .context-menu li {\n padding: 8px 15px;\n cursor: pointer;\n border-bottom: 1px solid #eee;\n background-color: #fff;\n color: #333;\n font-size: 14px;\n }\n\n .context-menu li:hover {\n background-color: #f5f5f5;\n }\n\n\n";
|
|
8349
8349
|
n(css$1,{});
|
|
8350
8350
|
|
|
8351
|
+
var useTagColorsStyles = makeStyles$1({
|
|
8352
|
+
swatch: {
|
|
8353
|
+
width: '25px',
|
|
8354
|
+
height: '25px',
|
|
8355
|
+
display: 'inline-block',
|
|
8356
|
+
margin: '2px',
|
|
8357
|
+
borderRadius: '4px',
|
|
8358
|
+
cursor: 'pointer'
|
|
8359
|
+
},
|
|
8360
|
+
popover: {
|
|
8361
|
+
display: 'flex',
|
|
8362
|
+
flexWrap: 'wrap',
|
|
8363
|
+
padding: '10px',
|
|
8364
|
+
maxWidth: '165px'
|
|
8365
|
+
}
|
|
8366
|
+
});
|
|
8367
|
+
|
|
8351
8368
|
var tagColors = [
|
|
8352
8369
|
"#5eaf60",
|
|
8353
8370
|
"green",
|
|
@@ -8366,6 +8383,102 @@ var tagColors = [
|
|
|
8366
8383
|
"#bf3b2c", // dark red
|
|
8367
8384
|
];
|
|
8368
8385
|
|
|
8386
|
+
var Swatch = function (_a) {
|
|
8387
|
+
var color = _a.color, onSelect = _a.onSelect;
|
|
8388
|
+
var classes = useTagColorsStyles();
|
|
8389
|
+
return (React__default.createElement("div", { className: classes.swatch, style: { backgroundColor: color }, onClick: function () { return onSelect(color); } }));
|
|
8390
|
+
};
|
|
8391
|
+
var ColorPicker = function (_a) {
|
|
8392
|
+
var onChange = _a.onChange, color = _a.color, elementId = _a.elementId;
|
|
8393
|
+
var classes = useTagColorsStyles();
|
|
8394
|
+
var _b = useState(null), anchorEl = _b[0], setAnchorEl = _b[1];
|
|
8395
|
+
var handleClick = function (event) {
|
|
8396
|
+
setAnchorEl(event.currentTarget);
|
|
8397
|
+
};
|
|
8398
|
+
var handleClose = function () {
|
|
8399
|
+
setAnchorEl(null);
|
|
8400
|
+
};
|
|
8401
|
+
var open = Boolean(anchorEl);
|
|
8402
|
+
var id = open ? 'simple-popover' : undefined;
|
|
8403
|
+
return (React__default.createElement("div", null,
|
|
8404
|
+
React__default.createElement(Button, { "aria-describedby": id, variant: "outlined", onClick: handleClick, style: {
|
|
8405
|
+
backgroundColor: color,
|
|
8406
|
+
width: '20px',
|
|
8407
|
+
height: '20px',
|
|
8408
|
+
minWidth: '20px',
|
|
8409
|
+
padding: 0,
|
|
8410
|
+
margin: '4px'
|
|
8411
|
+
} }),
|
|
8412
|
+
React__default.createElement(Popover, { id: id, open: open, anchorEl: anchorEl, onClose: handleClose, anchorOrigin: {
|
|
8413
|
+
vertical: 'bottom',
|
|
8414
|
+
horizontal: 'left'
|
|
8415
|
+
} },
|
|
8416
|
+
React__default.createElement("div", { className: classes.popover }, tagColors.map(function (color) { return (React__default.createElement(Swatch, { key: color, color: color, onSelect: function (color) {
|
|
8417
|
+
onChange(elementId, color);
|
|
8418
|
+
handleClose();
|
|
8419
|
+
} })); })))));
|
|
8420
|
+
};
|
|
8421
|
+
|
|
8422
|
+
var useTagsTableStyles = makeStyles$1(function (theme) { return ({
|
|
8423
|
+
checkbox: {
|
|
8424
|
+
'& input[type="checkbox"]': {
|
|
8425
|
+
zoom: 1.5
|
|
8426
|
+
},
|
|
8427
|
+
textAlign: 'center'
|
|
8428
|
+
},
|
|
8429
|
+
rowHover: {
|
|
8430
|
+
'&:hover': {
|
|
8431
|
+
backgroundColor: "#f2f2f2"
|
|
8432
|
+
}
|
|
8433
|
+
},
|
|
8434
|
+
topTitles: {
|
|
8435
|
+
border: "0.0625rem black solid",
|
|
8436
|
+
borderBottom: "none",
|
|
8437
|
+
backgroundColor: "#e9ecef"
|
|
8438
|
+
},
|
|
8439
|
+
bottomTitlesRow: {
|
|
8440
|
+
'& th': {
|
|
8441
|
+
border: "1px black solid"
|
|
8442
|
+
},
|
|
8443
|
+
backgroundColor: "#e9ecef"
|
|
8444
|
+
},
|
|
8445
|
+
doubleInput: {
|
|
8446
|
+
padding: "0",
|
|
8447
|
+
'& input[type="text"] ': {
|
|
8448
|
+
width: "100%",
|
|
8449
|
+
height: "17px",
|
|
8450
|
+
display: "block",
|
|
8451
|
+
margin: "0",
|
|
8452
|
+
padding: "0"
|
|
8453
|
+
}
|
|
8454
|
+
},
|
|
8455
|
+
inputCol: {
|
|
8456
|
+
width: "11.25rem",
|
|
8457
|
+
overflow: 'hidden',
|
|
8458
|
+
textOverflow: 'ellipsis',
|
|
8459
|
+
whiteSpace: 'nowrap'
|
|
8460
|
+
},
|
|
8461
|
+
autoScale: {
|
|
8462
|
+
width: '7.5rem'
|
|
8463
|
+
},
|
|
8464
|
+
scale: {
|
|
8465
|
+
width: '37.5rem',
|
|
8466
|
+
padding: "0"
|
|
8467
|
+
},
|
|
8468
|
+
visible: {
|
|
8469
|
+
width: '3.75rem'
|
|
8470
|
+
},
|
|
8471
|
+
color: {
|
|
8472
|
+
width: '4.375rem'
|
|
8473
|
+
},
|
|
8474
|
+
unit: {
|
|
8475
|
+
width: '7.5rem'
|
|
8476
|
+
},
|
|
8477
|
+
xStats: {
|
|
8478
|
+
// ...
|
|
8479
|
+
}
|
|
8480
|
+
}); });
|
|
8481
|
+
|
|
8369
8482
|
var TagSelectionModal = function (_a) {
|
|
8370
8483
|
var isOpen = _a.isOpen; _a.onClose; var onTagSelect = _a.onTagSelect;
|
|
8371
8484
|
var _b = useState(true), isLoading = _b[0], setIsLoading = _b[1];
|
|
@@ -8512,77 +8625,31 @@ var TagSelectionModal = function (_a) {
|
|
|
8512
8625
|
React__default.createElement(CircularProgress$1, { size: "2rem" }))) : (React__default.createElement(TreeView$1, { expanded: expanded, onNodeSelect: handleNodeSelect, onNodeToggle: handleNodeToggle }, treeData.map(function (tree) { return renderTree(tree); }))))));
|
|
8513
8626
|
};
|
|
8514
8627
|
|
|
8515
|
-
var
|
|
8516
|
-
|
|
8517
|
-
|
|
8518
|
-
|
|
8519
|
-
|
|
8520
|
-
|
|
8521
|
-
|
|
8522
|
-
cursor: 'pointer'
|
|
8523
|
-
},
|
|
8524
|
-
popover: {
|
|
8525
|
-
display: 'flex',
|
|
8526
|
-
flexWrap: 'wrap',
|
|
8527
|
-
padding: '10px',
|
|
8528
|
-
maxWidth: '165px'
|
|
8529
|
-
}
|
|
8530
|
-
});
|
|
8531
|
-
|
|
8532
|
-
var Swatch = function (_a) {
|
|
8533
|
-
var color = _a.color, onSelect = _a.onSelect;
|
|
8534
|
-
var classes = useTagColorsStyles();
|
|
8535
|
-
return (React__default.createElement("div", { className: classes.swatch, style: { backgroundColor: color }, onClick: function () { return onSelect(color); } }));
|
|
8536
|
-
};
|
|
8537
|
-
var ColorPicker = function (_a) {
|
|
8538
|
-
var onChange = _a.onChange, color = _a.color, elementId = _a.elementId;
|
|
8539
|
-
var classes = useTagColorsStyles();
|
|
8540
|
-
var _b = useState(null), anchorEl = _b[0], setAnchorEl = _b[1];
|
|
8541
|
-
var handleClick = function (event) {
|
|
8542
|
-
setAnchorEl(event.currentTarget);
|
|
8543
|
-
};
|
|
8544
|
-
var handleClose = function () {
|
|
8545
|
-
setAnchorEl(null);
|
|
8546
|
-
};
|
|
8547
|
-
var open = Boolean(anchorEl);
|
|
8548
|
-
var id = open ? 'simple-popover' : undefined;
|
|
8549
|
-
return (React__default.createElement("div", null,
|
|
8550
|
-
React__default.createElement(Button, { "aria-describedby": id, variant: "outlined", onClick: handleClick, style: {
|
|
8551
|
-
backgroundColor: color,
|
|
8552
|
-
width: '20px',
|
|
8553
|
-
height: '20px',
|
|
8554
|
-
minWidth: '20px',
|
|
8555
|
-
padding: 0,
|
|
8556
|
-
margin: '4px'
|
|
8557
|
-
} }),
|
|
8558
|
-
React__default.createElement(Popover, { id: id, open: open, anchorEl: anchorEl, onClose: handleClose, anchorOrigin: {
|
|
8559
|
-
vertical: 'bottom',
|
|
8560
|
-
horizontal: 'left'
|
|
8561
|
-
} },
|
|
8562
|
-
React__default.createElement("div", { className: classes.popover }, tagColors.map(function (color) { return (React__default.createElement(Swatch, { key: color, color: color, onSelect: function (color) {
|
|
8563
|
-
onChange(elementId, color);
|
|
8564
|
-
handleClose();
|
|
8565
|
-
} })); })))));
|
|
8628
|
+
var AddTagModal = function (_a) {
|
|
8629
|
+
var open = _a.open, handleClose = _a.handleClose, onTagSelect = _a.onTagSelect;
|
|
8630
|
+
return (React__default.createElement(MesfModal, { open: open, handleClose: handleClose, maxWidth: "lg", "aria-labelledby": "modal-modal-title", "aria-describedby": "modal-modal-description", title: 'Tags' },
|
|
8631
|
+
React__default.createElement(MesfModal.Content, null,
|
|
8632
|
+
React__default.createElement(Box, null,
|
|
8633
|
+
React__default.createElement(Typography, { id: "modal-modal-description" },
|
|
8634
|
+
React__default.createElement(TagSelectionModal, { isOpen: open, onClose: function () { return handleClose; }, onTagSelect: onTagSelect }))))));
|
|
8566
8635
|
};
|
|
8567
8636
|
|
|
8568
|
-
var useTagsTableStyles = makeStyles$1(function (theme) { return ({
|
|
8569
|
-
checkbox: {
|
|
8570
|
-
'& input[type="checkbox"]': {
|
|
8571
|
-
zoom: 1.5
|
|
8572
|
-
},
|
|
8573
|
-
textAlign: 'center'
|
|
8574
|
-
}
|
|
8575
|
-
}); });
|
|
8576
|
-
|
|
8577
8637
|
var TableComponent = function (_a) {
|
|
8578
|
-
var tagList = _a.tagList, setTagList = _a.setTagList
|
|
8638
|
+
var tagList = _a.tagList, setTagList = _a.setTagList; _a.chartData; var cursorData = _a.cursorData, onDeleteTag = _a.onDeleteTag, onAddTag = _a.onAddTag;
|
|
8579
8639
|
var classes = useTagsTableStyles();
|
|
8640
|
+
var _b = useState(""); _b[0]; _b[1];
|
|
8641
|
+
var _c = useState({}), editableTagNames = _c[0], setEditableTagNames = _c[1];
|
|
8580
8642
|
var handleChange = function (index, value, property) {
|
|
8581
8643
|
setTagList(function (prev) { return prev.map(function (tag, currentIndex) {
|
|
8582
8644
|
var _a;
|
|
8583
8645
|
return currentIndex === index ? __assign(__assign({}, tag), (_a = {}, _a[property] = value, _a.autoScale = false, _a)) : tag;
|
|
8584
8646
|
}); });
|
|
8585
8647
|
};
|
|
8648
|
+
var handleChangeAlias = function (tagId, newName) {
|
|
8649
|
+
setTagList(function (prevTagList) {
|
|
8650
|
+
return prevTagList.map(function (tag) { return (tag.tagId === tagId ? __assign(__assign({}, tag), { tagName: newName }) : tag); });
|
|
8651
|
+
});
|
|
8652
|
+
};
|
|
8586
8653
|
var handleVisibilityChange = function (index, value) {
|
|
8587
8654
|
setTagList(function (prev) { return prev.map(function (tag, currentIndex) { return currentIndex === index ? __assign(__assign({}, tag), { visible: value }) : tag; }); });
|
|
8588
8655
|
};
|
|
@@ -8592,10 +8659,9 @@ var TableComponent = function (_a) {
|
|
|
8592
8659
|
var handleColorChange = function (tagId, value) {
|
|
8593
8660
|
setTagList(function (prev) { return prev.map(function (tag) { return tag.tagId === tagId ? __assign(__assign({}, tag), { color: value }) : tag; }); });
|
|
8594
8661
|
};
|
|
8595
|
-
var
|
|
8596
|
-
var
|
|
8597
|
-
var
|
|
8598
|
-
var handleClose = function () { return setModalOpen(false); };
|
|
8662
|
+
var _d = useState(null), selectedRowIndex = _d[0], setSelectedRowIndex = _d[1];
|
|
8663
|
+
var _e = useState(false), addTagModalOpen = _e[0], setAddTagModalOpen = _e[1];
|
|
8664
|
+
var handleClose = function () { return setAddTagModalOpen(false); };
|
|
8599
8665
|
var ContextMenu = function (_a) {
|
|
8600
8666
|
var x = _a.x, y = _a.y, options = _a.options;
|
|
8601
8667
|
var handleContextMenuClick = function (e) {
|
|
@@ -8605,15 +8671,47 @@ var TableComponent = function (_a) {
|
|
|
8605
8671
|
React__default.createElement("ul", null, options.map(function (option) { return (React__default.createElement("li", { key: option.id, onClick: option.onClick }, option.label)); }))));
|
|
8606
8672
|
};
|
|
8607
8673
|
// Position state for the context menu
|
|
8608
|
-
var
|
|
8674
|
+
var _f = useState({ x: 0, y: 0 }), contextMenuPosition = _f[0], setContextMenuPosition = _f[1];
|
|
8609
8675
|
var contextMenuOptions = [
|
|
8610
8676
|
{ id: 'delete', label: 'Remove Tag', onClick: function () { return handleDelete(); } },
|
|
8611
|
-
{ id: 'add', label: 'Add Tag', onClick: function () { return
|
|
8677
|
+
{ id: 'add', label: 'Add Tag', onClick: function () { return setAddTagModalOpen(true); } },
|
|
8678
|
+
{ id: 'saveDefault', label: 'Save Default To Tag', onClick: function () { } },
|
|
8679
|
+
{ id: 'saveAsView', label: 'Save as View', onClick: function () { } },
|
|
8680
|
+
{ id: 'loadView', label: 'Load View', onClick: function () { } },
|
|
8612
8681
|
// ... other options
|
|
8613
8682
|
];
|
|
8614
|
-
|
|
8615
|
-
|
|
8616
|
-
|
|
8683
|
+
// const binarySearch = (arr: any, searchDate: Date): number | null => {
|
|
8684
|
+
// let left = 0;
|
|
8685
|
+
// let right = arr.length - 1;
|
|
8686
|
+
// let closest: number | null = null;
|
|
8687
|
+
// if (!arr.length) return null;
|
|
8688
|
+
// while (left <= right) {
|
|
8689
|
+
// const mid = Math.floor((left + right) / 2);
|
|
8690
|
+
// const midDate = arr[mid].x; // Asegúrate de que esto es una instancia de Date
|
|
8691
|
+
// const midTimestamp = midDate.getTime(); // Esto es un number
|
|
8692
|
+
// const searchTimestamp = searchDate.getTime(); // Esto también es un number
|
|
8693
|
+
// console.log(midTimestamp, searchTimestamp);
|
|
8694
|
+
// if (midTimestamp === searchTimestamp) {
|
|
8695
|
+
// return arr[mid].y;
|
|
8696
|
+
// } else if (midTimestamp < searchTimestamp) {
|
|
8697
|
+
// left = mid + 1;
|
|
8698
|
+
// } else {
|
|
8699
|
+
// right = mid - 1;
|
|
8700
|
+
// }
|
|
8701
|
+
// // Revisa si midDate está más cerca que el 'closest' actual
|
|
8702
|
+
// if (closest === null || Math.abs(midTimestamp - searchTimestamp) < Math.abs(arr[closest].x.getTime() - searchTimestamp)) {
|
|
8703
|
+
// closest = mid;
|
|
8704
|
+
// }
|
|
8705
|
+
// }
|
|
8706
|
+
// return closest !== null ? arr[closest].y : null;
|
|
8707
|
+
// };
|
|
8708
|
+
// useEffect(() => {
|
|
8709
|
+
// if (cursorData) {
|
|
8710
|
+
// const yValue = binarySearch(chartData.datasets[0]?.data, new Date(cursorData.x1));
|
|
8711
|
+
// if(yValue)console.log(yValue,"retorna binary")
|
|
8712
|
+
// }
|
|
8713
|
+
// else console.log("NULL")
|
|
8714
|
+
// }, [cursorData,chartData.datasets[1]?.data])
|
|
8617
8715
|
var handleTagSelect = function (selectedTag) {
|
|
8618
8716
|
onAddTag(selectedTag);
|
|
8619
8717
|
handleClose();
|
|
@@ -8625,6 +8723,12 @@ var TableComponent = function (_a) {
|
|
|
8625
8723
|
setSelectedRowIndex(null); // Reset the selected row index
|
|
8626
8724
|
}
|
|
8627
8725
|
};
|
|
8726
|
+
useEffect(function () {
|
|
8727
|
+
setEditableTagNames(tagList.reduce(function (acc, tag) {
|
|
8728
|
+
acc[tag.tagId] = tag.tagName;
|
|
8729
|
+
return acc;
|
|
8730
|
+
}, {}));
|
|
8731
|
+
}, [tagList]);
|
|
8628
8732
|
useEffect(function () {
|
|
8629
8733
|
var handleGlobalClick = function (e) {
|
|
8630
8734
|
if (selectedRowIndex !== null) {
|
|
@@ -8654,53 +8758,88 @@ var TableComponent = function (_a) {
|
|
|
8654
8758
|
setSelectedRowIndex(index);
|
|
8655
8759
|
setContextMenuPosition({ x: event.clientX, y: event.clientY });
|
|
8656
8760
|
};
|
|
8657
|
-
|
|
8658
|
-
visible: { width: '60px' },
|
|
8659
|
-
color: { width: '70px' },
|
|
8660
|
-
autoScale: { width: '120px' }
|
|
8661
|
-
};
|
|
8662
|
-
var cellStyles = {
|
|
8663
|
-
tagName: {
|
|
8664
|
-
maxWidth: '200px',
|
|
8665
|
-
overflow: 'hidden',
|
|
8666
|
-
textOverflow: 'ellipsis',
|
|
8667
|
-
whiteSpace: 'nowrap'
|
|
8668
|
-
}
|
|
8669
|
-
};
|
|
8670
|
-
return (React__default.createElement(Grid$1, { container: true },
|
|
8761
|
+
return (React__default.createElement(Grid$1, { container: true, spacing: 1 },
|
|
8671
8762
|
React__default.createElement(Grid$1, { item: true, xs: 12 },
|
|
8672
8763
|
React__default.createElement("div", { style: { overflowX: 'auto', width: '100%' } },
|
|
8673
|
-
React__default.createElement("table", { style: { width: '
|
|
8764
|
+
React__default.createElement("table", { style: { width: '100%', tableLayout: 'fixed', textAlign: "center" } },
|
|
8674
8765
|
React__default.createElement("thead", null,
|
|
8675
8766
|
React__default.createElement("tr", null,
|
|
8676
|
-
React__default.createElement("th", {
|
|
8677
|
-
React__default.createElement("th",
|
|
8678
|
-
React__default.createElement("th", {
|
|
8679
|
-
React__default.createElement("th",
|
|
8680
|
-
React__default.createElement("th",
|
|
8681
|
-
|
|
8682
|
-
|
|
8683
|
-
|
|
8767
|
+
React__default.createElement("th", { className: classes.visible }),
|
|
8768
|
+
React__default.createElement("th", { className: classes.inputCol }),
|
|
8769
|
+
React__default.createElement("th", { className: classes.color }),
|
|
8770
|
+
React__default.createElement("th", { colSpan: 4, className: "".concat(classes.topTitles, " ").concat(classes.scale) }, "Scale"),
|
|
8771
|
+
React__default.createElement("th", { className: "".concat(classes.topTitles, " ").concat(classes.xStats) }, cursorData ? (function () {
|
|
8772
|
+
var date = new Date(cursorData.x1);
|
|
8773
|
+
// console.log(cursorData, "cursor data")
|
|
8774
|
+
var formattedDate = date.toLocaleString('en-US', {
|
|
8775
|
+
hour12: false,
|
|
8776
|
+
month: 'short',
|
|
8777
|
+
day: 'numeric',
|
|
8778
|
+
hour: '2-digit',
|
|
8779
|
+
minute: '2-digit',
|
|
8780
|
+
second: '2-digit'
|
|
8781
|
+
});
|
|
8782
|
+
var milliseconds = date.getMilliseconds().toString().padStart(3, '0');
|
|
8783
|
+
return "".concat(formattedDate, ".").concat(milliseconds);
|
|
8784
|
+
})() : null),
|
|
8785
|
+
React__default.createElement("th", { className: "".concat(classes.topTitles, " ").concat(classes.xStats) }, cursorData ? (function () {
|
|
8786
|
+
var date = new Date(cursorData.x2);
|
|
8787
|
+
// console.log(cursorData, "cursor data")
|
|
8788
|
+
var formattedDate = date.toLocaleString('en-US', {
|
|
8789
|
+
hour12: false,
|
|
8790
|
+
month: 'short',
|
|
8791
|
+
day: 'numeric',
|
|
8792
|
+
hour: '2-digit',
|
|
8793
|
+
minute: '2-digit',
|
|
8794
|
+
second: '2-digit'
|
|
8795
|
+
});
|
|
8796
|
+
var milliseconds = date.getMilliseconds().toString().padStart(3, '0');
|
|
8797
|
+
return "".concat(formattedDate, ".").concat(milliseconds);
|
|
8798
|
+
})() : null),
|
|
8799
|
+
React__default.createElement("th", { colSpan: 3, className: "".concat(classes.topTitles, " ").concat(classes.xStats) }, "X2-X1 Stats")))),
|
|
8800
|
+
React__default.createElement("table", { style: { width: '100%', tableLayout: 'fixed', textAlign: "center" } },
|
|
8801
|
+
React__default.createElement("thead", null,
|
|
8802
|
+
React__default.createElement("tr", { className: classes.bottomTitlesRow },
|
|
8803
|
+
React__default.createElement("th", { className: classes.visible }, "Visible"),
|
|
8804
|
+
React__default.createElement("th", { className: classes.inputCol }, "Alias / Tagname"),
|
|
8805
|
+
React__default.createElement("th", { className: classes.color }, "Color"),
|
|
8806
|
+
React__default.createElement("th", { className: classes.inputCol }, "Min Scale"),
|
|
8807
|
+
React__default.createElement("th", { className: classes.inputCol }, "Max Scale"),
|
|
8808
|
+
React__default.createElement("th", { className: classes.unit }, "Unit"),
|
|
8809
|
+
React__default.createElement("th", { className: classes.autoScale }, "AutoScale"),
|
|
8810
|
+
React__default.createElement("th", null, " Y1"),
|
|
8811
|
+
React__default.createElement("th", null, "Y2"),
|
|
8812
|
+
React__default.createElement("th", null, "Y2-Y1"),
|
|
8813
|
+
React__default.createElement("th", null, "Min"),
|
|
8814
|
+
React__default.createElement("th", null, "May")))))),
|
|
8684
8815
|
React__default.createElement(Grid$1, { item: true, xs: 12 },
|
|
8685
|
-
React__default.createElement("div", { style: { width: '100%', overflowY: 'auto', maxHeight: '
|
|
8686
|
-
React__default.createElement("table", { cellPadding: '4px', style: { width: '
|
|
8687
|
-
React__default.createElement("tbody", null, tagList.map(function (tag, index) { return (React__default.createElement("tr", { key: tag.tagName, onClick: function () { return handleRowClick(index); }, onContextMenu: function (e) { return handleRightClick(e, index); }, className:
|
|
8688
|
-
React__default.createElement("td", {
|
|
8816
|
+
React__default.createElement("div", { style: { width: '100%', overflowY: 'auto', maxHeight: ' 20svh' } },
|
|
8817
|
+
React__default.createElement("table", { cellPadding: '4px', style: { width: '100%', tableLayout: 'fixed', textAlign: "center" } },
|
|
8818
|
+
React__default.createElement("tbody", null, tagList.map(function (tag, index) { return (React__default.createElement("tr", { key: tag.tagName, onClick: function () { return handleRowClick(index); }, onContextMenu: function (e) { return handleRightClick(e, index); }, className: classes.rowHover },
|
|
8819
|
+
React__default.createElement("td", { className: "".concat(classes.visible, " ").concat(classes.checkbox) },
|
|
8689
8820
|
React__default.createElement("input", { type: "checkbox", checked: tag.visible, onChange: function (e) { return handleVisibilityChange(index, e.target.checked); } })),
|
|
8690
|
-
React__default.createElement("td",
|
|
8821
|
+
React__default.createElement("td", { className: classes.inputCol },
|
|
8691
8822
|
React__default.createElement(Tooltip, { title: tag.tagName, placement: "top", arrow: true, interactive: true, enterDelay: 500 },
|
|
8692
|
-
React__default.createElement("div",
|
|
8693
|
-
|
|
8823
|
+
React__default.createElement("div", null,
|
|
8824
|
+
React__default.createElement("input", { type: "text", style: { width: '100%' }, value: editableTagNames[tag.tagId] || '', onFocus: function (e) { return e.target.select(); }, onChange: function (e) {
|
|
8825
|
+
var _a;
|
|
8826
|
+
setEditableTagNames(__assign(__assign({}, editableTagNames), (_a = {}, _a[tag.tagId] = e.target.value, _a)));
|
|
8827
|
+
}, onKeyDown: function (e) {
|
|
8828
|
+
if (e.key === 'Enter') {
|
|
8829
|
+
handleChangeAlias(tag.tagId, editableTagNames[tag.tagId]);
|
|
8830
|
+
}
|
|
8831
|
+
} })))),
|
|
8832
|
+
React__default.createElement("td", { className: classes.color },
|
|
8694
8833
|
React__default.createElement(ColorPicker, { onChange: handleColorChange, color: tag.color, elementId: tag.tagId })),
|
|
8695
|
-
React__default.createElement("td",
|
|
8696
|
-
React__default.createElement("input", { type: "text", style: { width: '100%' }, value: tag.minScale, onFocus: function (e) { return e.target.select(); }, onChange: function (e) {
|
|
8834
|
+
React__default.createElement("td", { className: classes.inputCol },
|
|
8835
|
+
React__default.createElement("input", { type: "text", style: { width: '100%' }, disabled: tag.autoScale, value: tag.minScale, onFocus: function (e) { return e.target.select(); }, onChange: function (e) {
|
|
8697
8836
|
var value = e.target.value;
|
|
8698
8837
|
var numericValue = Number(value);
|
|
8699
8838
|
// Check if the value is a number and not empty
|
|
8700
8839
|
handleChange(index, numericValue, 'minScale');
|
|
8701
8840
|
} })),
|
|
8702
|
-
React__default.createElement("td",
|
|
8703
|
-
React__default.createElement("input", { type: "text", style: { width: '100%' }, value: tag.maxScale, onFocus: function (e) { return e.target.select(); }, onChange: function (e) {
|
|
8841
|
+
React__default.createElement("td", { className: classes.inputCol },
|
|
8842
|
+
React__default.createElement("input", { type: "text", style: { width: '100%' }, disabled: tag.autoScale, value: tag.maxScale, onFocus: function (e) { return e.target.select(); }, onChange: function (e) {
|
|
8704
8843
|
var value = e.target.value;
|
|
8705
8844
|
var numericValue = Number(value);
|
|
8706
8845
|
// Check if the value is a number and not empty
|
|
@@ -8708,34 +8847,24 @@ var TableComponent = function (_a) {
|
|
|
8708
8847
|
handleChange(index, numericValue, 'maxScale');
|
|
8709
8848
|
}
|
|
8710
8849
|
} })),
|
|
8711
|
-
React__default.createElement("td", {
|
|
8850
|
+
React__default.createElement("td", { className: "".concat(classes.autoScale, " ").concat(classes.checkbox) },
|
|
8851
|
+
React__default.createElement("input", { type: "text", style: { width: '100%' }, disabled: true, value: /* tag.unit */ "Unit ", onFocus: function (e) { return e.target.select(); } })),
|
|
8852
|
+
React__default.createElement("td", { className: "".concat(classes.autoScale, " ").concat(classes.checkbox) },
|
|
8712
8853
|
React__default.createElement("input", { type: "checkbox", checked: tag.autoScale, onChange: function (e) { return handleAutoScaleChange(index, e.target.checked); } })),
|
|
8713
|
-
React__default.createElement("td", null,
|
|
8714
|
-
|
|
8715
|
-
|
|
8716
|
-
|
|
8717
|
-
|
|
8718
|
-
day: 'numeric',
|
|
8719
|
-
hour: '2-digit',
|
|
8720
|
-
minute: '2-digit',
|
|
8721
|
-
second: '2-digit'
|
|
8722
|
-
});
|
|
8723
|
-
var milliseconds = date.getMilliseconds().toString().padStart(3, '0');
|
|
8724
|
-
return "".concat(formattedDate, ".").concat(milliseconds);
|
|
8725
|
-
})() : null),
|
|
8726
|
-
React__default.createElement("td", null, cursorData ? cursorData.values[index] : null))); }))))),
|
|
8854
|
+
React__default.createElement("td", null),
|
|
8855
|
+
React__default.createElement("td", { className: classes.doubleInput }),
|
|
8856
|
+
React__default.createElement("td", null, "y1y2"),
|
|
8857
|
+
React__default.createElement("td", null, "min"),
|
|
8858
|
+
React__default.createElement("td", null, "max"))); }))))),
|
|
8727
8859
|
selectedRowIndex !== null && (React__default.createElement(ContextMenu, { x: contextMenuPosition.x, y: contextMenuPosition.y, options: contextMenuOptions })),
|
|
8728
|
-
React__default.createElement(
|
|
8729
|
-
React__default.createElement(MesfModal.Content, null,
|
|
8730
|
-
React__default.createElement(Box, null,
|
|
8731
|
-
React__default.createElement(Typography, { id: "modal-modal-description" },
|
|
8732
|
-
React__default.createElement(TagSelectionModal, { isOpen: modalOpen, onClose: function () { return handleClose; }, onTagSelect: handleTagSelect })))))));
|
|
8860
|
+
React__default.createElement(AddTagModal, { open: addTagModalOpen, handleClose: handleClose, onTagSelect: handleTagSelect })));
|
|
8733
8861
|
};
|
|
8734
8862
|
|
|
8735
8863
|
var TrendingsInitialState = {
|
|
8736
8864
|
timeScopeStart: moment(new Date()).subtract(1, "days").toDate(),
|
|
8737
8865
|
timeScopeEnd: new Date(),
|
|
8738
|
-
scope: "1 day"
|
|
8866
|
+
scope: "1 day",
|
|
8867
|
+
graphPan: false
|
|
8739
8868
|
};
|
|
8740
8869
|
var TrendingsReducer = createSlice({
|
|
8741
8870
|
name: "__",
|
|
@@ -8788,13 +8917,19 @@ var TrendingsReducer = createSlice({
|
|
|
8788
8917
|
state.scope = payload.scope;
|
|
8789
8918
|
return;
|
|
8790
8919
|
}
|
|
8791
|
-
if (!isNil$1(payload.start) && !isNil$1(payload.end) && isNil$1(payload.
|
|
8792
|
-
// from
|
|
8920
|
+
if (!isNil$1(payload.start) && !isNil$1(payload.end) && isNil$1(payload.graphPan)) {
|
|
8921
|
+
// from zoom
|
|
8793
8922
|
state.timeScopeStart = payload.start;
|
|
8794
8923
|
state.timeScopeEnd = payload.end;
|
|
8795
8924
|
state.scope = "custom";
|
|
8796
8925
|
return;
|
|
8797
8926
|
}
|
|
8927
|
+
if (!isNil$1(payload.start) && !isNil$1(payload.end) && !isNil$1(payload.graphPan)) {
|
|
8928
|
+
// from pan
|
|
8929
|
+
state.timeScopeStart = payload.start;
|
|
8930
|
+
state.timeScopeEnd = payload.end;
|
|
8931
|
+
return;
|
|
8932
|
+
}
|
|
8798
8933
|
if (!isNil$1(payload.start)) {
|
|
8799
8934
|
state.timeScopeStart = payload.start;
|
|
8800
8935
|
if (state.scope !== "custom") {
|
|
@@ -8967,6 +9102,44 @@ var CustomOptionsComponent = function (_a) {
|
|
|
8967
9102
|
"Stepped"))));
|
|
8968
9103
|
};
|
|
8969
9104
|
|
|
9105
|
+
var DraggableLineControl = function (_a) {
|
|
9106
|
+
var initialLeft = _a.initialLeft, onUpdate = _a.onUpdate, color = _a.color, chartArea = _a.chartArea;
|
|
9107
|
+
var _b = useState(false), isDragging = _b[0], setIsDragging = _b[1];
|
|
9108
|
+
var _c = useState(initialLeft), left = _c[0], setLeft = _c[1];
|
|
9109
|
+
var ref = useRef(null);
|
|
9110
|
+
var handleMouseDown = function (e) {
|
|
9111
|
+
setIsDragging(true);
|
|
9112
|
+
e.stopPropagation();
|
|
9113
|
+
e.preventDefault();
|
|
9114
|
+
};
|
|
9115
|
+
var handleMouseMove = function (e) {
|
|
9116
|
+
if (!isDragging || !ref.current)
|
|
9117
|
+
return;
|
|
9118
|
+
chartArea.width - chartArea.right;
|
|
9119
|
+
chartArea.left;
|
|
9120
|
+
var newLeft = Math.min(Math.max(e.clientX - ref.current.offsetParent.getBoundingClientRect().left, chartArea.left), chartArea.right);
|
|
9121
|
+
setLeft(newLeft);
|
|
9122
|
+
onUpdate(newLeft); // Actualiza la posición de la línea en el gráfico
|
|
9123
|
+
};
|
|
9124
|
+
var handleMouseUp = function () {
|
|
9125
|
+
setIsDragging(false);
|
|
9126
|
+
};
|
|
9127
|
+
useEffect(function () {
|
|
9128
|
+
var mouseMoveHandler = function (e) { return handleMouseMove(e); };
|
|
9129
|
+
var mouseUpHandler = function () { return handleMouseUp(); };
|
|
9130
|
+
if (isDragging) {
|
|
9131
|
+
window.addEventListener('mousemove', mouseMoveHandler);
|
|
9132
|
+
window.addEventListener('mouseup', mouseUpHandler);
|
|
9133
|
+
}
|
|
9134
|
+
return function () {
|
|
9135
|
+
window.removeEventListener('mousemove', mouseMoveHandler);
|
|
9136
|
+
window.removeEventListener('mouseup', mouseUpHandler);
|
|
9137
|
+
};
|
|
9138
|
+
}, [isDragging]);
|
|
9139
|
+
return (React__default.createElement("div", { ref: ref, style: { height: 20, width: 20, background: color, position: 'absolute', top: -10, left: left - 10 }, onMouseDown: handleMouseDown },
|
|
9140
|
+
React__default.createElement("div", { style: { height: chartArea.height, width: 2, background: color, position: 'relative', top: 20, left: 0, right: 0, margin: 'auto' } })));
|
|
9141
|
+
};
|
|
9142
|
+
|
|
8970
9143
|
var dateNavigator = function (startDate, endDate, scope, operator) {
|
|
8971
9144
|
if (scope === "custom")
|
|
8972
9145
|
return;
|
|
@@ -8979,76 +9152,90 @@ var dateNavigator = function (startDate, endDate, scope, operator) {
|
|
|
8979
9152
|
};
|
|
8980
9153
|
|
|
8981
9154
|
Chart.register(CategoryScale, LinearScale, PointElement, LineElement, Title, Tooltip$1, Legend, TimeScale, zoomPlugin);
|
|
8982
|
-
function
|
|
9155
|
+
function getValuesAtCursor(chart, timeAtCursor) {
|
|
9156
|
+
var valuesAtCursor = [];
|
|
9157
|
+
chart.data.datasets.forEach(function (dataset) {
|
|
9158
|
+
var previousDataPoint = null;
|
|
9159
|
+
for (var i = 0; i < dataset.data.length; i++) {
|
|
9160
|
+
if (dataset.data[i].x.getTime() <= timeAtCursor) {
|
|
9161
|
+
previousDataPoint = dataset.data[i];
|
|
9162
|
+
}
|
|
9163
|
+
else {
|
|
9164
|
+
break;
|
|
9165
|
+
}
|
|
9166
|
+
}
|
|
9167
|
+
if (previousDataPoint) {
|
|
9168
|
+
valuesAtCursor.push(previousDataPoint.y);
|
|
9169
|
+
}
|
|
9170
|
+
});
|
|
9171
|
+
return valuesAtCursor;
|
|
9172
|
+
}
|
|
9173
|
+
function updateCursorData(chart, setCursorData) {
|
|
9174
|
+
var xScale = chart.scales.x;
|
|
9175
|
+
chart.scales.y;
|
|
9176
|
+
// Coordenadas para la primera línea
|
|
9177
|
+
var timeAtCursor1 = xScale.getValueForPixel(chart.mouseX);
|
|
9178
|
+
// Coordenadas para la segunda línea
|
|
9179
|
+
var timeAtCursor2 = xScale.getValueForPixel(chart.secondLineX);
|
|
9180
|
+
// Los valores en el punto del cursor pueden ser diferentes para cada línea si corresponden a diferentes series de datos
|
|
9181
|
+
var valuesAtCursor1 = getValuesAtCursor(chart, timeAtCursor1);
|
|
9182
|
+
var valuesAtCursor2 = getValuesAtCursor(chart, timeAtCursor2);
|
|
9183
|
+
setCursorData({
|
|
9184
|
+
x1: timeAtCursor1,
|
|
9185
|
+
x2: timeAtCursor2,
|
|
9186
|
+
values: __spreadArray(__spreadArray([], valuesAtCursor1, true), valuesAtCursor2, true)
|
|
9187
|
+
});
|
|
9188
|
+
}
|
|
9189
|
+
function getVerticalLinePlugin(setChartArea, setCoords) {
|
|
8983
9190
|
return {
|
|
8984
9191
|
id: "verticalLinePlugin",
|
|
9192
|
+
afterUpdate: function (chart) {
|
|
9193
|
+
if (chart.secondLineX === null) {
|
|
9194
|
+
chart.secondLineX = chart.scales.x.left + (chart.scales.x.width * 0.75);
|
|
9195
|
+
}
|
|
9196
|
+
if (chart.mouseX === null) {
|
|
9197
|
+
chart.mouseX = chart.scales.x.left + (chart.scales.x.width / 4);
|
|
9198
|
+
}
|
|
9199
|
+
},
|
|
8985
9200
|
beforeInit: function (chart) {
|
|
8986
|
-
var canvas = chart.canvas;
|
|
8987
9201
|
chart.mouseX = null;
|
|
8988
|
-
|
|
8989
|
-
var rect = canvas.getBoundingClientRect();
|
|
8990
|
-
chart.mouseX = event.clientX - rect.left;
|
|
8991
|
-
var xScale = chart.scales.x;
|
|
8992
|
-
var mouseXPixel = chart.mouseX - xScale.left; // Adjusting for the scale's position
|
|
8993
|
-
var timeAtCursor = xScale.min +
|
|
8994
|
-
(mouseXPixel * (xScale.max - xScale.min)) / xScale.width;
|
|
8995
|
-
var valuesAtCursor = [];
|
|
8996
|
-
// Loop through each dataset to find the previous y-values at the current x-position
|
|
8997
|
-
chart.data.datasets.forEach(function (dataset) {
|
|
8998
|
-
// Find the closest preceding data point
|
|
8999
|
-
var previousDataPoint = null;
|
|
9000
|
-
for (var i = 0; i < dataset.data.length; i++) {
|
|
9001
|
-
if (dataset.data[i].x.getTime() <= timeAtCursor) {
|
|
9002
|
-
previousDataPoint = dataset.data[i];
|
|
9003
|
-
}
|
|
9004
|
-
else {
|
|
9005
|
-
break;
|
|
9006
|
-
}
|
|
9007
|
-
}
|
|
9008
|
-
if (previousDataPoint) {
|
|
9009
|
-
valuesAtCursor.push(previousDataPoint.y);
|
|
9010
|
-
}
|
|
9011
|
-
});
|
|
9012
|
-
setCursorData({ x: timeAtCursor, values: valuesAtCursor });
|
|
9013
|
-
chart.draw();
|
|
9014
|
-
});
|
|
9202
|
+
chart.secondLineX = null;
|
|
9015
9203
|
},
|
|
9016
|
-
afterDatasetsDraw: function (chart
|
|
9017
|
-
|
|
9018
|
-
|
|
9019
|
-
|
|
9020
|
-
|
|
9021
|
-
var bottomY = chart.chartArea.bottom;
|
|
9022
|
-
ctx.save();
|
|
9023
|
-
ctx.beginPath();
|
|
9024
|
-
ctx.moveTo(x, topY);
|
|
9025
|
-
ctx.lineTo(x, bottomY);
|
|
9026
|
-
ctx.strokeStyle = "#ff0000"; // Customize line color
|
|
9027
|
-
ctx.lineWidth = 1; // Customize line width
|
|
9028
|
-
ctx.stroke();
|
|
9029
|
-
ctx.restore();
|
|
9030
|
-
}
|
|
9204
|
+
afterDatasetsDraw: function (chart) {
|
|
9205
|
+
var x1 = chart.mouseX;
|
|
9206
|
+
var x2 = chart.secondLineX;
|
|
9207
|
+
setChartArea(chart.chartArea);
|
|
9208
|
+
setCoords({ x1: x1, x2: x2 });
|
|
9031
9209
|
}
|
|
9032
9210
|
};
|
|
9033
9211
|
}
|
|
9034
9212
|
var Trending = function (_a) {
|
|
9035
9213
|
_a.title; var tags = _a.tags;
|
|
9036
9214
|
var _b = useTrendingContext(), state = _b.state, actions = _b.actions;
|
|
9215
|
+
var chartRef = useRef(null);
|
|
9037
9216
|
var _c = useState({
|
|
9038
9217
|
labels: [],
|
|
9039
9218
|
datasets: []
|
|
9040
9219
|
}), chartData = _c[0], setChartData = _c[1];
|
|
9041
|
-
var _d = useState(
|
|
9042
|
-
var _e = useState(null),
|
|
9043
|
-
var
|
|
9044
|
-
var
|
|
9220
|
+
var _d = useState(null), lineTabCoords = _d[0], setLineTabCoords = _d[1];
|
|
9221
|
+
var _e = useState(null), chartArea = _e[0], setChartArea = _e[1];
|
|
9222
|
+
var _f = useState(tags), tagList = _f[0], setTagList = _f[1];
|
|
9223
|
+
var _g = useState(null), cursorData = _g[0], setCursorData = _g[1];
|
|
9224
|
+
var verticalLinePlugin = getVerticalLinePlugin(setChartArea, setLineTabCoords);
|
|
9225
|
+
var _h = useState({
|
|
9045
9226
|
showGrid: true,
|
|
9046
9227
|
stepped: false
|
|
9047
|
-
}), customOptions =
|
|
9048
|
-
var
|
|
9049
|
-
var
|
|
9228
|
+
}), customOptions = _h[0], setCustomOptions = _h[1];
|
|
9229
|
+
var _j = useState(true), loading = _j[0], setLoading = _j[1];
|
|
9230
|
+
var _k = useState(""), error = _k[0], setError = _k[1];
|
|
9050
9231
|
var debounceTimerRef = useRef(null);
|
|
9051
9232
|
var classes = useTrendingStyles();
|
|
9233
|
+
var debouncedUpdateChart = useRef(debounce(function () {
|
|
9234
|
+
if (chartRef.current) {
|
|
9235
|
+
updateCursorData(chartRef.current, setCursorData);
|
|
9236
|
+
chartRef.current.update();
|
|
9237
|
+
}
|
|
9238
|
+
}, 250)).current;
|
|
9052
9239
|
var handleDateChange = function (newValue, key) {
|
|
9053
9240
|
var _a;
|
|
9054
9241
|
//@ts-ignore
|
|
@@ -9075,6 +9262,22 @@ var Trending = function (_a) {
|
|
|
9075
9262
|
});
|
|
9076
9263
|
}, 1000);
|
|
9077
9264
|
};
|
|
9265
|
+
var handlePan = function (_a) {
|
|
9266
|
+
var chart = _a.chart;
|
|
9267
|
+
if (debounceTimerRef.current) {
|
|
9268
|
+
clearTimeout(debounceTimerRef.current);
|
|
9269
|
+
}
|
|
9270
|
+
debounceTimerRef.current = setTimeout(function () {
|
|
9271
|
+
// Handle pan event and execute fetch
|
|
9272
|
+
var newStart = new Date(chart.scales.x.min);
|
|
9273
|
+
var newEnd = new Date(chart.scales.x.max);
|
|
9274
|
+
actions.setTotalScope({
|
|
9275
|
+
start: newStart,
|
|
9276
|
+
end: newEnd,
|
|
9277
|
+
graphPan: true
|
|
9278
|
+
});
|
|
9279
|
+
}, 1000);
|
|
9280
|
+
};
|
|
9078
9281
|
var handleDeleteTag = function (tagId) {
|
|
9079
9282
|
setTagList(function (prevTagList) {
|
|
9080
9283
|
return prevTagList.filter(function (tag) { return tag.tagId !== tagId; });
|
|
@@ -9097,7 +9300,7 @@ var Trending = function (_a) {
|
|
|
9097
9300
|
actions.setTotalScope({ start: newDates.newStartDate, end: newDates.newEndDate, scope: state.scope });
|
|
9098
9301
|
}
|
|
9099
9302
|
};
|
|
9100
|
-
var
|
|
9303
|
+
var _l = useState({
|
|
9101
9304
|
animation: {
|
|
9102
9305
|
duration: 0
|
|
9103
9306
|
},
|
|
@@ -9162,11 +9365,11 @@ var Trending = function (_a) {
|
|
|
9162
9365
|
pan: {
|
|
9163
9366
|
enabled: true,
|
|
9164
9367
|
mode: "x",
|
|
9165
|
-
onPan:
|
|
9368
|
+
onPan: handlePan
|
|
9166
9369
|
}
|
|
9167
9370
|
}
|
|
9168
9371
|
}
|
|
9169
|
-
}), chartOptions =
|
|
9372
|
+
}), chartOptions = _l[0], setChartOptions = _l[1];
|
|
9170
9373
|
useEffect(function () {
|
|
9171
9374
|
var fetchData = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
9172
9375
|
var tagIds, response, series_1, axes_1, updatedSeries, error_1;
|
|
@@ -9267,28 +9470,16 @@ var Trending = function (_a) {
|
|
|
9267
9470
|
changeOptions();
|
|
9268
9471
|
}, [customOptions]);
|
|
9269
9472
|
function areRangesSimilar(tag1, tag2) {
|
|
9270
|
-
var
|
|
9271
|
-
|
|
9272
|
-
|
|
9273
|
-
|
|
9274
|
-
|
|
9275
|
-
|
|
9276
|
-
|
|
9277
|
-
|
|
9278
|
-
var
|
|
9279
|
-
|
|
9280
|
-
var logTag2Min = safeLog(tag2.minScale);
|
|
9281
|
-
var logTag2Max = safeLog(tag2.maxScale);
|
|
9282
|
-
// Check if any log value is null, which indicates an invalid comparison
|
|
9283
|
-
if (logTag1Min === null ||
|
|
9284
|
-
logTag1Max === null ||
|
|
9285
|
-
logTag2Min === null ||
|
|
9286
|
-
logTag2Max === null) {
|
|
9287
|
-
return false;
|
|
9288
|
-
}
|
|
9289
|
-
var logDiffMin = Math.abs(logTag1Min - logTag2Min);
|
|
9290
|
-
var logDiffMax = Math.abs(logTag1Max - logTag2Max);
|
|
9291
|
-
return logDiffMin < threshold && logDiffMax < threshold;
|
|
9473
|
+
var range1 = tag1.maxScale - tag1.minScale; // Rango de la primera etiqueta
|
|
9474
|
+
var range2 = tag2.maxScale - tag2.minScale; // Rango de la segunda etiqueta
|
|
9475
|
+
// Determina los límites para la comparación
|
|
9476
|
+
var lowerBound = Math.max(tag1.minScale, tag2.minScale);
|
|
9477
|
+
var upperBound = Math.min(tag1.maxScale, tag2.maxScale);
|
|
9478
|
+
// Calcula el solapamiento entre los dos rangos
|
|
9479
|
+
var overlap = Math.max(0, upperBound - lowerBound);
|
|
9480
|
+
// Determina si el solapamiento es significativo comparado con los rangos individuales
|
|
9481
|
+
var isSignificantOverlap = (overlap / range1 > 0.5) && (overlap / range2 > 0.5);
|
|
9482
|
+
return isSignificantOverlap;
|
|
9292
9483
|
}
|
|
9293
9484
|
function calculateScales(min, max, sigDigits) {
|
|
9294
9485
|
var roundToSignificantDigits = function (num) {
|
|
@@ -9312,7 +9503,6 @@ var Trending = function (_a) {
|
|
|
9312
9503
|
return React__default.createElement("p", null,
|
|
9313
9504
|
"Error: ",
|
|
9314
9505
|
error);
|
|
9315
|
-
useRef(null);
|
|
9316
9506
|
useEffect(function () {
|
|
9317
9507
|
setChartOptions(function (prevOptions) { return (__assign(__assign({}, prevOptions), { scales: __assign(__assign({}, prevOptions.scales), { x: __assign(__assign({}, prevOptions.scales.x), { min: state.timeScopeStart.getTime(), max: state.timeScopeEnd.getTime() }) }) })); });
|
|
9318
9508
|
}, [state.timeScopeStart, state.timeScopeEnd]);
|
|
@@ -9348,21 +9538,66 @@ var Trending = function (_a) {
|
|
|
9348
9538
|
React__default.createElement(Grid$1, { md: 7, item: true, container: true, justifyContent: "space-between" },
|
|
9349
9539
|
React__default.createElement(Grid$1, { item: true, container: true, wrap: "nowrap", spacing: 1 },
|
|
9350
9540
|
React__default.createElement(Grid$1, { item: true, container: true },
|
|
9351
|
-
React__default.createElement(CustomOptionsComponent, { customOptions: customOptions, setCustomOptions: setCustomOptions })),
|
|
9352
|
-
React__default.createElement(Grid$1, { item: true, container: true, justifyContent: "flex-end" },
|
|
9353
|
-
React__default.createElement(Button$1, { variant: "contained", color: "primary" }, "Load View"),
|
|
9354
|
-
React__default.createElement(Button$1, { variant: "contained", color: "secondary" }, "Save View"))))),
|
|
9541
|
+
React__default.createElement(CustomOptionsComponent, { customOptions: customOptions, setCustomOptions: setCustomOptions }))))),
|
|
9355
9542
|
React__default.createElement(Grid$1, { item: true, xs: 12, style: { height: '45%' } },
|
|
9356
|
-
React__default.createElement(Paper$1, { style: { height: '100%',
|
|
9357
|
-
React__default.createElement(
|
|
9543
|
+
React__default.createElement(Paper$1, { style: { height: '100%', position: 'relative' } },
|
|
9544
|
+
lineTabCoords && chartArea ? (React__default.createElement(DraggableLineControl, { color: 'red', chartArea: chartArea, initialLeft: lineTabCoords === null || lineTabCoords === void 0 ? void 0 : lineTabCoords.x1, onUpdate: function (newLeft) {
|
|
9545
|
+
setLineTabCoords(function (prevCoords) {
|
|
9546
|
+
prevCoords.x1 = newLeft;
|
|
9547
|
+
return prevCoords;
|
|
9548
|
+
});
|
|
9549
|
+
// @ts-ignore
|
|
9550
|
+
chartRef.current.mouseX = newLeft;
|
|
9551
|
+
debouncedUpdateChart();
|
|
9552
|
+
} })) : null,
|
|
9553
|
+
lineTabCoords && chartArea ? (React__default.createElement(DraggableLineControl, { color: 'blue', initialLeft: lineTabCoords === null || lineTabCoords === void 0 ? void 0 : lineTabCoords.x2, chartArea: chartArea, onUpdate: function (newLeft) {
|
|
9554
|
+
setLineTabCoords(function (prevCoords) {
|
|
9555
|
+
prevCoords.x2 = newLeft;
|
|
9556
|
+
return prevCoords;
|
|
9557
|
+
});
|
|
9558
|
+
// @ts-ignore
|
|
9559
|
+
chartRef.current.secondLineX = newLeft;
|
|
9560
|
+
debouncedUpdateChart();
|
|
9561
|
+
} })) : null,
|
|
9562
|
+
React__default.createElement(Line, { ref: chartRef, data: chartData, options: chartOptions, plugins: [verticalLinePlugin] }))),
|
|
9358
9563
|
React__default.createElement(Grid$1, { item: true, xs: 12, style: { height: '40%', minWidth: "100%", paddingTop: "3rem" } },
|
|
9359
|
-
React__default.createElement(TableComponent, { tagList: tagList, setTagList: setTagList, cursorData: cursorData, onDeleteTag: handleDeleteTag, onAddTag: handleAddTag })),
|
|
9564
|
+
React__default.createElement(TableComponent, { tagList: tagList, chartData: chartData, setTagList: setTagList, cursorData: cursorData, onDeleteTag: handleDeleteTag, onAddTag: handleAddTag })),
|
|
9360
9565
|
loading && (React__default.createElement(Grid$1, { item: true, xs: 12, style: { textAlign: 'center' } },
|
|
9361
9566
|
React__default.createElement("p", null, "Loading...")))));
|
|
9362
9567
|
};
|
|
9363
9568
|
|
|
9364
|
-
//
|
|
9569
|
+
//tags
|
|
9570
|
+
var getTags = function (NodeName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
9571
|
+
var apiService, parameters, resp;
|
|
9572
|
+
return __generator(this, function (_a) {
|
|
9573
|
+
switch (_a.label) {
|
|
9574
|
+
case 0:
|
|
9575
|
+
apiService = new MESApiService();
|
|
9576
|
+
parameters = [];
|
|
9577
|
+
parameters.push({ name: "NodeName", value: NodeName });
|
|
9578
|
+
return [4 /*yield*/, apiService.callV2("[mssql2022].[IH_100020].[dbo].[GetTagDirectChildren]", parameters)];
|
|
9579
|
+
case 1:
|
|
9580
|
+
resp = _a.sent();
|
|
9581
|
+
return [2 /*return*/, resp];
|
|
9582
|
+
}
|
|
9583
|
+
});
|
|
9584
|
+
}); };
|
|
9585
|
+
|
|
9365
9586
|
var TrendingsIndex = function (props) {
|
|
9587
|
+
React.useEffect(function () {
|
|
9588
|
+
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
9589
|
+
var tags;
|
|
9590
|
+
return __generator(this, function (_a) {
|
|
9591
|
+
switch (_a.label) {
|
|
9592
|
+
case 0: return [4 /*yield*/, getTags(null)];
|
|
9593
|
+
case 1:
|
|
9594
|
+
tags = _a.sent();
|
|
9595
|
+
console.log(tags);
|
|
9596
|
+
return [2 /*return*/];
|
|
9597
|
+
}
|
|
9598
|
+
});
|
|
9599
|
+
}); })();
|
|
9600
|
+
}, []);
|
|
9366
9601
|
return (React.createElement(TrendingProvider, null,
|
|
9367
9602
|
React.createElement(Box, { p: 3, style: { maxWidth: "100%" } },
|
|
9368
9603
|
React.createElement(Paper, null,
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './ContextMenu.css';
|
|
3
3
|
import { CursorData, TagList } from './Trending';
|
|
4
|
+
import { ChartData } from 'chart.js';
|
|
4
5
|
interface TableComponentProps {
|
|
5
6
|
tagList: TagList;
|
|
6
7
|
setTagList: React.Dispatch<React.SetStateAction<TagList>>;
|
|
7
8
|
cursorData: CursorData;
|
|
8
9
|
onDeleteTag: (tagId: number) => void;
|
|
9
10
|
onAddTag: (tagId: number) => void;
|
|
11
|
+
chartData: ChartData;
|
|
10
12
|
}
|
|
11
13
|
declare const TableComponent: React.FC<TableComponentProps>;
|
|
12
14
|
export default TableComponent;
|
|
@@ -20,9 +20,14 @@ export interface Tag {
|
|
|
20
20
|
visible: boolean;
|
|
21
21
|
}
|
|
22
22
|
export interface CursorData {
|
|
23
|
-
|
|
23
|
+
x1: Date;
|
|
24
|
+
x2: Date;
|
|
24
25
|
values: number[];
|
|
25
26
|
}
|
|
27
|
+
export interface LineCoords {
|
|
28
|
+
x1: number;
|
|
29
|
+
x2: number;
|
|
30
|
+
}
|
|
26
31
|
export interface CustomOptions {
|
|
27
32
|
showGrid: boolean;
|
|
28
33
|
stepped: boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ChartArea } from 'chart.js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
interface DraggableLineControlProps {
|
|
4
|
+
chartArea: ChartArea;
|
|
5
|
+
initialLeft: number;
|
|
6
|
+
onUpdate: (newLeft: number) => void;
|
|
7
|
+
color: string;
|
|
8
|
+
}
|
|
9
|
+
declare const DraggableLineControl: React.FC<DraggableLineControlProps>;
|
|
10
|
+
export default DraggableLineControl;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Tag } from '../../../Trending';
|
|
3
|
+
interface Props {
|
|
4
|
+
open: boolean;
|
|
5
|
+
handleClose: () => void;
|
|
6
|
+
onTagSelect: (selected: Tag) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const AddTagModal: ({ open, handleClose, onTagSelect }: Props) => React.JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -4,29 +4,35 @@ export declare const useTrendingContext: () => {
|
|
|
4
4
|
timeScopeStart: Date;
|
|
5
5
|
timeScopeEnd: Date;
|
|
6
6
|
scope: import("../models/scopes.model").scopeType;
|
|
7
|
+
graphPan?: boolean | undefined;
|
|
7
8
|
};
|
|
8
9
|
actions: import("@reduxjs/toolkit").CaseReducerActions<{
|
|
9
10
|
setTotalScope(state: import("immer/dist/internal").WritableDraft<{
|
|
10
11
|
timeScopeStart: Date;
|
|
11
12
|
timeScopeEnd: Date;
|
|
12
13
|
scope: import("../models/scopes.model").scopeType;
|
|
14
|
+
graphPan?: boolean | undefined;
|
|
13
15
|
}>, { payload, type, }: {
|
|
14
16
|
payload: {
|
|
15
17
|
scope: import("../models/scopes.model").scopeType;
|
|
16
18
|
start?: Date | undefined;
|
|
17
19
|
end?: Date | undefined;
|
|
20
|
+
graphPan?: boolean | undefined;
|
|
18
21
|
} | {
|
|
19
22
|
scope?: import("../models/scopes.model").scopeType | undefined;
|
|
20
23
|
start: Date;
|
|
21
24
|
end?: Date | undefined;
|
|
25
|
+
graphPan?: boolean | undefined;
|
|
22
26
|
} | {
|
|
23
27
|
scope?: import("../models/scopes.model").scopeType | undefined;
|
|
24
28
|
start?: Date | undefined;
|
|
25
29
|
end: Date;
|
|
30
|
+
graphPan?: boolean | undefined;
|
|
26
31
|
} | {
|
|
27
|
-
scope
|
|
32
|
+
scope?: import("../models/scopes.model").scopeType | undefined;
|
|
28
33
|
start: Date;
|
|
29
34
|
end: Date;
|
|
35
|
+
graphPan: boolean;
|
|
30
36
|
};
|
|
31
37
|
type: string;
|
|
32
38
|
}): void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const getTags: (NodeName: string | null) => Promise<import("../../../../../services").ResponseMESF>;
|
|
2
|
+
export declare const getSeriesData: (TagIds: string, Start: number | null, End: number | null, SampleCount: number) => Promise<import("../../../../../services").ResponseMESF>;
|
|
3
|
+
export declare const saveTagDefaults: (TagId: number, Alias: string, Color: string, MinScale: number, MaxScale: number, Unit: string) => Promise<import("../../../../../services").ResponseMESF>;
|
|
4
|
+
export declare const getViewTags: (ViewId: number | null) => Promise<import("../../../../../services").ResponseMESF>;
|
|
5
|
+
export declare const upsertView: (ViewId: number | null, ViewName: string, UserName: string, isPublic: boolean) => Promise<import("../../../../../services").ResponseMESF>;
|
|
6
|
+
export declare const upsertViewTag: (ViewId: number, TagId: number, Color: string, MinScale: number, MaxScale: number, IsVisible: boolean) => Promise<import("../../../../../services").ResponseMESF>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useTagsTableStyles: (props?: any) => import("@material-ui/styles").ClassNameMap<"checkbox">;
|
|
1
|
+
export declare const useTagsTableStyles: (props?: any) => import("@material-ui/styles").ClassNameMap<"checkbox" | "color" | "scale" | "visible" | "rowHover" | "topTitles" | "bottomTitlesRow" | "doubleInput" | "inputCol" | "autoScale" | "unit" | "xStats">;
|
|
@@ -3,28 +3,34 @@ export declare const TrendingsReducer: import("@reduxjs/toolkit").Slice<{
|
|
|
3
3
|
timeScopeStart: Date;
|
|
4
4
|
timeScopeEnd: Date;
|
|
5
5
|
scope: scopeType;
|
|
6
|
+
graphPan?: boolean | undefined;
|
|
6
7
|
}, {
|
|
7
8
|
setTotalScope(state: import("immer/dist/internal").WritableDraft<{
|
|
8
9
|
timeScopeStart: Date;
|
|
9
10
|
timeScopeEnd: Date;
|
|
10
11
|
scope: scopeType;
|
|
12
|
+
graphPan?: boolean | undefined;
|
|
11
13
|
}>, { payload, type, }: {
|
|
12
14
|
payload: {
|
|
13
15
|
scope: scopeType;
|
|
14
16
|
start?: Date;
|
|
15
17
|
end?: Date;
|
|
18
|
+
graphPan?: boolean;
|
|
16
19
|
} | {
|
|
17
20
|
scope?: scopeType;
|
|
18
21
|
start: Date;
|
|
19
22
|
end?: Date;
|
|
23
|
+
graphPan?: boolean;
|
|
20
24
|
} | {
|
|
21
25
|
scope?: scopeType;
|
|
22
26
|
start?: Date;
|
|
23
27
|
end: Date;
|
|
28
|
+
graphPan?: boolean;
|
|
24
29
|
} | {
|
|
25
|
-
scope
|
|
30
|
+
scope?: scopeType;
|
|
26
31
|
start: Date;
|
|
27
32
|
end: Date;
|
|
33
|
+
graphPan: boolean;
|
|
28
34
|
};
|
|
29
35
|
type: string;
|
|
30
36
|
}): void;
|