acrn-hypervisor/misc/config_tools/config_app/templates/launch.html
Shuang Zheng e775db23b1 config_tools: add interface to save config xmls to user defined path in config editor
add interface to save scenario xmls and launch xmls to user defined
path in config editor; move all config xmls and generated scripts
out of acrn-hypervisor.

Tracked-On: #6208
Signed-off-by: Shuang Zheng <shuang.zheng@intel.com>
Reviewed-by: Victor Sun <victor.sun@intel.com>
2021-07-27 14:55:46 +08:00

408 lines
26 KiB
HTML

{% 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">&times;</button>
<h4 class="modal-title" id="myModalLabel">Save as</h4>
</div>
<div class="modal-body">
<div class="form-group row">
<label for="new_launch_name" class="col-sm-3 control-label">XML Name: </label>
<div class="col-sm-6">
<input type="text" class="form-control" id="new_launch_name"
value={{launch}}>
</div>
</div>
<div class="form-group row" id="src_path_row">
<label for="src_path" class="col-sm-3 control-label"
title="the path to save config xmls; if no path is specified,
the launch scripts will be generated into misc/acrn-config/xmls/config-xmls/[board]/output and overwirte the previous files.">
Source Path: </label>
<div class="col-sm-9">
<input type="text" class="form-control" id="src_path" value=""
placeholder="[acrn-hypervisor]/../user_config/">
</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">Submit
</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="add_launch_modal" tabindex="-1" role="dialog" aria-labelledby="addlaunchModalLabel" 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">&times;</button>
<h4 class="modal-title" id="addlaunchModalLabel">Configure UOS for Post-launched VM</h4>
</div>
<div class="modal-body">
<div class="form-group row">
<label for="add_launch_type" class="col-sm-3 control-label">VM : </label>
<div class="dropdown col-sm-6">
<select class="selectpicker" data-width="auto" id="add_launch_type">
</select>
</div>
</div>
<div class="form-group row">
<label for="new_launch_name2" class="col-sm-3 control-label">Launch Name : </label>
<div class="col-sm-6">
<input type="text" class="form-control" id="new_launch_name2"
value={{ launch }}>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" id="add_launch_submit" 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;">&nbsp;&nbsp;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 XML</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 XML</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"
id="export_launch_xml">Export XML
</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 XML</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;">&nbsp;&nbsp;Select
Scenario:</label>
<div class="dropdown col-sm-9">
<select class="selectpicker" data-width="auto" id="scenario_name">
<option style="display:none">
<option disabled selected value> -- Select an option -- </option>
{% for sc in scenarios[1] %}
{% if root !=None and root.attrib['scenario'] == sc%}
<option value="{{sc}}" selected>{{sc}}</option>
{% else %}
<option value="{{sc}}">{{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|list %}
<tr>
<td>
<div class="form-group">
<label class="col-sm-3 control-label">UOS: </label>
<label class="col-sm-1 control-label" id="vm">{{vm.attrib['id']}}</label>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">VM ID: </label>
<label class="col-sm-1 control-label" id="vm_id">
{{post_launch_vm_list[vm.attrib['id']|int-1][0] if post_launch_vm_list|length>=1 else ''}}</label>
</div>
<div class="form-group">
<button type="button" class="col-sm-6 btn" id="add_launch_vm" data-id="{{vm.attrib['id']}}" data-toggle="modal"
data-target="#add_launch_modal">Configure an UOS below</button>
</div>
<div class="form-group">
<button type="button" class="col-sm-6 btn" id="remove_launch_vm" data-id="{{vm.attrib['id']}}">
Remove this VM</button>
</div>
</td>
<td>
{% for elem in vm|list %}
{% if elem|list == [] 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-6">
{% 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 %}
<option disabled selected value> -- Select an option -- </option>
{% 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 %}
<p id="{{'uos:id='+vm.attrib['id']+','+elem.tag}}_err" class="col-sm-3"></p>
</div>
{% elif elem|list != [] %}
{% if 'multiselect' not in elem.attrib or elem.attrib['multiselect'] != 'true' %}
{% set first_multi_child = {'block': 0, 'network': 0, 'input': 0, 'pcpu_id': 0, 'shm_region': 0,
'passthrough_devices': 0, 'virtio_devices': 0, 'communication_vuart': 0} %}
{% for sub_elem in elem|list %}
{% 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 elem.tag in first_multi_child.keys() and first_multi_child[elem.tag] == 0 %}
<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>
{% do first_multi_child.update({elem.tag: first_multi_child[elem.tag]+1}) %}
{% elif sub_elem.tag in ['pcpu_id', 'shm_region', 'communication_vuart'] and first_multi_child[sub_elem.tag] == 0 %}
<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
and elem.tag not in ['cpu_affinity', 'shm_regions', 'communication_vuarts']%}
<div class="col-sm-5">
{% 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>
{% if elem.tag in ['virtio_devices'] and sub_elem.tag in ['block', 'network', 'input'] %}
<div class="col-sm-1">
<button type="button" class="btn" id="add_virtio_{{sub_elem.tag}}_{{first_multi_child[sub_elem.tag]}}">+</button>
{% if first_multi_child[sub_elem.tag] == 0 %}
<button type="button" disabled class="btn" id="remove_virtio_{{sub_elem.tag}}_{{first_multi_child[sub_elem.tag]}}">-</button>
{% else %}
<button type="button" class="btn" id="remove_virtio_{{sub_elem.tag}}_{{first_multi_child[sub_elem.tag]}}">-</button>
{% endif %}
</div>
{% do first_multi_child.update({sub_elem.tag: first_multi_child[sub_elem.tag]+1}) %}
{% endif%}
{% else %}
{% if elem.tag == 'cpu_affinity' %}
{% set item_key = ','.join(['uos', elem.tag]) %}
{% elif elem.tag in ['shm_regions', 'communication_vuarts'] %}
{% set item_key = ','.join(['uos:id='+vm.attrib['id'], elem.tag, sub_elem.tag]) %}
{% else %}
{% set item_key = ','.join(['uos', elem.tag, sub_elem.tag]) %}
{% endif %}
<div class="dropdown col-sm-6">
{% 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 %}
<option disabled selected value> -- Select an option -- </option>
{% for item_value in launch_item_values[item_key] %}
{% 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>
{% if elem.tag in ['cpu_affinity', 'shm_regions', 'communication_vuarts'] %}
<button type="button" class="btn" id="add_shm_{{first_multi_child[sub_elem.tag]}}">+</button>
{% if not first_multi_child[sub_elem.tag] %}
<button type="button" disabled class="btn" id="remove_shm_{{first_multi_child[sub_elem.tag]}}">-</button>
{% else %}
<button type="button" class="btn" id="remove_shm_{{first_multi_child[sub_elem.tag]}}">-</button>
{% endif %}
{% do first_multi_child.update({sub_elem.tag: first_multi_child[sub_elem.tag]+1}) %}
{% endif %}
</div>
{% endif %}
<p id="{{'uos:id='+vm.attrib['id']+','+elem.tag+','+sub_elem.tag}}_err" class="col-sm-3"></p>
{% else %}
{% if elem.tag in first_multi_child.keys() and first_multi_child[elem.tag] == 0 %}
{% do first_multi_child.update({elem.tag: first_multi_child[elem.tag]+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-6">
{% 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 %}
<option disabled selected value> -- Select an option -- </option>
{% 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>
<p id="{{'uos:id='+vm.attrib['id']+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}_err"
class="col-sm-3"></p>
{% 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|list %}
<option value="{{sub_elem.text}}" selected="selected">{{sub_elem.text}}</option>
{% endfor %}
{% else %}
{% set selected_list = [] %}
{% for sub_elem in elem|list %}
{% 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>
<p id="{{'uos:id='+vm.attrib['id']+','+elem.tag+','+elem.tag[:-1]}}_err" class="col-sm-3"></p>
</div>
{% endif %}
{% endif %}
{% endfor %}
</td>
</tr>
{% endfor %}
<tr><td>
<button type="button" class="btn" id="add_launch_script" data-toggle="modal" data-id="-1"
data-target="#add_launch_modal">Configure an UOS</button>
</td></tr>
</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 %}