Browse files

Display (basic way) services for one host

  • Loading branch information...
1 parent 8aba47b commit 7aa1cedfac230e21925ec605274baf62c37a7c1f Marc Lagrange committed Nov 1, 2010
Showing with 15 additions and 0 deletions.
  1. +5 −0 lib/helpers.rb
  2. +9 −0 naglight.rb
  3. +1 −0 views/services/one_host.haml
View
5 lib/helpers.rb
@@ -55,3 +55,8 @@ def number_to_enabledisable(num)
def host_get_services(query)
return get_services(query)
end
+
+# Implement rails-like partials
+def partial(template, options={})
+ haml template, options.merge(:layout => false)
+end
View
9 naglight.rb
@@ -14,6 +14,7 @@
include ActionView::Helpers::TextHelper
include ActionView::Helpers::UrlHelper # Need mail_to for auto_link
+
# Need to improve this...
before do
# number / short / end of "num_services_foo" key
@@ -49,6 +50,14 @@
haml :"services/index"
end
+get '/services/hosts/:host_name' do
+ @title = "Services of #{params[:host_name]}"
+ filter = "Filter: host_name = #{params[:host_name]}\n"
+ @services = get_mk({:table => "services", :extras_headers => filter})
+ @allservices = @services
+ haml :"services/one_host"
+end
+
get '/contacts' do
@title = "Contacts"
@contacts = get_mk({:table => "contacts"})
View
1 views/services/one_host.haml
@@ -0,0 +1 @@
+= partial :"services/index"

0 comments on commit 7aa1ced

Please sign in to comment.