|
|
@@ -58,7 +58,7 @@ func DirIndex(ctx *context.Context) { |
|
|
dirArray = []string{attachment.Name} |
|
|
dirArray = []string{attachment.Name} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
dirs, err := getDirs(uuid, parentDir) |
|
|
|
|
|
|
|
|
dirs, err := getDatasetDirs(uuid, parentDir) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
log.Error("getDirs failed:", err.Error()) |
|
|
log.Error("getDirs failed:", err.Error()) |
|
|
ctx.ServerError("getDirs failed:", err) |
|
|
ctx.ServerError("getDirs failed:", err) |
|
|
@@ -75,13 +75,13 @@ func DirIndex(ctx *context.Context) { |
|
|
|
|
|
|
|
|
ctx.Data["Path"] = dirArray |
|
|
ctx.Data["Path"] = dirArray |
|
|
ctx.Data["Dirs"] = fileInfos |
|
|
ctx.Data["Dirs"] = fileInfos |
|
|
|
|
|
ctx.Data["Uuid"] = uuid |
|
|
ctx.Data["PageIsDataset"] = true |
|
|
ctx.Data["PageIsDataset"] = true |
|
|
|
|
|
|
|
|
ctx.HTML(200, tplDirIndex) |
|
|
ctx.HTML(200, tplDirIndex) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func getDirs(uuid string, parentDir string) (string, error) { |
|
|
|
|
|
var dirs string |
|
|
|
|
|
|
|
|
func getDatasetDirs(uuid string, parentDir string) (string, error) { |
|
|
var req string |
|
|
var req string |
|
|
if parentDir == "" { |
|
|
if parentDir == "" { |
|
|
req = "uuid=" + uuid |
|
|
req = "uuid=" + uuid |
|
|
@@ -89,7 +89,13 @@ func getDirs(uuid string, parentDir string) (string, error) { |
|
|
req = "uuid=" + uuid + "&parentDir=" + parentDir |
|
|
req = "uuid=" + uuid + "&parentDir=" + parentDir |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
url := setting.DecompressAddress + "/dirs?" + req |
|
|
|
|
|
|
|
|
return getDirs(req) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func getDirs(req string) (string, error) { |
|
|
|
|
|
var dirs string |
|
|
|
|
|
|
|
|
|
|
|
url := setting.DecompressAddress + "/dirs/dataset?" + req |
|
|
reqHttp, err := http.NewRequest(http.MethodGet, url, nil) |
|
|
reqHttp, err := http.NewRequest(http.MethodGet, url, nil) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
log.Error("http.NewRequest failed:", err.Error()) |
|
|
log.Error("http.NewRequest failed:", err.Error()) |
|
|
@@ -127,6 +133,5 @@ func getDirs(uuid string, parentDir string) (string, error) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
dirs = resp.FileInfos |
|
|
dirs = resp.FileInfos |
|
|
|
|
|
|
|
|
return dirs, nil |
|
|
return dirs, nil |
|
|
} |
|
|
} |