mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
devParentNodeMac chips in devices list
This commit is contained in:
@@ -1489,7 +1489,7 @@ input[readonly] {
|
||||
}
|
||||
|
||||
#tableDevicesBox td svg, #tableDevicesBox td i{
|
||||
height: 1.5em !important;
|
||||
height: 1em !important;
|
||||
}
|
||||
|
||||
#TileCards .tile .inner
|
||||
@@ -1649,6 +1649,23 @@ input[readonly] {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.custom-badge a
|
||||
{
|
||||
color: #fff !important;
|
||||
font-size: 14px;
|
||||
}
|
||||
.custom-badge
|
||||
{
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 4px;
|
||||
border-style: solid;
|
||||
margin-right: 5px;
|
||||
margin-top: 5px;
|
||||
padding: 0 5px;
|
||||
font-size: 14px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
#deviceDetailsEdit .form-control
|
||||
{
|
||||
min-height: 42px;
|
||||
|
||||
@@ -503,36 +503,36 @@ function collectFilters() {
|
||||
function mapColumnIndexToFieldName(index, tableColumnVisible) {
|
||||
// the order is important, don't change it!
|
||||
const columnNames = [
|
||||
"devName",
|
||||
"devOwner",
|
||||
"devType",
|
||||
"devIcon",
|
||||
"devFavorite",
|
||||
"devGroup",
|
||||
"devFirstConnection",
|
||||
"devLastConnection",
|
||||
"devLastIP",
|
||||
"devIsRandomMac", // resolved on the fly
|
||||
"devStatus", // resolved on the fly
|
||||
"devMac",
|
||||
"devIpLong", //formatIPlong(device.devLastIP) || "", // IP orderable
|
||||
"rowid",
|
||||
"devParentMAC",
|
||||
"devParentChildrenCount", // resolved on the fly
|
||||
"devLocation",
|
||||
"devVendor",
|
||||
"devParentPort",
|
||||
"devGUID",
|
||||
"devSyncHubNode",
|
||||
"devSite",
|
||||
"devSSID",
|
||||
"devSourcePlugin",
|
||||
"devPresentLastScan",
|
||||
"devAlertDown",
|
||||
"devCustomProps",
|
||||
"devFQDN",
|
||||
"devParentRelType",
|
||||
"devReqNicsOnline"
|
||||
"devName", // 0
|
||||
"devOwner", // 1
|
||||
"devType", // 2
|
||||
"devIcon", // 3
|
||||
"devFavorite", // 4
|
||||
"devGroup", // 5
|
||||
"devFirstConnection", // 6
|
||||
"devLastConnection", // 7
|
||||
"devLastIP", // 8
|
||||
"devIsRandomMac", // 9 resolved on the fly
|
||||
"devStatus", // 10 resolved on the fly
|
||||
"devMac", // 11
|
||||
"devIpLong", // 12 formatIPlong(device.devLastIP) || "", // IP orderable
|
||||
"rowid", // 13
|
||||
"devParentMAC", // 14
|
||||
"devParentChildrenCount", // 15 resolved on the fly
|
||||
"devLocation", // 16
|
||||
"devVendor", // 17
|
||||
"devParentPort", // 18
|
||||
"devGUID", // 19
|
||||
"devSyncHubNode", // 20
|
||||
"devSite", // 21
|
||||
"devSSID", // 22
|
||||
"devSourcePlugin", // 23
|
||||
"devPresentLastScan", // 24
|
||||
"devAlertDown", // 25
|
||||
"devCustomProps", // 26
|
||||
"devFQDN", // 27
|
||||
"devParentRelType", // 28
|
||||
"devReqNicsOnline" // 29
|
||||
];
|
||||
|
||||
// console.log("OrderBy: " + columnNames[tableColumnOrder[index]]);
|
||||
@@ -899,6 +899,28 @@ function initializeDatatable (status) {
|
||||
}
|
||||
} },
|
||||
|
||||
// Parent Mac
|
||||
{targets: [mapIndx(14)],
|
||||
'createdCell': function (td, cellData, rowData, row, col) {
|
||||
if (!cellData) {
|
||||
$(td).html('');
|
||||
return;
|
||||
}
|
||||
|
||||
const data = {
|
||||
id: cellData, // MAC address
|
||||
text: cellData // Optional display text (you could use a name or something else)
|
||||
};
|
||||
|
||||
spanWrap = $(`<span class="custom-badge text-white"></span>`)
|
||||
|
||||
$(td).html(spanWrap);
|
||||
|
||||
const chipHtml = renderDeviceLink(data, spanWrap, true); // pass the td as container
|
||||
|
||||
$(spanWrap).append(chipHtml);
|
||||
}
|
||||
},
|
||||
// Status color
|
||||
{targets: [mapIndx(10)],
|
||||
'createdCell': function (td, cellData, rowData, row, col) {
|
||||
|
||||
@@ -715,45 +715,7 @@ function initSelect2() {
|
||||
{
|
||||
var selectEl = $(this).select2({
|
||||
templateSelection: function (data, container) {
|
||||
if (!data.id) return data.text; // default for placeholder etc.
|
||||
|
||||
const device = getDevDataByMac(data.id);
|
||||
|
||||
const badge = getStatusBadgeParts(
|
||||
device.devPresentLastScan,
|
||||
device.devAlertDown,
|
||||
device.devMac
|
||||
)
|
||||
|
||||
$(container).addClass(badge.cssClass);
|
||||
|
||||
// Custom HTML
|
||||
const html = $(`
|
||||
<a href="${badge.url}" target="_blank">
|
||||
<span class="custom-chip hover-node-info"
|
||||
data-name="${device.devName}"
|
||||
data-ip="${device.devLastIP}"
|
||||
data-mac="${device.devMac}"
|
||||
data-vendor="${device.devVendor}"
|
||||
data-type="${device.devType}"
|
||||
data-lastseen="${device.devLastConnection}"
|
||||
data-firstseen="${device.devFirstConnection}"
|
||||
data-relationship="${device.devParentRelType}"
|
||||
data-status="${device.devStatus}"
|
||||
data-present="${device.devPresentLastScan}"
|
||||
data-alert="${device.devAlertDown}"
|
||||
data-icon="${device.devIcon}"
|
||||
>
|
||||
<span class="iconPreview">${atob(device.devIcon)}</span>
|
||||
${data.text}
|
||||
<span>
|
||||
(${badge.iconHtml})
|
||||
</span
|
||||
</span>
|
||||
</a>
|
||||
`);
|
||||
|
||||
return html;
|
||||
return $(renderDeviceLink(data, container));
|
||||
},
|
||||
escapeMarkup: function (m) {
|
||||
return m; // Allow HTML
|
||||
@@ -817,6 +779,48 @@ function initSelect2() {
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------
|
||||
// Render a device link with hover-over functionality
|
||||
function renderDeviceLink(data, container, useName=false) {
|
||||
if (!data.id) return data.text; // default placeholder etc.
|
||||
|
||||
const device = getDevDataByMac(data.id);
|
||||
|
||||
const badge = getStatusBadgeParts(
|
||||
device.devPresentLastScan,
|
||||
device.devAlertDown,
|
||||
device.devMac
|
||||
);
|
||||
|
||||
$(container).addClass(badge.cssClass);
|
||||
|
||||
return `
|
||||
<a href="${badge.url}" target="_blank">
|
||||
<span class="custom-chip hover-node-info"
|
||||
data-name="${device.devName}"
|
||||
data-ip="${device.devLastIP}"
|
||||
data-mac="${device.devMac}"
|
||||
data-vendor="${device.devVendor}"
|
||||
data-type="${device.devType}"
|
||||
data-lastseen="${device.devLastConnection}"
|
||||
data-firstseen="${device.devFirstConnection}"
|
||||
data-relationship="${device.devParentRelType}"
|
||||
data-status="${device.devStatus}"
|
||||
data-present="${device.devPresentLastScan}"
|
||||
data-alert="${device.devAlertDown}"
|
||||
data-icon="${device.devIcon}"
|
||||
>
|
||||
<span class="iconPreview">${atob(device.devIcon)}</span>
|
||||
${useName ? device.devName : data.text}
|
||||
<span>
|
||||
(${badge.iconHtml})
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
`;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------
|
||||
// Display device info on hover (attach only once)
|
||||
function initHoverNodeInfo() {
|
||||
|
||||
@@ -264,8 +264,6 @@ function fetchUsedIps(callback) {
|
||||
function renderAvailableIpsTable(allIps, usedIps) {
|
||||
const availableIps = allIps.filter(row => !usedIps.includes(row.ip));
|
||||
|
||||
console.log(allIps);
|
||||
console.log(usedIps);
|
||||
console.log(availableIps);
|
||||
|
||||
$('#availableIpsTable').DataTable({
|
||||
|
||||
Reference in New Issue
Block a user