|
|
@ -2,13 +2,48 @@ package master_ui |
|
|
|
|
|
|
|
import ( |
|
|
|
"html/template" |
|
|
|
"strconv" |
|
|
|
"strings" |
|
|
|
) |
|
|
|
|
|
|
|
var StatusTpl = template.Must(template.New("status").Parse(`<!DOCTYPE html> |
|
|
|
func join(data []int64) string { |
|
|
|
var ret []string |
|
|
|
for _, d := range data { |
|
|
|
ret = append(ret, strconv.Itoa(int(d))) |
|
|
|
} |
|
|
|
return strings.Join(ret, ",") |
|
|
|
} |
|
|
|
|
|
|
|
var funcMap = template.FuncMap{ |
|
|
|
"join": join, |
|
|
|
} |
|
|
|
|
|
|
|
var StatusTpl = template.Must(template.New("status").Funcs(funcMap).Parse(`<!DOCTYPE html> |
|
|
|
<html> |
|
|
|
<head> |
|
|
|
<title>Seaweed File System {{ .Version }}</title> |
|
|
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"> |
|
|
|
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.3.min.js"></script> |
|
|
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-sparklines/2.1.2/jquery.sparkline.min.js"></script> |
|
|
|
<script type="text/javascript"> |
|
|
|
$(function() { |
|
|
|
var periods = ['second', 'minute', 'hour', 'day']; |
|
|
|
for (i = 0; i < periods.length; i++) { |
|
|
|
var period = periods[i]; |
|
|
|
$('.inlinesparkline-'+period).sparkline('html', { |
|
|
|
type: 'line', |
|
|
|
barColor: 'red', |
|
|
|
tooltipSuffix:' request per '+period, |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
</script> |
|
|
|
<style> |
|
|
|
#jqstooltip{ |
|
|
|
height: 28px !important; |
|
|
|
width: 150px !important; |
|
|
|
} |
|
|
|
</style> |
|
|
|
</head> |
|
|
|
<body> |
|
|
|
<div class="container"> |
|
|
@ -23,7 +58,7 @@ var StatusTpl = template.Must(template.New("status").Parse(`<!DOCTYPE html> |
|
|
|
{{ range .DiskStatuses }} |
|
|
|
<tr> |
|
|
|
<th>{{ .Dir }}</th> |
|
|
|
<td>{{ .Free }}</td> |
|
|
|
<td>{{ .Free }} Bytes Free</td> |
|
|
|
</tr> |
|
|
|
{{ end }} |
|
|
|
</table> |
|
|
@ -36,6 +71,22 @@ var StatusTpl = template.Must(template.New("status").Parse(`<!DOCTYPE html> |
|
|
|
<th>Master</th> |
|
|
|
<td><a href="http://{{.Master}}/ui/index.html">{{.Master}}</a></td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<th>Weekly # ReadRequests</th> |
|
|
|
<td><span class="inlinesparkline-day">{{ .Counters.ReadRequests.WeekCounter.ToList | join }}</span></td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<th>Daily # ReadRequests</th> |
|
|
|
<td><span class="inlinesparkline-hour">{{ .Counters.ReadRequests.DayCounter.ToList | join }}</span></td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<th>Hourly # ReadRequests</th> |
|
|
|
<td><span class="inlinesparkline-minute">{{ .Counters.ReadRequests.HourCounter.ToList | join }}</span></td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<th>Last Minute # ReadRequests</th> |
|
|
|
<td><span class="inlinesparkline-second">{{ .Counters.ReadRequests.MinuteCounter.ToList | join }}</span></td> |
|
|
|
</tr> |
|
|
|
{{ range $key, $val := .Stats }} |
|
|
|
<tr> |
|
|
|
<th>{{ $key }}</th> |
|
|
@ -52,6 +103,7 @@ var StatusTpl = template.Must(template.New("status").Parse(`<!DOCTYPE html> |
|
|
|
<thead> |
|
|
|
<tr> |
|
|
|
<th>Id</th> |
|
|
|
<th>Collection</th> |
|
|
|
<th>Size</th> |
|
|
|
<th>Files</th> |
|
|
|
<th>Trash</th> |
|
|
@ -62,7 +114,8 @@ var StatusTpl = template.Must(template.New("status").Parse(`<!DOCTYPE html> |
|
|
|
{{ range .Volumes }} |
|
|
|
<tr> |
|
|
|
<td><code>{{ .Id }}</code></td> |
|
|
|
<td>{{ .Size }}</td> |
|
|
|
<td>{{ .Collection }}</td> |
|
|
|
<td>{{ .Size }} Bytes</td> |
|
|
|
<td>{{ .FileCount }}</td> |
|
|
|
<td>{{ .DeleteCount }} / {{.DeletedByteCount}} Bytes</td> |
|
|
|
<td>{{ .Ttl }}</td> |
|
|
|