diff --git a/aprsd/web/admin/static/js/main.js b/aprsd/web/admin/static/js/main.js index f448a2a..f202e90 100644 --- a/aprsd/web/admin/static/js/main.js +++ b/aprsd/web/admin/static/js/main.js @@ -113,6 +113,32 @@ function update_plugins( data ) { plugindiv.append(html_str); } +function update_threads( data ) { + stats = data["stats"]; + if (stats.hasOwnProperty("APRSDThreadList") == false) { + return + } + var threadsdiv = $("#threadsDiv"); + var html_str = '
Thread Name | Alive? | ' + html_str += 'Age | Loop Count | ' + html_str += '' + key + ' | '; + html_str += '' + val["alive"] + ' | ' + val["age"] + ' | '; + html_str += '' + val["loop_count"] + ' | '; + } + html_str += "
---|
{{ config_json|safe }}diff --git a/aprsd/wsgi.py b/aprsd/wsgi.py index 487a5e4..28fc02e 100644 --- a/aprsd/wsgi.py +++ b/aprsd/wsgi.py @@ -70,12 +70,17 @@ def index(): pm = plugin.PluginManager() plugins = pm.get_plugins() plugin_count = len(plugins) + client_stats = stats["stats"].get("APRSClientStats", {}) if CONF.aprs_network.enabled: transport = "aprs-is" + if client_stats: + aprs_connection = client_stats.get("server_string", "") + else: + aprs_connection = "APRS-IS" aprs_connection = ( "APRS-IS Server: " - "{}".format(stats["stats"]["APRSClientStats"]["server_string"]) + "{}".format(aprs_connection) ) else: # We might be connected to a KISS socket? @@ -96,10 +101,17 @@ def index(): ) ) - stats["stats"]["APRSClientStats"]["transport"] = transport - stats["stats"]["APRSClientStats"]["aprs_connection"] = aprs_connection + if client_stats: + stats["stats"]["APRSClientStats"]["transport"] = transport + stats["stats"]["APRSClientStats"]["aprs_connection"] = aprs_connection entries = conf.conf_to_dict() + thread_info = stats["stats"].get("APRSDThreadList", {}) + if thread_info: + thread_count = len(thread_info) + else: + thread_count = "unknown" + return flask.render_template( "index.html", initial_stats=json.dumps(stats, cls=aprsd_json.SimpleJSONEncoder), @@ -111,6 +123,7 @@ def index(): sort_keys=True, default=str, ), plugin_count=plugin_count, + thread_count=thread_count, # oslo_out=generate_oslo() )