SlideShare a Scribd company logo
Larry cai <larry.caiyu@gmail.com>
Agenda
 Introduction
 Exercise 1: Install Dashing
 Exercise 2:Add one widget
 Exercise 3: Update the view
 Exercise 4: Control the data
 Exercise 5: Update the data with color (coffeescript)
 Exercise 6: Pull the data (jobs)
 Reference
Learn Dashing Widget2 06/16/16
Introduction
Learn Dashing Widget3
 Dashing is a Sinatra based framework that
lets you build beautiful dashboards.
 Key features:
 Use premade widgets, or fully create your own
with scss, html, and coffeescript.
 Widgets harness the power of data bindings to
keep things DRY and simple. Powered by batman.js.
 Use the API to push data to your dashboards, or
make use of a simple ruby DSL for fetching data.
 Drag & Drop interface for re-arranging your
widgets.
Source http://shopify.github.io/dashing
06/16/16
Environment
 Ruby environment (Ruby 1.9.x+, Node.Js 0.10+)
 Ubuntu 14.04
 $ sudo apt-get install ruby, ruby-dev, gem
 $ sudo apt-get install bundler, g++,make,
 $ sudo apt-get install nodejs
 $ sudo gem install dashing
 Windows (use virtualbox with UbuntuVM)
 http://virtualboxes.org/
 http://virtualboxes.org/images/ubuntu-server/
 Or use online service for exercise
http://c9.io , http://codio.com
Learn Dashing Widget4 06/16/16
Environment using c9.io
 https://c9.io/
 New Ruby workspace
 In console:
gem install dashing
Learn Dashing Widget5 06/16/16
Exercise 1: Install Dashing
 Create new dashboard
 $ dashing new dashboard
 $ cd dashboard
 Remove twitter (need both)
 Comment out twitter in Gemfile
 Delete twitter.rb in jobs (dir)
 Start it
 $ bundle
 $ dashing start –p 8080 # default is 3030
 Point your browser to http://localhost:8080
 Or Run panel (if c9.io)
Learn Dashing Widget7 06/16/16
Widget
 Dashboard : dashboard/sample.erb (ruby template)
contains widget
 Dashboard is created with widgets
 Pre-made 50+ widgets (market place)
 Create own widget using css/html
 Widget (set of related files)
 widgetnumbernumber.html –View (html)
 widgetnumbernumber.scss – Style (css)
 widgetnumbernumber.coffee – Data (coffeescript)
Learn Dashing Widget8 06/16/16
Dashboard
Widget
Exercise 2: Add new widget
 Generate `log` widget
 $ dashing generate widget log
 Add into Dashboard
 # update sample.erb
 Check log.html
 Change data-view from Log to Text
 View can be used in other widget “instance”
/”object”
!! Log shall be capitalized for data-view !!!
Learn Dashing Widget9 06/16/16
https://gist.github.com/larrycai/79cf4c63927957a37eba/a909ff38b411eff8cf714c29973a7dc26d9f309e
Exercise 3: Update the view
 Update log.html
 Update log.scss
 Copy the view using list widget css (list.scss -> log.scss)
 Change inside .widget-list -> .widget-log
Learn Dashing Widget10 06/16/16
# log.html
<h1 class="title" data-bind="title"></h1>
<ul class="list-nostyle">
<li>
<span class="label">Access Log</span>
<span class="value" data-bind="access">0</span>
</li>
<li>
<span class="label">Event Log</span>
<span class="value" data-bind="event2">0</span>
</li>
</ul>
<p class="updated-at" data-bind="updatedAtMessage"></p>
Data in Dashing
 Each widget has the data-id (like log), which provides the
URL access point to update the data
 Push data to dashing using REST API (see bottom)
 $ curl -d '{ "auth_token": "YOUR_AUTH_TOKEN", "title":
"Current Hour Rate" }' http://<your url>/widgets/log
Learn Dashing Widget11 06/16/16
Exercise 4: Control the Data
 Update the data using curl for welcome message
 Find in the bottom of your dashboard (remove 443,  front of
http)
 Update the data using curl for log
 $ curl -d '{ "auth_token": "YOUR_AUTH_TOKEN", “access”: “100“,
