Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

add breadcrumb to filer UI

Chris Luf8776ad5cdda
diff --git a/weed/server/filer_server_handlers_admin.go b/weed/server/filer_server_handlers_admin.go
index 7f17f936db..01b18a76d1 100644
--- a/weed/server/filer_server_handlers_admin.go
+++ b/weed/server/filer_server_handlers_admin.go
@@ -34,9 +34,11 @@ func (fs *FilerServer) registerHandler(w http.ResponseWriter, r *http.Request) {
entry := &filer2.Entry{
FullPath: filer2.FullPath(path),
Attr: filer2.Attr{
- Mode: 0660,
- Uid: uint32(uid),
- Gid: uint32(gid),
+ Mode: 0660,
+ Crtime: time.Now(),
+ Mtime: time.Now(),
+ Uid: uint32(uid),
+ Gid: uint32(gid),
},
Chunks: []*filer_pb.FileChunk{{
FileId: fileId,
diff --git a/weed/server/filer_server_handlers_read.go b/weed/server/filer_server_handlers_read.go
index 52b7ba1777..7c479e18be 100644
--- a/weed/server/filer_server_handlers_read.go
+++ b/weed/server/filer_server_handlers_read.go
@@ -52,12 +52,14 @@ func (fs *FilerServer) listDirectoryHandler(w http.ResponseWriter, r *http.Reque
args := struct {
Path string
+ Breadcrumbs []ui.Breadcrumb
Entries interface{}
Limit int
LastFileName string
ShouldDisplayLoadMore bool
}{
path,
+ ui.ToBreadcrumb(path),
entries,
limit,
lastFileName,
diff --git a/weed/server/filer_ui/breadcrumb.go b/weed/server/filer_ui/breadcrumb.go
new file mode 100644
index 0000000000..146b6c6c4c
--- /dev/null
+++ b/weed/server/filer_ui/breadcrumb.go
@@ -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
+}
diff --git a/weed/server/filer_ui/templates.go b/weed/server/filer_ui/templates.go
index 5e901cd682..d5c42672e4 100644
--- a/weed/server/filer_ui/templates.go
+++ b/weed/server/filer_ui/templates.go
@@ -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">