From 9270a0504a2956a74eda6b5d54600e6351d32904 Mon Sep 17 00:00:00 2001 From: astaxie Date: Sat, 17 May 2014 02:20:48 +0800 Subject: [PATCH] beego: admin support link --- admin.go | 52 +++++++++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/admin.go b/admin.go index ffaed11e..d908565d 100644 --- a/admin.go +++ b/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, http://localhost:8088/qps\n")) - rw.Write([]byte("2. Get runtime profiling data by the pprof, http://localhost:8088/prof\n")) - rw.Write([]byte("3. Get healthcheck result from http://localhost:8088/healthcheck\n")) - rw.Write([]byte("4. Get current task infomation from task http://localhost:8088/task \n")) - rw.Write([]byte("5. To run a task passed a param http://localhost:8088/runtask\n")) - rw.Write([]byte("6. Get all confige & router infomation http://localhost:8088/listconf\n")) - + rw.Write([]byte("beego admin dashboard")) + 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, http://localhost:" + strconv.Itoa(AdminHttpPort) + "/qps
\n")) + rw.Write([]byte("2. Get runtime profiling data by the pprof, http://localhost:" + strconv.Itoa(AdminHttpPort) + "/prof
\n")) + rw.Write([]byte("3. Get healthcheck result from http://localhost:" + strconv.Itoa(AdminHttpPort) + "/healthcheck
\n")) + rw.Write([]byte("4. Get current task infomation from task http://localhost:" + strconv.Itoa(AdminHttpPort) + "/task
\n")) + rw.Write([]byte("5. To run a task passed a param http://localhost:" + strconv.Itoa(AdminHttpPort) + "/runtask
\n")) + rw.Write([]byte("6. Get all confige & router infomation http://localhost:" + strconv.Itoa(AdminHttpPort) + "/listconf
\n")) + rw.Write([]byte("")) } // 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("beego admin dashboard")) + 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("")) } } @@ -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("beego admin dashboard")) + 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("")) } }