2021-04-22 21:21:11 +00:00
|
|
|
package filer_ui
|
2016-07-18 08:28:24 +00:00
|
|
|
|
|
|
|
import (
|
2021-07-05 10:09:44 +00:00
|
|
|
_ "embed"
|
2018-08-11 06:47:31 +00:00
|
|
|
"github.com/dustin/go-humanize"
|
2018-08-12 21:27:14 +00:00
|
|
|
"html/template"
|
2020-09-11 02:46:00 +00:00
|
|
|
"net/url"
|
|
|
|
"strings"
|
2016-07-18 08:28:24 +00:00
|
|
|
)
|
|
|
|
|
2020-09-11 02:46:00 +00:00
|
|
|
func printpath(parts ...string) string {
|
|
|
|
concat := strings.Join(parts, "")
|
|
|
|
escaped := url.PathEscape(concat)
|
|
|
|
return strings.ReplaceAll(escaped, "%2F", "/")
|
|
|
|
}
|
|
|
|
|
2018-08-11 06:47:31 +00:00
|
|
|
var funcMap = template.FuncMap{
|
|
|
|
"humanizeBytes": humanize.Bytes,
|
2020-09-11 02:46:00 +00:00
|
|
|
"printpath": printpath,
|
2018-08-11 06:47:31 +00:00
|
|
|
}
|
|
|
|
|
2021-07-05 10:09:44 +00:00
|
|
|
//go:embed filer.html
|
|
|
|
var filerHtml string
|
2018-08-20 01:42:40 +00:00
|
|
|
|
2021-07-05 10:09:44 +00:00
|
|
|
var StatusTpl = template.Must(template.New("status").Funcs(funcMap).Parse(filerHtml))
|