- <%= live_patch(alert.name, to: ~p"/alerts/#{alert.id}", class: "tw-text-white") %>
+ <.link patch={~p"/alerts/#{alert.id}"} class="tw-text-white"><%= alert.name %>
uuid: <%= alert.token %>
<%= alert.description %>
diff --git a/lib/logflare_web/live/alerts/actions/new.html.heex b/lib/logflare_web/live/alerts/actions/new.html.heex
index 9e116cb44..eeed06c26 100644
--- a/lib/logflare_web/live/alerts/actions/new.html.heex
+++ b/lib/logflare_web/live/alerts/actions/new.html.heex
@@ -1,9 +1,6 @@
<.subheader>
<:path>
- ~/<%= live_patch("alerts",
- to: ~p"/alerts",
- "data-confirm": "Confirm navigate away? All unsaved changes will be lost"
- ) %>/new
+ ~/<.link patch={~p"/alerts"} data-confirm="Confirm navigate away? All unsaved changes will be lost">alerts/new
diff --git a/lib/logflare_web/live/billingaccount_live/templates/edit.html.heex b/lib/logflare_web/live/billingaccount_live/templates/edit.html.heex
index 500ccdcb3..5897cfc9e 100644
--- a/lib/logflare_web/live/billingaccount_live/templates/edit.html.heex
+++ b/lib/logflare_web/live/billingaccount_live/templates/edit.html.heex
@@ -61,16 +61,8 @@
id: "dropdownMenuButton"
) %>
- <%= live_component(LogflareWeb.BillingAccountLive.ChartComponent,
- id: :chart,
- user: @user,
- days: 30
- ) %>
- <%= live_component(LogflareWeb.BillingAccountLive.EstimateUsageComponent,
- id: :table,
- user: @user,
- plan: @plan
- ) %>
+ <.live_component module={LogflareWeb.BillingAccountLive.ChartComponent} id="chart" user={@user} days={30} />
+ <.live_component module={LogflareWeb.BillingAccountLive.EstimateUsageComponent} id="table" user={@user} plan={@plan} />
diff --git a/lib/logflare_web/live/modal_live_helpers.ex b/lib/logflare_web/live/modal_live_helpers.ex
index a2ac888d0..9d8290242 100644
--- a/lib/logflare_web/live/modal_live_helpers.ex
+++ b/lib/logflare_web/live/modal_live_helpers.ex
@@ -2,7 +2,6 @@ defmodule LogflareWeb.ModalLiveHelpers do
@moduledoc """
Modal helpers to be imported where modals may be called
"""
- import Phoenix.LiveView.Helpers
import Phoenix.Component, only: [assign: 3]
import Phoenix.HTML.Link, only: [link: 2]
@@ -96,7 +95,8 @@ defmodule LogflareWeb.ModalLiveHelpers do
path = Keyword.fetch!(opts, :return_to)
title = Keyword.fetch!(opts, :title)
- modal_opts = [
+ modal_opts = %{
+ module: LogflareWeb.ModalComponent,
id: :modal,
return_to: path,
template: template,
@@ -104,24 +104,25 @@ defmodule LogflareWeb.ModalLiveHelpers do
title: title,
view: Keyword.fetch!(opts, :view),
is_template?: true
- ]
+ }
- live_component(LogflareWeb.ModalComponent, modal_opts)
+ Phoenix.Component.live_component(modal_opts)
end
def live_modal(component, opts) when is_atom(component) do
path = Keyword.fetch!(opts, :return_to)
title = Keyword.fetch!(opts, :title)
- modal_opts = [
+ modal_opts = %{
+ module: LogflareWeb.ModalComponent,
id: :"logflare-modal",
return_to: path,
component: component,
opts: opts,
title: title,
is_template?: false
- ]
+ }
- live_component(LogflareWeb.ModalComponent, modal_opts)
+ Phoenix.Component.live_component(modal_opts)
end
end
diff --git a/lib/logflare_web/live/plans_live.ex b/lib/logflare_web/live/plans_live.ex
index 5f91abbf1..86ab0f22a 100644
--- a/lib/logflare_web/live/plans_live.ex
+++ b/lib/logflare_web/live/plans_live.ex
@@ -1,13 +1,10 @@
defmodule LogflareWeb.PlansLive do
@moduledoc false
- use Phoenix.LiveView, layout: {LogflareWeb.SharedView, :live_widget}
- use Phoenix.HTML
+ use LogflareWeb, {:live_view, layout: {LogflareWeb.SharedView, :live_widget}}
alias Logflare.Billing
alias Logflare.Users
- alias LogflareWeb.Router.Helpers, as: Routes
-
def render(assigns) do
~H"""
@@ -20,45 +17,45 @@ defmodule LogflareWeb.PlansLive do
Team members
Sources
- <%= link to: Routes.marketing_path(@socket, :pricing) <> "#sources", class: "position-absolute absolute-right" do %>
+ <.link navigate={~p"/pricing#sources"} class="position-absolute absolute-right">
- <% end %>
+
Alert frequency
Dashboards
- <%= link to: Routes.marketing_path(@socket, :pricing) <> "#dashboards", class: "position-absolute absolute-right" do %>
+ <.link navigate={~p"/pricing#dashboards"} class="position-absolute absolute-right">
- <% end %>
+
Backend
- <%= link to: Routes.marketing_path(@socket, :pricing) <> "#backend", class: "position-absolute absolute-right" do %>
+ <.link navigate={~p"/pricing#backend"} class="position-absolute absolute-right">
- <% end %>
+
Fields
- <%= link to: Routes.marketing_path(@socket, :pricing) <> "#fields", class: "position-absolute absolute-right" do %>
+ <.link navigate={~p"/pricing#fields"} class="position-absolute absolute-right">
- <% end %>
+
Event Retention
- <%= link to: Routes.marketing_path(@socket, :pricing) <> "#retention", class: "position-absolute absolute-right" do %>
+ <.link navigate={~p"/pricing#retention"} class="position-absolute absolute-right">
- <% end %>
+
Events per month
Rate limit
- <%= link to: Routes.marketing_path(@socket, :pricing) <> "#rate-limit", class: "position-absolute absolute-right" do %>
+ <.link navigate={~p"/pricing#rate-limit"} class="position-absolute absolute-right">
- <% end %>
+
Rate burst
@@ -90,7 +87,7 @@ defmodule LogflareWeb.PlansLive do
per <%= @period %>
- <%= link("Continue", to: Routes.auth_path(@socket, :login), class: "btn btn-dark text-white w-75 mr-0") %>
+ <.link navigate={~p"/auth/login"} class="btn btn-dark text-white w-75 mr-0">Continue
diff --git a/lib/logflare_web/templates/admin_shared/nav_links_live.html.heex b/lib/logflare_web/templates/admin_shared/nav_links_live.html.heex
index 7e3acb1eb..c7039a475 100644
--- a/lib/logflare_web/templates/admin_shared/nav_links_live.html.heex
+++ b/lib/logflare_web/templates/admin_shared/nav_links_live.html.heex
@@ -1,19 +1,19 @@
-
- <%= link to: Routes.admin_path(@socket, :sources) do %>
+ <.link navigate={~p"/admin/sources"}>
sources
- <% end %>
+
-
- <%= link to: Routes.admin_path(@socket, :accounts) do %>
+ <.link navigate={~p"/admin/accounts"}>
accounts
- <% end %>
+
-
- <%= link to: Routes.cluster_path(@socket, :index) do %>
+ <.link navigate={~p"/admin/cluster"}>
cluster
- <% end %>
+
-
<%= link to: Routes.live_path(@socket, LogflareWeb.AdminSearchDashboardLive) do %>
@@ -21,9 +21,9 @@
<% end %>
-
- <%= link to: Routes.admin_plan_path(@socket, :index) do %>
+ <.link navigate={~p"/admin/plans"}>
plans
- <% end %>
+
diff --git a/lib/logflare_web/templates/log/log_event.html.heex b/lib/logflare_web/templates/log/log_event.html.heex
index 138465265..165dfdec8 100644
--- a/lib/logflare_web/templates/log/log_event.html.heex
+++ b/lib/logflare_web/templates/log/log_event.html.heex
@@ -1,10 +1,7 @@
- ~/logs/<%= link(@source.name,
- to: Routes.source_path(@socket, :show, @source),
- class: "text-primary"
- ) %>/event
+ ~/logs/<.link navigate={~p"/sources/#{@source}"} class="text-primary"><%= @source.name %>/event
- <%= live_component(
- LogflareWeb.Search.LogEventViewerComponent,
- Map.merge(assigns, %{
- id: :log_event_viewer,
- source: @source,
- team_user: @team_user,
- user: @user
- })
- ) %>
+ <.live_component module={LogflareWeb.Search.LogEventViewerComponent} id="log_event_viewer" {assigns} />
diff --git a/lib/logflare_web/templates/rule/source_rules.html.heex b/lib/logflare_web/templates/rule/source_rules.html.heex
index 6989680f4..a3b96fe6d 100644
--- a/lib/logflare_web/templates/rule/source_rules.html.heex
+++ b/lib/logflare_web/templates/rule/source_rules.html.heex
@@ -9,7 +9,7 @@
<% end %>
-
~/logs/<%= link(@source.name, to: Routes.source_path(@socket, :show, @source), class: "text-primary") %>/rules
+
~/logs/<.link navigate={~p"/sources/#{@source}"} class="text-primary" )><%= @source.name %>/rules
-
@@ -61,7 +61,7 @@
<% end %>
<.form :let={f} for={:rule} action="#" phx-submit="fsubmit">
- <%= live_component(Lql.LqlFormLVC, f: f, lql_string: @lql_string, loading: has_regex_rules?(@rules)) %>
+ <.live_component module={Lql.LqlFormLVC} f={f} lql_string={@lql_string} loading={has_regex_rules?(@rules)} />
<%= label(f, :sink, "Sink source", class: "control-label") %>
<% sink_form_options = for s <- @sources, do: [key: s.name, value: s.token, disabled: s.disabled] %>