diff --git a/misc/acrn-config/config_app/static/main.js b/misc/acrn-config/config_app/static/main.js index 9275726f3..eb91fe9cd 100644 --- a/misc/acrn-config/config_app/static/main.js +++ b/misc/acrn-config/config_app/static/main.js @@ -299,6 +299,26 @@ $().ready(function(){ show_com_target(id, value); }) + $(document).on('click', "button:contains('+')", function() { + var add_vcpu_id = $(this).attr('id'); + var id = add_vcpu_id.replace('add_vcpu_', ''); + var config_item = $(this).parent().parent(); + var config_item_added = config_item.clone(); + var id_added = (parseInt(id)+1).toString(); + config_item_added.find("button:contains('+')").attr('id', 'add_vcpu_'+id_added); + config_item_added.find("button:contains('-')").attr('id', 'remove_vcpu_'+id_added); + config_item_added.find("button:contains('-')").prop("disabled", false); + config_item_added.find("label:first").text(""); + config_item_added.find('.bootstrap-select').replaceWith(function() { return $('select', this); }); + config_item_added.find('.selectpicker').selectpicker('render'); + config_item_added.insertAfter(config_item); + }); + + $(document).on('click', "button:contains('-')", function() { + var config_item = $(this).parent().parent(); + config_item.remove(); + }); + }) @@ -330,7 +350,7 @@ function show_com_target(id, value) { function save_scenario(generator=null){ - var board_info = $("select#board_info").val(); + var board_info = $("text#board_type").text(); if (board_info==null || board_info=='') { alert("Please select one board info before this operation."); return; @@ -346,7 +366,7 @@ function save_scenario(generator=null){ var value = $(this).val(); if(id!='new_scenario_name' && id!='board_info_file' && id!='board_info_upload' && id!="scenario_file") { - scenario_config[id] = $(this).val(); + scenario_config[id] = value; } }) @@ -355,16 +375,22 @@ function save_scenario(generator=null){ var value = $(this).val(); if(id!='new_scenario_name' && id!='board_info_file' && id!='board_info_upload' && id!="scenario_file") { - scenario_config[id] = $(this).val(); + scenario_config[id] = value; } }) $("select").each(function(){ var id = $(this).attr('id'); - var value = $(this).val(); - if(id!='board_info') { - scenario_config[$(this).attr('id')] = $(this).val(); - } + var value = $(this).val(); + if(id.indexOf('pcpu_id')>=0) { + if(id in scenario_config) { + scenario_config[id].push(value); + } else { + scenario_config[id] = [value]; + } + } else if(id!='board_info') { + scenario_config[id] = value; + } }) $.ajax({ @@ -442,7 +468,7 @@ function save_scenario(generator=null){ } function save_launch(generator=null) { - var board_info = $("select#board_info").val(); + var board_info = $("text#board_type").text(); var scenario_name = $("select#scenario_name").val(); if (board_info==null || board_info=='' || scenario_name==null || scenario_name=='') { alert("Please select one board and scenario before this operation."); @@ -461,7 +487,7 @@ function save_launch(generator=null) { if(id!='new_launch_name' && id!='board_info_file' && id!='board_info_upload' && id!='scenario_name' && id!="launch_file") { - launch_config[id] = $(this).val(); + launch_config[id] = value; } }) @@ -469,7 +495,7 @@ function save_launch(generator=null) { var id = $(this).attr('id'); var value = $(this).val(); if(id!='board_info') { - launch_config[$(this).attr('id')] = $(this).val(); + launch_config[id] = value; } }) @@ -478,7 +504,7 @@ function save_launch(generator=null) { var value = $(this).val(); if(id!='new_scenario_name' && id!='board_info_file' && id!='board_info_upload' && id!="scenario_file") { - launch_config[id] = $(this).val(); + launch_config[id] = value; } }) diff --git a/misc/acrn-config/config_app/templates/scenario.html b/misc/acrn-config/config_app/templates/scenario.html index 9eca87ed2..0f8f922b4 100644 --- a/misc/acrn-config/config_app/templates/scenario.html +++ b/misc/acrn-config/config_app/templates/scenario.html @@ -147,20 +147,19 @@
{% if 'id' not in elem.attrib %} {% if not first_child %} - {% do first_child.append(1) %} {% else %} {% endif %} - - {% if ','.join(['vm', elem.tag, sub_elem.tag]) not in scenario_item_values %} + + {% if ','.join(['vm', elem.tag, sub_elem.tag]) not in scenario_item_values and elem.tag != 'vcpu_affinity' %} {% if sub_elem.tag in ['bootargs', 'kern_args'] %}
{% if 'readonly' in sub_elem.attrib and sub_elem.attrib['readonly'] == 'true' %} @@ -186,6 +185,8 @@
{% endif %} {% else %} + {% set item_key = ','.join(['vm', elem.tag, sub_elem.tag]) if elem.tag != 'vcpu_affinity' else + ','.join(['vm', elem.tag])%} {% endif %} + {% do first_child.append(1) %}

{% else %} {% if not first_child %}