-
-
OLT/ONT Informationen
-
+
+
+
OLT/ONT Informationen
+
+
+
+
Serviceports von
+
+
+
@@ -992,6 +1003,26 @@ foreach ($devicesall as $deviceall) {
table.draw();
}
+ const apiUrl = "= self::getUrl('Device', 'api', ['do' => 'deviceoltserviceporttimestamp', 'ip' => $devices->ip]) ?>";
+
+ // Funktion, die die Daten holt und ins DOM schreibt
+ function updateTimestamp() {
+ $.getJSON(apiUrl)
+ .done(function(data) {
+ $('#olt-serviceports').text('(' + data.data.timestamp + ')');
+ })
+ .fail(function(jqxhr, textStatus, error) {
+ console.error('Error fetching timestamp:', textStatus, error);
+ });
+ }
+
+ // Erstaufruf direkt beim Laden der Seite
+ updateTimestamp();
+
+ // Dann alle 30 000 ms (30 Sekunden) wiederholen
+ setInterval(updateTimestamp, 10000);
+
+
}).fail(function (jqxhr, textStatus, error) {
window.location.href = "Dashboard";
console.log("Request Failed: " + err);
@@ -1037,6 +1068,25 @@ foreach ($devicesall as $deviceall) {
});
+ $("body").on("click", ".ont-serviceport-refresh", function () {
+ if ($(this).hasClass('noclick')) {
+ return;
+ }
+ $('.ont-serviceport-refresh').addClass('noclick');
+ $('.ont-serviceport-refresh-span').html('
');
+
+ $.getJSON("= self::getUrl("Device", "api", ['do' => 'deviceoltserviceportrefresh', 'ip' => $devices->ip]) ?>", {})
+ .done(function (data) {
+ setTimeout(function () {
+ $('.spinner-border').remove();
+ $('.ont-serviceport-refresh').removeClass('noclick');
+ $('.ont-serviceport-refresh-span').html(
+ '
'
+ );
+ }, 8000);
+ });
+
+ });
$("body").on("click", ".sp-splitter-count-show", function () {
if ($(this).hasClass('noclick')) {
return;
diff --git a/application/Device/DeviceController.php b/application/Device/DeviceController.php
index a2abb53c6..7c467bfdd 100644
--- a/application/Device/DeviceController.php
+++ b/application/Device/DeviceController.php
@@ -337,6 +337,12 @@ class DeviceController extends mfBaseController
case "changeoltsplitter":
$this->changeoltSplitter($id, $portid, $ports);
break;
+ case "deviceoltserviceporttimestamp":
+ $this->deviceoltserviceporttimestamp($ip);
+ break;
+ case "deviceoltserviceportrefresh":
+ $this->deviceoltserviceportrefresh($ip);
+ break;
default:
$return = false;
}
@@ -423,6 +429,21 @@ class DeviceController extends mfBaseController
exit;
}
+
+ private function deviceoltserviceporttimestamp($ip)
+ {
+ $deviceoltserviceporttimestamp = DeviceModel::deviceoltserviceporttimestamp($ip);
+ echo json_encode($deviceoltserviceporttimestamp);
+ exit;
+ }
+
+ private function deviceoltserviceportrefresh($ip)
+ {
+ $deviceoltserviceportrefresh = DeviceModel::deviceoltserviceportrefresh($ip);
+ echo json_encode($deviceoltserviceportrefresh);
+ exit;
+ }
+
private function getontInfoMac($ip, $portid, $ont)
{
$r = $this->request;
diff --git a/application/Device/DeviceModel.php b/application/Device/DeviceModel.php
index ae42e8d63..a17769c61 100644
--- a/application/Device/DeviceModel.php
+++ b/application/Device/DeviceModel.php
@@ -337,6 +337,60 @@ class DeviceModel
endif;
return json_decode($response);
}
+ public static function deviceoltserviceporttimestamp($ip)
+ {
+
+ $url = TT_MBI_API_URL . TT_MBI_API_VERSION . '/deviceoltserviceporttimestamp/' . $ip;
+
+ $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 deviceoltserviceportrefresh($ip)
+ {
+
+ $url = TT_MBI_API_URL . TT_MBI_API_VERSION . '/deviceoltserviceportrefresh/' . $ip;
+
+ $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)
{