1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-04-05 21:15:25 +00:00

Compare commits

..

No commits in common. "b8971a1fcaeae3be4a0bd74365d6a7e0548d2a78" and "83709eddbf5f758cec884b195cb6a913a702b4b6" have entirely different histories.

3 changed files with 14 additions and 46 deletions

View file

@ -178,12 +178,6 @@
</div>
</div>
<div class="collapse" id="flavAddCollapse">
<div class="row">
<label class="col-sm-4 col-form-label">{% trans "MAC" %}</label>
<div class="col-sm-7">
<input type="text" class="form-control" name="mac" maxlength="17" value="{{ mac_auto }}" required pattern="[a-zA-Z0-9:]+">
</div>
</div>
<div class="row">
<label class="col-sm-4 col-form-label">{% trans "NWFilter" %}</label>
<div class="col-sm-7">
@ -206,6 +200,12 @@
</select>
</div>
</div>
<div class="row">
<label class="col-sm-4 col-form-label">{% trans "MAC" %}</label>
<div class="col-sm-7">
<input type="text" class="form-control" name="mac" maxlength="17" value="{{ mac_auto }}" required pattern="[a-zA-Z0-9:]+">
</div>
</div>
{% if dom_caps.graphics_support == 'yes' %}
<div class="row">
<label class="col-sm-4 col-form-label">{% trans "Graphics" %}</label>
@ -396,7 +396,6 @@
{% endfor %}
</select>
</div>
<input id="mac" type="hidden" name="mac" value=""/>
</div>
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Advanced" %}</label>
@ -602,17 +601,14 @@
</div>
</div>
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Network/MAC" %}</label>
<div class="col-sm-3">
<label class="col-sm-3 col-form-label">{% trans "Network" %}</label>
<div class="col-sm-7">
<select class="form-select" name="networks">
{% for network in networks %}
<option value="{{ network }}">{{ network }}</option>
{% endfor %}
</select>
</div>
<div class="col-sm-4">
<input type="text" class="form-control" name="mac" maxlength="17" value="{{ mac_auto }}" required pattern="[a-zA-Z0-9:]+">
</div>
</div>
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Advanced" %}</label>
@ -814,39 +810,21 @@
let input_value = toggleValue($('#networks').val(), element.val(), checked);
$('#networks').val(input_value);
let selected_list_html = '';
mac_array = [];
net_counter = 0;
let counter = 0;
if (input_value != '') {
$.each(input_value.split(','), function (index, value) {
let li = '<li><input type="text" class="input-xs" name="mac'+ net_counter +'" maxlength="17" required pattern="[a-zA-Z0-9:]+" onchange="populate_mac(' + net_counter +')">' +
' eth' + net_counter +
let li = '<li>eth' + counter +
' -> ' + value + ' ' +
'<a class="btn-link float-end" onclick="$(\'#network-control\').multiselect(\'deselect\', \'' + value + '\', true)"><i class="fa fa-remove"></i></a></li>';
random_mac(net_counter);
selected_list_html += li;
net_counter++;
counter++;
});
}
$('#net-list').html(selected_list_html);
}
});
});
var mac_array = [];
function random_mac(c) {
$.getJSON("{% url 'instances:random_mac_address' %}", function (data) {
mac_array[c] = data['mac'];
$('input[name="mac' + c + '"').val(data['mac']);
populate_mac(c);
});
}
function populate_mac(c){
mac_array[c] = $('input[name="mac' + c + '"').val();
$('input[name="mac"').val(mac_array.join(","));
}
$("id[vcpu_mode]").multiselect();
function get_cust_vols(compute_id, pool) {
@ -888,7 +866,7 @@
{% if request.user.is_superuser %}
<script>
function goto_compute() {
let compute = {{ compute.id }};
let compute = {{ compute.id }}
window.location.href = "{% url 'instances:create_instance_select_type' 1 %}".replace(1, compute);
}
</script>

View file

@ -173,11 +173,3 @@ p {
a {
outline: 0;
}
.input-xs {
height: 22px;
padding: 2px 5px;
font-size: 12px;
line-height: 1.5; /* If Placeholder of the input is moved up, rem/modify this. */
border-radius: 2px;
}

View file

@ -338,12 +338,10 @@ class wvmCreate(wvmConnect):
xml += """<target dev='vd%s' bus='%s'/>""" % (vd_disk_letters.pop(0), "virtio")
xml += """</disk>"""
if mac:
macs = mac.split(',')
for idx, net in enumerate(networks.split(",")):
for net in networks.split(","):
xml += """<interface type='network'>"""
if mac:
xml += f"""<mac address='{macs[idx]}'/>"""
xml += f"""<mac address='{mac}'/>"""
xml += f"""<source network='{net}'/>"""
if nwfilter:
xml += f"""<filterref filter='{nwfilter}'/>"""