mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-13 22:06:49 +00:00
acrn-config: update vcpu affinity in web UI
According to the new vcpu affinity configuration method, update vcpu configuration in Web UI from multi-select box to seperated select box which can dynamically add or delete vcpus with mapped pcpus. Tracked-On: #3798 Signed-off-by: Shuang Zheng <shuang.zheng@intel.com> Reviewed-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
parent
c442f3f4d1
commit
62ed91d303
@ -299,6 +299,26 @@ $().ready(function(){
|
|||||||
show_com_target(id, value);
|
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){
|
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=='') {
|
if (board_info==null || board_info=='') {
|
||||||
alert("Please select one board info before this operation.");
|
alert("Please select one board info before this operation.");
|
||||||
return;
|
return;
|
||||||
@ -346,7 +366,7 @@ function save_scenario(generator=null){
|
|||||||
var value = $(this).val();
|
var value = $(this).val();
|
||||||
if(id!='new_scenario_name' && id!='board_info_file'
|
if(id!='new_scenario_name' && id!='board_info_file'
|
||||||
&& id!='board_info_upload' && id!="scenario_file") {
|
&& id!='board_info_upload' && id!="scenario_file") {
|
||||||
scenario_config[id] = $(this).val();
|
scenario_config[id] = value;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -355,15 +375,21 @@ function save_scenario(generator=null){
|
|||||||
var value = $(this).val();
|
var value = $(this).val();
|
||||||
if(id!='new_scenario_name' && id!='board_info_file'
|
if(id!='new_scenario_name' && id!='board_info_file'
|
||||||
&& id!='board_info_upload' && id!="scenario_file") {
|
&& id!='board_info_upload' && id!="scenario_file") {
|
||||||
scenario_config[id] = $(this).val();
|
scenario_config[id] = value;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
$("select").each(function(){
|
$("select").each(function(){
|
||||||
var id = $(this).attr('id');
|
var id = $(this).attr('id');
|
||||||
var value = $(this).val();
|
var value = $(this).val();
|
||||||
if(id!='board_info') {
|
if(id.indexOf('pcpu_id')>=0) {
|
||||||
scenario_config[$(this).attr('id')] = $(this).val();
|
if(id in scenario_config) {
|
||||||
|
scenario_config[id].push(value);
|
||||||
|
} else {
|
||||||
|
scenario_config[id] = [value];
|
||||||
|
}
|
||||||
|
} else if(id!='board_info') {
|
||||||
|
scenario_config[id] = value;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -442,7 +468,7 @@ function save_scenario(generator=null){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function save_launch(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();
|
var scenario_name = $("select#scenario_name").val();
|
||||||
if (board_info==null || board_info=='' || scenario_name==null || scenario_name=='') {
|
if (board_info==null || board_info=='' || scenario_name==null || scenario_name=='') {
|
||||||
alert("Please select one board and scenario before this operation.");
|
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'
|
if(id!='new_launch_name' && id!='board_info_file'
|
||||||
&& id!='board_info_upload' && id!='scenario_name'
|
&& id!='board_info_upload' && id!='scenario_name'
|
||||||
&& id!="launch_file") {
|
&& 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 id = $(this).attr('id');
|
||||||
var value = $(this).val();
|
var value = $(this).val();
|
||||||
if(id!='board_info') {
|
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();
|
var value = $(this).val();
|
||||||
if(id!='new_scenario_name' && id!='board_info_file'
|
if(id!='new_scenario_name' && id!='board_info_file'
|
||||||
&& id!='board_info_upload' && id!="scenario_file") {
|
&& id!='board_info_upload' && id!="scenario_file") {
|
||||||
launch_config[id] = $(this).val();
|
launch_config[id] = value;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -147,20 +147,19 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
{% if 'id' not in elem.attrib %}
|
{% if 'id' not in elem.attrib %}
|
||||||
{% if not first_child %}
|
{% if not first_child %}
|
||||||
{% do first_child.append(1) %}
|
|
||||||
<label class="col-sm-1 control-label" data-toggle="tooltip"
|
<label class="col-sm-1 control-label" data-toggle="tooltip"
|
||||||
title="{{sub_elem.attrib['desc'] if 'desc' in sub_elem.attrib else sub_elem.tag}}">
|
title="{{elem.attrib['desc'] if 'desc' in elem.attrib else elem.tag}}">
|
||||||
{{elem.tag}}</label>
|
{{elem.tag}}</label>
|
||||||
{% else %}
|
{% else %}
|
||||||
<label class="col-sm-1 control-label" data-toggle="tooltip"
|
<label class="col-sm-1 control-label" data-toggle="tooltip"
|
||||||
title="{{sub_elem.attrib['desc'] if 'desc' in sub_elem.attrib else sub_elem.tag}}">
|
title="{{elem.attrib['desc'] if 'desc' in elem.attrib else elem.tag}}">
|
||||||
</label>
|
</label>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<label class="col-sm-2 control-label" data-toggle="tooltip"
|
<label class="col-sm-2 control-label" data-toggle="tooltip"
|
||||||
title="{{sub_elem.attrib['desc'] if 'desc' in sub_elem.attrib else sub_elem.tag}}">
|
title="{{sub_elem.attrib['desc'] if 'desc' in sub_elem.attrib else sub_elem.tag}}">
|
||||||
{{sub_elem.tag}}</label>
|
{{sub_elem.tag}}</label>
|
||||||
{% 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 sub_elem.tag in ['bootargs', 'kern_args'] %}
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
{% if 'readonly' in sub_elem.attrib and sub_elem.attrib['readonly'] == 'true' %}
|
{% if 'readonly' in sub_elem.attrib and sub_elem.attrib['readonly'] == 'true' %}
|
||||||
@ -186,6 +185,8 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
{% set item_key = ','.join(['vm', elem.tag, sub_elem.tag]) if elem.tag != 'vcpu_affinity' else
|
||||||
|
','.join(['vm', elem.tag])%}
|
||||||
<div class="dropdown col-sm-6">
|
<div class="dropdown col-sm-6">
|
||||||
{% if 'readonly' in sub_elem.attrib and sub_elem.attrib['readonly'] == 'true' %}
|
{% if 'readonly' in sub_elem.attrib and sub_elem.attrib['readonly'] == 'true' %}
|
||||||
<select class="selectpicker" data-width="auto"
|
<select class="selectpicker" data-width="auto"
|
||||||
@ -194,7 +195,7 @@
|
|||||||
<select class="selectpicker" data-width="auto"
|
<select class="selectpicker" data-width="auto"
|
||||||
id="{{'vm:id='+vm.attrib['id']+','+elem.tag+','+sub_elem.tag}}">
|
id="{{'vm:id='+vm.attrib['id']+','+elem.tag+','+sub_elem.tag}}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% for item_value in scenario_item_values[','.join(['vm', elem.tag, sub_elem.tag])] %}
|
{% for item_value in scenario_item_values[item_key] %}
|
||||||
{% if item_value == sub_elem_text %}
|
{% if item_value == sub_elem_text %}
|
||||||
<option value="{{item_value}}" selected="selected">{{item_value}}</option>
|
<option value="{{item_value}}" selected="selected">{{item_value}}</option>
|
||||||
{% else %}
|
{% else %}
|
||||||
@ -202,8 +203,18 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
{% if elem.tag == 'vcpu_affinity' %}
|
||||||
|
<button type="button" class="btn" id="add_vcpu_{{first_child|length}}">+</button>
|
||||||
|
{% if not first_child %}
|
||||||
|
<button type="button" disabled class="btn" id="remove_vcpu_{{first_child|length}}">-</button>
|
||||||
|
{% else %}
|
||||||
|
<button type="button" class="btn" id="remove_vcpu_{{first_child|length}}">-</button>
|
||||||
|
{% endif %}
|
||||||
|
{% endif%}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% do first_child.append(1) %}
|
||||||
<p id="{{'vm:id='+vm.attrib['id']+','+elem.tag+','+sub_elem.tag}}_err" class="col-sm-3"></p>
|
<p id="{{'vm:id='+vm.attrib['id']+','+elem.tag+','+sub_elem.tag}}_err" class="col-sm-3"></p>
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if not first_child %}
|
{% if not first_child %}
|
||||||
|
Loading…
Reference in New Issue
Block a user