Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/840 Reviewed-by: ychao_1983 <ychao_1983@sina.com>pull/845/head
@@ -8,6 +8,7 @@ import ( | |||||
"io" | "io" | ||||
"net/url" | "net/url" | ||||
"path" | "path" | ||||
"sort" | |||||
"strconv" | "strconv" | ||||
"strings" | "strings" | ||||
@@ -222,6 +223,9 @@ func GetObsListObject(jobName, parentDir string) ([]FileInfo, error) { | |||||
} | } | ||||
fileInfos = append(fileInfos, fileInfo) | fileInfos = append(fileInfos, fileInfo) | ||||
} | } | ||||
sort.Slice(fileInfos, func(i, j int) bool { | |||||
return fileInfos[i].ModTime > fileInfos[j].ModTime | |||||
}) | |||||
return fileInfos, err | return fileInfos, err | ||||
} else { | } else { | ||||
if obsError, ok := err.(obs.ObsError); ok { | if obsError, ok := err.(obs.ObsError); ok { | ||||
@@ -10,6 +10,7 @@ import ( | |||||
"os" | "os" | ||||
"os/exec" | "os/exec" | ||||
"regexp" | "regexp" | ||||
"sort" | |||||
"strconv" | "strconv" | ||||
"strings" | "strings" | ||||
"time" | "time" | ||||
@@ -533,6 +534,10 @@ func CloudBrainShowModels(ctx *context.Context) { | |||||
fileInfos[i].ModTime = temp.Local().Format("2006-01-02 15:04:05") | fileInfos[i].ModTime = temp.Local().Format("2006-01-02 15:04:05") | ||||
} | } | ||||
sort.Slice(fileInfos, func(i, j int) bool { | |||||
return fileInfos[i].ModTime > fileInfos[j].ModTime | |||||
}) | |||||
ctx.Data["Path"] = dirArray | ctx.Data["Path"] = dirArray | ||||
ctx.Data["Dirs"] = fileInfos | ctx.Data["Dirs"] = fileInfos | ||||
ctx.Data["task"] = task | ctx.Data["task"] = task | ||||