smashing 1.3.1 → 1.3.2
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 +35 -30
- data/lib/dashing/app.rb +11 -14
- data/lib/dashing/version.rb +1 -1
- metadata +19 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81e32b16c4aa7ec98c1c7392e491117ff12d8626b720260a84424d6bd1fa8b28
|
4
|
+
data.tar.gz: 991e9aeff8e5e18508b7b71a790a1f6ee0bdbdbdcbd4fc7dfaa88f7132d9e22c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f1476edfb161b08c0df5ed5ca7fc8d21275dd0bc00c6d9def498d96d3314ab479954c80e6e701ec9f8b5de12e06a94e132d3ef2381636ae060de505e25b235f
|
7
|
+
data.tar.gz: 3dd675a7510e926d4764660c3d3a9b8081a01b82eba3b94e99884e6d70c9f882fbe001ba0a9b68eb046f973dd55c4ae5eefac0b2c3266103c951a50daf1d9b75
|
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}")
|
@@ -121,34 +122,38 @@ Dashing.widgets = widgets = {}
|
|
121
122
|
Dashing.lastEvents = lastEvents = {}
|
122
123
|
Dashing.debugMode = false
|
123
124
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
source.addEventListener '
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
125
|
+
Dashing.on 'run', ->
|
126
|
+
setTimeout -> # run only when all widgets are created
|
127
|
+
ids = Object.keys(Dashing.widgets)
|
128
|
+
source = new EventSource('events?ids=' + encodeURIComponent(ids.join(',')))
|
129
|
+
source.addEventListener 'open', (e) ->
|
130
|
+
console.log("Connection opened", e)
|
131
|
+
|
132
|
+
source.addEventListener 'error', (e)->
|
133
|
+
console.log("Connection error", e)
|
134
|
+
if (e.currentTarget.readyState == EventSource.CLOSED)
|
135
|
+
console.log("Connection closed")
|
136
|
+
setTimeout (->
|
137
|
+
window.location.reload()
|
138
|
+
), 5*60*1000
|
139
|
+
|
140
|
+
source.addEventListener 'message', (e) ->
|
141
|
+
data = JSON.parse(e.data)
|
142
|
+
if lastEvents[data.id]?.updatedAt != data.updatedAt
|
143
|
+
if Dashing.debugMode
|
144
|
+
console.log("Received data for #{data.id}", data)
|
145
|
+
lastEvents[data.id] = data
|
146
|
+
if widgets[data.id]?.length > 0
|
147
|
+
for widget in widgets[data.id]
|
148
|
+
widget.receiveData(data)
|
149
|
+
|
150
|
+
source.addEventListener 'dashboards', (e) ->
|
151
|
+
data = JSON.parse(e.data)
|
152
|
+
if Dashing.debugMode
|
153
|
+
console.log("Received data for dashboards", data)
|
154
|
+
if data.dashboard is '*' or window.location.pathname is "/#{data.dashboard}"
|
155
|
+
Dashing.fire data.event, data
|
156
|
+
, 0
|
152
157
|
|
153
158
|
$(document).ready ->
|
154
159
|
Dashing.run()
|
data/lib/dashing/app.rb
CHANGED
@@ -36,7 +36,7 @@ set :sprockets, Sprockets::Environment.new(settings.root)
|
|
36
36
|
set :assets_prefix, '/assets'
|
37
37
|
set :digest_assets, false
|
38
38
|
set :server, 'thin'
|
39
|
-
set :connections,
|
39
|
+
set :connections, {}
|
40
40
|
set :history_file, 'history.yml'
|
41
41
|
set :public_folder, File.join(settings.root, 'public')
|
42
42
|
set :views, File.join(settings.root, 'dashboards')
|
@@ -54,7 +54,7 @@ end
|
|
54
54
|
settings.sprockets.append_path("assets/#{path}")
|
55
55
|
end
|
56
56
|
|
57
|
-
['widgets', File.expand_path('../../../javascripts', __FILE__)].
|
57
|
+
['widgets', File.expand_path('../../../javascripts', __FILE__)].each do |path|
|
58
58
|
settings.sprockets.append_path(path)
|
59
59
|
end
|
60
60
|
|
@@ -77,9 +77,12 @@ end
|
|
77
77
|
get '/events', :provides => 'text/event-stream' do
|
78
78
|
protected!
|
79
79
|
response.headers['X-Accel-Buffering'] = 'no' # Disable buffering for nginx
|
80
|
+
ids = params[:ids].to_s.split(',').to_set
|
80
81
|
stream :keep_open do |out|
|
81
|
-
settings.connections
|
82
|
-
|
82
|
+
settings.connections[out] = ids
|
83
|
+
settings.history.each do |id, event|
|
84
|
+
out << event if ids.include?(id)
|
85
|
+
end
|
83
86
|
out.callback { settings.connections.delete(out) }
|
84
87
|
end
|
85
88
|
end
|
@@ -131,7 +134,7 @@ end
|
|
131
134
|
|
132
135
|
Thin::Server.class_eval do
|
133
136
|
def stop_with_connection_closing
|
134
|
-
Sinatra::Application.settings.connections.dup.
|
137
|
+
Sinatra::Application.settings.connections.dup.each_key(&:close)
|
135
138
|
stop_without_connection_closing
|
136
139
|
end
|
137
140
|
|
@@ -141,12 +144,12 @@ end
|
|
141
144
|
|
142
145
|
def send_event(id, body, target=nil)
|
143
146
|
body[:id] = id
|
144
|
-
body[:updatedAt] ||= (Time.now.to_f * 1000.0).to_i
|
147
|
+
body[:updatedAt] ||= (Time.now.to_f * 1000.0).to_i
|
145
148
|
event = format_event(body.to_json, target)
|
146
149
|
Sinatra::Application.settings.history[id] = event unless target == 'dashboards'
|
147
|
-
Sinatra::Application.settings.connections.each { |out|
|
150
|
+
Sinatra::Application.settings.connections.each { |out, ids|
|
148
151
|
begin
|
149
|
-
out << event
|
152
|
+
out << event if target == 'dashboards' || ids.include?(id)
|
150
153
|
rescue IOError => e # if the socket is closed an IOError is thrown
|
151
154
|
Sinatra::Application.settings.connections.delete(out)
|
152
155
|
end
|
@@ -159,12 +162,6 @@ def format_event(body, name=nil)
|
|
159
162
|
str << "data: #{body}\n\n"
|
160
163
|
end
|
161
164
|
|
162
|
-
def latest_events
|
163
|
-
settings.history.inject("") do |str, (_id, body)|
|
164
|
-
str << body
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
165
|
def first_dashboard
|
169
166
|
files = Dir[File.join(settings.views, '*')].collect { |f| File.basename(f, '.*') }
|
170
167
|
files -= ['layout']
|
data/lib/dashing/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smashing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Beauchamp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coffee-script
|
@@ -16,98 +16,98 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.4
|
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: 2.4
|
26
|
+
version: '2.4'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: execjs
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.7
|
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.7
|
40
|
+
version: '2.7'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: sinatra
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 2.0
|
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.0
|
54
|
+
version: '2.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
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
70
|
name: thin
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.7
|
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: 1.7
|
82
|
+
version: '1.7'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rufus-scheduler
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 3.6
|
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: 3.6
|
96
|
+
version: '3.6'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: thor
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 1.0
|
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: 1.0
|
110
|
+
version: '1.0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: sprockets
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,14 +142,14 @@ dependencies:
|
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 2.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.2
|
152
|
+
version: '2.2'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: rake
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -371,7 +371,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
371
371
|
- !ruby/object:Gem::Version
|
372
372
|
version: '0'
|
373
373
|
requirements: []
|
374
|
-
rubygems_version: 3.
|
374
|
+
rubygems_version: 3.1.4
|
375
375
|
signing_key:
|
376
376
|
specification_version: 4
|
377
377
|
summary: The wonderfully excellent dashboard framework.
|