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

import (
	_ "embed"
	"html/template"
	"strings"
)

//go:embed master.html
var masterHtml string

//go:embed masterNewRaft.html
var masterNewRaftHtml string

var templateFunctions = template.FuncMap{
	"url": func(input string) string {

		if !strings.HasPrefix(input, "http://") && !strings.HasPrefix(input, "https://") {
			return "http://" + input
		}

		return input
	},
}

var StatusTpl = template.Must(template.New("status").Funcs(templateFunctions).Parse(masterHtml))

var StatusNewRaftTpl = template.Must(template.New("status").Parse(masterNewRaftHtml))