mirror of
https://github.com/craigerl/aprsd.git
synced 2024-10-31 15:07:13 -04:00
Added threads table in the admin web ui
This commit is contained in:
parent
66e4850353
commit
c6079f897d
@ -113,6 +113,32 @@ function update_plugins( data ) {
|
|||||||
plugindiv.append(html_str);
|
plugindiv.append(html_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function update_threads( data ) {
|
||||||
|
stats = data["stats"];
|
||||||
|
if (stats.hasOwnProperty("APRSDThreadList") == false) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var threadsdiv = $("#threadsDiv");
|
||||||
|
var html_str = '<table class="ui celled striped table"><thead><tr>'
|
||||||
|
html_str += '<th>Thread Name</th><th>Alive?</th>'
|
||||||
|
html_str += '<th>Age</th><th>Loop Count</th>'
|
||||||
|
html_str += '</tr></thead><tbody>'
|
||||||
|
threadsdiv.html('')
|
||||||
|
|
||||||
|
var threads = stats["APRSDThreadList"];
|
||||||
|
var keys = Object.keys(threads);
|
||||||
|
keys.sort();
|
||||||
|
for (var i=0; i<keys.length; i++) { // now lets iterate in sort order
|
||||||
|
var key = keys[i];
|
||||||
|
var val = threads[key];
|
||||||
|
html_str += '<tr><td class="collapsing">' + key + '</td>';
|
||||||
|
html_str += '<td>' + val["alive"] + '</td><td>' + val["age"] + '</td>';
|
||||||
|
html_str += '<td>' + val["loop_count"] + '</td></tr>';
|
||||||
|
}
|
||||||
|
html_str += "</tbody></table>";
|
||||||
|
threadsdiv.append(html_str);
|
||||||
|
}
|
||||||
|
|
||||||
function update_packets( data ) {
|
function update_packets( data ) {
|
||||||
var packetsdiv = $("#packetsDiv");
|
var packetsdiv = $("#packetsDiv");
|
||||||
//nuke the contents first, then add to it.
|
//nuke the contents first, then add to it.
|
||||||
@ -179,6 +205,7 @@ function start_update() {
|
|||||||
update_watchlist(data);
|
update_watchlist(data);
|
||||||
update_seenlist(data);
|
update_seenlist(data);
|
||||||
update_plugins(data);
|
update_plugins(data);
|
||||||
|
update_threads(data);
|
||||||
},
|
},
|
||||||
complete: function() {
|
complete: function() {
|
||||||
setTimeout(statsworker, 10000);
|
setTimeout(statsworker, 10000);
|
||||||
|
@ -81,6 +81,7 @@
|
|||||||
<div class="item" data-tab="seen-tab">Seen List</div>
|
<div class="item" data-tab="seen-tab">Seen List</div>
|
||||||
<div class="item" data-tab="watch-tab">Watch List</div>
|
<div class="item" data-tab="watch-tab">Watch List</div>
|
||||||
<div class="item" data-tab="plugin-tab">Plugins</div>
|
<div class="item" data-tab="plugin-tab">Plugins</div>
|
||||||
|
<div class="item" data-tab="threads-tab">Threads</div>
|
||||||
<div class="item" data-tab="config-tab">Config</div>
|
<div class="item" data-tab="config-tab">Config</div>
|
||||||
<div class="item" data-tab="log-tab">LogFile</div>
|
<div class="item" data-tab="log-tab">LogFile</div>
|
||||||
<!-- <div class="item" data-tab="oslo-tab">OSLO CONFIG</div> //-->
|
<!-- <div class="item" data-tab="oslo-tab">OSLO CONFIG</div> //-->
|
||||||
@ -155,6 +156,13 @@
|
|||||||
<div id="pluginDiv" class="ui mini text">Loading</div>
|
<div id="pluginDiv" class="ui mini text">Loading</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="ui bottom attached tab segment" data-tab="threads-tab">
|
||||||
|
<h3 class="ui dividing header">
|
||||||
|
Threads Loaded (<span id="thread_count">{{ thread_count }}</span>)
|
||||||
|
</h3>
|
||||||
|
<div id="threadsDiv" class="ui mini text">Loading</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="ui bottom attached tab segment" data-tab="config-tab">
|
<div class="ui bottom attached tab segment" data-tab="config-tab">
|
||||||
<h3 class="ui dividing header">Config</h3>
|
<h3 class="ui dividing header">Config</h3>
|
||||||
<pre id="configjson" class="language-json">{{ config_json|safe }}</pre>
|
<pre id="configjson" class="language-json">{{ config_json|safe }}</pre>
|
||||||
|
@ -70,12 +70,17 @@ def index():
|
|||||||
pm = plugin.PluginManager()
|
pm = plugin.PluginManager()
|
||||||
plugins = pm.get_plugins()
|
plugins = pm.get_plugins()
|
||||||
plugin_count = len(plugins)
|
plugin_count = len(plugins)
|
||||||
|
client_stats = stats["stats"].get("APRSClientStats", {})
|
||||||
|
|
||||||
if CONF.aprs_network.enabled:
|
if CONF.aprs_network.enabled:
|
||||||
transport = "aprs-is"
|
transport = "aprs-is"
|
||||||
|
if client_stats:
|
||||||
|
aprs_connection = client_stats.get("server_string", "")
|
||||||
|
else:
|
||||||
|
aprs_connection = "APRS-IS"
|
||||||
aprs_connection = (
|
aprs_connection = (
|
||||||
"APRS-IS Server: <a href='http://status.aprs2.net' >"
|
"APRS-IS Server: <a href='http://status.aprs2.net' >"
|
||||||
"{}</a>".format(stats["stats"]["APRSClientStats"]["server_string"])
|
"{}</a>".format(aprs_connection)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
# We might be connected to a KISS socket?
|
# We might be connected to a KISS socket?
|
||||||
@ -96,10 +101,17 @@ def index():
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if client_stats:
|
||||||
stats["stats"]["APRSClientStats"]["transport"] = transport
|
stats["stats"]["APRSClientStats"]["transport"] = transport
|
||||||
stats["stats"]["APRSClientStats"]["aprs_connection"] = aprs_connection
|
stats["stats"]["APRSClientStats"]["aprs_connection"] = aprs_connection
|
||||||
entries = conf.conf_to_dict()
|
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(
|
return flask.render_template(
|
||||||
"index.html",
|
"index.html",
|
||||||
initial_stats=json.dumps(stats, cls=aprsd_json.SimpleJSONEncoder),
|
initial_stats=json.dumps(stats, cls=aprsd_json.SimpleJSONEncoder),
|
||||||
@ -111,6 +123,7 @@ def index():
|
|||||||
sort_keys=True, default=str,
|
sort_keys=True, default=str,
|
||||||
),
|
),
|
||||||
plugin_count=plugin_count,
|
plugin_count=plugin_count,
|
||||||
|
thread_count=thread_count,
|
||||||
# oslo_out=generate_oslo()
|
# oslo_out=generate_oslo()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user