From 56619790a56273d6a8df7de335859393027335e6 Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Thu, 21 Jul 2022 08:56:05 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/repo/ai_model_manage.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/routers/repo/ai_model_manage.go b/routers/repo/ai_model_manage.go index 0aef1a70c..d01539a75 100644 --- a/routers/repo/ai_model_manage.go +++ b/routers/repo/ai_model_manage.go @@ -152,6 +152,10 @@ func saveModelByParameters(jobId string, versionName string, name string, versio } func SaveNewNameModel(ctx *context.Context) { + if !ctx.Repo.CanWrite(models.UnitTypeModelManage) { + ctx.Error(403, ctx.Tr("repo.model_noright")) + return + } name := ctx.Query("Name") if name == "" { ctx.Error(500, fmt.Sprintf("name or version is null.")) @@ -169,6 +173,10 @@ func SaveNewNameModel(ctx *context.Context) { } func SaveModel(ctx *context.Context) { + if !ctx.Repo.CanWrite(models.UnitTypeModelManage) { + ctx.Error(403, ctx.Tr("repo.model_noright")) + return + } log.Info("save model start.") JobId := ctx.Query("JobId") VersionName := ctx.Query("VersionName") @@ -177,16 +185,8 @@ func SaveModel(ctx *context.Context) { label := ctx.Query("Label") description := ctx.Query("Description") engine := ctx.QueryInt("Engine") - trainTaskCreate := ctx.QueryBool("trainTaskCreate") modelSelectedFile := ctx.Query("modelSelectedFile") log.Info("engine=" + fmt.Sprint(engine) + " modelSelectedFile=" + modelSelectedFile) - if !trainTaskCreate { - if !ctx.Repo.CanWrite(models.UnitTypeModelManage) { - //ctx.NotFound(ctx.Req.URL.RequestURI(), nil) - ctx.JSON(403, ctx.Tr("repo.model_noright")) - return - } - } if JobId == "" || VersionName == "" { ctx.Error(500, fmt.Sprintf("JobId or VersionName is null.")) From 7d5cf069591cfdf351889a91dd2e64c33382dbc3 Mon Sep 17 00:00:00 2001 From: chenshihai Date: Thu, 21 Jul 2022 11:44:19 +0800 Subject: [PATCH 2/6] =?UTF-8?q?fix=20#1172=20=E6=A8=A1=E5=9E=8B=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=9C=892=E4=B8=AA=E5=B1=95=E5=BC=80=E7=9A=84?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E8=8A=82=E7=82=B9=E6=97=B6=EF=BC=8C=E7=BB=99?= =?UTF-8?q?A=E5=88=9B=E5=BB=BA=E6=96=B0=E7=89=88=E6=9C=AC=EF=BC=8CB?= =?UTF-8?q?=E7=9A=84=E5=B1=95=E5=BC=80=E5=9B=BE=E6=A0=87=E4=BC=9A=E6=B6=88?= =?UTF-8?q?=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web_src/js/components/Model.vue | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/web_src/js/components/Model.vue b/web_src/js/components/Model.vue index cb002e76a..cf1210d59 100644 --- a/web_src/js/components/Model.vue +++ b/web_src/js/components/Model.vue @@ -6,7 +6,7 @@ ref="table" :data="tableData" style="min-width: 100%" - row-key="ID" + row-key="rowKey" lazy :load="load" :tree-props="{children: 'Children', hasChildren: 'hasChildren'}" @@ -171,6 +171,7 @@ export default { tableData[i].EngineName = this.getEngineName(tableData[i]) tableData[i].ComputeResource = TrainTaskInfo.ComputeResource tableData[i].cName=tableData[i].Name + tableData[i].rowKey = tableData[i].ID + Math.random() tableData[i].Name='' tableData[i].VersionCount = '' tableData[i].Children = true @@ -310,18 +311,18 @@ export default { const store = this.$refs.table.store if(!this.loadNodeMap.get(row.cName)){ const parent = store.states.data - const index = parent.findIndex(child => child.ID == row.ID) + const index = parent.findIndex(child => child.rowKey == row.rowKey) this.getModelList() }else{ let {tree,treeNode,resolve} = this.loadNodeMap.get(row.cName) const keys = Object.keys(store.states.lazyTreeNodeMap); - if(keys.includes(row.ID)){ + if(keys.includes(row.rowKey)){ 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) + let childrenIndex = store.states.lazyTreeNodeMap[parentRow.rowKey].findIndex(child => child.rowKey == row.rowKey) parentRow.VersionCount = parentRow.VersionCount-1 - const parent = store.states.lazyTreeNodeMap[parentRow.ID] + const parent = store.states.lazyTreeNodeMap[parentRow.rowKey] if(parent.length===1){ this.getModelList() }else{ @@ -379,8 +380,8 @@ export default { } }, getModelList(){ - try { - this.$refs.table.store.states.lazyTreeNodeMap = {} + try { + this.loadNodeMap.clear(); this.$axios.get(location.href+'_api',{ params:this.params }).then((res)=>{ @@ -391,6 +392,7 @@ export default { for(let i=0;i Date: Thu, 21 Jul 2022 11:57:54 +0800 Subject: [PATCH 3/6] =?UTF-8?q?fix=20#1347=20=E5=AF=BC=E5=85=A5=E6=96=B0?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E6=97=B6=E8=B6=85=E9=95=BF=E8=AE=AD=E7=BB=83?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=90=8D=E7=A7=B0=E6=98=BE=E7=A4=BA=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E6=9C=89=E9=87=8D=E5=8F=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/repo/modelmanage/index.tmpl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/repo/modelmanage/index.tmpl b/templates/repo/modelmanage/index.tmpl index b54fa5cfa..c42f1ba7b 100644 --- a/templates/repo/modelmanage/index.tmpl +++ b/templates/repo/modelmanage/index.tmpl @@ -6,7 +6,8 @@ text-align: right; } .inline .ui.dropdown .text { - color: rgba(0, 0, 0, .87) !important + color: rgba(0, 0, 0, .87) !important; + max-width: 360px; } .newtext{ left: 15px !important From 2b91b1f8db054ed57dba9ed7ab2699c2a0911d60 Mon Sep 17 00:00:00 2001 From: chenshihai Date: Thu, 21 Jul 2022 12:33:04 +0800 Subject: [PATCH 4/6] =?UTF-8?q?fix=20#2478=20=E8=BF=81=E7=A7=BB=E5=A4=96?= =?UTF-8?q?=E9=83=A8=E9=A1=B9=E7=9B=AE=E6=97=B6=EF=BC=8C=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E7=94=9F=E6=88=90=E7=9A=84=E9=A1=B9=E7=9B=AE=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E6=9C=89=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/repo/migrate.tmpl | 2 +- web_src/js/index.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/repo/migrate.tmpl b/templates/repo/migrate.tmpl index ef667361e..68c8f16d0 100644 --- a/templates/repo/migrate.tmpl +++ b/templates/repo/migrate.tmpl @@ -11,7 +11,7 @@ {{template "base/alert" .}}
- + {{.i18n.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{.i18n.Tr "repo.migrate.clone_local_path"}}{{end}}
{{.i18n.Tr "repo.migrate.migrate_items_options"}} diff --git a/web_src/js/index.js b/web_src/js/index.js index 53dba8a88..ce859e4df 100755 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -2950,13 +2950,13 @@ $(document).ready(async () => { } const $cloneAddr = $("#clone_addr"); - $cloneAddr.on("change", () => { + $cloneAddr.on("input change", () => { const $repoName = $("#alias"); const $owner = $("#ownerDropdown div.text").attr("title"); const $urlAdd = location.href.split("/")[0] + "//" + location.href.split("/")[2]; - if ($cloneAddr.val().length > 0 && $repoName.val().length === 0) { - // Only modify if repo_name input is blank + if ($cloneAddr.val().length > 0 /* && $repoName.val().length === 0 */) { + // modify when clone address change const repoValue = $cloneAddr.val().match(/^(.*\/)?((.+?)(\.git)?)$/)[3]; $repoName.val($cloneAddr.val().match(/^(.*\/)?((.+?)(\.git)?)$/)[3]); $.get( From abb39d7ce29d965ab5d4565048fa58ee2a7799e6 Mon Sep 17 00:00:00 2001 From: chenshihai Date: Thu, 21 Jul 2022 14:50:42 +0800 Subject: [PATCH 5/6] =?UTF-8?q?fix=20#2370=20=E3=80=90=E9=95=9C=E5=83=8F?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E3=80=91=E6=8F=90=E4=BA=A4=E9=95=9C=E5=83=8F?= =?UTF-8?q?=E5=90=8E=E9=A1=B5=E9=9D=A2=E6=B2=A1=E6=9C=89=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E9=95=9C=E5=83=8F=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/repo/debugjob/index.tmpl | 1 + web_src/js/components/images/Images.vue | 40 ++++++++++++++++++++----- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/templates/repo/debugjob/index.tmpl b/templates/repo/debugjob/index.tmpl index 043816e9f..5381602b9 100755 --- a/templates/repo/debugjob/index.tmpl +++ b/templates/repo/debugjob/index.tmpl @@ -427,6 +427,7 @@ {{if .CanDebug}} {{$.i18n.Tr "repo.submit_image"}} {{else}} 私有 公开 - - + + - - + + - - + +
@@ -473,6 +473,7 @@ export default { tableDataCustom: [], starCustom:[], loadingCustom:false, + refreshCustomTimer: null, currentPageStar:1, pageSizeStar:10, @@ -485,6 +486,7 @@ export default { methods: { handleClick(tab, event) { this.search = '' + this.stopImageListCustomRefresh(); if(tab.name=="first"){ this.paramsPublic.q = '' this.getImageListPublic() @@ -560,9 +562,31 @@ export default { }); this.loadingCustom = false + this.getImageListCustomRefresh() }) }, + getImageListCustomRefresh() { + this.stopImageListCustomRefresh(); + this.refreshCustomTimer = setInterval(() => { + this.tableDataCustom.forEach(item => { + if (item.status === 0) { + this.$axios.get(`/image/${item.id}`, {}).then((res) => { + const newData = res.data; + this.tableDataCustom.forEach(it => { + if (it.id === newData.id) { + it.status = newData.status; + } + }); + }) + } + }); + }, 5000); + }, + + stopImageListCustomRefresh() { + this.refreshCustomTimer && clearInterval(this.refreshCustomTimer); + }, getImageListStar(){ this.loadingStar = true this.$axios.get('/explore/images/star',{ @@ -715,8 +739,10 @@ export default { else{ this.getImageListPublic() } + }, + beforeDestroy() { + this.stopImageListCustomRefresh(); } - }; From f33089b213397cf34acac0acc44fdcd4e0fbe4cd Mon Sep 17 00:00:00 2001 From: chenshihai Date: Thu, 21 Jul 2022 15:29:23 +0800 Subject: [PATCH 6/6] =?UTF-8?q?fix=20#1345=20=E5=89=8D=E7=AB=AF=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E6=A0=A1=E9=AA=8C=E4=B8=8D=E5=90=88=E6=B3=95=E7=9A=84?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=90=8D=E7=A7=B0=E5=B9=B6=E7=BB=99=E5=87=BA?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/repo/cloudbrain/inference/new.tmpl | 4 ++-- templates/repo/cloudbrain/new.tmpl | 21 ++++++++++++++++++ templates/repo/cloudbrain/trainjob/new.tmpl | 4 ++-- templates/repo/grampus/trainjob/gpu/new.tmpl | 2 +- templates/repo/grampus/trainjob/npu/new.tmpl | 2 +- .../repo/modelarts/inferencejob/new.tmpl | 4 ++-- templates/repo/modelarts/notebook/new.tmpl | 22 +++++++++++++++++++ templates/repo/modelarts/trainjob/new.tmpl | 2 +- 8 files changed, 52 insertions(+), 9 deletions(-) diff --git a/templates/repo/cloudbrain/inference/new.tmpl b/templates/repo/cloudbrain/inference/new.tmpl index 223fcfe1c..6d3da0be7 100644 --- a/templates/repo/cloudbrain/inference/new.tmpl +++ b/templates/repo/cloudbrain/inference/new.tmpl @@ -421,7 +421,7 @@ identifier : 'display_job_name', rules: [ { - type: 'regExp[/^[a-zA-Z0-9-_]{1,64}[^-]$/]', + type: 'regExp[/^[a-zA-Z0-9-_]{1,64}[a-zA-Z0-9_]$/]', } ] }, @@ -472,9 +472,9 @@ document.getElementById("mask").style.display = "none" } } + validate(); $('.ui.create_train_job.green.button').click(function(e) { send_run_para() get_name() - validate() }) diff --git a/templates/repo/cloudbrain/new.tmpl b/templates/repo/cloudbrain/new.tmpl index f0538261d..9552c80c0 100755 --- a/templates/repo/cloudbrain/new.tmpl +++ b/templates/repo/cloudbrain/new.tmpl @@ -294,6 +294,27 @@ context.value = '' $(".icon.icons").css("visibility", "hidden") } + function validate(){ + $('.ui.form').form({ + on: 'blur', + fields: { + display_job_name:{ + identifier : 'display_job_name', + rules: [ + { + type: 'regExp[/^[a-z0-9][a-z0-9-_]{1,34}[a-z0-9-]$/]', + } + ] + }, + }, + onSuccess: function(){ + }, + onFailure: function(e){ + return false; + } + }) + } + validate(); form.onsubmit = function (e) { let value_task = $("input[name='display_job_name']").val() let value_image = $("input[name='image']").val() diff --git a/templates/repo/cloudbrain/trainjob/new.tmpl b/templates/repo/cloudbrain/trainjob/new.tmpl index c410889b2..07540869d 100755 --- a/templates/repo/cloudbrain/trainjob/new.tmpl +++ b/templates/repo/cloudbrain/trainjob/new.tmpl @@ -483,9 +483,9 @@ $("input#ai_flaver_name").val(name2) } + validate(); $('.ui.create_train_job.green.button').click(function (e) { get_name() - send_run_para() - validate() + send_run_para() }) \ No newline at end of file diff --git a/templates/repo/grampus/trainjob/gpu/new.tmpl b/templates/repo/grampus/trainjob/gpu/new.tmpl index 75b8bcff2..9321532bf 100755 --- a/templates/repo/grampus/trainjob/gpu/new.tmpl +++ b/templates/repo/grampus/trainjob/gpu/new.tmpl @@ -433,9 +433,9 @@ $("input#ai_flavor_name").val(name2) } + validate(); $('.ui.create_train_job.green.button').click(function(e) { get_name() send_run_para() - validate() }) \ No newline at end of file diff --git a/templates/repo/grampus/trainjob/npu/new.tmpl b/templates/repo/grampus/trainjob/npu/new.tmpl index f23942e13..827a2ad8e 100755 --- a/templates/repo/grampus/trainjob/npu/new.tmpl +++ b/templates/repo/grampus/trainjob/npu/new.tmpl @@ -425,9 +425,9 @@ $("input#trainjob_work_server_num").val(val_server_num_select) } + validate(); $('.ui.create_train_job.green.button').click(function(e) { get_name() send_run_para() - validate() }) diff --git a/templates/repo/modelarts/inferencejob/new.tmpl b/templates/repo/modelarts/inferencejob/new.tmpl index 89f4180c0..91d856bf7 100644 --- a/templates/repo/modelarts/inferencejob/new.tmpl +++ b/templates/repo/modelarts/inferencejob/new.tmpl @@ -438,7 +438,7 @@ identifier : 'display_job_name', rules: [ { - type: 'regExp[/^[a-zA-Z0-9-_]{1,64}[^-]$/]', + type: 'regExp[/^[a-zA-Z0-9-_]{1,64}[a-zA-Z0-9_]$/]', } ] }, @@ -489,9 +489,9 @@ document.getElementById("mask").style.display = "none" } } + validate(); $('.ui.create_train_job.green.button').click(function(e) { send_run_para() get_name() - validate() }) diff --git a/templates/repo/modelarts/notebook/new.tmpl b/templates/repo/modelarts/notebook/new.tmpl index 6ab16f941..b81bdfdec 100755 --- a/templates/repo/modelarts/notebook/new.tmpl +++ b/templates/repo/modelarts/notebook/new.tmpl @@ -110,6 +110,28 @@ $('#messageInfo').css('display','none') + function validate(){ + $('.ui.form').form({ + on: 'blur', + fields: { + display_job_name:{ + identifier : 'display_job_name', + rules: [ + { + type: 'regExp[/^[a-z0-9][a-z0-9-_]{1,36}$/]', + } + ] + }, + }, + onSuccess: function(){ + }, + onFailure: function(e){ + return false; + } + }) + } + validate(); + form.onsubmit = function(e){ let value_task = $("input[name='display_job_name']").val() diff --git a/templates/repo/modelarts/trainjob/new.tmpl b/templates/repo/modelarts/trainjob/new.tmpl index e89482dc2..26c57327d 100755 --- a/templates/repo/modelarts/trainjob/new.tmpl +++ b/templates/repo/modelarts/trainjob/new.tmpl @@ -500,9 +500,9 @@ $("input#trainjob_work_server_num").val(val_server_num_select) } + validate(); $('.ui.create_train_job.green.button').click(function (e) { get_name() send_run_para() - validate() }) \ No newline at end of file