Skip to content

Commit

Permalink
feat: remove dropped/replaced transactions in pending transactions list
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Feb 28, 2019
1 parent e0b4ac6 commit c861879
Show file tree
Hide file tree
Showing 9 changed files with 120 additions and 96 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<% status = BlockScoutWeb.TransactionView.transaction_status(@transaction) %>
<div class="tile tile-type-<%= BlockScoutWeb.TransactionView.type_suffix(@transaction) %> fade-in" data-test="<%= BlockScoutWeb.TransactionView.type_suffix(@transaction) %>" data-identifier-hash="<%= @transaction.hash %>">
<div class="row" data-test="chain_transaction">
<div class="col-md-2 d-flex flex-row flex-md-column align-items-left justify-content-start justify-content-lg-center mb-1 mb-md-0 pl-md-4">
<span class="tile-label" data-test="transaction_type"> <%= BlockScoutWeb.TransactionView.transaction_display_type(@transaction) %></span>
<div class="tile-status-label ml-2 ml-md-0" data-test="transaction_status"><%= BlockScoutWeb.TransactionView.formatted_status(@transaction) %></div>
<div class="tile-status-label ml-2 ml-md-0" data-test="transaction_status"><%= BlockScoutWeb.TransactionView.formatted_status(status) %></div>
</div>
<div class="col-md-7 col-lg-8 d-flex flex-column pr-2 pr-sm-2 pr-md-0">
<%= render BlockScoutWeb.TransactionView, "_link.html", transaction_hash: @transaction.hash %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<% status = transaction_status(@transaction) %>
<div class="tile tile-type-<%= type_suffix(@transaction) %> fade-in <%= status_class(@transaction) %>" data-test="<%= type_suffix(@transaction) %>" data-identifier-hash="<%= @transaction.hash %>">
<div class="row tile-body" data-selector="token-transfers-toggle" data-test="chain_transaction">
<div class="col-md-2 d-flex flex-row flex-md-column align-items-left justify-content-start justify-content-lg-center mb-1 mb-md-0 pl-md-4">
Expand All @@ -11,7 +12,7 @@
<span class="loading-spinner-block-2"></span>
</div>
<% end %>
<%= formatted_status(@transaction) %>
<%= formatted_status(status) %>
</span>
</div>
<div class="col-md-7 col-lg-8 d-flex flex-column pr-2 pr-sm-2 pr-md-0">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<% block = @transaction.block %>
<% decoded_input_data = decoded_input_data(@transaction) %>
<% status = transaction_status(@transaction) %>
<section data-page="transaction-details" data-page-transaction-hash="<%= @transaction %>">
<div class="row">
<div class="col-md-12 col-lg-8">
Expand All @@ -15,7 +16,7 @@
</div>
<h1 class="card-title"><%= gettext "Transaction Details" %> </h1>

<%= if !block do %>
<%= if status == :pending do %>
<div class="tile tile-muted d-flex justify-content-center align-items-center mb-4">
<div class="loading-spinner">
<span class="loading-spinner-block-1"></span>
Expand All @@ -33,7 +34,7 @@
</span>
<div class="d-flex flex-row justify-content-start text-muted">
<span class="mr-4 text-<%= BlockScoutWeb.TransactionView.type_suffix(@transaction) %>"><%= BlockScoutWeb.TransactionView.transaction_display_type(@transaction) %></span>
<span class="mr-4" data-transaction-status="<%= BlockScoutWeb.TransactionView.formatted_status(@transaction) %>"><%= BlockScoutWeb.TransactionView.formatted_status(@transaction) %></span>
<span class="mr-4" data-transaction-status="<%= BlockScoutWeb.TransactionView.formatted_status(status) %>"><%= BlockScoutWeb.TransactionView.formatted_status(status) %></span>
<span class="mr-4">
<%= if block do %>
<span data-from-now="<%= @transaction.block.timestamp %>"></span>
Expand All @@ -52,7 +53,7 @@
to: block_path(@conn, :show, block)
) %>
<% else %>
<%= gettext "Pending" %>
<%= formatted_status(status) %>
<% end %>
</dd>
</dl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,12 @@ defmodule BlockScoutWeb.TransactionView do
end
end

def formatted_status(transaction) do
transaction
|> Chain.transaction_to_status()
|> case do
def transaction_status(transaction) do
Chain.transaction_to_status(transaction)
end

def formatted_status(status) do
case status do
:pending -> gettext("Pending")
:awaiting_internal_transactions -> gettext("(Awaiting internal transactions for status)")
:success -> gettext("Success")
Expand Down
81 changes: 40 additions & 41 deletions apps/block_scout_web/priv/gettext/default.pot
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ msgid "%{subnetwork} Explorer - BlockScout"
msgstr ""

#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:121
#: lib/block_scout_web/views/transaction_view.ex:123
msgid "(Awaiting internal transactions for status)"
msgstr ""

Expand Down Expand Up @@ -145,7 +145,7 @@ msgid "Block %{block_number} - %{subnetwork} Explorer"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:60
#: lib/block_scout_web/templates/transaction/overview.html.eex:61
msgid "Block Confirmations"
msgstr ""

Expand All @@ -160,7 +160,7 @@ msgid "Block Mined, awaiting import..."
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:46
#: lib/block_scout_web/templates/transaction/overview.html.eex:47
msgid "Block Number"
msgstr ""

Expand Down Expand Up @@ -271,19 +271,19 @@ msgid "Contract Address"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:15
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:16
#: lib/block_scout_web/views/address_view.ex:35
#: lib/block_scout_web/views/address_view.ex:69
msgid "Contract Address Pending"
msgstr ""

#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:198
#: lib/block_scout_web/views/transaction_view.ex:200
msgid "Contract Call"
msgstr ""

#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:197
#: lib/block_scout_web/views/transaction_view.ex:199
msgid "Contract Creation"
msgstr ""

Expand Down Expand Up @@ -317,13 +317,13 @@ msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/transaction/not_found.html.eex:9
#: lib/block_scout_web/templates/transaction/overview.html.eex:11
#: lib/block_scout_web/templates/transaction/overview.html.eex:12
msgid "Copy Transaction Hash"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/transaction/not_found.html.eex:9
#: lib/block_scout_web/templates/transaction/overview.html.eex:11
#: lib/block_scout_web/templates/transaction/overview.html.eex:12
msgid "Copy Txn Hash"
msgstr ""

Expand Down Expand Up @@ -377,22 +377,22 @@ msgid "Error trying to fetch balances."
msgstr ""

#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:125
#: lib/block_scout_web/views/transaction_view.ex:127
msgid "Error: %{reason}"
msgstr ""

#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:123
#: lib/block_scout_web/views/transaction_view.ex:125
msgid "Error: (Awaiting internal transactions for reason)"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/address/_balance_card.html.eex:13
#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:16
#: lib/block_scout_web/templates/layout/app.html.eex:51
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:19
#: lib/block_scout_web/templates/transaction/_tile.html.eex:26
#: lib/block_scout_web/templates/transaction/overview.html.eex:140
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20
#: lib/block_scout_web/templates/transaction/_tile.html.eex:27
#: lib/block_scout_web/templates/transaction/overview.html.eex:141
#: lib/block_scout_web/views/wei_helpers.ex:72
msgid "Ether"
msgstr ""
Expand Down Expand Up @@ -431,7 +431,7 @@ msgid "GET"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:153
#: lib/block_scout_web/templates/transaction/overview.html.eex:154
msgid "Gas"
msgstr ""

Expand Down Expand Up @@ -467,7 +467,7 @@ msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:32
#: lib/block_scout_web/templates/transaction/_tile.html.eex:46
#: lib/block_scout_web/templates/transaction/_tile.html.eex:47
msgid "IN"
msgstr ""

Expand Down Expand Up @@ -495,7 +495,7 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:43
#: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:10
#: lib/block_scout_web/views/address_view.ex:270
#: lib/block_scout_web/views/transaction_view.ex:251
#: lib/block_scout_web/views/transaction_view.ex:253
msgid "Internal Transactions"
msgstr ""

Expand All @@ -513,15 +513,15 @@ msgid "Less than"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:165
#: lib/block_scout_web/templates/transaction/overview.html.eex:166
msgid "Limit"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:21
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:48
#: lib/block_scout_web/templates/transaction_log/index.html.eex:10
#: lib/block_scout_web/views/transaction_view.ex:252
#: lib/block_scout_web/views/transaction_view.ex:254
msgid "Logs"
msgstr ""

