mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-24 02:13:35 +08:00
adjust filer web page
This commit is contained in:
@@ -55,6 +55,18 @@ type Entry struct {
|
|||||||
Chunks []*filer_pb.FileChunk `json:"chunks,omitempty"`
|
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 {
|
type AbstractFiler interface {
|
||||||
CreateEntry(*Entry) (error)
|
CreateEntry(*Entry) (error)
|
||||||
AppendFileChunk(FullPath, []*filer_pb.FileChunk) (err error)
|
AppendFileChunk(FullPath, []*filer_pb.FileChunk) (err error)
|
||||||
|
@@ -46,7 +46,7 @@ func (fs *FilerServer) ListEntries(ctx context.Context, req *filer_pb.ListEntrie
|
|||||||
IsDirectory: entry.IsDirectory(),
|
IsDirectory: entry.IsDirectory(),
|
||||||
Chunks: entry.Chunks,
|
Chunks: entry.Chunks,
|
||||||
Attributes: &filer_pb.FuseAttributes{
|
Attributes: &filer_pb.FuseAttributes{
|
||||||
FileSize: filer2.TotalSize(entry.Chunks),
|
FileSize: entry.Size(),
|
||||||
Mtime: entry.Mtime.Unix(),
|
Mtime: entry.Mtime.Unix(),
|
||||||
Gid: entry.Gid,
|
Gid: entry.Gid,
|
||||||
Uid: entry.Uid,
|
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)
|
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.FileMode = uint32(entry.Mode)
|
||||||
attributes.Uid = entry.Uid
|
attributes.Uid = entry.Uid
|
||||||
attributes.Gid = entry.Gid
|
attributes.Gid = entry.Gid
|
||||||
|
@@ -24,10 +24,11 @@ var StatusTpl = template.Must(template.New("status").Parse(`<!DOCTYPE html>
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<ul>
|
<table width="90%">
|
||||||
{{$path := .Path }}
|
{{$path := .Path }}
|
||||||
{{ range $entry_index, $entry := .Entries }}
|
{{ range $entry_index, $entry := .Entries }}
|
||||||
<li>
|
<tr>
|
||||||
|
<td>
|
||||||
{{if $entry.IsDirectory}}
|
{{if $entry.IsDirectory}}
|
||||||
<img src="https://www.w3.org/TR/WWWicn/folder.gif" width="20" height="23">
|
<img src="https://www.w3.org/TR/WWWicn/folder.gif" width="20" height="23">
|
||||||
<a href={{ print $path "/" $entry.Name "/"}} >
|
<a href={{ print $path "/" $entry.Name "/"}} >
|
||||||
@@ -38,10 +39,21 @@ var StatusTpl = template.Must(template.New("status").Parse(`<!DOCTYPE html>
|
|||||||
{{ $entry.Name }}
|
{{ $entry.Name }}
|
||||||
</a>
|
</a>
|
||||||
{{end}}
|
{{end}}
|
||||||
</li>
|
</td>
|
||||||
|
<td align="right">
|
||||||
|
{{if $entry.IsDirectory}}
|
||||||
|
{{else}}
|
||||||
|
{{ $entry.Size }} bytes
|
||||||
|
|
||||||
|
{{end}}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ $entry.Timestamp.Format "2006-01-02 15:04" }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
</ul>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{if .ShouldDisplayLoadMore}}
|
{{if .ShouldDisplayLoadMore}}
|
||||||
|
Reference in New Issue
Block a user