Skip to content

Commit

Permalink
Fixes #25168 - add managed icon interface overview
Browse files Browse the repository at this point in the history
  • Loading branch information
akshay-mendhe committed Oct 31, 2018
1 parent bd95c2f commit 2b90bbf
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
19 changes: 17 additions & 2 deletions app/assets/javascripts/host_edit_interfaces.js
Expand Up @@ -52,6 +52,9 @@ function save_interface_modal() {
if (modal_form.find('.interface_provision').is(':checked')) {
$('#interfaceForms .interface_provision:checked').attr("checked", false);
}
if (modal_form.find('.interface_managed').is(':checked')) {
$('#interfaceForms .interface_managed:checked').attr("checked", false);
}

var interface_hidden = get_interface_hidden(interface_id);
interface_hidden.html('');
Expand Down Expand Up @@ -163,20 +166,24 @@ function update_interface_row(row, interface_form) {
row.find('.ip').text(interface_form.find('.interface_ip').val());
row.find('.ip6').text(interface_form.find('.interface_ip6').val());

var flags = '', primary_class = '', provision_class = '';
var flags = '', primary_class = '', provision_class = '', managed_class = '';
if (interface_form.find('.interface_primary').is(':checked'))
primary_class = 'active'

if (interface_form.find('.interface_provision').is(':checked'))
provision_class = 'active'

if (primary_class == '' && provision_class == '')
if (interface_form.find('.interface_managed').is(':checked'))
managed_class = 'active'

if (primary_class == '' && provision_class == '' && managed_class == '')
row.find('.removeInterface').removeAttr('disabled');
else
row.find('.removeInterface').attr('disabled', 'disabled');

flags += '<i class="glyphicon glyphicon glyphicon-tag primary-flag '+ primary_class +'" title="" data-original-title="'+ __('Primary') +'"></i>';
flags += '<i class="glyphicon glyphicon glyphicon-hdd provision-flag '+ provision_class +'" title="" data-original-title="'+ __('Provisioning') +'"></i>';
flags += '<i class="glyphicon glyphicon glyphicon-home managed-flag '+ managed_class +'" title="" data-original-title="'+ __('Managed') +'"></i>';

row.find('.flags').html(flags);

Expand All @@ -187,6 +194,7 @@ function update_interface_row(row, interface_form) {

$('.primary-flag').tooltip();
$('.provision-flag').tooltip();
$('.managed-flag').tooltip();
}

function update_interface_table() {
Expand Down Expand Up @@ -276,6 +284,13 @@ $(document).on('click', '.provision-flag', function () {
update_interface_table();
});

$(document).on('click', '.managed-flag', function () {
var interface_id = $(this).closest('tr').data('interface-id');
$('#interfaceForms .interface_managed:checked').prop('checked', false);
get_interface_hidden(interface_id).find('.interface_managed').prop('checked', true);
update_interface_table();
});

var providerSpecificNICInfo = null;

function nic_info(form) {
Expand Down
1 change: 1 addition & 0 deletions app/assets/stylesheets/base.scss
Expand Up @@ -396,6 +396,7 @@ table {
}

.primary-flag,
.managed-flag,
.provision-flag {
color: #bbb;
cursor: pointer;
Expand Down
1 change: 1 addition & 0 deletions app/views/nic/_base_form.html.erb
Expand Up @@ -65,6 +65,7 @@
<% if SETTINGS[:unattended] %>
<%= checkbox_f f, :managed,
:label_help => _("If the Managed flag is enabled, external services such as DHCP, DNS, and TFTP will be configured according to the information provided.") + '<br/>' + _("The services to be configured are determined by the subnet and domain that are selected for this interface. If you want to manage<br/> only a subset of these services, change the %{subnet} and %{domain} proxies configuration. When a proxy is set to 'None', the corresponding") + '<br/>' + _("service configuration will be skipped.") + '<br/><br/>' + _("If the Managed flag is disabled, none of the services will be configured for this interface, even if it is configured for the subnet and domain.") + '<br/><br/>' + _("The Managed flag also determines whether the interface should be configured during host provisioning, so that the configuration remains after reboot.") % { :subnet => link_to(_('subnet'), subnets_path, :target => :blank), :domain => link_to(_('domain'), domains_path, :target => :blank)},
:class => :interface_managed,
:label_help_options => { :rel => 'popover-modal' },
:size => "col-md-8", :label_size => "col-md-3" %>
<% end %>
Expand Down

0 comments on commit 2b90bbf

Please sign in to comment.