Files
stf-DeviceFarmer/res/app/control-panes/dashboard/shell/shell-controller.js
2016-01-19 23:08:33 +09:00

31 lines
638 B
JavaScript

module.exports = function ShellCtrl($scope) {
$scope.result = null
$scope.run = function(command) {
if (command === 'clear') {
$scope.clear()
return
}
$scope.command = ''
return $scope.control.shell(command)
.progressed(function(result) {
$scope.result = result
$scope.data = result.data.join('')
$scope.$digest()
})
.then(function(result) {
$scope.result = result
$scope.data = result.data.join('')
$scope.$digest()
})
}
$scope.clear = function() {
$scope.command = ''
$scope.data = ''
$scope.result = null
}
}