Skip to content

Commit

Permalink
Update GitHub status widget
Browse files Browse the repository at this point in the history
  • Loading branch information
Jay Zoldak committed Mar 2, 2014
1 parent c27484c commit df172d0
Show file tree
Hide file tree
Showing 13 changed files with 82 additions and 41 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ gem 'dashing', "1.3.2"
gem 'nokogiri'
gem 'execjs'
gem 'therubyracer'
gem 'httparty'
6 changes: 6 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,14 @@ GEM
eventmachine (1.0.3)
execjs (2.0.2)
hike (1.2.3)
httparty (0.13.0)
json (~> 1.8)
multi_xml (>= 0.5.2)
json (1.8.1)
libv8 (3.16.14.3)
mini_portile (0.5.2)
multi_json (1.8.4)
multi_xml (0.5.5)
nokogiri (1.6.1)
mini_portile (~> 0.5.0)
rack (1.5.2)
Expand Down Expand Up @@ -72,5 +77,6 @@ PLATFORMS
DEPENDENCIES
dashing (= 1.3.2)
execjs
httparty
nokogiri
therubyracer
Binary file added assets/images/github/invertocat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/github/logo-good.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/github/logo-major.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/github/logo-minor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion dashboards/edx.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Dashing.numColumns = 12
<div data-id="mathworks_status" data-view="Status"></div>
</li>
<li data-row="1" data-col="1" data-sizex="2" data-sizey="2">
<div data-id="github_status" data-title="GitHub Status" data-view="Status"></div>
<div data-id="github_status" data-view="GithubStatus" data-title="GitHub Status"></div>
</li>
<li data-row="1" data-col="9" data-sizex="4" data-sizey="5">
<div data-id="jenkins_deploy_status" data-view="Jenkins" data-title="Deploy Tests"></div>
Expand Down
40 changes: 0 additions & 40 deletions jobs/github-status.rb

This file was deleted.

7 changes: 7 additions & 0 deletions jobs/github_status.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'httparty'

github_api = 'https://status.github.com/api/last-message.json'

SCHEDULER.every '1m', :first_in => 0 do
send_event('github_status', HTTParty.get(github_api).parsed_response)
end
1 change: 1 addition & 0 deletions widgets/github_status/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Adapted from https://gist.github.com/dacamp/7166065
9 changes: 9 additions & 0 deletions widgets/github_status/github_status.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class Dashing.GithubStatus extends Dashing.Widget
ready: ->
@onData(this)

onData: (data) ->
widget = $(@node)
widget.removeClass("good minor major").addClass(data.status)
widget.find('#github-logo').removeClass("good minor major").addClass(data.status)
widget.find('#message').removeClass("good minor major").addClass(data.status)
5 changes: 5 additions & 0 deletions widgets/github_status/github_status.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div id="latest-message" class="wrap">
<p id="message" data-bind="body"></span>
</div>
<div id="github-logo"></div>
<p class="updated-at" data-bind="updatedAtMessage"></p>
52 changes: 52 additions & 0 deletions widgets/github_status/github_status.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// ----------------------------------------------------------------------------
// Widget-github-status styles
// ----------------------------------------------------------------------------
.widget-github-status {
background: #2A455C url("/assets/github/invertocat.png") no-repeat center;
position: relative;
overflow: hidden;
&.good {color:#396;}
&.minor {color:#f29d50;}
&.major {color:#c30;}

div {
position: absolute;
left: 0;
right: 0;
margin: 0 auto;
}

#latest-message{
top: 5px;
margin: 0 5px;
#message {
&.good {
}
&.minor {
background:#fdf5ed;
border-radius:3px;
border:1px solid #ccc;
border-color:#f8cea7;
}
&.major {
background:#f9eae5;
border-radius:3px;
border:1px solid #ccc;
border-color:#e5997f;
}
}
}

#github-logo{
bottom: 30px;
height: 100px;
width: 200px;
&.good { background: url("/assets/github/logo-good.png") no-repeat center bottom; }
&.minor { background: url("/assets/github/logo-minor.png") no-repeat center bottom; }
&.major { background: url("/assets/github/logo-major.png") no-repeat center bottom; }
}

.updated-at {
color: rgba(255, 255, 255, 0.7);
}
}

0 comments on commit df172d0

Please sign in to comment.