rtdi 1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. data/README.md +9 -0
  2. data/bin/dashing +9 -0
  3. data/javascripts/batman.jquery.js +163 -0
  4. data/javascripts/batman.js +13680 -0
  5. data/javascripts/dashing.coffee +125 -0
  6. data/javascripts/es5-shim.js +1021 -0
  7. data/javascripts/jquery.js +4 -0
  8. data/lib/dashing.rb +6 -0
  9. data/lib/dashing/app.rb +178 -0
  10. data/lib/dashing/cli.rb +109 -0
  11. data/lib/dashing/downloader.rb +18 -0
  12. data/lib/rtdi.rb +6 -0
  13. data/lib/rtdi/socket.rb +39 -0
  14. data/lib/rtdi/start.rb +170 -0
  15. data/lib/rtdi/status.rb +476 -0
  16. data/templates/dashboard/%name%.erb.tt +7 -0
  17. data/templates/job/%name%.rb +4 -0
  18. data/templates/project/.gitignore +2 -0
  19. data/templates/project/Gemfile +7 -0
  20. data/templates/project/README.md +1 -0
  21. data/templates/project/assets/favicon.ico +0 -0
  22. data/templates/project/assets/fonts/fontawesome-webfont.eot +0 -0
  23. data/templates/project/assets/fonts/fontawesome-webfont.svg +255 -0
  24. data/templates/project/assets/fonts/fontawesome-webfont.ttf +0 -0
  25. data/templates/project/assets/fonts/fontawesome-webfont.woff +0 -0
  26. data/templates/project/assets/images/favicon.ico +0 -0
  27. data/templates/project/assets/images/itslogo.png +0 -0
  28. data/templates/project/assets/images/itslogoflur.png +0 -0
  29. data/templates/project/assets/images/itslogozi207.png +0 -0
  30. data/templates/project/assets/images/logo.png +0 -0
  31. data/templates/project/assets/javascripts/application.coffee +42 -0
  32. data/templates/project/assets/javascripts/cycleDashboard.coffee +523 -0
  33. data/templates/project/assets/javascripts/d3-3.2.8.js +5 -0
  34. data/templates/project/assets/javascripts/d3.v2.min.js +4 -0
  35. data/templates/project/assets/javascripts/dashing.gridster.coffee +37 -0
  36. data/templates/project/assets/javascripts/gridster/jquery.gridster.js +3263 -0
  37. data/templates/project/assets/javascripts/gridster/jquery.leanModal.min.js +5 -0
  38. data/templates/project/assets/javascripts/jquery.knob.js +646 -0
  39. data/templates/project/assets/javascripts/rickshaw-1.4.3.min.js +2 -0
  40. data/templates/project/assets/javascripts/rickshaw.min.js +3 -0
  41. data/templates/project/assets/javascripts/rickshaw.min.js.1 +3 -0
  42. data/templates/project/assets/javascripts/rickshaw.min.js.bak +2 -0
  43. data/templates/project/assets/stylesheets/application.scss +342 -0
  44. data/templates/project/assets/stylesheets/font-awesome.css +313 -0
  45. data/templates/project/assets/stylesheets/jquery.gridster.css +57 -0
  46. data/templates/project/config.ru +19 -0
  47. data/templates/project/dashboards/layout.erb +32 -0
  48. data/templates/project/dashboards/rtdi_sample.erb +31 -0
  49. data/templates/project/dashboards/sample.erb +25 -0
  50. data/templates/project/dashboards/sampletv.erb +56 -0
  51. data/templates/project/jobs/buzzwords.rb +9 -0
  52. data/templates/project/jobs/convergence.rb +14 -0
  53. data/templates/project/jobs/rtdi_sample.rb +16 -0
  54. data/templates/project/jobs/sample.rb +13 -0
  55. data/templates/project/lib/bsp.csv +16 -0
  56. data/templates/project/public/404.html +26 -0
  57. data/templates/project/public/favicon.ico +0 -0
  58. data/templates/project/widgets/clock/clock.coffee +18 -0
  59. data/templates/project/widgets/clock/clock.html +2 -0
  60. data/templates/project/widgets/clock/clock.scss +13 -0
  61. data/templates/project/widgets/comments/comments.coffee +24 -0
  62. data/templates/project/widgets/comments/comments.html +7 -0
  63. data/templates/project/widgets/comments/comments.scss +33 -0
  64. data/templates/project/widgets/graph/graph.coffee +36 -0
  65. data/templates/project/widgets/graph/graph.html +5 -0
  66. data/templates/project/widgets/graph/graph.scss +65 -0
  67. data/templates/project/widgets/iframe/iframe.coffee +9 -0
  68. data/templates/project/widgets/iframe/iframe.html +1 -0
  69. data/templates/project/widgets/iframe/iframe.scss +8 -0
  70. data/templates/project/widgets/image/image.coffee +9 -0
  71. data/templates/project/widgets/image/image.html +1 -0
  72. data/templates/project/widgets/image/image.scss +13 -0
  73. data/templates/project/widgets/list/list.coffee +34 -0
  74. data/templates/project/widgets/list/list.html +18 -0
  75. data/templates/project/widgets/list/list.scss +60 -0
  76. data/templates/project/widgets/meter/meter.coffee +14 -0
  77. data/templates/project/widgets/meter/meter.html +7 -0
  78. data/templates/project/widgets/meter/meter.scss +35 -0
  79. data/templates/project/widgets/number/number.coffee +24 -0
  80. data/templates/project/widgets/number/number.html +11 -0
  81. data/templates/project/widgets/number/number.scss +39 -0
  82. data/templates/project/widgets/text/text.coffee +1 -0
  83. data/templates/project/widgets/text/text.html +7 -0
  84. data/templates/project/widgets/text/text.scss +32 -0
  85. data/templates/widget/%name%/%name%.coffee.tt +9 -0
  86. data/templates/widget/%name%/%name%.html +1 -0
  87. data/templates/widget/%name%/%name%.scss.tt +3 -0
  88. metadata +392 -0
