* OLT ONT Mac-Adressen Anzeige
* Performancesteigerung Serviceports

Bugfixing:
* Kundenanzeige nun auch bei Datatables Link
* Uptime wird nun korrekt angezeigt
* Textuelle Korrekturen
This commit is contained in:
Spitzer_Daniel
2023-07-17 19:44:05 +02:00
parent 81ba7c633c
commit d3576ecafb
3 changed files with 140 additions and 46 deletions

View File

@@ -174,9 +174,7 @@ if ($devices->power != "0.0") {
} else {
$power = $devices->devicetype->power;
}
//var_dump($customer);
?>
<div class="row">
<div class="col-12">
<div class="card">
@@ -255,16 +253,13 @@ if ($devices->power != "0.0") {
href="http://maps.google.com/?q=' . $devices->addr_street . ' ' . $devices->addr_number . ' ' . $devices->addr_zip . ' ' . $devices->addr_city . '"
target="_blank"><div>' . $devices->addr_street . ' ' . $devices->addr_number . $addrExtended . '</div>
<div>' . $devices->addr_zip . ' ' . $devices->addr_city . '</div></a>';
} else if (trim($devices->gps_lat)) {
$StdHeader = "Standort Informationen";
$mapsHeader = "Koordinaten";
$mapsLink = '<a class="mapsLink"
href="http://maps.google.com/?q=' . $devices->gps_lat . ',' . $devices->gps_long . '"
target="_blank"><div>' . $devices->gps_lat . ' , ' . $devices->gps_long . '</div></a>';
}
?>
<div class="col-4 card-border">
@@ -326,12 +321,9 @@ if ($devices->power != "0.0") {
} else {
?>
<h5 class="text-center">Keine Standort Informationen vorhanden</h5>
<?php
}
?>
</div>
<div class="col-3 card-border">
<div class="overflow-auto">
@@ -356,7 +348,6 @@ if ($devices->power != "0.0") {
<tr>
<th>Datum/Uhrzeit</th>
<th></th>
</tr>
</thead>
<tbody>
@@ -366,8 +357,7 @@ if ($devices->power != "0.0") {
$configid = $config->id;
if ($configfileCleartext && $configfileCompressed) :
$configLinks = '<a href="https://' . $_SERVER['SERVER_NAME'] . '/Device/api?do=getconfig&id=' . $configid . '&format=txt&filename=' . $configfileCleartext . '">
TXT</a> / <a
href="https://' . $_SERVER['SERVER_NAME'] . '/Device/api?do=getconfig&id=' . $configid . '&format=xml&filename=' . $configfileCompressed . '">
TXT</a> / <a href="https://' . $_SERVER['SERVER_NAME'] . '/Device/api?do=getconfig&id=' . $configid . '&format=xml&filename=' . $configfileCompressed . '">
XML</a>';
elseif ($configfileCleartext || $configfileCompressed) :
$configLinks = '<a href="https://' . $_SERVER['SERVER_NAME'] . '/Device/api?do=getconfig&id=' . $configid . '&format=txt&filename=' . $configfileCleartext . $configfileCompressed . '">
@@ -411,8 +401,6 @@ if ($devices->power != "0.0") {
</div>
<div id="olt-body"></div>
</div>
<div id="olt-datatables" class="col-5 card-border" style="display: none">
<div>
<h4></h4>
@@ -427,8 +415,6 @@ if ($devices->power != "0.0") {
<th>Kunde</th>
<th class="text-center">Stat.</th>
<th class="text-center">Serial</th>
</tr>
<tr id="filterrow">
<th></th>
@@ -462,7 +448,7 @@ if ($devices->power != "0.0") {
<div class="col-6">
<h4>Allgemein<span class="ml-2"><i id="ont-deteil-spinner"
<h4>Allgemein<span class="ml-2"><i id="ont-detail-spinner"
class="fas fa-spinner fa-spin spinner-ico font-19 text-info"
style="display: none;"></i></span>
<span id="ont-detail-refresh" style="width: 20px;"
@@ -509,10 +495,6 @@ if ($devices->power != "0.0") {
/ <span class="ont-line-stat"
id="ont-detail-ontsoftwarever">N/A</span></td>
</tr>
<!-- <tr>-->
<!-- <th>Temperatur</th>-->
<!-- <td class="text-right pr-3" ><span id="ont-detail-temp">N/A</span> °C</td>-->
<!-- </tr>-->
<tr>
<th>RX-Pegel OLT</th>
<td class="text-right pr-3"><span class="ont-line-stat"
@@ -594,6 +576,21 @@ if ($devices->power != "0.0") {
</tr>
</tbody>
</table>
<h4>MAC-Adressen<span class="ml-2"><i id="ont-detail-mac-spinner"
class="fas fa-spinner fa-spin spinner-ico font-19 text-info"
style="display: none;"></i></span>
<span id="ont-detail-mac-refresh" style="width: 20px;"
class="ontdetail-refresh-span"><i style="display: unset"
title="Refresh"
class="fa-solid fa-rotate-right "></i></span>
</h4>
<table class="table condensed-ont">
<thead id="ont-macadresses-head">
</thead>
<tbody id="ont-macadresses">
</tbody>
</table>
<h4>Service Ports</h4>
<table class="table condensed-ont">
<thead>
@@ -603,8 +600,6 @@ if ($devices->power != "0.0") {
<th>Status</th>
<th>Downstream</th>
<th>Upstream</th>
</tr>
</thead>
<tbody id="ont-serviceports">
@@ -737,7 +732,7 @@ if ($devices->power != "0.0") {
<td class="sp-ont-text">` + customername + `</td>
<td class="sp-ont-text text-center">` + status + `</td>
<td class="sp-ont-text"><div class="text-decoration-underline" data-port="` + item['portsimple'] + `" data-ontid="` + o + `" data-portid="` + item['portindex'] + `" data-toggle="modal" data-target="#ontDetailInfo">` + ont['serial'] + `</div></td>
<td class="sp-ont-text"><div class="text-decoration-underline" data-port="` + item['portsimple'] + `" data-ontid="` + o + `" data-portid="` + item['portindex'] + `" data-snr="` + ont['serial'] + `" data-toggle="modal" data-target="#ontDetailInfo">` + ont['serial'] + `</div></td>
</tr>
`);
@@ -837,8 +832,10 @@ if ($devices->power != "0.0") {
table.draw();
}
}).fail(function (jqxhr, textStatus, error) {
window.location.href = "Dashboard";
console.log("Request Failed: " + err);
});
;
});
@@ -897,9 +894,7 @@ if ($devices->power != "0.0") {
$(this).html('<i class="fas fa-spinner fa-spin spinner-ico text-info"></i>');
$(this).data('shown', '1');
var oltport = $(this).data('oltport');
// $('#olt-body').append(`<div class="spinner-border text-primary float-right" role="status">
// <span class="visually-hidden"></span>
// </div>`);
$('#olt-body').append(`<table style="display:none;" id="ont-line-table" data-oltport="` + $(this).data('oltport') + `" class="float-left">` + $('#olt-port-table').html() + `</table>`);
$("#ont-line-table .sp-port-lines").each(function (index) {
@@ -908,27 +903,30 @@ if ($devices->power != "0.0") {
}
});
$('#olt-body').append(` <table id="ont-table" data-portid="` + thisspan.data('portid') + `" style="text-align: center; display:none ; min-height: 500px;" class="sp-table-border float-left" >
<thead>
<tr><td><span class="ml-5">ONT's </span><span style="width: 20px;" class="float-right mr-4 ont-refresh-span "><i title="Refresh" class="fa-solid fa-rotate-right ont-refresh" ></i></span></td></tr>
</thead>
<tbody style="font-size:13px;" id="ont-table-body"><tr>
<tbody style="font-size:13px;" id="ont-table-body">
<tr>
<th class="sp-ont-text">ONT ID</th>
<th class="sp-ont-text" title="Online Status">Stat.</th>
<th class="sp-ont-text">Type</th>
<th class="sp-ont-text">Serial</th>
<th class="sp-ont-text">Distance</th>
<!-- <th class="sp-ont-text">RX OLT Power</th>-->
<th class="sp-ont-text">Eth</th>
<th class="sp-ont-text">Eth Spd/Dpx</th>
</tr></tbody></table>`);
</tr>
</tbody></table>`);
$.getJSON("https://<?= $_SERVER['SERVER_NAME']; ?>/Device/api?do=getoltinfo&ip=<?= $devices->ip; ?>&portid=" + thisspan.data('portid'), {})
.done(function (data) {
if (typeof data.success === 'undefined') {
console.log('logged out');
// window.location.href = "/";
}
$.each(data.data[0]['ont'], function (o, ont) {
var status;
if (ont.status == "1") {
@@ -966,6 +964,12 @@ if ($devices->power != "0.0") {
}).done(function (data) {
$.getJSON("https://<?= $_SERVER['SERVER_NAME']; ?>/Device/api?do=getoltinfo&ip=<?= $devices->ip; ?>&portid=" + thisspan.data('portid') + "&adv=ext", {}).done(function (data) {
if (typeof data.success === 'undefined') {
console.log('logged out');
// window.location.href = "/";
}
if (thisspan.data('portid') == $('#ont-table').data('portid')) {
$.each(data.data, function (o, ont) {
var eth = ont['eth'];
@@ -996,6 +1000,9 @@ if ($devices->power != "0.0") {
});
}).fail(function (jqxhr, textStatus, error) {
window.location.href = "Dashboard";
console.log("Request Failed: " + err);
});
}
});
@@ -1004,6 +1011,8 @@ if ($devices->power != "0.0") {
$('.ont-refresh-span').html('<i class="fas fa-spinner fa-spin spinner-ico text-info"></i>');
$('.sp-splitter-count-show').addClass('noclick');
$.getJSON("https://<?= $_SERVER['SERVER_NAME']; ?>/Device/api?do=getoltinfo&ip=<?= $devices->ip; ?>&portid=" + thisspan.data('portid') + "&adv=ext", {}).done(function (data) {
if (thisspan.data('portid') == $('#ont-table').data('portid')) {
$.each(data.data, function (o, ont) {
var eth = ont['eth'];
@@ -1033,7 +1042,11 @@ if ($devices->power != "0.0") {
$('.ont-refresh-span').html('<i title="Refresh" class="fa-solid fa-rotate-right ont-refresh"></i>');
$('.ont-refresh').show();
$('.sp-splitter-count-show').removeClass('noclick');
}).fail(function (jqxhr, textStatus, error) {
window.location.href = "Dashboard";
console.log("Request Failed: " + err);
});
;
});
@@ -1054,19 +1067,23 @@ if ($devices->power != "0.0") {
customername = "N/A";
customerid = "N/A";
}
$('#ont-macadresses').empty();
$('.ont-line-stat').text('N/A');
$('#ont-detail-kd').text(customername);
$('#ont-detail-lastofflinecause').attr('data-original-title', '');
$('#ont-deteil-spinner').show();
$('#ont-detail-spinner').show();
$('#ont-detail-refresh').hide();
$('#ont-serviceports').empty();
$('#ont-detail-refresh').data('portid', button.data('portid'));
$('#ont-detail-refresh').data('port', button.data('port'));
$('#ont-detail-refresh').data('ontid', button.data('ontid'));
$('#ont-detail-refresh').data('snr', button.data('snr'));
$('#ont-detail-mac-refresh').data('snr', button.data('snr'));
$('#ont-detail-mac-refresh').data('portid', button.data('portid'));
$('#ont-detail-mac-refresh').data('port', button.data('port'));
$('#ont-detail-mac-refresh').data('ontid', button.data('ontid'));
$('#ont-detail-mac-refresh').data('snr', button.data('snr'));
$.getJSON("https://<?= $_SERVER['SERVER_NAME']; ?>/Device/api?do=getontinfo&ip=<?= $devices->ip; ?>&portid=" + button.data('portid') + "&ont=" + button.data('port') + '-' + button.data('ontid'), {}).done(function (data) {
$.each(data.data.linestat, function (o, ont) {
@@ -1105,12 +1122,51 @@ if ($devices->power != "0.0") {
});
}
$('#ont-deteil-spinner').hide();
$('#ont-detail-spinner').hide();
$('#ont-detail-refresh').show();
}).fail(function (jqxhr, textStatus, error) {
window.location.href = "Dashboard";
console.log("Request Failed: " + err);
});
;
});
$("body").on("click", "#ont-detail-mac-refresh", function () {
$('#ont-detail-mac-spinner').show();
$('#ont-detail-mac-refresh').hide();
var button = $('#ont-detail-mac-refresh');
$('#ont-macadresses').empty();
$('#ont-macadresses-nomac').remove();
$.getJSON("https://<?= $_SERVER['SERVER_NAME']; ?>/Device/api?do=getontinfomac&ip=<?= $devices->ip; ?>&portid=" + button.data('portid') + "&ont=" + button.data('port') + '-' + button.data('ontid'), {}).done(function (data) {
if (typeof data.data !== 'undefined' && data.data.length > 0) {
$('#ont-macadresses').html(`
<tr>
<th>Mac</th>
<th>Vlan</th>
</tr>
`);
$.each(data.data, function (o, mac) {
$('#ont-macadresses').append(`<tr>
<td>` + mac.mac + `</td>
<td>` + mac.vlan + `</td>
</tr>`);
});
} else {
$('#ont-macadresses').append(`<tr>
<td id="ont-macadresses-nomac" class="text-center" colspan="2">Keine Mac-Adressen verfügbar</td>
</tr>`);
}
$('#ont-detail-mac-spinner').hide();
$('#ont-detail-mac-refresh').show();
}).fail(function (jqxhr, textStatus, error) {
window.location.href = "Dashboard";
});
;
});
$("body").on("click", "#ont-detail-refresh", function () {
let customername;
let customerid;
@@ -1131,8 +1187,8 @@ if ($devices->power != "0.0") {
$('.ont-line-stat').text('N/A');
$('#ont-detail-kd').text(customername);
$('#ont-detail-lastofflinecause').attr('data-original-title', '');
$('#ont-deteil-spinner').show();
$('#ont-macadresses').empty();
$('#ont-detail-spinner').show();
$('#ont-detail-refresh').hide();
$('#ont-serviceports').empty();
$('#ont-detail-refresh').data('portid', button.data('portid'));
@@ -1169,21 +1225,19 @@ if ($devices->power != "0.0") {
<td class="text-center">` + operstatus + `</td>
<td class="text-center">` + ont.traficdescrx + `</td>
<td class="text-center">` + ont.traficdesctx + `</td>
</tr>
`)
});
}
$('#ont-deteil-spinner').hide();
$('#ont-detail-spinner').hide();
$('#ont-detail-refresh').show();
}).fail(function (jqxhr, textStatus, error) {
window.location.href = "Dashboard";
});
;
});
$('[data-toggle="tooltip"]').tooltip()
});
</script>

View File

@@ -251,6 +251,9 @@ class DeviceController extends mfBaseController
case "getontinfo":
$return = $this->getontInfo($ip, $portid, $ont);
break;
case "getontinfomac":
$return = $this->getontInfoMac($ip, $portid, $ont);
break;
case "changeoltsplitter":
$return = $this->changeoltSplitter($id, $portid, $ports);
break;
@@ -325,6 +328,16 @@ class DeviceController extends mfBaseController
$r = $this->request;
$id = $r->id;
$getOntInfo = DeviceModel::getontInfo($ip, $portid, $ont);
echo json_encode($getOntInfo);
exit;
}
private function getontInfoMac($ip, $portid, $ont)
{
$r = $this->request;
$id = $r->id;
$getOntInfo = DeviceModel::getontInfoMac($ip, $portid, $ont);
echo json_encode($getOntInfo);
exit;
}

View File

@@ -320,7 +320,34 @@ WHERE `item_id` = '55'";
endif;
return json_decode($response);
}
public static function getontInfoMac($ip, $portid = '', $ont = '')
{
$portid = "/" . $portid;
$ont = "/mac/" . $ont;
$url = TT_MBI_API_URL . TT_MBI_API_VERSION . '/deviceoltinfo/' . $ip . $portid . $ont;
$response = "";
if (TT_MBI_API_ENABLE) :
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer ' . TT_MBI_API_KEY),
));
$response = curl_exec($curl);
curl_close($curl);
endif;
return json_decode($response);
}
public static function changeoltSplitter($id, $portid, $ports)
{