Skip to content

Commit 233577e

Browse files
szhen11wenlingz
authored andcommitted
acrn-config: enable hv config for scenarion setting UI
config app supports hv config in scenario setting UI. Tracked-On: #4634 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>
1 parent c5cd7ca commit 233577e

File tree

1 file changed

+41
-33
lines changed

1 file changed

+41
-33
lines changed

misc/acrn-config/config_app/templates/scenario.html

Lines changed: 41 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,19 @@ <h4 class="modal-title" id="myModalLabel">Save as</h4>
8585
{% if 'configurable' not in vm.attrib or vm.attrib['configurable'] != '0'%}
8686
<tr>
8787
<td>
88+
{% if vm.tag != 'vm' %}
89+
{% set vm_type = 'hv' %}
90+
<div class="form-group">
91+
<label class="col-sm-1 control-label">HV </label>
92+
</div>
93+
{% else %}
94+
{% set vm_type = 'vm:id='+vm.attrib['id'] %}
8895
<div class="form-group">
8996
<label class="col-sm-1 control-label">VM: </label>
9097
<label class="col-sm-1 control-label" id="vm">{{vm.attrib['id']}}</label>
9198

9299
</div>
100+
{% endif %}
93101
{% if 'desc' in vm.attrib or vm.attrib['desc'] == 'specific for Kata' %}
94102
<div class="form-group">
95103
<button type="button" class="btn" id="remove_vm_kata">Remove Kata VM</button>
@@ -106,26 +114,26 @@ <h4 class="modal-title" id="myModalLabel">Save as</h4>
106114
title="{{elem.attrib['desc'] if 'desc' in elem.attrib else elem.tag}}">{{elem.tag}}</label>
107115
<label class="col-sm-2 control-label"></label>
108116

109-
{% if ','.join(['vm', elem.tag]) not in scenario_item_values %}
117+
{% if ','.join([vm.tag, elem.tag]) not in scenario_item_values %}
110118
<div class="col-sm-6">
111119
{% if 'readonly' in elem.attrib and elem.attrib['readonly'] == 'true' %}
112-
<input type="text" class="form-control" id="{{'vm:id='+vm.attrib['id']+','+elem.tag}}"
120+
<input type="text" class="form-control" id="{{vm_type+','+elem.tag}}"
113121
value="{{elem_text}}" readonly>
114122
{% else %}
115-
<input type="text" class="form-control" id="{{'vm:id='+vm.attrib['id']+','+elem.tag}}"
123+
<input type="text" class="form-control" id="{{vm_type+','+elem.tag}}"
116124
value="{{elem_text}}">
117125
{% endif %}
118126
</div>
119127
{% else %}
120128
<div class="dropdown col-sm-6">
121129
{% if 'readonly' in elem.attrib and elem.attrib['readonly'] == 'true' %}
122130
<select class="selectpicker" data-width="auto"
123-
id="{{'vm:id='+vm.attrib['id']+','+elem.tag}}" disabled>
131+
id="{{vm_type+','+elem.tag}}" disabled>
124132
{% else %}
125133
<select class="selectpicker" data-width="auto"
126-
id="{{'vm:id='+vm.attrib['id']+','+elem.tag}}">
134+
id="{{vm_type+','+elem.tag}}">
127135
{% endif %}
128-
{% for item_value in scenario_item_values[','.join(['vm', elem.tag])] %}
136+
{% for item_value in scenario_item_values[','.join([vm.tag, elem.tag])] %}
129137
{% if item_value == elem_text %}
130138
<option value="{{item_value}}" selected="selected">{{item_value}}</option>
131139
{% else %}
@@ -135,7 +143,7 @@ <h4 class="modal-title" id="myModalLabel">Save as</h4>
135143
</select>
136144
</div>
137145
{% endif %}
138-
<p id="{{'vm:id='+vm.attrib['id']+','+elem.tag}}_err" class="col-sm-3"></p>
146+
<p id="{{vm_type+','+elem.tag}}_err" class="col-sm-3"></p>
139147
</div>
140148
{% elif elem.getchildren() != [] and ('configurable' not in elem.attrib or elem.attrib['configurable']
141149
!= '0')%}
@@ -159,41 +167,41 @@ <h4 class="modal-title" id="myModalLabel">Save as</h4>
159167
title="{{sub_elem.attrib['desc'] if 'desc' in sub_elem.attrib else sub_elem.tag}}">
160168
{{sub_elem.tag}}</label>
161169

