Browse Source

readable file size

pull/719/head
Chris Lu 7 years ago
parent
commit
b931ced0a3
  1. 9
      weed/server/filer_ui/templates.go

9
weed/server/filer_ui/templates.go

@ -2,9 +2,14 @@ package master_ui
import ( import (
"html/template" "html/template"
"github.com/dustin/go-humanize"
) )
var StatusTpl = template.Must(template.New("status").Parse(`<!DOCTYPE html>
var funcMap = template.FuncMap{
"humanizeBytes": humanize.Bytes,
}
var StatusTpl = template.Must(template.New("status").Funcs(funcMap).Parse(`<!DOCTYPE html>
<html> <html>
<head> <head>
<title>SeaweedFS Filer</title> <title>SeaweedFS Filer</title>
@ -54,7 +59,7 @@ var StatusTpl = template.Must(template.New("status").Parse(`<!DOCTYPE html>
<td align="right"> <td align="right">
{{if $entry.IsDirectory}} {{if $entry.IsDirectory}}
{{else}} {{else}}
{{ $entry.Size }} bytes
{{ $entry.Size | humanizeBytes }}
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
{{end}} {{end}}
</td> </td>

Loading…
Cancel
Save