“event2”:”87”}' http://<url>/widgets/log
 Update the data using curl for log
 # Save the request into log.json
 $ curl -d @log.json http://<url>/widgets/log
 Write your own script from anywhere!! (homework)
Learn Dashing12 06/16/16
Data in Dashing (more)
 Push data from anywhere using any language besides curl
 i.e. Python in jenkins job
 Push data in dashing jobs (ruby)
 jobs/sample.rb
Learn Dashing Widget13 06/16/16
CoffeeScript
 CofferScript is like javascript to control views when data
comes (like color) (log.coffeescript)
Learn Dashing Widget14 06/16/16
(Skipped)
Exercise 5: Update the color with data
 <error>/<warning> if there is error, it is red, if there is
warning, it is yellow. Otherwise green
 Use css class to change the color
 Use chrome developer to debug ..
Learn Dashing Widget15 06/16/16
# log.coffee
ready: ->
# This is fired when the widget is done being rendered
onData: (data) ->
# Fired when you receive data
for key,value of data
break if key in ["id","updatedAt"]
id = $(@node).find("##{key}")
console.log(id)
[error,warning] = value.split("/")
if error != "0"
id.attr("class","value-error")
(Skipped)
Exercise 6: Pull data in jobs
 Write log job to simulate fetching the log and send event
to widget
 $ dashing generate job log
 Update the data in every 5 second with random data
 Check sample.rb
Learn Dashing Widget16 06/16/16
Summary
 Dashing is a Radiator framework
 Dashboard consists of Widgets
 Widget:
 Connect with widget view (html/css) (may share one)
coffeescript is used to update view when data comes
 Connect with widget id (expose as HTTP/REST API)
 Update Dashboards can be done
 HTTP/REST API using any language
 Or internal ruby based jobs (crontab) inside Dashing
Learn Dashing Widget17 06/16/16
Reference
 http://shopify.github.io/dashing/
 https://github.com/Shopify/dashing/wiki/Additional-
Widgets
 http://dashing.challengepost.com/submissions
 https://www.andreydevyatkin.com/archives/getting-
started-with-dashing/
 http://www.alexecollins.com/content/team-dashboard-
dashing/
 Log widget gist:
https://gist.github.com/larrycai/79cf4c63927957a37eba
Learn Dashing Widget18 06/16/16

More Related Content

What's hot (20)

PDF
Git for beginners
Arulmurugan Rajaraman
 
PPTX
Introduction to CSS
Folasade Adedeji
 
PPTX
Css tables
AbhishekMondal42
 
PPS
Jsp chapter 1
kamal kotecha
 
KEY
Git and GitHub
James Gray
 
PPTX
Git n git hub
Jiwon Baek
 
PDF
Api fundamentals
AgileDenver
 
PDF
Git - An Introduction
Behzad Altaf
 
PDF
Git
Mayank Patel
 
PPT
Java Script ppt
Priya Goyal
 
PPT
Introduction to Git Commands and Concepts
Carl Brown
 
PDF
Github - Git Training Slides: Foundations
Lee Hanxue
 
PPT
JavaScript & Dom Manipulation
Mohammed Arif
 
PPTX
Git 101
Sachet Mittal
 
PPT
Bootstrap Part - 1
EPAM Systems
 
PPTX
Git and GitHub
Md. Ahsan Habib Nayan
 
PPTX
Html 5 tutorial - By Bally Chohan
ballychohanuk
 
PPTX
git, 이해부터 활용까지
jylee1229
 
PDF
Git and github 101
Senthilkumar Gopal
 
Git for beginners
Arulmurugan Rajaraman
 
Introduction to CSS
Folasade Adedeji
 
Css tables
AbhishekMondal42
 
Jsp chapter 1
kamal kotecha
 
Git and GitHub
James Gray
 
Git n git hub
Jiwon Baek
 
Api fundamentals
AgileDenver
 
Git - An Introduction
Behzad Altaf
 
Java Script ppt
Priya Goyal
 
Introduction to Git Commands and Concepts
Carl Brown
 
Github - Git Training Slides: Foundations
Lee Hanxue
 
JavaScript & Dom Manipulation
Mohammed Arif
 
Git 101
Sachet Mittal
 
Bootstrap Part - 1
EPAM Systems
 
Git and GitHub
Md. Ahsan Habib Nayan
 
Html 5 tutorial - By Bally Chohan
ballychohanuk
 
git, 이해부터 활용까지
jylee1229
 
Git and github 101
Senthilkumar Gopal
 

Viewers also liked (20)

ODP
Widget Platform
josemataf
 
PPTX
Présentation Dashing
Nathaniel Richand
 
KEY
Simple REST Services With Sinatra
Oisin Hurley
 
PPTX
미래가 알고 싶으세요?
Seongho Jang
 
PDF
Opensource Tools für das Data Center Management
inovex GmbH
 
PPTX
Splunking the JVM
Damien Dallimore
 
PPT
Widget 101
Wunderman
 
PPTX
Splunk Java Agent
Damien Dallimore
 
PDF
Workshop HTML5+PhoneGap by Ivano Malavolta
Commit University
 
PPTX
Splunk for JMX
Damien Dallimore
 
PPTX
Splunk Conf 2014 - Splunking the Java Virtual Machine
Damien Dallimore
 
PDF
Logging & Metrics
Tammo van Lessen
 
PPTX
Tips for creating a Self Organizing Teams
Yves Hanoulle
 
PDF
WSO2 para o Governo Brasileiro
Edgar Silva
 
PDF
Splunk conf2014 - Dashboard Fun - Creating an Interactive Transaction Profiler
Splunk
 
PDF
Comparing JVM Web Frameworks - Devoxx France 2013
Matt Raible
 
PDF
Rails Best Practices
Wen-Tien Chang
 
PDF
JavaScript + Jenkins = Winning!
Eric Wendelin
 
PDF
RequireJS & Handlebars
Ivano Malavolta
 
PPTX
#PortraitDeCDO - Guénaëlle Gault - Kantar
OCTO Technology
 
Widget Platform
josemataf
 
Présentation Dashing
Nathaniel Richand
 
Simple REST Services With Sinatra
Oisin Hurley
 
미래가 알고 싶으세요?
Seongho Jang
 
Opensource Tools für das Data Center Management
inovex GmbH
 
Splunking the JVM
Damien Dallimore
 
Widget 101
Wunderman
 
Splunk Java Agent
Damien Dallimore
 
Workshop HTML5+PhoneGap by Ivano Malavolta
Commit University
 
Splunk for JMX
Damien Dallimore
 
Splunk Conf 2014 - Splunking the Java Virtual Machine
Damien Dallimore
 
Logging & Metrics
Tammo van Lessen
 
Tips for creating a Self Organizing Teams
Yves Hanoulle
 
WSO2 para o Governo Brasileiro
Edgar Silva
 
Splunk conf2014 - Dashboard Fun - Creating an Interactive Transaction Profiler
Splunk
 
Comparing JVM Web Frameworks - Devoxx France 2013
Matt Raible
 
Rails Best Practices
Wen-Tien Chang
 
JavaScript + Jenkins = Winning!
Eric Wendelin
 
RequireJS & Handlebars
Ivano Malavolta
 
#PortraitDeCDO - Guénaëlle Gault - Kantar
OCTO Technology
 
Ad

Similar to Learn Dashing Widget in 90 minutes (20)

PPT
Drupal 7 Deployment Using Apache Ant. Dmitriy Svetlichniy.
DrupalCampDN
 
ODP
Drupal Theme Development - DrupalCon Chicago 2011
Ryan Price
 
PDF
Refresh Austin - Intro to Dexy
ananelson
 
DOCX
CIS407AWk2iLabDefault.aspx Greetings and Salutations.docx
clarebernice
 
ODP
Zend Framework 1.9 Setup & Using Zend_Tool
Gordon Forsythe
 
PDF
How to Use the Command Line to Increase Speed of Development
Acquia
 
PPT
BP204 - Take a REST and put your data to work with APIs!
Craig Schumann
 
KEY
Eat whatever you can with PyBabe
Dataiku
 
PDF
Everything is Awesome - Cutting the Corners off the Web
James Rakich
 
