suricate 0.0.3 → 0.0.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ac902ad9c42da7826dd54eac991f2ad0e335fbcd
4
- data.tar.gz: b56b7f691abc48903c1f046cf6716cb959583501
3
+ metadata.gz: 5b8794a9a174151433cd55ca1141d728c2c5b6c2
4
+ data.tar.gz: da4ee9ddd4b8e28ec9faa0727c6f6607807f6016
5
5
  SHA512:
6
- metadata.gz: aef33555cd23cdf3c0bddce0e166e29c746725338582cd37e123ac21dfc2f76e1aa5fb71860ed816522333e8a4f2889aa3a739b496ce3c983bc78ed583a8ceba
7
- data.tar.gz: 3ff8a9850671e7cb19093c69e9a7036ccdcc44ebaa7ace586f993a99c47af0d71198f03bc331eb98a1725dee27fd1bf0d11b9e326aba4ef839c8e2943af67a84
6
+ metadata.gz: 995489c410f4900e5afdcb13eb62768038375f7983c1303d8db4364137d5522e48172f152a27d3a23cb0bc8a09143694a245b7314d5f4686720c4017f0cb0dc7
7
+ data.tar.gz: 03e86a61c6d84cbe30b530f18b7f758abd4a8f6190a53ae3349eb917c952db00accd2930d2a102683491d0c175954f7c75f89b0830b5fb3c40160bebfd79d2b4
@@ -21,6 +21,7 @@ module Suricate
21
21
  autoload :Widget, 'suricate/widgets/widget'
22
22
  autoload :CounterWidget, 'suricate/widgets/counter_widget'
23
23
  autoload :LineChartWidget, 'suricate/widgets/line_chart_widget'
24
+ autoload :StatusWidget, 'suricate/widgets/status_widget'
24
25
 
25
26
  # Responses
26
27
  autoload :WidgetResponse, 'suricate/widgets/responses/widget_response'
@@ -17,6 +17,10 @@ module Suricate
17
17
  register(id, LineChartWidget, collector, options)
18
18
  end
19
19
 
20
+ def status(id, collector, options = {})
21
+ register(id, StatusWidget, collector, options)
22
+ end
23
+
20
24
  def register(id, klass, collector, options = {})
21
25
  id = id.to_sym
22
26
  if find_with_id(id)
@@ -10,7 +10,7 @@
10
10
 
11
11
  Suricate.WidgetView = function(content) {
12
12
  this.content = $(content);
13
- this.currentStatus = statuses.ok;
13
+ this.currentStatus = undefined;
14
14
  };
15
15
 
16
16
  /*
@@ -68,7 +68,8 @@
68
68
  if(this.currentStatus !== status) {
69
69
  var statuses = ["ok", "danger", "warning"];
70
70
  var statusIndex = statuses.indexOf(status);
71
- var classesToRemove = statuses.splice(statusIndex, 1);
71
+ statuses.splice(statusIndex, 1);
72
+ var classesToRemove = statuses.join(" ");
72
73
  this.content.removeClass(classesToRemove);
73
74
  this.content.addClass(status);
74
75
  this.currentStatus = status;
@@ -0,0 +1,14 @@
1
+ (function() {
2
+ "use strict";
3
+ window.Suricate = window.Suricate || {};
4
+
5
+ Suricate.StatusWidget = function(id, container, configuration, application) {
6
+ Suricate.Widget.call(this, id, container, configuration, application);
7
+ };
8
+
9
+ Suricate.StatusWidget.prototype = new Suricate.Widget();
10
+
11
+ Suricate.StatusWidget.prototype.setData = function(data) {
12
+ };
13
+ }());
14
+
@@ -19,7 +19,7 @@
19
19
  text-transform: uppercase;
20
20
  text-align: center;
21
21
  color: #5C5C5C;
22
- padding-bottom: 15px;
22
+ padding-bottom: 5px;
23
23
  }
24
24
 
25
25
  .widget .bottom-bar {
@@ -67,7 +67,7 @@
67
67
  }
68
68
 
69
69
  .line-chart-widget .name {
70
- padding-top: 20px;
70
+ padding-top: 10px;
71
71
  }
72
72
 
73
73
  .line-chart-widget .legend {
@@ -95,3 +95,37 @@
95
95
  position: relative;
96
96
  margin-right: 5px;
97
97
  }
98
+
99
+ /*
100
+ * StatusWidget
101
+ */
102
+
103
+ .status-widget .status {
104
+ margin-top: 10px;
105
+ margin-left: auto;
106
+ margin-right: auto;
107
+ width: 60px;
108
+ border-radius: 50%;
109
+ height: 60px;
110
+ margin-bottom: 10px;
111
+ }
112
+
113
+ .status-widget.danger .body {
114
+ background-color: white;
115
+ }
116
+
117
+ .status-widget.warning .body {
118
+ background-color: white;
119
+ }
120
+
121
+ .status-widget.ok .status {
122
+ background-color: #32986C;
123
+ }
124
+
125
+ .status-widget.danger .status {
126
+ background-color: #F59F97;
127
+ }
128
+
129
+ .status-widget.warning .status {
130
+ background-color: #f5ce97;
131
+ }
@@ -1,3 +1,3 @@
1
1
  module Suricate
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
@@ -0,0 +1,9 @@
1
+ module Suricate
2
+ class StatusWidget < Widget
3
+ def execute
4
+ response = WidgetResponse.new
5
+ @collector.populate(response, params)
6
+ api_success response.to_h
7
+ end
8
+ end
9
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: suricate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aurélien AMILIN
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-07 00:00:00.000000000 Z
11
+ date: 2015-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -153,6 +153,7 @@ files:
153
153
  - lib/suricate/generator/assets/javascript/widgets-container.js
154
154
  - lib/suricate/generator/assets/javascript/widgets/counter-widget.js
155
155
  - lib/suricate/generator/assets/javascript/widgets/line-chart-widget.js
156
+ - lib/suricate/generator/assets/javascript/widgets/status-widget.js
156
157
  - lib/suricate/generator/assets/javascript/widgets/widget.js
157
158
  - lib/suricate/generator/assets/stylesheets/suricate.css
158
159
  - lib/suricate/generator/assets/stylesheets/vendor/bootstrap-theme.css.map
@@ -172,6 +173,7 @@ files:
172
173
  - lib/suricate/widgets/responses/chart_widget_response.rb
173
174
  - lib/suricate/widgets/responses/counter_widget_response.rb
174
175
  - lib/suricate/widgets/responses/widget_response.rb
176
+ - lib/suricate/widgets/status_widget.rb
175
177
  - lib/suricate/widgets/widget.rb
176
178
  homepage: https://github.com/holinnn/suricate
177
179
  licenses: