ref: refs/heads/master
commit dd64f1591072cda7e355eaecad5ea4531d650624
Author: Jiri Suchomel
Date: Fri Nov 6 10:03:25 2009 +0100
pass 'custom' parameter to webservice (bnc#553171)
---
.../app/controllers/services_controller.rb | 8 +++-
plugins/services/app/views/services/index.rhtml | 40 +++++++++++++++----
2 files changed, 37 insertions(+), 11 deletions(-)
diff --git a/plugins/services/app/controllers/services_controller.rb b/plugins/services/app/controllers/services_controller.rb
index 31e5821..9db60a9 100644
--- a/plugins/services/app/controllers/services_controller.rb
+++ b/plugins/services/app/controllers/services_controller.rb
@@ -26,7 +26,9 @@ class ServicesController < ApplicationController
return unless client_permissions
begin
- @response = @client.find(params[:id])
+ args = {}
+ args[:custom] = 1 if params.has_key? "custom"
+ @response = @client.find(:one, :from => params[:id].intern, :params => args)
rescue ActiveResource::ResourceNotFound => e
Rails.logger.error "Resource not found: #{e.to_s}: #{e.response.body}"
render :text => _('(cannot read status)') and return
@@ -61,7 +63,9 @@ class ServicesController < ApplicationController
return unless client_permissions
# PUT /services/1.xml
- response = @client.put(params[:service_id], :execute => params[:id])
+ args = { :execute => params[:id] }
+ args[:custom] = 1 if params.has_key? "custom"
+ response = @client.put(params[:service_id], args)
# we get a hash with exit, stderr, stdout
ret = Hash.from_xml(response.body)
diff --git a/plugins/services/app/views/services/index.rhtml b/plugins/services/app/views/services/index.rhtml
index 2830ec5..bdb023e 100644
--- a/plugins/services/app/views/services/index.rhtml
+++ b/plugins/services/app/views/services/index.rhtml
@@ -33,11 +33,19 @@ end
<% if service.status.nil? %>
<% javascript_tag do %>
$(document).ready( function() {
- <%= remote_function :update => "service_status_#{service.name}",
- :url => { :controller => :services, :action => :show_status, :id => service.name },
+ <%=
+ url = {
+ :controller => :services,
+ :id => service.name,
+ :action => :show_status
+ }
+ url[:custom] = 1 if params.has_key?("custom")
+
+ remote_function :update => "service_status_#{service.name}",
+ :url => url,
:loading => "$('#service_progress_#{service.name}').show(); $('#service_status_#{service.name}').hide()",
:complete => "$('#service_progress_#{service.name}').hide(); $('#service_status_#{service.name}').show()"
- %>
+ %>
});
<% end %>
<% else %>
@@ -54,12 +62,17 @@ $(document).ready( function() {
:service_id => service.name
}
url[:custom] = 1 if params.has_key?("custom")
+ status_url = {
+ :controler => :services,
+ :action => :show_status,
+ :id => service.name
+ }
+ status_url[:custom] = 1 if params.has_key?("custom")
link_to_remote cmd,
-# :update => "resultdlg",
:url => url,
:loading => "$('#service_progress_#{service.name}').show(); $('#service_status_#{service.name}').hide()",
:complete => remote_function(:update => "service_status_#{service.name}",
- :url => { :controller => :services, :action => :show_status, :id => service.name },
+ :url => status_url,
:complete => "$('#service_progress_#{service.name}').hide(); $('#service_status_#{service.name}').show()")
%>
<%
@@ -69,10 +82,19 @@ $(document).ready( function() {
end
end %>
- <%= link_to_remote _('status'), :update => "service_status_#{service.name}",
- :url => { :controller => :services, :action => :show_status, :id => service.name },
- :loading => "$('#service_progress_#{service.name}').show(); $('#service_status_#{service.name}').hide()",
- :complete => "$('#service_progress_#{service.name}').hide(); $('#service_status_#{service.name}').show()" %>
+ <%=
+ url = {
+ :controller => :services,
+ :id => service.name,
+ :action => :show_status
+ }
+ url[:custom] = 1 if params.has_key?("custom")
+
+ link_to_remote _('status'), :update => "service_status_#{service.name}",
+ :url => url,
+ :loading => "$('#service_progress_#{service.name}').show(); $('#service_status_#{service.name}').hide()",
+ :complete => "$('#service_progress_#{service.name}').hide(); $('#service_status_#{service.name}').show()"
+ %>
</li>
<% end %>
</ul>
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org