var KT = KT ? KT : {}; KT.hosts = {}; $(document).on('ContentLoad', function(){ KT.hosts.onKatelloHostEditLoad(); window.tfm.hosts.registerPluginAttributes("os", ['lifecycle_environment_id', 'content_view_id', 'environment_id', 'content_source_id', 'architecture_id']); $("#hostgroup_lifecycle_environment_id").change(KT.hosts.environmentChanged); $("#host_lifecycle_environment_id").change(KT.hosts.environmentChanged); KT.hosts.update_media_enablement(); KT.hosts.set_media_selection_bindings(); }); KT.hosts.environmentChanged = function() { // if we don't save the currently selected view it's likely // it will be undefined in toggle_installation_medium due to the CV dropdown reload var previous_content_view = KT.hosts.getSelectedContentView(); KT.hosts.fetchContentViews(); KT.hosts.toggle_installation_medium(previous_content_view); }; KT.hosts.fetchContentViews = function () { var select = KT.hosts.getContentViewSelect(); var envId = KT.hosts.getSelectedEnvironment(); var option; var previous_view = KT.hosts.getSelectedContentView(); select.find('option').remove(); if (envId) { KT.hosts.signalContentViewFetch(true); var url = tfm.tools.foremanUrl('/katello/api/v2/content_views/'); $.get(url, {environment_id: envId, full_result: true}, function (data) { select.append($("