Fix backfill page missing partitioned table stats, fix contacts map init
Backfill page now sums child partition stats for partitioned tables like hrrr_profiles (relkind 'p') which were excluded by the relkind 'r' filter. Contacts map defers Leaflet init to requestAnimationFrame so the flex container has dimensions before map initialization.
This commit is contained in:
parent
4e37b0eeca
commit
18e920fe54
2 changed files with 28 additions and 8 deletions
|
|
@ -34,6 +34,18 @@ export const ContactsMap = {
|
|||
this.lineLayer = L.layerGroup()
|
||||
this.dotLayer = L.layerGroup()
|
||||
|
||||
// Listen for filter changes from LiveView
|
||||
this.handleEvent("apply_filter", ({enabled_bands, callsign}) => {
|
||||
this.enabledBands = new Set(enabled_bands)
|
||||
this.callsignFilter = (callsign || "").toUpperCase()
|
||||
this.rebuildMap()
|
||||
})
|
||||
|
||||
// Defer map init until container has dimensions
|
||||
requestAnimationFrame(() => this.initMap())
|
||||
},
|
||||
|
||||
initMap() {
|
||||
this.map = L.map(this.el, {
|
||||
center: [37.5, -96],
|
||||
zoom: 5,
|
||||
|
|
@ -53,13 +65,6 @@ export const ContactsMap = {
|
|||
// Enable all bands initially
|
||||
for (const c of this.allContacts) this.enabledBands.add(c[4])
|
||||
|
||||
// Listen for filter changes from LiveView
|
||||
this.handleEvent("apply_filter", ({enabled_bands, callsign}) => {
|
||||
this.enabledBands = new Set(enabled_bands)
|
||||
this.callsignFilter = (callsign || "").toUpperCase()
|
||||
this.rebuildMap()
|
||||
})
|
||||
|
||||
this.rebuildMap()
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -185,6 +185,7 @@ defmodule MicrowavepropWeb.BackfillLive do
|
|||
end
|
||||
|
||||
defp fetch_db_stats do
|
||||
# Regular tables + partitioned tables (summing child partition stats)
|
||||
%{rows: rows} =
|
||||
Repo.query!("""
|
||||
SELECT
|
||||
|
|
@ -199,7 +200,21 @@ defmodule MicrowavepropWeb.BackfillLive do
|
|||
AND c.relkind = 'r'
|
||||
AND c.relname NOT LIKE 'oban_%'
|
||||
AND c.relname NOT LIKE 'schema_%'
|
||||
ORDER BY pg_total_relation_size(c.oid) DESC
|
||||
AND NOT EXISTS (SELECT 1 FROM pg_inherits WHERE inhrelid = c.oid)
|
||||
UNION ALL
|
||||
SELECT
|
||||
parent.relname,
|
||||
COALESCE(SUM(cs.n_live_tup), 0)::bigint,
|
||||
COALESCE(SUM(cs.n_dead_tup), 0)::bigint,
|
||||
COALESCE(SUM(pg_total_relation_size(child.oid)), 0)::bigint
|
||||
FROM pg_class parent
|
||||
JOIN pg_namespace n ON n.oid = parent.relnamespace
|
||||
JOIN pg_inherits inh ON inh.inhparent = parent.oid
|
||||
JOIN pg_class child ON child.oid = inh.inhrelid
|
||||
LEFT JOIN pg_stat_user_tables cs ON cs.relid = child.oid
|
||||
WHERE n.nspname = 'public' AND parent.relkind = 'p'
|
||||
GROUP BY parent.relname
|
||||
ORDER BY bytes DESC
|
||||
LIMIT 20
|
||||
""")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue