From 793a2be76a5d068e86e7515e0d056b9686eef512 Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Tue, 4 Jan 2022 14:46:20 +0800 Subject: [PATCH] fix issue --- options/locale/locale_en-US.ini | 1 + options/locale/locale_zh-CN.ini | 1 + templates/repo/modelarts/trainjob/show.tmpl | 127 +++++++++++++++++++++++++++- templates/repo/modelmanage/index.tmpl | 2 - 4 files changed, 128 insertions(+), 3 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 272957887..1dceb5c4a 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -844,6 +844,7 @@ modelarts.current_version=Current version modelarts.parent_version=Parent Version modelarts.run_version=Run Version modelarts.train_job.compute_node=Compute Node +modelarts.create_model = Create Model modelarts.train_job.basic_info=Basic Info diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index efa730002..2e7f4d73c 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -849,6 +849,7 @@ modelarts.modify=修改 modelarts.current_version=当前版本 modelarts.parent_version=父版本 modelarts.run_version=运行版本 +modelarts.create_model=创建模型 diff --git a/templates/repo/modelarts/trainjob/show.tmpl b/templates/repo/modelarts/trainjob/show.tmpl index 956853d94..0be93fc8f 100755 --- a/templates/repo/modelarts/trainjob/show.tmpl +++ b/templates/repo/modelarts/trainjob/show.tmpl @@ -161,6 +161,15 @@ td, th { padding-top: 0.5rem ; } +
+
+
+
+
+
+
+
+
{{template "repo/header" .}}
@@ -188,6 +197,12 @@ td, th {
{{$.CsrfTokenHtml}} {{if .CanModify}} + {{$.i18n.Tr "repo.modelarts.create_model"}} + {{else}} + {{$.i18n.Tr "repo.modelarts.create_model"}} + {{end}} + {{$.CsrfTokenHtml}} + {{if .CanModify}} {{$.i18n.Tr "repo.modelarts.modify"}} {{else}} {{$.i18n.Tr "repo.modelarts.modify"}} @@ -446,6 +461,62 @@ td, th {
+ +
+
{{template "base/footer" .}} @@ -479,7 +550,61 @@ td, th { } let timeid = window.setInterval(loadJobStatus, 30000); $(document).ready(loadJobStatus); - + function showcreate(obj){ + $('.ui.modal.second') + .modal({ + centered: false, + onShow:function(){ + $('input[name="Version"]').addClass('model_disabled') + // $('input[name="JobId"]').text(obj.JobName) + $('#JobName').val(obj.JobName).addClass('model_disabled') + $('input[name="JobId"]').val(obj.JobID) + $('input[name="VersionName"]').val(obj.VersionName).addClass('model_disabled') + $('.ui.dimmer').css({"background-color":"rgb(136, 136, 136,0.7)"}) + createModelName() + + + }, + onHide:function(){ + document.getElementById("formId").reset(); + $('.ui.dimmer').css({"background-color":""}) + $('.ui.error.message').text() + $('.ui.error.message').css('display','none') + + } + }) + .modal('show') + } + function createModel(){ + let url_href = `/${userName}/${repoPath}/modelmanage/create_new_model` + let data = $("#formId").serialize() + $("#mask").css({"display":"block","z-index":"9999"}) + $.ajax({ + url:url_href, + type:'POST', + data:data, + success:function(res){ + location.href=`/${userName}/${repoPath}/modelmanage/show_model` + $('.ui.modal.second').modal('hide') + }, + error: function(xhr){ + // 隐藏 loading + // 只有请求不正常(状态码不为200)才会执行 + $('.ui.error.message').text(xhr.responseText) + $('.ui.error.message').css('display','block') + }, + complete:function(xhr){ + $("#mask").css({"display":"none","z-index":"1"}) + } + }) + + } + function createModelName(){ + let repoName = location.pathname.split('/')[2] + let modelName = repoName + '_model_' + Math.random().toString(36).substr(2, 4) + $('#name').val(modelName) + $('#version').val("0.0.1") + } function renderSize(value){ if(null==value||value==''){ return "0 Bytes"; diff --git a/templates/repo/modelmanage/index.tmpl b/templates/repo/modelmanage/index.tmpl index c83816c62..5dd54a6d3 100644 --- a/templates/repo/modelmanage/index.tmpl +++ b/templates/repo/modelmanage/index.tmpl @@ -104,7 +104,6 @@ -
@@ -118,7 +117,6 @@
-