Project

General

Profile

0001-Fixes-353-Added-responder-for-YAML-output-in-HostsCo.patch

Proposed patch - Jochen Schalanda, 11/02/2010 02:44 PM

View differences:

app/controllers/hosts_controller.rb
12 12
  helper :hosts, :reports
13 13

  
14 14
  def index
15
    @search = Host.search(params[:search])
15 16
    respond_to do |format|
16 17
      format.html do
17
        @search = Host.search(params[:search])
18 18
        @hosts = @search.paginate :page => params[:page], :include => [:hostgroup, :domain, :operatingsystem, :environment]
19 19
        @via    = "fact_values_"
20 20
        @last_reports = Report.maximum(:id, :group => :host_id, :conditions => {:host_id => @hosts})
21 21
      end
22
      format.json { render :json => Host.all(:select => [:name]).to_json(:only => :name) }
22
      format.json { render :text => @search.map(&:name).to_json }
23
      format.yaml { render :text => @search.map(&:name).to_yaml }
23 24
    end
24 25
  end
25 26

  
26
-