Skip to content

Commit

Permalink
handle_params
Browse files Browse the repository at this point in the history
  • Loading branch information
egze committed Nov 11, 2024
1 parent c1e4f9f commit f1f23d8
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lib/oban/live_dashboard.ex
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,7 @@ defmodule Oban.LiveDashboard do
end

@impl true
def mount(params, _, socket) do
socket =
socket
|> assign(job_state: Map.get(params, "job_state", "executing"))
|> assign(sort_by: Map.get(params, "job_state"))

def mount(_params, _, socket) do
{:ok, socket}
end

Expand All @@ -87,9 +82,11 @@ defmodule Oban.LiveDashboard do
end

@impl true
def handle_params(%{"params" => %{"job" => job_id}}, _url, socket) do
def handle_params(%{"params" => %{"job" => job_id}} = params, _url, socket) do
socket =
socket
|> assign(job_state: Map.get(params, "job_state", "executing"))
|> assign(sort_by: Map.get(params, "job_state"))
|> assign(job: nil)
|> assign_job_state_counts()
|> assign_timestamp_field()
Expand All @@ -104,9 +101,11 @@ defmodule Oban.LiveDashboard do
end
end

def handle_params(_params, _uri, socket) do
def handle_params(params, _uri, socket) do
socket =
socket
|> assign(job_state: Map.get(params, "job_state", "executing"))
|> assign(sort_by: Map.get(params, "job_state"))
|> assign(job: nil)
|> assign_job_state_counts()
|> assign_timestamp_field()
Expand Down

0 comments on commit f1f23d8

Please sign in to comment.