Feature #353 ยป 0001-Fixes-353-Added-responder-for-YAML-output-in-HostsCo.patch
app/controllers/hosts_controller.rb | ||
---|---|---|
helper :hosts, :reports
|
||
def index
|
||
@search = Host.search(params[:search])
|
||
respond_to do |format|
|
||
format.html do
|
||
@search = Host.search(params[:search])
|
||
@hosts = @search.paginate :page => params[:page], :include => [:hostgroup, :domain, :operatingsystem, :environment]
|
||
@via = "fact_values_"
|
||
@last_reports = Report.maximum(:id, :group => :host_id, :conditions => {:host_id => @hosts})
|
||
end
|
||
format.json { render :json => Host.all(:select => [:name]).to_json(:only => :name) }
|
||
format.json { render :text => @search.map(&:name).to_json }
|
||
format.yaml { render :text => @search.map(&:name).to_yaml }
|
||
end
|
||
end
|
||