Skip to content

Commit

Permalink
upgrade foreman to rails 3.2.13
Browse files Browse the repository at this point in the history
This commit updates from rails 3.0.x to 3.2.x, main changes include:

* Asset pipline support
* cleanup of existing assets (javascript, css, images)

Users who uses foreman in production, make sure that you now compile
your assets, e.g

rake assets:precompile

Paired-with: Joseph Mitchell Magen <jmagen@redhat.com>
Paired-with: Ohad Levy <ohadlevy@gmail.com>

Signed-off-by: Ohad Levy <ohadlevy@gmail.com>
  • Loading branch information
abenari authored and ohadlevy committed Apr 2, 2013
1 parent dbc1ee9 commit feacea3
Show file tree
Hide file tree
Showing 274 changed files with 954 additions and 3,391 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -14,6 +14,7 @@ bundler.d/Gemfile.local.rb
.idea
*.pyc
public/apipie-cache
public/assets
.DS_Store
foreman_client
doc/apidoc*
Expand Down
5 changes: 2 additions & 3 deletions Gemfile
Expand Up @@ -2,14 +2,13 @@ require File.expand_path('../config/settings', __FILE__)
require File.expand_path('../lib/regexp_extensions', __FILE__)
source 'http://rubygems.org'

gem 'rails', '3.0.20'
gem "jquery-rails"
gem 'rails', '3.2.13'
gem 'json'
gem 'rest-client', :require => 'rest_client'
gem "audited-activerecord", "3.0.0.rc1"
gem "will_paginate", "~> 3.0.2"
gem "ancestry", "~> 1.3"
gem 'scoped_search', '>= 2.4'
gem 'scoped_search', '>= 2.5'
gem 'net-ldap'
gem 'uuidtools'
gem "apipie-rails", '0.0.16'
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
@@ -1,8 +1,19 @@
//= require jquery
//= require jquery_ujs
//= require jquery.ui.autocomplete
//= require scoped_search
//= require twitter/bootstrap
//= require charts
//= require vendor
//= require_self

$(function() {
onContentLoad();
});

