smashing 1.2.0 → 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of smashing might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/javascripts/dashing.coffee +43 -31
- data/lib/dashing.rb +1 -0
- data/lib/dashing/app.rb +18 -14
- data/lib/dashing/cli.rb +7 -0
- data/lib/dashing/version.rb +3 -0
- data/templates/project/Gemfile +2 -2
- data/templates/project/jobs/{twitter.rb → twitter.rb.disabled} +0 -0
- metadata +34 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 721d40877762d848822b6bc0de8dfa8597074035af92afc3bea7d4aca9fc4bdc
|
4
|
+
data.tar.gz: 579de5e911ffeb05986481ed0e41b676856b43fa78e639e1d2b661082c983c9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a338ddf3e7e4fc0c6b630d9e1b710cbfdac91deb711a8a738e5bda229e79310669a035407f0fb5ebe5395e7ee2eec7de9b1dbb41a7204bd91d321644ac1dd3ea
|
7
|
+
data.tar.gz: f08c1b7bdd36c315e88acee22512c5c2066ed2c55a375726631f7053e35f7ab416b2723691a1e043afcc4a55f32d00684b46730f48814637cf0bbd553c1450a9
|
data/README.md
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
[![Build](https://github.com/Smashing/smashing/actions/workflows/main.yml/badge.svg)](https://github.com/Smashing/smashing/actions/workflows/main.yml)
|
1
2
|
[![Gitter chat](https://badges.gitter.im/smashing.svg)](https://gitter.im/Smashing)
|
2
3
|
|
3
4
|
# [Smashing](https://github.com/Smashing/smashing/wiki)
|
data/javascripts/dashing.coffee
CHANGED
@@ -53,8 +53,9 @@ class Dashing.Widget extends Batman.View
|
|
53
53
|
super
|
54
54
|
|
55
55
|
@mixin($(@node).data())
|
56
|
-
|
57
|
-
|
56
|
+
if @id # skip widgets without id
|
57
|
+
Dashing.widgets[@id] ||= []
|
58
|
+
Dashing.widgets[@id].push(@)
|
58
59
|
|
59
60
|
type = Batman.Filters.dashize(@view)
|
60
61
|
$(@node).addClass("widget widget-#{type} #{@id}")
|
@@ -96,7 +97,10 @@ Dashing.AnimatedValue =
|
|
96
97
|
else
|
97
98
|
timer = "interval_#{k}"
|
98
99
|
num = if (!isNaN(@[k]) && @[k]?) then @[k] else 0
|
99
|
-
|
100
|
+
# NOTE: We are using backticks in the num == to below as that is a comparison with string
|
101
|
+
# and float and CoffeeScript compiles it to ===, causing it to always fail - see issue #155
|
102
|
+
# https://github.com/Smashing/smashing/pull/155
|
103
|
+
unless @[timer] || `num == to`
|
100
104
|
to = parseFloat(to)
|
101
105
|
num = parseFloat(num)
|
102
106
|
up = to > num
|
@@ -117,35 +121,43 @@ Dashing.AnimatedValue =
|
|
117
121
|
Dashing.widgets = widgets = {}
|
118
122
|
Dashing.lastEvents = lastEvents = {}
|
119
123
|
Dashing.debugMode = false
|
124
|
+
Dashing.filterEvents = true
|
120
125
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
126
|
+
Dashing.on 'run', ->
|
127
|
+
@layout.on 'ready', -> # run only when all widgets are created
|
128
|
+
ids = Object.keys(Dashing.widgets)
|
129
|
+
url = if Dashing.filterEvents
|
130
|
+
'events?ids=' + encodeURIComponent(ids.join(','))
|
131
|
+
else
|
132
|
+
'events'
|
133
|
+
source = new EventSource(url)
|
134
|
+
source.addEventListener 'open', (e) ->
|
135
|
+
console.log("Connection opened", e)
|
136
|
+
|
137
|
+
source.addEventListener 'error', (e)->
|
138
|
+
console.log("Connection error", e)
|
139
|
+
if (e.currentTarget.readyState == EventSource.CLOSED)
|
140
|
+
console.log("Connection closed")
|
141
|
+
setTimeout (->
|
142
|
+
window.location.reload()
|
143
|
+
), 5*60*1000
|
144
|
+
|
145
|
+
source.addEventListener 'message', (e) ->
|
146
|
+
data = JSON.parse(e.data)
|
147
|
+
if lastEvents[data.id]?.updatedAt != data.updatedAt
|
148
|
+
if Dashing.debugMode
|
149
|
+
console.log("Received data for #{data.id}", data)
|
150
|
+
lastEvents[data.id] = data
|
151
|
+
if widgets[data.id]?.length > 0
|
152
|
+
for widget in widgets[data.id]
|
153
|
+
widget.receiveData(data)
|
154
|
+
|
155
|
+
source.addEventListener 'dashboards', (e) ->
|
156
|
+
data = JSON.parse(e.data)
|
157
|
+
if Dashing.debugMode
|
158
|
+
console.log("Received data for dashboards", data)
|
159
|
+
if data.dashboard is '*' or window.location.pathname is "/#{data.dashboard}"
|
160
|
+
Dashing.fire data.event, data
|
149
161
|
|
150
162
|
$(document).ready ->
|
151
163
|
Dashing.run()
|
data/lib/dashing.rb
CHANGED
data/lib/dashing/app.rb
CHANGED
@@ -3,7 +3,8 @@ require 'sprockets'
|
|
3
3
|
require 'sinatra/content_for'
|
4
4
|
require 'rufus/scheduler'
|
5
5
|
require 'coffee-script'
|
6
|
-
require 'sass'
|
6
|
+
require 'sass' if RUBY_VERSION < "2.5.0"
|
7
|
+
require 'sassc' if RUBY_VERSION >= "2.5.0"
|
7
8
|
require 'json'
|
8
9
|
require 'yaml'
|
9
10
|
require 'thin'
|
@@ -35,7 +36,7 @@ set :sprockets, Sprockets::Environment.new(settings.root)
|
|
35
36
|
set :assets_prefix, '/assets'
|
36
37
|
set :digest_assets, false
|
37
38
|
set :server, 'thin'
|
38
|
-
set :connections,
|
39
|
+
set :connections, {}
|
39
40
|
set :history_file, 'history.yml'
|
40
41
|
set :public_folder, File.join(settings.root, 'public')
|
41
42
|
set :views, File.join(settings.root, 'dashboards')
|
@@ -53,7 +54,7 @@ end
|
|
53
54
|
settings.sprockets.append_path("assets/#{path}")
|
54
55
|
end
|
55
56
|
|
56
|
-
['widgets', File.expand_path('../../../javascripts', __FILE__)].
|
57
|
+
['widgets', File.expand_path('../../../javascripts', __FILE__)].each do |path|
|
57
58
|
settings.sprockets.append_path(path)
|
58
59
|
end
|
59
60
|
|
@@ -76,9 +77,12 @@ end
|
|
76
77
|
get '/events', :provides => 'text/event-stream' do
|
77
78
|
protected!
|
78
79
|
response.headers['X-Accel-Buffering'] = 'no' # Disable buffering for nginx
|
80
|
+
ids = params[:ids] ? params[:ids].split(',').to_set : nil
|
79
81
|
stream :keep_open do |out|
|
80
|
-
settings.connections
|
81
|
-
|
82
|
+
settings.connections[out] = ids
|
83
|
+
settings.history.each do |id, event|
|
84
|
+
out << event if ids.nil? || ids.include?(id)
|
85
|
+
end
|
82
86
|
out.callback { settings.connections.delete(out) }
|
83
87
|
end
|
84
88
|
end
|
@@ -130,7 +134,7 @@ end
|
|
130
134
|
|
131
135
|
Thin::Server.class_eval do
|
132
136
|
def stop_with_connection_closing
|
133
|
-
Sinatra::Application.settings.connections.dup.
|
137
|
+
Sinatra::Application.settings.connections.dup.each_key(&:close)
|
134
138
|
stop_without_connection_closing
|
135
139
|
end
|
136
140
|
|
@@ -140,10 +144,16 @@ end
|
|
140
144
|
|
141
145
|
def send_event(id, body, target=nil)
|
142
146
|
body[:id] = id
|
143
|
-
body[:updatedAt] ||= (Time.now.to_f * 1000.0).to_i
|
147
|
+
body[:updatedAt] ||= (Time.now.to_f * 1000.0).to_i
|
144
148
|
event = format_event(body.to_json, target)
|
145
149
|
Sinatra::Application.settings.history[id] = event unless target == 'dashboards'
|
146
|
-
Sinatra::Application.settings.connections.each { |out|
|
150
|
+
Sinatra::Application.settings.connections.each { |out, ids|
|
151
|
+
begin
|
152
|
+
out << event if target == 'dashboards' || ids.nil? || ids.include?(id)
|
153
|
+
rescue IOError => e # if the socket is closed an IOError is thrown
|
154
|
+
Sinatra::Application.settings.connections.delete(out)
|
155
|
+
end
|
156
|
+
}
|
147
157
|
end
|
148
158
|
|
149
159
|
def format_event(body, name=nil)
|
@@ -152,12 +162,6 @@ def format_event(body, name=nil)
|
|
152
162
|
str << "data: #{body}\n\n"
|
153
163
|
end
|
154
164
|
|
155
|
-
def latest_events
|
156
|
-
settings.history.inject("") do |str, (_id, body)|
|
157
|
-
str << body
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
165
|
def first_dashboard
|
162
166
|
files = Dir[File.join(settings.views, '*')].collect { |f| File.basename(f, '.*') }
|
163
167
|
files -= ['layout']
|
data/lib/dashing/cli.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'thor'
|
2
2
|
require 'open-uri'
|
3
|
+
require 'dashing/version'
|
3
4
|
|
4
5
|
module Dashing
|
5
6
|
class CLI < Thor
|
@@ -25,6 +26,12 @@ module Dashing
|
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
29
|
+
desc "--version, -v", "Prints the version"
|
30
|
+
map %w[--version -v] => :__print_version
|
31
|
+
def __print_version
|
32
|
+
say "#{Dashing::VERSION}"
|
33
|
+
end
|
34
|
+
|
28
35
|
desc "new PROJECT_NAME", "Sets up ALL THE THINGS needed for your dashboard project."
|
29
36
|
def new(name)
|
30
37
|
@name = Thor::Util.snake_case(name)
|
data/templates/project/Gemfile
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,155 +1,155 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smashing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Beauchamp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: coffee-script
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '2.4'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '2.4'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: execjs
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.
|
33
|
+
version: '2.7'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.
|
40
|
+
version: '2.7'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: sinatra
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 2.
|
47
|
+
version: '2.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 2.
|
54
|
+
version: '2.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name: sinatra
|
56
|
+
name: sinatra-contrib
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 2.0
|
61
|
+
version: '2.0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 2.0
|
68
|
+
version: '2.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: thin
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: '1.7'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: '1.7'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: rufus-scheduler
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: '3.6'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: '3.6'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: thor
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: '1.0'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: '1.0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: sprockets
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0
|
117
|
+
version: '4.0'
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0
|
124
|
+
version: '4.0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: sassc
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: '2.0'
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
138
|
+
version: '2.0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: rack
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 2.
|
145
|
+
version: '2.2'
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 2.
|
152
|
+
version: '2.2'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: rake
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -271,6 +271,7 @@ files:
|
|
271
271
|
- lib/dashing/app.rb
|
272
272
|
- lib/dashing/cli.rb
|
273
273
|
- lib/dashing/downloader.rb
|
274
|
+
- lib/dashing/version.rb
|
274
275
|
- templates/dashboard/%name%.erb.tt
|
275
276
|
- templates/job/%name%.rb
|
276
277
|
- templates/project/.gitignore
|
@@ -311,7 +312,7 @@ files:
|
|
311
312
|
- templates/project/jobs/buzzwords.rb
|
312
313
|
- templates/project/jobs/convergence.rb
|
313
314
|
- templates/project/jobs/sample.rb
|
314
|
-
- templates/project/jobs/twitter.rb
|
315
|
+
- templates/project/jobs/twitter.rb.disabled
|
315
316
|
- templates/project/lib/.empty_directory
|
316
317
|
- templates/project/public/404.html
|
317
318
|
- templates/project/public/favicon.ico
|
@@ -370,7 +371,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
370
371
|
- !ruby/object:Gem::Version
|
371
372
|
version: '0'
|
372
373
|
requirements: []
|
373
|
-
rubygems_version: 3.1.
|
374
|
+
rubygems_version: 3.1.4
|
374
375
|
signing_key:
|
375
376
|
specification_version: 4
|
376
377
|
summary: The wonderfully excellent dashboard framework.
|