mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-21 10:37:24 +08:00
add breadcrumb to filer UI
This commit is contained in:
24
weed/server/filer_ui/breadcrumb.go
Normal file
24
weed/server/filer_ui/breadcrumb.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package master_ui
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
type Breadcrumb struct {
|
||||
Name string
|
||||
Link string
|
||||
}
|
||||
|
||||
func ToBreadcrumb(fullpath string) (crumbs []Breadcrumb) {
|
||||
parts := strings.Split(fullpath, "/")
|
||||
|
||||
for i := 0; i < len(parts); i++ {
|
||||
crumbs = append(crumbs, Breadcrumb{
|
||||
Name: parts[i] + "/",
|
||||
Link: "/" + filepath.Join(parts[0:i+1]...),
|
||||
})
|
||||
}
|
||||
|
||||
return
|
||||
}
|
@@ -20,7 +20,12 @@ var StatusTpl = template.Must(template.New("status").Parse(`<!DOCTYPE html>
|
||||
</h1>
|
||||
</div>
|
||||
<div class="row">
|
||||
{{.Path}}
|
||||
{{ range $entry := .Breadcrumbs }}
|
||||
<a href={{ $entry.Link }} >
|
||||
{{ $entry.Name }}
|
||||
</a>
|
||||
{{ end }}
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
Reference in New Issue
Block a user