diff --git a/weed/filer2/filer_structure.go b/weed/filer2/filer_structure.go index 5e5382d35..c732d9230 100644 --- a/weed/filer2/filer_structure.go +++ b/weed/filer2/filer_structure.go @@ -55,6 +55,18 @@ type Entry struct { Chunks []*filer_pb.FileChunk `json:"chunks,omitempty"` } +func (entry Entry) Size() uint64 { + return TotalSize(entry.Chunks) +} + +func (entry Entry) Timestamp() time.Time { + if entry.IsDirectory() { + return entry.Crtime + } else { + return entry.Mtime + } +} + type AbstractFiler interface { CreateEntry(*Entry) (error) AppendFileChunk(FullPath, []*filer_pb.FileChunk) (err error) diff --git a/weed/server/filer_grpc_server.go b/weed/server/filer_grpc_server.go index 7fba6a7ce..050785be2 100644 --- a/weed/server/filer_grpc_server.go +++ b/weed/server/filer_grpc_server.go @@ -46,7 +46,7 @@ func (fs *FilerServer) ListEntries(ctx context.Context, req *filer_pb.ListEntrie IsDirectory: entry.IsDirectory(), Chunks: entry.Chunks, Attributes: &filer_pb.FuseAttributes{ - FileSize: filer2.TotalSize(entry.Chunks), + FileSize: entry.Size(), Mtime: entry.Mtime.Unix(), Gid: entry.Gid, Uid: entry.Uid, @@ -73,7 +73,7 @@ func (fs *FilerServer) GetEntryAttributes(ctx context.Context, req *filer_pb.Get return nil, fmt.Errorf("file %s not found", fullpath) } - attributes.FileSize = filer2.TotalSize(entry.Chunks) + attributes.FileSize = entry.Size() attributes.FileMode = uint32(entry.Mode) attributes.Uid = entry.Uid attributes.Gid = entry.Gid diff --git a/weed/server/filer_ui/templates.go b/weed/server/filer_ui/templates.go index bba60ff1a..5e901cd68 100644 --- a/weed/server/filer_ui/templates.go +++ b/weed/server/filer_ui/templates.go @@ -24,10 +24,11 @@ var StatusTpl = template.Must(template.New("status").Parse(`
-
{{if .ShouldDisplayLoadMore}}