PDF
Bootstrap and XPages (DanNotes 2013)
Mark Leusink
 
PPTX
Html5 Overview
Abdel Moneim Emad
 
KEY
Drupal Meetup Lisbon
Paulo Gomes
 
PDF
lab56_db
tutorialsruby
 
PDF
lab56_db
tutorialsruby
 
PDF
大規模サイトにおけるユーザーレベルのキャッシュ活用によるパフォーマンスチューニング
Yoshikazu Aoyama
 
DOCX
Lab #9 and 10 Web Server ProgrammingCreate a New Folder I s.docx
DIPESH30
 
PDF
Debugging - Figuring it out yourself (WordCamp Dublin 2019)
Damien Carbery
 
PDF
Automating Workflows for Analytics Pipelines
Sadayuki Furuhashi
 
DOCX
PHP Lab template for lecturer log book- and syllabus
KavithaK23
 
PDF
WebGUI Developers Workshop
Plain Black Corporation
 
Drupal 7 Deployment Using Apache Ant. Dmitriy Svetlichniy.
DrupalCampDN
 
Drupal Theme Development - DrupalCon Chicago 2011
Ryan Price
 
Refresh Austin - Intro to Dexy
ananelson
 
CIS407AWk2iLabDefault.aspx Greetings and Salutations.docx
clarebernice
 
Zend Framework 1.9 Setup & Using Zend_Tool
Gordon Forsythe
 
How to Use the Command Line to Increase Speed of Development
Acquia
 
BP204 - Take a REST and put your data to work with APIs!
Craig Schumann
 
Eat whatever you can with PyBabe
Dataiku
 
Everything is Awesome - Cutting the Corners off the Web
James Rakich
 
Bootstrap and XPages (DanNotes 2013)
Mark Leusink
 
Html5 Overview
Abdel Moneim Emad
 
Drupal Meetup Lisbon
Paulo Gomes
 
lab56_db
tutorialsruby
 
lab56_db
tutorialsruby
 
大規模サイトにおけるユーザーレベルのキャッシュ活用によるパフォーマンスチューニング
Yoshikazu Aoyama
 
Lab #9 and 10 Web Server ProgrammingCreate a New Folder I s.docx
DIPESH30
 
Debugging - Figuring it out yourself (WordCamp Dublin 2019)
Damien Carbery
 
Automating Workflows for Analytics Pipelines
Sadayuki Furuhashi
 
PHP Lab template for lecturer log book- and syllabus
KavithaK23
 
WebGUI Developers Workshop
Plain Black Corporation
 
Ad

More from Larry Cai (20)

PPTX
Learn kubernetes in 90 minutes
Larry Cai
 
PPT
Learn jobDSL for Jenkins
Larry Cai
 
PPT
Learn RabbitMQ with Python in 90mins
Larry Cai
 
PPT
Learn flask in 90mins
Larry Cai
 
PPT
Learn ELK in docker
Larry Cai
 
PPT
Software Engineer Talk
Larry Cai
 
PPTX
Learn nginx in 90mins
Larry Cai
 
PPT
Learn basic ansible using docker
Larry Cai
 
PPT
Build service with_docker_in_90mins
Larry Cai
 
PPTX
Learn docker in 90 minutes
Larry Cai
 
PPT
Learn REST API with Python
Larry Cai
 
PPT
Jenkins Scriptler in 90mins
Larry Cai
 
PPT
Python virtualenv & pip in 90 minutes
Larry Cai
 
PPT
Lead changes in software development
Larry Cai
 
PPT
Python in 90mins
Larry Cai
 
PDF
Practical way to experience of Specification by Example
Larry Cai
 
PPT
Experience from specification_by_examples
Larry Cai
 
PPT
Write book in markdown
Larry Cai
 
PPT
Continuous Integration Introduction
Larry Cai
 
PDF
Agile & ALM tools
Larry Cai
 
Learn kubernetes in 90 minutes
Larry Cai
 
Learn jobDSL for Jenkins
Larry Cai
 
Learn RabbitMQ with Python in 90mins
Larry Cai
 
Learn flask in 90mins
Larry Cai
 