@@ -0,0 +1,57 @@
1
+ /*! gridster.js - v0.1.0 - 2012-08-14
2
+ * http://gridster.net/
3
+ * Copyright (c) 2012 ducksboard; Licensed MIT */
4
+
5
+ .gridster {
6
+ position:relative;
7
+ }
8
+
9
+ .gridster > * {
10
+ margin: 0 auto;
11
+ -webkit-transition: height .4s;
12
+ -moz-transition: height .4s;
13
+ -o-transition: height .4s;
14
+ -ms-transition: height .4s;
15
+ transition: height .4s;
16
+ }
17
+
18
+ .gridster .gs_w{
19
+ z-index: 2;
20
+ position: absolute;
21
+ }
22
+
23
+ .ready .gs_w:not(.preview-holder) {
24
+ -webkit-transition: opacity .3s, left .3s, top .3s;
25
+ -moz-transition: opacity .3s, left .3s, top .3s;
26
+ -o-transition: opacity .3s, left .3s, top .3s;
27
+ transition: opacity .3s, left .3s, top .3s;
28
+ }
29
+
30
+ .gridster .preview-holder {
31
+ z-index: 1;
32
+ position: absolute;
33
+ background-color: #fff;
34
+ border-color: #fff;
35
+ opacity: 0.3;
36
+ }
37
+
38
+ .gridster .player-revert {
39
+ z-index: 10!important;
40
+ -webkit-transition: left .3s, top .3s!important;
41
+ -moz-transition: left .3s, top .3s!important;
42
+ -o-transition: left .3s, top .3s!important;
43
+ transition: left .3s, top .3s!important;
44
+ }
45
+
46
+ .gridster .dragging {
47
+ z-index: 10!important;
48
+ -webkit-transition: all 0s !important;
49
+ -moz-transition: all 0s !important;
50
+ -o-transition: all 0s !important;
51
+ transition: all 0s !important;
52
+ }
53
+
54
+ /* Uncomment this if you set helper : "clone" in draggable options */
55
+ /*.gridster .player {
56
+ opacity:0;
57
+ }*/
@@ -0,0 +1,19 @@
1
+ require 'rtdi'
2
+ require 'dashing'
3
+
4
+ configure do
5
+ set :auth_token, 'YOUR_AUTH_TOKEN'
6
+ set :default_dashboard, 'rtdi_sample'
7
+ helpers do
8
+ def protected!
9
+ # Put any authentication code you want in here.
10
+ # This method is run before accessing any resource.
11
+ end
12
+ end
13
+ end
14
+
15
+ map Sinatra::Application.assets_prefix do
16
+ run Sinatra::Application.sprockets
17
+ end
18
+
19
+ run Sinatra::Application
@@ -0,0 +1,32 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8"/>
5
+ <meta name="description" content="">
6
+ <meta name="viewport" content="width=device-width">
7
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
8
+
9
+ <title><%= yield_content(:title) %></title>
10
+
11
+ <!-- The javascript and css are managed by sprockets. The files can be found in the /assets folder-->
12
+ <script type="text/javascript" src="/assets/application.js"></script>
13
+ <link rel="stylesheet" href="/assets/application.css">
14
+
15
+ <link href='//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700' rel='stylesheet' type='text/css'>
16
+ <link rel="icon" href="/assets/favicon.ico">
17
+
18
+ </head>
19
+ <body>
20
+ <div id="container">
21
+ <%= yield %>
22
+ </div>
23
+
24
+ <% if development? %>
25
+ <div id="saving-instructions">
26
+ <p>Paste the following at the top of <i><%= params[:dashboard] %>.erb</i></p>
27
+ <textarea id="gridster-code"></textarea>
28
+ </div>
29
+ <a href="#saving-instructions" id="save-gridster">Save this layout</a>
30
+ <% end %>
31
+ </body>
32
+ </html>
@@ -0,0 +1,31 @@
1
+ <script type='text/javascript'>
2
+ Dashing.widget_base_dimensions = [470,432];
3
+ </script>
4
+
5
+ <% content_for :title do %>System status<% end %>
6
+ <div class="gridster">
7
+ <ul>
8
+ <li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
9
+ <div data-id="dc1" data-view="List" data-unordered="true" data-title="Data Center 1"></div>
10
+ </li>
11
+
12
+ <li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
13
+ <div data-id="dc2" data-view="List" data-unordered="true" data-title="Data Center 2"></div>
14
+ </li>
15
+
16
+ <li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
17
+ <div data-id="dc3" data-view="List" data-unordered="true" data-title="Data Center 3"></div>
18
+ </li>
19
+
20
+ <li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
21
+ <div data-id="network" data-view="List" data-unordered="true" data-title="Network"></div>
22
+ </li>
23
+
24
+ <li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
25
+ <div data-id="miscellaneous" data-view="List" data-unordered="true" data-title="Miscellaneous"></div>
26
+ </li>
27
+ <li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
28
+ <div data-id="communication" data-view="List" data-unordered="true" data-title="Communication"></div>
29
+ </li>
30
+ </ul>
31
+ </div>
@@ -0,0 +1,25 @@
1
+ <% content_for :title do %>My super sweet dashboard<% end %>
2
+ <div class="gridster">
3
+ <ul>
4
+ <li data-row="1" data-col="1" data-sizex="2" data-sizey="1">
5
+ <div data-id="welcome" data-view="Text" data-title="Hello" data-text="This is your shiny new dashboard." data-moreinfo="Protip: You can drag the widgets around!"></div>
6
+ </li>
7
+
8
+ <li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
9
+ <div data-id="synergy" data-view="Meter" data-title="Synergy" data-min="0" data-max="100"></div>
10
+ </li>
11
+
12
+ <li data-row="1" data-col="1" data-sizex="1" data-sizey="2">
13
+ <div data-id="buzzwords" data-view="List" data-unordered="true" data-title="Buzzwords" data-moreinfo="# of times said around the office"></div>
14
+ </li>
15
+
16
+ <li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
17
+ <div data-id="valuation" data-view="Number" data-title="Current Valuation" data-moreinfo="In billions" data-prefix="$"></div>
18
+ </li>
19
+
20
+ <li data-row="1" data-col="1" data-sizex="2" data-sizey="1">
21
+ <div data-id="convergence" data-view="Graph" data-title="Convergence" style="background-color:#ff9618"></div>
22
+ </li>
23
+ </ul>
24
+ <center><div style="font-size: 12px">Try this: curl -d '{ "auth_token": "YOUR_AUTH_TOKEN", "text": "Hey, Look what I can do!" }' \http://<%=request.host%>:<%=request.port%>/widgets/welcome</div></center>
25
+ </div>
@@ -0,0 +1,56 @@
1
+ <script type='text/javascript'>
2
+ $(function() {
3
+ // These settings override the defaults set in application.coffee. You can do this on a per dashboard basis.
4
+ Dashing.gridsterLayout('[{"col":2,"row":1},{"col":1,"row":1},{"col":3,"row":1},{"col":2,"row":2},{"col":3,"row":2},{"col":1,"row":2},{"col":5,"row":1},{"col":4,"row":2},{"col":2,"row":3}]')
5
+ Dashing.widget_base_dimensions = [370, 340]
6
+ Dashing.numColumns = 5
7
+ });
8
+ </script>
9
+
10
+
11
+ <% content_for :title do %>1080p dashboard<% end %>
12
+
13
+ <div class="gridster">
14
+ <ul>
15
+ <li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
16
+ <div data-view="Clock"></div>
17
+ <i class="icon-time icon-background"></i>
18
+ </li>
19
+
20
+ <li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
21
+ <div data-view="Image" data-image="/logo.png"></div>
22
+ </li>
23
+
24
+ <li data-row="1" data-col="1" data-sizex="2" data-sizey="1">
25
+ <div data-id="welcome" data-view="Text" data-title="Hello" data-text="This is your shiny new 1080p dashboard." data-moreinfo="Protip: You can drag the widgets around!"></div>
26
+ </li>
27
+
28
+ <li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
29
+ <div data-id="synergy" data-view="Meter" data-title="Synergy" data-min="0" data-max="100"></div>
30
+ </li>
31
+
32
+ <li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
33
+ <div data-id="synergy" data-view="Meter" data-moreinfo="In sync with my neighbour!" data-title="Synergy" data-min="0" data-max="100"></div>
34
+ </li>
35
+
36
+ <li data-row="1" data-col="1" data-sizex="1" data-sizey="2">
37
+ <div data-id="buzzwords" data-view="List" data-unordered="true" data-title="Buzzwords" data-moreinfo="# of times said around the office"></div>
38
+ </li>
39
+
40
+ <li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
41
+ <div data-id="karma" data-view="Number" data-title="Karma" style="background-color:#96bf48;"></div>
42
+ <i class="icon-heart icon-background"></i>
43
+ </li>
44
+
45
+ <li data-row="1" data-col="1" data-sizex="2" data-sizey="2">
46
+ <div data-id="convergence" data-view="Graph" data-title="Convergence" style="background-color:#47bbb3;"></div>
47
+ </li>
48
+
49
+ <li data-row="1" data-col="1" data-sizex="2" data-sizey="1">
50
+ <div data-id="twitter_mentions" data-view="Comments" style="background-color:#ff9618;" data-moreinfo="Tweets tagged with #todayilearned"></div>
51
+ <i class="icon-twitter icon-background"></i>
52
+ </li>
53
+
54
+ </ul>
55
+ <center><div style="font-size: 12px">Try this: curl -d '{ "auth_token": "YOUR_AUTH_TOKEN", "text": "Hey, Look what I can do!" }' \http://<%=request.host%>:<%=request.port%>/widgets/welcome</div></center>
56
+ </div>
@@ -0,0 +1,9 @@
1
+ buzzwords = ['Paradigm shift', 'Leverage', 'Pivoting', 'Turn-key', 'Streamlininess', 'Exit strategy', 'Synergy', 'Enterprise', 'Web 2.0']
2
+ buzzword_counts = Hash.new({ value: 0 })
3
+
4
+ SCHEDULER.every '2s' do
5
+ random_buzzword = buzzwords.sample
6
+ buzzword_counts[random_buzzword] = { label: random_buzzword, value: (buzzword_counts[random_buzzword][:value] + 1) % 30 }
7
+
8
+ send_event('buzzwords', { items: buzzword_counts.values })
9
+ end
@@ -0,0 +1,14 @@
1
+ # Populate the graph with some random points
2
+ points = []
3
+ (1..10).each do |i|
4
+ points << { x: i, y: rand(50) }
5
+ end
6
+ last_x = points.last[:x]
7
+
8
+ SCHEDULER.every '2s' do
9
+ points.shift
10
+ last_x += 1
11
+ points << { x: last_x, y: rand(50) }
12
+
13
+ send_event('convergence', points: points)
14
+ end
@@ -0,0 +1,16 @@
1
+ SCHEDULER.every '15s', allow_overlapping: false do |job|
2
+ # This command ist just for generating sample-data. dont use this!
3
+ values, status = RTDI::Getdata.sample()
4
+
5
+ #!!use the commented command below!!
6
+ #values, status = RTDI::Getdata.start(/path/to/rtdi/lib/name_of.csv)
7
+
8
+
9
+ send_event('dc1', {items:values[0], status:status[0]})
10
+ send_event('dc2', {items:values[1], status:status[1]})
11
+ send_event('dc3', {items:values[2], status:status[2]})
12
+ send_event('network', {items:values[3], status:status[3]})
13
+ send_event('miscellaneous', {items:values[5], status:status[5]})
14
+ send_event('communication', {items: values[4], status:status[4]})
15
+ # and so on ..
16
+ end
@@ -0,0 +1,13 @@
1
+ current_valuation = 0
2
+ current_karma = 0
3
+
4
+ SCHEDULER.every '2s' do
5
+ last_valuation = current_valuation
6
+ last_karma = current_karma
7
+ current_valuation = rand(100)
8
+ current_karma = rand(200000)
9
+
10
+ send_event('valuation', { current: current_valuation, last: last_valuation })
11
+ send_event('karma', { current: current_karma, last: last_karma })
12
+ send_event('synergy', { value: rand(100) })
13
+ end
@@ -0,0 +1,16 @@
1
+ 0,XenApp,XenApp,service,true,false
2
+ 0,XenDesktop,ctxmgt01,servicehost,false,false
3
+ 0,Anmeldedauer,login_time,service,false,true
4
+ 1,Mail,mail,servicehost,false,false
5
+ 1,EGVP,egvp,service,false,false
6
+ 1,TK-Anlage,TK-Anlage,service,true,false
7
+ 1,LK Website,www.landkreis-lueneburg.de_Startseite,service,false,true
8
+ 2,Scan,lklgricoh02,servicehost,false,false
9
+ 2,USV,USV,host,true,false
10
+ 2,Stromverb.,pdu_activepower,true,true
11
+ 2,PUE,energymeter_power,false,true
12
+ 3,WAN,WAN,host,true,false
13
+ 3,Netzwerk LK,Etagenverteiler,host,true,false
14
+ 3,Internet,gw_luenecom_inet,host,false,false
15
+ 3,VMWare,VMWare,service,true,false
16
+ 3,XenServer,XenServer,service,true,false
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>This Dashboard doesn't exist.</title>
5
+ <style>
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>Drats! That Dashboard doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,18 @@
1
+ class Dashing.Clock extends Dashing.Widget
2
+
3
+ ready: ->
4
+ setInterval(@startTime, 500)
5
+
6
+ startTime: =>
7
+ today = new Date()
8
+
9
+ h = today.getHours()
10
+ m = today.getMinutes()
11
+ s = today.getSeconds()
12
+ m = @formatTime(m)
13
+ s = @formatTime(s)
14
+ @set('time', h + ":" + m + ":" + s)
15
+ @set('date', today.toDateString())
16
+
17
+ formatTime: (i) ->
18
+ if i < 10 then "0" + i else i
@@ -0,0 +1,2 @@
1
+ <h1 data-bind="date"></h1>
2
+ <h2 data-bind="time"></h2>
@@ -0,0 +1,13 @@
1
+ // ----------------------------------------------------------------------------
2
+ // Sass declarations
3
+ // ----------------------------------------------------------------------------
4
+ $background-color: #dc5945;
5
+
6
+ // ----------------------------------------------------------------------------
7
+ // Widget-clock styles
8
+ // ----------------------------------------------------------------------------
9
+ .widget-clock {
10
+
11
+ background-color: $background-color;
12
+
13
+ }
@@ -0,0 +1,24 @@
1
+ class Dashing.Comments extends Dashing.Widget
2
+
3
+ @accessor 'quote', ->
4
+ "“#{@get('current_comment')?.body}”"
5
+
6
+ ready: ->
7
+ @currentIndex = 0
8
+ @commentElem = $(@node).find('.comment-container')
9
+ @nextComment()
10
+ @startCarousel()
11
+
12
+ onData: (data) ->
13
+ @currentIndex = 0
14
+
15
+ startCarousel: ->
16
+ setInterval(@nextComment, 8000)
17
+
18
+ nextComment: =>
19
+ comments = @get('comments')
20
+ if comments
21
+ @commentElem.fadeOut =>
22
+ @currentIndex = (@currentIndex + 1) % comments.length
23
+ @set 'current_comment', comments[@currentIndex]
24
+ @commentElem.fadeIn()
@@ -0,0 +1,7 @@
1
+ <h1 class="title" data-bind="title"></h1>
2
+ <div class="comment-container">
3
+ <h3><img data-bind-src='current_comment.avatar'/><span data-bind='current_comment.name' class="name"></span></h3>
4
+ <p class="comment" data-bind='quote'></p>
5
+ </div>
6
+
7
+ <p class="more-info" data-bind="moreinfo"></p>
@@ -0,0 +1,33 @@
1
+ // ----------------------------------------------------------------------------
2
+ // Sass declarations
3
+ // ----------------------------------------------------------------------------
4
+ $background-color: #eb9c3c;
5
+
6
+ $title-color: rgba(255, 255, 255, 0.7);
7
+ $moreinfo-color: rgba(255, 255, 255, 0.7);
8
+
9
+ // ----------------------------------------------------------------------------
10
+ // Widget-comment styles
11
+ // ----------------------------------------------------------------------------
12
+ .widget-comments {
13
+
14
+ background-color: $background-color;
15
+
16
+ .title {
17
+ color: $title-color;
18
+ margin-bottom: 15px;
19
+ }
20
+
21
+ .name {
22
+ padding-left: 5px;
23
+ }
24
+
25
+ .comment-container {
26
+ display: none;
27
+ }
28
+
29
+ .more-info {
30
+ color: $moreinfo-color;
31
+ }
32
+
33
+ }