Merge pull request #3 from alexfriesen/gh-pages

Server Info Page and Player Kick function
This commit is contained in:
Garry Newman
2016-05-01 07:43:05 +01:00
7 changed files with 153 additions and 32 deletions
+16
View File
@@ -13,6 +13,8 @@
<table> <table>
<thead> <thead>
<tr> <tr>
<th>Actions</th>
<th ng-click="Order( 'DisplayName' )" ng-class="SortClass( 'DisplayName' )">Username</th> <th ng-click="Order( 'DisplayName' )" ng-class="SortClass( 'DisplayName' )">Username</th>
<th style="text-align: right" ng-click="Order( 'SteamID' )" ng-class="SortClass( 'SteamID' )">Steamid</th> <th style="text-align: right" ng-click="Order( 'SteamID' )" ng-class="SortClass( 'SteamID' )">Steamid</th>
<th style="text-align: right" ng-click="Order( 'VoiationLevel' )" ng-class="SortClass( 'VoiationLevel' )">Voilation</th> <th style="text-align: right" ng-click="Order( 'VoiationLevel' )" ng-class="SortClass( 'VoiationLevel' )">Voilation</th>
@@ -24,6 +26,20 @@
</tr> </tr>
</thead> </thead>
<tr ng-repeat="line in Players | orderBy: OrderBy | filter:FilterText" href="#/{{address}}/player/{{line.SteamID}}/"> <tr ng-repeat="line in Players | orderBy: OrderBy | filter:FilterText" href="#/{{address}}/player/{{line.SteamID}}/">
<td>
<div class="btn-group">
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="glyphicon glyphicon-cog"></span> <span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li>
<a href ng-click="KickPlayer(line.SteamID)">Kick</a>
</li>
</ul>
</div>
</td>
<td> <td>
<a href="#/{{address}}/player/{{line.SteamID}}/">{{line.DisplayName}}</a> <a href="#/{{address}}/player/{{line.SteamID}}/">{{line.DisplayName}}</a>
</td> </td>
+75
View File
@@ -0,0 +1,75 @@
<div ng-controller="ServerInfoController" flex layout="column" id="ServerInfoController">
<div class="row">
<div class="col-lg-12">
<h2 class="center">
{{info.Hostname}}
<div class="btn-group pull-right">
<button ng-click="Refresh()" class="btn btn-default" type="button"><i class="glyphicon glyphicon-refresh"></i></button>
</div>
</h2>
</div>
<div class="col-lg-4">
<div class="container">
<p>Map: {{info.Map}}</p>
</div>
</div>
<div class="col-lg-4">
<div class="container">
<p>Max Players: {{info.MaxPlayers}}</p>
</div>
</div>
<div class="col-lg-4">
<div class="container">
<p>GameTime: {{info.GameTime}}</p>
</div>
</div>
<div class="col-lg-4">
<div class="container">
<p>Framerate: <span class="badge">{{info.Framerate}}</span></p>
</div>
</div>
<div class="col-lg-4">
<div class="container">
<p>EntityCount: <span class="badge">{{info.EntityCount}}</span></p>
</div>
</div>
<div class="col-lg-4">
<div class="container">
<p>Uptime: <span class="badge">{{info.Uptime}}s</span></p>
</div>
</div>
<div class="col-lg-4">
<div class="container">
<p>Players: <span class="badge">{{info.Players}}</span></p>
</div>
</div>
<div class="col-lg-4">
<div class="container">
<p>Joining: <span class="badge">{{info.Joining}}</span></p>
</div>
</div>
<div class="col-lg-4">
<div class="container">
<p>Queued: <span class="badge">{{info.Queued}}</span></p>
</div>
</div>
</div>
<div class="right row">
</div>
</div>
+32 -32
View File
@@ -5,10 +5,10 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Websocket Rcon</title> <title>Websocket Rcon</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.8.2/nv.d3.min.css" rel="stylesheet"> <link href="https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.8.2/nv.d3.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.css" rel="stylesheet"> <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap-theme.css" rel="stylesheet"> <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap-theme.css" rel="stylesheet">
<link href="rcon.css" rel="stylesheet"> <link href="rcon.css" rel="stylesheet">
</head> </head>
<body ng-controller="RconController"> <body ng-controller="RconController">
@@ -27,44 +27,44 @@
</div> </div>
<div class="col-sm-10" ng-show="Connected" > <div class="col-sm-10" ng-show="Connected">
<h1 class="page-header">{{$route.current.Title}}</h1> <h1 class="page-header">{{$route.current.Title}}</h1>
<div class="row" ng-view></div> <div class="row" ng-view></div>
</div> </div>
</div> </div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- AngularJS -->
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-route.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-animate.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-aria.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-messages.min.js"></script>
<!-- Bootstrap -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.js"></script>
<!-- For charts -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.16/d3.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.8.2/nv.d3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-nvd3/1.0.5/angular-nvd3.min.js"></script>
<!-- Data manipulation -->
<script src="js/linq.min.js"></script>
<!-- Our stuff --> <!-- AngularJS -->
<script src="js/rconService.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script src="js/app.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-route.min.js"></script>
<script src="js/connection.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-animate.min.js"></script>
<script src="js/console.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-aria.min.js"></script>
<script src="js/playerlist.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-messages.min.js"></script>
<script src="js/playerInfo.js"></script>
<script src="js/playerXp.js"></script> <!-- Bootstrap -->
<script src="js/chat.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.js"></script>
<!-- For charts -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.16/d3.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.8.2/nv.d3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-nvd3/1.0.5/angular-nvd3.min.js"></script>
<!-- Data manipulation -->
<script src="js/linq.min.js"></script>
<!-- Our stuff -->
<script src="js/rconService.js"></script>
<script src="js/app.js"></script>
<script src="js/connection.js"></script>
<script src="js/serverInfo.js"></script>
<script src="js/console.js"></script>
<script src="js/playerlist.js"></script>
<script src="js/playerInfo.js"></script>
<script src="js/playerXp.js"></script>
<script src="js/chat.js"></script>
</body> </body>
</html> </html>
+1
View File
@@ -7,6 +7,7 @@ app.service( 'rconService', [RconService] );
app.config( function ( $routeProvider ) app.config( function ( $routeProvider )
{ {
$routeProvider.when( "/home", { Title: "Home" } ) $routeProvider.when( "/home", { Title: "Home" } )
$routeProvider.when( "/:address/info", { Title: "Server", templateUrl: "html/serverInfo.html", Nav: true } )
$routeProvider.when( "/:address/console", { Title: "Console", templateUrl: "html/console.html", Nav: true } ) $routeProvider.when( "/:address/console", { Title: "Console", templateUrl: "html/console.html", Nav: true } )
$routeProvider.when( "/:address/chat", { Title: "Chat", templateUrl: "html/chat.html", Nav: true } ) $routeProvider.when( "/:address/chat", { Title: "Chat", templateUrl: "html/chat.html", Nav: true } )
$routeProvider.when( "/:address/playerlist", { Title: "Player List", templateUrl: "html/playerlist.html", Nav: true } ) $routeProvider.when( "/:address/playerlist", { Title: "Player List", templateUrl: "html/playerlist.html", Nav: true } )
+2
View File
@@ -20,6 +20,8 @@ function ConnectionController( $scope, rconService, $routeParams, $timeout, $loc
$scope.LastErrorMessage = null; $scope.LastErrorMessage = null;
rconService.Connect( $scope.Address, $scope.Password ); rconService.Connect( $scope.Address, $scope.Password );
$location.path('/' + $scope.Address + '/info');
} }
$scope.ConnectTo = function ( c ) $scope.ConnectTo = function ( c )
+7
View File
@@ -32,6 +32,13 @@ function PlayerListController( $scope, rconService, $interval )
return null; return null;
} }
$scope.KickPlayer = function ( id )
{
rconService.Command( 'kick ' + id );
$scope.Refresh();
}
rconService.InstallService( $scope, $scope.Refresh ) rconService.InstallService( $scope, $scope.Refresh )
var timer = $interval( function () var timer = $interval( function ()
+20
View File
@@ -0,0 +1,20 @@
app.controller( 'ServerInfoController', ServerInfoController );
function ServerInfoController( $scope, rconService, $routeParams )
{
$scope.info = {};
$scope.Refresh = function ()
{
rconService.Request( 'serverinfo', $scope, function ( msg )
{
$scope.info = JSON.parse( msg.Message );
// $scope.Players = JSON.parse( msg.Message );
console.log($scope.info);
});
}
rconService.InstallService( $scope, $scope.Refresh );
}