Add block_type to block_channel to receive channel updates. Ensure uncle and reorg list pages don’t receive block live updates. Fix failing tests due to selector overload.

pull/870/head
Stamates 6 years ago committed by Ryan Arthur
parent 8d307cb137
commit 1d37033518
  1. 3
      apps/block_scout_web/lib/block_scout_web/channels/block_channel.ex
  2. 8
      apps/block_scout_web/lib/block_scout_web/templates/block/_tile.html.eex
  3. 2
      apps/block_scout_web/lib/block_scout_web/templates/block/index.html.eex
  4. 4
      apps/block_scout_web/test/block_scout_web/features/pages/block_list_page.ex

@ -24,7 +24,8 @@ defmodule BlockScoutWeb.BlockChannel do
View.render_to_string(
BlockView,
"_tile.html",
block: block
block: block,
block_type: BlockView.block_type(block)
)
rendered_chain_block =

@ -1,4 +1,4 @@
<div class="tile tile-type-<%= String.downcase(@block_type) %> fade-up" data-block-number="<%= to_string(@block.number) %>">
<div class="tile tile-type-<%= String.downcase(@block_type) %> fade-up" data-selector="block-tile" data-block-number="<%= to_string(@block.number) %>">
<div class="row">
<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">
@ -12,16 +12,14 @@
@block,
class: "tile-title",
to: block_path(BlockScoutWeb.Endpoint, :show, @block),
"data-selector": "block-number",
"data-block-number": to_string(@block.number)
"data-selector": "block-number"
) %>
<% else %>
<%= link(
@block,
class: "tile-title",
to: block_path(BlockScoutWeb.Endpoint, :show, @block.hash),
"data-selector": "block-number",
"data-block-number": to_string(@block.number)
"data-selector": "block-number"
) %>
<% end %>
<div>

@ -1,4 +1,4 @@
<section class="container" data-page="block-list">
<section class="container" data-page="<%= String.downcase(@block_type) %>-list">
<div class="card">
<div class="card-body">
<div data-selector="channel-disconnected-message" style="display:none;">

@ -20,7 +20,7 @@ defmodule BlockScoutWeb.BlockListPage do
end
def block(%Block{number: block_number}) do
css("[data-block-number='#{block_number}']")
css("[data-selector='block-tile'][data-block-number='#{block_number}']")
end
def place_holder_blocks(count) do
@ -28,6 +28,6 @@ defmodule BlockScoutWeb.BlockListPage do
end
def blocks(count) do
css("[data-selector='block-number']", count: count)
css("[data-selector='block-tile']", count: count)
end
end

Loading…
Cancel
Save