Learn ELK in docker
Larry Cai
 
Software Engineer Talk
Larry Cai
 
Learn nginx in 90mins
Larry Cai
 
Learn basic ansible using docker
Larry Cai
 
Build service with_docker_in_90mins
Larry Cai
 
Learn docker in 90 minutes
Larry Cai
 
Learn REST API with Python
Larry Cai
 
Jenkins Scriptler in 90mins
Larry Cai
 
Python virtualenv & pip in 90 minutes
Larry Cai
 
Lead changes in software development
Larry Cai
 
Python in 90mins
Larry Cai
 
Practical way to experience of Specification by Example
Larry Cai
 
Experience from specification_by_examples
Larry Cai
 
Write book in markdown
Larry Cai
 
Continuous Integration Introduction
Larry Cai
 
Agile & ALM tools
Larry Cai
 

Recently uploaded (20)

PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PDF
Modern Decentralized Application Architectures.pdf
Kalema Edgar
 
PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
PDF
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pdf
ghjghvhjgc
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PDF
[GDGoC FPTU] Spring 2025 Summary Slidess
minhtrietgect
 
PDF
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PDF
Evolution: How True AI is Redefining Safety in Industry 4.0
vikaassingh4433
 
PDF
“ONNX and Python to C++: State-of-the-art Graph Compilation,” a Presentation ...
Edge AI and Vision Alliance
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PPTX
Role_of_Artificial_Intelligence_in_Livestock_Extension_Services.pptx
DrRajdeepMadavi
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
Modern Decentralized Application Architectures.pdf
Kalema Edgar
 
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pdf
ghjghvhjgc
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
[GDGoC FPTU] Spring 2025 Summary Slidess
minhtrietgect
 
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
Evolution: How True AI is Redefining Safety in Industry 4.0
vikaassingh4433
 
“ONNX and Python to C++: State-of-the-art Graph Compilation,” a Presentation ...
Edge AI and Vision Alliance
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
Role_of_Artificial_Intelligence_in_Livestock_Extension_Services.pptx
DrRajdeepMadavi
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 