Expand Down Expand Up @@ -609,13 +609,13 @@ msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/block/overview.html.eex:71
#: lib/block_scout_web/templates/transaction/overview.html.eex:67
#: lib/block_scout_web/templates/transaction/overview.html.eex:68
msgid "Nonce"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:30
#: lib/block_scout_web/templates/transaction/_tile.html.eex:42
#: lib/block_scout_web/templates/transaction/_tile.html.eex:43
msgid "OUT"
msgstr ""

Expand Down Expand Up @@ -661,9 +661,8 @@ msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/layout/_topnav.html.eex:44
#: lib/block_scout_web/templates/transaction/overview.html.eex:55
#: lib/block_scout_web/views/transaction_view.ex:120
#: lib/block_scout_web/views/transaction_view.ex:154
#: lib/block_scout_web/views/transaction_view.ex:122
#: lib/block_scout_web/views/transaction_view.ex:156
msgid "Pending"
msgstr ""

Expand Down Expand Up @@ -768,14 +767,14 @@ msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/transaction/_emission_reward_tile.html.eex:8
#: lib/block_scout_web/views/transaction_view.ex:122
#: lib/block_scout_web/views/transaction_view.ex:124
msgid "Success"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20
#: lib/block_scout_web/templates/transaction/_tile.html.eex:29
#: lib/block_scout_web/templates/transaction/overview.html.eex:72
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:21
#: lib/block_scout_web/templates/transaction/_tile.html.eex:30
#: lib/block_scout_web/templates/transaction/overview.html.eex:73
msgid "TX Fee"
msgstr ""

Expand Down Expand Up @@ -841,7 +840,7 @@ msgid "There are no transfers for this Token."
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:24
#: lib/block_scout_web/templates/transaction/overview.html.eex:25
msgid "This transaction is pending confirmation."
msgstr ""

Expand Down Expand Up @@ -879,7 +878,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:4
#: lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex:4
#: lib/block_scout_web/views/transaction_view.ex:196
#: lib/block_scout_web/views/transaction_view.ex:198
msgid "Token Transfer"
msgstr ""

Expand All @@ -891,7 +890,7 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:36
#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:10
#: lib/block_scout_web/views/tokens/overview_view.ex:35
#: lib/block_scout_web/views/transaction_view.ex:250
#: lib/block_scout_web/views/transaction_view.ex:252
msgid "Token Transfers"
msgstr ""

Expand Down Expand Up @@ -932,7 +931,7 @@ msgid "Total transactions"
msgstr ""

#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:199
#: lib/block_scout_web/views/transaction_view.ex:201
msgid "Transaction"
msgstr ""

Expand All @@ -948,7 +947,7 @@ msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/transaction/not_found.html.eex:14
#: lib/block_scout_web/templates/transaction/overview.html.eex:16
#: lib/block_scout_web/templates/transaction/overview.html.eex:17
msgid "Transaction Details"
msgstr ""

Expand Down Expand Up @@ -999,7 +998,7 @@ msgid "Unique Token"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:158
#: lib/block_scout_web/templates/transaction/overview.html.eex:159
msgid "Used"
msgstr ""

Expand All @@ -1020,7 +1019,7 @@ msgid "Validations"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:140
#: lib/block_scout_web/templates/transaction/overview.html.eex:141
msgid "Value"
msgstr ""

Expand Down Expand Up @@ -1050,12 +1049,12 @@ msgid "View Contract"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/transaction/_tile.html.eex:70
#: lib/block_scout_web/templates/transaction/_tile.html.eex:71
msgid "View Less Transfers"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/transaction/_tile.html.eex:69
#: lib/block_scout_web/templates/transaction/_tile.html.eex:70
msgid "View More Transfers"
msgstr ""

Expand Down Expand Up @@ -1216,7 +1215,7 @@ msgid "This API is provided for developers transitioning their applications from
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:94
#: lib/block_scout_web/templates/transaction/overview.html.eex:95
msgid "Raw Input"
msgstr ""

Expand Down Expand Up @@ -1639,17 +1638,17 @@ msgid "Transactions Sent"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:85
#: lib/block_scout_web/templates/transaction/overview.html.eex:86
msgid "Transaction Speed"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:116
#: lib/block_scout_web/templates/transaction/overview.html.eex:121
#: lib/block_scout_web/templates/transaction/overview.html.eex:117
#: lib/block_scout_web/templates/transaction/overview.html.eex:122
msgid "Hex (Default)"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:125
#: lib/block_scout_web/templates/transaction/overview.html.eex:126
msgid "UTF-8"
msgstr ""
Loading

0 comments on commit c861879

Please sign in to comment.