Last active
December 23, 2015 08:08
-
-
Save bacall213/6605258 to your computer and use it in GitHub Desktop.
Ninjablocks Diskspace Dashboard Widget (Designed for use with https://github.com/bacall213/ninja-diskspace) (Author: Brian Call) (License: MIT)
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
return { | |
"name": "Ninja Diskspace", | |
"deviceMap": [ | |
{ "deviceId": 2000, "minimum": 1, "maximum": 1} // Sandbox device until more specific ID is availble | |
], | |
"forceDeviceMapGroup": true | |
} |
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
background: white; | |
h4 { | |
color: rgba(0,0,0,0.3); | |
font-size: 15px; | |
margin: 10px 10px; | |
} | |
.value { | |
position: absolute; | |
top: 50px; | |
width: 100%; | |
text-align: center; | |
font-size: 45px; | |
font-weight: bold; | |
left: 8px; | |
.units { | |
font-size: 14px; | |
font-weight: normal; | |
vertical-align: super; | |
position: relative; | |
top: -10px; | |
} | |
} | |
.sparkline { | |
position: relative; | |
top: 100px; | |
width: 90%; | |
height: 95px; | |
margin-left: auto; | |
margin-right: auto; | |
line-height: 30px; | |
border: 1px solid hsl(0,0%,90%); | |
background: hsl(0,0%,95%); | |
canvas { | |
width: 100%; | |
height: 85px; | |
} | |
} | |
.diskspace { | |
color: hsl(45,100%,45%); | |
} |
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
<div class="diskspace"> | |
<div class="value"> | |
<span class="text"></span> | |
<sup class="units">%</sup> | |
</div> | |
<div class="sparkline"></div> | |
</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
var sparkDisk = element.find(".diskspace .sparkline"); | |
var dataDisk = []; | |
var sparklineOptions = { | |
width: '100%', | |
height: '95px', | |
chartRangeMin: 0, | |
chartRangeMax: 100, | |
chartRangeMinX: 0, | |
drawNormalOnTop: false, | |
//fillColor: 'hsla(360,100%,100%,1.0)', | |
fillColor: null, | |
tooltipFormat: '<span style="color: {{color}}">●</span> {{y}}%' | |
}; | |
function SetDisk(value) { | |
element.find(".diskspace .value .text").html(value); | |
dataDisk.push(value); | |
sparkDisk.sparkline(dataDisk, sparklineOptions); | |
}; | |
scope.onData = function(data) { | |
var diskVal = data.DA.split('%'); | |
SetDisk(diskVal[0]); | |
}; | |
scope.Widget.settings.name = _.find(scope.Widget.devices, function(device) { return true; }).shortName; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment