logitude-dashboard-library 1.2.21 → 1.2.24
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/dist/assets/styles/dl-dashboard.scss +18 -1
- package/dist/features/Dashboard/dashboard-dialog/dashboard-dialog-component.d.ts +7 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +287 -12
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +288 -13
- package/dist/index.modern.js.map +1 -1
- package/dist/services/ApiServices.d.ts +10 -0
- package/dist/services/DashBoardService.d.ts +10 -0
- package/dist/services/DataService.d.ts +2 -0
- package/dist/services/session.d.ts +5 -0
- package/dist/services/tools.d.ts +3 -0
- package/dist/types/APIResult.d.ts +5 -0
- package/dist/types/Dashboard.d.ts +11 -0
- package/package.json +1 -1
|
@@ -25,7 +25,7 @@ $dark-grey: #717585;
|
|
|
25
25
|
|
|
26
26
|
.dl-dashboard-header {
|
|
27
27
|
display: flex;
|
|
28
|
-
|
|
28
|
+
flex-direction: row-reverse;
|
|
29
29
|
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -264,4 +264,21 @@ $dark-grey: #717585;
|
|
|
264
264
|
|
|
265
265
|
.hidden {
|
|
266
266
|
display: none;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.dl-dashboard-add{
|
|
270
|
+
height: 40px !important;
|
|
271
|
+
margin: 3px 3px 0px 8px !important;
|
|
272
|
+
width: 40px !important ;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.dl-card{
|
|
276
|
+
border-radius: 19px;
|
|
277
|
+
background-color: #f5f6fb;
|
|
278
|
+
padding: 6px 0px 0px 0px;
|
|
279
|
+
margin: 0px 0px 10px 0px;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.dl-m-t-s{
|
|
283
|
+
margin-top: 10px;
|
|
267
284
|
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -2,15 +2,16 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var React__default = _interopDefault(React);
|
|
5
|
+
var button = require('primereact/button');
|
|
5
6
|
var reactGridLayout = require('react-grid-layout');
|
|
6
7
|
var _ = _interopDefault(require('lodash'));
|
|
7
8
|
var dropdown = require('primereact/dropdown');
|
|
8
9
|
var dialog = require('primereact/dialog');
|
|
9
10
|
var inputtext = require('primereact/inputtext');
|
|
10
|
-
var button = require('primereact/button');
|
|
11
11
|
var axios = _interopDefault(require('axios'));
|
|
12
12
|
var ReactApexChart = _interopDefault(require('react-apexcharts'));
|
|
13
13
|
var overlaypanel = require('primereact/overlaypanel');
|
|
14
|
+
var inputtextarea = require('primereact/inputtextarea');
|
|
14
15
|
|
|
15
16
|
function _extends() {
|
|
16
17
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
@@ -44,14 +45,37 @@ function _setPrototypeOf(o, p) {
|
|
|
44
45
|
return _setPrototypeOf(o, p);
|
|
45
46
|
}
|
|
46
47
|
|
|
48
|
+
var Tools = /*#__PURE__*/function () {
|
|
49
|
+
function Tools() {}
|
|
50
|
+
|
|
51
|
+
Tools.GetLogitudeURL = function GetLogitudeURL() {
|
|
52
|
+
var logitude_url = location.href.replace('index.html', '');
|
|
53
|
+
|
|
54
|
+
if (location.href.indexOf('localhost') > -1) {
|
|
55
|
+
logitude_url = 'http://localhost:9996';
|
|
56
|
+
} else {
|
|
57
|
+
var urlArr = location.href.split("/index.html");
|
|
58
|
+
var url = urlArr[0];
|
|
59
|
+
url = url.replace(url.substring(url.lastIndexOf('/'), url.length), "");
|
|
60
|
+
logitude_url = url;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return logitude_url;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
return Tools;
|
|
67
|
+
}();
|
|
68
|
+
|
|
47
69
|
var DataService = /*#__PURE__*/function () {
|
|
48
|
-
function DataService() {
|
|
70
|
+
function DataService() {
|
|
71
|
+
this._apiUrl = Tools.GetLogitudeURL();
|
|
72
|
+
}
|
|
49
73
|
|
|
50
74
|
var _proto = DataService.prototype;
|
|
51
75
|
|
|
52
76
|
_proto.getObjectTables = function getObjectTables(filters) {
|
|
53
77
|
var token = this.getTokenFromStorage();
|
|
54
|
-
var apiURL =
|
|
78
|
+
var apiURL = this._apiUrl + "/api/ObjectTableViews/getbyfilters?";
|
|
55
79
|
apiURL = this.ConcatFiltersToURL(filters, apiURL);
|
|
56
80
|
return axios.get(apiURL, {
|
|
57
81
|
headers: {
|
|
@@ -63,7 +87,7 @@ var DataService = /*#__PURE__*/function () {
|
|
|
63
87
|
|
|
64
88
|
_proto.getObjectFields = function getObjectFields(filters) {
|
|
65
89
|
var token = this.getTokenFromStorage();
|
|
66
|
-
var apiURL =
|
|
90
|
+
var apiURL = this._apiUrl + "/api/ObjectFieldViews/getbyfilters?";
|
|
67
91
|
apiURL = this.ConcatFiltersToURL(filters, apiURL);
|
|
68
92
|
return axios.get(apiURL, {
|
|
69
93
|
headers: {
|
|
@@ -75,7 +99,7 @@ var DataService = /*#__PURE__*/function () {
|
|
|
75
99
|
|
|
76
100
|
_proto.getDataByFilters = function getDataByFilters(filters, tableName) {
|
|
77
101
|
var token = this.getTokenFromStorage();
|
|
78
|
-
var apiURL = "
|
|
102
|
+
var apiURL = this._apiUrl + "/api/" + tableName + "Views/getbyfilters?";
|
|
79
103
|
apiURL = this.ConcatFiltersToURL(filters, apiURL);
|
|
80
104
|
return axios.get(apiURL, {
|
|
81
105
|
headers: {
|
|
@@ -1067,9 +1091,7 @@ var DashboardDesigner = function DashboardDesigner() {
|
|
|
1067
1091
|
setWidgetToEdit = _useState13[1];
|
|
1068
1092
|
|
|
1069
1093
|
var renderPageHeader = function renderPageHeader() {
|
|
1070
|
-
return React__default.createElement("
|
|
1071
|
-
className: "dl-dashboard-header"
|
|
1072
|
-
}, React__default.createElement("div", {
|
|
1094
|
+
return React__default.createElement("div", {
|
|
1073
1095
|
className: "dl-heder-row"
|
|
1074
1096
|
}, React__default.createElement("div", {
|
|
1075
1097
|
style: {
|
|
@@ -1088,7 +1110,7 @@ var DashboardDesigner = function DashboardDesigner() {
|
|
|
1088
1110
|
return option === null || option === void 0 ? void 0 : option.Disabled;
|
|
1089
1111
|
},
|
|
1090
1112
|
scrollHeight: "300px"
|
|
1091
|
-
})))
|
|
1113
|
+
})));
|
|
1092
1114
|
};
|
|
1093
1115
|
|
|
1094
1116
|
function addComponent(componentType) {
|
|
@@ -1354,11 +1376,264 @@ var WidgetTypes = [{
|
|
|
1354
1376
|
Disabled: true
|
|
1355
1377
|
}];
|
|
1356
1378
|
|
|
1379
|
+
var ApiServices = /*#__PURE__*/function () {
|
|
1380
|
+
function ApiServices() {
|
|
1381
|
+
this._apiUrl = Tools.GetLogitudeURL();
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
var _proto = ApiServices.prototype;
|
|
1385
|
+
|
|
1386
|
+
_proto.getByFilters = function getByFilters(api, filters) {
|
|
1387
|
+
var token = this.getTokenFromStorage();
|
|
1388
|
+
var apiURL = "" + this._apiUrl + api;
|
|
1389
|
+
apiURL = this.ConcatFiltersToURL(filters, apiURL);
|
|
1390
|
+
return axios.get(apiURL, {
|
|
1391
|
+
headers: {
|
|
1392
|
+
'Content-Type': 'application/json',
|
|
1393
|
+
'Token': token
|
|
1394
|
+
}
|
|
1395
|
+
});
|
|
1396
|
+
};
|
|
1397
|
+
|
|
1398
|
+
_proto.post = function post(api, date) {
|
|
1399
|
+
var token = this.getTokenFromStorage();
|
|
1400
|
+
var apiURL = "" + this._apiUrl + api;
|
|
1401
|
+
return axios.post(apiURL, date, {
|
|
1402
|
+
headers: {
|
|
1403
|
+
'Content-Type': 'application/json',
|
|
1404
|
+
'Token': token
|
|
1405
|
+
}
|
|
1406
|
+
});
|
|
1407
|
+
};
|
|
1408
|
+
|
|
1409
|
+
_proto.getTokenFromStorage = function getTokenFromStorage() {
|
|
1410
|
+
return window.localStorage.getItem("token") || '';
|
|
1411
|
+
};
|
|
1412
|
+
|
|
1413
|
+
_proto.ConcatFiltersToURL = function ConcatFiltersToURL(filters, urlparameters) {
|
|
1414
|
+
var mykeys = Object.keys(filters);
|
|
1415
|
+
var addtionalFiltersValues = null;
|
|
1416
|
+
|
|
1417
|
+
for (var i in mykeys) {
|
|
1418
|
+
var propName = mykeys[i];
|
|
1419
|
+
var propValue = filters[propName];
|
|
1420
|
+
var ignoreFilter = propName.indexOf("Operator") > 0 && propValue == "Equals" || propName == "AdditionalFilters";
|
|
1421
|
+
|
|
1422
|
+
if (urlparameters != "?") {
|
|
1423
|
+
urlparameters = urlparameters.concat('&');
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
if (!ignoreFilter) {
|
|
1427
|
+
propValue = propValue ? encodeURIComponent(propValue) : '';
|
|
1428
|
+
urlparameters = urlparameters.concat(propName.concat('=').concat(propValue));
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
if (propName == "AdditionalFilters" && propValue.length > 0) {
|
|
1432
|
+
addtionalFiltersValues = JSON.stringify(propValue);
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1436
|
+
if (addtionalFiltersValues) {
|
|
1437
|
+
urlparameters = urlparameters.concat("&AdditionalFilters=").concat(addtionalFiltersValues);
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
return urlparameters;
|
|
1441
|
+
};
|
|
1442
|
+
|
|
1443
|
+
return ApiServices;
|
|
1444
|
+
}();
|
|
1445
|
+
|
|
1446
|
+
var DashBoardService = /*#__PURE__*/function () {
|
|
1447
|
+
function DashBoardService() {
|
|
1448
|
+
this.tableName = 'DashBoard';
|
|
1449
|
+
this._ApiServices = new ApiServices();
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
var _proto = DashBoardService.prototype;
|
|
1453
|
+
|
|
1454
|
+
_proto.getDataByFilters = function getDataByFilters(filters) {
|
|
1455
|
+
return this._ApiServices.getByFilters("/api/" + this.tableName + "Views/getbyfilters?", filters);
|
|
1456
|
+
};
|
|
1457
|
+
|
|
1458
|
+
_proto.add = function add(data) {
|
|
1459
|
+
return this._ApiServices.post("/api/DashBoards", data);
|
|
1460
|
+
};
|
|
1461
|
+
|
|
1462
|
+
return DashBoardService;
|
|
1463
|
+
}();
|
|
1464
|
+
|
|
1465
|
+
var Session = function Session() {};
|
|
1466
|
+
|
|
1467
|
+
var DashboardDialogComponent = function DashboardDialogComponent(props) {
|
|
1468
|
+
var _useState = React.useState(''),
|
|
1469
|
+
name = _useState[0],
|
|
1470
|
+
setName = _useState[1];
|
|
1471
|
+
|
|
1472
|
+
var _useState2 = React.useState(''),
|
|
1473
|
+
description = _useState2[0],
|
|
1474
|
+
setDescription = _useState2[1];
|
|
1475
|
+
|
|
1476
|
+
var _useState3 = React.useState(props.display),
|
|
1477
|
+
displayAddDashboard = _useState3[0],
|
|
1478
|
+
setDisplayAddDashboard = _useState3[1];
|
|
1479
|
+
|
|
1480
|
+
var _useState4 = React.useState({}),
|
|
1481
|
+
validation = _useState4[0],
|
|
1482
|
+
setValidation = _useState4[1];
|
|
1483
|
+
|
|
1484
|
+
React.useEffect(function () {
|
|
1485
|
+
setDisplayAddDashboard(props.display);
|
|
1486
|
+
}, [props.display]);
|
|
1487
|
+
|
|
1488
|
+
var onSave = function onSave() {
|
|
1489
|
+
if (!checkFormValidation()) return;
|
|
1490
|
+
var dashBoardService = new DashBoardService();
|
|
1491
|
+
var dasboard = {
|
|
1492
|
+
Name: name,
|
|
1493
|
+
Description: description,
|
|
1494
|
+
Tenant: Session.Tenant,
|
|
1495
|
+
UpdatedByUserId: Session.CurrentUserId,
|
|
1496
|
+
CreatedByUserId: Session.CurrentUserId
|
|
1497
|
+
};
|
|
1498
|
+
dashBoardService.add(dasboard).then(function (e) {
|
|
1499
|
+
onCancel();
|
|
1500
|
+
});
|
|
1501
|
+
};
|
|
1502
|
+
|
|
1503
|
+
var checkFormValidation = function checkFormValidation() {
|
|
1504
|
+
var isValid = true;
|
|
1505
|
+
var formValidation = {};
|
|
1506
|
+
|
|
1507
|
+
if ((name === null || name === void 0 ? void 0 : name.length) == 0) {
|
|
1508
|
+
formValidation['name'] = true;
|
|
1509
|
+
isValid = false;
|
|
1510
|
+
} else {
|
|
1511
|
+
formValidation['name'] = false;
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
console.log(formValidation['name']);
|
|
1515
|
+
setValidation(formValidation);
|
|
1516
|
+
return isValid;
|
|
1517
|
+
};
|
|
1518
|
+
|
|
1519
|
+
var onCancel = function onCancel() {
|
|
1520
|
+
setDisplayAddDashboard(false);
|
|
1521
|
+
props.onClose();
|
|
1522
|
+
clear();
|
|
1523
|
+
};
|
|
1524
|
+
|
|
1525
|
+
var clear = function clear() {
|
|
1526
|
+
setDescription('');
|
|
1527
|
+
setName('');
|
|
1528
|
+
};
|
|
1529
|
+
|
|
1530
|
+
return React__default.createElement(dialog.Dialog, {
|
|
1531
|
+
header: "New Dashboard",
|
|
1532
|
+
visible: displayAddDashboard,
|
|
1533
|
+
style: {
|
|
1534
|
+
width: 'auto'
|
|
1535
|
+
},
|
|
1536
|
+
onHide: onCancel
|
|
1537
|
+
}, React__default.createElement("form", {
|
|
1538
|
+
id: "dashboard-crd",
|
|
1539
|
+
name: "dashboard-crd"
|
|
1540
|
+
}, React__default.createElement("div", {
|
|
1541
|
+
className: "form"
|
|
1542
|
+
}, React__default.createElement("div", {
|
|
1543
|
+
className: "form-field"
|
|
1544
|
+
}, React__default.createElement("label", {
|
|
1545
|
+
htmlFor: "dashboard-name"
|
|
1546
|
+
}, "Name"), React__default.createElement(inputtext.InputText, {
|
|
1547
|
+
id: "dashboard-name",
|
|
1548
|
+
className: "p-inputtext-sm " + (validation['name'] ? 'p-invalid' : ''),
|
|
1549
|
+
value: name,
|
|
1550
|
+
required: true,
|
|
1551
|
+
onChange: function onChange(e) {
|
|
1552
|
+
setName(e.target.value);
|
|
1553
|
+
}
|
|
1554
|
+
})), React__default.createElement("div", {
|
|
1555
|
+
className: "form-field"
|
|
1556
|
+
}, React__default.createElement("label", {
|
|
1557
|
+
htmlFor: "dashboard-description"
|
|
1558
|
+
}, "Description"), React__default.createElement(inputtextarea.InputTextarea, {
|
|
1559
|
+
id: "dashboard-description",
|
|
1560
|
+
className: "p-inputtext-sm",
|
|
1561
|
+
value: description,
|
|
1562
|
+
onChange: function onChange(e) {
|
|
1563
|
+
setDescription(e.target.value);
|
|
1564
|
+
}
|
|
1565
|
+
}))), React__default.createElement("div", {
|
|
1566
|
+
className: "dialog-footer dl-m-t-s"
|
|
1567
|
+
}, React__default.createElement(button.Button, {
|
|
1568
|
+
label: "Cancel",
|
|
1569
|
+
className: "p-button-text",
|
|
1570
|
+
onClick: onCancel
|
|
1571
|
+
}), React__default.createElement(button.Button, {
|
|
1572
|
+
label: "Ok",
|
|
1573
|
+
form: "frm",
|
|
1574
|
+
onClick: onSave,
|
|
1575
|
+
autoFocus: true
|
|
1576
|
+
}))));
|
|
1577
|
+
};
|
|
1578
|
+
|
|
1357
1579
|
var Dashboard = function Dashboard(props) {
|
|
1358
|
-
|
|
1359
|
-
|
|
1580
|
+
var _props$token;
|
|
1581
|
+
|
|
1582
|
+
var _useState = React.useState([]),
|
|
1583
|
+
dashbords = _useState[0],
|
|
1584
|
+
setDashbords = _useState[1];
|
|
1585
|
+
|
|
1586
|
+
var _useState2 = React.useState(false),
|
|
1587
|
+
displayAddDashboard = _useState2[0],
|
|
1588
|
+
setDisplayAddDashboard = _useState2[1];
|
|
1589
|
+
|
|
1590
|
+
var dashboardService = new DashBoardService();
|
|
1591
|
+
React.useEffect(function () {
|
|
1592
|
+
getDashboards();
|
|
1593
|
+
}, []);
|
|
1594
|
+
Session.CurrentUserId = props.userId;
|
|
1595
|
+
Session.Tenant = props.tenant;
|
|
1596
|
+
Session.Token = props.token;
|
|
1597
|
+
if ((props === null || props === void 0 ? void 0 : (_props$token = props.token) === null || _props$token === void 0 ? void 0 : _props$token.length) > 0) localStorage.setItem("token", props === null || props === void 0 ? void 0 : props.token);
|
|
1598
|
+
|
|
1599
|
+
var onDashboardDialogClose = function onDashboardDialogClose() {
|
|
1600
|
+
getDashboards();
|
|
1601
|
+
setDisplayAddDashboard(false);
|
|
1602
|
+
};
|
|
1603
|
+
|
|
1604
|
+
var getDashboards = function getDashboards() {
|
|
1605
|
+
dashboardService.getDataByFilters(new ApiQueryFilters()).then(function (data) {
|
|
1606
|
+
console.log(data);
|
|
1607
|
+
setDashbords(data.data.Result);
|
|
1608
|
+
});
|
|
1609
|
+
};
|
|
1610
|
+
|
|
1611
|
+
return React.createElement("div", null, React.createElement("div", {
|
|
1612
|
+
className: 'dl-dashboard-header dl-card'
|
|
1613
|
+
}, React.createElement("div", null, React.createElement(button.Button, {
|
|
1614
|
+
icon: "pi pi-plus",
|
|
1615
|
+
onClick: function onClick() {
|
|
1616
|
+
return setDisplayAddDashboard(true);
|
|
1617
|
+
},
|
|
1618
|
+
className: "dl-dashboard-add p-button-rounded p-button-success",
|
|
1619
|
+
"aria-label": "Search"
|
|
1620
|
+
})), React.createElement(DashboardDialogComponent, {
|
|
1621
|
+
display: displayAddDashboard,
|
|
1622
|
+
onClose: onDashboardDialogClose
|
|
1623
|
+
}), React.createElement(dropdown.Dropdown, {
|
|
1624
|
+
value: [],
|
|
1625
|
+
options: dashbords,
|
|
1626
|
+
optionValue: "Id",
|
|
1627
|
+
optionLabel: "Name",
|
|
1628
|
+
onChange: function onChange(e) {},
|
|
1629
|
+
placeholder: "Choose Dashboard",
|
|
1630
|
+
optionDisabled: function optionDisabled(option) {
|
|
1631
|
+
return option === null || option === void 0 ? void 0 : option.Disabled;
|
|
1632
|
+
},
|
|
1633
|
+
scrollHeight: "300px"
|
|
1634
|
+
})), React.createElement("div", {
|
|
1360
1635
|
className: 'dl-dashboard-body'
|
|
1361
|
-
}, React.createElement(DashboardDesigner, null));
|
|
1636
|
+
}, React.createElement(DashboardDesigner, null)));
|
|
1362
1637
|
};
|
|
1363
1638
|
|
|
1364
1639
|
module.exports = Dashboard;
|