|
|
|
@@ -202,7 +202,7 @@ |
|
|
|
<label style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.run_parameter"}}</label> |
|
|
|
<span id="add_run_para" style="margin-left: 0.5rem;cursor:pointer;color: rgba(3, 102, 214, 100);font-size: 14px;line-height: 26px;font-family: SourceHanSansSC-medium;"><i class="plus square outline icon"></i>{{.i18n.Tr "repo.modelarts.train_job.add_run_parameter"}}</span> |
|
|
|
<input id="store_run_para" type="hidden" name="run_para_list"> |
|
|
|
<div class="dynamic field" style="margin-top: 1rem;" data-params="{{.run_para_list}}"> |
|
|
|
<div class="dynamic field" style="margin-top: 1rem;" data-params="{{.run_para_list}}" data-params-value="{{.i18n.Tr "repo.modelarts.train_job.parameter_value"}}" data-params-name="{{.i18n.Tr "repo.modelarts.train_job.parameter_name"}}"> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
@@ -276,7 +276,7 @@ |
|
|
|
</div> |
|
|
|
{{template "base/footer" .}} |
|
|
|
<script src="{{StaticUrlPrefix}}/js/specsuse.js?v={{MD5 AppVer}}" type="text/javascript"></script> |
|
|
|
|
|
|
|
<script src="{{StaticUrlPrefix}}/js/cloudbrainNew.js?v={{MD5 AppVer}}" type="text/javascript"></script> |
|
|
|
<script> |
|
|
|
let url_href = location.pathname.split('/create_version')[0] |
|
|
|
let url_post = location.pathname |
|
|
|
@@ -285,182 +285,182 @@ |
|
|
|
$(".ui.button").attr('href',url_href) |
|
|
|
$(".ui.form").attr('action',url_post) |
|
|
|
$("input[name=version_name]").attr('value',version_name) |
|
|
|
$('select.dropdown') |
|
|
|
.dropdown(); |
|
|
|
|
|
|
|
$('.menu .item') |
|
|
|
.tab(); |
|
|
|
|
|
|
|
let sever_num = $('#trainjob_work_server_num') |
|
|
|
$('.add').click(function(){ |
|
|
|
sever_num.val(parseInt(sever_num.val())+1) |
|
|
|
if(sever_num.val()>=26){ |
|
|
|
sever_num.val(parseInt(sever_num.val())-1) |
|
|
|
} |
|
|
|
}) |
|
|
|
$('.min').click(function(){ |
|
|
|
sever_num.val(parseInt(sever_num.val())-1) |
|
|
|
if(sever_num.val()<=0){ |
|
|
|
sever_num.val(parseInt(sever_num.val())+1) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
$(document).ready(function(){ |
|
|
|
let params = $('.dynamic.field').data('params') |
|
|
|
params&¶ms.parameter.forEach((item,index)=>{ |
|
|
|
Add_parameter(index,flag=true,item) |
|
|
|
}) |
|
|
|
}) |
|
|
|
// 参数增加、删除、修改、保存 |
|
|
|
function Add_parameter(i,flag=false,paramsObject={}) { |
|
|
|
let value = '' |
|
|
|
value += `<div class="two fields width85" id= "para${i}">` |
|
|
|
value += '<div class="field">' |
|
|
|
let placeholder_value='{{.i18n.Tr "repo.modelarts.train_job.parameter_value"}}' |
|
|
|
let placeholder_name='{{.i18n.Tr "repo.modelarts.train_job.parameter_name"}}' |
|
|
|
if(flag){ |
|
|
|
value +=`<input type="text" class="shipping_first-name" value="${paramsObject.label}">` |
|
|
|
}else{ |
|
|
|
value +='<input type="text" class="shipping_first-name" required placeholder="' + placeholder_name+ '">' |
|
|
|
} |
|
|
|
value += '</div>' |
|
|
|
value += '<div class="field">' |
|
|
|
if(flag){ |
|
|
|
value +=`<input type="text" class="shipping_last-name" value="${paramsObject.value}">` |
|
|
|
}else{ |
|
|
|
value +='<input type="text" class="shipping_last-name" required placeholder="' + placeholder_value+ '">' |
|
|
|
} |
|
|
|
value += '</div>' |
|
|
|
value += '<span><i class="trash icon"></i></span>' |
|
|
|
value += '</div>' |
|
|
|
$(".dynamic.field").append(value) |
|
|
|
|
|
|
|
} |
|
|
|
// $('select.dropdown') |
|
|
|
// .dropdown(); |
|
|
|
|
|
|
|
// $('.menu .item') |
|
|
|
// .tab(); |
|
|
|
|
|
|
|
// let sever_num = $('#trainjob_work_server_num') |
|
|
|
// $('.add').click(function(){ |
|
|
|
// sever_num.val(parseInt(sever_num.val())+1) |
|
|
|
// if(sever_num.val()>=26){ |
|
|
|
// sever_num.val(parseInt(sever_num.val())-1) |
|
|
|
// } |
|
|
|
// }) |
|
|
|
// $('.min').click(function(){ |
|
|
|
// sever_num.val(parseInt(sever_num.val())-1) |
|
|
|
// if(sever_num.val()<=0){ |
|
|
|
// sever_num.val(parseInt(sever_num.val())+1) |
|
|
|
// } |
|
|
|
// }) |
|
|
|
|
|
|
|
// $(document).ready(function(){ |
|
|
|
// let params = $('.dynamic.field').data('params') |
|
|
|
// params&¶ms.parameter.forEach((item,index)=>{ |
|
|
|
// Add_parameter(index,flag=true,item) |
|
|
|
// }) |
|
|
|
// }) |
|
|
|
// // 参数增加、删除、修改、保存 |
|
|
|
// function Add_parameter(i,flag=false,paramsObject={}) { |
|
|
|
// let value = '' |
|
|
|
// value += `<div class="two fields width85" id= "para${i}">` |
|
|
|
// value += '<div class="field">' |
|
|
|
// let placeholder_value='{{.i18n.Tr "repo.modelarts.train_job.parameter_value"}}' |
|
|
|
// let placeholder_name='{{.i18n.Tr "repo.modelarts.train_job.parameter_name"}}' |
|
|
|
// if(flag){ |
|
|
|
// value +=`<input type="text" class="shipping_first-name" value="${paramsObject.label}">` |
|
|
|
// }else{ |
|
|
|
// value +='<input type="text" class="shipping_first-name" required placeholder="' + placeholder_name+ '">' |
|
|
|
// } |
|
|
|
// value += '</div>' |
|
|
|
// value += '<div class="field">' |
|
|
|
// if(flag){ |
|
|
|
// value +=`<input type="text" class="shipping_last-name" value="${paramsObject.value}">` |
|
|
|
// }else{ |
|
|
|
// value +='<input type="text" class="shipping_last-name" required placeholder="' + placeholder_value+ '">' |
|
|
|
// } |
|
|
|
// value += '</div>' |
|
|
|
// value += '<span><i class="trash icon"></i></span>' |
|
|
|
// value += '</div>' |
|
|
|
// $(".dynamic.field").append(value) |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
$('#add_run_para').click(function () { |
|
|
|
var len = $(".dynamic.field .two.fields").length |
|
|
|
Add_parameter(len) |
|
|
|
}); |
|
|
|
|
|
|
|
$(".dynamic.field").on("click", ".trash.icon", function () { |
|
|
|
var index = $(this).parent().parent().index() |
|
|
|
$(this).parent().parent().remove() |
|
|
|
var len = $(".dynamic.field .two.fields").length |
|
|
|
$(".dynamic.field .two.fields").each(function () { |
|
|
|
var cur_index = $(this).index() |
|
|
|
$(this).attr('id', 'para' + cur_index) |
|
|
|
}) |
|
|
|
}); |
|
|
|
|
|
|
|
$('.question.circle.icon').hover(function(){ |
|
|
|
$(this).popup('show') |
|
|
|
}); |
|
|
|
|
|
|
|
$(".item.active.parameter_config").click(function(){ |
|
|
|
$('.ui.parameter.modal') |
|
|
|
.modal('setting', 'closable', false) |
|
|
|
.modal('show'); |
|
|
|
}) |
|
|
|
|
|
|
|
$('.ui.deny.button').click(function(){ |
|
|
|
$('.ui.parameter.modal') |
|
|
|
.modal('hide'); |
|
|
|
}) |
|
|
|
$('select.dropdown') |
|
|
|
.dropdown(); |
|
|
|
|
|
|
|
var isValidate = false; |
|
|
|
function validate(){ |
|
|
|
$('.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 : '选择一个数据集' |
|
|
|
} |
|
|
|
] |
|
|
|
|
|
|
|
}, |
|
|
|
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; |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
document.onreadystatechange = function() { |
|
|
|
if (document.readyState === "complete") { |
|
|
|
|
|
|
|
document.getElementById("mask").style.display = "none" |
|
|
|
} |
|
|
|
} |
|
|
|
function send_run_para() { |
|
|
|
var run_parameters = [] |
|
|
|
var msg = {} |
|
|
|
$(".dynamic.field .two.fields").each(function () { |
|
|
|
var para_name = $(this).find('input.shipping_first-name').val() |
|
|
|
var para_value = $(this).find('input.shipping_last-name').val() |
|
|
|
run_parameters.push({ "label": para_name, "value": para_value }) |
|
|
|
}) |
|
|
|
msg["parameter"] = run_parameters |
|
|
|
msg = JSON.stringify(msg) |
|
|
|
$('#store_run_para').val(msg) |
|
|
|
} |
|
|
|
function get_name(){ |
|
|
|
let name1=$("#engine_name .text").text() |
|
|
|
let name2=$("#flaver_name .text").text() |
|
|
|
$("input#ai_engine_name").val(name1) |
|
|
|
$("input#ai_flaver_name").val(name2) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
validate() |
|
|
|
$('.ui.create_train_job.green.button').click(function(e) { |
|
|
|
get_name() |
|
|
|
send_run_para() |
|
|
|
validate() |
|
|
|
}) |
|
|
|
// $('#add_run_para').click(function () { |
|
|
|
// var len = $(".dynamic.field .two.fields").length |
|
|
|
// Add_parameter(len) |
|
|
|
// }); |
|
|
|
|
|
|
|
// $(".dynamic.field").on("click", ".trash.icon", function () { |
|
|
|
// var index = $(this).parent().parent().index() |
|
|
|
// $(this).parent().parent().remove() |
|
|
|
// var len = $(".dynamic.field .two.fields").length |
|
|
|
// $(".dynamic.field .two.fields").each(function () { |
|
|
|
// var cur_index = $(this).index() |
|
|
|
// $(this).attr('id', 'para' + cur_index) |
|
|
|
// }) |
|
|
|
// }); |
|
|
|
|
|
|
|
// $('.question.circle.icon').hover(function(){ |
|
|
|
// $(this).popup('show') |
|
|
|
// }); |
|
|
|
|
|
|
|
// $(".item.active.parameter_config").click(function(){ |
|
|
|
// $('.ui.parameter.modal') |
|
|
|
// .modal('setting', 'closable', false) |
|
|
|
// .modal('show'); |
|
|
|
// }) |
|
|
|
|
|
|
|
// $('.ui.deny.button').click(function(){ |
|
|
|
// $('.ui.parameter.modal') |
|
|
|
// .modal('hide'); |
|
|
|
// }) |
|
|
|
// $('select.dropdown') |
|
|
|
// .dropdown(); |
|
|
|
|
|
|
|
// var isValidate = false; |
|
|
|
// function validate(){ |
|
|
|
// $('.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 : '选择一个数据集' |
|
|
|
// } |
|
|
|
// ] |
|
|
|
|
|
|
|
// }, |
|
|
|
// 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; |
|
|
|
// } |
|
|
|
// }) |
|
|
|
// } |
|
|
|
// document.onreadystatechange = function() { |
|
|
|
// if (document.readyState === "complete") { |
|
|
|
|
|
|
|
// document.getElementById("mask").style.display = "none" |
|
|
|
// } |
|
|
|
// } |
|
|
|
// function send_run_para() { |
|
|
|
// var run_parameters = [] |
|
|
|
// var msg = {} |
|
|
|
// $(".dynamic.field .two.fields").each(function () { |
|
|
|
// var para_name = $(this).find('input.shipping_first-name').val() |
|
|
|
// var para_value = $(this).find('input.shipping_last-name').val() |
|
|
|
// run_parameters.push({ "label": para_name, "value": para_value }) |
|
|
|
// }) |
|
|
|
// msg["parameter"] = run_parameters |
|
|
|
// msg = JSON.stringify(msg) |
|
|
|
// $('#store_run_para').val(msg) |
|
|
|
// } |
|
|
|
// function get_name(){ |
|
|
|
// let name1=$("#engine_name .text").text() |
|
|
|
// let name2=$("#flaver_name .text").text() |
|
|
|
// $("input#ai_engine_name").val(name1) |
|
|
|
// $("input#ai_flaver_name").val(name2) |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
// validate() |
|
|
|
// $('.ui.create_train_job.green.button').click(function(e) { |
|
|
|
// get_name() |
|
|
|
// send_run_para() |
|
|
|
// validate() |
|
|
|
// }) |
|
|
|
|
|
|
|
;(function() { |
|
|
|
var SPECS = {{ .Specs }}; |
|
|
|
|