sensu-dashboard 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -33,7 +33,9 @@ function fetchEvents() {
33
33
 
34
34
  for (var a in node) {
35
35
  var is_unknown = node[a]['status'] >= 3 || node[a]['status'] < 0;
36
+
36
37
  var dataObject = {
38
+ identifier: SHA1(nodekey+a),
37
39
  client: nodekey,
38
40
  check: a,
39
41
  status: node[a]['status'],
@@ -58,11 +60,11 @@ function fetchEvents() {
58
60
 
59
61
  $('#eventTemplate').tmpl(m_event).prependTo('table#events > tbody');
60
62
 
61
- $('tr#' + ccheck).click(function() {
63
+ $('tr#' + SHA1(ccheck)).click(function() {
62
64
  $('div#event_details_modal > div#event_data').empty();
63
65
  $('div#event_details_modal > div#client_data').empty();
64
66
  var selectedStatus = $(this).children('td#status').html();
65
- var selectedNodeKey = $(this).attr('id');
67
+ var selectedNodeKey = $(this).children('td#client').html() + $(this).children('td#check').html();
66
68
  var selectedEvent = m_events[selectedStatus][selectedNodeKey];
67
69
  $('#eventDetailsRowTemplate').tmpl(selectedEvent).appendTo('div#event_details_modal > div#event_data');
68
70
 
@@ -0,0 +1,174 @@
1
+ /**
2
+ *
3
+ * Secure Hash Algorithm (SHA1)
4
+ * http://www.webtoolkit.info/
5
+ *
6
+ **/
7
+
8
+ function SHA1 (msg) {
9
+
10
+ function rotate_left(n,s) {
11
+ var t4 = ( n<<s ) | (n>>>(32-s));
12
+ return t4;
13
+ };
14
+
15
+ function lsb_hex(val) {
16
+ var str="";
17
+ var i;
18
+ var vh;
19
+ var vl;
20
+
21
+ for( i=0; i<=6; i+=2 ) {
22
+ vh = (val>>>(i*4+4))&0x0f;
23
+ vl = (val>>>(i*4))&0x0f;
24
+ str += vh.toString(16) + vl.toString(16);
25
+ }
26
+ return str;
27
+ };
28
+
29
+ function cvt_hex(val) {
30
+ var str="";
31
+ var i;
32
+ var v;
33
+
34
+ for( i=7; i>=0; i-- ) {
35
+ v = (val>>>(i*4))&0x0f;
36
+ str += v.toString(16);
37
+ }
38
+ return str;
39
+ };
40
+
41
+
42
+ function Utf8Encode(string) {
43
+ string = string.replace(/\r\n/g,"\n");
44
+ var utftext = "";
45
+
46
+ for (var n = 0; n < string.length; n++) {
47
+
48
+ var c = string.charCodeAt(n);
49
+
50
+ if (c < 128) {
51
+ utftext += String.fromCharCode(c);
52
+ }
53
+ else if((c > 127) && (c < 2048)) {
54
+ utftext += String.fromCharCode((c >> 6) | 192);
55
+ utftext += String.fromCharCode((c & 63) | 128);
56
+ }
57
+ else {
58
+ utftext += String.fromCharCode((c >> 12) | 224);
59
+ utftext += String.fromCharCode(((c >> 6) & 63) | 128);
60
+ utftext += String.fromCharCode((c & 63) | 128);
61
+ }
62
+
63
+ }
64
+
65
+ return utftext;
66
+ };
67
+
68
+ var blockstart;
69
+ var i, j;
70
+ var W = new Array(80);
71
+ var H0 = 0x67452301;
72
+ var H1 = 0xEFCDAB89;
73
+ var H2 = 0x98BADCFE;
74
+ var H3 = 0x10325476;
75
+ var H4 = 0xC3D2E1F0;
76
+ var A, B, C, D, E;
77
+ var temp;
78
+
79
+ msg = Utf8Encode(msg);
80
+
81
+ var msg_len = msg.length;
82
+
83
+ var word_array = new Array();
84
+ for( i=0; i<msg_len-3; i+=4 ) {
85
+ j = msg.charCodeAt(i)<<24 | msg.charCodeAt(i+1)<<16 |
86
+ msg.charCodeAt(i+2)<<8 | msg.charCodeAt(i+3);
87
+ word_array.push( j );
88
+ }
89
+
90
+ switch( msg_len % 4 ) {
91
+ case 0:
92
+ i = 0x080000000;
93
+ break;
94
+ case 1:
95
+ i = msg.charCodeAt(msg_len-1)<<24 | 0x0800000;
96
+ break;
97
+
98
+ case 2:
99
+ i = msg.charCodeAt(msg_len-2)<<24 | msg.charCodeAt(msg_len-1)<<16 | 0x08000;
100
+ break;
101
+
102
+ case 3:
103
+ i = msg.charCodeAt(msg_len-3)<<24 | msg.charCodeAt(msg_len-2)<<16 | msg.charCodeAt(msg_len-1)<<8| 0x80;
104
+ break;
105
+ }
106
+
107
+ word_array.push( i );
108
+
109
+ while( (word_array.length % 16) != 14 ) word_array.push( 0 );
110
+
111
+ word_array.push( msg_len>>>29 );
112
+ word_array.push( (msg_len<<3)&0x0ffffffff );
113
+
114
+
115
+ for ( blockstart=0; blockstart<word_array.length; blockstart+=16 ) {
116
+
117
+ for( i=0; i<16; i++ ) W[i] = word_array[blockstart+i];
118
+ for( i=16; i<=79; i++ ) W[i] = rotate_left(W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16], 1);
119
+
120
+ A = H0;
121
+ B = H1;
122
+ C = H2;
123
+ D = H3;
124
+ E = H4;
125
+
126
+ for( i= 0; i<=19; i++ ) {
127
+ temp = (rotate_left(A,5) + ((B&C) | (~B&D)) + E + W[i] + 0x5A827999) & 0x0ffffffff;
128
+ E = D;
129
+ D = C;
130
+ C = rotate_left(B,30);
131
+ B = A;
132
+ A = temp;
133
+ }
134
+
135
+ for( i=20; i<=39; i++ ) {
136
+ temp = (rotate_left(A,5) + (B ^ C ^ D) + E + W[i] + 0x6ED9EBA1) & 0x0ffffffff;
137
+ E = D;
138
+ D = C;
139
+ C = rotate_left(B,30);
140
+ B = A;
141
+ A = temp;
142
+ }
143
+
144
+ for( i=40; i<=59; i++ ) {
145
+ temp = (rotate_left(A,5) + ((B&C) | (B&D) | (C&D)) + E + W[i] + 0x8F1BBCDC) & 0x0ffffffff;
146
+ E = D;
147
+ D = C;
148
+ C = rotate_left(B,30);
149
+ B = A;
150
+ A = temp;
151
+ }
152
+
153
+ for( i=60; i<=79; i++ ) {
154
+ temp = (rotate_left(A,5) + (B ^ C ^ D) + E + W[i] + 0xCA62C1D6) & 0x0ffffffff;
155
+ E = D;
156
+ D = C;
157
+ C = rotate_left(B,30);
158
+ B = A;
159
+ A = temp;
160
+ }
161
+
162
+ H0 = (H0 + A) & 0x0ffffffff;
163
+ H1 = (H1 + B) & 0x0ffffffff;
164
+ H2 = (H2 + C) & 0x0ffffffff;
165
+ H3 = (H3 + D) & 0x0ffffffff;
166
+ H4 = (H4 + E) & 0x0ffffffff;
167
+
168
+ }
169
+
170
+ var temp = cvt_hex(H0) + cvt_hex(H1) + cvt_hex(H2) + cvt_hex(H3) + cvt_hex(H4);
171
+
172
+ return temp.toLowerCase();
173
+
174
+ }
@@ -1,5 +1,5 @@
1
1
  module Sensu
2
2
  module Dashboard
3
- VERSION = "0.6.0"
3
+ VERSION = "0.6.1"
4
4
  end
5
5
  end
@@ -1,9 +1,9 @@
1
1
  <!-- Event template -->
2
2
  <script id="eventTemplate" type="text/x-jquery-tmpl">
3
3
  {{if is_unknown}}
4
- <tr class="status3" id="${client}${check}" rel="leanModal" href="#event_details_modal">
4
+ <tr class="status3" id="${identifier}" rel="leanModal" href="#event_details_modal">
5
5
  {{else}}
6
- <tr class="status${status}" id="${client}${check}" rel="leanModal" href="#event_details_modal">
6
+ <tr class="status${status}" id="${identifier}" rel="leanModal" href="#event_details_modal">
7
7
  {{/if}}
8
8
  <td id="client">${client}</td><td id="check">${check}</td><td id="status">${status}</td><td id="output">${output}</td>
9
9
  </tr>
@@ -95,6 +95,9 @@
95
95
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
96
96
  <script>window.jQuery || document.write("<script src='js/jquery-1.5.1.min.js'>\x3C/script>")</script>
97
97
 
98
+ <!-- Javascript SHA1 -->
99
+ <script src="js/webtoolkit.sha1.js"></script>
100
+
98
101
  <!-- jQuery templates -->
99
102
  <script src="js/jquery.tmpl.min.js"></script>
100
103
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-dashboard
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 0
10
- version: 0.6.0
9
+ - 1
10
+ version: 0.6.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Justin Kolberg
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-11-15 00:00:00 -08:00
19
+ date: 2011-11-16 00:00:00 -08:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -115,6 +115,7 @@ files:
115
115
  - lib/sensu-dashboard/public/js/modernizr-1.7.min.js
116
116
  - lib/sensu-dashboard/public/js/swfobject.js
117
117
  - lib/sensu-dashboard/public/js/web_socket.js
118
+ - lib/sensu-dashboard/public/js/webtoolkit.sha1.js
118
119
  - lib/sensu-dashboard/public/swf/WebSocketMain.swf
119
120
  - lib/sensu-dashboard/public/swf/ZeroClipboard.swf
120
121
  - lib/sensu-dashboard/version.rb