mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-03-30 23:03:03 -07:00
BE+FE: better VLAN/SSID handling
Signed-off-by: jokob-sk <jokob.sk@gmail.com>
This commit is contained in:
23
front/lib/treeviz/treeviz.iife.js
Normal file
23
front/lib/treeviz/treeviz.iife.js
Normal file
File diff suppressed because one or more lines are too long
0
front/lib/treeviz/bundle.js → front/lib/treeviz/treeviz.iife.old.js
Executable file → Normal file
0
front/lib/treeviz/bundle.js → front/lib/treeviz/treeviz.iife.old.js
Executable file → Normal file
@@ -69,7 +69,8 @@
|
|||||||
require 'php/templates/footer.php';
|
require 'php/templates/footer.php';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<script src="lib/treeviz/bundle.js"></script>
|
<!-- <script src="lib/treeviz/bundle.js"></script> -->
|
||||||
|
<script src="lib/treeviz/treeviz.iife.js"></script>
|
||||||
|
|
||||||
<script defer>
|
<script defer>
|
||||||
|
|
||||||
@@ -388,7 +389,7 @@
|
|||||||
const normalized_mac = node_mac.toLowerCase();
|
const normalized_mac = node_mac.toLowerCase();
|
||||||
|
|
||||||
const sql = `
|
const sql = `
|
||||||
SELECT devName, devMac, devLastIP, devVendor, devPresentLastScan, devAlertDown, devParentPort,
|
SELECT devName, devMac, devLastIP, devVendor, devPresentLastScan, devAlertDown, devParentPort, devVlan,
|
||||||
CASE
|
CASE
|
||||||
WHEN devIsNew = 1 THEN 'New'
|
WHEN devIsNew = 1 THEN 'New'
|
||||||
WHEN devPresentLastScan = 1 THEN 'On-line'
|
WHEN devPresentLastScan = 1 THEN 'On-line'
|
||||||
@@ -588,6 +589,8 @@ function getChildren(node, list, path, visited = [])
|
|||||||
parentNodesCount++;
|
parentNodesCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// console.log(node);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: node.devName,
|
name: node.devName,
|
||||||
path: path,
|
path: path,
|
||||||
@@ -607,6 +610,7 @@ function getChildren(node, list, path, visited = [])
|
|||||||
alertDown: node.devAlertDown,
|
alertDown: node.devAlertDown,
|
||||||
hasChildren: children.length > 0 || hiddenMacs.includes(node.devMac),
|
hasChildren: children.length > 0 || hiddenMacs.includes(node.devMac),
|
||||||
relType: node.devParentRelType,
|
relType: node.devParentRelType,
|
||||||
|
devVlan: node.devVlan,
|
||||||
hiddenChildren: hiddenMacs.includes(node.devMac),
|
hiddenChildren: hiddenMacs.includes(node.devMac),
|
||||||
qty: children.length,
|
qty: children.length,
|
||||||
children: children
|
children: children
|
||||||
@@ -883,6 +887,16 @@ function initTree(myHierarchy)
|
|||||||
idKey: "mac",
|
idKey: "mac",
|
||||||
hasFlatData: false,
|
hasFlatData: false,
|
||||||
relationnalField: "children",
|
relationnalField: "children",
|
||||||
|
linkLabel: {
|
||||||
|
render: (parent, child) => {
|
||||||
|
// Return text or HTML to display on the connection line
|
||||||
|
return child.data.devVlan ?? "";
|
||||||
|
// or with HTML:
|
||||||
|
// return "<tspan><strong>reports to</strong></tspan>";
|
||||||
|
},
|
||||||
|
color: "#336c87ff", // Label text color (optional)
|
||||||
|
fontSize: 11 // Label font size in px (optional)
|
||||||
|
},
|
||||||
linkWidth: (nodeData) => 2,
|
linkWidth: (nodeData) => 2,
|
||||||
linkColor: (nodeData) => {
|
linkColor: (nodeData) => {
|
||||||
relConf = getRelationshipConf(nodeData.data.relType)
|
relConf = getRelationshipConf(nodeData.data.relType)
|
||||||
|
|||||||
@@ -1520,14 +1520,23 @@
|
|||||||
"dataType": "string",
|
"dataType": "string",
|
||||||
"elements": [
|
"elements": [
|
||||||
{
|
{
|
||||||
"elementType": "input",
|
"elementType": "select",
|
||||||
"elementOptions": [],
|
"elementOptions": [],
|
||||||
"transformers": []
|
"transformers": []
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"default_value": "",
|
"default_value": "",
|
||||||
"options": [],
|
"options": [
|
||||||
|
"{value}"
|
||||||
|
],
|
||||||
|
"options_params": [
|
||||||
|
{
|
||||||
|
"name": "value",
|
||||||
|
"type": "sql",
|
||||||
|
"value": "SELECT DISTINCT '' as id, '❌None' as name UNION SELECT devSSID as id, devSSID as name FROM (SELECT devSSID FROM Devices) AS all_devices ORDER BY id;"
|
||||||
|
}
|
||||||
|
],
|
||||||
"localized": [
|
"localized": [
|
||||||
"name",
|
"name",
|
||||||
"description"
|
"description"
|
||||||
@@ -1594,7 +1603,7 @@
|
|||||||
"dataType": "string",
|
"dataType": "string",
|
||||||
"elements": [
|
"elements": [
|
||||||
{
|
{
|
||||||
"elementType": "input",
|
"elementType": "select",
|
||||||
"elementOptions": [],
|
"elementOptions": [],
|
||||||
"transformers": []
|
"transformers": []
|
||||||
}
|
}
|
||||||
@@ -1602,7 +1611,16 @@
|
|||||||
},
|
},
|
||||||
"maxLength": 50,
|
"maxLength": 50,
|
||||||
"default_value": "",
|
"default_value": "",
|
||||||
"options": [],
|
"options": [
|
||||||
|
"{value}"
|
||||||
|
],
|
||||||
|
"options_params": [
|
||||||
|
{
|
||||||
|
"name": "value",
|
||||||
|
"type": "sql",
|
||||||
|
"value": "SELECT DISTINCT '' as id, '❌None' as name UNION SELECT devVlan as id, devVlan as name FROM (SELECT devVlan FROM Devices) AS all_devices ORDER BY id;"
|
||||||
|
}
|
||||||
|
],
|
||||||
"localized": [
|
"localized": [
|
||||||
"name",
|
"name",
|
||||||
"description"
|
"description"
|
||||||
|
|||||||
Reference in New Issue
Block a user