From fc54a4281e76cbf99e9f91aeb0be57f65b2c500e Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 14 Sep 2021 16:32:29 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=A0=87=E6=B3=A8?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- public/self/js/Director/detection.js | 27 ++++++++++++++++++--------- public/self/labelTaskPage.js | 2 +- 2 files changed, 19 insertions(+), 10 deletions(-) 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{ From 5c0e4ed465c17fd1310e79192251502c92cb3591 Mon Sep 17 00:00:00 2001 From: zouap Date: Wed, 15 Sep 2021 09:38:34 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E6=94=AF=E6=8C=81.tar.gz=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=A7=A3=E5=8E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/attachment.go | 2 +- modules/worker/task.go | 4 ++-- routers/repo/attachment.go | 13 ++++++++++--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/models/attachment.go b/models/attachment.go index 4f2c8d09a..2a3bbf9c8 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')", 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/routers/repo/attachment.go b/routers/repo/attachment.go index cfbbc73a4..1ac496c2f 100755 --- a/routers/repo/attachment.go +++ b/routers/repo/attachment.go @@ -386,7 +386,7 @@ func AddAttachment(ctx *context.Context) { if attachment.DatasetID != 0 { if strings.HasSuffix(attachment.Name, ".zip") { 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") { + return true + } + return false +} + func UpdateAttachmentDecompressState(ctx *context.Context) { uuid := ctx.Query("uuid") result := ctx.Query("result") @@ -768,7 +775,7 @@ func CompleteMultipart(ctx *context.Context) { if attachment.DatasetID != 0 { if strings.HasSuffix(attachment.Name, ".zip") { 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 { From 20ab6324169409567e14f435ba2c5fc975e2039f Mon Sep 17 00:00:00 2001 From: zouap Date: Wed, 15 Sep 2021 09:40:48 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E6=94=AF=E6=8C=81.tar.gz=E8=A7=A3=E5=8E=8B?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/attachment.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/routers/repo/attachment.go b/routers/repo/attachment.go index 1ac496c2f..a20ed9a7d 100755 --- a/routers/repo/attachment.go +++ b/routers/repo/attachment.go @@ -384,7 +384,7 @@ 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, attachment.Name) if err != nil { @@ -773,7 +773,7 @@ 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, attachment.Name) if err != nil { From a1a49ed4ee419148710b2f102e939000017c67f6 Mon Sep 17 00:00:00 2001 From: zouap Date: Wed, 22 Sep 2021 11:45:09 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E6=94=AF=E6=8C=81tar.gz=E5=8F=8Atgz?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E8=A7=A3=E5=8E=8B=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/attachment.go | 2 +- routers/repo/attachment.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/models/attachment.go b/models/attachment.go index 2a3bbf9c8..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' or name like '%.tar.gz')", 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/routers/repo/attachment.go b/routers/repo/attachment.go index a20ed9a7d..c62a7b215 100755 --- a/routers/repo/attachment.go +++ b/routers/repo/attachment.go @@ -407,7 +407,7 @@ func AddAttachment(ctx *context.Context) { } func isCanDecompress(name string) bool { - if strings.HasSuffix(name, ".zip") || strings.HasSuffix(name, ".tar.gz") { + if strings.HasSuffix(name, ".zip") || strings.HasSuffix(name, ".tar.gz") || strings.HasSuffix(name, ".tgz") { return true } return false From 71d1911eec5064dd737b4420754c6a897eaa82fc Mon Sep 17 00:00:00 2001 From: zouap Date: Wed, 22 Sep 2021 14:23:54 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E6=94=AF=E6=8C=81tar.gz=E5=8F=8Atgz?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E6=96=87=E4=BB=B6=E8=A7=A3=E5=8E=8B=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/dir.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/routers/repo/dir.go b/routers/repo/dir.go index ea46af7fc..25fb2215d 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 !isZipFile(attachment.Name) { log.Error("The file is not zip file, can not query the dir") return } else if attachment.DecompressState != models.DecompressStateDone { @@ -116,6 +117,13 @@ func DeleteAllUnzipFile(attachment *models.Attachment, parentDir string) { } +func isZipFile(name string) bool { + if strings.HasSuffix(name, ".zip") || strings.HasSuffix(name, ".tar.gz") || strings.HasSuffix(name, ".tgz") { + return true + } + return false +} + func DirIndex(ctx *context.Context) { uuid := ctx.Params("uuid") parentDir := ctx.Query("parentDir") @@ -127,7 +135,8 @@ func DirIndex(ctx *context.Context) { return } - if !strings.HasSuffix(attachment.Name, ".zip") { + //if !strings.HasSuffix(attachment.Name, ".zip") { + if !isZipFile(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 From c339cfdc7089d5b8486c0e2c4e4ffde361f31609 Mon Sep 17 00:00:00 2001 From: zouap Date: Wed, 22 Sep 2021 15:10:15 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/dir.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/repo/dir.go b/routers/repo/dir.go index 25fb2215d..62d842874 100755 --- a/routers/repo/dir.go +++ b/routers/repo/dir.go @@ -70,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) From ce1cb7c90b391c8dba96fb7bf1ba734c8b9e3912 Mon Sep 17 00:00:00 2001 From: zouap Date: Wed, 22 Sep 2021 16:57:10 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=AF=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E7=9A=84=E8=A7=A3=E5=8E=8B=E6=96=87=E4=BB=B6=E6=96=B9?= =?UTF-8?q?=E6=B3=95=EF=BC=8C=E7=BB=9F=E4=B8=80=E4=B8=80=E4=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/dir.go | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/routers/repo/dir.go b/routers/repo/dir.go index 62d842874..612019d46 100755 --- a/routers/repo/dir.go +++ b/routers/repo/dir.go @@ -40,7 +40,7 @@ func DeleteAllUnzipFile(attachment *models.Attachment, parentDir string) { dirArray := strings.Split(parentDir, "/") //if !strings.HasSuffix(attachment.Name, ".zip") { - if !isZipFile(attachment.Name) { + if !isCanDecompress(attachment.Name) { log.Error("The file is not zip file, can not query the dir") return } else if attachment.DecompressState != models.DecompressStateDone { @@ -117,13 +117,6 @@ func DeleteAllUnzipFile(attachment *models.Attachment, parentDir string) { } -func isZipFile(name string) bool { - if strings.HasSuffix(name, ".zip") || strings.HasSuffix(name, ".tar.gz") || strings.HasSuffix(name, ".tgz") { - return true - } - return false -} - func DirIndex(ctx *context.Context) { uuid := ctx.Params("uuid") parentDir := ctx.Query("parentDir") @@ -136,7 +129,7 @@ func DirIndex(ctx *context.Context) { } //if !strings.HasSuffix(attachment.Name, ".zip") { - if !isZipFile(attachment.Name) { + 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