Added logs

This commit is contained in:
Martin Schröder 2015-05-21 11:39:36 +02:00 committed by Martin Schröder
parent 69d15acd73
commit 7194e647a2
21 changed files with 131 additions and 44 deletions

View file

@ -171,7 +171,7 @@
"fw_check_url": { dvalue: "", type: String, required: false},
"fw_path_url": { dvalue: "", type: String, required: false},
"fw_find_ext": { dvalue: "", type: String, required: false},
"fw_down_path": { dvalue: "", type: String, required: false}
"fw_upload_path": { dvalue: "", type: String, required: false}
}
},
"voice_client": {

View file

@ -10,7 +10,7 @@ $juci.module("core")
.directive("luciConfigSection", function(){
var plugin_root = $juci.module("core").plugin_root;
return {
template: '<div class="luci-config-section" ng-transclude></div>',
template: '<div><div class="luci-config-section" ng-transclude></div><hr style="width: 100%; border-bottom: 1px solid #ccc; clear: both;"/></div>',
replace: true,
transclude: true
};
@ -34,7 +34,7 @@ $juci.module("core")
.directive("luciConfigLines", function(){
var plugin_root = $juci.module("core").plugin_root;
return {
template: '<div class="table" ><div ng-transclude></div><hr style="width: 100%; border-bottom: 1px solid #ccc; clear: both;"/></div>',
template: '<div class="table" ><div ng-transclude></div></div>',
replace: true,
transclude: true
};

View file

@ -1,7 +1,25 @@
<luci-layout-with-sidebar>
<div ng-controller="StatusNATPageCtrl">
<luci-config-section>
<luci-config-heading>{{ 'Nat table' | translate }}</luci-config-heading>
<luci-config-heading>{{ 'Connections for each Device' | translate }}</luci-config-heading>
<luci-config-info>{{ 'status.nat.connections.info' | translate }}</luci-config-info>
<table class="table" style="font-size: 12px;">
<thead >
<th>#</th>
<th>Hostname</th>
<th style="text-align: center;">IP</th>
<th style="text-align: center;">Nr. of Connections</th>
</thead>
<tr ng-repeat="cl in clients track by $index">
<td>{{$index}}</td>
<td>{{cl.hostname}}</td>
<td style="text-align: center;">{{cl.ipaddr}}</td>
<td style="text-align: center;">{{cl.active_cons||0}}</td>
</tr>
</table>
</luci-config-section>
<luci-config-section>
<luci-config-heading>{{ 'NAT Connection Table' | translate }}</luci-config-heading>
<luci-config-info>{{ 'status.nat.info' | translate }}</luci-config-info>
<table class="table" style="font-size: 12px">
<thead>

View file

@ -1,5 +1,14 @@
JUCI.app
.controller("StatusNATPageCtrl", function($scope, $rpc){
$rpc.router.clients().done(function(table){
var clients = [];
Object.keys(table).map(function(x){
var cl = table[x];
if(cl.connected) clients.push(cl);
});
$scope.clients = clients;
$scope.$apply();
});
$rpc.luci2.network.conntrack_table().done(function(table){
if(table && table.entries){
$scope.connections = table.entries.sort(function(a, b){ return (a.src+a.dest) < (b.src+b.dest); }).map(function(x){

View file

@ -1,4 +1,6 @@
$juci.module("settings")
//! Author: Martin K. Schröder <mkschreder.uk@gmail.com>
JUCI.app
.controller("SettingsConfigurationCtrl", function($scope, $rpc, $session){
$scope.sessionID = $session.sid;
$scope.resetPossible = 0;

View file

@ -1,4 +1,6 @@
$juci.module("settings")
//! Author: Martin K. Schröder <mkschreder.uk@gmail.com>
JUCI.app
.controller("SettingsEnergyCtrl", function($scope, $uci){
$uci.sync(["boardpanel"]).done(function(){
if($uci.boardpanel)

View file

@ -1,4 +1,6 @@
$juci.module("settings")
//! Author: Martin K. Schröder <mkschreder.uk@gmail.com>
JUCI.app
.controller("SettingsNetworkCtrl", function($scope){
});

View file

@ -1,4 +1,6 @@
$juci.module("settings")
//! Author: Martin K. Schröder <mkschreder.uk@gmail.com>
JUCI.app
.controller("SettingsPasswordCtrl", function($scope, $rpc, $tr, $session, gettext){
$scope.showPassword = 0;
$scope.showModal = 0;

View file

@ -1,4 +1,6 @@
$juci.module("settings")
//! Author: Martin K. Schröder <mkschreder.uk@gmail.com>
JUCI.app
.controller("SettingsUCIController", function($scope, $rpc){
var configs = {};
$scope.loading = 0;

View file

@ -108,7 +108,7 @@
};
})( jQuery);
$juci.module("settings")
JUCI.app
.controller("SettingsUpgradeCtrl", function($scope, $uci, $rpc, $session){
$scope.sessionID = $session.sid;
$scope.uploadFilename = "/tmp/firmware.bin";

View file

@ -1,4 +1,6 @@
$juci.module("status")
//! Author: Martin K. Schröder <mkschreder.uk@gmail.com>
JUCI.app
.controller("StatusAbout", function($scope){
});

View file

@ -1,8 +1,9 @@
<luci-layout-with-sidebar>
<div ng-controller="StatusDiagnostics">
<luci-config-heading>{{ 'Diagnostic Utility' | translate }}</luci-config-heading>
<luci-config-info>{{ 'status.diagnostics.info' | translate }}</luci-config-info>
<luci-config-section>
<luci-config-heading>{{ 'Diagnostic Utility' | translate }}</luci-config-heading>
<luci-config-info>{{ 'status.diagnostics.info' | translate }}</luci-config-info>
<h3>{{'Automated Diagnostics'|translate}}</h3>
<p>{{'status.diagnostics.auto.info'|translate}}</p>
<luci-config-lines>
@ -10,6 +11,8 @@
<button class="btn btn-lg btn-default">{{'Diagnose'|translate}}</button>
</luci-config-line>
</luci-config-lines>
</luci-config-section>
<luci-config-section>
<h3>{{'Ping Test'|translate}}</h3>
<p>{{'status.diagnostics.ping.info'|translate}}</p>
<div class="row">
@ -20,21 +23,18 @@
</div>
<div class="alert alert-default" ng-show="data.pingResults">{{'Ping results'|translate}}: <br/><pre>{{data.pingResults}}</pre></div>
<div class="alert alert-danger" ng-show="data.pingError">{{'Error'|translate}}: <br/><pre>{{data.pingError}}</pre></div>
</luci-config-section>
<luci-config-section>
<h3>{{'Tracing Tool'|translate}}</h3>
<p>{{'status.diagnostics.trace.info'|translate}}</p>
<luci-config-lines>
<luci-config-line title="{{'Interface to use'|translate}}">
<luci-dropdown type="button" placeholder="{{'Pick interface'|translate}}" ng-model="data.allInterfaces" ng-selected="data.traceInterface"/>
</luci-config-line>
</luci-config-lines>
<div class="row">
<form class="form-inline form-group pull-right">
<input type="text" class="form-control input-lg" placeholder="{{'Host to trace'|translate}}" ng-model="data.traceHost"></input>
<button type="submit" class="btn btn-lg btn-default" ng-click="onTraceTest()">{{'Trace'|translate}}</button>
</form>
</div>
<div class="alert alert-default" ng-show="data.traceResults">{{'Trace results'|translate}}: <br/><pre>{{data.traceResults}}</pre></div>
<div class="alert alert-danger" ng-show="data.traceError">{{'Error'|translate}}: <br/><pre>{{data.traceError}}</pre></div>
</luci-config-section>
</div>
</luci-layout-with-sidebar>

View file

@ -1,26 +1,24 @@
$juci.module("status")
//! Author: Martin K. Schröder <mkschreder.uk@gmail.com>
JUCI.app
.controller("StatusDiagnostics", function($scope, $rpc){
$scope.data = {};
$rpc.router.networks().done(function(result){
if(result){
$scope.data.allInterfaces = Object.keys(result).map(function(x){return {label: x, id: x};});
$scope.data.allInterfaces = Object.keys(result).map(function(x){return {label: x, value: x};});
$scope.$apply();
}
});
$scope.onTraceTest = function(){
var item = $scope.data.traceInterface;
if(item && item.id){
console.log("Performing trace on interface "+item.id);
$rpc.luci2.network.traceroute({ data: "google.com" }).done(function(result){
if(result.stderr) $scope.data.traceError = result.stderr;
$scope.data.traceResults = result.stdout;
$scope.$apply();
}).fail(function(error){
$scope.data.traceResults = "";
$scope.data.traceError = JSON.stringify(error);
$scope.$apply();
});
}
$rpc.luci2.network.traceroute({ data: $scope.data.traceHost }).done(function(result){
if(result.stderr) $scope.data.traceError = result.stderr;
$scope.data.traceResults = result.stdout;
$scope.$apply();
}).fail(function(error){
$scope.data.traceResults = "";
$scope.data.traceError = JSON.stringify(error);
$scope.$apply();
});
}
$scope.onPingTest = function(){
$scope.data.pingResults = "...";

View file

@ -17,7 +17,23 @@
<luci-select ng-model="selectedShownType" ng-items="allEventTypes" placeholder="Select events to show"></luci-select>
</luci-config-line>
</luci-config-lines>
</luci-config-section>
<luci-config-section>
<luci-config-heading>{{'Log' | translate}}</luci-config-heading>
<table class="table">
<thead>
<th translate>Date</th>
<th translate>Type</th>
<th translate>Source</th>
<th translate>Message</th>
</thead>
<tr ng-repeat="line in logs track by $index">
<td nowrap>{{line[0]}}</td>
<td>{{line[1]}}</td>
<td>{{line[2]}}</td>
<td>{{line[3]}}</td>
</tr>
</table>
</luci-config-section>
</div>
</luci-layout-with-sidebar>

View file

@ -1,8 +1,29 @@
$juci.module("status")
.controller("StatusEventsPageCtrl", function($scope){
//! Author: Martin K. Schröder <mkschreder.uk@gmail.com>
JUCI.app
.controller("StatusEventsPageCtrl", function($scope, $rpc){
$scope.selectedShowType = "all";
$scope.selectedLogTypes = [];
$rpc.luci2.system.syslog().done(function(result){
if(result && result.log){
$scope.logs = result.log.split("\n").map(function(line){
var fields = line.match(/(\w* \w* \w* \d{2}:\d{2}:\d{2} \d{4}) ([^\s]*) ([^\s:]*): (.*)/);
if(fields){
// remove first one because it is the whole line
fields.shift();
fields[0] = new Date(fields[0]);
}
return fields;
})
.filter(function(x){ return x != null && x[2] != "kernel"; }) // filter out all invalid matches
.reverse() // sort by date in descending order
.map(function(x){ // convert date back to string and shorten it's format
x[0] = x[0].toLocaleFormat("%d-%b-%Y %H:%M:%S");
return x;
});
$scope.$apply();
}
});
$scope.allLogTypes = [
{ label: "System", value: "system" },
{ label: "WAN", value: "wan" },

View file

@ -1,4 +1,6 @@
$juci.module("status")
//! Author: Martin K. Schröder <mkschreder.uk@gmail.com>
JUCI.app
.controller("StatusRestartPageCtrl", function($scope, $rpc){
$scope.onRestart = function(){
$scope.showConfirmation = 1;

View file

@ -1,4 +1,6 @@
$juci.module("status")
//! Author: Martin K. Schröder <mkschreder.uk@gmail.com>
JUCI.app
.controller("StatsCtrl", function($scope, $rpc, $session, gettext, $tr){
$scope.dslstats = {};

View file

@ -1,4 +1,6 @@
$juci.module("status")
//! Author: Martin K. Schröder <mkschreder.uk@gmail.com>
JUCI.app
.controller("StatsOverviewCtrl", function ($scope, $session, $rootScope, $rpc, gettext, $tr) {
$scope.sysinfo = {};
$scope.info = {};
@ -50,7 +52,7 @@ $juci.module("status")
[$tr(gettext("Kernel Version")), info.system.kernel],
[$tr(gettext("Local Time")), new Date(sys.localtime)],
[$tr(gettext("Uptime")), info.system.uptime],
[$tr(gettext("Load Average")), sys.load[0] + " " + sys.load[1] + " " + sys.load[2]]
//[$tr(gettext("Load Average")), sys.load[0] + " " + sys.load[1] + " " + sys.load[2]]
];
$scope.systemExtStatusTbl.rows = [
[$tr(gettext("Wifi")), (info.specs.wifi)?gettext("yes"):gettext("no")],

View file

@ -1,4 +1,6 @@
$juci.module("status")
//! Author: Martin K. Schröder <mkschreder.uk@gmail.com>
JUCI.app
.controller("StatusTVPageCtrl", function($scope, $rpc, gettext){
$rpc.router.igmptable().done(function(result){
if(!result.table) {

View file

@ -1,4 +1,6 @@
$juci.module("status")
//! Author: Martin K. Schröder <mkschreder.uk@gmail.com>
JUCI.app
.controller("StatusVoicePageCtrl", function($scope, $rpc){
$rpc.asterisk.status().done(function(data){
if(data && data.sip){

View file

@ -1,4 +1,7 @@
angular.module("luci").config(function($stateProvider) {
//! Author: Martin K. Schröder <mkschreder.uk@gmail.com>
JUCI.app
.config(function($stateProvider) {
$stateProvider.state("status", {
url: "/status",
onEnter: function($state){