The exceptionally remarkable instrumentenbord framework.
Dashing is a Sinatra based framework that lets you build beautiful dashboards.
Check out a demo overheen here. Here’s another one, optimized for 1080p screens.
- Use premade widgets, or fully create your own with scss, html, and coffeescript.
- Widgets corset the power of gegevens bindings to keep things DRY and elementary. Powered by batman.js.
- Use the API to thrust gegevens to your dashboards, or make use of a elementary ruby DSL for fetching gegevens.
- Haul & Druppel interface for re-arranging your widgets.
- Host your dashboards on Heroku te less than 30 seconds.
This project wasgoed created at Shopify for displaying custom-built dashboards on TVs around the office.
Install the gem from the directive line. Make sure you have Ruby 1.9+
$ gem install dashing
Generate a fresh project
$ dashing fresh sweet_dashboard_project
Switch your directory to sweet_dashboard_project and bundle gems
Commence the server!
Point your browser at localhost:3030 and have joy!
Every fresh Dashing project comes with sample widgets & sample dashboards for you to explore. The directory is setup spil goes after:
- Assets &mdash, All your pics, fonts, and js/coffeescript libraries. Uses Sprockets
- Dashboards &mdash, One .erb opstopping for each instrumentenbord that contains the layout for the widgets.
- Jobs &mdash, Your ruby jobs for fetching gegevens (e.g for calling third party APIs like twitter).
- Lib &mdash, Optional ruby files to help out your jobs.
- Public &mdash, Static files that you want to serve. A good place for a favicon or a custom-made 404 pagina.
- Widgets &mdash, All the html/css/coffee for individual widgets.
Run dashing from directive line to find out what instruction line contraptions are available to you.
Each widget is represented by a div factor needing data-id and data-view attributes. The wrapping <,li>, tags are used for layout.
data-id : Sets the widget ID which will be used when pushing gegevens to the widget. Two widgets can have the same widget id, permitting you to have the same widget te numerous dashboards. Shove gegevens to that id, and each example will be updated.
data-view : Specifies the type of widget that will be used.
Both thesis widgets are of the same type: Number . However, using different data- attributes lets you customize them. You can use any arbitrary attribute you want &mdash, each one will be available for you within the widget logic.
Anatomy of a widget
- an HTML opstopping used for layout and bindings
- a SCSS opstopping for styles
- a coffeescript verkeersopstopping which permits you to treat incoming gegevens & functionality
Number widget’s HTML:
Widgets use batman bindings ter order to update their contents. Whenever the gegevens switches, the Onverstandig will automatically reflect the switches.
You may notice the piping ‘|’ characters te some of the data-bind ‘s above. Thesis are Batman Filters, and let you lightly format the representation of gegevens.
Number widget’s Coffeescript:
By default, whenever a widget receives JSON gegevens, it mixes te the received gegevens onto itself. This means that if you pass ter gegevens with a title attribute, the widget’s title variable will switch, and so will all Onverstandig elements roped to it. No need to treat that yourself.
Laying out the widgets
Dashing uses gridster.js to create a layout for your widgets. Each widget is part of an unordered list. The <,li>, factor for a widget contains:
- data-row : What row the widget is on.
- data-col : What katern the widget is on
- data-sizex : Oprecht size for the width of a widget
- data-sizey : Rechtschapen size for the height of a widget
For both data-row and data-col , you can leave them spil 1, and gridster will automatically position your widgets.
If you want to customize the layout lightly, simply navigate to your running instrumentenbord, and haul the widgets with your mouse. You will be prompted to save the layout when you’re finished. Go after the on-screen instructions.
For data-sizex and data-sizey , thesis are multiples of the widget dimensions you can configure ter application.coffee
Getting Gegevens Into Your Widgets
Providing gegevens to widgets is effortless. You specify which widget you want using a widget id, and then pass ter the JSON gegevens. There are two ways to do this:
Dashing uses rufus-scheduler to schedule jobs. You can make a fresh job with dashing generate job sample_job , which will create a opstopping te the jobs directory called sample_job.rb .
This job will run every minute, and will send a random number to ALL widgets that have data-id set to ‘karma’.
You send gegevens using the following method:
Jobs are where you waterput stuff such spil fetching metrics from a database, or calling a third party API like Twitter. Since the gegevens fetch is happening te only one place, it means that all instances of widgets are ter sync. Server Sent Events are used ter order to stream gegevens to the dashboards.
Note that if you modify a job then Dashing needs to be restarted to pick up the switches.
Your widgets can be updated directly overheen HTTP. Postbode the gegevens you want ter json to /widgets/widget_id . For security, you will also have to include your auth_token (which can be found te config.ru ).
You can also perform dashboard-level deeds by posting to /dashboards/dashboard_id . Presently there is a single event available, reload , that will refresh the target instrumentenbord ter the browser.
If you want an event to target every instrumentenbord, use a wildcard ( * ).
Check out the wiki for interesting tips such spil hosting on Heroku, or adding authentication.
Tested ter Chrome, Safari 6+, and Firefox 15+.
Does not work te Internet Explorer because it relies on Server Sent Events.
Authors & Maintainers
Albeit this project is not being actively maintained, there are tons of widgets being added by the community, especially fresh widgets!