var KT = KT ? KT : {}; KT.hosts = {}; $(document).on('ContentLoad', function(){ KT.hosts.onKatelloHostEditLoad(); $("#hostgroup_lifecycle_environment_id").change(KT.hosts.fetchContentViews); $("#host_lifecycle_environment_id").change(KT.hosts.fetchContentViews); $("#hostgroup_content_view_id").change(KT.hosts.contentViewSelected); $("#host_content_view_id").change(KT.hosts.contentViewSelected); $("#reset_puppet_environment").click(function() { KT.hosts.getPuppetEnvironmentSelect().data('content_puppet_match', 'true'); KT.hosts.setDefaultPuppetEnvironment(KT.hosts.getSelectedContentView(), KT.hosts.getSelectedEnvironment()); }); KT.hosts.update_media_enablement(); KT.hosts.set_media_selection_bindings(); }); KT.hosts.fetchContentViews = function () { var select = KT.hosts.getContentViewSelect(); var envId = KT.hosts.getSelectedEnvironment(); select.find('option').remove(); if (envId) { KT.hosts.signalContentViewFetch(true); $.get('/katello/api/v2/content_views/', {environment_id: envId, full_result: true}, function (data) { select.find('option').remove(); select.append($("