Use a proper type for admin page search results.
This commit is contained in:
parent
4810802fa9
commit
7cb0ded1fe
@ -7,6 +7,7 @@ package webapi
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/decred/vspd/database"
|
||||
"github.com/decred/vspd/rpc"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gorilla/sessions"
|
||||
@ -26,6 +27,14 @@ type WalletStatus struct {
|
||||
BestBlockHeight int64 `json:"bestblockheight"`
|
||||
}
|
||||
|
||||
type searchResult struct {
|
||||
Hash string
|
||||
Found bool
|
||||
Ticket database.Ticket
|
||||
VoteChanges map[uint32]database.VoteChangeRecord
|
||||
MaxVoteChanges int
|
||||
}
|
||||
|
||||
func walletStatus(c *gin.Context) map[string]WalletStatus {
|
||||
walletClients := c.MustGet("WalletClients").([]*rpc.WalletRPC)
|
||||
failedWalletClients := c.MustGet("FailedWalletClients").([]string)
|
||||
@ -113,12 +122,12 @@ func ticketSearch(c *gin.Context) {
|
||||
}
|
||||
|
||||
c.HTML(http.StatusOK, "admin.html", gin.H{
|
||||
"SearchResult": gin.H{
|
||||
"Hash": hash,
|
||||
"Found": found,
|
||||
"Ticket": ticket,
|
||||
"VoteChanges": voteChanges,
|
||||
"MaxVoteChanges": cfg.MaxVoteChangeRecords,
|
||||
"SearchResult": searchResult{
|
||||
Hash: hash,
|
||||
Found: found,
|
||||
Ticket: ticket,
|
||||
VoteChanges: voteChanges,
|
||||
MaxVoteChanges: cfg.MaxVoteChangeRecords,
|
||||
},
|
||||
"VspStats": getVSPStats(),
|
||||
"WalletStatus": walletStatus(c),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user