Skip to content

Commit

Permalink
Application alerts management: whole explorer, staking dapp
Browse files Browse the repository at this point in the history
  • Loading branch information
vbaranov committed Mar 17, 2021
1 parent 3684f66 commit 9cd0fcb
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
- [#3577](https://github.com/poanetwork/blockscout/pull/3577) - Eliminate GraphiQL page XSS attack

### Chore
- [#3714](https://github.com/poanetwork/blockscout/pull/3714) - Application announcements management: whole explorer, staking dapp
- [#3709](https://github.com/poanetwork/blockscout/pull/3709) - Fix 413 Request Entity Too Large returned from single request batch
- [#3701](https://github.com/poanetwork/blockscout/pull/3701) - Increase LP tokens calc process re-check interval
- [#3700](https://github.com/poanetwork/blockscout/pull/3700) - Update tool versions
Expand Down
3 changes: 3 additions & 0 deletions apps/block_scout_web/config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ config :block_scout_web, BlockScoutWeb.Chain,
logo_text: System.get_env("LOGO_TEXT"),
has_emission_funds: false,
staking_enabled: not is_nil(System.get_env("POS_STAKING_CONTRACT")),
staking_enabled_in_menu: System.get_env("DISABLE_POS_STAKING_IN_MENU", "false") != "true",
show_staking_warning: System.get_env("SHOW_STAKING_WARNING", "false") == "true",
show_maintenance_alert: System.get_env("SHOW_MAINTENANCE_ALERT", "false") == "true",
# how often (in blocks) the list of pools should autorefresh in UI (zero turns off autorefreshing)
staking_pool_list_refresh_interval: 5

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<link rel="stylesheet" href="<%= static_path(@conn, "/css/awesomplete.css") %>">
<script src="<%= static_path(@conn, "/js/awesomplete.min.js") %>"></script>
<script src="<%= static_path(@conn, "/js/awesomplete-util.min.js") %>"></script>
<% staking_enabled_in_menu = Application.get_env(:block_scout_web, BlockScoutWeb.Chain)[:staking_enabled_in_menu] %>
<% apps_menu = Application.get_env(:block_scout_web, :apps_menu) %>
<nav class="navbar navbar-dark navbar-expand-lg navbar-primary" data-selector="navbar" id="top-navbar">
<script>
if (localStorage.getItem("current-color-mode") === "dark") {
Expand Down Expand Up @@ -142,26 +144,26 @@
</div>
</li>
<% end %>
<%= if Application.get_env(:block_scout_web, :apps_menu) == true || Application.get_env(:block_scout_web, BlockScoutWeb.Chain)[:staking_enabled] do %>
<%= if apps_menu == true || staking_enabled_in_menu do %>
<li class="nav-item dropdown">
<a href="#" role="button" id="navbarAppsDropdown" class="nav-link topnav-nav-link dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="nav-link-icon">
<%= render BlockScoutWeb.IconsView, "_apps_icon.html" %>
</span>
<%= if Application.get_env(:block_scout_web, :apps_menu) == true do %>
<%= if apps_menu == true do %>
<%= gettext("Apps") %>
<% else %>
<%= gettext("Stakes") %>
<% end %>
</a>
<div class="dropdown-menu" aria-labeledby="navbarAppsDropdown">
<%= if Application.get_env(:block_scout_web, BlockScoutWeb.Chain)[:staking_enabled] do %>
<%= if staking_enabled_in_menu do %>
<a class="dropdown-item <%= #{tab_status("validators", @conn.request_path)} %>" href="<%= validators_path(@conn, :index) %>">
<%= gettext("Staking") %>
<span class="bs-label secondary right from-dropdown">New</span>
</a>
<% end %>
<%= if Application.get_env(:block_scout_web, :apps_menu) == true do %>
<%= if apps_menu == true do %>
<%= for %{url: url, title: title} <- external_apps_list() do %>
<a href="<%= url %>" class="dropdown-item" target="_blank"><%= title %>
<span class="external-link-icon">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@
window.onload = applyDarkMode()
</script>
<div class="layout-container">
<% show_maintenance_alert = Application.get_env(:block_scout_web, BlockScoutWeb.Chain)[:show_maintenance_alert] %>
<%= if show_maintenance_alert do %>
<div class="alert alert-warning text-center mb-0 p-3" data-selector="indexed-status">
<%= System.get_env("MAINTENANCE_ALERT_MESSAGE") %>
</div>
<% end %>
<%= if not Explorer.Chain.finished_indexing?() do %>
<div class="alert alert-warning text-center mb-0 p-3" data-selector="indexed-status">
<span class="loading-spinner-small mr-2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
</button>
<span style="font-size: 1.3em;">
<i style="color: #f7b32b;" class="fa fa-info-circle ml-1"></i>
Due to high load volumes, current staking data display may lag behind actual transactions. Transactions are being processed correctly on-chain. We are currently working to address this UI display issue.
<%= if @message do %>
<%= "#{@message}" %>
<% else %>
Due to high load volumes, current staking data display may lag behind actual transactions. Transactions are being processed correctly on-chain. We are currently working to address this UI display issue.
<% end %>
</span>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
<%= raw(@top) %>
</div>
<%= render BlockScoutWeb.StakesView, "_learn-more.html", conn: @conn %>
<%= # render BlockScoutWeb.StakesView, "_warning.html", conn: @conn %>
<%= if Application.get_env(:block_scout_web, BlockScoutWeb.Chain)[:show_staking_warning] do %>
<%= render BlockScoutWeb.StakesView, "_warning.html", conn: @conn, message: System.get_env("STAKING_WARNING_MESSAGE", nil) %>
<% end %>
<section data-page="stakes" class="container" data-refresh-interval="<%= @refresh_interval %>">
<div class="card" data-async-load data-async-listing="<%= @current_path %>" data-no-first-loading>
<%= render BlockScoutWeb.StakesView, "_stakes_tabs.html", conn: @conn %>
Expand Down

0 comments on commit 9cd0fcb

Please sign in to comment.