api/assets/javascripts/artoo/controllers/robot.js.coffee in artoo-0.1.2 vs api/assets/javascripts/artoo/controllers/robot.js.coffee in artoo-0.1.3
- old
+ new
@@ -1,5 +1,7 @@
+window.driversWithOutput = ["Pinger", "Pinger2", "ardrone_navigation", "wiiclassic"]
+
@RobotIndexCtrl = ($scope, $http, $location, $route) ->
$http.get('/robots').success (data)->
$scope.robots = data
$scope.robotDetail = (robotId) ->
$location.path "/robots/" + robotId
@@ -11,16 +13,18 @@
$scope.getDeviceDetail = (deviceId) ->
$http.get('/robots/' + $scope.robot.name + "/devices/" + deviceId).success (data)->
$scope.deviceDetail = data
device.console()
+ $scope.driverHasOutput = (driverId)->
+ true if $.inArray(driverId, window.driversWithOutput) != -1
+
device = console: ->
window.ws.close() if window.ws
window.ws = new WebSocket("ws://localhost:4321/robots/" + $scope.robot.name + "/devices/" + $scope.deviceDetail.name + "/events")
$(".console code").empty()
ws.onmessage = (evt)->
$(".console code").prepend(evt.data + "\n")
-
$scope.isConnected = (connection) ->
"connected" if connection && connection.connected