Skip to content

Instantly share code, notes, and snippets.

@witokondoria
Last active September 15, 2016 13:49
Show Gist options
  • Save witokondoria/ac81f1332978b338192e1879fa44b750 to your computer and use it in GitHub Desktop.
Save witokondoria/ac81f1332978b338192e1879fa44b750 to your computer and use it in GitHub Desktop.
Awesome jenkins job dashing widget
class Dashing.Jenkinsmeter extends Dashing.Widget
@accessor 'value', Dashing.AnimatedValue
constructor: ->
super
@observe 'value', (value) ->
$(@node).find(".meter").val(value).trigger('change')
ready: ->
meter = $(@node).find(".meter")
meter.attr("data-bgcolor", meter.css("background-color"))
meter.attr("data-fgcolor", meter.css("color"))
meter.knob()
<h1 class="title" data-bind="title"></h1>
<input class="meter" data-angleOffset=-90 data-angleArc=180 data-bind-data-height="height | default 200" data-bind-data-width="width | default 200" data-readOnly=true data-bind-value="value | shortenedNumber | prepend prefix | append suffix" data-bind-data-min="min" data-bind-data-max="max">
// ----------------------------------------------------------------------------
// Sass declarations
// ----------------------------------------------------------------------------
$background-color: #9c4274;
$title-color: rgba(255, 255, 255, 0.7);
$moreinfo-color: rgba(0, 0, 0, 0.3);
$meter-background: darken($background-color, 15%);
// ----------------------------------------------------------------------------
// Widget-meter styles
// ----------------------------------------------------------------------------
.widget-meter {
background-color: $background-color;
input.meter {
background-color: $meter-background;
color: #000;
}
.title {
color: $title-color;
font-family: Brandon Text;
font-style: normal;
font-stretch: normal;
line-height: 1.1;
text-align: left;
}
.more-info {
color: $moreinfo-color;
}
.updated-at {
color: rgba(0, 0, 0, 0.3);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment