Sha256: 20dc6fb67a3abaa87a2ed62a867d04dfbc993425216c2e2ba5188167accd21a5

Contents?: true

Size: 869 Bytes

Versions: 8

Compression:

Stored size: 869 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 = $('select[name*=salt_environment_id]').val();
  var url = $(element).attr('data-url');
  var data = $("form").serialize().replace('method=put', 'method=post');

  if (url == undefined) return;

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

  if (!env_id) {
    return;
  }

  foreman.tools.showSpinner();
  $.ajax({
    type: 'put',
    url:  url,
    data: data,
    success: function(request) {
      $('#salt_modules').html(request);
      $('[rel="twipsy"]').tooltip();
      multiSelectOnLoad();
    },
    complete: function() {
      foreman.tools.hideSpinner();
    }
  });
}

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
foreman_salt-8.0.0 app/assets/javascripts/foreman_salt/states.js
foreman_salt-7.0.2 app/assets/javascripts/foreman_salt/states.js
foreman_salt-6.0.1 app/assets/javascripts/foreman_salt/states.js
foreman_salt-7.0.1 app/assets/javascripts/foreman_salt/states.js
foreman_salt-7.0.0 app/assets/javascripts/foreman_salt/states.js
foreman_salt-6.0.0 app/assets/javascripts/foreman_salt/states.js
foreman_salt-5.0.1 app/assets/javascripts/foreman_salt/states.js
foreman_salt-5.0.0 app/assets/javascripts/foreman_salt/states.js