mirror of
https://github.com/astaxie/beego.git
synced 2024-11-01 02:20:55 +00:00
356 lines
12 KiB
Go
356 lines
12 KiB
Go
// Copyright 2014 beego Author. All Rights Reserved.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
package beego
|
|
|
|
var indexTpl = `
|
|
{{define "content"}}
|
|
<h1>Beego Admin Dashboard</h1>
|
|
<p>
|
|
For detail usage please check our document:
|
|
</p>
|
|
<p>
|
|
<a target="_blank" href="http://beego.me/docs/module/toolbox.md">Toolbox</a>
|
|
</p>
|
|
<p>
|
|
<a target="_blank" href="http://beego.me/docs/advantage/monitor.md">Live Monitor</a>
|
|
</p>
|
|
{{.Content}}
|
|
{{end}}`
|
|
|
|
var profillingTpl = `
|
|
{{define "content"}}
|
|
<h1>{{.Title}}</h1>
|
|
<pre id="content">
|
|
<div>{{.Content}}</div>
|
|
</pre>
|
|
{{end}}`
|
|
|
|
var defaultScriptsTpl = ``
|
|
|
|
var gcAjaxTpl = `
|
|
{{define "scripts"}}
|
|
<script type="text/javascript">
|
|
var app = app || {};
|
|
(function() {
|
|
app.$el = $('#content');
|
|
app.getGc = function() {
|
|
var that = this;
|
|
$.ajax("/prof?command=gc%20summary&format=json").done(function(data) {
|
|
that.$el.append($('<p>' + data.Content + '</p>'));
|
|
});
|
|
};
|
|
$(document).ready(function() {
|
|
setInterval(function() {
|
|
app.getGc();
|
|
}, 3000);
|
|
});
|
|
})();
|
|
</script>
|
|
{{end}}
|
|
`
|
|
|
|
var qpsTpl = `{{define "content"}}
|
|
<h1>Requests statistics</h1>
|
|
<table class="table table-striped table-hover ">
|
|
<thead>
|
|
<tr>
|
|
{{range .Content.Fields}}
|
|
<th>
|
|
{{.}}
|
|
</th>
|
|
{{end}}
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
{{range $i, $elem := .Content.Data}}
|
|
|
|
<tr>
|
|
{{range $elem}}
|
|
<td>
|
|
{{.}}
|
|
</td>
|
|
{{end}}
|
|
</tr>
|
|
|
|
{{end}}
|
|
</tbody>
|
|
|
|
</table>
|
|
{{end}}`
|
|
|
|
var configTpl = `
|
|
{{define "content"}}
|
|
<h1>Configurations</h1>
|
|
<pre>
|
|
{{range $index, $elem := .Content}}
|
|
{{$index}}={{$elem}}
|
|
{{end}}
|
|
</pre>
|
|
{{end}}
|
|
`
|
|
|
|
var routerAndFilterTpl = `{{define "content"}}
|
|
|
|
|
|
<h1>{{.Title}}</h1>
|
|
|
|
{{range .Content.Methods}}
|
|
|
|
<div class="panel panel-default">
|
|
<div class="panel-heading lead success"><strong>{{.}}</strong></div>
|
|
<div class="panel-body">
|
|
<table class="table table-striped table-hover ">
|
|
<thead>
|
|
<tr>
|
|
{{range $.Content.Fields}}
|
|
<th>
|
|
{{.}}
|
|
</th>
|
|
{{end}}
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
{{$slice := index $.Content.Data .}}
|
|
{{range $i, $elem := $slice}}
|
|
|
|
<tr>
|
|
{{range $elem}}
|
|
<td>
|
|
{{.}}
|
|
</td>
|
|
{{end}}
|
|
</tr>
|
|
|
|
{{end}}
|
|
</tbody>
|
|
|
|
</table>
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
|
|
|
|
{{end}}`
|
|
|
|
var tasksTpl = `{{define "content"}}
|
|
|
|
<h1>{{.Title}}</h1>
|
|
|
|
{{if .Message }}
|
|
{{ $messageType := index .Message 0}}
|
|
<p class="message
|
|
{{if eq "error" $messageType}}
|
|
bg-danger
|
|
{{else if eq "success" $messageType}}
|
|
bg-success
|
|
{{else}}
|
|
bg-warning
|
|
{{end}}
|
|
">
|
|
{{index .Message 1}}
|
|
</p>
|
|
{{end}}
|
|
|
|
|
|
<table class="table table-striped table-hover ">
|
|
<thead>
|
|
<tr>
|
|
{{range .Content.Fields}}
|
|
<th>
|
|
{{.}}
|
|
</th>
|
|
{{end}}
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
{{range $i, $slice := .Content.Data}}
|
|
<tr>
|
|
{{range $slice}}
|
|
<td>
|
|
{{.}}
|
|
</td>
|
|
{{end}}
|
|
<td>
|
|
<a class="btn btn-primary btn-sm" href="/task?taskname={{index $slice 0}}">Run</a>
|
|
</td>
|
|
</tr>
|
|
{{end}}
|
|
</tbody>
|
|
</table>
|
|
|
|
{{end}}`
|
|
|
|
var healthCheckTpl = `
|
|
{{define "content"}}
|
|
|
|
<h1>{{.Title}}</h1>
|
|
<table class="table table-striped table-hover ">
|
|
<thead>
|
|
<tr>
|
|
{{range .Content.Fields}}
|
|
<th>
|
|
{{.}}
|
|
</th>
|
|
{{end}}
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{range $i, $slice := .Content.Data}}
|
|
{{ $header := index $slice 0}}
|
|
{{ if eq "success" $header}}
|
|
<tr class="success">
|
|
{{else if eq "error" $header}}
|
|
<tr class="danger">
|
|
{{else}}
|
|
<tr>
|
|
{{end}}
|
|
{{range $j, $elem := $slice}}
|
|
{{if ne $j 0}}
|
|
<td>
|
|
{{$elem}}
|
|
</td>
|
|
{{end}}
|
|
{{end}}
|
|
<td>
|
|
{{$header}}
|
|
</td>
|
|
</tr>
|
|
{{end}}
|
|
|
|
</tbody>
|
|
</table>
|
|
{{end}}`
|
|
|
|
// The base dashboardTpl
|
|
var dashboardTpl = `
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<!-- Meta, title, CSS, favicons, etc. -->
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
<title>
|
|
|
|
Welcome to Beego Admin Dashboard
|
|
|
|
</title>
|
|
|
|
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
|
|
<link href="//cdn.datatables.net/plug-ins/725b2a2115b/integration/bootstrap/3/dataTables.bootstrap.css" rel="stylesheet">
|
|
|
|
<style type="text/css">
|
|
ul.nav li.dropdown:hover > ul.dropdown-menu {
|
|
display: block;
|
|
}
|
|
#logo {
|
|
width: 102px;
|
|
height: 32px;
|
|
margin-top: 5px;
|
|
}
|
|
.message {
|
|
padding: 15px;
|
|
}
|
|
</style>
|
|
|
|
</head>
|
|
<body>
|
|
|
|
<header class="navbar navbar-default navbar-static-top bs-docs-nav" id="top" role="banner">
|
|
<div class="container">
|
|
<div class="navbar-header">
|
|
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".bs-navbar-collapse">
|
|
<span class="sr-only">Toggle navigation</span>
|
|
<span class="icon-bar"></span>
|
|
<span class="icon-bar"></span>
|
|
<span class="icon-bar"></span>
|
|
</button>
|
|
|
|
<a href="/">
|
|
<img id="logo" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPYAAABNCAYAAACVH5l+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAV/QAAFf0BzXBRYQAAABZ0RVh0Q3JlYXRpb24gVGltZQAxMi8xMy8xM+ovEHIAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzbovLKMAAAQAklEQVR4nO2de7RcVXnAfzM3MckmhLdKtZYqoimtERVtXSjFNvYE6rsnFMFKy2MJC4tGdNECalFsKxRQ5GGDClUjzS6lltcuUmiryxRqFaEaCkgVqAkSakKSneTm3rn949uHOTNzzp1zZs5j7mT/1pqVmzMze39z73xnf/vb36OBx+OZFRuEvwusBp4fu7wROE0ZfUs9UiUzMzMDQLNmOTyeucB1dCo17v/XVS5JRrxiezz9OSDn9drxiu3xjCFesT2eMcQrtsczh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q92IbUAizceVlVyt3d1HzUMCDPYQ6k/jkGltW176ni7zMDnKmMLj1xxGVEbSL56CspvqJwXE+x99LZ1jceYWbK6rJSRfmYrwCnj1LvpJwkOX9GlYFlVUbfaIPwTMrrnNFClPrOksZPIjr26o7w6vneu7iLw5Fwz+cjyr8L6a+13Y21M/bvM4iDbguy8u6I96x2EWbnIFZQd+XRGUpwmMUpU7HvB853SQJzmSq/iMMylKzK6KttED6OpEKmmeWD8CPk5n5XgWNmIR47HhHV6wbABuEBiH/hWOB5iEJHCSTx9yTRMa4NwvhcDcSK6h5nBvGLfFUZvTHn58lMkYq9EcnoWgfcrIxeV+DYdfAYcIky+u66BclAYbIqo2+xQfgSxIRcARyBKHme78pOYAPwbaSlk46vZhUSrdjdit10ZvJKZA+8P+JU617ZI9KuZ6F77hYS0164wyzOMAJ7PCONDcKPIllUcV/SDHLjsUhySJNOPYgfRQ1L92rdcvOeX9aWZGZGRJ9rJVo9njx0r9iRib0QyWOIVzft7tZZBN2r9W7gX6rwM3jF9owzu+hVLkhW3CRPfZqC57V0W4hS/w9QST82r9ieccaSrIRpjrG4uRx15ZhAzPXoEa360f+hM6Ksm0kko3E98Lm8zfUGxSu2Z5x5Glkp59OrdElm8n8jOd3fUUYnJcYk4o62FrrHXu6hEP2yyNHYJhcvUAlesT3jzEbkDHoJnUdYcZN8J3IcN3BIrvP4b3OPTcMIXBResT3jzONIqaGFtE3qiB3AD5AAqnUul3ts8IrtGWc2IDHw5yAtdOYjoZzfRRoN3FdGnPYo4M+xPWONK2C4H+1FbArYXFPATOlE59j/D6WId7YitGZUAAAAAElFTkSuQmCC"/>
|
|
</a>
|
|
|
|
</div>
|
|
<nav class="collapse navbar-collapse bs-navbar-collapse" role="navigation">
|
|
<ul class="nav navbar-nav">
|
|
<li>
|
|
<a href="/qps">
|
|
Requests statistics
|
|
</a>
|
|
</li>
|
|
<li>
|
|
|
|
<li class="dropdown">
|
|
<a href="#" class="dropdown-toggle disabled" data-toggle="dropdown">Performance profiling<span class="caret"></span></a>
|
|
<ul class="dropdown-menu" role="menu">
|
|
|
|
<li><a href="/prof?command=lookup goroutine">lookup goroutine</a></li>
|
|
<li><a href="/prof?command=lookup heap">lookup heap</a></li>
|
|
<li><a href="/prof?command=lookup threadcreate">lookup threadcreate</a></li>
|
|
<li><a href="/prof?command=lookup block">lookup block</a></li>
|
|
<li><a href="/prof?command=get cpuprof">get cpuprof</a></li>
|
|
<li><a href="/prof?command=get memprof">get memprof</a></li>
|
|
<li><a href="/prof?command=gc summary">gc summary</a></li>
|
|
|
|
</ul>
|
|
</li>
|
|
|
|
<li>
|
|
<a href="/healthcheck">
|
|
Healthcheck
|
|
</a>
|
|
</li>
|
|
|
|
<li>
|
|
<a href="/task" class="dropdown-toggle disabled" data-toggle="dropdown">Tasks</a>
|
|
</li>
|
|
|
|
<li class="dropdown">
|
|
<a href="#" class="dropdown-toggle disabled" data-toggle="dropdown">Config Status<span class="caret"></span></a>
|
|
<ul class="dropdown-menu" role="menu">
|
|
<li><a href="/listconf?command=conf">Configs</a></li>
|
|
<li><a href="/listconf?command=router">Routers</a></li>
|
|
<li><a href="/listconf?command=filter">Filters</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</nav>
|
|
</div>
|
|
</header>
|
|
|
|
<div class="container">
|
|
{{template "content" .}}
|
|
</div>
|
|
|
|
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
|
|
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
|
|
<script src="//cdn.datatables.net/1.10.2/js/jquery.dataTables.min.js"></script>
|
|
<script src="//cdn.datatables.net/plug-ins/725b2a2115b/integration/bootstrap/3/dataTables.bootstrap.js
|
|
"></script>
|
|
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
$('.table').dataTable();
|
|
});
|
|
</script>
|
|
{{template "scripts" .}}
|
|
</body>
|
|
</html>
|
|
`
|