function onContentLoad(){
$('.autocomplete-input').scopedSearch();

$('.flash.error').hide().each(function(index, item) {
if ($('.alert-message.alert-error.base').length == 0) {
if ($('#host-conflicts-modal').length == 0) {
Expand Down Expand Up @@ -95,9 +106,19 @@ function add_fields(link, association, content) {
$(link).before(content.replace(regexp, new_id));
}

function checkAll (id, checked) {
$(id).attr('checked',checked);
}
$(document).ready(function() {
$("#check_all_roles").click(function(e) {
e.preventDefault();
$(".role_checkbox").prop('checked', true);

});

$("#uncheck_all_roles").click(function(e) {
e.preventDefault();
$(".role_checkbox").prop('checked', false);
});
});


function toggleCheckboxesBySelector(selector) {
boxes = $(selector);
Expand Down Expand Up @@ -130,7 +151,7 @@ function template_info(div, url) {
hostgroup_id = $("#host_hostgroup_id :selected").attr("value");
build = $('input:radio[name$="[provision_method]"]:checked').val();

$(div).html('<img src="/images/spinner.gif" alt="Wait" />');
$(div).html('<img src="/assets/spinner.gif" alt="Wait" />');
$(div).load(url + "?operatingsystem_id=" + os_id + "&hostgroup_id=" + hostgroup_id + "&environment_id=" + env_id+"&provisioning="+build,
function(response, status, xhr) {
if (status == "error") {
Expand All @@ -142,7 +163,7 @@ function template_info(div, url) {
$(document).ready(function() {
var common_settings = {
method : 'PUT',
indicator : "<img src='../images/spinner.gif' />",
indicator : "<img src='/assets/spinner.gif' />",
tooltip : 'Click to edit..',
placeholder : 'Click to edit..',
submitdata : {authenticity_token: AUTH_TOKEN, format : "json"},
Expand Down Expand Up @@ -207,9 +228,9 @@ $(function() {

function magic_line(id, combo) {
var $el, leftPos, newWidth, $mainNav = $(id);

$mainNav.append("<li class='magic-line'></li>");
var $magicLine = $(id + " .magic-line");
if ($magicLine.size() == 0) return;
if ($('[data-toggle=collapse]:visible').length > 0){
$magicLine.hide();
}else{$magicLine.show();}
Expand Down Expand Up @@ -304,14 +325,14 @@ function filter_by_level(item){
}

function auth_source_selected(){
var auth_source_id = $('#user_auth_source_id').attr('value');
if (auth_source_id == '') return false;
$.ajax({
type:'get',
url:'/users/auth_source_selected',
data:'auth_source_id=' + auth_source_id
})
var auth_source_id = $('#user_auth_source_id').val();
if (auth_source_id == '') {
$("#password").hide();
} else {
$("#password").show();
}
}

function show_release(element){
var os_family = $(element).val();
if (os_family == 'Debian' || os_family == 'Solaris') {
Expand Down Expand Up @@ -359,9 +380,9 @@ $(function() {

function update_puppetclasses(element) {
var host_id = $(element).attr('data-host-id');
var env_id = $('*[id*=environment_id]').attr('value');
var env_id = $('*[id*=environment_id]').val();
var url = $(element).attr('data-url');
var hostgroup_id = $('*[id*=hostgroup_id]').attr('value');
var hostgroup_id = $('*[id*=hostgroup_id]').val();
if (env_id == "") return;
$.ajax({
type: 'post',
Expand All @@ -370,10 +391,10 @@ function update_puppetclasses(element) {
success: function(request) {
$('#puppet_klasses').html(request);
reload_params();
$('[rel="twipsy"]').tooltip();
},
complete: function() {
$('#hostgroup_indicator').hide();
$('[rel="twipsy"]').tooltip();
}
})
}
Expand Down
Expand Up @@ -3,12 +3,9 @@ $(function(){
var el = $(element);
var name = el.attr('chart-name');
var title = el.attr('chart-title');
var border = $.parseJSON(el.attr('border'));
var expandable = el.attr('expandable');
var show_title = $.parseJSON(el.attr('show_title'));
var data = $.parseJSON(el.attr('chart-data'));

stat_pie(name, title, data, border, expandable, show_title);
stat_pie(name, title, data, false, expandable, false);
});

$(".statistics_bar").each(function(index, element){
Expand Down
Expand Up @@ -21,15 +21,8 @@ function providerSelected(item)
}
$("[type=submit]").attr("disabled",false);
var url = $(item).attr('data-url');
$.ajax({
type:'post',
url: url,
data:'provider=' + provider,
success: function(result){
$('#compute_connection').html($(result).find("#compute_connection"));
$('#compute_connection').append($(result).find(".alert-message"));
}
});
var data = 'provider=' + provider;
$('#compute_connection').load(url + ' div#compute_connection', data);
}

function testConnection(item) {
Expand All @@ -40,8 +33,9 @@ function testConnection(item) {
url: $(item).attr('data-url'),
data: $('form').serialize(),
success:function (result) {
$('#compute_connection').html($(result).find("#compute_connection"));
$('#compute_connection').prepend($(result).find(".alert-message"));
var res = $('<div>' + result + '</div>');
$('#compute_connection').html(res.find("#compute_connection"));
$('#compute_connection').prepend(res.find(".alert-message"));
},
complete:function (result) {
$('#test_connection_indicator').hide();
Expand Down
Expand Up @@ -2,7 +2,7 @@ var $editor

$(function() {
var template_text = $(".template_text");
if ($.browser.msie && $.browser.version.slice(0,1) < 10) {
if ($.browser && $.browser.msie && $.browser.version.slice(0,1) < 10) {
$('.subnav').hide();
if ($('.diffMode').size() >0) {
IE_diff_mode(template_text);
Expand Down
Expand Up @@ -107,7 +107,7 @@ $(function() {
var title = $(this).attr('data-original-title') + ' - The following hosts are about to be changed';
var url = $(this).attr('href') + "?" + $.param({host_ids: $.foremanSelectedHosts});
$('#confirmation-modal .modal-header h3').text(title);
$('#confirmation-modal .modal-body').empty().append("<img class='modal-loading' src='/images/spinner.gif'>");
$('#confirmation-modal .modal-body').empty().append("<img class='modal-loading' src='/assets/spinner.gif'>");
$('#confirmation-modal').modal({show: "true", backdrop: "static"});
$("#confirmation-modal .modal-body").load(url + " #content",
function(response, status, xhr) {
Expand Down
@@ -1,7 +1,6 @@
function computeResourceSelected(item){
var compute = $(item).val();
var attrs = attribute_hash(['architecture_id', 'compute_resource_id', 'operatingsystem_id']);
var label = $(item).children(":selected").text();
if(compute=='') { //Bare Metal
$('#mac_address').show();
$("#model_name").show();
Expand Down Expand Up @@ -151,7 +150,7 @@ function add_puppet_class(item){
var link = content.children('a');
link.attr('onclick', 'remove_puppet_class(this)');
link.attr('data-original-title', 'Click to undo adding this class');
link.removeClass('ui-icon-plus').addClass('ui-icon-minus').tooltip();
link.removeClass('icon-plus-sign').addClass('icon-remove-sign').tooltip();

$('#selected_classes').append(content);

Expand Down Expand Up @@ -185,7 +184,7 @@ function load_puppet_class_parameters(item) {

if (url == undefined) return; // no parameters
var placeholder = $('<tr id="puppetclass_'+id+'_params_loading">'+
'<td colspan="5"><p><img src="/images/spinner.gif" alt="Wait" /> Loading parameters...</p></td>'+'</tr>');
'<td colspan="5"><p><img src="/assets/spinner.gif" alt="Wait" /> Loading parameters...</p></td>'+'</tr>');
$('#inherited_puppetclasses_parameters').append(placeholder);
$.ajax({
url: url,
Expand All @@ -201,64 +200,39 @@ function load_puppet_class_parameters(item) {
}

function hostgroup_changed(element) {
var host_id = $(element).attr('data-host-id');
var url = $(element).attr('data-url');
var attrs = attribute_hash(['hostgroup_id', 'compute_resource_id', 'organization_id', 'location_id']);
if (attrs["hostgroup_id"] == undefined) attrs["hostgroup_id"] = $('#hostgroup_parent_id').attr('value');
$('#hostgroup_indicator').show();
var host_id = $(element).data('host-id');
if (!host_id){ // a new host
$.ajax({
type:'post',
url: url,
data:attrs,
complete: function(){
$('#hostgroup_indicator').hide();
$('[rel="twipsy"]').tooltip();
update_provisioning_image();
reload_params();
}
})
update_form(element);
} else { // edit host
update_puppetclasses(element);
}
}

function organization_changed(element) {
var url = $(element).attr('data-url');
var data = $('form').serialize().replace('method=put', 'method=post');
$('#organization_indicator').show();
$.ajax({
type: 'post',
url: url,
data: data,
success: function(response) {
$('#organization_indicator').hide();
$('form').html(response);
onContentLoad();
},
complete: function(){
$('#organization_indicator').hide();
$('[rel="twipsy"]').tooltip();
}
})
update_form(element);
}

function location_changed(element) {
var url = $(element).attr('data-url');
update_form(element);
}


function update_form(element) {
var url = $(element).data('url');
var data = $('form').serialize().replace('method=put', 'method=post');
$('#location_indicator').show();
var indicator = $(element).parent().find('img');
indicator.show();
$.ajax({
type: 'post',
url: url,
data: data,
success: function(response) {
$('#location_indicator').hide();
$('form').html(response);
$("[id$='subnet_id']").first().change();
onContentLoad();
},
complete: function(){
$('#location_indicator').hide();
$('[rel="twipsy"]').tooltip();
indicator.hide();
}
})
}
Expand All @@ -276,11 +250,15 @@ function subnet_selected(element){
}
var attrs = attribute_hash(["subnet_id", "host_mac", 'organization_id', 'location_id']);
$('#subnet_indicator').show();
var url = $(element).data('url');
$.ajax({
data: attrs,
type:'post',
url: foreman_url('/subnets/freeip'),
complete: function(){$('#subnet_indicator').hide()}
url: url,
complete: function(){$('#subnet_indicator').hide()},
success: function(data){
$('#host_ip').val(data.ip);
}
})
}

Expand All @@ -302,11 +280,13 @@ function _to_int(str){

function domain_selected(element){
var attrs = attribute_hash(['domain_id', 'organization_id', 'location_id']);
var url = $(element).attr('data-url');
var url = $(element).data('url');
$('#domain_indicator').show();
$.ajax({
data: attrs,
type:'post',
url: url,
complete: function(){$('#domain_indicator').hide()},
success: function(request) {
$('#subnet_select').html(request);
reload_params();
Expand Down Expand Up @@ -434,18 +414,18 @@ function override_class_param(item){
}

function reload_params(){
var url = $('#params-tab').attr('data-url');
var url = $('#params-tab').data('url');
var data = $("[data-submit='progress_bar']").serialize().replace('method=put', 'method=post');
load_with_placeholder('inherited_parameters', url, data)

var url2 = $('#params-tab').attr('data-url2');
var url2 = $('#params-tab').data('url2');
load_with_placeholder('inherited_puppetclasses_parameters', url2, data)
}

function load_with_placeholder(target, url, data){
if(url==undefined) return;
var placeholder = $('<tr id="' + target + '_loading" >'+
'<td colspan="4"><p><img src="/images/spinner.gif" alt="Wait" /> Loading parameters...</p></td></tr>');
'<td colspan="4"><p><img src="/assets/spinner.gif" alt="Wait" /> Loading parameters...</p></td></tr>');
$('#' + target + ' tbody').replaceWith(placeholder);
$.ajax({
type:'post',
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit feacea3

Please sign in to comment.