Last active
August 29, 2015 14:07
-
-
Save gaving/e0b92c123a31516c5424 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Dashing.Alert extends Dashing.Widget | |
ready: -> | |
onData: (data) -> | |
@accessor 'isHigh', -> | |
@get('level') in ['SEVERE', 'CRITICAL'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1 class="title" data-bind="title"></h1> <h2 class="level" data-bind="level"></h2> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.widget-alert { | |
background: #00ff99; | |
} | |
.widget-alert > h2 { | |
font-size: 50px; | |
} | |
.danger { | |
background: #FF7400; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% content_for :title do %>Dashboard<% end %> | |
<div class="gridster"> | |
<ul> | |
<li data-row="1" data-col="1" data-sizex="1" data-sizey="1"> | |
<div data-id="terror" data-view="Alert" data-addclass-danger="isHigh"></div> | |
<i class="icon-warning-sign icon-background"></i> | |
</li> | |
</ul> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'feedjira' | |
SCHEDULER.every '30s' do | |
feed = Feedjira::Feed.fetch_and_parse('https://www.mi5.gov.uk/UKThreatLevel/UKThreatLevel.xml') | |
entry = feed.entries.first | |
send_event('terror', { | |
title: entry.title, | |
level: entry.summary.scan(/\b[A-Z]+\b/)[1] | |
}) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment