Skip to content

Commit

Permalink
ls
Browse files Browse the repository at this point in the history
  • Loading branch information
padsbanger committed Nov 5, 2015
1 parent 3e5eadd commit 28688fb
Show file tree
Hide file tree
Showing 9 changed files with 843 additions and 12 deletions.
3 changes: 1 addition & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ module.exports = function(grunt) {
},
libs: {
src: [
'libs/angular/angular.js',
'libs/angular-route/angular-route.js'
'libs/angular.min.js',
],
dest: 'js/build/libs.js'
},
Expand Down
Binary file added img/bg.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 19 additions & 9 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,24 @@
<link rel="stylesheet" href="styles/css/styles.css">
</head>

<body>
<div class="container" ng-controller="mainController">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<body ng-controller="terminalCtrl">
<img src="img/bg.jpg">
<div id="pipboy">
<span ng-repeat="command in commands">
{{::command.name}}
</span>
<div>
{{::commandToType}}
</div>
<div class="terminalInput">
<span class="logo">[~]</span>
<span class="user">$</span>
<form name="terminal" ng-submit="execute(commandToType)">
<input type="text" ng-model="commandToType" palceholder="For list of avaiable commands type help" autofocus required />
</form>

</div>

</div>
<script src="js/build/libs.js"></script>
<script src="js/src/app.js"></script>
Expand All @@ -27,4 +37,4 @@
<script src="js/build/services.js"></script>
</body>

</html>
</html>
1 change: 1 addition & 0 deletions js/src/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var pipboy = angular.module('pipboy', []);
45 changes: 45 additions & 0 deletions js/src/controllers/terminalCtrl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
'use strict';

pipboy.controller('terminalCtrl', ['$scope', 'CommandService', function($scope, CommandService ) {


$scope.commandToType = '';
$scope.commands = '';

CommandService.sendCommand('ls', '0').then(function(data){
// angular.copy(data.data.items, $scope.commands)
$scope.commands = data.data.items
})


function splitCommand(commandString) {
var command = commandString.split(" ")

return command;
}

$scope.execute = function(commandToType) {

var command = splitCommand(commandToType)[0]
var target = splitCommand(commandToType)[1]

console.log(target, command)

for(var prop in $scope.commands) {
if(target === $scope.commands[prop].name ) {

target = prop;
console.log('eureka')
}
console.log($scope.commands[prop])
}


CommandService.sendCommand(command, target).then(function(data){
// angular.copy(data.data.items, $scope.commands)
$scope.commands = data.data.items
})


}
}]);
17 changes: 17 additions & 0 deletions js/src/services/commandService.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use strict';

pipboy.factory('CommandService', [ '$http',
function($http) {

var api = 'http://localhost:8080/api/'

return {
sendCommand: function(command, param) {
return $http({
method: 'GET',
url: api+command + '/'+param
})
}
};
}
]);
294 changes: 294 additions & 0 deletions libs/angular.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 28688fb

Please sign in to comment.