mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-16 14:28:56 +00:00
acrn-config: web UI app for acrn-config tool
The web UI application for ACRN VM configuration tool based on Flask web framework: 1. import board info xml which is generated by acrn-config/target on target boards; or select one board from the imported list of UI. 2. load scenario settings or import scenario settings from local. 3. edit scenario settings from web UI. 4. export and save the edited scenario setting, the application will prompt error messages from UI if there are illegal configured items. 5. generate board source code, generate scenario source code. 6. load launch settings or import launch settings from local. 7. edit launch settings from web UI. 8. export and save the edited launch setting; the application will prompt error messages from UI if there are illegal configurable items 9. generate launch scripts based on current launch setting. Tracked-On: #3602 Signed-off-by: Shuang Zheng <shuang.zheng@intel.com> Reviewed-by: Victor Sun <victor.sun@intel.com> Acked-by: Terry Zou <terry.zou@intel.com>
This commit is contained in:
committed by
ACRN System Integration
parent
476e9a2efe
commit
00da5a994e
310
misc/acrn-config/config_app/templates/launch.html
Normal file
310
misc/acrn-config/config_app/templates/launch.html
Normal file
@@ -0,0 +1,310 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block body_content %}
|
||||
|
||||
<div class="modal fade" id="save_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title" id="myModalLabel">Save as</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="new_launch_name" class="col-sm-3 control-label">Launch: </label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" class="form-control" id="new_launch_name"
|
||||
value={{launch[13:] if launch.startswith('user_defined_') else launch}}>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||
<button type="button" id="remove_launch" class="btn btn-default" data-dismiss="modal">Remove</button>
|
||||
<button type="button" id="save_launch" data-id="" class="btn btn-primary" data-dismiss="modal">Submit
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form class="form-horizontal" role="form" method="post">
|
||||
<div class="form-group">
|
||||
<label for="old_launch_name" class="col-sm-2 control-label" style="text-align: left;"> Launch
|
||||
Setting:</label>
|
||||
<div class="col-sm-3">
|
||||
<text class="form-control" id="old_launch_name" readonly>{{launch}}</text>
|
||||
</div>
|
||||
<div class="col-sm-1 col-sm-offset-1">
|
||||
{% if board_info != None %}
|
||||
<label for="launch_file" class="btn btn-primary" id="scenario_file2"
|
||||
style="border: 1px solid #ccc; display: inline-block; padding: 6px 12px;
|
||||
cursor: pointer; border-radius:5px; ">
|
||||
Import</label>
|
||||
<input type="file" name="file" id="launch_file" class="col-sm-1 btn btn-primary" style="display: none;">
|
||||
{% else %}
|
||||
<label class="btn"
|
||||
style="border: 1px solid #ccc; display: inline-block; padding: 6px 12px;
|
||||
cursor: pointer; border-radius:5px; ">
|
||||
Import</label>
|
||||
<input type="file" name="file" class="col-sm-1" style="display: none;" disabled>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if board_info != None and root != None %}
|
||||
<div class="col-sm-1">
|
||||
<button type="button" class="btn btn-primary" data-id="save" data-toggle="modal" data-target="#save_modal">
|
||||
Export
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-sm-1">
|
||||
<button type="button" id="generate_launch_script" class="btn btn-primary" data-id="generate_launch_script"
|
||||
data-toggle="modal" data-target="#save_modal">Generate Launch Script
|
||||
</button>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="col-sm-1">
|
||||
<button type="button" disabled class="btn btn-primary">Export</button>
|
||||
</div>
|
||||
<div class="col-sm-1">
|
||||
<button type="button" disabled class="btn btn-primary">Generate Launch Script</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="scenario_name" class="col-sm-2 control-label" style="text-align: left;"> Select
|
||||
Scenario:</label>
|
||||
<div class="dropdown col-sm-9">
|
||||
<select class="selectpicker" data-width="auto" id="scenario_name">
|
||||
<option style="display:none">
|
||||
{% for sc in scenarios[0] %}
|
||||
{% if root != None and root.attrib['scenario'] == sc %}
|
||||
<option value="{{sc}}" selected>{{sc}}</option>
|
||||
{% else %}
|
||||
<option value="{{sc}}">{{sc}}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% for sc in scenarios[1] %}
|
||||
{% if root !=None and root.attrib['scenario'] == 'user_defined_'+sc%}
|
||||
<option value="{{'user_defined_'+sc}}" selected>{{'user_defined_'+sc}}</option>
|
||||
{% else %}
|
||||
<option value="{{'user_defined_'+sc}}">{{'user_defined_'+sc}}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if board_info != None and root != None %}
|
||||
<table class="table table-hover" id="tab">
|
||||
{% for vm in root.getchildren() %}
|
||||
<tr>
|
||||
<td>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">UOS: </label>
|
||||
<label class="col-sm-1 control-label" id="vm">{{vm.attrib['id']}}</label>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{% for elem in vm.getchildren() %}
|
||||
{% if elem.getchildren() == [] and ('configurable' not in elem.attrib or elem.attrib['configurable'] !=
|
||||
'0') %}
|
||||
<div class="form-group">
|
||||
<label class="col-sm-1 control-label" data-toggle="tooltip"
|
||||
title="{{elem.attrib['desc'] if 'desc' in elem.attrib else elem.tag}}">{{elem.tag}}</label>
|
||||
<label class="col-sm-2 control-label"></label>
|
||||
{% set elem_text = '' if elem.text == None else elem.text %}
|
||||
{% if ','.join(['uos', elem.tag]) not in launch_item_values %}
|
||||
<div class="col-sm-6">
|
||||
{% if 'readonly' in elem.attrib and elem.attrib['readonly'] == 'true' %}
|
||||
{% if elem.tag == 'kernel_cmdline' %}
|
||||
<textarea type="text" class="form-control"
|
||||
id="{{'uos:id='+vm.attrib['id']+','+elem.tag}}" readonly>{{elem_text}}</textarea>
|
||||
{% else %}
|
||||
<input type="text" class="form-control"
|
||||
id="{{'uos:id='+vm.attrib['id']+','+elem.tag}}" value="{{elem_text}}" readonly/>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if elem.tag == 'kernel_cmdline' %}
|
||||
<textarea type="text" class="form-control" style="height:120px"
|
||||
id="{{'uos:id='+vm.attrib['id']+','+elem.tag}}">{{elem_text}}</textarea>
|
||||
{% else %}
|
||||
<input type="text" class="form-control" value="{{elem_text}}"
|
||||
id="{{'uos:id='+vm.attrib['id']+','+elem.tag}}"/>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="dropdown col-sm-9">
|
||||
{% if 'readonly' in elem.attrib and elem.attrib['readonly'] == 'true' %}
|
||||
<select class="selectpicker" data-width="auto" title="" disabled
|
||||
id="{{'uos:id='+vm.attrib['id']+','+elem.tag}}">
|
||||
{% else %}
|
||||
<select class="selectpicker" data-width="auto" title=""
|
||||
id="{{'uos:id='+vm.attrib['id']+','+elem.tag}}">
|
||||
{% endif %}
|
||||
{% for item_value in launch_item_values[','.join(['uos', elem.tag])] %}
|
||||
{% if item_value == elem_text %}
|
||||
<option value="{{item_value}}" selected="selected">{{item_value}}</option>
|
||||
{% else %}
|
||||
<option value="{{item_value}}">{{item_value}}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% elif elem.getchildren() != [] %}
|
||||
{% if 'multiselect' not in elem.attrib or elem.attrib['multiselect'] != 'true' %}
|
||||
{% set first_child = [] %}
|
||||
{% for sub_elem in elem.getchildren() %}
|
||||
{% set sub_elem_text = '' if sub_elem.text == None else sub_elem.text %}
|
||||
{% if 'configurable' not in sub_elem.attrib or sub_elem.attrib['configurable'] != '0' %}
|
||||
<div class="form-group">
|
||||
{% if 'id' not in elem.attrib %}
|
||||
{% if not first_child %}
|
||||
{% do first_child.append(1) %}
|
||||
<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}}">
|
||||
{{elem.tag}}</label>
|
||||
{% else %}
|
||||
<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}}">
|
||||
</label>
|
||||
{% endif %}
|
||||
|
||||
<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}}">
|
||||
{{sub_elem.tag}}</label>
|
||||
|
||||
{% if ','.join(['uos', elem.tag, sub_elem.tag]) not in launch_item_values %}
|
||||
<div class="col-sm-6">
|
||||
{% if 'readonly' in sub_elem.attrib and sub_elem.attrib['readonly'] == 'true' %}
|
||||
<input type="text" class="form-control" readonly
|
||||
id="{{'uos:id='+vm.attrib['id']+','+elem.tag+','+sub_elem.tag}}"
|
||||
value="{{sub_elem_text}}">
|
||||
{% else %}
|
||||
<input type="text" class="form-control"
|
||||
id="{{'uos:id='+vm.attrib['id']+','+elem.tag+','+sub_elem.tag}}"
|
||||
value="{{sub_elem_text}}">
|
||||
{% endif %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="dropdown col-sm-9">
|
||||
{% if 'readonly' in sub_elem.attrib and sub_elem.attrib['readonly'] == 'true' %}
|
||||
<select class="selectpicker" data-width="auto" disabled
|
||||
id="{{'uos:id='+vm.attrib['id']+','+elem.tag+','+sub_elem.tag}}">
|
||||
{% else %}
|
||||
<select class="selectpicker" data-width="auto"
|
||||
id="{{'uos:id='+vm.attrib['id']+','+elem.tag+','+sub_elem.tag}}">
|
||||
{% endif %}
|
||||
{% for item_value in launch_item_values[','.join(['uos', elem.tag, sub_elem.tag])] %}
|
||||
{% if item_value == sub_elem_text %}
|
||||
<option value="{{item_value}}" selected="selected">{{item_value}}</option>
|
||||
{% else %}
|
||||
<option value="{{item_value}}">{{item_value}}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if not first_child %}
|
||||
{% do first_child.append(1) %}
|
||||
<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}}">
|
||||
{{elem.tag+' '+elem.attrib['id']}}</label>
|
||||
{% else %}
|
||||
<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}}">
|
||||
</label>
|
||||
{% endif %}
|
||||
|
||||
<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}}">
|
||||
{{sub_elem.tag}}</label>
|
||||
|
||||
{% if ','.join(['uos', elem.tag, sub_elem.tag]) not in launch_item_values %}
|
||||
<div class="col-sm-6">
|
||||
{% if 'readonly' in sub_elem.attrib and sub_elem.attrib['readonly'] == 'true' %}
|
||||
<input type="text" class="form-control" readonly
|
||||
id="{{'uos:id='+vm.attrib['id']+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}"
|
||||
value="{{sub_elem_text}}">
|
||||
{% else %}
|
||||
<input type="text" class="form-control"
|
||||
id="{{'uos:id='+vm.attrib['id']+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}"
|
||||
value="{{sub_elem_text}}">
|
||||
{% endif %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="dropdown col-sm-9">
|
||||
{% if 'readonly' in sub_elem.attrib and sub_elem.attrib['readonly'] == 'true' %}
|
||||
<select class="selectpicker" data-width="auto" disabled
|
||||
id="{{'uos:id='+vm.attrib['id']+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}">
|
||||
{% else %}
|
||||
<select class="selectpicker" data-width="auto"
|
||||
id="{{'uos:id='+vm.attrib['id']+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}">
|
||||
{% endif %}
|
||||
{% for item_value in launch_item_values[','.join(['uos', elem.tag, sub_elem.tag])] %}
|
||||
{% if item_value == sub_elem_text %}
|
||||
<option value="{{item_value}}" selected="selected">{{item_value}}</option>
|
||||
{% else %}
|
||||
<option value="{{item_value}}">{{item_value}}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% elif 'configurable' not in elem.attrib or elem.attrib['configurable'] != '0' %}
|
||||
<div class="form-group">
|
||||
<label class="col-sm-1 control-label" data-toggle="tooltip"
|
||||
title="{{elem.attrib['desc'] if 'desc' in elem.attrib else elem.tag}}">{{elem.tag}}</label>
|
||||
<label class="col-sm-2 control-label" data-toggle="tooltip"
|
||||
title="{{elem.attrib['desc'] if 'desc' in elem.attrib else elem.tag}}"></label>
|
||||
<div class="dropdown col-sm-9">
|
||||
{% if 'readonly' in elem.attrib and elem.attrib['readonly'] == 'true' %}
|
||||
<select class="selectpicker" data-width="auto" disabled
|
||||
id="{{'uos:id='+vm.attrib['id']+','+elem.tag+','+elem.tag[:-1]}}" multiple>
|
||||
{% else %}
|
||||
<select class="selectpicker" data-width="auto" disabled
|
||||
id="{{'uos:id='+vm.attrib['id']+','+elem.tag+','+elem.tag[:-1]}}" multiple>
|
||||
{% endif %}
|
||||
{% if ','.join(['uos', elem.tag]) not in launch_item_values %}
|
||||
{% set x=1 %}
|
||||
{% for sub_elem in elem.getchildren() %}
|
||||
<option value="{{sub_elem.text}}" selected="selected">{{sub_elem.text}}</option>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% set selected_list = [] %}
|
||||
{% for sub_elem in elem.getchildren() %}
|
||||
{% do selected_list.append(sub_elem.text) %}
|
||||
{% endfor %}
|
||||
{% for item_value in launch_item_values[','.join(['uos', elem.tag])] %}
|
||||
{% if item_value in selected_list %}
|
||||
<option value="{{item_value}}" selected="selected">{{item_value}}</option>
|
||||
{% else %}
|
||||
<option value="{{item_value}}">{{item_value}}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% else %}
|
||||
<text class="form-control" id="err_msg">No setting available. Select one board info and make sure the launch xml
|
||||
exists.
|
||||
</text>
|
||||
{% endif %}
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
Reference in New Issue
Block a user