Sha256: b67c7cfd4747c5518133f921516e31b5f3e9fb660aedc0c8e04e683dcdbad3f3

Contents?: true

Size: 822 Bytes

Versions: 2

Compression:

Stored size: 822 Bytes

Contents

$(document).on( "ContentLoad", function() {
  update_salt_states($('#host_salt_environment_id'));
});

function update_salt_states(element) {
  var host_id = $("form").data('id')
  var env_id = $('*[id*=salt_environment_id]').val();
  var url = $(element).attr('data-url');
  var data = $("form").serialize().replace('method=put', 'method=post');

  if (url.match('hostgroups')) {
    data = data + '&hostgroup_id=' + host_id
  } else {
    data = data + '&host_id=' + host_id
  }

  if (env_id == "") return;

  $(element).indicator_show();
  $.ajax({
    type: 'post',
    url:  url,
    data: data,
    success: function(request) {
      $('#salt_modules').html(request);
      $('[rel="twipsy"]').tooltip();
      multiSelectOnLoad();
    },
    complete: function() {
      $(element).indicator_hide();
    }
  });
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
foreman_salt-3.0.0 app/assets/javascripts/foreman_salt/states.js
foreman_salt-2.1.0 app/assets/javascripts/foreman_salt/states.js