Sha256: f8073e73813ed263e622e077bd53d4c6bdab7d19ed85c2c8cf17890e4cb58e3e

Contents?: true

Size: 961 Bytes

Versions: 2

Compression:

Stored size: 961 Bytes

Contents

var RobotCommandsCtrl = function RobotCommandsCtrl($scope, $http) {
  $scope.command = "";
  $scope.types = [ 'string', 'boolean', 'number' ];

  $scope.isDisabled = function() {
    return ($scope.command === "")
  };

  $scope.addParam = function(last) {
    console.log("HEY");
    if (!last) { return; }
    $scope.robot.params.push({ name: '', value: '', type: 'string' });
  };

  $scope.removeParam = function(index) {
    if ($scope.robot.params.length === 1) { return; }
    $scope.robot.params.splice(index, 1);
  };

  $scope.submit = function() {
    var robot = $scope.robot.name,
        command = $scope.command,
        params = parseParams($scope.robot.params);

    var url ='/robots/' + robot + "/commands/" + command;

    $http.post(url, params).success(function(data) {
      if (data.result) {
        if ($scope.robot.results.length > 4) { $scope.robot.results.pop(); }
        $scope.robot.results.unshift(data);
      }
    });
  };
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
robeaux-0.1.1 js/controllers/robot_commands_ctrl.js
robeaux-0.1.0 js/controllers/robot_commands_ctrl.js