diff --git a/models/attachment.go b/models/attachment.go index 4f2c8d09a..fdd26b8ab 100755 --- a/models/attachment.go +++ b/models/attachment.go @@ -378,7 +378,7 @@ func GetUnDecompressAttachments() ([]*Attachment, error) { func getUnDecompressAttachments(e Engine) ([]*Attachment, error) { attachments := make([]*Attachment, 0, 10) - return attachments, e.Where("decompress_state = ? and dataset_id != 0 and attachment.type = ? and name like '%.zip'", DecompressStateInit, TypeCloudBrainOne).Find(&attachments) + return attachments, e.Where("decompress_state = ? and dataset_id != 0 and attachment.type = ? and (name like '%.zip' or name like '%.tar.gz' or name like '%.tgz')", DecompressStateInit, TypeCloudBrainOne).Find(&attachments) } func GetAllPublicAttachments() ([]*AttachmentUsername, error) { diff --git a/modules/worker/task.go b/modules/worker/task.go index 073b16b92..c2d9467dc 100755 --- a/modules/worker/task.go +++ b/modules/worker/task.go @@ -13,8 +13,8 @@ const ( DecompressTaskName = "Decompress" ) -func SendDecompressTask(ctx context.Context, uuid string) error { - args := []tasks.Arg{{Name: "uuid", Type: "string", Value: uuid}} +func SendDecompressTask(ctx context.Context, uuid string, name string) error { + args := []tasks.Arg{{Name: "uuid", Type: "string", Value: uuid}, {Name: "name", Type: "string", Value: name}} task, err := tasks.NewSignature(DecompressTaskName, args) if err != nil { log.Error("NewSignature failed:", err.Error()) diff --git a/public/self/js/Director/detection.js b/public/self/js/Director/detection.js index 5f40e73c3..8b63ef854 100644 --- a/public/self/js/Director/detection.js +++ b/public/self/js/Director/detection.js @@ -1640,22 +1640,31 @@ function showfilelist(){ var htmlstr=""; for (var i=0;i 70){ + var tmpIndex = labeltastresult[i].pic_image_field.indexOf("/",70); + console.log(tmpIndex) + if(tmpIndex != -1){ + fname = labeltastresult[i].pic_image_field.substring(tmpIndex + 1); + fname = fname.substring(fname.indexOf('/')+1); + } + } + var isfinished = labeltastresult[i].label_status; - if(isVerified()){ - isfinished = labeltastresult[i].verify_status - 1; - } + if(isVerified()){ + isfinished = labeltastresult[i].verify_status - 1; + } var lablebg=" style=\"cursor:pointer\""; var classStr = "style=\"color:#FF6200;background: transparent;border: 0;\""; var finish="未完成"; if (isfinished=="0"){finish="已完成";classStr = "style=\"color:#27c24c;background: transparent;border: 0;\"";} if (i==fileindex){lablebg=" style=\"color:#fff;cursor:pointer;\"";classStr = "style=\"color:#04B3E5;background: transparent;border: 0;\"";finish="标注中"} - if(isVerified()){ - htmlstr = htmlstr+" "+""+finish +""+""+ fname+ ""; - }else{ - htmlstr = htmlstr+""+fname+""+""+""; - } + if(isVerified()){ + htmlstr = htmlstr+" "+""+finish +""+""+ fname+ ""; + }else{ + htmlstr = htmlstr+""+fname+""+""+""; + } - }; + } document.getElementById("filelist").innerHTML=htmlstr; } diff --git a/public/self/labelTaskPage.js b/public/self/labelTaskPage.js index 98813dd08..4ce48407a 100644 --- a/public/self/labelTaskPage.js +++ b/public/self/labelTaskPage.js @@ -318,7 +318,7 @@ function label_task_create(task_name, relate_task_id, taskType,assign_user_id,la success:function(res){ console.log(res); if(res.code == 0){ - alert("人工校验任务创建成功!"); + alert("人工标注任务创建成功!"); createsucced = true; } else{ diff --git a/routers/repo/attachment.go b/routers/repo/attachment.go index cfbbc73a4..c62a7b215 100755 --- a/routers/repo/attachment.go +++ b/routers/repo/attachment.go @@ -384,9 +384,9 @@ func AddAttachment(ctx *context.Context) { } if attachment.DatasetID != 0 { - if strings.HasSuffix(attachment.Name, ".zip") { + if isCanDecompress(attachment.Name) { if typeCloudBrain == models.TypeCloudBrainOne { - err = worker.SendDecompressTask(contexExt.Background(), uuid) + err = worker.SendDecompressTask(contexExt.Background(), uuid, attachment.Name) if err != nil { log.Error("SendDecompressTask(%s) failed:%s", uuid, err.Error()) } else { @@ -406,6 +406,13 @@ func AddAttachment(ctx *context.Context) { }) } +func isCanDecompress(name string) bool { + if strings.HasSuffix(name, ".zip") || strings.HasSuffix(name, ".tar.gz") || strings.HasSuffix(name, ".tgz") { + return true + } + return false +} + func UpdateAttachmentDecompressState(ctx *context.Context) { uuid := ctx.Query("uuid") result := ctx.Query("result") @@ -766,9 +773,9 @@ func CompleteMultipart(ctx *context.Context) { } if attachment.DatasetID != 0 { - if strings.HasSuffix(attachment.Name, ".zip") { + if isCanDecompress(attachment.Name) { if typeCloudBrain == models.TypeCloudBrainOne { - err = worker.SendDecompressTask(contexExt.Background(), uuid) + err = worker.SendDecompressTask(contexExt.Background(), uuid, attachment.Name) if err != nil { log.Error("SendDecompressTask(%s) failed:%s", uuid, err.Error()) } else { @@ -838,7 +845,7 @@ func HandleUnDecompressAttachment() { } for _, attach := range attachs { - err = worker.SendDecompressTask(contexExt.Background(), attach.UUID) + err = worker.SendDecompressTask(contexExt.Background(), attach.UUID, attach.Name) if err != nil { log.Error("SendDecompressTask(%s) failed:%s", attach.UUID, err.Error()) } else { diff --git a/routers/repo/dir.go b/routers/repo/dir.go index ea46af7fc..612019d46 100755 --- a/routers/repo/dir.go +++ b/routers/repo/dir.go @@ -39,7 +39,8 @@ func DeleteAllUnzipFile(attachment *models.Attachment, parentDir string) { uuid := attachment.UUID dirArray := strings.Split(parentDir, "/") - if !strings.HasSuffix(attachment.Name, ".zip") { + //if !strings.HasSuffix(attachment.Name, ".zip") { + if !isCanDecompress(attachment.Name) { log.Error("The file is not zip file, can not query the dir") return } else if attachment.DecompressState != models.DecompressStateDone { @@ -69,7 +70,7 @@ func DeleteAllUnzipFile(attachment *models.Attachment, parentDir string) { log.Info("fileName=" + fileInfo.FileName) log.Info("parentDir=" + fileInfo.ParenDir) if fileInfo.IsDir { - DeleteAllUnzipFile(attachment, fileInfo.FileName) + DeleteAllUnzipFile(attachment, fileInfo.ParenDir) } else { absolutepath := path.Join(attachment.RelativePath()+attachment.UUID, fileInfo.ParenDir) log.Info("absolutepath=" + absolutepath) @@ -127,7 +128,8 @@ func DirIndex(ctx *context.Context) { return } - if !strings.HasSuffix(attachment.Name, ".zip") { + //if !strings.HasSuffix(attachment.Name, ".zip") { + if !isCanDecompress(attachment.Name) { log.Error("The file is not zip file, can not query the dir") ctx.ServerError("The file is not zip file, can not query the dir", errors.New("The file is not zip file, can not query the dir")) return