]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blobdiff - js/unrealircd-admin.js
Log view: don't redraw when fetching 1000 log entries.
[irc/unrealircd/unrealircd-webpanel.git] / js / unrealircd-admin.js
index 4aa5fa1427968421120b733d512d18b706878ccb..635cba40e9b9e48b0870d13f0bc0552b799b4407 100644 (file)
@@ -63,6 +63,8 @@ function toggle_checkbox(source) {
     }
 }
 
+/* Popup notifications */
+
 function generate_notif(title, body)
 {
     /* generate a random number between 1000 and 90000 to use as an id */
@@ -128,10 +130,43 @@ function StreamNotifs(e)
     msg = data.msg;
     generate_notif(title, msg);
 }
+
 function StartStreamNotifs(url)
 {
     if (!!window.EventSource) {
         var source = new EventSource(url);
         source.addEventListener('message', StreamNotifs, false);
     }
-}
\ No newline at end of file
+}
+
+/* Log streamer */
+function NewLogEntry(e)
+{
+    var data;
+    try {
+        data = JSON.parse(e.data);
+    } catch(e) {
+        return;
+    }
+
+    if (data.sync_option != "sync_now")
+    {
+        data_list_table.row.add({
+            'Time':data.timestamp,
+            'Level':data.level,
+            'Subsystem':data.subsystem,
+            'Event':data.event_id,
+            'Message':data.msg});
+        if (data.sync_option == "no_sync")
+            return;
+    }
+    data_list_table.draw(true);
+    data_list_table.rows().invalidate();
+    data_list_table.searchPanes.rebuildPane();
+}
+
+function StartLogStream(url)
+{
+    var source = new EventSource(url);
+    source.addEventListener('message', NewLogEntry, false);
+}