ref: refs/heads/master
commit fc4670047979c97b6be0109bbf58e0c62de184fd
Author: Stefan Schubert
Date: Fri Jul 10 15:51:58 2009 +0200
showing disk usage in a pie graphic
---
plugins/status/app/views/status/index.html.erb | 45 ++++++++++++++++++++----
1 files changed, 38 insertions(+), 7 deletions(-)
diff --git a/plugins/status/app/views/status/index.html.erb b/plugins/status/app/views/status/index.html.erb
index 1f68677..3f078c3 100644
--- a/plugins/status/app/views/status/index.html.erb
+++ b/plugins/status/app/views/status/index.html.erb
@@ -7,12 +7,18 @@
<br style='clear: both'>
<% last = !last %>
<% end %>
- <h3><%= key.tr('_',' ').capitalize %></h3>
+ <% if key == "df" %>
+ <h3><%= _("Disk usage") %></h3>
+ <% else %>
+ <h3><%= key.tr('_',' ').capitalize %></h3>
+ <% end %>
<% map.each do |graph_key, list_value| %>
- <% graph_id = key + "_" + graph_key.tr('/','_') %>
- <%= graph(graph_id, 400, 300, last) %>
- <% last = !last %>
+ <% if key != "df" || !graph_key.end_with? ("used") %>
+ <% graph_id = key + "_" + graph_key.tr('/','_') %>
+ <%= graph(graph_id, 400, 300, last) %>
+ <% last = !last %>
+ <% end %>
<% end %>
<% end %>
@@ -20,9 +26,26 @@
<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
+ }
+ },
+ cursor: {
+ show: false
+ },
+ });
+}
-function plotLineGraph(graph_id, graph_title, graph_data ) {
+function plotLineGraph(graph_id, graph_title, graph_data ) {
$.jqplot(graph_id, graph_data, {
title: graph_title,
axes: {
@@ -43,8 +66,16 @@ function plotLineGraph(graph_id, graph_title, graph_data ) {
<% @data_group.each do |key, map| %>
<% map.each do |graph_key, list_value| %>
<% graph_id = key + "_" + graph_key.tr('/','_') %>
- $('#' + '<%= graph_id %>').html("");
- plotLineGraph('<%= graph_id %>', '<%= graph_key.tr('/','_').tr('_',' ').capitalize %>', [<%= list_value.inspect %>]);
+ <% if key != "df" %>
+ $('#' + '<%= graph_id %>').html("");
+ plotLineGraph('<%= graph_id %>', '<%= graph_key.tr('/','_').tr('_',' ').capitalize %>', [<%= list_value.inspect %>]);
+ <% 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 %>
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org