ref: refs/heads/dmacvicar_log_viewer commit edee31f7bbc27e5d0d27cc28db013c3453b41919 Author: Jiri Suchomel <jsuchome@suse.cz> Date: Tue Aug 18 15:26:59 2009 +0200 no standalone plugin for now, let's work inside 'services' only --- plugins/custom_services/README | 7 -- plugins/custom_services/Rakefile | 10 --- .../app/controllers/custom_services_controller.rb | 67 ------------------ .../app/views/custom_services/_result.rhtml | 20 ------ .../app/views/custom_services/index.rhtml | 70 ------------------- plugins/custom_services/config/rails_parent.rb | 15 ---- plugins/custom_services/init.rb | 12 --- plugins/custom_services/install.rb | 1 - .../yast2-webclient-custom-services.changes | 4 - .../package/yast2-webclient-custom-services.spec | 73 -------------------- plugins/custom_services/shortcuts.yml | 8 -- .../tasks/custom_services_tasks.rake | 6 -- .../custom_services/test/custom_services_test.rb | 8 -- .../functional/custom_services_controller_test.rb | 45 ------------ plugins/custom_services/test/test_helper.rb | 19 ----- plugins/custom_services/uninstall.rb | 1 - 16 files changed, 0 insertions(+), 366 deletions(-) diff --git a/plugins/custom_services/README b/plugins/custom_services/README deleted file mode 100644 index afbf229..0000000 --- a/plugins/custom_services/README +++ /dev/null @@ -1,7 +0,0 @@ -Services -========= - -Plugin for hanling custom vendor service. - - -Copyright (c) 2009 Novell, released under the MIT license diff --git a/plugins/custom_services/Rakefile b/plugins/custom_services/Rakefile deleted file mode 100644 index ca63e76..0000000 --- a/plugins/custom_services/Rakefile +++ /dev/null @@ -1,10 +0,0 @@ -require 'rake' -require 'rake/testtask' -require 'rake/rdoctask' -require File.join(File.dirname(__FILE__), 'config', 'rails_parent') -require File.join(RailsParent.parent, 'config', 'boot') -require 'tasks/rails' - -desc 'Default: run unit tests.' -task :default => :test - diff --git a/plugins/custom_services/app/controllers/custom_services_controller.rb b/plugins/custom_services/app/controllers/custom_services_controller.rb deleted file mode 100644 index 518bccd..0000000 --- a/plugins/custom_services/app/controllers/custom_services_controller.rb +++ /dev/null @@ -1,67 +0,0 @@ -require 'yast/service_resource' - -class CustomServicesController < ApplicationController - before_filter :login_required - layout 'main' - - private - def client_permissions - @client = YaST::ServiceResource.proxy_for('org.opensuse.yast.modules.yapi.services') - unless @client - flash[:notice] = _("Invalid session, please login again.") - redirect_to( logout_path ) and return - end - @permissions = @client.permissions - end - - # Initialize GetText and Content-Type. - init_gettext "yast_webclient_custom_service" # textdomain, options(:charset, :content_type) - - public - - def initialize - end - - # GET /services - # GET /services.xml - def index - return unless client_permissions - @services = [] -logger.debug "-------------------------------- index" - - begin - @services = @client.find(:all) - rescue ActiveResource::ClientError => e - flash[:error] = YaST::ServiceResource.error(e) - end -logger.debug @services.inspect - - respond_to do |format| - format.html # index.html.erb - format.xml { render :xml => @services } - end - end - - def execute - return unless client_permissions - @service = @client.find(params[:service_id]) - - response = @client.put(params[:service_id], :execute => params[:id]) - - # we get a hash with exit, stderr, stdout - ret = Hash.from_xml(response.body) - ret = ret["hash"] - logger.debug "returns #{ret.inspect}" - - @result_string = "" - @result_string << ret["stdout"] if ret["stdout"] - @result_string << ret["stderr"] if ret["stderr"] - @error_string = ret["exit"].to_s - if ret["exit"] == 0 - @error_string = _("success") - end - render(:partial =>'result') - end - - -end diff --git a/plugins/custom_services/app/views/custom_services/_result.rhtml b/plugins/custom_services/app/views/custom_services/_result.rhtml deleted file mode 100644 index 3af3d5f..0000000 --- a/plugins/custom_services/app/views/custom_services/_result.rhtml +++ /dev/null @@ -1,20 +0,0 @@ - <div class="box"> - <div class="table"> - <img src="images/bg-th-left.gif" width="8" height="7" alt="" class="left" /> - <img src="images/bg-th-right.gif" width="7" height="7" alt="" class="right" /> - <table class="listing form" cellpadding="0" cellspacing="0"> - <tr> - <th class="full" colspan="2"><%=_("Service Call Result")%></th> - </tr> - <tr> - <td class="first" width="120"><strong><%=_("Result")%></strong></td> - <td class="last"><%=h @error_string %></td> - </tr> - <tr class="bg"> - <td class="first"><strong><%=_("Description")%></strong></td> - <td class="last"><%=h @result_string %></td> - </tr> - </table> - <p><a href="services" class="button"><%=_("Back")%></a></p> - </div> - </div> \ No newline at end of file diff --git a/plugins/custom_services/app/views/custom_services/index.rhtml b/plugins/custom_services/app/views/custom_services/index.rhtml deleted file mode 100644 index 7498013..0000000 --- a/plugins/custom_services/app/views/custom_services/index.rhtml +++ /dev/null @@ -1,70 +0,0 @@ -<%= javascript_include_tag :defaults %> - -<script language="javascript"> - - YAHOO.namespace('yuiresult'); - - function initResultDialog() { - var handleCancel = function() { - this.cancel(); - } - - YAHOO.yuiresult.resultDialog = new YAHOO.widget.Dialog("resultdlg", { - width: "625px", - modal: true, - visible: false, - fixedcenter: true, - constraintoviewport: true, - draggable: true }); - - YAHOO.yuiresult.resultDialog.render(); - } - - function showResultDialog() { - YAHOO.yuiresult.resultDialog.show(); - } - - YAHOO.util.Event.addListener(window, "load", initResultDialog); -</script> - -<!-- begin: dialog box --> -<div id="resultdlg"> -</div> -<!-- end: dialog box --> - -<div class='plugin-icon'><img src='/icons/yast-online_update.png'/></div> -<div class='plugin-content'> - -<h2><%=_("The full name of vendor service here")%></h2> -<br> - -<% if ! @permissions[:execute] %> -<p><%=_("You do not have permission to execute the service. The links are disabled.")%></p> -<% end %> - -<ul> -<% @services.each do |service| %> -<li><b><%=h service.name %></b> - <% [ "start", "stop" ].each do |cmd| - if @permissions[:execute] %> - <%= - link_to_remote cmd, - :update => "resultdlg", - :url=>{ :id=> cmd, - :action => "execute", - :service_id=> service.name - } -# :loading => "Element.show('progress')" -# :complete => "Element.hide('progress'); showResultDialog();" - %> - <% - else %> - <span style="color: #BDBDBD"><%="#{cmd}" -%></span> - <% - end - end %> -</li> -<% end %> -</ul> - -</div> diff --git a/plugins/custom_services/config/rails_parent.rb b/plugins/custom_services/config/rails_parent.rb deleted file mode 100644 index 59e7892..0000000 --- a/plugins/custom_services/config/rails_parent.rb +++ /dev/null @@ -1,15 +0,0 @@ -class RailsParent - - def RailsParent.parent - parent = ENV["RAILS_PARENT"] - unless parent - parent = File.expand_path(File.join('..','..','..', 'webclient'), File.dirname(__FILE__)) - unless File.directory?( parent || "" ) - $stderr.puts "Nope: #{parent}\nPlease set RAILS_PARENT environment" - exit 1 - end - end - parent - end - -end diff --git a/plugins/custom_services/init.rb b/plugins/custom_services/init.rb deleted file mode 100644 index e5b1498..0000000 --- a/plugins/custom_services/init.rb +++ /dev/null @@ -1,12 +0,0 @@ -# Include hook code here -# always reload all files in development mode -if ENV['RAILS_ENV'] == 'development' - # get all subdirectories in app/ - dirs = Dir[File.join(directory, 'app', '*')].reject{|x| not File.directory?(x)} - - dirs.each do |dir| - $LOAD_PATH << dir - ActiveSupport::Dependencies.load_paths << dir - ActiveSupport::Dependencies.load_once_paths.delete(dir) - end -end diff --git a/plugins/custom_services/install.rb b/plugins/custom_services/install.rb deleted file mode 100644 index f7732d3..0000000 --- a/plugins/custom_services/install.rb +++ /dev/null @@ -1 +0,0 @@ -# Install hook code here diff --git a/plugins/custom_services/package/yast2-webclient-custom-services.changes b/plugins/custom_services/package/yast2-webclient-custom-services.changes deleted file mode 100644 index 5cdd97b..0000000 --- a/plugins/custom_services/package/yast2-webclient-custom-services.changes +++ /dev/null @@ -1,4 +0,0 @@ -------------------------------------------------------------------- -Mon Aug 17 08:38:57 CEST 2009 - jsuchome@suse.cz - -- initial version diff --git a/plugins/custom_services/package/yast2-webclient-custom-services.spec b/plugins/custom_services/package/yast2-webclient-custom-services.spec deleted file mode 100644 index ea9e996..0000000 --- a/plugins/custom_services/package/yast2-webclient-custom-services.spec +++ /dev/null @@ -1,73 +0,0 @@ -# -# spec file for package yast2-webclient-custom-services (Version 0.1) -# -# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany. -# This file and all modifications and additions to the pristine -# package are under the same license as the package itself. -# -# Please submit bugfixes or comments via http://bugs.opensuse.org/ -# - - -Name: yast2-webclient-custom-services -PreReq: yast2-webclient -Provides: yast2-webclient:/srv/www/yast/app/controllers/custom_services_controller.rb -License: GPL -Group: Productivity/Networking/Web/Utilities -Autoreqprov: on -Version: 0.0.1 -Release: 0 -Summary: YaST2 - Webclient - Custom Service -Source: www.tar.bz2 -BuildRoot: %{_tmppath}/%{name}-%{version}-build -BuildArch: noarch - -# -%define pkg_user yast -%define plugin_name custom_services -# - - -%description -YaST2 - Webclient - UI for YaST-webservice in order to handle custom service. -Authors: --------- - Stefan Schubert <schubi@opensuse.org> - -%prep -%setup -q -n www - -%build -export RAILS_PARENT=/srv/www/yast -(rake makemo) - -%install - -# -# Install all web and frontend parts. -# -mkdir -p $RPM_BUILD_ROOT/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name} -cp -a * $RPM_BUILD_ROOT/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name} - - -%clean -rm -rf $RPM_BUILD_ROOT - -%files -%defattr(-,root,root) -%dir /srv/www/%{pkg_user} -%dir /srv/www/%{pkg_user}/vendor -%dir /srv/www/%{pkg_user}/vendor/plugins -%dir /srv/www/%{pkg_user}/vendor/plugins/%{plugin_name} -/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/README -/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/Rakefile -/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/init.rb -/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/install.rb -/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/uninstall.rb -/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/app -/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/locale -/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/po -/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/shortcuts.yml -/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/tasks -#/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/test -/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/config diff --git a/plugins/custom_services/shortcuts.yml b/plugins/custom_services/shortcuts.yml deleted file mode 100644 index d9fb55a..0000000 --- a/plugins/custom_services/shortcuts.yml +++ /dev/null @@ -1,8 +0,0 @@ -main: -# FIXME: use the correct icon - icon: '/icons/yast-online_update.png' - url: /custom_services - groups: [ Services ] - tags: [ init, script, service ] - title: Custom Service - description: Manage the custom service diff --git a/plugins/custom_services/tasks/custom_services_tasks.rake b/plugins/custom_services/tasks/custom_services_tasks.rake deleted file mode 100644 index 1568c54..0000000 --- a/plugins/custom_services/tasks/custom_services_tasks.rake +++ /dev/null @@ -1,6 +0,0 @@ -begin - require 'tasks/webservice' -rescue LoadError => e - $stderr.puts "Install rubygem-yast2-webservice-tasks.rpm" -end - diff --git a/plugins/custom_services/test/custom_services_test.rb b/plugins/custom_services/test/custom_services_test.rb deleted file mode 100644 index fe7b428..0000000 --- a/plugins/custom_services/test/custom_services_test.rb +++ /dev/null @@ -1,8 +0,0 @@ -require 'test_helper' - -class CustomServicesTest < ActiveSupport::TestCase - # Replace this with your real tests. - test "the truth" do - assert true - end -end diff --git a/plugins/custom_services/test/functional/custom_services_controller_test.rb b/plugins/custom_services/test/functional/custom_services_controller_test.rb deleted file mode 100644 index f3dd307..0000000 --- a/plugins/custom_services/test/functional/custom_services_controller_test.rb +++ /dev/null @@ -1,45 +0,0 @@ -require 'test_helper' - -class ServicesControllerTest < ActionController::TestCase - def test_should_get_index - get :index - assert_response :success - assert_not_nil assigns(:services) - end - - def test_should_get_new - get :new - assert_response :success - end - - def test_should_create_service - assert_difference('Service.count') do - post :create, :service => { } - end - - assert_redirected_to service_path(assigns(:service)) - end - - def test_should_show_service - get :show, :id => services(:one).id - assert_response :success - end - - def test_should_get_edit - get :edit, :id => services(:one).id - assert_response :success - end - - def test_should_update_service - put :update, :id => services(:one).id, :service => { } - assert_redirected_to service_path(assigns(:service)) - end - - def test_should_destroy_service - assert_difference('Service.count', -1) do - delete :destroy, :id => services(:one).id - end - - assert_redirected_to services_path - end -end diff --git a/plugins/custom_services/test/test_helper.rb b/plugins/custom_services/test/test_helper.rb deleted file mode 100644 index 5d083a8..0000000 --- a/plugins/custom_services/test/test_helper.rb +++ /dev/null @@ -1,19 +0,0 @@ -rails_parent = ENV["RAILS_PARENT"] -unless rails_parent - default_parent = "../../webclient" - if File.directory?(default_parent) - $stderr.puts "Taking #{default_parent} for RAILS_PARENT" - rails_parent = default_parent - else - $stderr.puts "Please set RAILS_PARENT environment" - exit - end -end -# first config rails -require File.expand_path(rails_parent + "/config/environment") -# then enable testing, this will get the routing right -ENV["RAILS_ENV"] = "test" - -require 'rubygems' -require 'active_support' -require 'active_support/test_case' diff --git a/plugins/custom_services/uninstall.rb b/plugins/custom_services/uninstall.rb deleted file mode 100644 index 9738333..0000000 --- a/plugins/custom_services/uninstall.rb +++ /dev/null @@ -1 +0,0 @@ -# Uninstall hook code here -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org