blob: d85eb247a14fd8164dba0692fa1afbc075a005f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
package volume_server_ui
import (
_ "embed"
"fmt"
"github.com/chrislusf/seaweedfs/weed/util"
"html/template"
"strconv"
"strings"
)
func percentFrom(total uint64, part_of uint64) string {
return fmt.Sprintf("%.2f", (float64(part_of)/float64(total))*100)
}
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,
"bytesToHumanReadable": util.BytesToHumanReadable,
"percentFrom": percentFrom,
"isNotEmpty": util.IsNotEmpty,
}
//go:embed volume.html
var volumeHtml string
var StatusTpl = template.Must(template.New("status").Funcs(funcMap).Parse(volumeHtml))
|