Commit 64ecc0c0 authored by wangzhengkun's avatar wangzhengkun
Browse files

feat: 修改 ls 命令

parent 2669bdf6
Showing with 16 additions and 13 deletions
+16 -13
......@@ -9,4 +9,5 @@ type File struct {
User string `json:"user"`
UserGroup string `json:"group"`
Link string `json:"link"`
Path string `json:"path"`
}
......@@ -4,7 +4,7 @@ import "strings"
func (p *PodTool) ListFiles(path string) ([]File, error) {
var files []File
commands := []string{"ls", "-lF", "--full-time", path}
commands := []string{"ls", "-l", "--full-time", path}
res, err := p.ExecCommand(commands)
if err != nil {
......@@ -28,18 +28,13 @@ func (p *PodTool) ListFiles(path string) ([]File, error) {
UserGroup: fArray[3],
}
name := fArray[8]
if strings.HasPrefix(fArray[0], "l") && len(fArray) > 10 {
f.IsDir = strings.HasSuffix(fArray[10],"/")
f.Link = strings.Replace(fArray[10],"/","",1)
if strings.HasPrefix(f.Mode, "l") && len(fArray) > 10 {
f.Link = fArray[10]
}
if strings.HasSuffix(name,"/") {
if strings.HasPrefix(f.Mode,"d") {
f.IsDir = true
name = strings.Replace(name,"/","",1)
}
if strings.HasSuffix(name,"*") {
name = strings.Replace(name,"*","",1)
}
f.Name = name
files = append(files, f)
}
......
......@@ -197,7 +197,7 @@ export default {
handleClick (btn, row) {
switch (btn) {
case "edit":
this.ile(row)
this.catFile(row)
break
case "delete":
this.folderDelete(row.name)
......@@ -303,6 +303,13 @@ export default {
return this.folder + "/" + name
}
},
getLinkPath(row){
if (row.link !== "") {
return row.path
}else {
return this.getPath(row.name)
}
},
folderCreate () {
this.$refs["folderForm"].validate((valid) => {
if (valid) {
......
......@@ -109,7 +109,7 @@ const message = {
create_failed: "Created failed",
sync_success: "Sync successfully",
upload_success: "Upload successfully",
change_to_download: "The file is over 10M. Opening it directly will cause browser lag. Should I download it?",
change_to_download: "The file is over 1M. Opening it directly will cause browser lag. Should I download it?",
},
confirm_message: {
delete: "This operation cannot be undone, do you want to continue?",
......
......@@ -116,7 +116,7 @@ const message = {
back_form: "返回表单编辑不会保留对 YAML 做出的所有更改",
open_yaml: ",仍要打开 YAML 编辑?",
rollback: "此操作将回滚当前 deployment 到改版本,是否继续?",
change_to_download: "该文件超过 10M,直接打开将导致浏览器卡顿,是否下载?",
change_to_download: "该文件超过 1M,直接打开将导致浏览器卡顿,是否下载?",
},
login: {
username: "用户名",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment