rconService.getUsers() will get and parse the userdata
PlayerInfo displays Info and provide a link to steam profile Dropdown in the Playerlist offers more options the selected Player
This commit is contained in:
+41
-3
@@ -1,9 +1,47 @@
|
||||
|
||||
<div ng-controller="PlayerInfoController" flex layout="column" id="PlayerInfoController">
|
||||
|
||||
Info about player {{userid}}
|
||||
<div class="row">
|
||||
|
||||
<p>View <a href="#/{{address}}/player/{{userid}}/xp">XP info for this player</a></p>
|
||||
Show info about this player here
|
||||
<div class="col-lg-12">
|
||||
|
||||
<h2 class="center">
|
||||
Player: {{getUsername()}}
|
||||
<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 class="btn-group btn-group-lg btn-group-justified">
|
||||
<div class="btn-group">
|
||||
<a href="#/{{address}}/player/{{userid}}/xp" class="btn btn-default">
|
||||
<span class="glyphicon glyphicon-education"></span>
|
||||
XP Info
|
||||
</a>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<a href="http://www.steamcommunity.com/profiles/{{userid}}" target="_blank" class="btn btn-default">
|
||||
<span class="glyphicon glyphicon-info-sign"></span>
|
||||
Steam Profile
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-lg-12">
|
||||
<h2 class="center">
|
||||
Info
|
||||
</h2>
|
||||
|
||||
<div class="alert alert-warning" ng-show="!info">
|
||||
This Player is currently not connected to this server!
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-4" ng-repeat="(key, value) in info">
|
||||
<p>{{key}}: <span class="badge">{{value}}</span></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
+17
-1
@@ -33,8 +33,24 @@
|
||||
<span class="glyphicon glyphicon-cog"></span> <span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li>
|
||||
<a href="#/{{address}}/player/{{line.SteamID}}/xp">
|
||||
<span class="glyphicon glyphicon-education"></span>
|
||||
XP Info
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href ng-click="KickPlayer(line.SteamID)">Kick</a>
|
||||
<a href="http://www.steamcommunity.com/profiles/{{line.SteamID}}" target="_blank">
|
||||
<span class="glyphicon glyphicon-info-sign"></span>
|
||||
Steam Profile
|
||||
</a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
<li>
|
||||
<a href ng-click="KickPlayer(line.SteamID)">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
Kick
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -4,4 +4,36 @@ app.controller( 'PlayerInfoController', PlayerInfoController );
|
||||
function PlayerInfoController( $scope, rconService, $routeParams )
|
||||
{
|
||||
$scope.userid = $routeParams.userid;
|
||||
|
||||
$scope.info = null;
|
||||
|
||||
$scope.refresh = function ()
|
||||
{
|
||||
rconService.getUsers($scope, function(users) {
|
||||
|
||||
for(var i in users) {
|
||||
if(users[i].SteamID === $scope.userid){
|
||||
|
||||
// set player data
|
||||
$scope.info = users[i];
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// info not found
|
||||
$scope.info = null;
|
||||
});
|
||||
}
|
||||
|
||||
$scope.getUsername = function ()
|
||||
{
|
||||
if($scope.info && $scope.info.DisplayName) {
|
||||
return $scope.info.DisplayName;
|
||||
}
|
||||
|
||||
return $scope.userid;
|
||||
}
|
||||
|
||||
rconService.InstallService( $scope, $scope.refresh )
|
||||
}
|
||||
+3
-3
@@ -3,14 +3,14 @@ app.controller( 'PlayerListController', PlayerListController );
|
||||
|
||||
function PlayerListController( $scope, rconService, $interval )
|
||||
{
|
||||
$scope.Output = new Array();
|
||||
$scope.Output = [];
|
||||
$scope.OrderBy = '-ConnectedSeconds';
|
||||
|
||||
$scope.Refresh = function ()
|
||||
{
|
||||
rconService.Request( "playerlist", $scope, function ( msg )
|
||||
rconService.getUsers($scope, function ( users )
|
||||
{
|
||||
$scope.Players = JSON.parse( msg.Message );
|
||||
$scope.Players = users;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+14
-3
@@ -1,9 +1,9 @@
|
||||
|
||||
function RconService()
|
||||
{
|
||||
var s = {};
|
||||
|
||||
s.Callbacks = {};
|
||||
var s = {
|
||||
Callbacks: {}
|
||||
};
|
||||
|
||||
s.Connect = function ( addr, pass )
|
||||
{
|
||||
@@ -102,5 +102,16 @@ function RconService()
|
||||
}
|
||||
}
|
||||
|
||||
s.getUsers = function(scope, success) {
|
||||
this.Request( "playerlist", scope, function ( response )
|
||||
{
|
||||
var players = JSON.parse( response.Message );
|
||||
|
||||
if(typeof success === 'function') {
|
||||
success.call(scope, players);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
Reference in New Issue
Block a user