diff --git a/assets/css/components/_transactions.scss b/assets/css/components/_transactions.scss index 1f9c18058c..74276fb04e 100644 --- a/assets/css/components/_transactions.scss +++ b/assets/css/components/_transactions.scss @@ -11,10 +11,9 @@ &__title { @include explorer-typography("title"); color: explorer-color("slate", "100"); - margin: 0; } - &__headline-title { line-height: 18px; } + &__title { margin: 0; } &__table { @extend %table; diff --git a/lib/explorer_web/controllers/pending_transaction_controller.ex b/lib/explorer_web/controllers/pending_transaction_controller.ex index 7cd0682f80..628fb213b7 100644 --- a/lib/explorer_web/controllers/pending_transaction_controller.ex +++ b/lib/explorer_web/controllers/pending_transaction_controller.ex @@ -10,21 +10,27 @@ defmodule ExplorerWeb.PendingTransactionController do def index(conn, params) do query = from transaction in Transaction, left_join: receipt in assoc(transaction, :receipt), - left_join: block_transaction in assoc(transaction, :block_transaction), - join: to_address in assoc(transaction, :to_address), - join: from_address in assoc(transaction, :from_address), + inner_join: to_address in assoc(transaction, :to_address), + inner_join: from_address in assoc(transaction, :from_address), preload: [to_address: to_address, from_address: from_address], order_by: [desc: transaction.inserted_at], where: is_nil(receipt.transaction_id) + total_query = from transaction in Transaction, + select: fragment("count(?)", transaction.id), + left_join: receipt in assoc(transaction, :receipt), + where: is_nil(receipt.transaction_id) - transactions = query |> Repo.paginate(params) + transactions = Repo.paginate( + query, + params + |> Map.put(:total_entries, Repo.one(total_query)) + |> Map.put(:page_size, 25) + ) + entries = transactions.entries |> Enum.map(&PendingTransactionForm.build/1) render( conn, "index.html", - transactions: - transactions - |> Map.put(:entries, transactions.entries - |> Enum.map(&PendingTransactionForm.build/1)) + transactions: Map.put(transactions, :entries, entries) ) end end diff --git a/lib/explorer_web/controllers/transaction_controller.ex b/lib/explorer_web/controllers/transaction_controller.ex index 1a20b57261..2da4060c01 100644 --- a/lib/explorer_web/controllers/transaction_controller.ex +++ b/lib/explorer_web/controllers/transaction_controller.ex @@ -17,8 +17,16 @@ defmodule ExplorerWeb.TransactionController do block: block, receipt: receipt, to_address: to_address, from_address: from_address], order_by: [desc: block.timestamp] - - transactions = Repo.paginate(query, params) + total_query = from transaction in Transaction, + select: fragment("count(?)", transaction.id), + inner_join: receipt in assoc(transaction, :receipt), + inner_join: block in assoc(transaction, :block) + transactions = Repo.paginate( + query, + params + |> Map.put(:total_entries, Repo.one(total_query)) + |> Map.put(:page_size, 25) + ) render(conn, "index.html", transactions: transactions) end diff --git a/lib/explorer_web/templates/pending_transaction/index.html.eex b/lib/explorer_web/templates/pending_transaction/index.html.eex index 002b6dac0b..1cca5cdce2 100644 --- a/lib/explorer_web/templates/pending_transaction/index.html.eex +++ b/lib/explorer_web/templates/pending_transaction/index.html.eex @@ -2,7 +2,6 @@

<%= gettext("Showing %{count} Pending Transactions", count: @transactions.total_entries) %>

-
<%= pagination_links @conn, @transactions, ["en"], view_style: :bulma, first: true, distance: 1, previous: Phoenix.HTML.raw("‹"), next: Phoenix.HTML.raw("›"), path: &pending_transaction_path/4 %>
diff --git a/lib/explorer_web/templates/transaction/index.html.eex b/lib/explorer_web/templates/transaction/index.html.eex index 37e88d2449..7957e5aca8 100644 --- a/lib/explorer_web/templates/transaction/index.html.eex +++ b/lib/explorer_web/templates/transaction/index.html.eex @@ -2,7 +2,6 @@

<%= gettext("Showing %{count} Transactions", count: @transactions.total_entries) %>

-
<%= pagination_links @conn, @transactions, ["en"], view_style: :bulma, first: true, distance: 1, previous: Phoenix.HTML.raw("‹"), next: Phoenix.HTML.raw("›"), path: &transaction_path/4 %>