Software /
code /
prosody
Changeset
11917:d27b74b25105
mod_admin_shell: Return counts of shown vs total from new table views
Not exactly the way it was before, but close enough and useful.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 16 Nov 2021 16:06:41 +0100 |
parents | 11916:5dae9262f81f |
children | 11918:2dc3bc5e137a |
files | plugins/mod_admin_shell.lua |
diffstat | 1 files changed, 17 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_admin_shell.lua Tue Nov 16 16:03:23 2021 +0100 +++ b/plugins/mod_admin_shell.lua Tue Nov 16 16:06:41 2021 +0100 @@ -851,7 +851,11 @@ if not group_by_host then print(row()); end local currenthost = nil; - for _, session in ipairs(get_c2s():filter(match):sort(_sort_by_jid)) do + local c2s_sessions = get_c2s(); + local total_count = #c2s_sessions; + c2s_sessions:filter(match):sort(_sort_by_jid); + local shown_count = #c2s_sessions; + for _, session in ipairs(c2s_sessions) do if group_by_host and session.host ~= currenthost then currenthost = session.host; print("#",prosody.hosts[currenthost] or "Unknown host"); @@ -860,7 +864,10 @@ print(row(session)); end - return true; + if total_count ~= shown_count then + return true, ("%d out of %d c2s sessions shown"):format(shown_count, total_count); + end + return true, ("%d c2s sessions shown"):format(total_count); end function def_env.c2s:show_tls(match_jid) @@ -927,7 +934,10 @@ if not group_by_host then print(row()); end - local s2s_sessions = array(iterators.values(module:shared"/*/s2s/sessions")):filter(match):sort(_sort_s2s); + local s2s_sessions = array(iterators.values(module:shared"/*/s2s/sessions")); + local total_count = #s2s_sessions; + s2s_sessions:filter(match):sort(_sort_s2s); + local shown_count = #s2s_sessions; for _, session in ipairs(s2s_sessions) do if group_by_host and currenthost ~= get_s2s_hosts(session) then @@ -938,7 +948,10 @@ print(row(session)); end - return true; -- TODO counts + if total_count ~= shown_count then + return true, ("%d out of %d s2s connections shown"):format(shown_count, total_count); + end + return true, ("%d s2s connections shown"):format(total_count); end function def_env.s2s:show_tls(match_jid)