Browse Source

Rename fileSize to size.

HEAD
Yang Luo 3 years ago
parent
commit
6bdf063dd9
3 changed files with 6 additions and 6 deletions
  1. +1
    -1
      object/store.go
  2. +4
    -4
      object/store_provider.go
  3. +1
    -1
      web/src/FileTree.js

+ 1
- 1
object/store.go View File

@@ -10,7 +10,7 @@ import (
type File struct {
Key string `xorm:"varchar(100)" json:"key"`
Title string `xorm:"varchar(100)" json:"title"`
FileSize int64 `json:"fileSize"`
Size int64 `json:"size"`
ModifiedTime string `xorm:"varchar(100)" json:"modifiedTime"`
IsLeaf bool `json:"isLeaf"`
Children []*File `xorm:"varchar(1000)" json:"children"`


+ 4
- 4
object/store_provider.go View File

@@ -8,7 +8,7 @@ import (
"github.com/casbin/casbase/util"
)

func (store *Store) createPathIfNotExisted(tokens []string, fileSize int64, lastModifiedTime string, isLeaf bool) {
func (store *Store) createPathIfNotExisted(tokens []string, size int64, lastModifiedTime string, isLeaf bool) {
currentFile := store.FileTree
if currentFile == nil {
currentFile = &File{
@@ -51,7 +51,7 @@ func (store *Store) createPathIfNotExisted(tokens []string, fileSize int64, last
}

if i == len(tokens)-1 {
newFile.FileSize = fileSize
newFile.Size = size
newFile.ModifiedTime = lastModifiedTime
}

@@ -71,10 +71,10 @@ func (store *Store) Populate() {
isLeaf = false
}

fileSize := object.Size
size := object.Size

tokens := strings.Split(strings.Trim(object.Key, "/"), "/")
store.createPathIfNotExisted(tokens, fileSize, lastModifiedTime, isLeaf)
store.createPathIfNotExisted(tokens, size, lastModifiedTime, isLeaf)

//fmt.Printf("%s, %d, %v\n", object.Key, object.Size, object.LastModified)
}


+ 1
- 1
web/src/FileTree.js View File

@@ -200,7 +200,7 @@ class FileTree extends React.Component {
treeData={tree.children}
titleRender={(file) => {
if (file.isLeaf) {
return `${file.title} (${Setting.getFriendlyFileSize(file.fileSize)})`;
return `${file.title} (${Setting.getFriendlyFileSize(file.size)})`;
} else {
return file.title;
}


Loading…
Cancel
Save