mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-08-25 01:47:24 +08:00
add breadcrumb to filer UI
This commit is contained in:
parent
a01557f4cb
commit
f8776ad5cd
@ -34,9 +34,11 @@ func (fs *FilerServer) registerHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
entry := &filer2.Entry{
|
entry := &filer2.Entry{
|
||||||
FullPath: filer2.FullPath(path),
|
FullPath: filer2.FullPath(path),
|
||||||
Attr: filer2.Attr{
|
Attr: filer2.Attr{
|
||||||
Mode: 0660,
|
Mode: 0660,
|
||||||
Uid: uint32(uid),
|
Crtime: time.Now(),
|
||||||
Gid: uint32(gid),
|
Mtime: time.Now(),
|
||||||
|
Uid: uint32(uid),
|
||||||
|
Gid: uint32(gid),
|
||||||
},
|
},
|
||||||
Chunks: []*filer_pb.FileChunk{{
|
Chunks: []*filer_pb.FileChunk{{
|
||||||
FileId: fileId,
|
FileId: fileId,
|
||||||
|
@ -52,12 +52,14 @@ func (fs *FilerServer) listDirectoryHandler(w http.ResponseWriter, r *http.Reque
|
|||||||
|
|
||||||
args := struct {
|
args := struct {
|
||||||
Path string
|
Path string
|
||||||
|
Breadcrumbs []ui.Breadcrumb
|
||||||
Entries interface{}
|
Entries interface{}
|
||||||
Limit int
|
Limit int
|
||||||
LastFileName string
|
LastFileName string
|
||||||
ShouldDisplayLoadMore bool
|
ShouldDisplayLoadMore bool
|
||||||
}{
|
}{
|
||||||
path,
|
path,
|
||||||
|
ui.ToBreadcrumb(path),
|
||||||
entries,
|
entries,
|
||||||
limit,
|
limit,
|
||||||
lastFileName,
|
lastFileName,
|
||||||
|
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>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{{.Path}}
|
{{ range $entry := .Breadcrumbs }}
|
||||||
|
<a href={{ $entry.Link }} >
|
||||||
|
{{ $entry.Name }}
|
||||||
|
</a>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
Loading…
Reference in New Issue
Block a user