@dexteel/mesf-core 4.5.10 → 4.6.1
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 +5 -1
- package/dist/components/shared/buttons/button-with-loading.d.ts +9 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.esm.js +1049 -742
- package/dist/index.esm.js.map +1 -1
- package/dist/pages/trendings/TrendingsPage.d.ts +4 -0
- package/dist/pages/trendings/components/chart/TableComponent.d.ts +1 -3
- package/dist/pages/trendings/components/chart/Trending.d.ts +0 -2
- package/dist/pages/trendings/components/chart/components/modals/addTagModal/AddTagModal.d.ts +2 -2
- package/dist/pages/trendings/components/chart/components/modals/addTagModal/TagSelectionModal.d.ts +2 -2
- package/dist/pages/trendings/components/chart/components/modals/loadView/LoadViewModal.d.ts +7 -0
- package/dist/pages/trendings/components/chart/components/modals/saveAsView/SaveAsViewModal.d.ts +7 -0
- package/dist/pages/trendings/components/chart/context/TrendingContext.d.ts +47 -0
- package/dist/pages/trendings/components/chart/hooks/useTagsDataTable.d.ts +3 -3
- package/dist/pages/trendings/components/chart/models/TrendingModels.d.ts +25 -0
- package/dist/pages/trendings/components/chart/repository/TrendingRepository.d.ts +4 -5
- package/dist/pages/trendings/components/chart/sections/trending-chart.d.ts +3 -4
- package/dist/pages/trendings/components/chart/styles/TrendingStyles.d.ts +1 -1
- package/dist/pages/trendings/components/chart/utils/areRangeSimilar.d.ts +2 -2
- package/dist/pages/trendings/index.d.ts +3 -4
- package/dist/pages/trendings/reducers/trendings.reducer.d.ts +58 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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, debounce, createStyles as createStyles$1, List, ListItem, ListItemText } from '@material-ui/core';
|
|
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, Divider, Tooltip, IconButton as IconButton$1, FormControl as FormControl$1, Select as Select$1, debounce, createStyles as createStyles$1, List, ListItem, ListItemText } from '@material-ui/core';
|
|
2
2
|
import { values, get, isNil as isNil$1, isEmpty, isNaN } 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';
|
|
@@ -20,15 +20,15 @@ import Grid from '@material-ui/core/Grid';
|
|
|
20
20
|
import { isNil, get as get$1 } from 'lodash';
|
|
21
21
|
import { DndProvider } from 'react-dnd';
|
|
22
22
|
import { HTML5Backend } from 'react-dnd-html5-backend';
|
|
23
|
+
import moment from 'moment';
|
|
23
24
|
import axios from 'axios';
|
|
24
25
|
import { _adapters, Chart, CategoryScale, LinearScale, PointElement, LineElement, Title, Tooltip as Tooltip$1, Legend, TimeScale } from 'chart.js';
|
|
25
|
-
import moment from 'moment';
|
|
26
26
|
import zoomPlugin from 'chartjs-plugin-zoom';
|
|
27
27
|
import Popover from '@material-ui/core/Popover';
|
|
28
28
|
import ArrowDropDownIcon from '@material-ui/icons/ArrowDropDown';
|
|
29
29
|
import FolderIcon from '@material-ui/icons/Folder';
|
|
30
30
|
import InsertDriveFileIcon from '@material-ui/icons/InsertDriveFile';
|
|
31
|
-
import { Alert as Alert$3, TreeView as TreeView$1, TreeItem as TreeItem$1 } from '@material-ui/lab';
|
|
31
|
+
import { Alert as Alert$3, TreeView as TreeView$1, TreeItem as TreeItem$1, Autocomplete } from '@material-ui/lab';
|
|
32
32
|
import { ArrowRight, ChevronLeft, ChevronRight } from '@material-ui/icons';
|
|
33
33
|
import { Line } from 'react-chartjs-2';
|
|
34
34
|
import PersonPinCircleIcon from '@material-ui/icons/PersonPinCircle';
|
|
@@ -1298,7 +1298,7 @@ var DialogTitle = withStyles(styles)(function (props) {
|
|
|
1298
1298
|
var DialogContent = withStyles(function (theme) { return ({
|
|
1299
1299
|
root: {
|
|
1300
1300
|
padding: theme.spacing(2),
|
|
1301
|
-
minWidth:
|
|
1301
|
+
minWidth: 600
|
|
1302
1302
|
}
|
|
1303
1303
|
}); })(DialogContent$1);
|
|
1304
1304
|
var DialogActions = withStyles(function (theme) { return ({
|
|
@@ -8283,6 +8283,213 @@ var Home = function () { return (React__default.createElement("div", { style: {
|
|
|
8283
8283
|
position: "absolute"
|
|
8284
8284
|
} })); };
|
|
8285
8285
|
|
|
8286
|
+
var TrendingsInitialState = {
|
|
8287
|
+
timeScopeStart: moment(new Date()).subtract(1, "days").toDate(),
|
|
8288
|
+
timeScopeEnd: new Date(),
|
|
8289
|
+
scope: "1 day",
|
|
8290
|
+
graphPan: false,
|
|
8291
|
+
graphShouldUpdate: 0,
|
|
8292
|
+
views: [
|
|
8293
|
+
{
|
|
8294
|
+
ViewId: 0,
|
|
8295
|
+
ViewName: '',
|
|
8296
|
+
UserName: null,
|
|
8297
|
+
IsPublic: false,
|
|
8298
|
+
LastModified: null,
|
|
8299
|
+
LastModifiedBy: null
|
|
8300
|
+
}
|
|
8301
|
+
],
|
|
8302
|
+
viewSelected: null,
|
|
8303
|
+
viewTags: [
|
|
8304
|
+
{
|
|
8305
|
+
ViewId: 0,
|
|
8306
|
+
TagId: 0,
|
|
8307
|
+
TagName: '',
|
|
8308
|
+
Color: '',
|
|
8309
|
+
IsVisible: true,
|
|
8310
|
+
MinScale: 0,
|
|
8311
|
+
MaxScale: 0,
|
|
8312
|
+
IsAutoScale: true,
|
|
8313
|
+
Alias: '',
|
|
8314
|
+
TagType: '',
|
|
8315
|
+
Unit: ''
|
|
8316
|
+
}
|
|
8317
|
+
]
|
|
8318
|
+
};
|
|
8319
|
+
var TrendingsReducer = createSlice({
|
|
8320
|
+
name: "__",
|
|
8321
|
+
initialState: TrendingsInitialState,
|
|
8322
|
+
reducers: {
|
|
8323
|
+
setTotalScope: function (state, _a) {
|
|
8324
|
+
var payload = _a.payload; _a.type;
|
|
8325
|
+
state.graphShouldUpdate += 1;
|
|
8326
|
+
if (!isNil$1(payload.start) && !isNil$1(payload.end) && !isNil$1(payload.scope)) {
|
|
8327
|
+
//from arrow navigators
|
|
8328
|
+
state.timeScopeStart = payload.start;
|
|
8329
|
+
state.timeScopeEnd = payload.end;
|
|
8330
|
+
state.scope = payload.scope;
|
|
8331
|
+
return;
|
|
8332
|
+
}
|
|
8333
|
+
if (!isNil$1(payload.scope)) {
|
|
8334
|
+
if (payload.scope !== "custom") {
|
|
8335
|
+
switch (payload.scope) {
|
|
8336
|
+
case "10 min":
|
|
8337
|
+
state.timeScopeStart = moment(state.timeScopeEnd)
|
|
8338
|
+
.subtract(10, "minutes")
|
|
8339
|
+
.toDate();
|
|
8340
|
+
break;
|
|
8341
|
+
case "1 hour":
|
|
8342
|
+
state.timeScopeStart = moment(state.timeScopeEnd)
|
|
8343
|
+
.subtract(1, "hours")
|
|
8344
|
+
.toDate();
|
|
8345
|
+
break;
|
|
8346
|
+
case "4 hours":
|
|
8347
|
+
state.timeScopeStart = moment(state.timeScopeEnd)
|
|
8348
|
+
.subtract(4, "hours")
|
|
8349
|
+
.toDate();
|
|
8350
|
+
break;
|
|
8351
|
+
case "12 hours":
|
|
8352
|
+
state.timeScopeStart = moment(state.timeScopeEnd)
|
|
8353
|
+
.subtract(12, "hours")
|
|
8354
|
+
.toDate();
|
|
8355
|
+
break;
|
|
8356
|
+
case "1 day":
|
|
8357
|
+
state.timeScopeStart = moment(state.timeScopeEnd)
|
|
8358
|
+
.subtract(1, "days")
|
|
8359
|
+
.toDate();
|
|
8360
|
+
break;
|
|
8361
|
+
case "10 days":
|
|
8362
|
+
state.timeScopeStart = moment(state.timeScopeEnd)
|
|
8363
|
+
.subtract(10, "days")
|
|
8364
|
+
.toDate();
|
|
8365
|
+
break;
|
|
8366
|
+
}
|
|
8367
|
+
}
|
|
8368
|
+
state.scope = payload.scope;
|
|
8369
|
+
return;
|
|
8370
|
+
}
|
|
8371
|
+
if (!isNil$1(payload.start) && !isNil$1(payload.end) && isNil$1(payload.graphPan)) {
|
|
8372
|
+
// from zoom
|
|
8373
|
+
state.timeScopeStart = payload.start;
|
|
8374
|
+
state.timeScopeEnd = payload.end;
|
|
8375
|
+
state.scope = "custom";
|
|
8376
|
+
return;
|
|
8377
|
+
}
|
|
8378
|
+
if (!isNil$1(payload.start) && !isNil$1(payload.end) && !isNil$1(payload.graphPan)) {
|
|
8379
|
+
// from pan
|
|
8380
|
+
state.timeScopeStart = payload.start;
|
|
8381
|
+
state.timeScopeEnd = payload.end;
|
|
8382
|
+
return;
|
|
8383
|
+
}
|
|
8384
|
+
if (!isNil$1(payload.start)) {
|
|
8385
|
+
state.timeScopeStart = payload.start;
|
|
8386
|
+
if (state.scope !== "custom") {
|
|
8387
|
+
switch (state.scope) {
|
|
8388
|
+
case "10 min":
|
|
8389
|
+
state.timeScopeEnd = moment(payload.start)
|
|
8390
|
+
.add(10, "minutes")
|
|
8391
|
+
.toDate();
|
|
8392
|
+
break;
|
|
8393
|
+
case "1 hour":
|
|
8394
|
+
state.timeScopeEnd = moment(payload.start)
|
|
8395
|
+
.add(1, "hours")
|
|
8396
|
+
.toDate();
|
|
8397
|
+
break;
|
|
8398
|
+
case "4 hours":
|
|
8399
|
+
state.timeScopeEnd = moment(payload.start)
|
|
8400
|
+
.add(4, "hours")
|
|
8401
|
+
.toDate();
|
|
8402
|
+
break;
|
|
8403
|
+
case "12 hours":
|
|
8404
|
+
state.timeScopeEnd = moment(payload.start)
|
|
8405
|
+
.add(12, "hours")
|
|
8406
|
+
.toDate();
|
|
8407
|
+
break;
|
|
8408
|
+
case "1 day":
|
|
8409
|
+
state.timeScopeEnd = moment(payload.start)
|
|
8410
|
+
.add(1, "days")
|
|
8411
|
+
.toDate();
|
|
8412
|
+
break;
|
|
8413
|
+
case "10 days":
|
|
8414
|
+
state.timeScopeEnd = moment(payload.start)
|
|
8415
|
+
.add(10, "days")
|
|
8416
|
+
.toDate();
|
|
8417
|
+
break;
|
|
8418
|
+
}
|
|
8419
|
+
}
|
|
8420
|
+
return;
|
|
8421
|
+
}
|
|
8422
|
+
if (!isNil$1(payload.end)) {
|
|
8423
|
+
state.timeScopeEnd = payload.end;
|
|
8424
|
+
if (state.scope !== "custom") {
|
|
8425
|
+
switch (state.scope) {
|
|
8426
|
+
case "10 min":
|
|
8427
|
+
state.timeScopeStart = moment(payload.end)
|
|
8428
|
+
.subtract(10, "minutes")
|
|
8429
|
+
.toDate();
|
|
8430
|
+
break;
|
|
8431
|
+
case "1 hour":
|
|
8432
|
+
state.timeScopeStart = moment(payload.end)
|
|
8433
|
+
.subtract(1, "hours")
|
|
8434
|
+
.toDate();
|
|
8435
|
+
break;
|
|
8436
|
+
case "4 hours":
|
|
8437
|
+
state.timeScopeStart = moment(payload.end)
|
|
8438
|
+
.subtract(4, "hours")
|
|
8439
|
+
.toDate();
|
|
8440
|
+
break;
|
|
8441
|
+
case "12 hours":
|
|
8442
|
+
state.timeScopeStart = moment(payload.end)
|
|
8443
|
+
.subtract(12, "hours")
|
|
8444
|
+
.toDate();
|
|
8445
|
+
break;
|
|
8446
|
+
case "1 day":
|
|
8447
|
+
state.timeScopeStart = moment(payload.end)
|
|
8448
|
+
.subtract(1, "days")
|
|
8449
|
+
.toDate();
|
|
8450
|
+
break;
|
|
8451
|
+
case "10 days":
|
|
8452
|
+
state.timeScopeStart = moment(payload.end)
|
|
8453
|
+
.subtract(10, "days")
|
|
8454
|
+
.toDate();
|
|
8455
|
+
break;
|
|
8456
|
+
}
|
|
8457
|
+
}
|
|
8458
|
+
return;
|
|
8459
|
+
}
|
|
8460
|
+
},
|
|
8461
|
+
setViews: function (state, _a) {
|
|
8462
|
+
var payload = _a.payload;
|
|
8463
|
+
state.views = payload;
|
|
8464
|
+
},
|
|
8465
|
+
setViewSelected: function (state, _a) {
|
|
8466
|
+
var payload = _a.payload;
|
|
8467
|
+
state.viewSelected = payload;
|
|
8468
|
+
},
|
|
8469
|
+
setViewTags: function (state, _a) {
|
|
8470
|
+
var payload = _a.payload;
|
|
8471
|
+
state.viewTags = payload;
|
|
8472
|
+
},
|
|
8473
|
+
setGraphShouldUpdate: function (state) {
|
|
8474
|
+
state.graphShouldUpdate = +1;
|
|
8475
|
+
}
|
|
8476
|
+
}
|
|
8477
|
+
});
|
|
8478
|
+
|
|
8479
|
+
var TrendingContext = createContext({
|
|
8480
|
+
state: TrendingsReducer.getInitialState(),
|
|
8481
|
+
actions: TrendingsReducer.actions
|
|
8482
|
+
});
|
|
8483
|
+
var useTrendingContext = function () { return useContext(TrendingContext); };
|
|
8484
|
+
var TrendingProvider = function (_a) {
|
|
8485
|
+
var children = _a.children;
|
|
8486
|
+
var _b = useComplexState({
|
|
8487
|
+
initialState: TrendingsReducer.getInitialState(),
|
|
8488
|
+
reducers: TrendingsReducer.caseReducers
|
|
8489
|
+
}), state = _b[0], actions = _b[1];
|
|
8490
|
+
return (React__default.createElement(TrendingContext.Provider, { value: { state: state, actions: actions } }, children));
|
|
8491
|
+
};
|
|
8492
|
+
|
|
8286
8493
|
/*!
|
|
8287
8494
|
* chartjs-adapter-moment v1.0.1
|
|
8288
8495
|
* https://www.chartjs.org
|
|
@@ -8422,8 +8629,9 @@ var ColorPicker = function (_a) {
|
|
|
8422
8629
|
var TagSelectionModal = function (_a) {
|
|
8423
8630
|
var isOpen = _a.isOpen; _a.onClose; var onTagSelect = _a.onTagSelect;
|
|
8424
8631
|
var _b = useState(true), isLoading = _b[0], setIsLoading = _b[1];
|
|
8425
|
-
var _c = useState(
|
|
8426
|
-
var _d = useState([]),
|
|
8632
|
+
var _c = useState(''), error = _c[0], setError = _c[1];
|
|
8633
|
+
var _d = useState([]), treeData = _d[0], setTreeData = _d[1];
|
|
8634
|
+
var _e = useState([]), expanded = _e[0], setExpanded = _e[1];
|
|
8427
8635
|
var currentColorIndex = useRef(0);
|
|
8428
8636
|
useEffect(function () {
|
|
8429
8637
|
var loadData = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -8438,8 +8646,8 @@ var TagSelectionModal = function (_a) {
|
|
|
8438
8646
|
children = _a.sent();
|
|
8439
8647
|
setTreeData([
|
|
8440
8648
|
{
|
|
8441
|
-
|
|
8442
|
-
|
|
8649
|
+
TagId: null,
|
|
8650
|
+
TagName: "root",
|
|
8443
8651
|
children: children,
|
|
8444
8652
|
isLoaded: true,
|
|
8445
8653
|
shortName: "Tags",
|
|
@@ -8488,20 +8696,19 @@ var TagSelectionModal = function (_a) {
|
|
|
8488
8696
|
case 1:
|
|
8489
8697
|
children = _a.sent();
|
|
8490
8698
|
return [2 /*return*/, {
|
|
8491
|
-
|
|
8492
|
-
|
|
8699
|
+
TagId: dbTag.tagId,
|
|
8700
|
+
TagName: childTagName,
|
|
8493
8701
|
shortName: dbTag.tagName,
|
|
8494
8702
|
children: children,
|
|
8495
8703
|
isLoaded: true,
|
|
8496
8704
|
tag: {
|
|
8497
|
-
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
|
|
8501
|
-
|
|
8502
|
-
|
|
8503
|
-
|
|
8504
|
-
visible: true
|
|
8705
|
+
TagId: dbTag.tagId,
|
|
8706
|
+
TagName: dbTag.tagName,
|
|
8707
|
+
Color: getColor(),
|
|
8708
|
+
IsAutoScale: true,
|
|
8709
|
+
MinScale: dbTag.minScale,
|
|
8710
|
+
MaxScale: dbTag.maxScale,
|
|
8711
|
+
IsVisible: true
|
|
8505
8712
|
}
|
|
8506
8713
|
}];
|
|
8507
8714
|
}
|
|
@@ -8514,7 +8721,7 @@ var TagSelectionModal = function (_a) {
|
|
|
8514
8721
|
return [2 /*return*/, childrenData];
|
|
8515
8722
|
case 4:
|
|
8516
8723
|
error_1 = _a.sent();
|
|
8517
|
-
|
|
8724
|
+
setError(error_1.message);
|
|
8518
8725
|
return [2 /*return*/, []];
|
|
8519
8726
|
case 5: return [2 /*return*/];
|
|
8520
8727
|
}
|
|
@@ -8533,7 +8740,7 @@ var TagSelectionModal = function (_a) {
|
|
|
8533
8740
|
var node;
|
|
8534
8741
|
return __generator(this, function (_a) {
|
|
8535
8742
|
node = findNode(treeData, nodeId);
|
|
8536
|
-
if (node === null || node === void 0 ? void 0 : node.
|
|
8743
|
+
if (node === null || node === void 0 ? void 0 : node.TagId) {
|
|
8537
8744
|
onTagSelect(node.tag);
|
|
8538
8745
|
}
|
|
8539
8746
|
return [2 /*return*/];
|
|
@@ -8542,7 +8749,7 @@ var TagSelectionModal = function (_a) {
|
|
|
8542
8749
|
var findNode = function (nodes, tagName) {
|
|
8543
8750
|
for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
|
|
8544
8751
|
var node = nodes_1[_i];
|
|
8545
|
-
if (node.
|
|
8752
|
+
if (node.TagName === tagName) {
|
|
8546
8753
|
return node;
|
|
8547
8754
|
}
|
|
8548
8755
|
else if (node.children) {
|
|
@@ -8553,553 +8760,733 @@ var TagSelectionModal = function (_a) {
|
|
|
8553
8760
|
}
|
|
8554
8761
|
return null;
|
|
8555
8762
|
};
|
|
8556
|
-
var renderTree = function (node) { return (React__default.createElement(TreeItem$1, { key: node.
|
|
8557
|
-
return (React__default.createElement(
|
|
8558
|
-
|
|
8559
|
-
|
|
8560
|
-
|
|
8561
|
-
|
|
8562
|
-
|
|
8563
|
-
React__default.createElement(
|
|
8763
|
+
var renderTree = function (node) { return (React__default.createElement(TreeItem$1, { key: node.TagName, nodeId: node.TagName, label: node.shortName, endIcon: React__default.createElement(ArrowDropDownIcon, null), icon: node.children && node.children.length > 0 ? (React__default.createElement(FolderIcon, null)) : (React__default.createElement(InsertDriveFileIcon, null)) }, node.children && node.children.map(function (child) { return renderTree(child); }))); };
|
|
8764
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
8765
|
+
React__default.createElement("div", { style: {
|
|
8766
|
+
display: isOpen ? "block" : "none",
|
|
8767
|
+
minHeight: "400px",
|
|
8768
|
+
minWidth: "600px"
|
|
8769
|
+
} },
|
|
8770
|
+
React__default.createElement("div", null, isLoading ? (React__default.createElement(Grid$1, { container: true, justifyContent: "center", alignItems: "center", style: { minHeight: "100px" } },
|
|
8771
|
+
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); }))))),
|
|
8772
|
+
React__default.createElement(ErrorModal, { error: error, onHide: function () { return setError(''); } })));
|
|
8564
8773
|
};
|
|
8565
8774
|
|
|
8566
8775
|
var AddTagModal = function (_a) {
|
|
8567
8776
|
var open = _a.open, handleClose = _a.handleClose, onTagSelect = _a.onTagSelect;
|
|
8568
|
-
return (React__default.createElement(
|
|
8569
|
-
React__default.createElement(MesfModal
|
|
8570
|
-
React__default.createElement(
|
|
8571
|
-
React__default.createElement(
|
|
8572
|
-
React__default.createElement(
|
|
8777
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
8778
|
+
React__default.createElement(MesfModal, { open: open, handleClose: handleClose, maxWidth: "lg", "aria-labelledby": "modal-modal-title", "aria-describedby": "modal-modal-description", title: 'Tags' },
|
|
8779
|
+
React__default.createElement(MesfModal.Content, null,
|
|
8780
|
+
React__default.createElement(Box, null,
|
|
8781
|
+
React__default.createElement(Typography, { id: "modal-modal-description" },
|
|
8782
|
+
React__default.createElement(TagSelectionModal, { isOpen: open, onClose: function () { return handleClose; }, onTagSelect: onTagSelect })))))));
|
|
8573
8783
|
};
|
|
8574
8784
|
|
|
8575
|
-
var
|
|
8576
|
-
var
|
|
8577
|
-
return
|
|
8578
|
-
|
|
8579
|
-
|
|
8580
|
-
var dataTable = {};
|
|
8581
|
-
if (cursorData) {
|
|
8582
|
-
var _loop_1 = function (idx) {
|
|
8583
|
-
var tag = tagList[idx];
|
|
8584
|
-
var datasetForTag = ((_a = chartData.datasets.find(function (ds) { return ds.tagId === tag.tagId; })) === null || _a === void 0 ? void 0 : _a.data) || [];
|
|
8585
|
-
var p1 = { x: new Date('1900-01-01'), y: 0 };
|
|
8586
|
-
var p2 = { x: new Date('1900-01-01'), y: 0 };
|
|
8587
|
-
var p1Found = false;
|
|
8588
|
-
var pmin = { x: 0, y: Number.POSITIVE_INFINITY };
|
|
8589
|
-
var pmax = { x: 0, y: Number.NEGATIVE_INFINITY };
|
|
8590
|
-
for (var idx_1 = 0; idx_1 < datasetForTag.length; idx_1++) {
|
|
8591
|
-
var curr = datasetForTag[idx_1];
|
|
8592
|
-
var currentVal = curr.x;
|
|
8593
|
-
if (!p1Found) {
|
|
8594
|
-
if (currentVal < cursorData.x1) {
|
|
8595
|
-
p1 = curr;
|
|
8596
|
-
p2 = JSON.parse(JSON.stringify(p1));
|
|
8597
|
-
pmin = JSON.parse(JSON.stringify(p1));
|
|
8598
|
-
pmax = JSON.parse(JSON.stringify(p1));
|
|
8599
|
-
continue;
|
|
8600
|
-
}
|
|
8601
|
-
else {
|
|
8602
|
-
p1Found = true;
|
|
8603
|
-
}
|
|
8604
|
-
}
|
|
8605
|
-
else {
|
|
8606
|
-
if (currentVal < cursorData.x2) {
|
|
8607
|
-
p2 = curr;
|
|
8608
|
-
if (pmin['y'] > curr['y']) {
|
|
8609
|
-
pmin = JSON.parse(JSON.stringify(curr));
|
|
8610
|
-
}
|
|
8611
|
-
if (pmax['y'] < curr['y']) {
|
|
8612
|
-
pmax = JSON.parse(JSON.stringify(curr));
|
|
8613
|
-
}
|
|
8614
|
-
}
|
|
8615
|
-
else {
|
|
8616
|
-
break;
|
|
8617
|
-
}
|
|
8618
|
-
}
|
|
8619
|
-
}
|
|
8620
|
-
dataTable[tag.tagName] = {
|
|
8621
|
-
y1: p1.y,
|
|
8622
|
-
y2: p2.y,
|
|
8623
|
-
y2y1: Number(p2.y) - Number(p1.y),
|
|
8624
|
-
pmin: pmin,
|
|
8625
|
-
pmax: pmax
|
|
8626
|
-
};
|
|
8627
|
-
};
|
|
8628
|
-
for (var idx = 0; idx < tagList.length; idx++) {
|
|
8629
|
-
_loop_1(idx);
|
|
8630
|
-
}
|
|
8631
|
-
}
|
|
8632
|
-
return dataTable;
|
|
8633
|
-
}, [tagList, chartData, cursorData]);
|
|
8785
|
+
var ButtonWithLoading = function (_a) {
|
|
8786
|
+
var children = _a.children, isLoading = _a.isLoading, props = __rest(_a, ["children", "isLoading"]);
|
|
8787
|
+
return (React__default.createElement(Button$1, __assign({}, props, { disabled: isLoading }),
|
|
8788
|
+
isLoading && React__default.createElement(CircularProgress$1, { size: "1rem" }),
|
|
8789
|
+
children));
|
|
8634
8790
|
};
|
|
8635
8791
|
|
|
8636
|
-
var
|
|
8637
|
-
|
|
8638
|
-
|
|
8639
|
-
|
|
8640
|
-
|
|
8641
|
-
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
|
|
8792
|
+
var saveTagDefaults = function (TagId, Alias, Color, MinScale, MaxScale, Unit) { return __awaiter(void 0, void 0, void 0, function () {
|
|
8793
|
+
var apiService, parameters, resp;
|
|
8794
|
+
return __generator(this, function (_a) {
|
|
8795
|
+
switch (_a.label) {
|
|
8796
|
+
case 0:
|
|
8797
|
+
apiService = new MESApiService();
|
|
8798
|
+
parameters = [];
|
|
8799
|
+
parameters.push({ name: "TagId", value: TagId });
|
|
8800
|
+
parameters.push({ name: "Alias", value: Alias });
|
|
8801
|
+
parameters.push({ name: "Color", value: Color });
|
|
8802
|
+
parameters.push({ name: "MinScale", value: MinScale });
|
|
8803
|
+
parameters.push({ name: "MaxScale", value: MaxScale });
|
|
8804
|
+
parameters.push({ name: "Unit", value: Unit });
|
|
8805
|
+
return [4 /*yield*/, apiService.callV2("[mssql2022].[IH_100020].[ih].[SaveTagDefaults]", parameters)];
|
|
8806
|
+
case 1:
|
|
8807
|
+
resp = _a.sent();
|
|
8808
|
+
return [2 /*return*/, resp];
|
|
8646
8809
|
}
|
|
8647
|
-
}
|
|
8648
|
-
|
|
8649
|
-
|
|
8650
|
-
|
|
8651
|
-
|
|
8652
|
-
|
|
8653
|
-
|
|
8654
|
-
|
|
8655
|
-
|
|
8810
|
+
});
|
|
8811
|
+
}); };
|
|
8812
|
+
//views
|
|
8813
|
+
var getViews = function (Search) { return __awaiter(void 0, void 0, void 0, function () {
|
|
8814
|
+
var apiService, parameters, resp;
|
|
8815
|
+
return __generator(this, function (_a) {
|
|
8816
|
+
switch (_a.label) {
|
|
8817
|
+
case 0:
|
|
8818
|
+
apiService = new MESApiService();
|
|
8819
|
+
parameters = [];
|
|
8820
|
+
parameters.push({ name: "Search", value: Search });
|
|
8821
|
+
return [4 /*yield*/, apiService.callV2("[mssql2022].[IH_100020].[ih].[GetViews]", parameters)];
|
|
8822
|
+
case 1:
|
|
8823
|
+
resp = _a.sent();
|
|
8824
|
+
return [2 /*return*/, resp];
|
|
8825
|
+
}
|
|
8826
|
+
});
|
|
8827
|
+
}); };
|
|
8828
|
+
var getViewTags = function (ViewId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
8829
|
+
var apiService, parameters, resp;
|
|
8830
|
+
return __generator(this, function (_a) {
|
|
8831
|
+
switch (_a.label) {
|
|
8832
|
+
case 0:
|
|
8833
|
+
apiService = new MESApiService();
|
|
8834
|
+
parameters = [];
|
|
8835
|
+
parameters.push({ name: "ViewId", value: ViewId });
|
|
8836
|
+
return [4 /*yield*/, apiService.callV2("[mssql2022].[IH_100020].[ih].[GetViewTags]", parameters)];
|
|
8837
|
+
case 1:
|
|
8838
|
+
resp = _a.sent();
|
|
8839
|
+
return [2 /*return*/, resp];
|
|
8840
|
+
}
|
|
8841
|
+
});
|
|
8842
|
+
}); };
|
|
8843
|
+
var upsertView = function (ViewId, ViewName, isPublic) { return __awaiter(void 0, void 0, void 0, function () {
|
|
8844
|
+
var apiService, parameters, resp;
|
|
8845
|
+
return __generator(this, function (_a) {
|
|
8846
|
+
switch (_a.label) {
|
|
8847
|
+
case 0:
|
|
8848
|
+
apiService = new MESApiService();
|
|
8849
|
+
parameters = [];
|
|
8850
|
+
parameters.push({ name: "ViewId", value: ViewId });
|
|
8851
|
+
parameters.push({ name: "ViewName", value: ViewName });
|
|
8852
|
+
parameters.push({ name: "isPublic", value: isPublic });
|
|
8853
|
+
return [4 /*yield*/, apiService.callV2("[mssql2022].[IH_100020].[ih].[UpsertView]", parameters)];
|
|
8854
|
+
case 1:
|
|
8855
|
+
resp = _a.sent();
|
|
8856
|
+
return [2 /*return*/, resp];
|
|
8857
|
+
}
|
|
8858
|
+
});
|
|
8859
|
+
}); };
|
|
8860
|
+
var upsertViewTag = function (ViewId, TagId, Color, MinScale, MaxScale, IsVisible, IsAutoScale) { return __awaiter(void 0, void 0, void 0, function () {
|
|
8861
|
+
var apiService, parameters, resp;
|
|
8862
|
+
return __generator(this, function (_a) {
|
|
8863
|
+
switch (_a.label) {
|
|
8864
|
+
case 0:
|
|
8865
|
+
apiService = new MESApiService();
|
|
8866
|
+
parameters = [];
|
|
8867
|
+
parameters.push({ name: "ViewId", value: ViewId });
|
|
8868
|
+
parameters.push({ name: "TagId", value: TagId });
|
|
8869
|
+
parameters.push({ name: "Color", value: Color });
|
|
8870
|
+
parameters.push({ name: "MinScale", value: MinScale });
|
|
8871
|
+
parameters.push({ name: "MaxScale", value: MaxScale });
|
|
8872
|
+
parameters.push({ name: "IsVisible", value: IsVisible });
|
|
8873
|
+
parameters.push({ name: "IsAutoScale", value: IsAutoScale });
|
|
8874
|
+
return [4 /*yield*/, apiService.callV2("[mssql2022].[IH_100020].[ih].[UpsertViewTag]", parameters)];
|
|
8875
|
+
case 1:
|
|
8876
|
+
resp = _a.sent();
|
|
8877
|
+
return [2 /*return*/, resp];
|
|
8878
|
+
}
|
|
8879
|
+
});
|
|
8880
|
+
}); };
|
|
8881
|
+
|
|
8882
|
+
var LoadViewModal = function (_a) {
|
|
8883
|
+
var open = _a.open, handleClose = _a.handleClose;
|
|
8884
|
+
var _b = useTrendingContext(), _c = _b.state; _c.viewTags; var views = _c.views, viewSelected = _c.viewSelected, _d = _b.actions; _d.setViews; var setViewTags = _d.setViewTags, setViewSelected = _d.setViewSelected;
|
|
8885
|
+
var _e = useState(false), isLoading = _e[0], setIsLoading = _e[1];
|
|
8886
|
+
var _f = useState(''), error = _f[0], setError = _f[1];
|
|
8887
|
+
var handleSelect = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
8888
|
+
var viewTagsResp;
|
|
8889
|
+
return __generator(this, function (_a) {
|
|
8890
|
+
switch (_a.label) {
|
|
8891
|
+
case 0:
|
|
8892
|
+
if (!viewSelected) return [3 /*break*/, 2];
|
|
8893
|
+
setIsLoading(true);
|
|
8894
|
+
return [4 /*yield*/, getViewTags(viewSelected.ViewId)];
|
|
8895
|
+
case 1:
|
|
8896
|
+
viewTagsResp = _a.sent();
|
|
8897
|
+
if (viewTagsResp.ok) {
|
|
8898
|
+
setViewTags(viewTagsResp.data.tables[0].rows);
|
|
8899
|
+
}
|
|
8900
|
+
else {
|
|
8901
|
+
setError(viewTagsResp.message);
|
|
8902
|
+
}
|
|
8903
|
+
setIsLoading(false);
|
|
8904
|
+
handleClose();
|
|
8905
|
+
_a.label = 2;
|
|
8906
|
+
case 2: return [2 /*return*/];
|
|
8907
|
+
}
|
|
8908
|
+
});
|
|
8909
|
+
}); };
|
|
8910
|
+
return (React__default.createElement("div", null,
|
|
8911
|
+
React__default.createElement(MesfModal, { open: open, handleClose: handleClose, maxWidth: "xl", "aria-labelledby": "modal-modal-title", "aria-describedby": "modal-modal-description", title: 'Tags' },
|
|
8912
|
+
React__default.createElement(MesfModal.Content, null,
|
|
8913
|
+
React__default.createElement(Grid$1, { container: true },
|
|
8914
|
+
React__default.createElement(Grid$1, { item: true, md: 12 }, views.length ? (React__default.createElement(Autocomplete, { size: 'small', id: "list-of-views", options: views, getOptionLabel: function (option) { return option.ViewName; }, onChange: function (ev, val) { return setViewSelected(val); }, style: { width: "100%" }, renderInput: function (params) { return React__default.createElement(TextField, __assign({}, params, { label: "Views", variant: "outlined" })); } })) :
|
|
8915
|
+
(React__default.createElement("div", null, "No tag views detected, please add one"))))),
|
|
8916
|
+
React__default.createElement(MesfModal.Actions, null,
|
|
8917
|
+
React__default.createElement("div", { style: { paddingTop: "1rem" } },
|
|
8918
|
+
React__default.createElement(Button$1, { variant: 'outlined', style: { marginRight: "1rem" }, color: 'secondary', onClick: handleClose }, "Cancel"),
|
|
8919
|
+
React__default.createElement(ButtonWithLoading, { onClick: handleSelect, variant: 'contained', color: 'primary', isLoading: isLoading, style: { marginRight: "1rem" } }, "Apply")))),
|
|
8920
|
+
React__default.createElement(ErrorModal, { error: error, onHide: function () { return setError(''); } })));
|
|
8921
|
+
};
|
|
8922
|
+
|
|
8923
|
+
var useTrendingStyles = makeStyles$1(function (theme) { return ({
|
|
8924
|
+
datetimePicker: {
|
|
8925
|
+
alignItems: "center",
|
|
8926
|
+
"& .MuiInputBase-root": {
|
|
8927
|
+
color: "black",
|
|
8928
|
+
backgroundColor: "white",
|
|
8929
|
+
borderRadius: theme.shape.borderRadius,
|
|
8930
|
+
width: "90%",
|
|
8931
|
+
minWidth: "90%",
|
|
8932
|
+
maxWidth: "90%"
|
|
8656
8933
|
},
|
|
8657
|
-
|
|
8658
|
-
|
|
8659
|
-
|
|
8660
|
-
|
|
8661
|
-
|
|
8662
|
-
|
|
8663
|
-
|
|
8664
|
-
|
|
8665
|
-
margin: "0",
|
|
8666
|
-
padding: "0"
|
|
8934
|
+
"& .MuiInputBase-input": {
|
|
8935
|
+
fontSize: "13px !important",
|
|
8936
|
+
height: "15px !important",
|
|
8937
|
+
paddingRight: "3px",
|
|
8938
|
+
paddingLeft: "5px"
|
|
8939
|
+
},
|
|
8940
|
+
"& .MuiInput-underline:before": {
|
|
8941
|
+
borderBottomColor: "rgba(0, 0, 0, 0.42)"
|
|
8667
8942
|
}
|
|
8668
8943
|
},
|
|
8669
|
-
|
|
8670
|
-
|
|
8671
|
-
|
|
8672
|
-
|
|
8673
|
-
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
|
|
8679
|
-
|
|
8680
|
-
|
|
8681
|
-
|
|
8682
|
-
|
|
8683
|
-
|
|
8944
|
+
select: {
|
|
8945
|
+
"& .MuiInput-root": {
|
|
8946
|
+
width: "100%"
|
|
8947
|
+
},
|
|
8948
|
+
"& .MuiInputBase-root": {
|
|
8949
|
+
color: "black",
|
|
8950
|
+
backgroundColor: "white",
|
|
8951
|
+
borderRadius: theme.shape.borderRadius,
|
|
8952
|
+
minWidth: "100%"
|
|
8953
|
+
},
|
|
8954
|
+
"& .MuiInputBase-input": {
|
|
8955
|
+
fontSize: "14px !important",
|
|
8956
|
+
height: "15px !important"
|
|
8957
|
+
},
|
|
8958
|
+
"& .MuiInput-underline:before": {
|
|
8959
|
+
borderBottomColor: "rgba(0, 0, 0, 0.42)"
|
|
8960
|
+
}
|
|
8684
8961
|
},
|
|
8685
|
-
|
|
8686
|
-
|
|
8962
|
+
labelOptions: {
|
|
8963
|
+
paddingLeft: "2rem",
|
|
8964
|
+
userSelect: "none",
|
|
8965
|
+
"& > label": {
|
|
8966
|
+
display: "flex",
|
|
8967
|
+
alignItems: "center",
|
|
8968
|
+
gap: "5px"
|
|
8969
|
+
},
|
|
8970
|
+
'& input[type="checkbox"]': {
|
|
8971
|
+
zoom: 1.5
|
|
8972
|
+
}
|
|
8687
8973
|
},
|
|
8688
|
-
|
|
8689
|
-
|
|
8974
|
+
isPublicCheckbox: {
|
|
8975
|
+
userSelect: "none",
|
|
8976
|
+
paddingLeft: '1rem',
|
|
8977
|
+
"& > label": {
|
|
8978
|
+
display: "flex",
|
|
8979
|
+
alignItems: "center",
|
|
8980
|
+
gap: "15px"
|
|
8981
|
+
},
|
|
8982
|
+
'& input[type="checkbox"]': {
|
|
8983
|
+
zoom: 1.5
|
|
8984
|
+
}
|
|
8690
8985
|
},
|
|
8691
|
-
|
|
8692
|
-
|
|
8986
|
+
navigatorButton: {
|
|
8987
|
+
"& .MuiSvgIcon-root": {
|
|
8988
|
+
cursor: "pointer !important"
|
|
8989
|
+
}
|
|
8693
8990
|
}
|
|
8694
8991
|
}); });
|
|
8695
8992
|
|
|
8696
|
-
var
|
|
8697
|
-
var
|
|
8698
|
-
var
|
|
8699
|
-
var
|
|
8700
|
-
var
|
|
8701
|
-
var
|
|
8702
|
-
var
|
|
8703
|
-
|
|
8704
|
-
};
|
|
8705
|
-
|
|
8706
|
-
var
|
|
8707
|
-
|
|
8708
|
-
|
|
8709
|
-
|
|
8710
|
-
|
|
8711
|
-
|
|
8712
|
-
|
|
8713
|
-
|
|
8714
|
-
|
|
8715
|
-
|
|
8716
|
-
|
|
8717
|
-
|
|
8718
|
-
|
|
8719
|
-
|
|
8720
|
-
|
|
8721
|
-
|
|
8722
|
-
|
|
8723
|
-
|
|
8724
|
-
|
|
8725
|
-
|
|
8726
|
-
|
|
8727
|
-
|
|
8728
|
-
|
|
8729
|
-
|
|
8730
|
-
|
|
8731
|
-
|
|
8732
|
-
|
|
8733
|
-
|
|
8734
|
-
|
|
8735
|
-
|
|
8736
|
-
|
|
8737
|
-
|
|
8738
|
-
|
|
8739
|
-
|
|
8740
|
-
|
|
8741
|
-
|
|
8742
|
-
return
|
|
8743
|
-
}
|
|
8744
|
-
return __spreadArray(__spreadArray([], prevTagList, true), [newTag], false); // Add the new tag to the list
|
|
8745
|
-
});
|
|
8746
|
-
}
|
|
8747
|
-
};
|
|
8748
|
-
var _d = useState(null), selectedRowIndex = _d[0], setSelectedRowIndex = _d[1];
|
|
8749
|
-
var _e = useState(false), addTagModalOpen = _e[0], setAddTagModalOpen = _e[1];
|
|
8750
|
-
var handleClose = function () { return setAddTagModalOpen(false); };
|
|
8751
|
-
var ContextMenu = function (_a) {
|
|
8752
|
-
var x = _a.x, y = _a.y, options = _a.options;
|
|
8753
|
-
var handleContextMenuClick = function (e) {
|
|
8754
|
-
e.stopPropagation(); // Prevent click inside the menu from closing it
|
|
8755
|
-
};
|
|
8756
|
-
return (React__default.createElement("div", { className: "context-menu", style: { top: y, left: x }, onClick: handleContextMenuClick },
|
|
8757
|
-
React__default.createElement("ul", null, options.map(function (option) { return (React__default.createElement("li", { key: option.id, onClick: option.onClick }, option.label)); }))));
|
|
8758
|
-
};
|
|
8759
|
-
// Position state for the context menu
|
|
8760
|
-
var _f = useState({ x: 0, y: 0 }), contextMenuPosition = _f[0], setContextMenuPosition = _f[1];
|
|
8761
|
-
var contextMenuOptions = [
|
|
8762
|
-
{ id: 'delete', label: 'Remove Tag', onClick: function () { return handleDelete(); } },
|
|
8763
|
-
{ id: 'add', label: 'Add Tag', onClick: function () { return setAddTagModalOpen(true); } },
|
|
8764
|
-
{ id: 'saveDefault', label: 'Save Default To Tag', onClick: function () { } },
|
|
8765
|
-
{ id: 'saveAsView', label: 'Save as View', onClick: function () { } },
|
|
8766
|
-
{ id: 'loadView', label: 'Load View', onClick: function () { } },
|
|
8767
|
-
];
|
|
8768
|
-
var handleTagSelect = function (selectedTag) {
|
|
8769
|
-
handleAddTag(selectedTag);
|
|
8770
|
-
handleClose();
|
|
8771
|
-
};
|
|
8772
|
-
var handleDelete = function (index) {
|
|
8773
|
-
if (selectedRowIndex !== null) {
|
|
8774
|
-
var tagToDelete = tagList[selectedRowIndex];
|
|
8775
|
-
handleDeleteTag(tagToDelete.tagId);
|
|
8776
|
-
setSelectedRowIndex(null); // Reset the selected row index
|
|
8777
|
-
}
|
|
8778
|
-
};
|
|
8779
|
-
useEffect(function () {
|
|
8780
|
-
setEditableTagNames(tagList.reduce(function (acc, tag) {
|
|
8781
|
-
acc[tag.tagId] = tag.tagName;
|
|
8782
|
-
return acc;
|
|
8783
|
-
}, {}));
|
|
8784
|
-
}, [tagList]);
|
|
8785
|
-
useEffect(function () {
|
|
8786
|
-
var handleGlobalClick = function (e) {
|
|
8787
|
-
if (selectedRowIndex !== null) {
|
|
8788
|
-
setSelectedRowIndex(null);
|
|
8789
|
-
}
|
|
8790
|
-
};
|
|
8791
|
-
var handleKeyDown = function (e) {
|
|
8792
|
-
if (e.key === "Escape" && selectedRowIndex !== null) {
|
|
8793
|
-
setSelectedRowIndex(null);
|
|
8993
|
+
var SaveAsViewModal = function (_a) {
|
|
8994
|
+
var open = _a.open, handleClose = _a.handleClose;
|
|
8995
|
+
var classes = useTrendingStyles();
|
|
8996
|
+
var _b = useState(false), isLoading = _b[0], setIsLoading = _b[1];
|
|
8997
|
+
var _c = useState(''), error = _c[0], setError = _c[1];
|
|
8998
|
+
var viewTags = useTrendingContext().state.viewTags;
|
|
8999
|
+
var _d = useState(true), isPublic = _d[0], setIsPublic = _d[1];
|
|
9000
|
+
var _e = useState(''), viewName = _e[0], setViewName = _e[1];
|
|
9001
|
+
var handleCheck = function () { return setIsPublic(!isPublic); };
|
|
9002
|
+
var handleInputChange = function (e) { return setViewName(e.target.value); };
|
|
9003
|
+
var handleSubmit = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
9004
|
+
var resp, ViewId_1, results;
|
|
9005
|
+
return __generator(this, function (_a) {
|
|
9006
|
+
switch (_a.label) {
|
|
9007
|
+
case 0:
|
|
9008
|
+
setIsLoading(true);
|
|
9009
|
+
return [4 /*yield*/, upsertView(null, viewName, isPublic)];
|
|
9010
|
+
case 1:
|
|
9011
|
+
resp = _a.sent();
|
|
9012
|
+
if (!resp.ok) return [3 /*break*/, 3];
|
|
9013
|
+
ViewId_1 = resp.data.returnValue;
|
|
9014
|
+
return [4 /*yield*/, Promise.allSettled(viewTags.map(function (_a) {
|
|
9015
|
+
var TagId = _a.TagId, Color = _a.Color, MinScale = _a.MinScale, MaxScale = _a.MaxScale, IsAutoScale = _a.IsAutoScale, IsVisible = _a.IsVisible;
|
|
9016
|
+
upsertViewTag(ViewId_1, TagId, Color, MinScale, MaxScale, IsVisible, IsAutoScale)
|
|
9017
|
+
.then(function (r) {
|
|
9018
|
+
if (!r.ok) {
|
|
9019
|
+
setError(r.message);
|
|
9020
|
+
}
|
|
9021
|
+
});
|
|
9022
|
+
}))];
|
|
9023
|
+
case 2:
|
|
9024
|
+
results = _a.sent();
|
|
9025
|
+
results.forEach(function (result, index) {
|
|
9026
|
+
if (result.status === "rejected") {
|
|
9027
|
+
setError("Tag ".concat(index, " failed with reason: ").concat(result.reason));
|
|
9028
|
+
}
|
|
9029
|
+
else {
|
|
9030
|
+
handleClose();
|
|
9031
|
+
}
|
|
9032
|
+
});
|
|
9033
|
+
return [3 /*break*/, 4];
|
|
9034
|
+
case 3:
|
|
9035
|
+
setError(resp.message);
|
|
9036
|
+
_a.label = 4;
|
|
9037
|
+
case 4:
|
|
9038
|
+
setIsLoading(false);
|
|
9039
|
+
return [2 /*return*/];
|
|
8794
9040
|
}
|
|
8795
|
-
};
|
|
8796
|
-
|
|
8797
|
-
|
|
8798
|
-
|
|
8799
|
-
|
|
8800
|
-
|
|
8801
|
-
|
|
8802
|
-
|
|
8803
|
-
|
|
8804
|
-
|
|
8805
|
-
|
|
8806
|
-
|
|
8807
|
-
|
|
8808
|
-
|
|
8809
|
-
|
|
8810
|
-
|
|
8811
|
-
|
|
8812
|
-
|
|
8813
|
-
|
|
8814
|
-
|
|
8815
|
-
React__default.createElement(
|
|
8816
|
-
React__default.createElement("div", { style: { overflowX: 'auto', width: '100%' } },
|
|
8817
|
-
React__default.createElement("table", { style: { width: '100%', tableLayout: 'fixed', textAlign: "center" } },
|
|
8818
|
-
React__default.createElement("thead", null,
|
|
8819
|
-
React__default.createElement("tr", null,
|
|
8820
|
-
React__default.createElement("th", { className: classes.visible }),
|
|
8821
|
-
React__default.createElement("th", { className: classes.inputCol }),
|
|
8822
|
-
React__default.createElement("th", { className: classes.color }),
|
|
8823
|
-
React__default.createElement("th", { colSpan: 4, className: "".concat(classes.topTitles, " ").concat(classes.scale) }, "Scale"),
|
|
8824
|
-
React__default.createElement("th", { className: "".concat(classes.topTitles, " ").concat(classes.xStats) }, cursorData ? (function () {
|
|
8825
|
-
var date = new Date(cursorData.x1);
|
|
8826
|
-
var formattedDate = date.toLocaleString('en-US', {
|
|
8827
|
-
hour12: false,
|
|
8828
|
-
month: 'short',
|
|
8829
|
-
day: 'numeric',
|
|
8830
|
-
hour: '2-digit',
|
|
8831
|
-
minute: '2-digit',
|
|
8832
|
-
second: '2-digit'
|
|
8833
|
-
});
|
|
8834
|
-
var milliseconds = date.getMilliseconds().toString().padStart(3, '0');
|
|
8835
|
-
var dateText = "".concat(formattedDate, ".").concat(milliseconds);
|
|
8836
|
-
return (React__default.createElement(React__default.Fragment, null,
|
|
8837
|
-
React__default.createElement("span", { style: {
|
|
8838
|
-
height: '10px',
|
|
8839
|
-
width: '10px',
|
|
8840
|
-
backgroundColor: "red",
|
|
8841
|
-
borderRadius: '50%',
|
|
8842
|
-
display: 'inline-block',
|
|
8843
|
-
marginRight: '5px'
|
|
8844
|
-
} }),
|
|
8845
|
-
dateText));
|
|
8846
|
-
})() : null),
|
|
8847
|
-
React__default.createElement("th", { className: "".concat(classes.topTitles, " ").concat(classes.xStats) }, cursorData ? (function () {
|
|
8848
|
-
var date = new Date(cursorData.x2);
|
|
8849
|
-
var formattedDate = date.toLocaleString('en-US', {
|
|
8850
|
-
hour12: false,
|
|
8851
|
-
month: 'short',
|
|
8852
|
-
day: 'numeric',
|
|
8853
|
-
hour: '2-digit',
|
|
8854
|
-
minute: '2-digit',
|
|
8855
|
-
second: '2-digit'
|
|
8856
|
-
});
|
|
8857
|
-
var milliseconds = date.getMilliseconds().toString().padStart(3, '0');
|
|
8858
|
-
var dateText = "".concat(formattedDate, ".").concat(milliseconds);
|
|
8859
|
-
return (React__default.createElement(React__default.Fragment, null,
|
|
8860
|
-
React__default.createElement("span", { style: {
|
|
8861
|
-
height: '10px',
|
|
8862
|
-
width: '10px',
|
|
8863
|
-
backgroundColor: "blue",
|
|
8864
|
-
borderRadius: '50%',
|
|
8865
|
-
display: 'inline-block',
|
|
8866
|
-
marginRight: '5px'
|
|
8867
|
-
} }),
|
|
8868
|
-
dateText));
|
|
8869
|
-
})() : null),
|
|
8870
|
-
React__default.createElement("th", { colSpan: 3, className: "".concat(classes.topTitles, " ").concat(classes.xStats) }, cursorData ? timeDifference(cursorData.x2, cursorData.x1) : null)))),
|
|
8871
|
-
React__default.createElement("table", { style: { width: '100%', tableLayout: 'fixed', textAlign: "center" } },
|
|
8872
|
-
React__default.createElement("thead", null,
|
|
8873
|
-
React__default.createElement("tr", { className: classes.bottomTitlesRow },
|
|
8874
|
-
React__default.createElement("th", { className: classes.visible }, "Visible"),
|
|
8875
|
-
React__default.createElement("th", { className: classes.inputCol }, "Alias / Tagname"),
|
|
8876
|
-
React__default.createElement("th", { className: classes.color }, "Color"),
|
|
8877
|
-
React__default.createElement("th", { className: classes.inputCol }, "Min Scale"),
|
|
8878
|
-
React__default.createElement("th", { className: classes.inputCol }, "Max Scale"),
|
|
8879
|
-
React__default.createElement("th", { className: classes.unit }, "Unit"),
|
|
8880
|
-
React__default.createElement("th", { className: classes.autoScale }, "AutoScale"),
|
|
8881
|
-
React__default.createElement("th", null, " "),
|
|
8882
|
-
React__default.createElement("th", null),
|
|
8883
|
-
React__default.createElement("th", null, "Y2-Y1"),
|
|
8884
|
-
React__default.createElement("th", null, "Min"),
|
|
8885
|
-
React__default.createElement("th", null, "Max")))))),
|
|
8886
|
-
React__default.createElement(Grid$1, { item: true, xs: 12 },
|
|
8887
|
-
React__default.createElement("div", { style: { width: '100%', overflowY: 'auto', maxHeight: ' 20svh' } },
|
|
8888
|
-
React__default.createElement("table", { cellPadding: '4px', style: { width: '100%', tableLayout: 'fixed', textAlign: "center" } },
|
|
8889
|
-
React__default.createElement("tbody", null, tagList.map(function (tag, index) {
|
|
8890
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
8891
|
-
return (React__default.createElement("tr", { key: tag.tagName, onClick: function () { return handleRowClick(index); }, onContextMenu: function (e) { return handleRightClick(e, index); }, className: classes.rowHover },
|
|
8892
|
-
React__default.createElement("td", { className: "".concat(classes.visible, " ").concat(classes.checkbox) },
|
|
8893
|
-
React__default.createElement("input", { type: "checkbox", checked: tag.visible, onChange: function (e) { return handleVisibilityChange(index, e.target.checked); } })),
|
|
8894
|
-
React__default.createElement("td", { className: classes.inputCol },
|
|
8895
|
-
React__default.createElement(Tooltip, { title: tag.tagName, placement: "top", arrow: true, interactive: true, enterDelay: 500 },
|
|
8896
|
-
React__default.createElement("div", null,
|
|
8897
|
-
React__default.createElement("input", { type: "text", style: { width: '100%' }, value: editableTagNames[tag.tagId] || '', onFocus: function (e) { return e.target.select(); }, onChange: function (e) {
|
|
8898
|
-
var _a;
|
|
8899
|
-
setEditableTagNames(__assign(__assign({}, editableTagNames), (_a = {}, _a[tag.tagId] = e.target.value, _a)));
|
|
8900
|
-
}, onKeyDown: function (e) {
|
|
8901
|
-
if (e.key === 'Enter') {
|
|
8902
|
-
handleChangeAlias(tag.tagId, editableTagNames[tag.tagId]);
|
|
8903
|
-
}
|
|
8904
|
-
} })))),
|
|
8905
|
-
React__default.createElement("td", { className: classes.color },
|
|
8906
|
-
React__default.createElement(ColorPicker, { onChange: handleColorChange, color: tag.color, elementId: tag.tagId })),
|
|
8907
|
-
React__default.createElement("td", { className: classes.inputCol },
|
|
8908
|
-
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) {
|
|
8909
|
-
var value = e.target.value;
|
|
8910
|
-
var numericValue = Number(value);
|
|
8911
|
-
// Check if the value is a number and not empty
|
|
8912
|
-
handleChange(index, numericValue, 'minScale');
|
|
8913
|
-
} })),
|
|
8914
|
-
React__default.createElement("td", { className: classes.inputCol },
|
|
8915
|
-
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) {
|
|
8916
|
-
var value = e.target.value;
|
|
8917
|
-
var numericValue = Number(value);
|
|
8918
|
-
// Check if the value is a number and not empty
|
|
8919
|
-
if (!isNaN(numericValue) && value.trim() !== '') {
|
|
8920
|
-
handleChange(index, numericValue, 'maxScale');
|
|
8921
|
-
}
|
|
8922
|
-
} })),
|
|
8923
|
-
React__default.createElement("td", { className: "".concat(classes.autoScale, " ").concat(classes.checkbox) },
|
|
8924
|
-
React__default.createElement("input", { type: "text", style: { width: '100%' }, disabled: true, value: /* tag.unit */ "Unit ", onFocus: function (e) { return e.target.select(); } })),
|
|
8925
|
-
React__default.createElement("td", { className: "".concat(classes.autoScale, " ").concat(classes.checkbox) },
|
|
8926
|
-
React__default.createElement("input", { type: "checkbox", checked: tag.autoScale, onChange: function (e) { return handleAutoScaleChange(index, e.target.checked); } })),
|
|
8927
|
-
React__default.createElement("td", null, (_a = dataTable[tag.tagName]) === null || _a === void 0 ? void 0 : _a.y1),
|
|
8928
|
-
React__default.createElement("td", { className: classes.doubleInput }, (_b = dataTable[tag.tagName]) === null || _b === void 0 ? void 0 : _b.y2),
|
|
8929
|
-
React__default.createElement("td", null, (_c = dataTable[tag.tagName]) === null || _c === void 0 ? void 0 : _c.y2y1),
|
|
8930
|
-
React__default.createElement("td", null,
|
|
8931
|
-
!isNaN(((_d = dataTable[tag.tagName]) === null || _d === void 0 ? void 0 : _d.pmin.y) * 0) ? (_e = dataTable[tag.tagName]) === null || _e === void 0 ? void 0 : _e.pmin.y : 0,
|
|
8932
|
-
" "),
|
|
8933
|
-
React__default.createElement("td", null,
|
|
8934
|
-
!isNaN(((_f = dataTable[tag.tagName]) === null || _f === void 0 ? void 0 : _f.pmax.y) * 0) ? (_g = dataTable[tag.tagName]) === null || _g === void 0 ? void 0 : _g.pmax.y : 0,
|
|
8935
|
-
" ")));
|
|
8936
|
-
}))))),
|
|
8937
|
-
selectedRowIndex !== null && (React__default.createElement(ContextMenu, { x: contextMenuPosition.x, y: contextMenuPosition.y, options: contextMenuOptions })),
|
|
8938
|
-
React__default.createElement(AddTagModal, { open: addTagModalOpen, handleClose: handleClose, onTagSelect: handleTagSelect })));
|
|
9041
|
+
});
|
|
9042
|
+
}); };
|
|
9043
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
9044
|
+
React__default.createElement(MesfModal, { open: open, handleClose: handleClose, maxWidth: "xl", "aria-labelledby": "modal-modal-title", "aria-describedby": "modal-modal-description", title: 'Tags' },
|
|
9045
|
+
React__default.createElement(Divider, null),
|
|
9046
|
+
React__default.createElement(MesfModal.Content, null,
|
|
9047
|
+
React__default.createElement(Grid$1, { container: true, spacing: 5, style: { padding: "1rem" } },
|
|
9048
|
+
React__default.createElement(Grid$1, { item: true, md: 12, xs: 12, style: { padding: "10px", width: "100%" } },
|
|
9049
|
+
React__default.createElement(TextField, { size: 'small', id: "outlined-basic", label: "View Name", variant: "outlined", value: viewName, onChange: handleInputChange, style: { width: "100%" } }))),
|
|
9050
|
+
React__default.createElement(Grid$1, { item: true, md: 12, xs: 12, style: { paddingTop: "2rem" }, className: classes.isPublicCheckbox },
|
|
9051
|
+
React__default.createElement("label", null,
|
|
9052
|
+
"Public",
|
|
9053
|
+
React__default.createElement("input", { type: "checkbox", checked: isPublic, onChange: handleCheck })))),
|
|
9054
|
+
React__default.createElement(Divider, null),
|
|
9055
|
+
React__default.createElement(MesfModal.Actions, null,
|
|
9056
|
+
React__default.createElement(Grid$1, { container: true, spacing: 1, style: { display: 'flex', alignItems: 'flex-end', justifyContent: 'flex-end' } },
|
|
9057
|
+
React__default.createElement(Grid$1, { item: true },
|
|
9058
|
+
React__default.createElement(Button$1, { variant: 'outlined', color: 'secondary', onClick: handleClose }, "Cancel")),
|
|
9059
|
+
React__default.createElement(Grid$1, { item: true },
|
|
9060
|
+
React__default.createElement(ButtonWithLoading, { variant: 'contained', color: 'primary', onClick: handleSubmit, isLoading: isLoading }, "Save"))))),
|
|
9061
|
+
React__default.createElement(ErrorModal, { error: error, onHide: function () { return setError(''); } })));
|
|
8939
9062
|
};
|
|
8940
9063
|
|
|
8941
|
-
var
|
|
8942
|
-
|
|
8943
|
-
|
|
8944
|
-
|
|
8945
|
-
|
|
8946
|
-
|
|
8947
|
-
var
|
|
8948
|
-
|
|
8949
|
-
|
|
8950
|
-
|
|
8951
|
-
|
|
8952
|
-
|
|
8953
|
-
|
|
8954
|
-
|
|
8955
|
-
|
|
8956
|
-
|
|
8957
|
-
|
|
8958
|
-
|
|
8959
|
-
|
|
8960
|
-
|
|
8961
|
-
|
|
8962
|
-
|
|
8963
|
-
|
|
8964
|
-
|
|
8965
|
-
|
|
8966
|
-
|
|
8967
|
-
|
|
8968
|
-
|
|
8969
|
-
|
|
8970
|
-
|
|
8971
|
-
.toDate();
|
|
8972
|
-
break;
|
|
8973
|
-
case "4 hours":
|
|
8974
|
-
state.timeScopeStart = moment(state.timeScopeEnd)
|
|
8975
|
-
.subtract(4, "hours")
|
|
8976
|
-
.toDate();
|
|
8977
|
-
break;
|
|
8978
|
-
case "12 hours":
|
|
8979
|
-
state.timeScopeStart = moment(state.timeScopeEnd)
|
|
8980
|
-
.subtract(12, "hours")
|
|
8981
|
-
.toDate();
|
|
8982
|
-
break;
|
|
8983
|
-
case "1 day":
|
|
8984
|
-
state.timeScopeStart = moment(state.timeScopeEnd)
|
|
8985
|
-
.subtract(1, "days")
|
|
8986
|
-
.toDate();
|
|
8987
|
-
break;
|
|
8988
|
-
case "10 days":
|
|
8989
|
-
state.timeScopeStart = moment(state.timeScopeEnd)
|
|
8990
|
-
.subtract(10, "days")
|
|
8991
|
-
.toDate();
|
|
8992
|
-
break;
|
|
8993
|
-
}
|
|
8994
|
-
}
|
|
8995
|
-
state.scope = payload.scope;
|
|
8996
|
-
return;
|
|
8997
|
-
}
|
|
8998
|
-
if (!isNil$1(payload.start) && !isNil$1(payload.end) && isNil$1(payload.graphPan)) {
|
|
8999
|
-
// from zoom
|
|
9000
|
-
state.timeScopeStart = payload.start;
|
|
9001
|
-
state.timeScopeEnd = payload.end;
|
|
9002
|
-
state.scope = "custom";
|
|
9003
|
-
return;
|
|
9004
|
-
}
|
|
9005
|
-
if (!isNil$1(payload.start) && !isNil$1(payload.end) && !isNil$1(payload.graphPan)) {
|
|
9006
|
-
// from pan
|
|
9007
|
-
state.timeScopeStart = payload.start;
|
|
9008
|
-
state.timeScopeEnd = payload.end;
|
|
9009
|
-
return;
|
|
9010
|
-
}
|
|
9011
|
-
if (!isNil$1(payload.start)) {
|
|
9012
|
-
state.timeScopeStart = payload.start;
|
|
9013
|
-
if (state.scope !== "custom") {
|
|
9014
|
-
switch (state.scope) {
|
|
9015
|
-
case "10 min":
|
|
9016
|
-
state.timeScopeEnd = moment(payload.start)
|
|
9017
|
-
.add(10, "minutes")
|
|
9018
|
-
.toDate();
|
|
9019
|
-
break;
|
|
9020
|
-
case "1 hour":
|
|
9021
|
-
state.timeScopeEnd = moment(payload.start)
|
|
9022
|
-
.add(1, "hours")
|
|
9023
|
-
.toDate();
|
|
9024
|
-
break;
|
|
9025
|
-
case "4 hours":
|
|
9026
|
-
state.timeScopeEnd = moment(payload.start)
|
|
9027
|
-
.add(4, "hours")
|
|
9028
|
-
.toDate();
|
|
9029
|
-
break;
|
|
9030
|
-
case "12 hours":
|
|
9031
|
-
state.timeScopeEnd = moment(payload.start)
|
|
9032
|
-
.add(12, "hours")
|
|
9033
|
-
.toDate();
|
|
9034
|
-
break;
|
|
9035
|
-
case "1 day":
|
|
9036
|
-
state.timeScopeEnd = moment(payload.start)
|
|
9037
|
-
.add(1, "days")
|
|
9038
|
-
.toDate();
|
|
9039
|
-
break;
|
|
9040
|
-
case "10 days":
|
|
9041
|
-
state.timeScopeEnd = moment(payload.start)
|
|
9042
|
-
.add(10, "days")
|
|
9043
|
-
.toDate();
|
|
9044
|
-
break;
|
|
9064
|
+
var useTagsDataTable = function (_a) {
|
|
9065
|
+
var cursorData = _a.cursorData, viewTags = _a.viewTags, chartData = _a.chartData;
|
|
9066
|
+
return useMemo(function () {
|
|
9067
|
+
var _a;
|
|
9068
|
+
var dataTable = {};
|
|
9069
|
+
if (cursorData) {
|
|
9070
|
+
var _loop_1 = function (idx) {
|
|
9071
|
+
var tag = viewTags[idx];
|
|
9072
|
+
var datasetForTag = ((_a = chartData.datasets.find(function (ds) {
|
|
9073
|
+
return ds.tagId === (tag === null || tag === void 0 ? void 0 : tag.TagId);
|
|
9074
|
+
})) === null || _a === void 0 ? void 0 : _a.data) || [];
|
|
9075
|
+
var p1 = { x: new Date('1900-01-01'), y: 0 };
|
|
9076
|
+
var p2 = { x: new Date('1900-01-01'), y: 0 };
|
|
9077
|
+
var p1Found = false;
|
|
9078
|
+
var pmin = { x: 0, y: Number.POSITIVE_INFINITY };
|
|
9079
|
+
var pmax = { x: 0, y: Number.NEGATIVE_INFINITY };
|
|
9080
|
+
for (var idx_1 = 0; idx_1 < datasetForTag.length; idx_1++) {
|
|
9081
|
+
var curr = datasetForTag[idx_1];
|
|
9082
|
+
var currentVal = curr.x;
|
|
9083
|
+
if (!p1Found) {
|
|
9084
|
+
if (currentVal < cursorData.x1) {
|
|
9085
|
+
p1 = curr;
|
|
9086
|
+
p2 = JSON.parse(JSON.stringify(p1));
|
|
9087
|
+
pmin = JSON.parse(JSON.stringify(p1));
|
|
9088
|
+
pmax = JSON.parse(JSON.stringify(p1));
|
|
9089
|
+
continue;
|
|
9090
|
+
}
|
|
9091
|
+
else {
|
|
9092
|
+
p1Found = true;
|
|
9093
|
+
}
|
|
9045
9094
|
}
|
|
9046
|
-
|
|
9047
|
-
|
|
9048
|
-
|
|
9049
|
-
|
|
9050
|
-
|
|
9051
|
-
|
|
9052
|
-
|
|
9053
|
-
|
|
9054
|
-
|
|
9055
|
-
|
|
9056
|
-
|
|
9057
|
-
break;
|
|
9058
|
-
case "1 hour":
|
|
9059
|
-
state.timeScopeStart = moment(payload.end)
|
|
9060
|
-
.subtract(1, "hours")
|
|
9061
|
-
.toDate();
|
|
9062
|
-
break;
|
|
9063
|
-
case "4 hours":
|
|
9064
|
-
state.timeScopeStart = moment(payload.end)
|
|
9065
|
-
.subtract(4, "hours")
|
|
9066
|
-
.toDate();
|
|
9067
|
-
break;
|
|
9068
|
-
case "12 hours":
|
|
9069
|
-
state.timeScopeStart = moment(payload.end)
|
|
9070
|
-
.subtract(12, "hours")
|
|
9071
|
-
.toDate();
|
|
9072
|
-
break;
|
|
9073
|
-
case "1 day":
|
|
9074
|
-
state.timeScopeStart = moment(payload.end)
|
|
9075
|
-
.subtract(1, "days")
|
|
9076
|
-
.toDate();
|
|
9077
|
-
break;
|
|
9078
|
-
case "10 days":
|
|
9079
|
-
state.timeScopeStart = moment(payload.end)
|
|
9080
|
-
.subtract(10, "days")
|
|
9081
|
-
.toDate();
|
|
9095
|
+
else {
|
|
9096
|
+
if (currentVal < cursorData.x2) {
|
|
9097
|
+
p2 = curr;
|
|
9098
|
+
if (pmin['y'] > curr['y']) {
|
|
9099
|
+
pmin = JSON.parse(JSON.stringify(curr));
|
|
9100
|
+
}
|
|
9101
|
+
if (pmax['y'] < curr['y']) {
|
|
9102
|
+
pmax = JSON.parse(JSON.stringify(curr));
|
|
9103
|
+
}
|
|
9104
|
+
}
|
|
9105
|
+
else {
|
|
9082
9106
|
break;
|
|
9107
|
+
}
|
|
9083
9108
|
}
|
|
9084
9109
|
}
|
|
9085
|
-
|
|
9110
|
+
dataTable[tag === null || tag === void 0 ? void 0 : tag.TagName] = {
|
|
9111
|
+
y1: p1.y,
|
|
9112
|
+
y2: p2.y,
|
|
9113
|
+
y2y1: Number(p2.y) - Number(p1.y),
|
|
9114
|
+
pmin: pmin,
|
|
9115
|
+
pmax: pmax
|
|
9116
|
+
};
|
|
9117
|
+
};
|
|
9118
|
+
for (var idx = 0; idx < viewTags.length; idx++) {
|
|
9119
|
+
_loop_1(idx);
|
|
9086
9120
|
}
|
|
9087
9121
|
}
|
|
9122
|
+
return dataTable;
|
|
9123
|
+
}, [viewTags, chartData, cursorData]);
|
|
9124
|
+
};
|
|
9125
|
+
|
|
9126
|
+
var useTagsTableStyles = makeStyles$1(function (theme) { return ({
|
|
9127
|
+
checkbox: {
|
|
9128
|
+
'& input[type="checkbox"]': {
|
|
9129
|
+
zoom: 1.5
|
|
9130
|
+
},
|
|
9131
|
+
textAlign: 'center'
|
|
9132
|
+
},
|
|
9133
|
+
rowHover: {
|
|
9134
|
+
'&:hover': {
|
|
9135
|
+
backgroundColor: "#f2f2f2"
|
|
9136
|
+
}
|
|
9137
|
+
},
|
|
9138
|
+
topTitles: {
|
|
9139
|
+
border: "0.0625rem black solid",
|
|
9140
|
+
borderBottom: "none",
|
|
9141
|
+
backgroundColor: "#e9ecef"
|
|
9142
|
+
},
|
|
9143
|
+
bottomTitlesRow: {
|
|
9144
|
+
'& th': {
|
|
9145
|
+
border: "1px black solid"
|
|
9146
|
+
},
|
|
9147
|
+
backgroundColor: "#e9ecef"
|
|
9148
|
+
},
|
|
9149
|
+
doubleInput: {
|
|
9150
|
+
padding: "0",
|
|
9151
|
+
'& input[type="text"] ': {
|
|
9152
|
+
width: "100%",
|
|
9153
|
+
height: "17px",
|
|
9154
|
+
display: "block",
|
|
9155
|
+
margin: "0",
|
|
9156
|
+
padding: "0"
|
|
9157
|
+
}
|
|
9158
|
+
},
|
|
9159
|
+
inputCol: {
|
|
9160
|
+
width: "11.25rem",
|
|
9161
|
+
overflow: 'hidden',
|
|
9162
|
+
textOverflow: 'ellipsis',
|
|
9163
|
+
whiteSpace: 'nowrap'
|
|
9164
|
+
},
|
|
9165
|
+
autoScale: {
|
|
9166
|
+
width: '7.5rem'
|
|
9167
|
+
},
|
|
9168
|
+
scale: {
|
|
9169
|
+
width: '37.5rem',
|
|
9170
|
+
padding: "0"
|
|
9171
|
+
},
|
|
9172
|
+
visible: {
|
|
9173
|
+
width: '3.75rem'
|
|
9174
|
+
},
|
|
9175
|
+
color: {
|
|
9176
|
+
width: '4.375rem'
|
|
9177
|
+
},
|
|
9178
|
+
unit: {
|
|
9179
|
+
width: '7.5rem'
|
|
9180
|
+
},
|
|
9181
|
+
xStats: {
|
|
9182
|
+
// ...
|
|
9088
9183
|
}
|
|
9089
|
-
});
|
|
9184
|
+
}); });
|
|
9090
9185
|
|
|
9091
|
-
var
|
|
9092
|
-
|
|
9093
|
-
|
|
9094
|
-
|
|
9095
|
-
var
|
|
9096
|
-
var
|
|
9097
|
-
var
|
|
9098
|
-
|
|
9099
|
-
|
|
9100
|
-
|
|
9101
|
-
|
|
9102
|
-
|
|
9186
|
+
var timeDifference = function (start, end) {
|
|
9187
|
+
var differenceMilliseconds = start - end;
|
|
9188
|
+
var seconds = Math.floor(differenceMilliseconds / 1000);
|
|
9189
|
+
var minutes = Math.floor(seconds / 60);
|
|
9190
|
+
var hours = Math.floor(minutes / 60);
|
|
9191
|
+
var remainingMinutes = minutes % 60;
|
|
9192
|
+
var remainingSeconds = seconds % 60;
|
|
9193
|
+
return "".concat(hours, "h ").concat(remainingMinutes, "m ").concat(remainingSeconds, "s");
|
|
9194
|
+
};
|
|
9195
|
+
|
|
9196
|
+
var TableComponent = function (_a) {
|
|
9197
|
+
var chartData = _a.chartData, cursorData = _a.cursorData;
|
|
9198
|
+
var classes = useTagsTableStyles();
|
|
9199
|
+
var _b = useTrendingContext(), _c = _b.state, viewTags = _c.viewTags, viewSelected = _c.viewSelected, _d = _b.actions, setViewTags = _d.setViewTags, setGraphShouldUpdate = _d.setGraphShouldUpdate;
|
|
9200
|
+
var _e = useState(''), error = _e[0], setError = _e[1];
|
|
9201
|
+
var dataTable = useTagsDataTable({ viewTags: viewTags, chartData: chartData, cursorData: cursorData });
|
|
9202
|
+
var _f = useState({}), editableTagNames = _f[0], setEditableTagNames = _f[1];
|
|
9203
|
+
var handleChange = function (tagId, value, property) {
|
|
9204
|
+
var newTags = viewTags.map(function (tag) {
|
|
9205
|
+
var _a;
|
|
9206
|
+
return tag.TagId === tagId ? __assign(__assign({}, tag), (_a = {}, _a[property] = value, _a.IsAutoScale = false, _a)) : tag;
|
|
9207
|
+
});
|
|
9208
|
+
setViewTags(newTags);
|
|
9209
|
+
setGraphShouldUpdate();
|
|
9210
|
+
};
|
|
9211
|
+
var handleChangeAlias = function (tagId, newName) {
|
|
9212
|
+
var newTags = viewTags.map(function (tag) { return (tag.TagId === tagId ? __assign(__assign({}, tag), { Alias: newName }) : tag); });
|
|
9213
|
+
setViewTags(newTags);
|
|
9214
|
+
};
|
|
9215
|
+
var handleVisibilityChange = function (tagId, value) {
|
|
9216
|
+
var newTags = viewTags.map(function (tag) { return tag.TagId === tagId ? __assign(__assign({}, tag), { IsVisible: value }) : tag; });
|
|
9217
|
+
setViewTags(newTags);
|
|
9218
|
+
};
|
|
9219
|
+
var handleAutoScaleChange = function (tagId, checked) {
|
|
9220
|
+
var newTags = viewTags.map(function (t) { return t.TagId == tagId ? __assign(__assign({}, t), { IsAutoScale: !checked }) : t; });
|
|
9221
|
+
setViewTags(newTags);
|
|
9222
|
+
};
|
|
9223
|
+
var handleColorChange = function (tagId, value) {
|
|
9224
|
+
var newTags = viewTags.map(function (tag) { return tag.TagId === tagId ? __assign(__assign({}, tag), { Color: value }) : tag; });
|
|
9225
|
+
setViewTags(newTags);
|
|
9226
|
+
};
|
|
9227
|
+
var handleDeleteTag = function (tagId) {
|
|
9228
|
+
var newTags = viewTags.filter(function (tag) { return tag.TagId !== tagId; });
|
|
9229
|
+
setViewTags(newTags);
|
|
9230
|
+
};
|
|
9231
|
+
var handleAddTag = function (newTag) {
|
|
9232
|
+
var newArr = __spreadArray([], viewTags, true);
|
|
9233
|
+
if (newTag) {
|
|
9234
|
+
newArr.push(newTag);
|
|
9235
|
+
setViewTags(newArr);
|
|
9236
|
+
}
|
|
9237
|
+
};
|
|
9238
|
+
var handleAbleScales = function (tagId, checked) {
|
|
9239
|
+
if (checked) {
|
|
9240
|
+
handleAutoScaleChange(tagId, checked);
|
|
9241
|
+
}
|
|
9242
|
+
};
|
|
9243
|
+
var _g = useState(null), selectedRowIndex = _g[0], setSelectedRowIndex = _g[1];
|
|
9244
|
+
var _h = useState(false), addTagModalOpen = _h[0], setAddTagModalOpen = _h[1];
|
|
9245
|
+
var _j = useState(false), saveAsViewModalOpen = _j[0], setSaveAsViewModalOpen = _j[1];
|
|
9246
|
+
var _k = useState(false), loadViewOpen = _k[0], setLoadViewOpen = _k[1];
|
|
9247
|
+
var handleClose = function () { return setAddTagModalOpen(false); };
|
|
9248
|
+
var ContextMenu = function (_a) {
|
|
9249
|
+
var x = _a.x, y = _a.y, options = _a.options;
|
|
9250
|
+
var handleContextMenuClick = function (e) {
|
|
9251
|
+
e.stopPropagation(); // Prevent click inside the menu from closing it
|
|
9252
|
+
};
|
|
9253
|
+
return (React__default.createElement("div", { className: "context-menu", style: { top: y, left: x }, onClick: handleContextMenuClick },
|
|
9254
|
+
React__default.createElement("ul", null, options.map(function (option) { return (React__default.createElement("li", { key: option.id, onClick: option.onClick }, option.label)); }))));
|
|
9255
|
+
};
|
|
9256
|
+
// Position state for the context menu
|
|
9257
|
+
var _l = useState({ x: 0, y: 0 }), contextMenuPosition = _l[0], setContextMenuPosition = _l[1];
|
|
9258
|
+
var contextMenuOptions = [
|
|
9259
|
+
{ id: 'delete', label: 'Remove Tag', onClick: function () { return handleDelete(); } },
|
|
9260
|
+
{ id: 'add', label: 'Add Tag', onClick: function () { return setAddTagModalOpen(true); } },
|
|
9261
|
+
{ id: 'saveDefault', label: 'Save Default To Tag', onClick: function () { return handleSaveDefaultToTag(); } },
|
|
9262
|
+
{ id: 'saveAsView', label: 'Save as View', onClick: function () { return setSaveAsViewModalOpen(true); } },
|
|
9263
|
+
{ id: 'loadView', label: 'Load View', onClick: function () { return setLoadViewOpen(true); } },
|
|
9264
|
+
];
|
|
9265
|
+
var handleTagSelect = function (selectedTag) {
|
|
9266
|
+
handleAddTag(selectedTag);
|
|
9267
|
+
handleClose();
|
|
9268
|
+
};
|
|
9269
|
+
var handleDelete = function (index) {
|
|
9270
|
+
if (selectedRowIndex !== null) {
|
|
9271
|
+
var tagToDelete = viewTags[selectedRowIndex];
|
|
9272
|
+
handleDeleteTag(tagToDelete.TagId);
|
|
9273
|
+
setSelectedRowIndex(null); // Reset the selected row index
|
|
9274
|
+
}
|
|
9275
|
+
};
|
|
9276
|
+
useEffect(function () {
|
|
9277
|
+
if (Array.isArray(viewTags)) {
|
|
9278
|
+
setEditableTagNames(viewTags.reduce(function (acc, tag) {
|
|
9279
|
+
acc[tag.TagId] = tag.Alias || tag.TagName;
|
|
9280
|
+
return acc;
|
|
9281
|
+
}, {}));
|
|
9282
|
+
}
|
|
9283
|
+
}, [viewTags]);
|
|
9284
|
+
useEffect(function () {
|
|
9285
|
+
var handleGlobalClick = function (e) {
|
|
9286
|
+
if (selectedRowIndex !== null) {
|
|
9287
|
+
setSelectedRowIndex(null);
|
|
9288
|
+
}
|
|
9289
|
+
};
|
|
9290
|
+
var handleKeyDown = function (e) {
|
|
9291
|
+
if (e.key === "Escape" && selectedRowIndex !== null) {
|
|
9292
|
+
setSelectedRowIndex(null);
|
|
9293
|
+
}
|
|
9294
|
+
};
|
|
9295
|
+
// Attach event listeners
|
|
9296
|
+
document.addEventListener("click", handleGlobalClick);
|
|
9297
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
9298
|
+
// Cleanup function
|
|
9299
|
+
return function () {
|
|
9300
|
+
document.removeEventListener("click", handleGlobalClick);
|
|
9301
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
9302
|
+
};
|
|
9303
|
+
}, [selectedRowIndex]);
|
|
9304
|
+
var handleRightClick = function (event, index) {
|
|
9305
|
+
event.preventDefault();
|
|
9306
|
+
event.stopPropagation(); // Prevent the click event from propagating to the document
|
|
9307
|
+
setSelectedRowIndex(index);
|
|
9308
|
+
setContextMenuPosition({ x: event.clientX, y: event.clientY });
|
|
9309
|
+
};
|
|
9310
|
+
var handleSaveDefaultToTag = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
9311
|
+
var promises, allResponses, error_1;
|
|
9312
|
+
return __generator(this, function (_a) {
|
|
9313
|
+
switch (_a.label) {
|
|
9314
|
+
case 0:
|
|
9315
|
+
_a.trys.push([0, 2, 3, 4]);
|
|
9316
|
+
promises = viewTags.map(function (vt) { return __awaiter(void 0, void 0, void 0, function () {
|
|
9317
|
+
var response;
|
|
9318
|
+
return __generator(this, function (_a) {
|
|
9319
|
+
switch (_a.label) {
|
|
9320
|
+
case 0: return [4 /*yield*/, saveTagDefaults(vt.TagId, vt.Alias, vt.Color, vt.MinScale, vt.MaxScale, vt.Unit)];
|
|
9321
|
+
case 1:
|
|
9322
|
+
response = _a.sent();
|
|
9323
|
+
return [2 /*return*/, response];
|
|
9324
|
+
}
|
|
9325
|
+
});
|
|
9326
|
+
}); });
|
|
9327
|
+
return [4 /*yield*/, Promise.all(promises)];
|
|
9328
|
+
case 1:
|
|
9329
|
+
allResponses = _a.sent();
|
|
9330
|
+
allResponses.forEach(function (r) {
|
|
9331
|
+
if (!r.ok) {
|
|
9332
|
+
setError(r.message);
|
|
9333
|
+
}
|
|
9334
|
+
});
|
|
9335
|
+
return [3 /*break*/, 4];
|
|
9336
|
+
case 2:
|
|
9337
|
+
error_1 = _a.sent();
|
|
9338
|
+
setError(error_1.message);
|
|
9339
|
+
return [3 /*break*/, 4];
|
|
9340
|
+
case 3:
|
|
9341
|
+
setSelectedRowIndex(null);
|
|
9342
|
+
return [7 /*endfinally*/];
|
|
9343
|
+
case 4: return [2 /*return*/];
|
|
9344
|
+
}
|
|
9345
|
+
});
|
|
9346
|
+
}); };
|
|
9347
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
9348
|
+
React__default.createElement(Grid$1, { container: true, spacing: 1 },
|
|
9349
|
+
React__default.createElement(Grid$1, { item: true, xs: 12 },
|
|
9350
|
+
React__default.createElement("div", { style: { overflowX: 'auto', width: '100%' } },
|
|
9351
|
+
React__default.createElement("table", { style: { width: '100%', tableLayout: 'fixed', textAlign: "center" } },
|
|
9352
|
+
React__default.createElement("thead", null,
|
|
9353
|
+
React__default.createElement("tr", null,
|
|
9354
|
+
React__default.createElement("th", { className: classes.visible }, "View:"),
|
|
9355
|
+
React__default.createElement("th", { className: classes.inputCol }, viewSelected === null || viewSelected === void 0 ? void 0 : viewSelected.ViewName),
|
|
9356
|
+
React__default.createElement("th", { className: classes.color }),
|
|
9357
|
+
React__default.createElement("th", { colSpan: 4, className: "".concat(classes.topTitles, " ").concat(classes.scale) }, "Scale"),
|
|
9358
|
+
React__default.createElement("th", { className: "".concat(classes.topTitles, " ").concat(classes.xStats) }, cursorData ? (function () {
|
|
9359
|
+
var date = new Date(cursorData.x1);
|
|
9360
|
+
var formattedDate = date.toLocaleString('en-US', {
|
|
9361
|
+
hour12: false,
|
|
9362
|
+
month: 'short',
|
|
9363
|
+
day: 'numeric',
|
|
9364
|
+
hour: '2-digit',
|
|
9365
|
+
minute: '2-digit',
|
|
9366
|
+
second: '2-digit'
|
|
9367
|
+
});
|
|
9368
|
+
var milliseconds = date.getMilliseconds().toString().padStart(3, '0');
|
|
9369
|
+
var dateText = "".concat(formattedDate, ".").concat(milliseconds);
|
|
9370
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
9371
|
+
React__default.createElement("span", { style: {
|
|
9372
|
+
height: '10px',
|
|
9373
|
+
width: '10px',
|
|
9374
|
+
backgroundColor: "red",
|
|
9375
|
+
borderRadius: '50%',
|
|
9376
|
+
display: 'inline-block',
|
|
9377
|
+
marginRight: '5px'
|
|
9378
|
+
} }),
|
|
9379
|
+
dateText));
|
|
9380
|
+
})() : null),
|
|
9381
|
+
React__default.createElement("th", { className: "".concat(classes.topTitles, " ").concat(classes.xStats) }, cursorData ? (function () {
|
|
9382
|
+
var date = new Date(cursorData.x2);
|
|
9383
|
+
var formattedDate = date.toLocaleString('en-US', {
|
|
9384
|
+
hour12: false,
|
|
9385
|
+
month: 'short',
|
|
9386
|
+
day: 'numeric',
|
|
9387
|
+
hour: '2-digit',
|
|
9388
|
+
minute: '2-digit',
|
|
9389
|
+
second: '2-digit'
|
|
9390
|
+
});
|
|
9391
|
+
var milliseconds = date.getMilliseconds().toString().padStart(3, '0');
|
|
9392
|
+
var dateText = "".concat(formattedDate, ".").concat(milliseconds);
|
|
9393
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
9394
|
+
React__default.createElement("span", { style: {
|
|
9395
|
+
height: '10px',
|
|
9396
|
+
width: '10px',
|
|
9397
|
+
backgroundColor: "blue",
|
|
9398
|
+
borderRadius: '50%',
|
|
9399
|
+
display: 'inline-block',
|
|
9400
|
+
marginRight: '5px'
|
|
9401
|
+
} }),
|
|
9402
|
+
dateText));
|
|
9403
|
+
})() : null),
|
|
9404
|
+
React__default.createElement("th", { colSpan: 3, className: "".concat(classes.topTitles, " ").concat(classes.xStats) }, cursorData ? timeDifference(cursorData.x2, cursorData.x1) : null)))),
|
|
9405
|
+
React__default.createElement("table", { style: { width: '100%', tableLayout: 'fixed', textAlign: "center" } },
|
|
9406
|
+
React__default.createElement("thead", null,
|
|
9407
|
+
React__default.createElement("tr", { className: classes.bottomTitlesRow },
|
|
9408
|
+
React__default.createElement("th", { className: classes.visible }, "Visible"),
|
|
9409
|
+
React__default.createElement("th", { className: classes.inputCol }, "Alias / Tagname"),
|
|
9410
|
+
React__default.createElement("th", { className: classes.color }, "Color"),
|
|
9411
|
+
React__default.createElement("th", { className: classes.inputCol }, "Min Scale"),
|
|
9412
|
+
React__default.createElement("th", { className: classes.inputCol }, "Max Scale"),
|
|
9413
|
+
React__default.createElement("th", { className: classes.unit }, "Unit"),
|
|
9414
|
+
React__default.createElement("th", { className: classes.autoScale }, "AutoScale"),
|
|
9415
|
+
React__default.createElement("th", null, " "),
|
|
9416
|
+
React__default.createElement("th", null),
|
|
9417
|
+
React__default.createElement("th", null, "Y2-Y1"),
|
|
9418
|
+
React__default.createElement("th", null, "Min"),
|
|
9419
|
+
React__default.createElement("th", null, "Max")))))),
|
|
9420
|
+
React__default.createElement(Grid$1, { item: true, xs: 12 },
|
|
9421
|
+
React__default.createElement("div", { style: { width: '100%', overflowY: 'auto', maxHeight: ' 20svh' } },
|
|
9422
|
+
React__default.createElement("table", { cellPadding: '4px', style: { width: '100%', tableLayout: 'fixed', textAlign: "center" } },
|
|
9423
|
+
React__default.createElement("tbody", null, viewTags && viewTags.length && Array.isArray(viewTags) ? viewTags.map(function (tag, index) {
|
|
9424
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
9425
|
+
return (React__default.createElement("tr", { key: tag.TagName,
|
|
9426
|
+
// onClick={() => handleRowClick(index)}
|
|
9427
|
+
onContextMenu: function (e) { return handleRightClick(e, index); }, className: classes.rowHover },
|
|
9428
|
+
React__default.createElement("td", { className: "".concat(classes.visible, " ").concat(classes.checkbox) },
|
|
9429
|
+
React__default.createElement("input", { type: "checkbox", checked: tag.IsVisible, onChange: function (e) { return handleVisibilityChange(tag.TagId, e.target.checked); } })),
|
|
9430
|
+
React__default.createElement("td", { className: classes.inputCol },
|
|
9431
|
+
React__default.createElement(Tooltip, { title: tag.TagName, placement: "top", arrow: true, interactive: true, enterDelay: 500 },
|
|
9432
|
+
React__default.createElement("div", null,
|
|
9433
|
+
React__default.createElement("input", { type: "text", style: { width: '100%' }, value: editableTagNames[tag.TagId], onFocus: function (e) { return e.target.select(); }, onChange: function (e) {
|
|
9434
|
+
var _a;
|
|
9435
|
+
setEditableTagNames(__assign(__assign({}, editableTagNames), (_a = {}, _a[tag.TagId] = e.target.value, _a)));
|
|
9436
|
+
}, onKeyDown: function (e) {
|
|
9437
|
+
if (e.key === 'Enter') {
|
|
9438
|
+
handleChangeAlias(tag.TagId, editableTagNames[tag.TagId]);
|
|
9439
|
+
}
|
|
9440
|
+
} })))),
|
|
9441
|
+
React__default.createElement("td", { className: classes.color },
|
|
9442
|
+
React__default.createElement(ColorPicker, { onChange: handleColorChange, color: tag.Color, elementId: tag.TagId })),
|
|
9443
|
+
React__default.createElement("td", { className: classes.inputCol },
|
|
9444
|
+
React__default.createElement("input", { type: "text", style: __assign({ width: '100%' }, (tag.IsAutoScale ? {
|
|
9445
|
+
backgroundColor: 'rgba(239, 239, 239, 0.3)',
|
|
9446
|
+
color: 'rgba(84, 84, 84, 1)',
|
|
9447
|
+
border: '1px solid rgba(118, 118, 118, 0.3)'
|
|
9448
|
+
} : {})), value: tag.MinScale, onClick: function () { return handleAbleScales(tag.TagId, tag.IsAutoScale); }, onFocus: function (e) { return e.target.select(); }, onChange: function (e) {
|
|
9449
|
+
var value = e.target.value;
|
|
9450
|
+
var numericValue = Number(value);
|
|
9451
|
+
handleChange(tag.TagId, numericValue, 'MinScale');
|
|
9452
|
+
} })),
|
|
9453
|
+
React__default.createElement("td", { className: classes.inputCol },
|
|
9454
|
+
React__default.createElement("input", { type: "text", style: __assign({ width: '100%' }, (tag.IsAutoScale ? {
|
|
9455
|
+
backgroundColor: 'rgba(239, 239, 239, 0.3)',
|
|
9456
|
+
color: 'rgba(84, 84, 84, 1)',
|
|
9457
|
+
border: '1px solid rgba(118, 118, 118, 0.3)'
|
|
9458
|
+
} : {})), value: tag.MaxScale, onClick: function () { return handleAbleScales(tag.TagId, tag.IsAutoScale); }, onFocus: function (e) { return e.target.select(); }, onChange: function (e) {
|
|
9459
|
+
var value = e.target.value;
|
|
9460
|
+
var numericValue = Number(value);
|
|
9461
|
+
// Check if the value is a number and not empty
|
|
9462
|
+
if (!isNaN(numericValue) && value.trim() !== '') {
|
|
9463
|
+
handleChange(tag.TagId, numericValue, 'MaxScale');
|
|
9464
|
+
}
|
|
9465
|
+
} })),
|
|
9466
|
+
React__default.createElement("td", { className: "".concat(classes.autoScale, " ").concat(classes.checkbox) },
|
|
9467
|
+
React__default.createElement("input", { type: "text", style: { width: '100%' }, disabled: true, value: tag.Unit, onFocus: function (e) { return e.target.select(); } })),
|
|
9468
|
+
React__default.createElement("td", { className: "".concat(classes.autoScale, " ").concat(classes.checkbox) },
|
|
9469
|
+
React__default.createElement("input", { type: "checkbox", checked: tag.IsAutoScale, onChange: function (e) { return handleAutoScaleChange(tag.TagId, tag.IsAutoScale); } })),
|
|
9470
|
+
React__default.createElement("td", null, (_a = dataTable[tag.TagName]) === null || _a === void 0 ? void 0 : _a.y1),
|
|
9471
|
+
React__default.createElement("td", { className: classes.doubleInput }, (_b = dataTable[tag.TagName]) === null || _b === void 0 ? void 0 : _b.y2),
|
|
9472
|
+
React__default.createElement("td", null, (_c = dataTable[tag.TagName]) === null || _c === void 0 ? void 0 : _c.y2y1),
|
|
9473
|
+
React__default.createElement("td", null,
|
|
9474
|
+
!isNaN(((_d = dataTable[tag.TagName]) === null || _d === void 0 ? void 0 : _d.pmin.y) * 0) ? (_e = dataTable[tag.TagName]) === null || _e === void 0 ? void 0 : _e.pmin.y : 0,
|
|
9475
|
+
" "),
|
|
9476
|
+
React__default.createElement("td", null,
|
|
9477
|
+
!isNaN(((_f = dataTable[tag.TagName]) === null || _f === void 0 ? void 0 : _f.pmax.y) * 0) ? (_g = dataTable[tag.TagName]) === null || _g === void 0 ? void 0 : _g.pmax.y : 0,
|
|
9478
|
+
" ")));
|
|
9479
|
+
}) : React__default.createElement("div", { style: { padding: '2rem' } },
|
|
9480
|
+
React__default.createElement("div", { style: { padding: "1rem" } }, "No tag view detected. "),
|
|
9481
|
+
React__default.createElement("div", { style: { padding: "1rem" } },
|
|
9482
|
+
React__default.createElement(Button$1, { onClick: function () { return setAddTagModalOpen(true); }, variant: 'contained', color: 'primary' }, " Add tag")),
|
|
9483
|
+
React__default.createElement("div", null,
|
|
9484
|
+
React__default.createElement(Button$1, { onClick: function () { return setLoadViewOpen(true); }, variant: 'outlined', color: 'primary' }, " Load view"))))))),
|
|
9485
|
+
selectedRowIndex !== null && (React__default.createElement(ContextMenu, { x: contextMenuPosition.x, y: contextMenuPosition.y, options: contextMenuOptions })),
|
|
9486
|
+
React__default.createElement(AddTagModal, { open: addTagModalOpen, handleClose: handleClose, onTagSelect: handleTagSelect }),
|
|
9487
|
+
React__default.createElement(SaveAsViewModal, { open: saveAsViewModalOpen, handleClose: function () { return setSaveAsViewModalOpen(false); } }),
|
|
9488
|
+
React__default.createElement(LoadViewModal, { open: loadViewOpen, handleClose: function () { return setLoadViewOpen(false); } })),
|
|
9489
|
+
React__default.createElement(ErrorModal, { error: error, onHide: function () { return setError(''); } })));
|
|
9103
9490
|
};
|
|
9104
9491
|
|
|
9105
9492
|
var formatDateTimeToString = function (date) {
|
|
@@ -9199,9 +9586,6 @@ var useChartOptions = function () {
|
|
|
9199
9586
|
}
|
|
9200
9587
|
}
|
|
9201
9588
|
}
|
|
9202
|
-
else {
|
|
9203
|
-
console.log('sin y', keys);
|
|
9204
|
-
}
|
|
9205
9589
|
}
|
|
9206
9590
|
}
|
|
9207
9591
|
},
|
|
@@ -9225,64 +9609,6 @@ var useChartOptions = function () {
|
|
|
9225
9609
|
});
|
|
9226
9610
|
};
|
|
9227
9611
|
|
|
9228
|
-
var useTrendingStyles = makeStyles$1(function (theme) { return ({
|
|
9229
|
-
datetimePicker: {
|
|
9230
|
-
alignItems: "center",
|
|
9231
|
-
"& .MuiInputBase-root": {
|
|
9232
|
-
color: "black",
|
|
9233
|
-
backgroundColor: "white",
|
|
9234
|
-
borderRadius: theme.shape.borderRadius,
|
|
9235
|
-
width: "90%",
|
|
9236
|
-
minWidth: "90%",
|
|
9237
|
-
maxWidth: "90%"
|
|
9238
|
-
},
|
|
9239
|
-
"& .MuiInputBase-input": {
|
|
9240
|
-
fontSize: "13px !important",
|
|
9241
|
-
height: "15px !important",
|
|
9242
|
-
paddingRight: "3px",
|
|
9243
|
-
paddingLeft: "5px"
|
|
9244
|
-
},
|
|
9245
|
-
"& .MuiInput-underline:before": {
|
|
9246
|
-
borderBottomColor: "rgba(0, 0, 0, 0.42)"
|
|
9247
|
-
}
|
|
9248
|
-
},
|
|
9249
|
-
select: {
|
|
9250
|
-
"& .MuiInput-root": {
|
|
9251
|
-
width: "100%"
|
|
9252
|
-
},
|
|
9253
|
-
"& .MuiInputBase-root": {
|
|
9254
|
-
color: "black",
|
|
9255
|
-
backgroundColor: "white",
|
|
9256
|
-
borderRadius: theme.shape.borderRadius,
|
|
9257
|
-
minWidth: "100%"
|
|
9258
|
-
},
|
|
9259
|
-
"& .MuiInputBase-input": {
|
|
9260
|
-
fontSize: "14px !important",
|
|
9261
|
-
height: "15px !important"
|
|
9262
|
-
},
|
|
9263
|
-
"& .MuiInput-underline:before": {
|
|
9264
|
-
borderBottomColor: "rgba(0, 0, 0, 0.42)"
|
|
9265
|
-
}
|
|
9266
|
-
},
|
|
9267
|
-
labelOptions: {
|
|
9268
|
-
paddingLeft: "2rem",
|
|
9269
|
-
userSelect: "none",
|
|
9270
|
-
"& > label": {
|
|
9271
|
-
display: "flex",
|
|
9272
|
-
alignItems: "center",
|
|
9273
|
-
gap: "5px"
|
|
9274
|
-
},
|
|
9275
|
-
'& input[type="checkbox"]': {
|
|
9276
|
-
zoom: 1.5
|
|
9277
|
-
}
|
|
9278
|
-
},
|
|
9279
|
-
navigatorButton: {
|
|
9280
|
-
"& .MuiSvgIcon-root": {
|
|
9281
|
-
cursor: "pointer !important"
|
|
9282
|
-
}
|
|
9283
|
-
}
|
|
9284
|
-
}); });
|
|
9285
|
-
|
|
9286
9612
|
var CustomOptionsComponent = function (_a) {
|
|
9287
9613
|
var customOptions = _a.customOptions, setCustomOptions = _a.setCustomOptions;
|
|
9288
9614
|
var classes = useTrendingStyles();
|
|
@@ -9528,11 +9854,13 @@ var useYAxisPlugin = function () {
|
|
|
9528
9854
|
};
|
|
9529
9855
|
|
|
9530
9856
|
var areRangesSimilar = function (tag1, tag2) {
|
|
9531
|
-
|
|
9532
|
-
|
|
9857
|
+
if (isNil$1(tag1.MaxScale) || isNil$1(tag1.MinScale) || isNil$1(tag2.MaxScale) || isNil$1(tag2.MinScale))
|
|
9858
|
+
return;
|
|
9859
|
+
var range1 = tag1.MaxScale - tag1.MinScale; // Rango de la primera etiqueta
|
|
9860
|
+
var range2 = tag2.MaxScale - tag2.MinScale; // Rango de la segunda etiqueta
|
|
9533
9861
|
// Determina los límites para la comparación
|
|
9534
|
-
var lowerBound = Math.max(tag1.
|
|
9535
|
-
var upperBound = Math.min(tag1.
|
|
9862
|
+
var lowerBound = Math.max(tag1.MinScale, tag2.MinScale);
|
|
9863
|
+
var upperBound = Math.min(tag1.MaxScale, tag2.MaxScale);
|
|
9536
9864
|
// Calcula el solapamiento entre los dos rangos
|
|
9537
9865
|
var overlap = Math.max(0, upperBound - lowerBound);
|
|
9538
9866
|
// Determina si el solapamiento es significativo comparado con los rangos individuales
|
|
@@ -9540,28 +9868,9 @@ var areRangesSimilar = function (tag1, tag2) {
|
|
|
9540
9868
|
return isSignificantOverlap;
|
|
9541
9869
|
};
|
|
9542
9870
|
|
|
9543
|
-
var calculateScales = function (min, max, sigDigits) {
|
|
9544
|
-
var roundToSignificantDigits = function (num) {
|
|
9545
|
-
if (num === 0)
|
|
9546
|
-
return 0;
|
|
9547
|
-
var multiplier = Math.pow(10, sigDigits - Math.floor(Math.log10(Math.abs(num))) - 1);
|
|
9548
|
-
return Math.round(num * multiplier) / multiplier;
|
|
9549
|
-
};
|
|
9550
|
-
var minScale = roundToSignificantDigits(min);
|
|
9551
|
-
var maxScale = roundToSignificantDigits(max);
|
|
9552
|
-
// Adjust minScale and maxScale if necessary
|
|
9553
|
-
if (minScale > min) {
|
|
9554
|
-
minScale *= 0.9;
|
|
9555
|
-
}
|
|
9556
|
-
if (maxScale < max) {
|
|
9557
|
-
maxScale *= 1.1;
|
|
9558
|
-
}
|
|
9559
|
-
return { minScale: minScale, maxScale: maxScale };
|
|
9560
|
-
};
|
|
9561
|
-
|
|
9562
9871
|
var TrendingChart = function (_a) {
|
|
9563
|
-
var
|
|
9564
|
-
var _b = useTrendingContext(), state = _b.state; _b.actions;
|
|
9872
|
+
var series = _a.series, chartOptions = _a.chartOptions, setChartOptions = _a.setChartOptions, chartData = _a.chartData, setCursorData = _a.setCursorData, setChartData = _a.setChartData;
|
|
9873
|
+
var _b = useTrendingContext(), state = _b.state, viewTags = _b.state.viewTags; _b.actions;
|
|
9565
9874
|
var _c = useState(null), lineTabCoords = _c[0], setLineTabCoords = _c[1];
|
|
9566
9875
|
var _d = useState(null), chartArea = _d[0], setChartArea = _d[1];
|
|
9567
9876
|
var chartRef = useRef(null);
|
|
@@ -9575,58 +9884,62 @@ var TrendingChart = function (_a) {
|
|
|
9575
9884
|
var verticalLinePlugin = useGetVerticalLinePlugin(setChartArea, setLineTabCoords);
|
|
9576
9885
|
var xAxisDatePlugin = useXAxisDatePlugin();
|
|
9577
9886
|
var yAxisPlugin = useYAxisPlugin();
|
|
9887
|
+
var seriesVsTags = useRef({});
|
|
9578
9888
|
useEffect(function () {
|
|
9579
9889
|
var axes = [];
|
|
9580
9890
|
if (!series.length) {
|
|
9581
9891
|
return;
|
|
9582
9892
|
}
|
|
9583
|
-
|
|
9584
|
-
|
|
9585
|
-
|
|
9586
|
-
|
|
9587
|
-
|
|
9588
|
-
|
|
9589
|
-
|
|
9590
|
-
|
|
9591
|
-
|
|
9592
|
-
|
|
9593
|
-
});
|
|
9594
|
-
if (!existingAxis) {
|
|
9595
|
-
axes.push(tag); // Add new axis if no similar one exists
|
|
9596
|
-
}
|
|
9893
|
+
viewTags.forEach(function (tag, index) {
|
|
9894
|
+
var existingAxis = axes.findIndex(function (existingTag) {
|
|
9895
|
+
return areRangesSimilar(existingTag, tag);
|
|
9896
|
+
});
|
|
9897
|
+
if (existingAxis === -1) {
|
|
9898
|
+
axes.push(tag); // Add new axis if no similar one exists
|
|
9899
|
+
seriesVsTags.current[tag.TagId] = tag.TagId;
|
|
9900
|
+
}
|
|
9901
|
+
else {
|
|
9902
|
+
seriesVsTags.current[tag.TagId] = axes[existingAxis].TagId;
|
|
9597
9903
|
}
|
|
9598
9904
|
});
|
|
9599
9905
|
// Configure yAxes based on grouped axes
|
|
9600
|
-
var yAxesConfig = axes.map(function (axis
|
|
9906
|
+
var yAxesConfig = axes.map(function (axis) {
|
|
9601
9907
|
return {
|
|
9602
|
-
id: "y-axis-".concat(
|
|
9908
|
+
id: "y-axis-".concat(axis.TagId),
|
|
9603
9909
|
type: "linear",
|
|
9604
|
-
display: axis.
|
|
9910
|
+
display: axis.IsVisible,
|
|
9605
9911
|
scaleLabel: {
|
|
9606
9912
|
display: true,
|
|
9607
|
-
labelString: axis.
|
|
9608
|
-
},
|
|
9609
|
-
ticks: {
|
|
9610
|
-
min: axis.autoScale ? undefined : axis.minScale,
|
|
9611
|
-
max: axis.autoScale ? undefined : axis.maxScale
|
|
9913
|
+
labelString: axis.TagName
|
|
9612
9914
|
},
|
|
9915
|
+
min: axis.IsAutoScale ? undefined : axis.MinScale,
|
|
9916
|
+
max: axis.IsAutoScale ? undefined : axis.MaxScale,
|
|
9917
|
+
suggestedMin: axis.IsAutoScale ? undefined : axis.MinScale,
|
|
9918
|
+
suggestedMax: axis.IsAutoScale ? undefined : axis.MaxScale,
|
|
9919
|
+
stepSize: 10,
|
|
9613
9920
|
grid: {
|
|
9614
9921
|
display: true
|
|
9615
9922
|
},
|
|
9616
|
-
afterUpdate: function (
|
|
9617
|
-
var chart =
|
|
9923
|
+
afterUpdate: function (a) {
|
|
9924
|
+
var chart = a.chart;
|
|
9618
9925
|
var keys = Object.keys(chart.scales).filter(function (sc) { return sc !== 'x'; });
|
|
9926
|
+
var counterOfDefaultsScales = 0;
|
|
9619
9927
|
if (keys.length > 1) {
|
|
9620
9928
|
for (var scaleKey in chart.scales) {
|
|
9621
9929
|
var scale = chart.scales[scaleKey];
|
|
9622
9930
|
if (scale.max === 1 && scale.min === 0) {
|
|
9623
9931
|
chart.scales[scaleKey].display = false;
|
|
9624
9932
|
chart.scales[scaleKey].options.display = false;
|
|
9933
|
+
counterOfDefaultsScales++;
|
|
9625
9934
|
}
|
|
9626
9935
|
else {
|
|
9627
9936
|
chart.scales[scaleKey].display = true;
|
|
9628
9937
|
chart.scales[scaleKey].options.display = true;
|
|
9629
9938
|
}
|
|
9939
|
+
if (counterOfDefaultsScales === keys.length) {
|
|
9940
|
+
chart.scales[keys[0]].display = true;
|
|
9941
|
+
chart.scales[keys[0]].options.display = true;
|
|
9942
|
+
}
|
|
9630
9943
|
}
|
|
9631
9944
|
}
|
|
9632
9945
|
}
|
|
@@ -9640,19 +9953,17 @@ var TrendingChart = function (_a) {
|
|
|
9640
9953
|
return newResp;
|
|
9641
9954
|
});
|
|
9642
9955
|
var updatedSeries = series.map(function (serie, index) {
|
|
9643
|
-
var tag =
|
|
9644
|
-
var
|
|
9645
|
-
return areRangesSimilar(existingTag, tag);
|
|
9646
|
-
});
|
|
9956
|
+
var tag = viewTags[index];
|
|
9957
|
+
var yAxisTagId = seriesVsTags.current[tag.TagId];
|
|
9647
9958
|
return {
|
|
9648
|
-
yAxisID:
|
|
9959
|
+
yAxisID: "y-axis-".concat(yAxisTagId),
|
|
9649
9960
|
data: serie.map(function (sample) { return ({
|
|
9650
9961
|
x: new Date(sample.timestamp),
|
|
9651
9962
|
y: sample.value
|
|
9652
9963
|
}); }),
|
|
9653
|
-
tagId: tag.
|
|
9654
|
-
borderColor: tag.
|
|
9655
|
-
hidden: !tag.
|
|
9964
|
+
tagId: tag === null || tag === void 0 ? void 0 : tag.TagId,
|
|
9965
|
+
borderColor: tag === null || tag === void 0 ? void 0 : tag.Color,
|
|
9966
|
+
hidden: !(tag === null || tag === void 0 ? void 0 : tag.IsVisible),
|
|
9656
9967
|
pointRadius: serie.length <= 50 ? 3 : 0
|
|
9657
9968
|
};
|
|
9658
9969
|
});
|
|
@@ -9661,7 +9972,7 @@ var TrendingChart = function (_a) {
|
|
|
9661
9972
|
labels: [],
|
|
9662
9973
|
datasets: updatedSeries
|
|
9663
9974
|
});
|
|
9664
|
-
}, [
|
|
9975
|
+
}, [state.graphShouldUpdate, series]);
|
|
9665
9976
|
useEffect(function () {
|
|
9666
9977
|
if (chartShouldInitCursors) {
|
|
9667
9978
|
if (chartRef.current) {
|
|
@@ -9669,7 +9980,7 @@ var TrendingChart = function (_a) {
|
|
|
9669
9980
|
chartRef.current.update();
|
|
9670
9981
|
}
|
|
9671
9982
|
}
|
|
9672
|
-
}, [chartShouldInitCursors, state]);
|
|
9983
|
+
}, [chartShouldInitCursors, state.graphShouldUpdate]);
|
|
9673
9984
|
return (React__default.createElement(Paper$1, { style: { height: '100%', position: 'relative' } },
|
|
9674
9985
|
lineTabCoords && chartArea ? (React__default.createElement(DraggableLineControl, { color: 'red', chartArea: chartArea, initialLeft: lineTabCoords === null || lineTabCoords === void 0 ? void 0 : lineTabCoords.x1, onUpdate: function (newLeft) {
|
|
9675
9986
|
setLineTabCoords(function (prevCoords) {
|
|
@@ -9694,18 +10005,17 @@ var TrendingChart = function (_a) {
|
|
|
9694
10005
|
|
|
9695
10006
|
Chart.register(CategoryScale, LinearScale, PointElement, LineElement, Title, Tooltip$1, Legend, TimeScale, zoomPlugin);
|
|
9696
10007
|
var Trending = function (_a) {
|
|
9697
|
-
_a.title;
|
|
9698
|
-
var _b = useTrendingContext(), state = _b.state
|
|
9699
|
-
var _c = useState(
|
|
9700
|
-
var _d = useState(
|
|
9701
|
-
var _e = useState(
|
|
9702
|
-
var _f =
|
|
9703
|
-
var _g =
|
|
9704
|
-
var _h = useState({
|
|
10008
|
+
_a.title;
|
|
10009
|
+
var _b = useTrendingContext(), state = _b.state, viewTags = _b.state.viewTags;
|
|
10010
|
+
var _c = useState(''), error = _c[0], setError = _c[1];
|
|
10011
|
+
var _d = useState(true), loading = _d[0], setLoading = _d[1];
|
|
10012
|
+
var _e = useState([]), series = _e[0], setSeries = _e[1];
|
|
10013
|
+
var _f = useChartOptions(), chartOptions = _f[0], setChartOptions = _f[1];
|
|
10014
|
+
var _g = useState({
|
|
9705
10015
|
labels: [],
|
|
9706
10016
|
datasets: []
|
|
9707
|
-
}), chartData =
|
|
9708
|
-
var
|
|
10017
|
+
}), chartData = _g[0], setChartData = _g[1];
|
|
10018
|
+
var _h = useState(null), cursorData = _h[0], setCursorData = _h[1];
|
|
9709
10019
|
var debounceForFetchingData = useRef(null);
|
|
9710
10020
|
useEffect(function () {
|
|
9711
10021
|
if (debounceForFetchingData.current) {
|
|
@@ -9717,10 +10027,10 @@ var Trending = function (_a) {
|
|
|
9717
10027
|
return __generator(this, function (_a) {
|
|
9718
10028
|
switch (_a.label) {
|
|
9719
10029
|
case 0:
|
|
9720
|
-
_a.trys.push([0,
|
|
9721
|
-
console.log("fetching data");
|
|
10030
|
+
_a.trys.push([0, 3, , 4]);
|
|
9722
10031
|
setLoading(true);
|
|
9723
|
-
|
|
10032
|
+
if (!(Array.isArray(viewTags) && viewTags.length)) return [3 /*break*/, 2];
|
|
10033
|
+
tagIds = viewTags.map(function (tag) { return tag.TagId; });
|
|
9724
10034
|
return [4 /*yield*/, axios.post("/series?nodeName=null", {
|
|
9725
10035
|
start: state.timeScopeStart.getTime(),
|
|
9726
10036
|
end: state.timeScopeEnd.getTime(),
|
|
@@ -9730,84 +10040,81 @@ var Trending = function (_a) {
|
|
|
9730
10040
|
case 1:
|
|
9731
10041
|
response = _a.sent();
|
|
9732
10042
|
setSeries(response.data || []);
|
|
9733
|
-
|
|
9734
|
-
return [3 /*break*/, 3];
|
|
10043
|
+
_a.label = 2;
|
|
9735
10044
|
case 2:
|
|
10045
|
+
setLoading(false);
|
|
10046
|
+
return [3 /*break*/, 4];
|
|
10047
|
+
case 3:
|
|
9736
10048
|
error_1 = _a.sent();
|
|
9737
|
-
|
|
9738
|
-
setError("Failed to fetch data");
|
|
10049
|
+
setError(error_1.message);
|
|
9739
10050
|
setLoading(false);
|
|
9740
|
-
return [3 /*break*/,
|
|
9741
|
-
case
|
|
10051
|
+
return [3 /*break*/, 4];
|
|
10052
|
+
case 4: return [2 /*return*/];
|
|
9742
10053
|
}
|
|
9743
10054
|
});
|
|
9744
10055
|
}); };
|
|
9745
10056
|
fetchData();
|
|
9746
10057
|
}, 800);
|
|
9747
|
-
}, [
|
|
9748
|
-
|
|
9749
|
-
|
|
9750
|
-
|
|
9751
|
-
|
|
9752
|
-
|
|
9753
|
-
|
|
9754
|
-
|
|
9755
|
-
React__default.createElement(
|
|
9756
|
-
|
|
9757
|
-
|
|
9758
|
-
loading && (React__default.createElement(Grid$1, { item: true, xs: 12, style: { textAlign: 'center' } },
|
|
9759
|
-
React__default.createElement("p", null, "Loading...")))));
|
|
10058
|
+
}, [state.graphShouldUpdate, viewTags]);
|
|
10059
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
10060
|
+
React__default.createElement(Grid$1, { container: true, style: { width: "95svw", height: "81svh", margin: 0 } },
|
|
10061
|
+
React__default.createElement(Header, { setChartOptions: setChartOptions }),
|
|
10062
|
+
React__default.createElement(Grid$1, { item: true, xs: 12, style: { height: '45%' } },
|
|
10063
|
+
React__default.createElement(TrendingChart, { series: series, chartData: chartData, setChartData: setChartData, chartOptions: chartOptions, setChartOptions: setChartOptions, setCursorData: setCursorData })),
|
|
10064
|
+
React__default.createElement(Grid$1, { item: true, xs: 12, style: { height: '40%', minWidth: "100%", paddingTop: "3rem" } },
|
|
10065
|
+
React__default.createElement(TableComponent, { chartData: chartData, cursorData: cursorData })),
|
|
10066
|
+
loading && (React__default.createElement(Grid$1, { item: true, xs: 12, style: { textAlign: 'center' } },
|
|
10067
|
+
React__default.createElement("p", null, "Loading...")))),
|
|
10068
|
+
React__default.createElement(ErrorModal, { error: error, onHide: function () { return setError(''); }, title: "ERROR" })));
|
|
9760
10069
|
};
|
|
9761
10070
|
|
|
9762
|
-
|
|
9763
|
-
var
|
|
9764
|
-
|
|
9765
|
-
|
|
9766
|
-
|
|
9767
|
-
|
|
9768
|
-
|
|
9769
|
-
|
|
9770
|
-
|
|
9771
|
-
|
|
9772
|
-
|
|
9773
|
-
|
|
9774
|
-
|
|
9775
|
-
|
|
9776
|
-
|
|
9777
|
-
|
|
9778
|
-
|
|
9779
|
-
|
|
9780
|
-
|
|
9781
|
-
|
|
9782
|
-
|
|
9783
|
-
|
|
9784
|
-
|
|
9785
|
-
|
|
9786
|
-
|
|
9787
|
-
|
|
9788
|
-
|
|
9789
|
-
|
|
9790
|
-
|
|
9791
|
-
|
|
9792
|
-
|
|
9793
|
-
|
|
9794
|
-
|
|
9795
|
-
|
|
9796
|
-
|
|
9797
|
-
|
|
9798
|
-
|
|
9799
|
-
|
|
9800
|
-
|
|
9801
|
-
|
|
9802
|
-
|
|
9803
|
-
|
|
9804
|
-
|
|
9805
|
-
|
|
9806
|
-
|
|
9807
|
-
|
|
9808
|
-
|
|
9809
|
-
},
|
|
9810
|
-
] })))))));
|
|
10071
|
+
var TrendingsPage = function (props) {
|
|
10072
|
+
var _a = useState(''), error = _a[0], setError = _a[1];
|
|
10073
|
+
var _b = useTrendingContext().actions, setViews = _b.setViews, setViewTags = _b.setViewTags, setViewSelected = _b.setViewSelected;
|
|
10074
|
+
useEffect(function () {
|
|
10075
|
+
var getTags = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
10076
|
+
var viewsResp, lastCreated, viewTagsResp;
|
|
10077
|
+
return __generator(this, function (_a) {
|
|
10078
|
+
switch (_a.label) {
|
|
10079
|
+
case 0: return [4 /*yield*/, getViews(null)];
|
|
10080
|
+
case 1:
|
|
10081
|
+
viewsResp = _a.sent();
|
|
10082
|
+
if (!viewsResp.ok) return [3 /*break*/, 3];
|
|
10083
|
+
setViews(viewsResp.data.tables[0].rows);
|
|
10084
|
+
lastCreated = viewsResp.data.tables[0].rows.reduce(function (prev, current) { return (prev.ViewId > current.ViewId) ? prev : current; });
|
|
10085
|
+
//viewSelected
|
|
10086
|
+
setViewSelected(lastCreated);
|
|
10087
|
+
return [4 /*yield*/, getViewTags(lastCreated.ViewId)];
|
|
10088
|
+
case 2:
|
|
10089
|
+
viewTagsResp = _a.sent();
|
|
10090
|
+
if (viewTagsResp.ok) {
|
|
10091
|
+
setViewTags(viewTagsResp.data.tables[0].rows);
|
|
10092
|
+
}
|
|
10093
|
+
else {
|
|
10094
|
+
setError(viewTagsResp.message);
|
|
10095
|
+
}
|
|
10096
|
+
return [3 /*break*/, 4];
|
|
10097
|
+
case 3:
|
|
10098
|
+
setError(viewsResp.message);
|
|
10099
|
+
_a.label = 4;
|
|
10100
|
+
case 4: return [2 /*return*/];
|
|
10101
|
+
}
|
|
10102
|
+
});
|
|
10103
|
+
}); };
|
|
10104
|
+
getTags();
|
|
10105
|
+
}, []);
|
|
10106
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
10107
|
+
React__default.createElement(Box, { p: 3, style: { maxWidth: "100%" } },
|
|
10108
|
+
React__default.createElement(Paper, null,
|
|
10109
|
+
React__default.createElement(Grid$1, { container: true, spacing: 3, style: { padding: "20px" } },
|
|
10110
|
+
React__default.createElement(Grid$1, { item: true, xs: 12 },
|
|
10111
|
+
React__default.createElement(Trending, { title: "Trending Chart" }))))),
|
|
10112
|
+
React__default.createElement(ErrorModal, { error: error, onHide: function () { return setError(''); }, size: "xl", title: "ERROR" })));
|
|
10113
|
+
};
|
|
10114
|
+
|
|
10115
|
+
var index = function () {
|
|
10116
|
+
return (React__default.createElement(TrendingProvider, null,
|
|
10117
|
+
React__default.createElement(TrendingsPage, null)));
|
|
9811
10118
|
};
|
|
9812
10119
|
|
|
9813
10120
|
var MESFMainRouter = function () {
|
|
@@ -9817,7 +10124,7 @@ var MESFMainRouter = function () {
|
|
|
9817
10124
|
React__default.createElement(Route, { path: "/", element: React__default.createElement(Navigate, { replace: true, to: "/home" }) }),
|
|
9818
10125
|
React__default.createElement(Route, { path: "/configuration/*", element: React__default.createElement(Configuration, null) }),
|
|
9819
10126
|
React__default.createElement(Route, { path: "/account", element: React__default.createElement(Account, null) }),
|
|
9820
|
-
React__default.createElement(Route, { path: "/trendings", element: React__default.createElement(
|
|
10127
|
+
React__default.createElement(Route, { path: "/trendings", element: React__default.createElement(index, null) }),
|
|
9821
10128
|
React__default.createElement(Route, { path: "/home", element: React__default.createElement(Home, null) })),
|
|
9822
10129
|
React__default.createElement(CustomRoutes, null)));
|
|
9823
10130
|
};
|
|
@@ -10004,5 +10311,5 @@ var areaSelector = /*#__PURE__*/Object.freeze({
|
|
|
10004
10311
|
AreaSelector: AreaSelector
|
|
10005
10312
|
});
|
|
10006
10313
|
|
|
10007
|
-
export { Account, AssetProvider, AuthContext, AuthProvider, BarChartControl, ChangePassword, CheckBoxControl, Configuration$1 as Configuration, CurrencyFormatter, DataGridControl, DateFormatter, DateTimeFormatter, ErrorModal, FetchError, FilterPanel, GenericPanel, GenericTable, GetCrewColor, GetShiftColor, HorizontalTextControl, IntegerFormatter, Login, Logout, LongFilterPanel, MESApiService, MESFMain, MESSAGE_API, MESSAGE_ERRORS, MasterDetailPanel, MesfModal, ModalTreeFilterControl, MultipleSelectorControl, NumberFormatter, NumericTextControl, SimplePasswordControl, SimpleSelectorControl, SimpleTextAreaControl, SimpleTextControl, TimeFormatter, TreePickerControl,
|
|
10314
|
+
export { Account, AssetProvider, AuthContext, AuthProvider, BarChartControl, ButtonWithLoading, ChangePassword, CheckBoxControl, Configuration$1 as Configuration, CurrencyFormatter, DataGridControl, DateFormatter, DateTimeFormatter, ErrorModal, FetchError, FilterPanel, GenericPanel, GenericTable, GetCrewColor, GetShiftColor, HorizontalTextControl, IntegerFormatter, Login, Logout, LongFilterPanel, MESApiService, MESFMain, MESSAGE_API, MESSAGE_ERRORS, MasterDetailPanel, MesfModal, ModalTreeFilterControl, MultipleSelectorControl, NumberFormatter, NumericTextControl, SimplePasswordControl, SimpleSelectorControl, SimpleTextAreaControl, SimpleTextControl, TimeFormatter, TreePickerControl, TrendingsPage, USER_LABELS, UTLSettingsProvider, UploadFileControl, UserProvider, axiosInstance, formatNumber, getCrewStyle, getError, getShiftStyle, getTokenFromLS, renewToken, useAssetContext, useToken, useUTLSettingsContext, useUserContext };
|
|
10008
10315
|
//# sourceMappingURL=index.esm.js.map
|