diff --git a/templates/repo/cloudbrain/benchmark/new.tmpl b/templates/repo/cloudbrain/benchmark/new.tmpl index 18516a765..58f471ede 100755 --- a/templates/repo/cloudbrain/benchmark/new.tmpl +++ b/templates/repo/cloudbrain/benchmark/new.tmpl @@ -130,7 +130,7 @@
@@ -230,7 +230,7 @@
@@ -325,6 +325,7 @@ } } } + var isValidate = false; function validate() { $('.ui.form') .form({ @@ -348,12 +349,18 @@ } ] }, + spec_id: { + identifier: 'spec_id', + rules: [{ type: 'empty' }] + } }, onSuccess: function () { // $('.ui.page.dimmer').dimmer('show') document.getElementById("mask").style.display = "block" + isValidate = true; }, onFailure: function (e) { + isValidate = false; return false; } }) diff --git a/templates/repo/cloudbrain/inference/new.tmpl b/templates/repo/cloudbrain/inference/new.tmpl index c0facf8b4..08cc23557 100644 --- a/templates/repo/cloudbrain/inference/new.tmpl +++ b/templates/repo/cloudbrain/inference/new.tmpl @@ -254,7 +254,7 @@ -->
-
@@ -443,6 +443,8 @@ msg = JSON.stringify(msg) $('#store_run_para').val(msg) } + + var isValidate = false; function validate(){ $('.ui.form') .form({ @@ -496,12 +498,18 @@ type: 'empty', } ] + }, + spec_id: { + identifier: 'spec_id', + rules: [{ type: 'empty' }] } }, onSuccess: function(){ document.getElementById("mask").style.display = "block" + isValidate = true; }, onFailure: function(e){ + isValidate = false; return false; } }) diff --git a/templates/repo/cloudbrain/new.tmpl b/templates/repo/cloudbrain/new.tmpl index cac971eaf..b9efe1d4b 100755 --- a/templates/repo/cloudbrain/new.tmpl +++ b/templates/repo/cloudbrain/new.tmpl @@ -145,7 +145,7 @@
@@ -208,6 +208,7 @@ context.value = '' $(".icon.icons").css("visibility", "hidden") } + var isValidate = false; function validate(){ $('.ui.form').form({ on: 'blur', @@ -219,11 +220,17 @@ type: 'regExp[/^[a-z0-9][a-z0-9-_]{1,34}[a-z0-9-]$/]', } ] - }, + }, + spec_id: { + identifier: 'spec_id', + rules: [{ type: 'empty' }] + } }, - onSuccess: function(){ + onSuccess: function(){ + isValidate = true; }, onFailure: function(e){ + isValidate = false; return false; } }) @@ -231,6 +238,7 @@ validate(); let createFlag = false form.onsubmit = function (e) { + if (!isValidate) return false; if(createFlag) return false let value_task = $("input[name='display_job_name']").val() let value_image = $("input[name='image']").val() @@ -298,7 +306,7 @@ } selected_value = $("#cloudbrain_benchmark_category").val() $('#store_category').attr("value", selected_value) - + validate(); }) ;(function() { diff --git a/templates/repo/cloudbrain/trainjob/new.tmpl b/templates/repo/cloudbrain/trainjob/new.tmpl index 9d680cd70..709490ac1 100755 --- a/templates/repo/cloudbrain/trainjob/new.tmpl +++ b/templates/repo/cloudbrain/trainjob/new.tmpl @@ -258,7 +258,7 @@
-
@@ -354,7 +354,8 @@ $('select.dropdown') .dropdown(); - + + var isValidate = false; function validate() { $('.ui.form') .form({ @@ -400,13 +401,19 @@ type: 'empty', } ] + }, + spec_id: { + identifier: 'spec_id', + rules: [{ type: 'empty' }] } }, onSuccess: function () { // $('.ui.page.dimmer').dimmer('show') document.getElementById("mask").style.display = "block" + isValidate = true; }, onFailure: function (e) { + isValidate = false; return false; } }) diff --git a/templates/repo/grampus/trainjob/gpu/new.tmpl b/templates/repo/grampus/trainjob/gpu/new.tmpl index 6eb2b49fd..90b38c422 100755 --- a/templates/repo/grampus/trainjob/gpu/new.tmpl +++ b/templates/repo/grampus/trainjob/gpu/new.tmpl @@ -206,7 +206,7 @@ -->
- +
@@ -296,6 +296,7 @@ $('select.dropdown') .dropdown(); + var isValidate = false; function validate(){ $('.ui.form') .form({ @@ -342,13 +343,19 @@ type : 'integer[1..25]', } ] + }, + spec_id: { + identifier: 'spec_id', + rules: [{ type: 'empty' }] } }, onSuccess: function(){ // $('.ui.page.dimmer').dimmer('show') document.getElementById("mask").style.display = "block" + isValidate = true; }, onFailure: function(e){ + isValidate = false; return false; } }) diff --git a/templates/repo/grampus/trainjob/npu/new.tmpl b/templates/repo/grampus/trainjob/npu/new.tmpl index 6849528dc..88a41779e 100755 --- a/templates/repo/grampus/trainjob/npu/new.tmpl +++ b/templates/repo/grampus/trainjob/npu/new.tmpl @@ -218,7 +218,7 @@
-->
- +
@@ -322,6 +322,7 @@ $('select.dropdown') .dropdown(); + var isValidate = false; function validate(){ $('.ui.form') .form({ @@ -359,13 +360,19 @@ type : 'integer[1..25]', } ] + }, + spec_id: { + identifier: 'spec_id', + rules: [{ type: 'empty' }] } }, onSuccess: function(){ // $('.ui.page.dimmer').dimmer('show') document.getElementById("mask").style.display = "block" + isValidate = true; }, onFailure: function(e){ + isValidate = false; return false; } }) diff --git a/templates/repo/modelarts/inferencejob/new.tmpl b/templates/repo/modelarts/inferencejob/new.tmpl index 2bf4a9d3d..0fb0e5504 100644 --- a/templates/repo/modelarts/inferencejob/new.tmpl +++ b/templates/repo/modelarts/inferencejob/new.tmpl @@ -275,7 +275,7 @@
-->
- +
@@ -465,6 +465,8 @@ $("input#ai_engine_name").val(name1) $("input#ai_flaver_name").val(name2) } + + var isValidate = false; function validate(){ $('.ui.form') .form({ @@ -518,12 +520,18 @@ type: 'empty', } ] + }, + spec_id: { + identifier: 'spec_id', + rules: [{ type: 'empty' }] } }, onSuccess: function(){ document.getElementById("mask").style.display = "block" + isValidate = true; }, onFailure: function(e){ + isValidate = false; return false; } }) diff --git a/templates/repo/modelarts/notebook/new.tmpl b/templates/repo/modelarts/notebook/new.tmpl index e2848b9e9..4f10f43fb 100755 --- a/templates/repo/modelarts/notebook/new.tmpl +++ b/templates/repo/modelarts/notebook/new.tmpl @@ -79,7 +79,7 @@
-->
- +
- +
@@ -464,6 +464,7 @@ $('select.dropdown') .dropdown(); + var isValidate = false; function validate() { $('.ui.form') .form({ @@ -503,11 +504,17 @@ ] } }, + spec_id: { + identifier: 'spec_id', + rules: [{ type: 'empty' }] + } onSuccess: function () { // $('.ui.page.dimmer').dimmer('show') document.getElementById("mask").style.display = "block" + isValidate = true; }, onFailure: function (e) { + isValidate = false; return false; } }) diff --git a/templates/repo/modelarts/trainjob/version_new.tmpl b/templates/repo/modelarts/trainjob/version_new.tmpl index 7bdba6d46..c95f5699a 100644 --- a/templates/repo/modelarts/trainjob/version_new.tmpl +++ b/templates/repo/modelarts/trainjob/version_new.tmpl @@ -263,7 +263,7 @@
-->
- +
@@ -431,53 +431,7 @@ $('select.dropdown') .dropdown(); - $('.ui.form') - .form({ - on: 'blur', - inline:true, - fields: { - boot_file: { - identifier : 'boot_file', - rules: [ - { - type: 'regExp[/.+\.py$/g]', - prompt : '启动文件必须为.py结尾' - } - ] - }, - job_name:{ - identifier : 'job_name', - rules: [ - { - type: 'regExp[/^[a-zA-Z0-9-_]{1,36}$/]', - prompt : '只包含大小写字母、数字、_和-,最长36个字符。' - } - ] - }, - display_job_name:{ - identifier : 'display_job_name', - rules: [ - { - type: 'regExp[/^[a-zA-Z0-9-_]{1,36}$/]', - prompt : '只包含大小写字母、数字、_和-,最长36个字符。' - } - ] - }, - attachment:{ - identifier : 'attachment', - rules: [ - { - type: 'empty', - prompt : '选择一个数据集' - } - ] - - }, - }, - }) - - - + var isValidate = false; function validate(){ $('.ui.form') .form({ @@ -521,12 +475,18 @@ ] }, + spec_id: { + identifier: 'spec_id', + rules: [{ type: 'empty' }] + } }, onSuccess: function(){ // $('.ui.page.dimmer').dimmer('show') document.getElementById("mask").style.display = "block" + isValidate = true; }, onFailure: function(e){ + isValidate = false; return false; } }) diff --git a/web_src/js/standalone/specsuse.js b/web_src/js/standalone/specsuse.js index 423c92c3b..1b9c075f9 100644 --- a/web_src/js/standalone/specsuse.js +++ b/web_src/js/standalone/specsuse.js @@ -21,9 +21,11 @@ window.renderSpecStr = (spec, showPoint, langObj) => { window.renderSpecsSelect = (specsSel, data, showPoint, langObj) => { specsSel.empty(); data = data || []; + var oValue = specsSel.attr('ovalue'); for (var i = 0, iLen = data.length; i < iLen; i++) { var spec = data[i]; var specStr = window.renderSpecStr(spec, showPoint, langObj); specsSel.append(``); - } + } + oValue && specsSel.val(oValue); }