Compare commits

...

4 Commits

Author SHA1 Message Date
Hemna 2e9cf3ce88 Fixed scrolling problem with new webchat sent msg
The Webchat ui was failing to scroll properly upon sending
a new message from a tab that had a lot of messages already.
2024-04-09 10:07:12 -04:00
Hemna 8728926bf4 Fix some issues with listen command
The listen command had some older references to some of the
thread modules.  this patch fixes those.
2024-04-09 09:58:59 -04:00
Hemna 2c5bc6c1f7 Admin interface catch empty stats
This patch adds checks in the admin js to ensure that the
specific stats aren't empty before trying to dereference.
2024-04-09 07:46:06 -04:00
Hemna 80705cb341 Ensure StatsStore has empty data
This patch ensures that the StatsStore object has a default
empty dict for data.
2024-04-09 06:59:22 -04:00
4 changed files with 17 additions and 7 deletions

View File

@ -19,7 +19,8 @@ from aprsd import cli_helper, client, packets, plugin, threads
from aprsd.main import cli from aprsd.main import cli
from aprsd.packets import log as packet_log from aprsd.packets import log as packet_log
from aprsd.stats import collector from aprsd.stats import collector
from aprsd.threads import rx from aprsd.threads import keep_alive, rx
from aprsd.threads import stats as stats_thread
# setup the global logger # setup the global logger
@ -190,7 +191,7 @@ def listen(
LOG.debug(f"Filter by '{filter}'") LOG.debug(f"Filter by '{filter}'")
aprs_client.set_filter(filter) aprs_client.set_filter(filter)
keepalive = threads.KeepAliveThread() keepalive = keep_alive.KeepAliveThread()
# keepalive.start() # keepalive.start()
pm = None pm = None
@ -203,8 +204,8 @@ def listen(
"Not Loading any plugins use --load-plugins to load what's " "Not Loading any plugins use --load-plugins to load what's "
"defined in the config file.", "defined in the config file.",
) )
stats_thread = threads.APRSDStatsStoreThread() stats = stats_thread.APRSDStatsStoreThread()
stats_thread.start() stats.start()
LOG.debug("Create APRSDListenThread") LOG.debug("Create APRSDListenThread")
listen_thread = APRSDListenThread( listen_thread = APRSDListenThread(
@ -220,4 +221,4 @@ def listen(
keepalive.join() keepalive.join()
LOG.debug("listen_thread Join") LOG.debug("listen_thread Join")
listen_thread.join() listen_thread.join()
stats_thread.join() stats.join()

View File

@ -16,6 +16,7 @@ LOG = logging.getLogger("APRSD")
class StatsStore(objectstore.ObjectStoreMixin): class StatsStore(objectstore.ObjectStoreMixin):
"""Container to save the stats from the collector.""" """Container to save the stats from the collector."""
lock = threading.Lock() lock = threading.Lock()
data = {}
class APRSDStatsStoreThread(APRSDThread): class APRSDStatsStoreThread(APRSDThread):

View File

@ -26,6 +26,9 @@ function ord(str){return str.charCodeAt(0);}
function update_watchlist( data ) { function update_watchlist( data ) {
// Update the watch list // Update the watch list
stats = data["stats"]; stats = data["stats"];
if (stats.hasOwnProperty("WatchList") == false) {
return
}
var watchdiv = $("#watchDiv"); var watchdiv = $("#watchDiv");
var html_str = '<table class="ui celled striped table"><thead><tr><th>HAM Callsign</th><th>Age since last seen by APRSD</th></tr></thead><tbody>' var html_str = '<table class="ui celled striped table"><thead><tr><th>HAM Callsign</th><th>Age since last seen by APRSD</th></tr></thead><tbody>'
watchdiv.html('') watchdiv.html('')
@ -62,6 +65,9 @@ function update_watchlist_from_packet(callsign, val) {
function update_seenlist( data ) { function update_seenlist( data ) {
stats = data["stats"]; stats = data["stats"];
if (stats.hasOwnProperty("SeenList") == false) {
return
}
var seendiv = $("#seenDiv"); var seendiv = $("#seenDiv");
var html_str = '<table class="ui celled striped table">' var html_str = '<table class="ui celled striped table">'
html_str += '<thead><tr><th>HAM Callsign</th><th>Age since last seen by APRSD</th>' html_str += '<thead><tr><th>HAM Callsign</th><th>Age since last seen by APRSD</th>'
@ -82,6 +88,9 @@ function update_seenlist( data ) {
function update_plugins( data ) { function update_plugins( data ) {
stats = data["stats"]; stats = data["stats"];
if (stats.hasOwnProperty("PluginManager") == false) {
return
}
var plugindiv = $("#pluginDiv"); var plugindiv = $("#pluginDiv");
var html_str = '<table class="ui celled striped table"><thead><tr>' var html_str = '<table class="ui celled striped table"><thead><tr>'
html_str += '<th>Plugin Name</th><th>Plugin Enabled?</th>' html_str += '<th>Plugin Name</th><th>Plugin Enabled?</th>'

View File

@ -413,7 +413,6 @@ function append_message(callsign, msg, msg_html) {
} }
// Find the right div to place the html // Find the right div to place the html
new_callsign = add_callsign(callsign, msg); new_callsign = add_callsign(callsign, msg);
update_callsign_path(callsign, msg); update_callsign_path(callsign, msg);
append_message_html(callsign, msg_html, new_callsign); append_message_html(callsign, msg_html, new_callsign);
@ -502,7 +501,7 @@ function sent_msg(msg) {
msg_html = create_message_html(d, t, msg['from_call'], msg['to_call'], msg['message_text'], ack_id, msg, false); msg_html = create_message_html(d, t, msg['from_call'], msg['to_call'], msg['message_text'], ack_id, msg, false);
append_message(msg['to_call'], msg, msg_html); append_message(msg['to_call'], msg, msg_html);
save_data(); save_data();
scroll_main_content(msg['from_call']); scroll_main_content(msg['to_call']);
} }
function from_msg(msg) { function from_msg(msg) {