Admin is functioning — Displays Servers that are connected with in/out bytes.

This commit is contained in:
Henry Camacho 2017-03-15 19:32:05 -05:00
parent 129e7df710
commit 72b4c4598f
3 changed files with 70 additions and 41 deletions

View File

@ -24,7 +24,7 @@
<header class="bs-docs-nav navbar navbar-static-top" id="top">
<div class="container">
<div class="navbar-header">
<a href="/admin/index.html" class="navbar-brand">RVPN Admin</a>
<a href="/admin/index.html" target="_parent" class="navbar-brand">RVPN Admin</a>
</div>
<nav class="collapse navbar-collapse" id="bs-navbar">
<ul class="nav navbar-nav">
@ -43,18 +43,8 @@
</div>
</header>
<div class="panel panel-default">
<div class="panel-heading"></div>
<div class="panel-body">
<div class="panel panel-default panel-info">
<!-- Partials here -->
<div ng-view> </div>
<div ng-view></div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
<script>window.jQuery || document.write('<script src="admin/js/vendor/jquery-1.12.0.min.js"><\/script>')</script>

View File

@ -1,13 +1,15 @@
console.log("app.sh startup")
var app = angular.module("rvpnApp", ["ngRoute"]);
app.config(function($routeProvider, $locationProvider) {
$routeProvider
.when("/admin/servers", {
.when("/admin/index.html", {
templateUrl : "admin/partials/servers.html"
})
.when("/admin/domains", {
.when("/admin/servers/", {
templateUrl : "admin/partials/servers.html"
})
.when("/admin/#domains", {
templateUrl : "green.htm"
})
.when("/blue", {
@ -15,3 +17,28 @@ app.config(function($routeProvider, $locationProvider) {
});
$locationProvider.html5Mode(true);
});
app.controller('serverController', function ($scope, $http) {
$scope.servers = [];
var api = '/api/com.daplie.rvpn/servers'
$http.get(api).then(function(response) {
updateView(response.data);
});
updateView = function(data) {
console.log(data);
if (data.error == 'ok' ){
console.log("ok")
$scope.servers = data.result.servers;
console.log(data.result)
}
};
});

View File

@ -1,29 +1,41 @@
<div class="panel-heading ">Control Plane</div>
<div class="panel-body">
<div class="row"> <!-- Auth -->
<div class="col-lg-6">
<div class="input-group">
<span class="input-group-btn">
<button class="btn btn-default" type="button" ng-click="startWebSocket()">Start WebSocket</button>
</span>
<button class="btn btn-default" type="button" ng-class="conn == false && 'btn-danger' || 'btn-success'">
{[{ conn == false && 'False' || 'True' }]}
</button>
</div>
</div>
</div>
<br>
<div class="panel panel-default" data-ng-controller="serverController">
<div class="panel-heading">
<div class="panel-title">
<div class="row">
<div class="col-lg-6">
<div class="input-group">
<span class="input-group-btn">
<button class="btn btn-default" type="button">Auth</button>
</span>
<input type="text" class="form-control" placeholder="Enter auth data here">
<div class="col-md-6">
Servers
</div>
<div class="col-md-6">
<form class="form-inline pull-right">
<div class="form-group">
<label for="search">Search:</label>
<input type="text" class="form-control" id="search">
</div>
</form>
</div>
</div>
</div>
</div>
<div class="panel-body">
<table class="table table-striped table-bordered">
<th width="10%">ID</th>
<th width="20%">Name</th>
<th>Address</th>
<th>Xfer (in/out)</th>
<th>Time</th>
<tr ng-repeat="s in servers | orderBy:'server_id'">
<td>{{ s.server_id }}</td>
<td>{{ s.server_name }}</td>
<td>{{ s.source_address }}</td>
<td>{{ s.bytes_in }}/{{ s.bytes_out}}</td>
<td>{{ s.duration }}</td>
</tr>
</table>
</div>
</div>