Project

General

Profile

« Previous | Next » 

Revision 8c678130

Added by Tomáš Strachota about 9 years ago

Fixes #9480 - multiple NICs integration with compute profiles

From users point of view:
- interfaces setup in compute profiles is back
- interface related compute attrs get merged into host NICs upon compute
profile selection
- NIC overview table displays details in the column "Type"
- UI for direct creation of VMs fixed
- fixed removing interfaces and volumes from compute profiles

From technical point of view:
- NIC overview table is always built by js
- templates for compute resources got more structure (split to partials
"base", "interface", "volume")
- compute resources can provide custom implementation of
'providerSpecificNICInfo' function

(cherry picked from commit 6d05514ad02676067389f44c4ba1d3daf357884b)

View differences:

app/assets/javascripts/host_edit_interfaces.js
var interface_id = modal_window.data('current-id');
// mark the selected values to preserve them for form hiding
modal_window.find('option:selected').attr('selected', 'selected');
preserve_selected_options(modal_window);
var modal_form = modal_window.find('.modal-body').contents();
if (modal_form.find('.interface_primary').is(':checked')) {
......
}
function update_interface_row(row, interface_form) {
row.find('.type').html(interface_form.find('.interface_type option:selected').text());
var has_errors = (interface_form.find('.has-error').length > 0)
row.toggleClass('has-error', has_errors);
var virtual = interface_form.find('.virtual').is(':checked');
var attached = interface_form.find('.attached').val();
var type = interface_form.find('.interface_type option:selected').text();
type += '<div class="additional-info">'
type += nic_info(interface_form);
type += '</div>'
row.find('.type').html(type);
row.find('.identifier').html(interface_form.find('.interface_identifier').val());
row.find('.mac').html(interface_form.find('.interface_mac').val());
row.find('.ip').html(interface_form.find('.interface_ip').val());
......
update_interface_table();
});
var providerSpecificNICInfo = null;
function nic_info(form) {
var info = "";
if (form.find('.virtual').is(':checked') || form.find('.interface_type').val() == "Nic::Bond") {
// common virtual
var attached = form.find('.attached').val();
if (attached != "")
info = Jed.sprintf(__("virtual attached to %s"), attached);
else
info = __("virtual");
} else {
// provider specific
if (typeof(providerSpecificNICInfo) == "function")
info = providerSpecificNICInfo(form);
else
info = __("physical")
}
return info;
}
$(document).on('change', '.compute_attributes', function () {
// remove "from profile" note if any of the fields changes
$(this).closest('.compute_attributes').find('.profile').html('');
});
$(document).on('change', '.virtual', function () {
var is_virtual = $(this).is(':checked');
$(this).closest('fieldset').find('.virtual_form').toggle(is_virtual);
$(this).closest('fieldset').find('.compute_attributes').toggle(!is_virtual);
});
function update_fqdn() {
var host_name = $('#host_name').val();
var domain_name = primary_nic_form().find('.interface_domain option:selected').text();

Also available in: Unified diff