Revision ef14965b
Added by Ohad Levy about 14 years ago
- ID ef14965bdd36b8534bb0fc96bffc0f5302fbabe2
app/controllers/dashboard_controller.rb | ||
---|---|---|
class DashboardController < ApplicationController
|
||
before_filter :prefetch_data, :graphs, :only_on => :index
|
||
before_filter :prefetch_data, :graphs, :only => :index
|
||
helper :hosts
|
||
|
||
def index
|
||
end
|
||
|
||
def errors
|
||
hosts = Host.recent.with_error.paginate(:page => params[:page], :order => 'last_report DESC')
|
||
@search = Host.recent.with_error.search(params[:search])
|
||
hosts = @search.paginate :page => params[:page]
|
||
render :partial => "hosts/minilist", :layout => true, :locals => {
|
||
:hosts => hosts,
|
||
:header => "Hosts with errors" }
|
||
end
|
||
|
||
def active
|
||
hosts = Host.recent.with_changes.paginate(:page => params[:page], :order => 'last_report DESC')
|
||
@search = Host.recent.with_changes.search(params[:search])
|
||
hosts = @search.paginate :page => params[:page]
|
||
render :partial => "hosts/minilist", :layout => true, :locals => {
|
||
:hosts => hosts,
|
||
:header => "Active Hosts" }
|
||
end
|
||
|
||
def OutOfSync
|
||
hosts = Host.out_of_sync.paginate(:page => params[:page], :order => 'last_report DESC')
|
||
@search = Host.out_of_sync.search(params[:search])
|
||
hosts = @search.paginate :page => params[:page]
|
||
render :partial => "hosts/minilist", :layout => true, :locals => {
|
||
:hosts => hosts,
|
||
:header => "Hosts which didnt run puppet in the last #{SETTINGS[:puppet_interval]} minutes" }
|
app/views/hosts/_minilist.html.erb | ||
---|---|---|
<div id="hostlist">
|
||
<%= link_to_function "Search", toggle_div(:search) %>
|
||
|
||
<div id="search" style="display:none;">
|
||
<% form_for @search do |f|-%>
|
||
<%= f.label :name_like, "Name" %>
|
||
<%= f.text_field :name_like, :size => 15 %>
|
||
<%= f.label :environment_id_equals, "Environment" %>
|
||
<%= f.collection_select :environment_id_equals, Environment.all, :id, :name, :include_blank => true %>
|
||
<%= f.label :hostgroup, "Role" %>
|
||
<%= f.collection_select :hostgroup_id_eq, Hostgroup.all, :id, :name, :include_blank => true %>
|
||
<%= render :partial => 'hosts/fact_selected' %>
|
||
<p>
|
||
<%= f.submit "Search" %>
|
||
<% end %>
|
||
</div>
|
||
|
||
<% if hosts.size > 0 -%>
|
||
<table class="list">
|
||
<caption> <%= header ||= "" -%> </caption>
|
app/views/hosts/index.html.erb | ||
---|---|---|
<%= link_to_function "Search", toggle_div(:search) %>
|
||
<%= link_to "New Host", new_host_path %>
|
||
|
||
<div id="search" style="display: <%= searching? ? 'none':'inline' %>;">
|
||
<% form_for @search do |f|-%>
|
||
<%= f.label :name_like, "Name" %>
|
||
<%= f.text_field :name_like, :size => 15 %>
|
||
<%= f.label :environment_id_equals, "Environment" %>
|
||
<%= f.collection_select :environment_id_equals, Environment.all, :id, :name, :include_blank => true %>
|
||
<%= f.label :hostgroup, "Role" %>
|
||
<%= f.collection_select :hostgroup_id_eq, Hostgroup.all, :id, :name, :include_blank => true %>
|
||
<%= render :partial => 'fact_selected' %>
|
||
<p>
|
||
<%= f.submit "Search" %>
|
||
<% end %>
|
||
</div>
|
||
<span id=host_index_links>
|
||
<%= link_to "New Host", new_host_path %>
|
||
</span>
|
||
|
||
<%= render 'minilist', :hosts => @hosts, :header => "Hosts" %>
|
public/stylesheets/style.css | ||
---|---|---|
font-size: 75%;
|
||
color: #333;
|
||
}
|
||
|
||
#host_index_links {
|
||
position: relative;
|
||
float: right;
|
||
}
|
vendor/plugins/searchlogic | ||
---|---|---|
Subproject commit 18e24e74d73134335448283051b438384db7be6f
|
||
Subproject commit ccb6fa5c64dae162e40912930921d28152801a07
|
Also available in: Unified diff
fixes #222 - add search and sort functionality to dashboard host lists