ref: refs/heads/master
commit 8250f68051fc6b26bc7b2e7d9f6b52a19aa60317
Author: Klaus Kämpf
Date: Wed Jul 22 17:30:04 2009 +0200
Oops, remove bogus files
---
plugins/status/package/www/README | 7 -
plugins/status/package/www/Rakefile | 10 -
.../www/app/controllers/status_controller.rb | 231 --------------------
.../package/www/app/helpers/status_helper.rb | 7 -
plugins/status/package/www/app/models/status.rb | 4 -
.../www/app/views/status/_status_summary.html.erb | 16 --
.../package/www/app/views/status/edit.html.erb | 47 ----
.../package/www/app/views/status/index.html.erb | 115 ----------
plugins/status/package/www/config/rails_parent.rb | 15 --
plugins/status/package/www/init.rb | 1 -
plugins/status/package/www/install.rb | 1 -
plugins/status/package/www/shortcuts.yml | 9 -
plugins/status/package/www/tasks/status_tasks.rake | 6 -
plugins/status/package/www/uninstall.rb | 1 -
14 files changed, 0 insertions(+), 470 deletions(-)
diff --git a/plugins/status/package/www/README b/plugins/status/package/www/README
deleted file mode 100644
index 3906624..0000000
--- a/plugins/status/package/www/README
+++ /dev/null
@@ -1,7 +0,0 @@
-Status
-============
-
-Plugin for showing system information like CPU, memorry, ....
-
-
-Copyright (c) 2009 Novell, released under the MIT license
diff --git a/plugins/status/package/www/Rakefile b/plugins/status/package/www/Rakefile
deleted file mode 100644
index ca63e76..0000000
--- a/plugins/status/package/www/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/status/package/www/app/controllers/status_controller.rb b/plugins/status/package/www/app/controllers/status_controller.rb
deleted file mode 100644
index 114c57a..0000000
--- a/plugins/status/package/www/app/controllers/status_controller.rb
+++ /dev/null
@@ -1,231 +0,0 @@
-require 'yast/service_resource'
-
-class StatusController < ApplicationController
- before_filter :login_required
- layout "main"
-
- private
- def client_permissions
- @client = YaST::ServiceResource.proxy_for('org.opensuse.yast.system.status')
- unless @client
- flash[:notice] = _("Invalid session, please login again.")
- redirect_to( logout_path ) and return
- end
- @permissions = @client.permissions
- end
-
- def create_data_map( tree, label = "")
- data_map = Hash.new
- if tree.methods.include?("attributes")
- tree.attributes.each do |key, branch|
- if key.start_with?("t_")
- data_map[key] = branch.to_f
- elsif key == "limit"
- @limits[label] = branch.attributes
- else
- next_label = label
- if key != "value"
- next_label += "/" + key
- end
- data_map = create_data_map(branch, next_label)
- if data_map.size > 0
- data_list = []
- flatten_map = data_map.sort #Sorting for timestamps
- flatten_map.each {|data| data_list << data[1] }
- @data[next_label] = data_list
- data_map = {}
- end
- end
- end
- else
- logger.error "wrong result: #{tree.inspect}"
- end
- return data_map
- end
-
- def create_data
- @data = Hash.new
- @limits = Hash.new
- @limits_list = Hash.new
- @data_group = Hash.new
- status = []
- begin
- till = Time.new
- from = till - 300 #last 5 minutes
-
- status = @client.find(:dummy_param, :params => { :start => from.to_i.to_s, :stop => till.to_i.to_s })
-
- rescue ActiveResource::ClientError => e
- flash[:error] = YaST::ServiceResource.error(e)
- return false
- end
-
- create_data_map status
-
- #grouping graphs to memory, cpu,...
- @data.each do |key, list_value|
- if @limits.has_key?(key)
- graph_list = []
- key_split = key.split("/")
- for i in 0..list_value.size-1 do
- if key_split.size>1 && key_split[1]=="memory" # take MByte for the value
- graph_list << [i,@limits[key]["value"]/1024/1024]
- else
- graph_list << [i,@limits[key]["value"]]
- end
- end
- @limits_list[key] = graph_list
- end
-
- key_split = key.split("/")
- if key_split.size > 1
- group_map = {}
- group_map = @data_group[key_split[1]] if @data_group.has_key?(key_split[1])
- label_name = ""
- for i in 2..key_split.size-1 do
- if i==2
- label_name = key_split[i]
- else
- label_name += "/" + key_split[i]
- end
- end
- graph_list = []
- store_data = false #take only a list which has one value greater than 0 at least
- for i in 0..list_value.size-1
- store_data = true if list_value[i] != 0
- value_list = [i]
- if key_split[1]=="memory" # take MByte for the value
- value_list << list_value[i]/1024/1024
- else
- value_list << list_value[i]
- end
- graph_list << value_list
- end
- if store_data
- group_map[label_name] = graph_list
- @data_group[key_split[1]] = group_map
- end
- else
- logger.error "empty key: #{@key} #{list.inspect}"
- end
- end
- logger.debug "Limits: #{@limits.inspect}"
-# logger.debug "System information: #{@data_group.inspect}"
- true
- end
-
- #removing logging data and add limits which are defined in params
- def create_save_data(status, params, label = "")
- status.each do |key, value|
- if key.start_with?("t_")
- status.delete(key)
- elsif
- next_label = label+ "/" + key
- create_save_data(value, params, next_label) if value.is_a? Hash
- end
- end
- if params.has_key?(label+"/value")
- limit = Hash.new
- key_split = label.split("/")
- if key_split.size>1 && key_split[1]=="memory" # MByte for the value --> change it to Byte
- limit["value"] = params[label+"/value"].to_f*1024*1024
- else
- limit["value"] = params[label+"/value"]
- end
- limit["maximum"] = params[label+"/maximum"] == "true"?true:false
- status["limit"] = limit
- end
- return status
- end
-
- # Initialize GetText and Content-Type.
- init_gettext "yast_webclient_status"
-
- public
-
- def initialize
- end
-
- def edit
- return unless client_permissions
- create_data
- end
-
- def index
- return unless client_permissions
- create_data
- end
-
-
- def show_summary
- return unless client_permissions
- unless create_data
- erase_redirect_results #reset all redirects
- erase_render_results
- flash.clear #no flash from load_proxy
- render :partial => "status_summary", :locals => { :status => nil }
- return false
- end
- status = ""
- @data_group.each do |key, map|
- error_found = false
- map.each do |graph_key, list_value|
- limit_key = "/#{key}/#{graph_key}"
- if @limits_list.has_key?(limit_key)
- cmp_value = @limits_list[limit_key][0][1] #take thatone cause it has already the right format
- #( e.g. MByte for memory)
- list_value.each do |value|
- if (@limits[limit_key]["maximum"] && value[1]>= cmp_value) ||
- (!@limits[limit_key]["maximum"] && value[1]<= cmp_value)
- error_found = true
- break
- end
- end
- end
- end
- if error_found
- status += "; " unless status.blank?
- status += key + " " + _("limits exceeded")
- end
- end
-
- render :partial => "status_summary", :locals => { :status => status }
- end
-
- def save
- return unless client_permissions
- begin
- till = Time.new
- from = till - 300 #last 5 minutes
- status = @client.find(:dummy_param, :params => { :start => from.to_i.to_s, :stop => till.to_i.to_s })
-
- rescue ActiveResource::ClientError => e
- flash[:error] = YaST::ServiceResource.error(e)
- redirect_to :controller=>"status", :action=>"edit"
- return false
- end
-
- save_hash = create_save_data(Hash.from_xml(status.to_xml)["status"], params)
- logger.debug "writing #{save_hash.inspect}"
-
- save_status = @client.new()
- save_status.load(save_hash)
-
- success = true
- begin
- save_status.save
- logger.debug "limits have been written"
- flash[:notice] = _("Limits have been written.")
- rescue ActiveResource::ClientError => e
- flash[:error] = YaST::ServiceResource.error(e)
- ExceptionLogger.log_exception e
- success = false
- end
- if success
- redirect_to :controller=>"status", :action=>"index"
- else
- redirect_to :controller=>"status", :action=>"edit"
- end
- end
-
-end
diff --git a/plugins/status/package/www/app/helpers/status_helper.rb b/plugins/status/package/www/app/helpers/status_helper.rb
deleted file mode 100644
index ad1a785..0000000
--- a/plugins/status/package/www/app/helpers/status_helper.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-module StatusHelper
- def graph id, width, height, last = false
- html = "<div id='#{id}' style='width:#{width}px;height:#{height}px;float:left'><img src='/images/spinner.gif'></div>"
- html += "<br style='clear: both'>" if last
- return html
- end
-end
diff --git a/plugins/status/package/www/app/models/status.rb b/plugins/status/package/www/app/models/status.rb
deleted file mode 100644
index 3621ed4..0000000
--- a/plugins/status/package/www/app/models/status.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'yast/service_resource'
-class Status < YaST::ServiceResource::Base
-
-end
diff --git a/plugins/status/package/www/app/views/status/_status_summary.html.erb b/plugins/status/package/www/app/views/status/_status_summary.html.erb
deleted file mode 100644
index 3f70230..0000000
--- a/plugins/status/package/www/app/views/status/_status_summary.html.erb
+++ /dev/null
@@ -1,16 +0,0 @@
-<div class="status_status">
- <% unless status %>
- <div class="status-icon warning"></div>
- <span><%= _("Error occur during loading status information.") %></span>
- <% else %>
- <% link_to "status" do %>
- <% if !status.blank? %>
- <img src="/images/button_critical.png" alt="error found"/>
- <%= status %>
- <% else %>
- <img src="/images/button_ok.png" alt="Your system is healthy"/>
- <%= _("Your system is healthy.") %>
- <% end %>
- <% end %>
- <% end %>
-</div>
diff --git a/plugins/status/package/www/app/views/status/edit.html.erb b/plugins/status/package/www/app/views/status/edit.html.erb
deleted file mode 100644
index 73fb003..0000000
--- a/plugins/status/package/www/app/views/status/edit.html.erb
+++ /dev/null
@@ -1,47 +0,0 @@
-<% disabled = ! @permissions[:writelimits] %>
-
-<h2><%=_("Configure Status Limits")%></h2>
-
-<% form_tag '/status/save' do %>
-<table class="list">
- <tr>
- <th width=350><%=_("Status Path")%></th>
- <th width=100><%=_("Limit Value")%></th>
- <th width=40><%=_("Maximum Reached") %></th>
- </tr>
-
- <% @data_group.each do |key, map| %>
- <% map.each do |graph_key, list_value| %>
- <tr>
- <% limit_key = "/#{key}/#{graph_key}" %>
- <td><%= limit_key %></td>
-
- <% if @limits_list.has_key?(limit_key) %>
- <td>
- type="text" size="10" maxlength="15" value=<%= @limits_list[limit_key][0][1] %>>
- </td>
- <td>
- id=<%= limit_key+"/maximum" %> value="true"
- <%= @limits[limit_key]["maximum"] ? "checked" : "" %>
- <%= "disabled=\"disabled\"" if disabled %> />
- </td>
- <% else %>
- <td>
- type="text" size="10" maxlength="15" value=0>
- </td>
- <td>
- id=<%= limit_key+"/maximum" %> value="true"
- <%= "disabled=\"disabled\"" if disabled %> />
- </td>
- <% end %>
- </tr>
- <% end %>
- <% end %>
-</table>
-<%= submit_tag _("Save"), :disabled=> disabled, :class => 'button' -%>
-<% end -%>
-<br>
-<a href="/" class="button"><%=_("Back")%></a>
-<br>
-
-
diff --git a/plugins/status/package/www/app/views/status/index.html.erb b/plugins/status/package/www/app/views/status/index.html.erb
deleted file mode 100644
index ed63eb3..0000000
--- a/plugins/status/package/www/app/views/status/index.html.erb
+++ /dev/null
@@ -1,115 +0,0 @@
-
-<h1>Status</h1>
-
-<% column = 1 %>
-<% @data_group.each do |key, map| %>
- <% if column != 1 %>
- <br style='clear: both'>
- <br>
- <% column = 1 %>
- <% end %>
- <% if key == "df" %>
- <h3><%= _("Disk usage") %></h3>
- <% else %>
- <h3><%= key.tr('_',' ').capitalize %></h3>
- <% end %>
-
- <% map.each do |graph_key, list_value| %>
- <% if key != "df" || !graph_key.end_with? ("used") %>
- <% graph_id = key + "_" + graph_key.tr('/','_') %>
- <%= graph(graph_id, 200, 150, column == 4?true:false) %>
- <% if column == 4 %>
- <br>
- <% column = 1 %>
- <% else %>
- <% column += 1 %>
- <% end %>
- <% end %>
- <% end %>
-<% end %>
-<% if column != 1 %>
- <br style='clear: both'>
- <br>
-<% end %>
-<br>
-<br>
-<%= button_to _("edit limits"), :action => :edit, :class => "button" %>
-<br>
-<%= button_to _("Back"), :back %>
-<br>
-<script type="text/javascript">
-
-
-function plotPieGraph (graph_id, graph_title, graph_data ) {
- $.jqplot(graph_id, [graph_data], {
- title: graph_title,
- legend: {
- show: true
- },
- seriesDefaults: {
- renderer: $.jqplot.PieRenderer,
- rendererOptions: {
- sliceMargin: 0,
- diameter: 100
- }
- },
-
- cursor: {
- show: false
- },
- });
-}
-
-
-function plotLineGraph(graph_id, graph_title, graph_data ) {
- $.jqplot(graph_id, graph_data, {
- title: graph_title,
- axes: {
- xaxis: {
- showTicks: false
- },
- yaxis: {
- showTicks: true,
- min: 0
- }
- },
- series:[{color:'#5FAB78',
- lineWidth: 1,
- markerOptions: {
- size: 0
- }
- },
- {color:'#E89120',
- lineWidth: 1,
- markerOptions: {
- size: 0
- }
- }]
- });
-}
-
- $(function() {
- <% @data_group.each do |key, map| %>
- <% map.each do |graph_key, list_value| %>
- <% graph_id = key + "_" + graph_key.tr('/','_') %>
- <% if key != "df" %>
- $('#' + '<%= graph_id %>').html("");
- <% limit_key = "/#{key}/#{graph_key}" %>
- <% if @limits_list.has_key?(limit_key) %>
- plotLineGraph('<%= graph_id %>', '<%= graph_key.tr('/','_').tr('_',' ').capitalize %>', [<%= list_value.inspect %>, <%= @limits_list[limit_key].inspect %>]);
- <% else %>
- plotLineGraph('<%= graph_id %>', '<%= graph_key.tr('/','_').tr('_',' ').capitalize %>', [<%= list_value.inspect %>]);
- <% end %>
- <% else %>
- <% if graph_key.end_with? ("free") %>
- $('#' + '<%= graph_id %>').html("");
- <% used_key = graph_key[0..graph_key.length-5] + "used" %>
- plotPieGraph ('<%= graph_id %>', '<%= graph_key[2..graph_key.length-5].tr('_','/') %>', [["<%= _("free") %>", <%= list_value.last[1] %>], ["<%= _("used") %>", <%= map[used_key].last[1] %>]]);
- <% end %>
- <% end %>
- <% end %>
- <% end %>
-
- });
-</script>
-
diff --git a/plugins/status/package/www/config/rails_parent.rb b/plugins/status/package/www/config/rails_parent.rb
deleted file mode 100644
index 59e7892..0000000
--- a/plugins/status/package/www/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/status/package/www/init.rb b/plugins/status/package/www/init.rb
deleted file mode 100644
index 3c19a74..0000000
--- a/plugins/status/package/www/init.rb
+++ /dev/null
@@ -1 +0,0 @@
-# Include hook code here
diff --git a/plugins/status/package/www/install.rb b/plugins/status/package/www/install.rb
deleted file mode 100644
index f7732d3..0000000
--- a/plugins/status/package/www/install.rb
+++ /dev/null
@@ -1 +0,0 @@
-# Install hook code here
diff --git a/plugins/status/package/www/shortcuts.yml b/plugins/status/package/www/shortcuts.yml
deleted file mode 100644
index a381312..0000000
--- a/plugins/status/package/www/shortcuts.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-main:
- icon: '/images/monitoring.png'
- url: /status
- groups: [ Access ]
- tags: [ access]
- title: Status
- description: Show system status
- resources: [ status ]
-
diff --git a/plugins/status/package/www/tasks/status_tasks.rake b/plugins/status/package/www/tasks/status_tasks.rake
deleted file mode 100644
index 1568c54..0000000
--- a/plugins/status/package/www/tasks/status_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/status/package/www/uninstall.rb b/plugins/status/package/www/uninstall.rb
deleted file mode 100644
index 9738333..0000000
--- a/plugins/status/package/www/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