diff --git a/lib/microwaveprop_web/live/contact_live/show.ex b/lib/microwaveprop_web/live/contact_live/show.ex index eb96445c..cec5aae2 100644 --- a/lib/microwaveprop_web/live/contact_live/show.ex +++ b/lib/microwaveprop_web/live/contact_live/show.ex @@ -32,7 +32,7 @@ defmodule MicrowavepropWeb.ContactLive.Show do hrrr = List.first(hrrr_path) {hrrr, hrrr_status} = maybe_enqueue_hrrr(hrrr, contact) terrain = Terrain.get_terrain_profile(contact.id) - maybe_enqueue_terrain(terrain, contact) + terrain_status = if terrain, do: :loaded, else: maybe_enqueue_terrain(terrain, contact) elevation_profile = compute_elevation_profile(contact, hrrr_path, weather.soundings) propagation_analysis = build_propagation_analysis(contact, hrrr, terrain, elevation_profile, weather.soundings) @@ -46,6 +46,7 @@ defmodule MicrowavepropWeb.ContactLive.Show do hrrr: hrrr, hrrr_status: hrrr_status, terrain: terrain, + terrain_status: terrain_status, elevation_profile: elevation_profile, propagation_analysis: propagation_analysis, terrain_expanded: false, @@ -124,6 +125,7 @@ defmodule MicrowavepropWeb.ContactLive.Show do {:noreply, assign(socket, terrain: terrain, + terrain_status: :loaded, elevation_profile: elevation_profile, propagation_analysis: propagation_analysis )} @@ -223,14 +225,15 @@ defmodule MicrowavepropWeb.ContactLive.Show do end end - defp maybe_enqueue_terrain(terrain, _contact) when not is_nil(terrain), do: :ok + defp maybe_enqueue_terrain(terrain, _contact) when not is_nil(terrain), do: :loaded defp maybe_enqueue_terrain(nil, contact) do if contact.pos1 && contact.pos2 do Oban.insert(TerrainProfileWorker.new(%{"qso_id" => contact.id})) + :queued + else + :unavailable end - - :ok end defp maybe_enqueue_hrrr(hrrr, _contact) when not is_nil(hrrr), do: {hrrr, :loaded} @@ -310,6 +313,13 @@ defmodule MicrowavepropWeb.ContactLive.Show do /> <% end %> + <%= if !@elevation_profile && @terrain_status == :queued do %> +
+ + Computing elevation profile and terrain analysis... +
+ <% end %> + <%= if @elevation_profile do %>
@@ -468,7 +478,16 @@ defmodule MicrowavepropWeb.ContactLive.Show do <% end %>
<% else %> -

No terrain profile available.

+
+ <%= if @terrain_status == :queued do %> + + + Computing terrain profile... + + <% else %> + No terrain profile available. + <% end %> +
<% end %>
@@ -622,16 +641,19 @@ defmodule MicrowavepropWeb.ContactLive.Show do <% end %>
<% else %> -

+

<%= case @hrrr_status do %> <% :queued -> %> - HRRR fetch queued — reload in a few minutes. + + + Fetching HRRR atmospheric data... + <% :unavailable -> %> HRRR data unavailable for this contact time. <% _ -> %> No HRRR profile available. <% end %> -

+
<% end %>