diff --git a/lib/sanbase/metric/registry/change_suggestion.ex b/lib/sanbase/metric/registry/change_suggestion.ex index 47d3f5f69..9ac19898b 100644 --- a/lib/sanbase/metric/registry/change_suggestion.ex +++ b/lib/sanbase/metric/registry/change_suggestion.ex @@ -145,7 +145,8 @@ defmodule Sanbase.Metric.Registry.ChangeSuggestion do # After change suggestion is applied, put the metric in a unverified state and mark # is as not synced. Someone needs to manually verify the metric after it is tested. # When the data is synced between stage and prod, the sync status will be updated. - params = Map.merge(params, %{is_verified: false, sync_status: "not_synced"}) + # Note: Keep the keys as strings, not atoms, so the map is not mixed + params = Map.merge(params, %{"is_verified" => false, "sync_status" => "not_synced"}) case Registry.changeset(registry, params) do %{valid?: false} = changeset -> diff --git a/lib/sanbase_web/live/metric_registry/metric_registry_change_suggestions_live.ex b/lib/sanbase_web/live/metric_registry/metric_registry_change_suggestions_live.ex index 5d7257ec9..fd42e685f 100644 --- a/lib/sanbase_web/live/metric_registry/metric_registry_change_suggestions_live.ex +++ b/lib/sanbase_web/live/metric_registry/metric_registry_change_suggestions_live.ex @@ -3,6 +3,7 @@ defmodule SanbaseWeb.MetricRegistryChangeSuggestionsLive do alias SanbaseWeb.AdminFormsComponents alias Sanbase.Metric.Registry.ChangeSuggestion + alias SanbaseWeb.AvailableMetricsComponents @impl true def mount(_params, _session, socket) do @@ -16,12 +17,17 @@ defmodule SanbaseWeb.MetricRegistryChangeSuggestionsLive do def render(assigns) do ~H"""
+
<.table id="metric_registry_changes_suggestions" rows={@rows}> <:col :let={row} label="Status"> - <:col :let={row} label="Metric"> + <:col :let={row} label="Metric" col_class="max-w-[320px] break-words"> <.link class="underline text-blue-600" href={~p"/admin2/metric_registry/show/#{row.metric_registry_id}"} diff --git a/lib/sanbase_web/live/metric_registry/metric_registry_index_live.ex b/lib/sanbase_web/live/metric_registry/metric_registry_index_live.ex index 68ea4e21d..d12c1c92b 100644 --- a/lib/sanbase_web/live/metric_registry/metric_registry_index_live.ex +++ b/lib/sanbase_web/live/metric_registry/metric_registry_index_live.ex @@ -45,7 +45,7 @@ defmodule SanbaseWeb.MetricRegistryIndexLive do <.filters filter={@filter} changed_metrics_ids={@changed_metrics_ids} /> <:col :let={row} label="ID"> <%= row.id %> @@ -278,7 +278,7 @@ defmodule SanbaseWeb.MetricRegistryIndexLive do />
- <.filter_not_verified /> + <.filter_unverified />
<.phx_click_button @@ -291,17 +291,17 @@ defmodule SanbaseWeb.MetricRegistryIndexLive do """ end - defp filter_not_verified(assigns) do + defp filter_unverified(assigns) do ~H"""
""" @@ -402,7 +402,7 @@ defmodule SanbaseWeb.MetricRegistryIndexLive do end) end - defp maybe_apply_filter(metrics, :match_table, %{"not_verified_only" => "on"}) do + defp maybe_apply_filter(metrics, :match_table, %{"unverified_only" => "on"}) do metrics |> Enum.filter(fn m -> m.is_verified == false @@ -410,4 +410,9 @@ defmodule SanbaseWeb.MetricRegistryIndexLive do end defp maybe_apply_filter(metrics, _, _), do: metrics + + defp take_ordered(metrics, ids) do + metrics_map = Map.new(metrics, &{&1.id, &1}) + Enum.map(ids, &Map.get(metrics_map, &1)) + end end