From d39f9068399ba8416963cc506815c9c116f7a03a Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 13 Dec 2021 16:48:56 +0800 Subject: [PATCH 01/24] =?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/ai_model_manage.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/routers/repo/ai_model_manage.go b/routers/repo/ai_model_manage.go index 54f6162be..aadaf4411 100644 --- a/routers/repo/ai_model_manage.go +++ b/routers/repo/ai_model_manage.go @@ -419,6 +419,8 @@ func queryUserName(intSlice []int64) map[int64]*models.User { uniqueElements = append(uniqueElements, entry) } } + uniqueElementsJson, _ := json.Marshal(uniqueElements) + log.Info("uniqueElementsJson=" + string(uniqueElementsJson)) result := make(map[int64]*models.User) userLists, err := models.GetUsersByIDs(uniqueElements) if err == nil { @@ -426,6 +428,7 @@ func queryUserName(intSlice []int64) map[int64]*models.User { result[uniqueElements[i]] = user } } + return result } @@ -523,6 +526,10 @@ func ShowModelPageInfo(ctx *context.Context) { } userNameMap := queryUserName(userIds) + + userNameMapJson, _ := json.Marshal(userNameMap) + log.Info("userNameMapJson=" + string(userNameMapJson)) + for _, model := range modelResult { value := userNameMap[model.UserId] if value != nil { From f8af112de8ab7a5f0bdd7e1f759dec38600891f1 Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 13 Dec 2021 16:55:18 +0800 Subject: [PATCH 02/24] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=90=8D=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF=E7=9A=84Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/ai_model_manage.go | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/routers/repo/ai_model_manage.go b/routers/repo/ai_model_manage.go index aadaf4411..93045129e 100644 --- a/routers/repo/ai_model_manage.go +++ b/routers/repo/ai_model_manage.go @@ -393,8 +393,6 @@ func ShowSingleModel(ctx *context.Context) { userIds := make([]int64, len(models)) for i, model := range models { - log.Info("model=" + model.Name) - log.Info("model.UserId=" + fmt.Sprint(model.UserId)) model.IsCanOper = isOper(ctx, model.UserId) userIds[i] = model.UserId } @@ -419,13 +417,11 @@ func queryUserName(intSlice []int64) map[int64]*models.User { uniqueElements = append(uniqueElements, entry) } } - uniqueElementsJson, _ := json.Marshal(uniqueElements) - log.Info("uniqueElementsJson=" + string(uniqueElementsJson)) result := make(map[int64]*models.User) userLists, err := models.GetUsersByIDs(uniqueElements) if err == nil { - for i, user := range userLists { - result[uniqueElements[i]] = user + for _, user := range userLists { + result[user.ID] = user } } @@ -439,8 +435,6 @@ func ShowOneVersionOtherModel(ctx *context.Context) { userIds := make([]int64, len(aimodels)) for i, model := range aimodels { - log.Info("model=" + model.Name) - log.Info("model.UserId=" + fmt.Sprint(model.UserId)) model.IsCanOper = isOper(ctx, model.UserId) userIds[i] = model.UserId } @@ -527,9 +521,6 @@ func ShowModelPageInfo(ctx *context.Context) { userNameMap := queryUserName(userIds) - userNameMapJson, _ := json.Marshal(userNameMap) - log.Info("userNameMapJson=" + string(userNameMapJson)) - for _, model := range modelResult { value := userNameMap[model.UserId] if value != nil { From ecd82e25c9a686e01c862d7aefd41c4115823a73 Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 13 Dec 2021 16:56:08 +0800 Subject: [PATCH 03/24] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=90=8D=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF=E7=9A=84Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/ai_model_manage.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/routers/repo/ai_model_manage.go b/routers/repo/ai_model_manage.go index 93045129e..ad68f5b99 100644 --- a/routers/repo/ai_model_manage.go +++ b/routers/repo/ai_model_manage.go @@ -513,8 +513,6 @@ func ShowModelPageInfo(ctx *context.Context) { userIds := make([]int64, len(modelResult)) for i, model := range modelResult { - log.Info("model=" + model.Name) - log.Info("model.UserId=" + fmt.Sprint(model.UserId)) model.IsCanOper = isOper(ctx, model.UserId) userIds[i] = model.UserId } From f8b6553ebccfa8559c0a12cfbe91d5e46e01e8b7 Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 13 Dec 2021 17:20:00 +0800 Subject: [PATCH 04/24] =?UTF-8?q?=E9=80=89=E6=8B=A9=E6=8E=92=E5=BA=8F?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/cloudbrain.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/models/cloudbrain.go b/models/cloudbrain.go index ceb552811..f54bbfbf9 100755 --- a/models/cloudbrain.go +++ b/models/cloudbrain.go @@ -962,12 +962,13 @@ func QueryModelTrainJobList(repoId int64) ([]*CloudbrainInfo, int, error) { cond = cond.And( builder.Eq{"Status": "COMPLETED"}, ) - sess.OrderBy("job_id DESC") + cloudbrains := make([]*CloudbrainInfo, 0) - if err := sess.Distinct("job_id,job_name").Table(&Cloudbrain{}).Where(cond). + if err := sess.Select("job_id,job_name").Table(&Cloudbrain{}).Where("job_id in (?)", sess.Distinct("job_id").Table(&Cloudbrain{}).Where(cond)).OrderBy("created_unix DESC"). Find(&cloudbrains); err != nil { return nil, 0, fmt.Errorf("Find: %v", err) } + return cloudbrains, int(len(cloudbrains)), nil } From 3d59d2307004e54ea6bd996b0d56304a0811fe42 Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 13 Dec 2021 17:30:05 +0800 Subject: [PATCH 05/24] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E8=A7=A3=E5=86=B3=E5=AF=BC=E5=85=A5=E6=96=B0=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E6=97=B6=E9=80=89=E6=8B=A9=E7=9A=84=E9=A1=BA=E5=BA=8F?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/cloudbrain.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/models/cloudbrain.go b/models/cloudbrain.go index f54bbfbf9..5a817bbca 100755 --- a/models/cloudbrain.go +++ b/models/cloudbrain.go @@ -964,12 +964,21 @@ func QueryModelTrainJobList(repoId int64) ([]*CloudbrainInfo, int, error) { ) cloudbrains := make([]*CloudbrainInfo, 0) - if err := sess.Select("job_id,job_name").Table(&Cloudbrain{}).Where("job_id in (?)", sess.Distinct("job_id").Table(&Cloudbrain{}).Where(cond)).OrderBy("created_unix DESC"). + if err := sess.Select("job_id,job_name").Table(&Cloudbrain{}).Where(cond).OrderBy("created_unix DESC"). Find(&cloudbrains); err != nil { return nil, 0, fmt.Errorf("Find: %v", err) } - return cloudbrains, int(len(cloudbrains)), nil + keys := make(map[string]string) + uniqueElements := make([]*CloudbrainInfo, 0) + for _, entry := range cloudbrains { + if _, value := keys[entry.JobID]; !value { + keys[entry.JobID] = entry.JobName + uniqueElements = append(uniqueElements, entry) + } + } + + return uniqueElements, int(len(uniqueElements)), nil } func CloudbrainsVersionList(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int, error) { From 3462e1c2c4ec22dc14ae6758c886196f3d9ec939 Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Mon, 13 Dec 2021 18:56:31 +0800 Subject: [PATCH 06/24] fix issue --- templates/repo/cloudbrain/new.tmpl | 21 +------------------- templates/repo/modelarts/notebook/new.tmpl | 6 +----- templates/repo/modelarts/trainjob/index.tmpl | 2 +- templates/repo/modelarts/trainjob/show.tmpl | 2 -- web_src/js/index.js | 5 ++++- 5 files changed, 7 insertions(+), 29 deletions(-) diff --git a/templates/repo/cloudbrain/new.tmpl b/templates/repo/cloudbrain/new.tmpl index 527faaf51..82f761c07 100755 --- a/templates/repo/cloudbrain/new.tmpl +++ b/templates/repo/cloudbrain/new.tmpl @@ -93,16 +93,6 @@ display: none; } - .select2-container .select2-selection--single{ - height:38px !important; - } - - .select2-container--default .select2-selection--single { - border : 1px solid rgba(34,36,38,.15) !important; - } - .select2-container--default .select2-selection--single .select2-selection__rendered{ - line-height: 38px !important; - }
@@ -258,7 +248,7 @@ - {{.i18n.Tr "repo.cloudbrain.cancel"}} + {{.i18n.Tr "repo.cloudbrain.cancel"}}
@@ -268,12 +258,7 @@ {{template "base/footer" .}} - - diff --git a/templates/repo/modelmanage/showinfo.tmpl b/templates/repo/modelmanage/showinfo.tmpl index f416347d3..0ce08d899 100644 --- a/templates/repo/modelmanage/showinfo.tmpl +++ b/templates/repo/modelmanage/showinfo.tmpl @@ -221,6 +221,7 @@ function tranSize(value){ function editorFn(context){ let id= context.dataset.id let text = context.dataset.desc + console.log(id,text) $('#edit-td').replaceWith("
"); } diff --git a/web_src/js/components/Model.vue b/web_src/js/components/Model.vue index f87c78a36..d02c96a1c 100644 --- a/web_src/js/components/Model.vue +++ b/web_src/js/components/Model.vue @@ -96,7 +96,7 @@ > @@ -141,6 +141,7 @@ export default { }, data() { return { + currentPage:1, pageSize:10, totalNum:0, @@ -149,29 +150,36 @@ export default { url:'', isLoading:true, loadNodeMap:new Map(), - submitId:{} + submitId:{}, + defaultAvatar:'/user/avatar/Ghost/-1', + data:'' }; }, methods: { load(tree, treeNode, resolve) { - this.loadNodeMap.set(tree.cName, {tree,treeNode,resolve}) - this.$axios.get(this.url+'show_model_child_api',{params:{ - name:tree.cName - }}).then((res)=>{ - let TrainTaskInfo - let tableData - tableData= res.data - for(let i=0;i{ + let TrainTaskInfo + let tableData + tableData= res.data + for(let i=0;i{ + // console.log(res) + // let initLabel = $("input[name='Label']").val() + // let addLabel=res.data[0].Label + ' ' + initLabel + // $("input[name='Label']").val(addLabel) + // this.data = $("#formId").serialize() + // }) + // }, submit(){ let context = this let flag= this.check() if(flag){ - let data = $("#formId").serialize() let cName = $("input[name='Name']").val() - let row = {cName:cName} + let version = $("input[name='Version']").val() + // if(!(version==='0.0.1')){ + // context.getFirstChildLabel(cName) + // }else{ + // context.data = $("#formId").serialize() + // } + // console.log(context.data) + let data = $("#formId").serialize() $("#mask").css({"display":"block","z-index":"9999"}) $.ajax({ url:url_href, type:'POST', data:data, success:function(res){ + // context.loadrefresh1(row) context.getModelList() - context.loadrefresh(row) $('.ui.modal.second').modal('hide') }, error: function(xhr){ @@ -274,20 +304,32 @@ export default { } }, loadrefresh(row){ + const store = this.$refs.table.store if(!this.loadNodeMap.get(row.cName)){ - return + const parent = store.states.data + const index = parent.findIndex(child => child.ID == row.ID) + parent.splice(index, 1) }else{ let {tree,treeNode,resolve} = this.loadNodeMap.get(row.cName) - this.$set( - this.$refs.table.store.states.lazyTreeNodeMap, - tree.ID, - []) - this.load(tree,treeNode,resolve) + const keys = Object.keys(store.states.lazyTreeNodeMap); + if(keys.includes(row.ID)){ + this.getModelList() + }else{ + let parentRow = store.states.data.find(child => child.cName == row.cName); + let childrenIndex = store.states.lazyTreeNodeMap[parentRow.ID].findIndex(child => child.ID == row.ID) + parentRow.VersionCount = parentRow.VersionCount-1 + const parent = store.states.lazyTreeNodeMap[parentRow.ID] + if(parent.length===1){ + this.getModelList() + }else{ + parent.splice(childrenIndex, 1); + } + } } }, deleteModel(id,name){ - let row={cName:name} + let row={cName:name,ID:id} let _this = this let flag=1 $('.ui.basic.modal.first') @@ -300,8 +342,8 @@ export default { params:{ ID:id }}).then((res)=>{ - _this.getModelList() _this.loadrefresh(row) + // _this.getModelList() }) flag = true }, @@ -315,24 +357,29 @@ export default { }) .modal('show') }, - getModelList(){ - this.$axios.get(location.href+'_api',{ - params:this.params - }).then((res)=>{ - $(".ui.grid").removeAttr("style") - $("#loadContainer").removeClass("loader") - let TrainTaskInfo - this.tableData = res.data.data - for(let i=0;i{ + $(".ui.grid").removeAttr("style") + $("#loadContainer").removeClass("loader") + let TrainTaskInfo + this.tableData = res.data.data + for(let i=0;i Date: Wed, 15 Dec 2021 16:45:46 +0800 Subject: [PATCH 14/24] fix issue --- templates/repo/modelmanage/index.tmpl | 2 +- web_src/js/components/Model.vue | 23 +++-------------------- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/templates/repo/modelmanage/index.tmpl b/templates/repo/modelmanage/index.tmpl index ce6f25287..d56a94c9d 100644 --- a/templates/repo/modelmanage/index.tmpl +++ b/templates/repo/modelmanage/index.tmpl @@ -114,7 +114,7 @@
- +
diff --git a/web_src/js/components/Model.vue b/web_src/js/components/Model.vue index d02c96a1c..9e6807ee0 100644 --- a/web_src/js/components/Model.vue +++ b/web_src/js/components/Model.vue @@ -104,7 +104,7 @@