162-
{% if ','.join(['vm', elem.tag, sub_elem.tag]) not in scenario_item_values and elem.tag != 'vcpu_affinity' %}
170+
{% if ','.join([vm.tag, elem.tag, sub_elem.tag]) not in scenario_item_values and elem.tag != 'vcpu_affinity' %}
163171
{% if sub_elem.tag in ['bootargs', 'kern_args'] %}
164172
<div class="col-sm-6">
165173
{% if 'readonly' in sub_elem.attrib and sub_elem.attrib['readonly'] == 'true' %}
166174
<textarea type="text" class="form-control" style="height:120px"
167-
id="{{'vm:id='+vm.attrib['id']+','+elem.tag+','+sub_elem.tag}}"
175+
id="{{vm_type+','+elem.tag+','+sub_elem.tag}}"
168176
readonly>{{sub_elem_text}}</textarea>
169177
{% else %}
170178
<textarea type="text" class="form-control" style="height:120px"
171-
id="{{'vm:id='+vm.attrib['id']+','+elem.tag+','+sub_elem.tag}}">{{sub_elem_text}}</textarea>
179+
id="{{vm_type+','+elem.tag+','+sub_elem.tag}}">{{sub_elem_text}}</textarea>
172180
{% endif %}
173181
</div>
174182
{% else %}
175183
<div class="col-sm-6">
176184
{% if 'readonly' in sub_elem.attrib and sub_elem.attrib['readonly'] == 'true' %}
177185
<input type="text" class="form-control"
178-
id="{{'vm:id='+vm.attrib['id']+','+elem.tag+','+sub_elem.tag}}"
186+
id="{{vm_type+','+elem.tag+','+sub_elem.tag}}"
179187
value="{{sub_elem_text}}" readonly>
180188
{% else %}
181189
<input type="text" class="form-control"
182-
id="{{'vm:id='+vm.attrib['id']+','+elem.tag+','+sub_elem.tag}}"
190+
id="{{vm_type+','+elem.tag+','+sub_elem.tag}}"
183191
value="{{sub_elem_text}}">
184192
{% endif %}
185193
</div>
186194
{% endif %}
187195
{% else %}
188-
{% set item_key = ','.join(['vm', elem.tag, sub_elem.tag]) if elem.tag != 'vcpu_affinity' else
189-
','.join(['vm', elem.tag])%}
196+
{% set item_key = ','.join([vm.tag, elem.tag, sub_elem.tag]) if elem.tag != 'vcpu_affinity' else
197+
','.join([vm.tag, elem.tag])%}
190198
<div class="dropdown col-sm-6">
191199
{% if 'readonly' in sub_elem.attrib and sub_elem.attrib['readonly'] == 'true' %}
192200
<select class="selectpicker" data-width="auto"
193-
id="{{'vm:id='+vm.attrib['id']+','+elem.tag+','+sub_elem.tag}}" disabled>
201+
id="{{vm_type+','+elem.tag+','+sub_elem.tag}}" disabled>
194202
{% else %}
195203
<select class="selectpicker" data-width="auto"
196-
id="{{'vm:id='+vm.attrib['id']+','+elem.tag+','+sub_elem.tag}}">
204+
id="{{vm_type+','+elem.tag+','+sub_elem.tag}}">
197205
{% endif %}
198206
{% for item_value in scenario_item_values[item_key] %}
199207
{% if item_value == sub_elem_text %}
@@ -215,51 +223,51 @@ <h4 class="modal-title" id="myModalLabel">Save as</h4>
215223
</div>
216224
{% endif %}
217225
{% do first_child.append(1) %}
218-
<p id="{{'vm:id='+vm.attrib['id']+','+elem.tag+','+sub_elem.tag}}_err" class="col-sm-3"></p>
226+
<p id="{{vm_type+','+elem.tag+','+sub_elem.tag}}_err" class="col-sm-3"></p>
219227
{% else %}
220228
{% if not first_child %}
221229
{% do first_child.append(1) %}
222230
<label class="col-sm-1 control-label" data-toggle="tooltip"
223-
id="{{'vm:id='+vm.attrib['id']+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}_label1"
231+
id="{{vm_type+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}_label1"
224232
title="{{sub_elem.attrib['desc'] if 'desc' in sub_elem.attrib else sub_elem.tag}}">
225233
{{elem.tag+' '+elem.attrib['id']}}</label>
226234
{% else %}
227235
<label class="col-sm-1 control-label" data-toggle="tooltip"
228-
id="{{'vm:id='+vm.attrib['id']+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}_label1"
236+
id="{{vm_type+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}_label1"
229237
title="{{sub_elem.attrib['desc'] if 'desc' in sub_elem.attrib else sub_elem.tag}}">
230238
</label>
231239
{% endif %}
232240

