Network fixes 🚑
This commit is contained in:
@@ -206,7 +206,10 @@ function getString (key) {
|
|||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Modal dialog handling
|
// Modal dialog handling
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
function showModalOk (title, message, callbackFunction = null) {
|
function showModalOK (title, message, callbackFunction) {
|
||||||
|
showModalOk (title, message, callbackFunction)
|
||||||
|
}
|
||||||
|
function showModalOk (title, message, callbackFunction) {
|
||||||
// set captions
|
// set captions
|
||||||
$('#modal-ok-title').html (title);
|
$('#modal-ok-title').html (title);
|
||||||
$('#modal-ok-message').html (message);
|
$('#modal-ok-message').html (message);
|
||||||
@@ -222,6 +225,8 @@ function showModalOk (title, message, callbackFunction = null) {
|
|||||||
// Show modal
|
// Show modal
|
||||||
$('#modal-ok').modal('show');
|
$('#modal-ok').modal('show');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
function showModalDefault (title, message, btnCancel, btnOK, callbackFunction) {
|
function showModalDefault (title, message, btnCancel, btnOK, callbackFunction) {
|
||||||
// set captions
|
// set captions
|
||||||
$('#modal-default-title').html (title);
|
$('#modal-default-title').html (title);
|
||||||
@@ -253,13 +258,17 @@ function showModalDefaultStrParam (title, message, btnCancel, btnOK, callbackFun
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
function showModalWarning (title, message, btnCancel, btnOK, callbackFunction) {
|
function showModalWarning (title, message, btnCancel=getString('Gen_Cancel'), btnOK=getString('Gen_Okay'), callbackFunction=null) {
|
||||||
// set captions
|
// set captions
|
||||||
$('#modal-warning-title').html (title);
|
$('#modal-warning-title').html (title);
|
||||||
$('#modal-warning-message').html (message);
|
$('#modal-warning-message').html (message);
|
||||||
$('#modal-warning-cancel').html (btnCancel);
|
$('#modal-warning-cancel').html (btnCancel);
|
||||||
$('#modal-warning-OK').html (btnOK);
|
$('#modal-warning-OK').html (btnOK);
|
||||||
|
|
||||||
|
if ( callbackFunction != null)
|
||||||
|
{
|
||||||
modalCallbackFunction = callbackFunction;
|
modalCallbackFunction = callbackFunction;
|
||||||
|
}
|
||||||
|
|
||||||
// Show modal
|
// Show modal
|
||||||
$('#modal-warning').modal('show');
|
$('#modal-warning').modal('show');
|
||||||
|
|||||||
@@ -458,6 +458,13 @@
|
|||||||
|
|
||||||
rawData = JSON.parse (data)
|
rawData = JSON.parse (data)
|
||||||
|
|
||||||
|
if(rawData["data"] == "")
|
||||||
|
{
|
||||||
|
showModalOK (getString('Gen_Warning'), getString('Network_NoDevices'))
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
devicesListnew = rawData["data"].map(item => { return {
|
devicesListnew = rawData["data"].map(item => { return {
|
||||||
"name":item[0],
|
"name":item[0],
|
||||||
"type":item[2],
|
"type":item[2],
|
||||||
@@ -612,13 +619,25 @@
|
|||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
var myTree;
|
var myTree;
|
||||||
var treeAreaHeight = 800;
|
var visibleTreeArea = $(window).height()-135;
|
||||||
|
var treeAreaHeight = visibleTreeArea > 800 ? 800 : visibleTreeArea;
|
||||||
var emSize;
|
var emSize;
|
||||||
var nodeHeight;
|
var nodeHeight;
|
||||||
var sizeCoefficient = 1
|
var sizeCoefficient = 1
|
||||||
|
|
||||||
function initTree(myHierarchy)
|
function initTree(myHierarchy)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
console.log(myHierarchy)
|
||||||
|
|
||||||
|
|
||||||
|
if(myHierarchy.type == "")
|
||||||
|
{
|
||||||
|
showModalOk(getString('Network_Configuration_Error'), getString('Network_Root_Not_Configured'))
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// calculate the font size of the leaf nodes to fit everything into the tree area
|
// calculate the font size of the leaf nodes to fit everything into the tree area
|
||||||
leafNodesCount == 0 ? 1 : leafNodesCount;
|
leafNodesCount == 0 ? 1 : leafNodesCount;
|
||||||
emSize = ((treeAreaHeight/(25*leafNodesCount)).toFixed(2));
|
emSize = ((treeAreaHeight/(25*leafNodesCount)).toFixed(2));
|
||||||
|
|||||||
@@ -22,6 +22,8 @@
|
|||||||
"AppEvents_Helper2" : "Helper 2",
|
"AppEvents_Helper2" : "Helper 2",
|
||||||
"AppEvents_Helper3" : "Helper 3",
|
"AppEvents_Helper3" : "Helper 3",
|
||||||
"AppEvents_Extra" : "Extra",
|
"AppEvents_Extra" : "Extra",
|
||||||
|
"Gen_Error" : "Error",
|
||||||
|
"Gen_Warning" : "Warning",
|
||||||
"Gen_Delete" : "Delete",
|
"Gen_Delete" : "Delete",
|
||||||
"Gen_DeleteAll" : "Delete all",
|
"Gen_DeleteAll" : "Delete all",
|
||||||
"Gen_Cancel" : "Cancel",
|
"Gen_Cancel" : "Cancel",
|
||||||
@@ -428,6 +430,9 @@
|
|||||||
"Network_Node_Name" : "Node name",
|
"Network_Node_Name" : "Node name",
|
||||||
"Network_Parent" : "Parent network device",
|
"Network_Parent" : "Parent network device",
|
||||||
"Network_Cant_Assign" : "Can't assign the root Internet node as a child leaf node.",
|
"Network_Cant_Assign" : "Can't assign the root Internet node as a child leaf node.",
|
||||||
|
"Network_NoDevices" : "Configuration Error",
|
||||||
|
"Network_Configuration_Error" : "Configuration Error",
|
||||||
|
"Network_Root_Not_Configured" : "Select a network device type, for example a <b>Gateway</b>, in the <b>Type</b> field of the <a href=\"deviceDetails.php?mac=Internet\">the Internet root device</a> to start configuring this screen. <br/><br/> More documentation can be found in the <a href=\"https://github.com/jokob-sk/Pi.Alert/blob/main/docs/NETWORK_TREE.md\" target=\"_blank\">How to setup your Network page</a> guide",
|
||||||
"Network_NoAssignedDevices" : "This network node does not have any assigned devices (leaf nodes). Assign one from bellow or go to the <b><i class=\"fa fa-info-circle\"></i> Details</b> tab of any device in <a href=\"devices.php\"><b> <i class=\"fa fa-laptop\"></i> Devices</b></a>, and assign it to a network <b><i class=\"fa fa-server\"></i> Node (MAC)</b> and <b><i class=\"fa fa-ethernet\"></i> Port</b> there.",
|
"Network_NoAssignedDevices" : "This network node does not have any assigned devices (leaf nodes). Assign one from bellow or go to the <b><i class=\"fa fa-info-circle\"></i> Details</b> tab of any device in <a href=\"devices.php\"><b> <i class=\"fa fa-laptop\"></i> Devices</b></a>, and assign it to a network <b><i class=\"fa fa-server\"></i> Node (MAC)</b> and <b><i class=\"fa fa-ethernet\"></i> Port</b> there.",
|
||||||
"Network_Root_Unconfigurable": "Unconfigurable root",
|
"Network_Root_Unconfigurable": "Unconfigurable root",
|
||||||
"HelpFAQ_Title" : "Help / FAQ",
|
"HelpFAQ_Title" : "Help / FAQ",
|
||||||
|
|||||||
Reference in New Issue
Block a user