You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
752 B

10 years ago
10 years ago
10 years ago
  1. package volume_server_ui
  2. import (
  3. _ "embed"
  4. "fmt"
  5. "github.com/seaweedfs/seaweedfs/weed/util"
  6. "html/template"
  7. "strconv"
  8. "strings"
  9. )
  10. func percentFrom(total uint64, part_of uint64) string {
  11. return fmt.Sprintf("%.2f", (float64(part_of)/float64(total))*100)
  12. }
  13. func join(data []int64) string {
  14. var ret []string
  15. for _, d := range data {
  16. ret = append(ret, strconv.Itoa(int(d)))
  17. }
  18. return strings.Join(ret, ",")
  19. }
  20. var funcMap = template.FuncMap{
  21. "join": join,
  22. "bytesToHumanReadable": util.BytesToHumanReadable,
  23. "percentFrom": percentFrom,
  24. "isNotEmpty": util.IsNotEmpty,
  25. }
  26. //go:embed volume.html
  27. var volumeHtml string
  28. var StatusTpl = template.Must(template.New("status").Funcs(funcMap).Parse(volumeHtml))