Browse Source

#2865 【资源管理】新建云脑任务报错后仍保持上一次选的规格

#2866 【资源规格】规格为空时新建云脑任务请求不用提交到后端
res-manage-v2
chenshihai 2 years ago
parent
commit
7121eeaacf
11 changed files with 95 additions and 66 deletions
  1. +9
    -2
      templates/repo/cloudbrain/benchmark/new.tmpl
  2. +9
    -1
      templates/repo/cloudbrain/inference/new.tmpl
  3. +12
    -4
      templates/repo/cloudbrain/new.tmpl
  4. +9
    -2
      templates/repo/cloudbrain/trainjob/new.tmpl
  5. +8
    -1
      templates/repo/grampus/trainjob/gpu/new.tmpl
  6. +8
    -1
      templates/repo/grampus/trainjob/npu/new.tmpl
  7. +9
    -1
      templates/repo/modelarts/inferencejob/new.tmpl
  8. +12
    -4
      templates/repo/modelarts/notebook/new.tmpl
  9. +8
    -1
      templates/repo/modelarts/trainjob/new.tmpl
  10. +8
    -48
      templates/repo/modelarts/trainjob/version_new.tmpl
  11. +3
    -1
      web_src/js/standalone/specsuse.js

+ 9
- 2
templates/repo/cloudbrain/benchmark/new.tmpl View File

@@ -130,7 +130,7 @@
<div class="required min_title inline field" style="margin-top:2rem;">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.resource_specification"}}</label>
<select id="__specs__" class="ui search dropdown width48"
placeholder="{{.i18n.Tr "cloudbrain.select_specification"}}" style='width:385px'
placeholder="{{.i18n.Tr "cloudbrain.select_specification"}}" style='width:385px' ovalue="{{.spec_id}}"
name="spec_id">
</select>
</div>
@@ -230,7 +230,7 @@
<div class="required min_title inline field">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.resource_specification"}}</label>
<select id="__specs__" class="ui search dropdown width48"
placeholder="{{.i18n.Tr "cloudbrain.select_specification"}}" style='width:385px'
placeholder="{{.i18n.Tr "cloudbrain.select_specification"}}" style='width:385px' ovalue="{{.spec_id}}"
name="spec_id">
</select>
</div>
@@ -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;
}
})


+ 9
- 1
templates/repo/cloudbrain/inference/new.tmpl View File

@@ -254,7 +254,7 @@
</div>-->
<div class="required min_title inline field">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.resource_specification"}}</label>
<select id="__specs__" class="ui search dropdown width48" placeholder="{{.i18n.Tr "cloudbrain.select_specification"}}" name="spec_id">
<select id="__specs__" class="ui search dropdown width48" placeholder="{{.i18n.Tr "cloudbrain.select_specification"}}" ovalue="{{.spec_id}}" name="spec_id">
</select>
</div>
<!-- 表单操作 -->
@@ -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;
}
})


+ 12
- 4
templates/repo/cloudbrain/new.tmpl View File

@@ -145,7 +145,7 @@
<div class="inline required field">
<label>{{.i18n.Tr "cloudbrain.resource_specification"}}</label>
<select id="__specs__" class="ui search dropdown"
placeholder="{{.i18n.Tr "cloudbrain.select_specification"}}" style='width:385px'
placeholder="{{.i18n.Tr "cloudbrain.select_specification"}}" style='width:385px' ovalue="{{.spec_id}}"
name="spec_id">
</select>
</div>
@@ -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() {


+ 9
- 2
templates/repo/cloudbrain/trainjob/new.tmpl View File

@@ -258,7 +258,7 @@

<div class="required min_title inline field">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.resource_specification"}}</label>
<select id="__specs__" class="ui dropdown width48" placeholder="{{.i18n.Tr "cloudbrain.select_specification"}}"
<select id="__specs__" class="ui dropdown width48" placeholder="{{.i18n.Tr "cloudbrain.select_specification"}}" ovalue="{{.spec_id}}"
name="spec_id">
</select>
</div>
@@ -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;
}
})


+ 8
- 1
templates/repo/grampus/trainjob/gpu/new.tmpl View File

@@ -206,7 +206,7 @@
</div>-->
<div class="required min_title inline field" id="flavor_name">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.standard"}}</label>
<select class="ui dropdown width48" id="__specs__" style='width:385px' name="spec_id"></select>
<select class="ui dropdown width48" id="__specs__" style='width:385px' name="spec_id" ovalue="{{.spec_id}}"></select>
</div>

<div class="inline min_title field">
@@ -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;
}
})


+ 8
- 1
templates/repo/grampus/trainjob/npu/new.tmpl View File

@@ -218,7 +218,7 @@
</div>-->
<div class="required min_title inline field" id="flavor_name">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.standard"}}</label>
<select class="ui dropdown width48" id="__specs__" style='width:385px' name="spec_id"></select>
<select class="ui dropdown width48" id="__specs__" style='width:385px' name="spec_id" ovalue="{{.spec_id}}"></select>
</div>
<div class="inline required min_title field">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.amount_of_compute_node"}}</label>
@@ -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;
}
})


+ 9
- 1
templates/repo/modelarts/inferencejob/new.tmpl View File

@@ -275,7 +275,7 @@
</div>-->
<div class="required min_title inline field" id="flaver_name">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.standard"}}</label>
<select class="ui dropdown width48" id="__specs__" name="spec_id"></select>
<select class="ui dropdown width48" id="__specs__" name="spec_id" ovalue="{{.spec_id}}"></select>
</div>
<!-- 计算节点 -->
<div class="inline required min_title field">
@@ -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;
}
})


+ 12
- 4
templates/repo/modelarts/notebook/new.tmpl View File

@@ -79,7 +79,7 @@
</div>-->
<div class="inline required field">
<label>{{.i18n.Tr "cloudbrain.specification"}}</label>
<select id="__specs__" class="ui search dropdown" placeholder="{{.i18n.Tr "cloudbrain.select_specification"}}" style='width:385px' name="spec_id"></select>
<select id="__specs__" class="ui search dropdown" placeholder="{{.i18n.Tr "cloudbrain.select_specification"}}" style='width:385px' name="spec_id" ovalue="{{.spec_id}}"></select>
</div>
<!--<div class="inline required field">
<label>数据集存放路径</label>
@@ -109,6 +109,7 @@

$('#messageInfo').css('display','none')

var isValidate = false;
function validate(){
$('.ui.form').form({
on: 'blur',
@@ -120,11 +121,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;
}
})
@@ -132,7 +139,8 @@
validate();
let createFlag = false
form.onsubmit = function(e){
if(createFlag) return false
if(!isValidate) return false;
if(createFlag) return false;
let value_task = $("input[name='display_job_name']").val()
let re = /^[a-z0-9][a-z0-9-_]{1,34}[a-z0-9-]$/
let flag = re.test(value_task)


+ 8
- 1
templates/repo/modelarts/trainjob/new.tmpl View File

@@ -283,7 +283,7 @@
</div>-->
<div class="required inline min_title field" id="flaver_name">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.standard"}}</label>
<select class="ui dropdown width48" id="__specs__" name="spec_id"></select>
<select class="ui dropdown width48" id="__specs__" name="spec_id" ovalue="{{.spec_id}}"></select>
</div>
<div class="inline required min_title field">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.amount_of_compute_node"}}</label>
@@ -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;
}
})


+ 8
- 48
templates/repo/modelarts/trainjob/version_new.tmpl View File

@@ -263,7 +263,7 @@
</div>-->
<div class="required unite min_title inline field" id="flaver_name">
<label style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.standard"}}</label>
<select id="__specs__" class="ui dropdown width81" style='width:385px' name="spec_id"></select>
<select id="__specs__" class="ui dropdown width81" style='width:385px' name="spec_id" ovalue="{{.spec_id}}"></select>
</div>
<div class="inline required unite min_title field">
<label style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.amount_of_compute_node"}}</label>
@@ -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;
}
})


+ 3
- 1
web_src/js/standalone/specsuse.js View File

@@ -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(`<option name="spec_id" value="${spec.ID}" queueCode="${spec.QueueCode}">${specStr}</option>`);
}
}
oValue && specsSel.val(oValue);
}

Loading…
Cancel
Save