-
-
Save elliots/7297678 to your computer and use it in GitHub Desktop.
This file contains 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
// Forked default widget to show live json DA. | |
return { | |
"name": "Default Widget", | |
"deviceMap": [ | |
{ minimum: "1", maximum:"1" } | |
] | |
} |
This file contains 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
h4 { | |
color: rgba(0,0,0,0.3); | |
font-size: 15px; | |
margin: 10px 10px; | |
} | |
.deviceInfo { | |
width: 90%; | |
margin: 0 auto; | |
font-size: 10px; | |
tr { | |
th, td { | |
border-collapse: collapse; | |
border: 1px solid rgba(0,0,0,0.1); | |
padding: 3px; | |
} | |
th { | |
text-align: left !important; | |
font-weight: bold; | |
width: 80px; | |
} | |
} | |
} |
This file contains 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
<br><br> | |
<h4 class="title"></h4> | |
<table class="deviceInfo"> | |
<tr> | |
<th>node</th> | |
<td class="node"></td> | |
</tr> | |
<tr> | |
<th>vendor:device</th> | |
<td><span class="vendorId"></span>:<span class="deviceId"></span></td> | |
</tr> | |
<tr> | |
<th>vendorId</th> | |
<td class="vendorId"></td> | |
</tr> | |
<tr> | |
<th>group</th> | |
<td class="group"></td> | |
</tr> | |
<tr> | |
<th>lastData</th> | |
<td class="lastData"></td> | |
</tr> | |
</table> |
This file contains 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
scope.onData = function(data) { | |
element.find(".lastData").html(JSON.stringify(data.DA)); | |
}; | |
var firstDevice = _.find(scope.Widget.devices, function(device) { return true; }); | |
element.find(".title").html(firstDevice.shortName); | |
element.find(".node").html(firstDevice.node); | |
element.find(".deviceId").html(firstDevice.did); | |
element.find(".vendorId").html(firstDevice.vid); | |
element.find(".group").html(firstDevice.gid); | |
element.find(".lastData").html(firstDevice.last_data.DA); | |
scope.Widget.settings.name = firstDevice.shortName; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment