aboutsummaryrefslogtreecommitdiff
path: root/weed/server/filer_ui/templates.go
blob: f9ef064bc3ad886272373ab0ea67fb3e52dfba6c (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
package filer_ui

import (
	_ "embed"
	"github.com/dustin/go-humanize"
	"html/template"
	"net/url"
	"strings"
)

func printpath(parts ...string) string {
	concat := strings.Join(parts, "")
	escaped := url.PathEscape(concat)
	return strings.ReplaceAll(escaped, "%2F", "/")
}

var funcMap = template.FuncMap{
	"humanizeBytes": humanize.Bytes,
	"printpath":     printpath,
}

//go:embed filer.html
var filerHtml string

var StatusTpl = template.Must(template.New("status").Funcs(funcMap).Parse(filerHtml))