uwa_sysload 0.2 → 0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/uwa_sysload/config.rb +1 -1
- data/lib/uwa_sysload/widget.rb +6 -1
- data/resources/bg.gif +0 -0
- data/{ressources → resources}/script.js +10 -5
- data/{ressources → resources}/style.css +1 -1
- metadata +5 -4
data/lib/uwa_sysload/config.rb
CHANGED
data/lib/uwa_sysload/widget.rb
CHANGED
@@ -14,7 +14,12 @@ class SysLoad
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def values
|
17
|
-
@
|
17
|
+
if @test # set through config
|
18
|
+
@values = [ 0.5.to_f ]
|
19
|
+
1.upto(200) { @values << @values.last.to_f + (rand(200) / 1000.to_f - 0.1.to_f)}
|
20
|
+
else
|
21
|
+
@values << File.read('/proc/loadavg').split.first
|
22
|
+
end
|
18
23
|
count = @query['count'].to_i
|
19
24
|
count = @values.size if count > @values.size
|
20
25
|
@values = @values[-(count)..-1]
|
data/resources/bg.gif
ADDED
Binary file
|
@@ -1,6 +1,7 @@
|
|
1
|
-
widget.bar_width = 2
|
1
|
+
widget.bar_width = 2;
|
2
2
|
widget.graph = widget.createElement('div');
|
3
3
|
widget.graph.className = 'graph';
|
4
|
+
widget.graph.style.backgroundImage = 'url(' + widget.remoteUrl + 'resource/bg.gif)';
|
4
5
|
|
5
6
|
widget.onLoad = function() {
|
6
7
|
widget.setBody(widget.graph);
|
@@ -10,15 +11,19 @@ widget.onLoad = function() {
|
|
10
11
|
|
11
12
|
widget.onValues = function(values) {
|
12
13
|
widget.graph.empty();
|
14
|
+
var max_height = 100;
|
13
15
|
for (var i = 0; i < values.length; i++) {
|
14
16
|
var bar = widget.createElement('div');
|
15
17
|
bar.className = 'bar';
|
16
|
-
|
17
|
-
bar.
|
18
|
-
|
19
|
-
bar.
|
18
|
+
var height = values[i] * 100;
|
19
|
+
bar.setStyle('height', height.toFixed(0) + 'px');
|
20
|
+
max_height = height > max_height ? height : max_height;
|
21
|
+
bar.setStyle('left', i * widget.bar_width + 'px');
|
22
|
+
bar.setStyle('width', widget.bar_width + 'px');
|
23
|
+
bar.setStyle('opacity', values[i]);
|
20
24
|
bar.appendText = ' ';
|
21
25
|
widget.graph.appendChild(bar);
|
22
26
|
}
|
27
|
+
widget.graph.setStyle('height', max_height.toFixed(0) + 'px');
|
23
28
|
}
|
24
29
|
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: uwa_sysload
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: "0.
|
7
|
-
date: 2007-04-
|
6
|
+
version: "0.3"
|
7
|
+
date: 2007-04-03 00:00:00 +02:00
|
8
8
|
summary: UWA System Load Monitor widget
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -31,8 +31,9 @@ authors:
|
|
31
31
|
files:
|
32
32
|
- lib/uwa_sysload/config.rb
|
33
33
|
- lib/uwa_sysload/widget.rb
|
34
|
-
-
|
35
|
-
-
|
34
|
+
- resources/script.js
|
35
|
+
- resources/style.css
|
36
|
+
- resources/bg.gif
|
36
37
|
test_files: []
|
37
38
|
|
38
39
|
rdoc_options: []
|