1
0
mirror of https://github.com/craigerl/aprsd.git synced 2024-12-21 09:01:23 -05:00

Fixes for webchat UI.

Fixed a few issues with webchat UI.  When sending a message,
make sure the recipient tab is selected after sending.
Also, don't reset the path selection after sending a message.
This commit is contained in:
Hemna 2024-11-18 14:29:32 -05:00
parent 257fa0db7d
commit f0b99564d1
2 changed files with 22 additions and 11 deletions

View File

@ -126,10 +126,14 @@ class APRSISClient(base.APRSClient):
return aprs_client
def consumer(self, callback, blocking=False, immortal=False, raw=False):
try:
self._client.consumer(
callback, blocking=blocking,
immortal=immortal, raw=raw,
)
except Exception as e:
LOG.error(f"Exception in consumer: {e}")
if self._client:
try:
self._client.consumer(
callback, blocking=blocking,
immortal=immortal, raw=raw,
)
except Exception as e:
LOG.error(e)
LOG.info(e.__cause__)
else:
LOG.warning("client is None, might be resetting.")

View File

@ -101,7 +101,7 @@ function init_chat() {
$("#sendform").submit(function(event) {
event.preventDefault();
to_call = $('#to_call').val();
to_call = $('#to_call').val().toUpperCase();
message = $('#message').val();
path = $('#pkt_path option:selected').val();
if (to_call == "") {
@ -116,6 +116,8 @@ function init_chat() {
//console.log(msg);
socket.emit("send", msg);
$('#message').val('');
callsign_select(to_call);
activate_callsign_tab(to_call);
}
});
@ -418,7 +420,7 @@ function append_message(callsign, msg, msg_html) {
// Find the right div to place the html
new_callsign = add_callsign(callsign, msg);
update_callsign_path(callsign, msg);
//update_callsign_path(callsign, msg);
append_message_html(callsign, msg_html, new_callsign);
len = Object.keys(callsign_list).length;
if (new_callsign && len == 1) {
@ -565,16 +567,21 @@ function ack_msg(msg) {
scroll_main_content();
}
function activate_callsign_tab(callsign) {
tab_content = tab_string(callsign, id=true);
$(tab_content).click();
}
function callsign_select(callsign) {
var tocall = $("#to_call");
tocall.val(callsign);
tocall.val(callsign.toUpperCase());
scroll_main_content(callsign);
selected_tab_callsign = callsign;
tab_notify_id = tab_notification_id(callsign, true);
$(tab_notify_id).addClass('visually-hidden');
$(tab_notify_id).text(0);
// Now update the path
$('#pkt_path').val(callsign_list[callsign]);
// $('#pkt_path').val(callsign_list[callsign]);
}
function call_callsign_location(callsign) {