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 (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/decred/vspd/database"
|
||||||
"github.com/decred/vspd/rpc"
|
"github.com/decred/vspd/rpc"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/gorilla/sessions"
|
"github.com/gorilla/sessions"
|
||||||
@ -26,6 +27,14 @@ type WalletStatus struct {
|
|||||||
BestBlockHeight int64 `json:"bestblockheight"`
|
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 {
|
func walletStatus(c *gin.Context) map[string]WalletStatus {
|
||||||
walletClients := c.MustGet("WalletClients").([]*rpc.WalletRPC)
|
walletClients := c.MustGet("WalletClients").([]*rpc.WalletRPC)
|
||||||
failedWalletClients := c.MustGet("FailedWalletClients").([]string)
|
failedWalletClients := c.MustGet("FailedWalletClients").([]string)
|
||||||
@ -113,12 +122,12 @@ func ticketSearch(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
c.HTML(http.StatusOK, "admin.html", gin.H{
|
c.HTML(http.StatusOK, "admin.html", gin.H{
|
||||||
"SearchResult": gin.H{
|
"SearchResult": searchResult{
|
||||||
"Hash": hash,
|
Hash: hash,
|
||||||
"Found": found,
|
Found: found,
|
||||||
"Ticket": ticket,
|
Ticket: ticket,
|
||||||
"VoteChanges": voteChanges,
|
VoteChanges: voteChanges,
|
||||||
"MaxVoteChanges": cfg.MaxVoteChangeRecords,
|
MaxVoteChanges: cfg.MaxVoteChangeRecords,
|
||||||
},
|
},
|
||||||
"VspStats": getVSPStats(),
|
"VspStats": getVSPStats(),
|
||||||
"WalletStatus": walletStatus(c),
|
"WalletStatus": walletStatus(c),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user