Browse Source

add parameter rendar and add data list index self-update

tags/v1.21.12.1
Gitea 4 years ago
parent
commit
b2282d0340
1 changed files with 68 additions and 60 deletions
  1. +68
    -60
      templates/repo/modelarts/trainjob/new.tmpl

+ 68
- 60
templates/repo/modelarts/trainjob/new.tmpl View File

@@ -272,31 +272,31 @@
<tbody>
<tr>
<td class="four wide"> {{.i18n.Tr "repo.modelarts.train_job.job_name"}} </td>
<td>1</td>
<td></td>
</tr>
<tr>
<td> {{.i18n.Tr "repo.modelarts.train_job.description"}} </td>
<td>2</td>
<td></td>
</tr>
<tr>
<td> {{.i18n.Tr "repo.modelarts.train_job.dataset"}} </td>
<td>3</td>
<td>05-express-mongodb.zip</td>
</tr>
<tr>
<td> {{.i18n.Tr "repo.modelarts.train_job.start_file"}} </td>
<td>4</td>
<td></td>
</tr>
<tr>
<td> {{.i18n.Tr "repo.modelarts.train_job.run_parameter"}} </td>
<td>5=6 7=8</td>
<td></td>
</tr>
<tr>
<td> {{.i18n.Tr "repo.modelarts.train_job.resource_pool"}} </td>
<td>6</td>
<td></td>
</tr>
<tr>
<td> {{.i18n.Tr "repo.modelarts.train_job.amount_of_compute_node"}} </td>
<td>7</td>
<td></td>
</tr>
</tbody>
</table>
@@ -325,29 +325,13 @@
$('.menu .item')
.tab();

// function Add_parameter(){
// value = '<div class="two fields">' +
// '<div class="field">' +
// '<input type="text" name="shipping[first-name]" placeholder={{.i18n.Tr "repo.modelarts.train_job.parameter_name"}}> ' +
// '</div> ' +
// '<div class="field"> ' +
// '<input type="text" name="shipping[last-name]" placeholder={{.i18n.Tr "repo.modelarts.train_job.parameter_value"}}>' +
// '</div>'+
// '<span>' +
// '<i class="trash icon">' +
// '</i>' +
// '</span>' +
// '</div>'
// $(".dynamic.field").append(value)
// }
$('#add_run_para').click(function(){
// Add_parameter()
value = '<div class="two fields">' +
function Add_parameter(i){
value = '<div class="two fields" id= "para'+ i +'">' +
'<div class="field">' +
'<input type="text" name="shipping[first-name]" placeholder={{.i18n.Tr "repo.modelarts.train_job.parameter_name"}}> ' +
'<input type="text" name="shipping_first-name" placeholder={{.i18n.Tr "repo.modelarts.train_job.parameter_name"}}> ' +
'</div> ' +
'<div class="field"> ' +
'<input type="text" name="shipping[last-name]" placeholder={{.i18n.Tr "repo.modelarts.train_job.parameter_value"}}>' +
'<input type="text" name="shipping_last-name" placeholder={{.i18n.Tr "repo.modelarts.train_job.parameter_value"}}>' +
'</div>'+
'<span>' +
'<i class="trash icon">' +
@@ -355,10 +339,22 @@
'</span>' +
'</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)
})
});

$('.ui.save.checkbox').click(function(){
@@ -394,38 +390,50 @@
.modal('show');
})

// $('.ui.parameter.green.button').click(function(){
// var parameters = [];
// $('table tr').each(function() {
// var row = []
// $(this).find('td').each(function(){
// row.push($(this).text())
// })
// parameters.push(row);
// });

// for(var i = 2; i < parameters.length; i++){
// switch(i) {
// case ("2"):
// $("select[name='attachment']").val(parameters[i]);
// case ("3"):
// $("input[name='boot_file']").val(parameters[i]);
// case ("4"):
// var para = parameters[i].split()
// for(var p in para){
// var para_name = p.split('=')[0]
// var para_value = p.split('=')[1]
// Add_parameter()
// $(".dynamic.field:last-child").find("input[name=shipping[first-name]]").val(para_name)
// $(".dynamic.field:last-child").find("input[name=shipping[last-name]]").val(para_value)
// }
// case ("5"):
// $("select[name='pool_id']").val(parameters[i]);
// case ("6"):
// $("input[name='work_server_number']").val(parameters[i]);
// }
// }
// })
$('.ui.parameter.green.button').click(function(){
var parameters = [];
$('table tr').each(function() {
$(this).find('td:eq(1)').each(function(){
parameters.push($(this).text());
})
});
console.log(parameters)
$('.ui.parameter.modal')
.modal('hide');
for(var i = 2; i < parameters.length; i++){
switch(i) {
// 数据集uuid待完成
// case (2):
// console.log(1)
// break;
// $("#trainjob_datasets").val(parameters[i]);
// console.log($("#trainjob_datasets").val())
case (3):
$("input[name='boot_file']").val(parameters[i]);
break;
case (4):
var para = parameters[i].split(" ")
for(var j = 0; j < para.length; j++){
var para_name = para[j].split('=')[0]
var para_value = para[j].split('=')[1]
var len = $(".dynamic.field .two.fields").length
console.log(len)
Add_parameter(len)
var pid = 'para' + len
$(".dynamic.field"+ " #" + pid + "").find("input[name=shipping_first-name]").css("background-color", "red")
$(".dynamic.field"+ " #" + pid + "").find("input[name=shipping_first-name]").val(para_name)
$(".dynamic.field"+ " #" + pid + "").find("input[name=shipping_last-name]").val(para_value)
}
break;
// case (5):
// $("select[name='pool_id']").val(parameters[i]);
// break;
case (6):
$("input[name='work_server_number']").val(parameters[i]);
break;
}
}
})

$('.ui.deny.button').click(function(){
$('.ui.parameter.modal')


Loading…
Cancel
Save