Workflows v0.1.13 🔀

This commit is contained in:
Jokob-sk
2024-02-05 20:51:00 +11:00
parent 6c5e0d4907
commit 02771cf399
4 changed files with 30 additions and 11 deletions

View File

@@ -57,10 +57,11 @@ function processData(data) {
{ data: 'DateTimeCreated', title: getString('AppEvents_DateTimeCreated') },
{ data: 'AppEventType', title: getString('AppEvents_Type') },
{ data: 'ObjectType', title: getString('AppEvents_ObjectType') },
{ data: 'ObjectMAC', title: getString('AppEvents_ObjectMAC') },
{ data: 'ObjectIP', title: getString('AppEvents_ObjectIP') },
{ data: 'ObjectPrimaryID', title: getString('AppEvents_ObjectPrimaryID') },
{ data: 'ObjectSecondaryID', title: getString('AppEvents_ObjectSecondaryID') },
{ data: 'ObjectStatus', title: getString('AppEvents_ObjectStatus') },
{ data: 'Extra', title: getString('AppEvents_Extra') },
{ data: 'ObjectPlugin', title: getString('AppEvents_Plugin') },
// Add other columns as needed
],
// Add column-specific configurations if needed
@@ -69,7 +70,7 @@ function processData(data) {
{ width: '80px', targets: [6] },
// ... Add other columnDefs as needed
// Full MAC
{targets: [3],
{targets: [3, 4],
'createdCell': function (td, cellData, rowData, row, col) {
if (!emptyArr.includes(cellData)){
$(td).html (createDeviceLink(cellData));

View File

@@ -429,9 +429,14 @@ function saveData(functionName, id, value) {
// -----------------------------------------------------------------------------
// create a link to the device
function createDeviceLink(mac)
function createDeviceLink(input)
{
return `<span class="anonymizeMac"><a href="/deviceDetails.php?mac=${mac}" target="_blank">${getNameByMacAddress(mac)}</a><span>`
if(checkMacOrInternet(input))
{
return `<span class="anonymizeMac"><a href="/deviceDetails.php?mac=${input}" target="_blank">${getNameByMacAddress(input)}</a><span>`
}
return input;
}
@@ -547,6 +552,22 @@ function getNameByMacAddress(macAddress) {
return getDeviceDataByMacAddress(macAddress, "dev_Name")
}
// -----------------------------------------------------------------------------
// Check if MAC or Internet
function checkMacOrInternet(inputStr) {
// Regular expression pattern for matching a MAC address
const macPattern = /^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/;
if (inputStr.toLowerCase() === 'internet') {
return true;
} else if (macPattern.test(inputStr)) {
return true;
} else {
return false;
}
}
// -----------------------------------------------------------------------------
// A function used to make the IP address orderable
function isValidIPv6(ipAddress) {

View File

@@ -7,8 +7,6 @@
"AppEvents_DateTimeCreated" : "Logged",
"AppEvents_ObjectType" : "Object Type",
"AppEvents_ObjectPlugin" : "Linked Plugin",
"AppEvents_ObjectMAC" : "Linked MAC (at log time)",
"AppEvents_ObjectIP" : "Linked IP (at log time)",
"AppEvents_ObjectPrimaryID" : "Primary ID",
"AppEvents_ObjectSecondaryID" : "Secondary ID",
"AppEvents_ObjectForeignKey" : "Foreign Key",
@@ -17,6 +15,7 @@
"AppEvents_ObjectIsArchived" : "Is archived (at log time)",
"AppEvents_ObjectStatusColumn" : "Status column",
"AppEvents_ObjectStatus" : "Status (at log time)",
"AppEvents_Plugin" : "Plugin",
"AppEvents_Type" : "Type",
"AppEvents_Helper1" : "Helper 1",
"AppEvents_Helper2" : "Helper 2",

View File

@@ -37,8 +37,6 @@ class AppEvent_obj:
"ObjectType" TEXT, -- ObjectType (Plugins, Notifications, Events)
"ObjectGUID" TEXT,
"ObjectPlugin" TEXT,
"ObjectMAC" TEXT,
"ObjectIP" TEXT,
"ObjectPrimaryID" TEXT,
"ObjectSecondaryID" TEXT,
"ObjectForeignKey" TEXT,
@@ -74,8 +72,8 @@ class AppEvent_obj:
"GUID",
"DateTimeCreated",
"ObjectType",
"ObjectMAC",
"ObjectIP",
"ObjectPrimaryID",
"ObjectSecondaryID",
"ObjectStatus",
"ObjectStatusColumn",
"ObjectIsNew",