sensu-dashboard 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -179,12 +179,32 @@ EventMachine.run do
179
179
  rescue => e
180
180
  puts e
181
181
  status 404
182
- body '{"error":"could not retrieve clients from the sensu api"}'
182
+ body '{"error":"could not retrieve client from the sensu api"}'
183
183
  end
184
184
 
185
185
  http.errback do
186
186
  status 404
187
- body '{"error":"could not retrieve clients from the sensu api"}'
187
+ body '{"error":"could not retrieve client from the sensu api"}'
188
+ end
189
+
190
+ http.callback do
191
+ status http.response_header.status
192
+ body http.response
193
+ end
194
+ end
195
+
196
+ adelete '/client/:id.json' do |id|
197
+ begin
198
+ http = EventMachine::HttpRequest.new("#{api_server}/client/#{id}").delete
199
+ rescue => e
200
+ puts e
201
+ status 404
202
+ body '{"error":"could not delete client from the sensu api"}'
203
+ end
204
+
205
+ http.errback do
206
+ status 404
207
+ body '{"error":"could not delete client from the sensu api"}'
188
208
  end
189
209
 
190
210
  http.callback do
@@ -1,5 +1,5 @@
1
1
  module Sensu
2
2
  module Dashboard
3
- VERSION = "0.9.0"
3
+ VERSION = "0.9.1"
4
4
  end
5
5
  end
@@ -11,7 +11,7 @@
11
11
  <div class="event_detail_group">
12
12
  <div class="event_detail">
13
13
  <h1>${capitaliseFirstLetter($index)}</h1>
14
- <p>${$value}</p>
14
+ <p id="${$index}">${$value}</p>
15
15
  </div>
16
16
  <!--<div class="copy">Copy</div>-->
17
17
  <div style="clear: both;"></div>
@@ -26,4 +26,26 @@ ws = new WebSocket("ws://" + location.hostname + ":9000");
26
26
  ws.onmessage = function(evt) {
27
27
  fetchClients();
28
28
  }
29
+
30
+ $("#remove_client").click(function() {
31
+ var client = $("#name").html();
32
+ var cross_img = $("#remove_client").children().first();
33
+ cross_img.attr("src", "/img/loading_circle.gif");
34
+ $.ajax({
35
+ type: 'DELETE',
36
+ contentType: 'application/json',
37
+ url: '/client/'+client+'.json',
38
+ success: function(data, textStatus, xhr) {
39
+ alert('Client '+client+' is being removed, resolving events...');
40
+ cross_img.attr("src", "/img/cross.png");
41
+ $("#lean_overlay").fadeOut(200);
42
+ $("#event_details_modal").css({'display':'none'});
43
+ fetchClients();
44
+ },
45
+ error: function(xhr, textStatus, errorThrown) {
46
+ cross_img.attr("src", "/img/cross.png");
47
+ alert('Client was not found in sensu. This may be due to a delay in a previous removal attempt.');
48
+ }
49
+ });
50
+ });
29
51
  </script>
@@ -18,6 +18,17 @@
18
18
  </table>
19
19
 
20
20
  <div id="event_details_modal" class="event_details_modal">
21
+ <h1 class="section_title">Actions</h1>
22
+ <div id="event_actions">
23
+ <div class="event_detail_group">
24
+ <div class="event_detail">
25
+ <div id="remove_client" class="action_btn" style="margin-right: 7px;">
26
+ <img src="/img/cross.png" style="vertical-align: middle; padding-right: 7px;"/><strong>Remove</strong>
27
+ </div>
28
+ </div>
29
+ <div style="clear: both;"></div>
30
+ </div>
31
+ </div>
21
32
  <h1 class="section_title">Client Data</h1>
22
33
  <div id="client_data"></div>
23
34
  </div>
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: 59
4
+ hash: 57
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 0
10
- version: 0.9.0
9
+ - 1
10
+ version: 0.9.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-12-15 00:00:00 -08:00
19
+ date: 2011-12-22 00:00:00 -08:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency