fix format of internal node URLs in master UI templates
This commit is contained in:
@@ -1,11 +1,13 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<title>SeaweedFS {{ .Version }}</title>
|
<title>SeaweedFS {{ .Version }}</title>
|
||||||
<link rel="stylesheet" href="/seaweedfsstatic/bootstrap/3.3.1/css/bootstrap.min.css">
|
<link rel="stylesheet" href="/seaweedfsstatic/bootstrap/3.3.1/css/bootstrap.min.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h1>
|
<h1>
|
||||||
<a href="https://github.com/seaweedfs/seaweedfs"><img src="/seaweedfsstatic/seaweed50x50.png"></img></a>
|
<a href="https://github.com/seaweedfs/seaweedfs"><img src="/seaweedfsstatic/seaweed50x50.png"></img></a>
|
||||||
@@ -33,14 +35,14 @@
|
|||||||
{{ with .RaftServer }}
|
{{ with .RaftServer }}
|
||||||
<tr>
|
<tr>
|
||||||
<th>Leader</th>
|
<th>Leader</th>
|
||||||
<td><a href="http://{{ .Leader }}">{{ .Leader }}</a></td>
|
<td><a href="{{ url .Leader }}">{{ .Leader }}</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Other Masters</th>
|
<th>Other Masters</th>
|
||||||
<td class="col-sm-5">
|
<td class="col-sm-5">
|
||||||
<ul class="list-unstyled">
|
<ul class="list-unstyled">
|
||||||
{{ range $k, $p := .GetConfiguration.Configuration.Servers }}
|
{{ range $k, $p := .GetConfiguration.Configuration.Servers }}
|
||||||
<li><a href="http://{{ $p.ID }}/ui/index.html">{{ $p.ID }}</a></li>
|
<li><a href="{{ url $p.ID }}/ui/index.html">{{ $p.ID }}</a></li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
@@ -99,9 +101,9 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><code>{{ $dc.Id }}</code></td>
|
<td><code>{{ $dc.Id }}</code></td>
|
||||||
<td>{{ $rack.Id }}</td>
|
<td>{{ $rack.Id }}</td>
|
||||||
<td><a href="http://{{ $dn.Url }}/ui/index.html">{{ $dn.Url }}</a>
|
<td><a href="{{ url $dn.Url }}/ui/index.html">{{ $dn.Url }}</a>
|
||||||
{{ if ne $dn.PublicUrl $dn.Url }}
|
{{ if ne $dn.PublicUrl $dn.Url }}
|
||||||
/ <a href="http://{{ $dn.PublicUrl }}/ui/index.html">{{ $dn.PublicUrl }}</a>
|
/ <a href="{{ url $dn.PublicUrl }}/ui/index.html">{{ $dn.PublicUrl }}</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</td>
|
</td>
|
||||||
<td>{{ $dn.Volumes }}</td>
|
<td>{{ $dn.Volumes }}</td>
|
||||||
@@ -116,6 +118,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -4,6 +4,8 @@ import (
|
|||||||
_ "embed"
|
_ "embed"
|
||||||
"html/template"
|
"html/template"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/seaweedfs/seaweedfs/weed/pb"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed master.html
|
//go:embed master.html
|
||||||
@@ -16,7 +18,7 @@ var templateFunctions = template.FuncMap{
|
|||||||
"url": func(input string) string {
|
"url": func(input string) string {
|
||||||
|
|
||||||
if !strings.HasPrefix(input, "http://") && !strings.HasPrefix(input, "https://") {
|
if !strings.HasPrefix(input, "http://") && !strings.HasPrefix(input, "https://") {
|
||||||
return "http://" + input
|
return "http://" + pb.ServerAddress(input).ToHttpAddress()
|
||||||
}
|
}
|
||||||
|
|
||||||
return input
|
return input
|
||||||
@@ -25,4 +27,4 @@ var templateFunctions = template.FuncMap{
|
|||||||
|
|
||||||
var StatusTpl = template.Must(template.New("status").Funcs(templateFunctions).Parse(masterHtml))
|
var StatusTpl = template.Must(template.New("status").Funcs(templateFunctions).Parse(masterHtml))
|
||||||
|
|
||||||
var StatusNewRaftTpl = template.Must(template.New("status").Parse(masterNewRaftHtml))
|
var StatusNewRaftTpl = template.Must(template.New("status").Funcs(templateFunctions).Parse(masterNewRaftHtml))
|
||||||
|
|||||||
Reference in New Issue
Block a user