Learn Dashing Widget in 90 minutes

  • 2. Agenda  Introduction  Exercise 1: Install Dashing  Exercise 2:Add one widget  Exercise 3: Update the view  Exercise 4: Control the data  Exercise 5: Update the data with color (coffeescript)  Exercise 6: Pull the data (jobs)  Reference Learn Dashing Widget2 06/16/16
  • 3. Introduction Learn Dashing Widget3  Dashing is a Sinatra based framework that lets you build beautiful dashboards.  Key features:  Use premade widgets, or fully create your own with scss, html, and coffeescript.  Widgets harness the power of data bindings to keep things DRY and simple. Powered by batman.js.  Use the API to push data to your dashboards, or make use of a simple ruby DSL for fetching data.  Drag & Drop interface for re-arranging your widgets. Source http://shopify.github.io/dashing 06/16/16
  • 4. Environment  Ruby environment (Ruby 1.9.x+, Node.Js 0.10+)  Ubuntu 14.04  $ sudo apt-get install ruby, ruby-dev, gem  $ sudo apt-get install bundler, g++,make,  $ sudo apt-get install nodejs  $ sudo gem install dashing  Windows (use virtualbox with UbuntuVM)  http://virtualboxes.org/  http://virtualboxes.org/images/ubuntu-server/  Or use online service for exercise http://c9.io , http://codio.com Learn Dashing Widget4 06/16/16
  • 5. Environment using c9.io  https://c9.io/  New Ruby workspace  In console: gem install dashing Learn Dashing Widget5 06/16/16
  • 6. Exercise 1: Install Dashing  Create new dashboard  $ dashing new dashboard  $ cd dashboard  Remove twitter (need both)  Comment out twitter in Gemfile  Delete twitter.rb in jobs (dir)  Start it  $ bundle  $ dashing start –p 8080 # default is 3030  Point your browser to http://localhost:8080  Or Run panel (if c9.io) Learn Dashing Widget7 06/16/16
  • 7. Widget  Dashboard : dashboard/sample.erb (ruby template) contains widget  Dashboard is created with widgets  Pre-made 50+ widgets (market place)  Create own widget using css/html  Widget (set of related files)  widgetnumbernumber.html –View (html)  widgetnumbernumber.scss – Style (css)  widgetnumbernumber.coffee – Data (coffeescript) Learn Dashing Widget8 06/16/16 Dashboard Widget
  • 8. Exercise 2: Add new widget  Generate `log` widget  $ dashing generate widget log  Add into Dashboard  # update sample.erb  Check log.html  Change data-view from Log to Text  View can be used in other widget “instance” /”object” !! Log shall be capitalized for data-view !!! Learn Dashing Widget9 06/16/16 https://gist.github.com/larrycai/79cf4c63927957a37eba/a909ff38b411eff8cf714c29973a7dc26d9f309e
  • 9. Exercise 3: Update the view  Update log.html  Update log.scss  Copy the view using list widget css (list.scss -> log.scss)  Change inside .widget-list -> .widget-log Learn Dashing Widget10 06/16/16 # log.html <h1 class="title" data-bind="title"></h1> <ul class="list-nostyle"> <li> <span class="label">Access Log</span> <span class="value" data-bind="access">0</span> </li> <li> <span class="label">Event Log</span> <span class="value" data-bind="event2">0</span> </li> </ul> <p class="updated-at" data-bind="updatedAtMessage"></p>
  • 10. Data in Dashing  Each widget has the data-id (like log), which provides the URL access point to update the data  Push data to dashing using REST API (see bottom)  $ curl -d '{ "auth_token": "YOUR_AUTH_TOKEN", "title": "Current Hour Rate" }' http://<your url>/widgets/log Learn Dashing Widget11 06/16/16
  • 11. Exercise 4: Control the Data  Update the data using curl for welcome message  Find in the bottom of your dashboard (remove 443, front of http)  Update the data using curl for log  $ curl -d '{ "auth_token": "YOUR_AUTH_TOKEN", “access”: “100“, “event2”:”87”}' http://<url>/widgets/log  Update the data using curl for log  # Save the request into log.json  $ curl -d @log.json http://<url>/widgets/log  Write your own script from anywhere!! (homework) Learn Dashing12 06/16/16
  • 12. Data in Dashing (more)  Push data from anywhere using any language besides curl  i.e. Python in jenkins job  Push data in dashing jobs (ruby)  jobs/sample.rb Learn Dashing Widget13 06/16/16
  • 13. CoffeeScript  CofferScript is like javascript to control views when data comes (like color) (log.coffeescript) Learn Dashing Widget14 06/16/16
  • 14. (Skipped) Exercise 5: Update the color with data  <error>/<warning> if there is error, it is red, if there is warning, it is yellow. Otherwise green  Use css class to change the color  Use chrome developer to debug .. Learn Dashing Widget15 06/16/16 # log.coffee ready: -> # This is fired when the widget is done being rendered onData: (data) -> # Fired when you receive data for key,value of data break if key in ["id","updatedAt"] id = $(@node).find("##{key}") console.log(id) [error,warning] = value.split("/") if error != "0" id.attr("class","value-error")
  • 15. (Skipped) Exercise 6: Pull data in jobs  Write log job to simulate fetching the log and send event to widget  $ dashing generate job log  Update the data in every 5 second with random data  Check sample.rb Learn Dashing Widget16 06/16/16
  • 16. Summary  Dashing is a Radiator framework  Dashboard consists of Widgets  Widget:  Connect with widget view (html/css) (may share one) coffeescript is used to update view when data comes  Connect with widget id (expose as HTTP/REST API)  Update Dashboards can be done  HTTP/REST API using any language  Or internal ruby based jobs (crontab) inside Dashing Learn Dashing Widget17 06/16/16
  • 17. Reference  http://shopify.github.io/dashing/  https://github.com/Shopify/dashing/wiki/Additional- Widgets  http://dashing.challengepost.com/submissions  https://www.andreydevyatkin.com/archives/getting- started-with-dashing/  http://www.alexecollins.com/content/team-dashboard- dashing/  Log widget gist: https://gist.github.com/larrycai/79cf4c63927957a37eba Learn Dashing Widget18 06/16/16