233241
<label class="col-sm-2 control-label" data-toggle="tooltip"
234-
id="{{'vm:id='+vm.attrib['id']+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}_label2"
242+
id="{{vm_type+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}_label2"
235243
title="{{sub_elem.attrib['desc'] if 'desc' in sub_elem.attrib else sub_elem.tag}}">
236244
{{sub_elem.tag}}</label>
237-
{% if (','.join(['vm', elem.tag, sub_elem.tag]) not in scenario_item_values) and
245+
{% if (','.join([vm.tag, elem.tag, sub_elem.tag]) not in scenario_item_values) and
238246
(elem.tag!='vuart' or sub_elem.tag!='base') %}
239247
<div class="col-sm-6"
240-
id="{{'vm:id='+vm.attrib['id']+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}_config">
248+
id="{{vm_type+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}_config">
241249
{% if 'readonly' in sub_elem.attrib and sub_elem.attrib['readonly'] == 'true' %}
242250
<input type="text" class="form-control"
243-
id="{{'vm:id='+vm.attrib['id']+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}"
251+
id="{{vm_type+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}"
244252
value="{{sub_elem_text}}" readonly>
245253
{% else %}
246254
<input type="text" class="form-control"
247-
id="{{'vm:id='+vm.attrib['id']+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}"
255+
id="{{vm_type+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}"
248256
value="{{sub_elem_text}}">
249257
{% endif %}
250258
</div>
251259
{% else %}
252260
<div class="dropdown col-sm-6">
253261
{% if 'readonly' in sub_elem.attrib and sub_elem.attrib['readonly'] == 'true' %}
254262
<select class="selectpicker" data-width="auto" disabled
255-
id="{{'vm:id='+vm.attrib['id']+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}">
263+
id="{{vm_type+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}">
256264
{% else %}
257265
<select class="selectpicker" data-width="auto"
258-
id="{{'vm:id='+vm.attrib['id']+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}">
266+
id="{{vm_type+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}">
259267
{% endif %}
260268
{% set key = ('vm='+vm.attrib['id']+','+elem.tag+'='+elem.attrib['id']+','+sub_elem.tag)
261269
if (elem.tag=='vuart' and sub_elem.tag=='base')
262-
else ','.join(['vm', elem.tag, sub_elem.tag]) %}
270+
else ','.join([vm.tag, elem.tag, sub_elem.tag]) %}
263271
{% for item_value in scenario_item_values[key] %}
264272
{% if item_value == sub_elem_text %}
265273
<option value="{{item_value}}" selected="selected">{{item_value}}</option>
@@ -270,7 +278,7 @@ <h4 class="modal-title" id="myModalLabel">Save as</h4>
270278
</select>
271279
</div>
272280
{% endif %}
273-
<p id="{{'vm:id='+vm.attrib['id']+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}_err"
281+
<p id="{{vm_type+','+elem.tag+':id='+elem.attrib['id']+','+sub_elem.tag}}_err"
274282
class="col-sm-3"></p>
275283
{% endif %}
276284
</div>
@@ -285,14 +293,14 @@ <h4 class="modal-title" id="myModalLabel">Save as</h4>
285293
<div class="dropdown col-sm-6">
286294
{% if 'readonly' in elem.attrib and elem.attrib['readonly'] == 'true' %}
287295
<select class="selectpicker" data-width="auto" disabled
288-
id="{{'vm:id='+vm.attrib['id']+','+elem.tag+','+elem.tag[:-1]}}"
296+
id="{{vm_type+','+elem.tag+','+elem.tag[:-1]}}"
289297
multiple>
290298
{% else %}
291299
<select class="selectpicker" data-width="auto"
292-
id="{{'vm:id='+vm.attrib['id']+','+elem.tag+','+elem.tag[:-1]}}"
300+
id="{{vm_type+','+elem.tag+','+elem.tag[:-1]}}"
293301
multiple>
294302
{% endif %}
295-
{% if ','.join(['vm', elem.tag]) not in scenario_item_values %}
303+
{% if ','.join([vm.tag, elem.tag]) not in scenario_item_values %}
296304
{% set x=1 %}
297305
{% for sub_elem in elem.getchildren() %}
298306
<option value="{{sub_elem.text}}" selected="selected">{{sub_elem.text}}</option>
@@ -302,7 +310,7 @@ <h4 class="modal-title" id="myModalLabel">Save as</h4>
302310
{% for sub_elem in elem.getchildren() %}
303311
{% do selected_list.append(sub_elem.text) %}
304312
{% endfor %}
305-
{% for item_value in scenario_item_values[','.join(['vm', elem.tag])] %}
313+
{% for item_value in scenario_item_values[','.join([vm.tag, elem.tag])] %}
306314
{% if item_value in selected_list %}
307315
<option value="{{item_value}}" selected="selected">{{item_value}}</option>
308316
{% else %}
@@ -312,7 +320,7 @@ <h4 class="modal-title" id="myModalLabel">Save as</h4>
312320
{% endif %}
313321
</select>
314322
</div>
315-
<p id="{{'vm:id='+vm.attrib['id']+','+elem.tag+','+elem.tag[:-1]}}_err" class="col-sm-3"></p>
323+
<p id="{{vm_type+','+elem.tag+','+elem.tag[:-1]}}_err" class="col-sm-3"></p>
316324
</div>
317325
{% endif %}
318326
{% endif %}

0 commit comments

Comments
 (0)