diff --git a/models/user_business_analysis.go b/models/user_business_analysis.go index cb503d669..47036e2e9 100644 --- a/models/user_business_analysis.go +++ b/models/user_business_analysis.go @@ -920,7 +920,7 @@ func CounDataByDateAndReCount(wikiCountMap map[string]int, startTime time.Time, CountDate = time.Date(startTime.Year(), startTime.Month(), startTime.Day(), 0, 1, 0, 0, currentTimeNow.Location()) } - DataDate := startTime.Format("2006-01-02") + DataDate := CountDate.Format("2006-01-02") CodeMergeCountMap := queryPullRequest(start_unix, end_unix) CommitCountMap := queryCommitAction(start_unix, end_unix, 5) IssueCountMap := queryCreateIssue(start_unix, end_unix) @@ -1103,6 +1103,7 @@ func updateNewUserAcitivity(currentUserActivity map[int64]map[int64]int64, userA ",activate_regist_user=" + fmt.Sprint(useMetrics.ActivateRegistUser) + ",not_activate_regist_user=" + fmt.Sprint(useMetrics.CurrentDayRegistUser-useMetrics.ActivateRegistUser) + ",current_day_regist_user=" + fmt.Sprint(useMetrics.CurrentDayRegistUser) + + ",data_date='" + time.Unix(key, 0).Format("2006-01-02") + "'" + " where count_date=" + fmt.Sprint(key) statictisSess.Exec(updateSql) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index b641f4011..105abf006 100755 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1007,7 +1007,7 @@ cloudbrain.time.starttime=Start run time cloudbrain.time.endtime=End run time cloudbrain.datasetdownload=Dataset download url model_manager = Model -model_noright=No right +model_noright=You have no right to do the operation. model_rename=Duplicate model name, please modify model name. date=Date @@ -1225,7 +1225,7 @@ model.manage.create_new_convert_task=Create Model Transformation Task modelconvert.manage.create_error1=A model transformation task with the same name already exists. modelconvert.manage.create_error2=Only one running model transformation task can be created. modelconvert.manage.model_not_exist=The model does not exist. -modelconvert.manage.no_operate_right=No operation permission. +modelconvert.manage.no_operate_right=You have no right to do the operation. grampus.train_job.ai_center = AI Center grampus.dataset_path_rule = The code is storaged in /cache/code;the dataset is storaged in /cache/dataset;and please put your model into /cache/output, then you can download it online。 diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index 87630d6c0..1717f5cfd 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -1006,7 +1006,7 @@ datasets.desc=数据集功能 cloudbrain_helper=使用GPU/NPU资源,开启Notebook、模型训练任务等 model_manager = 模型 -model_noright=无权限操作 +model_noright=您没有操作权限。 model_rename=模型名称重复,请修改模型名称 @@ -1237,7 +1237,7 @@ model.manage.create_new_convert_task=创建模型转换任务 modelconvert.manage.create_error1=相同的名称模型转换任务已经存在。 modelconvert.manage.create_error2=只能创建一个正在运行的模型转换任务。 modelconvert.manage.model_not_exist=选择的模型不存在。 -modelconvert.manage.no_operate_right=无操作权限。 +modelconvert.manage.no_operate_right=您没有操作权限。 grampus.train_job.ai_center=智算中心 grampus.dataset_path_rule = 训练脚本存储在/cache/code中,数据集存储在/cache/dataset中,训练输出请存储在/cache/output中以供后续下载。 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.")) 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/debugjob/index.tmpl b/templates/repo/debugjob/index.tmpl index bb1d1992a..ee020a8ca 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}} \ 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/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/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 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 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 私有 公开 - - + + - - + + - - + +
@@ -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(); } - }; 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(