Merge pull request #2009 from poanetwork/ab-addresse-page-improvements

addresses page improvements
pull/2018/head
Ayrat Badykov 6 years ago committed by GitHub
commit 746939b6d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 15
      apps/block_scout_web/assets/js/lib/async_listing_load.js
  3. 2
      apps/block_scout_web/lib/block_scout_web/controllers/address_controller.ex
  4. 4
      apps/block_scout_web/lib/block_scout_web/templates/address/index.html.eex

@ -58,6 +58,7 @@
- [#1917](https://github.com/poanetwork/blockscout/pull/1917) - Force block refetch if transaction is re-collated in a different block
- [#1992](https://github.com/poanetwork/blockscout/pull/1992) - fix: support https for wobserver polling
- [#1966](https://github.com/poanetwork/blockscout/pull/1966) - fix: add fields for contract filter performance
- [#2009](https://github.com/poanetwork/blockscout/pull/2009) - addresses page improvements
### Chore

@ -48,6 +48,8 @@ export const asyncInitialState = {
loading: false,
/* if there was an error fetching items */
requestError: false,
/* if response has no items */
emptyResponse: false,
/* if it is loading the first page */
loadingFirstPage: true,
/* link to the next page */
@ -90,6 +92,7 @@ export function asyncReducer (state = asyncInitialState, action) {
return Object.assign({}, state, {
requestError: false,
emptyResponse: action.items.length === 0,
items: action.items,
nextPagePath: action.nextPagePath,
prevPagePath: prevPagePath
@ -169,6 +172,10 @@ export const elements = {
},
'[data-async-listing] [data-next-page-button]': {
render ($el, state) {
if (state.emptyResponse) {
return $el.hide()
}
if (state.requestError || !state.nextPagePath || state.loading) {
return $el.attr('disabled', 'disabled')
}
@ -179,6 +186,10 @@ export const elements = {
},
'[data-async-listing] [data-prev-page-button]': {
render ($el, state) {
if (state.emptyResponse) {
return $el.hide()
}
if (state.requestError || !state.prevPagePath || state.loading) {
return $el.attr('disabled', 'disabled')
}
@ -189,6 +200,10 @@ export const elements = {
},
'[data-async-listing] [data-page-number]': {
render ($el, state) {
if (state.emptyResponse) {
return $el.hide()
}
if (state.pagesStack.length === 0) {
return $el.text('Page 1')
}

@ -26,7 +26,7 @@ defmodule BlockScoutWeb.AddressController do
address_path(
conn,
:index,
next_page_params
Map.delete(next_page_params, "type")
)
end

@ -3,11 +3,11 @@
<div class="card-body" data-async-load data-async-listing="<%= @current_path %>">
<h1 class="card-title"><%= gettext "Addresses" %></h1>
<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true %>
<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>
<div data-items data-selector="top-addresses-list"></div>
<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true %>
<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>
</div>
</div>
</section>

Loading…
Cancel
Save