uwa_sysload 0.2

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.
@@ -0,0 +1,17 @@
1
+ require 'uwa'
2
+
3
+ module UWA
4
+ module Widget
5
+ class SysLoad < UWA::Handler
6
+ NAME = 'uwa_sysload'
7
+ VERSION = '0.2'
8
+ COPYRIGHT = 'Copyright (C) 2007 Florent Solt'
9
+ DESC = 'UWA System Load Monitor widget'
10
+ AUTHOR = 'Florent Solt'
11
+ EMAIL = 'florent@solt.biz'
12
+ HOMEPAGE = 'http://gnetvibes.rubyforge.org'
13
+ LICENSE = 'BSD'
14
+ end
15
+ end
16
+ end
17
+
@@ -0,0 +1,26 @@
1
+ require 'uwa_sysload/config'
2
+
3
+ module UWA
4
+ module Widget
5
+ class SysLoad
6
+
7
+ def initialize
8
+ super
9
+ @debugMode = true
10
+ @author = 'Florent Solt'
11
+ @title = 'My System Load'
12
+ @values = []
13
+ @autoRefresh = 1
14
+ end
15
+
16
+ def values
17
+ @values << File.read('/proc/loadavg').split.first
18
+ count = @query['count'].to_i
19
+ count = @values.size if count > @values.size
20
+ @values = @values[-(count)..-1]
21
+ self << JSON.unparse(@values)
22
+ end
23
+
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,24 @@
1
+ widget.bar_width = 2
2
+ widget.graph = widget.createElement('div');
3
+ widget.graph.className = 'graph';
4
+
5
+ widget.onLoad = function() {
6
+ widget.setBody(widget.graph);
7
+ count = (widget.graph.clientWidth / widget.bar_width).toFixed(0);
8
+ widget.remoteJson('values?count=' + count, widget.onValues);
9
+ }
10
+
11
+ widget.onValues = function(values) {
12
+ widget.graph.empty();
13
+ for (var i = 0; i < values.length; i++) {
14
+ var bar = widget.createElement('div');
15
+ bar.className = 'bar';
16
+ bar.style.height = values[i] * 100 + 'px';
17
+ bar.style.left = i * widget.bar_width + 'px';
18
+ bar.style.width = widget.bar_width + 'px';
19
+ bar.style.opacity = values[i];
20
+ bar.appendText = '&nbsp;';
21
+ widget.graph.appendChild(bar);
22
+ }
23
+ }
24
+
@@ -0,0 +1,13 @@
1
+ .graph {
2
+ height: 100px;
3
+ margin: 0px;
4
+ padding: 0px;
5
+ border: 0px;
6
+ position: relative;
7
+ }
8
+
9
+ .graph .bar {
10
+ background-color: red;
11
+ position: absolute;
12
+ bottom: 0px;
13
+ }
metadata ADDED
@@ -0,0 +1,57 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.2
3
+ specification_version: 1
4
+ name: uwa_sysload
5
+ version: !ruby/object:Gem::Version
6
+ version: "0.2"
7
+ date: 2007-04-02 00:00:00 +02:00
8
+ summary: UWA System Load Monitor widget
9
+ require_paths:
10
+ - lib
11
+ email: florent@solt.biz
12
+ homepage: http://gnetvibes.rubyforge.org
13
+ rubyforge_project:
14
+ description:
15
+ autorequire:
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: false
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
29
+ authors:
30
+ - Florent Solt
31
+ files:
32
+ - lib/uwa_sysload/config.rb
33
+ - lib/uwa_sysload/widget.rb
34
+ - ressources/script.js
35
+ - ressources/style.css
36
+ test_files: []
37
+
38
+ rdoc_options: []
39
+
40
+ extra_rdoc_files: []
41
+
42
+ executables: []
43
+
44
+ extensions: []
45
+
46
+ requirements: []
47
+
48
+ dependencies:
49
+ - !ruby/object:Gem::Dependency
50
+ name: uwa
51
+ version_requirement:
52
+ version_requirements: !ruby/object:Gem::Version::Requirement
53
+ requirements:
54
+ - - ">"
55
+ - !ruby/object:Gem::Version
56
+ version: 0.0.0
57
+ version: