forked from near/nearcore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create epoch info debug page to show validators (near#6514)
### Description This PR adds the skeleton of the epoch info debug page , and fills in the information of account IDs of the validators, as the first step. ### JIRA Issue [CP-20](https://nearinc.atlassian.net/browse/CP-20) ### Test plan - Build with make neard - Under `nearcore` directory, launch localnet using command `nearup stop && nearup run localnet --binary-path ./target/release` - Open your browser and go to http://[host_address]:3030/debug/ - Expect to see the link "Epoch Info" - Click the link "Epoch Info" - Expect to see a webpage that looks similar to the one below - Go back to http://[host_address]:3030/debug/ - Make sure other links aren't broken, either ### Screenshot on localnet <img width="1512" alt="Screen Shot 2022-04-07 at 2 22 19 PM" src="https://user-images.githubusercontent.com/98097537/162317831-7e28d7f8-334c-4113-b155-b0c1a219a4d3.png"> ### First round reviewer - @mzhangmzz - @mm-near
- Loading branch information
Showing
5 changed files
with
139 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<html> | ||
<head> | ||
<style> | ||
table { | ||
width: 100%; | ||
border-collapse: collapse; | ||
} | ||
|
||
table, | ||
th, | ||
td { | ||
border: 1px solid black; | ||
} | ||
|
||
td { | ||
text-align: left; | ||
vertical-align: top; | ||
padding: 8px; | ||
} | ||
|
||
th { | ||
text-align: center; | ||
vertical-align: center; | ||
padding: 8px; | ||
background-color: lightgrey; | ||
} | ||
|
||
tr.active { | ||
background-color: #eff8bf; | ||
} | ||
</style> | ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> | ||
<script> | ||
$(document).ready(() => { | ||
$('span').text("Loading..."); | ||
$.ajax({ | ||
type: "GET", | ||
url: "/debug/api/status", | ||
success: data => { | ||
let epoch_info = data.detailed_debug_status.epoch_info; | ||
$('.js-epoch-id').text(epoch_info.epoch_id); | ||
$('.js-epoch-height').text(epoch_info.height); | ||
$('.js-epoch-first-block-hash').text(epoch_info.first_block_hash); | ||
$('.js-epoch-start-time').text(epoch_info.start_time); | ||
epoch_info.validators.forEach((validator, index) => | ||
$('.js-tbody-validators').append($('<tr>') | ||
.append($('<td>').append(validator.account_id)) | ||
) | ||
); | ||
}, | ||
dataType: "json", | ||
error: function (errMsg, textStatus, errorThrown) { | ||
alert("Failed: " + textStatus + " :" + errorThrown); | ||
}, | ||
contentType: "application/json; charset=utf-8", | ||
}) | ||
|
||
}); | ||
</script> | ||
</head> | ||
<body> | ||
<h1> | ||
Welcome to the Epoch Status page! | ||
</h1> | ||
<h2> | ||
<p> | ||
Current Epoch ID: | ||
<span class="js-epoch-id"></span> | ||
</p> | ||
<p> | ||
First block hash: | ||
<span class="js-epoch-first-block-hash"></span> | ||
</p> | ||
<p> | ||
Height at: | ||
<span class="js-epoch-height"></span> | ||
</p> | ||
<p> | ||
Started at: | ||
<span class="js-epoch-start-time"></span> | ||
</p> | ||
<p> | ||
Validators | ||
</p> | ||
</h2> | ||
|
||
<table> | ||
<thead><tr> | ||
<th>Account ID</th> | ||
</tr></thead> | ||
<tbody class="js-tbody-validators"> | ||
</tbody> | ||
</table> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters