This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "YaST web service".
The branch, master has been updated
via db1f082b780842047beeca42f62578a81c623ffd (commit)
from b26fec308d7cb1e2b6d9eecc22dd9023dce0ae59 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit db1f082b780842047beeca42f62578a81c623ffd
Author: Bjoern Geuken
Date: Fri Jul 3 15:50:10 2009 +0200
status module: inherit Status from ActiveRecord::Base to get nice to_xml convertion
-----------------------------------------------------------------------
Summary of changes and diff:
.../status/app/controllers/status_controller.rb | 15 +++++++--
plugins/status/app/models/status.rb | 31 +------------------
2 files changed, 14 insertions(+), 32 deletions(-)
diff --git a/plugins/status/app/controllers/status_controller.rb b/plugins/status/app/controllers/status_controller.rb
index f3e3416..7c1c5e8 100644
--- a/plugins/status/app/controllers/status_controller.rb
+++ b/plugins/status/app/controllers/status_controller.rb
@@ -25,8 +25,12 @@ class StatusController < ApplicationController
else
@status = Status.new
@status.collect_data("11:13,07/03/2009", "11:14,07/03/2009", %w{cpu memory disk})
-# @status.collect_data(params[:start], params[:stop], params[:data])
- #logger.debug "SHOW: #{@status.inspect}"
+
+ respond_to do |format|
+ format.html { render :xml => @status.data.to_xml, :location => "none" } #return xml only
+ format.xml { render :xml => @status.data.to_xml, :location => "none" }
+ format.json { render :json => @status.data.to_xml, :location => "none" }
+ end
end
end
@@ -39,7 +43,12 @@ class StatusController < ApplicationController
@status = Status.new
@status.collect_data(params[:start], params[:stop], params[:data])
#logger.debug "SHOW: #{@status.inspect}"
+
+ respond_to do |format|
+ format.html { render :xml => @status.data.to_xml, :location => "none" } #return xml only
+ format.xml { render :xml => @status.data.to_xml, :location => "none" }
+ format.json { render :json => @status.data.to_xml, :location => "none" }
+ end
end
end
-
end
diff --git a/plugins/status/app/models/status.rb b/plugins/status/app/models/status.rb
index ecc3fcc..4409b2f 100644
--- a/plugins/status/app/models/status.rb
+++ b/plugins/status/app/models/status.rb
@@ -1,34 +1,7 @@
-class Status
+class Status < ActiveRecord::Base
require 'scr'
-=begin
- def to_xml(options = {})
- xml = options[:builder] ||= Builder::XmlMarkup.new(options)
- xml.instruct! unless options[:skip_instruct]
- xml.status do
- xml.tag!(:cpu, @cpu)
- xml.tag!(:memory, @memory)
- end
- end
-=end
-
- def to_xml(options = {})
- xml = options[:builder] ||= Builder::XmlMarkup.new(options)
- xml.instruct! unless options[:skip_instruct]
- xml.status do
-# @data.each_pair do |key, value|
-# @data.each do |m|
- @data.each_pair do |m, n|
- @data["#{m}"].each_pair do |key, value|
-# @data["#{m}"]["#{key}"].each do |v|
- xml.tag!("#{key}", "#{value}")
-# end
- end
- end
- end
-# end
-#@data
- end
+ attr_accessor :data
def initialize
@scr = Scr.instance
hooks/post-receive
--
YaST web service
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org