summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVarac <varac@leap.se>2017-10-16 14:21:55 +0200
committerVarac <varac@leap.se>2017-10-16 14:21:55 +0200
commitc3e807eb42ea7389676b714584bde204eab18577 (patch)
treed9ac909ff468ff2f00f03a29ab3f9b4ba05a56a7
parent64a3927db5440fe2c9b5c4d02667cb0749884c40 (diff)
parent2917ad9519d6f872d51582d335a147bf2e5f935e (diff)
Merge branch 'upgrade_dashing'
-rw-r--r--.gitignore4
-rw-r--r--CONTRIBUTING.md71
-rw-r--r--Gemfile10
-rw-r--r--README.md2
-rwxr-xr-xbin/smashing (renamed from bin/dashing)0
-rw-r--r--javascripts/dashing.coffee8
-rw-r--r--lib/dashing/app.rb15
-rw-r--r--lib/dashing/cli.rb6
-rw-r--r--smashing.gemspec (renamed from dashing.gemspec)19
-rw-r--r--templates/project/Gemfile2
-rw-r--r--templates/project/README.md2
-rw-r--r--templates/project/assets/stylesheets/application.scss12
-rw-r--r--templates/project/dashboards/layout.erb2
-rw-r--r--test/app_test.rb8
14 files changed, 117 insertions, 44 deletions
diff --git a/.gitignore b/.gitignore
index 6f3b403..ffa0de7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,6 +8,10 @@ coverage/
log/
tmp/
.ruby-version
+history.yml
+.*.swp
+assets/images/piwik.png
+credentials
.bundle/
vendor/
nagiosharder.yml
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 38f4e03..051a840 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,15 +1,72 @@
+# Welcome!
+
+Thank you for your interest in Smashing! This project is a fork of Dashing, the exceptionally handsome dashboard framework. We're still in the process of transitioning, so please excuse the mess.
+
+For general questions on new features, widgets, or ideas, please consider using the
+[Gitter Chat Room](https://gitter.im/Smashing/Lobby). This way
+developers can maintain code-related issues in GitHub, and help users with users with simple
+usage or widgets questions in a more appropriate channel.
+
<a name="issues"></a>
-## Have an Issue?
+## Have an Issue
-Dashing is no longer being actively maintained.
+If you run into problems with Smashing (or Dashing), please take these steps before
+submitting an issue:
-1. Check the [Troubleshooting Guide](https://github.com/Shopify/dashing/wiki#how-tos) in the wiki.
+1. Check the [Troubleshooting Guide](https://github.com/Dashing-io/dashing/wiki#how-tos) in the wiki.
2. Use the [GitHub Issue Search](https://help.github.com/articles/searching-issues/) to check if the issue has already been reported.
-3. You can ask your issue on the tracker, but your best bet is to go to [Stack Overflow](http://stackoverflow.com/questions/tagged/dashing)
-
+3. Submit your issue to our Issue Tracker. Please provide as much helpful information as possible, preferably making use of a [reduced test case](https://developer.mozilla.org/en-US/docs/Mozilla/QA/Reducing_testcases).
<a name="features"></a>
+## Feature Requests
-If you feel that you have a really amazing, super neato idea that should be a part of Dashing, it may be a good candidate for an external Gem which supercharges a project. An excellent example of this is
+Feature requests are welcome, but take a moment to consider whether your idea
+fits with the scope and aim of the project. A good rule of thumb is to apply
+the 80/20 rule: every feature should be useful to at least 80% of users. Adding
+in every possible edge case will only make it more difficult to understand, maintain,
+and hack on.
+
+If you feel that you have a really amazing, super neato idea that doesn't
+quite fit with the core use of Smashing, it may be a good candidate for an
+external Gem which supercharges a project. An excellent example of this is
[dashing-contrib](https://github.com/QubitProducts/dashing-contrib). If you
-do create a third-party extension for Dashing, please add it [here](https://github.com/Shopify/dashing/wiki/Additional-Widgets#other-third-party-tools).
+do create a third-party extension for Smashing, please add it [here](https://github.com/Dashing-io/dashing/wiki/Additional-Widgets#other-third-party-tools).
+
+For general questions on new features, widgets, or ideas, please use the
+[project mailing list](https://groups.google.com/forum/#!forum/smashing-dashboard).
+
+<a name="pull-requests"></a>
+## Pull Requests
+
+Patches, improvements and new features are a fantastic
+help -- thank you!
+
+**Please ask first** before embarking on any significant pull request (e.g.
+implementing features, refactoring code, porting to a different language),
+otherwise you risk spending a lot of time working on something that may
+not be merged into the project.
+
+Please adhere to the coding conventions used throughout a project (indentation,
+accurate comments, etc.) and any other requirements (such as test coverage).
+All code submitted via Pull Request will be dicussed and critiqued in a
+respectful manner.
+
+GitHub has [excellent documentation on how to use Pull Requests.](https://help.github.com/articles/using-pull-requests/)
+
+<a name="commit-msgs"></a>
+## Git Commit Message Suggestions
+
+* Consider starting the commit message with an applicable emoji:
+ * :art: `:art:` when improving the format/structure of the code
+ * :moyai: `:moyai:` when adding a new feature
+ * :wrench: `:wrench:` when dealing with the toolchain (Git, Travis, etc)
+ * :notebook: `:notebook` when dealing with docs
+ * :racehorse: `:racehorse:` when improving performance
+ * :penguin: `:penguin:` when fixing something on Linux
+ * :apple: `:apple:` when fixing something on Mac OS
+ * :bug: `:bug:` when fixing a bug
+ * :bomb: `:bomb:` when removing code or files
+ * :white_check_mark: `:white_check_mark:` when adding tests
+ * :lock: `:lock:` when dealing with security
+ * :arrow_up: `:arrow_up:` when upgrading dependencies
+ * :arrow_down: `:arrow_down:` when downgrading dependencies
diff --git a/Gemfile b/Gemfile
index 62ad4e4..01dc836 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,11 +1,5 @@
source 'https://rubygems.org'
-gem 'gitlab'
-# activesupport >= 5.0.0 requires ruby 2.2 which break jessie support
-gem 'activesupport', '< 5.0.0'
-# both following gems will break on jessie with
-# Gem::InstallError: rest-client requires Ruby version >= 2.0.0.
-# even when ruby 2.1 ist installed. So we pin earlier versions:
-gem 'mime-types', '2.6.2'
-gem 'rest-client', '< 2.0.0'
gemspec
+
+gem "nagiosharder"
diff --git a/README.md b/README.md
index 8d43f41..073d4b9 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,5 @@
# LEAP Dashboard
Check out http://shopify.github.com/dashing for more information.
-The maintained shopify fork of dashing can be found here: https://github.com/Dashing-io/dashing.git
-
## Setup
diff --git a/bin/dashing b/bin/smashing
index cce9340..cce9340 100755
--- a/bin/dashing
+++ b/bin/smashing
diff --git a/javascripts/dashing.coffee b/javascripts/dashing.coffee
index 20a9987..58218ae 100644
--- a/javascripts/dashing.coffee
+++ b/javascripts/dashing.coffee
@@ -46,7 +46,7 @@ class Dashing.Widget extends Batman.View
@accessor 'updatedAtMessage', ->
if updatedAt = @get('updatedAt')
- timestamp = new Date(updatedAt * 1000)
+ timestamp = new Date(updatedAt)
hours = timestamp.getHours()
minutes = ("0" + timestamp.getMinutes()).slice(-2)
"Last updated at #{hours}:#{minutes}"
@@ -57,16 +57,22 @@ class Dashing.Widget extends Batman.View
# In case the events from the server came before the widget was rendered
lastData = Dashing.lastEvents[@id]
if lastData
+ lastData = @select(lastData)
@mixin(lastData)
@onData(lastData)
receiveData: (data) =>
+ data = @select(data)
@mixin(data)
@onData(data)
onData: (data) =>
# Widgets override this to handle incoming data
+ select: (data) =>
+ # Widgets override this to transform data before it is applied to the model
+ return data
+
Dashing.AnimatedValue =
get: Batman.Property.defaultAccessor.get
set: (k, to) ->
diff --git a/lib/dashing/app.rb b/lib/dashing/app.rb
index b11352d..53ee0dc 100644
--- a/lib/dashing/app.rb
+++ b/lib/dashing/app.rb
@@ -34,16 +34,18 @@ set :root, Dir.pwd
set :sprockets, Sprockets::Environment.new(settings.root)
set :assets_prefix, '/assets'
set :digest_assets, false
-set server: 'thin', connections: [], history_file: 'history.yml'
+set :server, 'thin'
+set :connections, []
+set :history_file, 'history.yml'
set :public_folder, File.join(settings.root, 'public')
set :views, File.join(settings.root, 'dashboards')
set :default_dashboard, nil
set :auth_token, nil
if File.exists?(settings.history_file)
- set history: YAML.load_file(settings.history_file)
+ set :history, YAML.load_file(settings.history_file)
else
- set history: {}
+ set :history, {}
end
%w(javascripts stylesheets fonts images).each do |path|
@@ -55,7 +57,7 @@ end
end
not_found do
- send_file File.join(settings.public_folder, '404.html'), status: 404
+ send_file File.join(settings.public_folder, '404.html'), :status => 404
end
at_exit do
@@ -70,7 +72,7 @@ get '/' do
redirect "/" + dashboard
end
-get '/events', provides: 'text/event-stream' do
+get '/events', :provides => 'text/event-stream' do
protected!
response.headers['X-Accel-Buffering'] = 'no' # Disable buffering for nginx
stream :keep_open do |out|
@@ -121,6 +123,7 @@ get '/views/:widget?.html' do
file = File.join(settings.root, "widgets", params[:widget], "#{params[:widget]}.#{suffix}")
return engines.first.new(file).render if File.exist? file
end
+ "Drats! Unable to find a widget file named: #{params[:widget]} to render."
end
Thin::Server.class_eval do
@@ -135,7 +138,7 @@ end
def send_event(id, body, target=nil)
body[:id] = id
- body[:updatedAt] ||= Time.now.to_i
+ body[:updatedAt] ||= (Time.now.to_f * 1000.0).to_i
event = format_event(body.to_json, target)
Sinatra::Application.settings.history[id] = event unless target == 'dashboards'
Sinatra::Application.settings.connections.each { |out| out << event }
diff --git a/lib/dashing/cli.rb b/lib/dashing/cli.rb
index 4b93f89..57d48d0 100644
--- a/lib/dashing/cli.rb
+++ b/lib/dashing/cli.rb
@@ -86,7 +86,11 @@ module Dashing
private
def run_command(command)
- system(command)
+ begin
+ system(command)
+ rescue Interrupt => e
+ say "Exiting..."
+ end
end
def install_widget_from_gist(gist, skip_overwrite)
diff --git a/dashing.gemspec b/smashing.gemspec
index ad299f4..d662f8c 100644
--- a/dashing.gemspec
+++ b/smashing.gemspec
@@ -1,17 +1,16 @@
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
- s.name = 'dashing'
- s.version = '1.3.6'
- s.date = '2015-04-11'
- s.executables = %w(dashing)
+ s.name = 'smashing'
+ s.version = '1.0.0'
+ s.date = '2016-10-23'
+ s.executables = %w(smashing)
- s.summary = "The exceptionally handsome dashboard framework."
- s.description = "This framework lets you build & easily layout dashboards with your own custom widgets. Use it to make a status boards for your ops team, or use it to track signups, conversion rates, or whatever else metrics you'd like to see in one spot. Included with the framework are ready-made widgets for you to use or customize. All of this code was extracted out of a project at Shopify that displays dashboards on TVs around the office."
+ s.summary = "The wonderfully excellent dashboard framework."
+ s.description = "A framework for pulling together an overview of data that is important to your team and displaying it easily on TVs around the office. You write a bit of ruby code to gather data from some services and let Smashing handle the rest - displaying that data in a wonderfully simple layout. Built for developers and hackers, Smashing is highly customizable while maintaining humble roots that make it approachable to beginners."
s.author = "Daniel Beauchamp"
- s.email = 'daniel.beauchamp@shopify.com'
- s.homepage = 'http://shopify.github.com/dashing'
+ s.homepage = 'http://smashing.github.io/smashing'
s.license = "MIT"
s.files = Dir['README.md', 'javascripts/**/*', 'templates/**/*','templates/**/.[a-z]*', 'lib/**/*']
@@ -22,8 +21,8 @@ Gem::Specification.new do |s|
s.add_dependency('sinatra', '~> 1.4.4')
s.add_dependency('sinatra-contrib', '~> 1.4.2')
s.add_dependency('thin', '~> 1.6.1')
- s.add_dependency('rufus-scheduler', '~> 2.0.24')
- s.add_dependency('thor', '> 0.18.1')
+ s.add_dependency('rufus-scheduler', '~> 3.2.0')
+ s.add_dependency('thor', '~> 0.19')
s.add_dependency('sprockets', '~> 2.10.1')
s.add_dependency('rack', '~> 1.5.4')
diff --git a/templates/project/Gemfile b/templates/project/Gemfile
index 1235b37..46fea32 100644
--- a/templates/project/Gemfile
+++ b/templates/project/Gemfile
@@ -1,6 +1,6 @@
source 'https://rubygems.org'
-gem 'dashing'
+gem 'smashing'
## Remove this if you don't need a twitter widget.
gem 'twitter', '>= 5.9.0' \ No newline at end of file
diff --git a/templates/project/README.md b/templates/project/README.md
index 260ac2a..7bd2471 100644
--- a/templates/project/README.md
+++ b/templates/project/README.md
@@ -1 +1 @@
-Check out http://shopify.github.com/dashing for more information. \ No newline at end of file
+Check out http://smashing.github.io/smashing for more information.
diff --git a/templates/project/assets/stylesheets/application.scss b/templates/project/assets/stylesheets/application.scss
index 9a7ec7c..fe4fe22 100644
--- a/templates/project/assets/stylesheets/application.scss
+++ b/templates/project/assets/stylesheets/application.scss
@@ -8,14 +8,14 @@
$background-color: #222;
$text-color: #fff;
-$background-warning-color-1: #e82711;
-$background-warning-color-2: #9b2d23;
-$text-warning-color: #fff;
-
-$background-danger-color-1: #eeae32;
-$background-danger-color-2: #ff9618;
+$background-danger-color-1: #e82711;
+$background-danger-color-2: #9b2d23;
$text-danger-color: #fff;
+$background-warning-color-1: #eeae32;
+$background-warning-color-2: #ff9618;
+$text-warning-color: #fff;
+
@-webkit-keyframes status-warning-background {
0% { background-color: $background-warning-color-1; }
50% { background-color: $background-warning-color-2; }
diff --git a/templates/project/dashboards/layout.erb b/templates/project/dashboards/layout.erb
index 4aa5120..76a1704 100644
--- a/templates/project/dashboards/layout.erb
+++ b/templates/project/dashboards/layout.erb
@@ -13,7 +13,7 @@
<link rel="stylesheet" href="/assets/application.css">
<link href='//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700' rel='stylesheet' type='text/css'>
- <link rel="icon" href="/assets/favicon.ico">
+ <link rel="icon" href="/public/favicon.ico">
</head>
<body>
diff --git a/test/app_test.rb b/test/app_test.rb
index 36cd310..0eb6f3a 100644
--- a/test/app_test.rb
+++ b/test/app_test.rb
@@ -137,6 +137,14 @@ class AppTest < Dashing::Test
end
end
+ def test_get_nonexistent_widget
+ with_generated_project do
+ get '/views/nowidget.html'
+ assert_equal 200, last_response.status
+ assert_equal last_response.body, 'Drats! Unable to find a widget file named: nowidget to render.'
+ end
+ end
+
def with_generated_project
source_path = File.expand_path('../../templates', __FILE__)