Browse Source

Use createdTime

HEAD
Yang Luo 3 years ago
parent
commit
6b8b13837d
6 changed files with 21 additions and 22 deletions
  1. +6
    -6
      object/store.go
  2. +7
    -8
      object/store_provider.go
  3. +4
    -4
      web/src/FileTable.js
  4. +1
    -1
      web/src/FileTree.js
  5. +1
    -1
      web/src/locales/en/data.json
  6. +2
    -2
      web/src/locales/zh/data.json

+ 6
- 6
object/store.go View File

@@ -8,12 +8,12 @@ import (
)

type File struct {
Key string `xorm:"varchar(100)" json:"key"`
Title string `xorm:"varchar(100)" json:"title"`
Size int64 `json:"size"`
ModifiedTime string `xorm:"varchar(100)" json:"modifiedTime"`
IsLeaf bool `json:"isLeaf"`
Children []*File `xorm:"varchar(1000)" json:"children"`
Key string `xorm:"varchar(100)" json:"key"`
Title string `xorm:"varchar(100)" json:"title"`
Size int64 `json:"size"`
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
IsLeaf bool `json:"isLeaf"`
Children []*File `xorm:"varchar(1000)" json:"children"`

ChildrenMap map[string]*File `xorm:"-" json:"-"`
}


+ 7
- 8
object/store_provider.go View File

@@ -6,7 +6,6 @@ import (

"github.com/aliyun/aliyun-oss-go-sdk/oss"
"github.com/casbin/casbase/storage"
"github.com/casbin/casbase/util"
)

func (store *Store) createPathIfNotExisted(tokens []string, size int64, lastModifiedTime string, isLeaf bool) {
@@ -41,7 +40,7 @@ func (store *Store) createPathIfNotExisted(tokens []string, size int64, lastModi

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

if token == "_hidden.ini" {
continue
@@ -67,12 +66,12 @@ func (store *Store) Populate() {

if store.FileTree == nil {
store.FileTree = &File{
Key: "/",
Title: store.DisplayName,
ModifiedTime: util.GetCurrentTime(),
IsLeaf: false,
Children: []*File{},
ChildrenMap: map[string]*File{},
Key: "/",
Title: store.DisplayName,
CreatedTime: store.CreatedTime,
IsLeaf: false,
Children: []*File{},
ChildrenMap: map[string]*File{},
}
}



+ 4
- 4
web/src/FileTable.js View File

@@ -81,11 +81,11 @@ class FileTable extends React.Component {
}
},
{
title: i18next.t("store:Modified time"),
dataIndex: 'modifiedTime',
key: 'modifiedTime',
title: i18next.t("general:Created time"),
dataIndex: 'createdTime',
key: 'createdTime',
width: '150px',
sorter: (a, b) => a.modifiedTime.localeCompare(b.modifiedTime),
sorter: (a, b) => a.createdTime.localeCompare(b.createdTime),
render: (text, record, index) => {
return Setting.getFormattedDate(text);
}


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

@@ -668,7 +668,7 @@ class FileTree extends React.Component {
>
<Descriptions.Item label={i18next.t("vectorset:File name")}>{file.title}</Descriptions.Item>
<Descriptions.Item label={i18next.t("vectorset:File size")}>{Setting.getFriendlyFileSize(file.size)}</Descriptions.Item>
<Descriptions.Item label={i18next.t("store:Modified time")}>{Setting.getFormattedDate(file.modifiedTime)}</Descriptions.Item>
<Descriptions.Item label={i18next.t("general:Created time")}>{Setting.getFormattedDate(file.createdTime)}</Descriptions.Item>
<Descriptions.Item label={i18next.t("store:File type")}>{file.title.split('.')[1]}</Descriptions.Item>
<Descriptions.Item label={i18next.t("store:Path")}>{file.key}</Descriptions.Item>
<Descriptions.Item label={i18next.t("store:Is leaf")}>{


+ 1
- 1
web/src/locales/en/data.json View File

@@ -9,6 +9,7 @@
"Action": "Action",
"Add": "Add",
"Clustering": "Clustering",
"Created time": "Created time",
"Data": "Data",
"Delete": "Delete",
"Display name": "Display name",
@@ -41,7 +42,6 @@
"File tree": "File tree",
"File type": "File type",
"Is leaf": "Is leaf",
"Modified time": "Modified time",
"Move": "Move",
"New folder": "New folder",
"Path": "Path",


+ 2
- 2
web/src/locales/zh/data.json View File

@@ -9,6 +9,7 @@
"Action": "操作",
"Add": "添加",
"Clustering": "聚类分析",
"Created time": "上传时间",
"Data": "数据",
"Delete": "删除",
"Display name": "显示名称",
@@ -41,7 +42,6 @@
"File tree": "文件",
"File type": "文件类型",
"Is leaf": "是否是文件",
"Modified time": "修改时间",
"Move": "移动",
"New folder": "新建文件夹",
"Path": "路径",
@@ -81,4 +81,4 @@
"Vectorset": "向量集",
"Words": "词汇表"
}
}
}

Loading…
Cancel
Save