mirror of
https://github.com/astaxie/beego.git
synced 2024-11-25 21:41:29 +00:00
beego: admin support link
This commit is contained in:
parent
1da37f6ce1
commit
9270a0504a
52
admin.go
52
admin.go
@ -9,6 +9,7 @@ package beego
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/toolbox"
|
||||
@ -53,15 +54,16 @@ func init() {
|
||||
// AdminIndex is the default http.Handler for admin module.
|
||||
// it matches url pattern "/".
|
||||
func adminIndex(rw http.ResponseWriter, r *http.Request) {
|
||||
rw.Write([]byte("Welcome to Admin Dashboard\n"))
|
||||
rw.Write([]byte("There are servral functions:\n"))
|
||||
rw.Write([]byte("1. Record all request and request time, <a href='/qps'>http://localhost:8088/qps</a>\n"))
|
||||
rw.Write([]byte("2. Get runtime profiling data by the pprof, <a href='/prof'>http://localhost:8088/prof</a>\n"))
|
||||
rw.Write([]byte("3. Get healthcheck result from <a href='/healthcheck'>http://localhost:8088/healthcheck</a>\n"))
|
||||
rw.Write([]byte("4. Get current task infomation from task <a href='/task'>http://localhost:8088/task</a> \n"))
|
||||
rw.Write([]byte("5. To run a task passed a param <a href='/runtask'>http://localhost:8088/runtask</a>\n"))
|
||||
rw.Write([]byte("6. Get all confige & router infomation <a href='/listconf'>http://localhost:8088/listconf</a>\n"))
|
||||
|
||||
rw.Write([]byte("<html><head><title>beego admin dashboard</title></head><body>"))
|
||||
rw.Write([]byte("Welcome to Admin Dashboard<br>\n"))
|
||||
rw.Write([]byte("There are servral functions:<br>\n"))
|
||||
rw.Write([]byte("1. Record all request and request time, <a href='/qps'>http://localhost:" + strconv.Itoa(AdminHttpPort) + "/qps</a><br>\n"))
|
||||
rw.Write([]byte("2. Get runtime profiling data by the pprof, <a href='/prof'>http://localhost:" + strconv.Itoa(AdminHttpPort) + "/prof</a><br>\n"))
|
||||
rw.Write([]byte("3. Get healthcheck result from <a href='/healthcheck'>http://localhost:" + strconv.Itoa(AdminHttpPort) + "/healthcheck</a><br>\n"))
|
||||
rw.Write([]byte("4. Get current task infomation from task <a href='/task'>http://localhost:" + strconv.Itoa(AdminHttpPort) + "/task</a><br> \n"))
|
||||
rw.Write([]byte("5. To run a task passed a param <a href='/runtask'>http://localhost:" + strconv.Itoa(AdminHttpPort) + "/runtask</a><br>\n"))
|
||||
rw.Write([]byte("6. Get all confige & router infomation <a href='/listconf'>http://localhost:" + strconv.Itoa(AdminHttpPort) + "/listconf</a><br>\n"))
|
||||
rw.Write([]byte("</body></html>"))
|
||||
}
|
||||
|
||||
// QpsIndex is the http.Handler for writing qbs statistics map result info in http.ResponseWriter.
|
||||
@ -180,10 +182,12 @@ func listConf(rw http.ResponseWriter, r *http.Request) {
|
||||
rw.Write([]byte("command not support"))
|
||||
}
|
||||
} else {
|
||||
rw.Write([]byte("ListConf support this command:\n"))
|
||||
rw.Write([]byte("1. command=conf\n"))
|
||||
rw.Write([]byte("2. command=router\n"))
|
||||
rw.Write([]byte("3. command=filter\n"))
|
||||
rw.Write([]byte("<html><head><title>beego admin dashboard</title></head><body>"))
|
||||
rw.Write([]byte("ListConf support this command:<br>\n"))
|
||||
rw.Write([]byte("1. <a href='?command=conf'>command=conf</a><br>\n"))
|
||||
rw.Write([]byte("2. <a href='?command=router'>command=router</a><br>\n"))
|
||||
rw.Write([]byte("3. <a href='?command=filter'>command=filter</a><br>\n"))
|
||||
rw.Write([]byte("</body></html>"))
|
||||
}
|
||||
}
|
||||
|
||||
@ -195,16 +199,18 @@ func profIndex(rw http.ResponseWriter, r *http.Request) {
|
||||
if command != "" {
|
||||
toolbox.ProcessInput(command, rw)
|
||||
} else {
|
||||
rw.Write([]byte("request url like '/prof?command=lookup goroutine'\n"))
|
||||
rw.Write([]byte("the command have below types:\n"))
|
||||
rw.Write([]byte("1. lookup goroutine\n"))
|
||||
rw.Write([]byte("2. lookup heap\n"))
|
||||
rw.Write([]byte("3. lookup threadcreate\n"))
|
||||
rw.Write([]byte("4. lookup block\n"))
|
||||
rw.Write([]byte("5. start cpuprof\n"))
|
||||
rw.Write([]byte("6. stop cpuprof\n"))
|
||||
rw.Write([]byte("7. get memprof\n"))
|
||||
rw.Write([]byte("8. gc summary\n"))
|
||||
rw.Write([]byte("<html><head><title>beego admin dashboard</title></head><body>"))
|
||||
rw.Write([]byte("request url like '/prof?command=lookup goroutine'<br>\n"))
|
||||
rw.Write([]byte("the command have below types:<br>\n"))
|
||||
rw.Write([]byte("1. <a href='?command=lookup goroutine'>lookup goroutine</a><br>\n"))
|
||||
rw.Write([]byte("2. <a href='?command=lookup heap'>lookup heap</a><br>\n"))
|
||||
rw.Write([]byte("3. <a href='?command=lookup threadcreate'>lookup threadcreate</a><br>\n"))
|
||||
rw.Write([]byte("4. <a href='?command=lookup block'>lookup block</a><br>\n"))
|
||||
rw.Write([]byte("5. <a href='?command=start cpuprof'>start cpuprof</a><br>\n"))
|
||||
rw.Write([]byte("6. <a href='?command=stop cpuprof'>stop cpuprof</a><br>\n"))
|
||||
rw.Write([]byte("7. <a href='?command=get memprof'>get memprof</a><br>\n"))
|
||||
rw.Write([]byte("8. <a href='?command=gc summary'>gc summary</a><br>\n"))
|
||||
rw.Write([]byte("</body></html>"))
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user