mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
Renamed bandwidth.php to data_usage.php.
Removed unused status_messages.php include in data_usage.php. Use single quote style in bandwidthcharts.js. Signed-off-by: D9ping <D9ping@users.noreply.github.com>
This commit is contained in:
parent
b3d7c06c60
commit
3bf4a74f3b
@ -1,18 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
include_once( 'includes/status_messages.php' );
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate html output for tab with charts and datatables
|
* Generate html for displaying data usage.
|
||||||
* with vnstat bandwidth use information.
|
|
||||||
*/
|
*/
|
||||||
function DisplayBandwidth(&$extraFooterScripts)
|
function DisplayDataUsage(&$extraFooterScripts)
|
||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<div class="panel panel-primary">
|
<div class="panel panel-primary">
|
||||||
<div class="panel-heading"><i class="fa fa-bar-chart fa-fw"></i> <?php echo _("Bandwidth monitoring"); ?></div>
|
<div class="panel-heading"><i class="fa fa-bar-chart fa-fw"></i> <?php echo _("Data usage monitoring"); ?></div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
@ -33,7 +33,7 @@ include_once( 'includes/system.php' );
|
|||||||
include_once( 'includes/configure_client.php' );
|
include_once( 'includes/configure_client.php' );
|
||||||
include_once( 'includes/networking.php' );
|
include_once( 'includes/networking.php' );
|
||||||
include_once( 'includes/themes.php' );
|
include_once( 'includes/themes.php' );
|
||||||
include_once( 'includes/bandwidth.php' );
|
include_once( 'includes/data_usage.php' );
|
||||||
|
|
||||||
$output = $return = 0;
|
$output = $return = 0;
|
||||||
$page = $_GET['page'];
|
$page = $_GET['page'];
|
||||||
@ -158,7 +158,7 @@ $theme_url = 'dist/css/'.htmlspecialchars($theme, ENT_QUOTES);
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if ( RASPI_VNSTAT_ENABLED ) : ?>
|
<?php if ( RASPI_VNSTAT_ENABLED ) : ?>
|
||||||
<li>
|
<li>
|
||||||
<a href="index.php?page=bandwidth"><i class="fa fa-bar-chart fa-fw"></i> <?php echo _("Bandwidth"); ?></a>
|
<a href="index.php?page=data_use"><i class="fa fa-bar-chart fa-fw"></i> <?php echo _("Data usage"); ?></a>
|
||||||
</li>
|
</li>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<li>
|
<li>
|
||||||
@ -214,8 +214,8 @@ $extraFooterScripts = array();
|
|||||||
case "theme_conf":
|
case "theme_conf":
|
||||||
DisplayThemeConfig();
|
DisplayThemeConfig();
|
||||||
break;
|
break;
|
||||||
case "bandwidth":
|
case "data_use":
|
||||||
DisplayBandwidth($extraFooterScripts);
|
DisplayDataUsage($extraFooterScripts);
|
||||||
break;
|
break;
|
||||||
case "system_info":
|
case "system_info":
|
||||||
DisplaySystem();
|
DisplaySystem();
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a bootstrap data table.
|
* Create a jquery bootstrap datatable.
|
||||||
*/
|
*/
|
||||||
function CreateDataTable(placeholder, timeunits) {
|
function CreateDataTable(placeholder, timeunits) {
|
||||||
$("#"+placeholder).append('<table id="tableBandwidth'+timeunits+
|
$("#"+placeholder).append('<table id="tableBandwidth'+timeunits+
|
||||||
@ -31,16 +31,16 @@
|
|||||||
*/
|
*/
|
||||||
function ShowBandwidthChartHandler(e) {
|
function ShowBandwidthChartHandler(e) {
|
||||||
// Remove all morrisjs charts
|
// Remove all morrisjs charts
|
||||||
$("#divChartBandwidthdaily").empty();
|
$('#divChartBandwidthdaily').empty();
|
||||||
$("#divChartBandwidthmonthly").empty();
|
$('#divChartBandwidthmonthly').empty();
|
||||||
// Remove all datatables
|
// Remove all datatables
|
||||||
$("#divTableBandwidthdaily").empty();
|
$('#divTableBandwidthdaily').empty();
|
||||||
$("#divTableBandwidthmonthly").empty();
|
$('#divTableBandwidthmonthly').empty();
|
||||||
// Construct ajax uri for getting the proper data.
|
// Construct ajax uri for getting the proper data.
|
||||||
var timeunit = $("ul#tabbarBandwidth li.active a").attr("href").substr(1);
|
var timeunit = $('ul#tabbarBandwidth li.active a').attr('href').substr(1);
|
||||||
var uri = 'ajax/bandwidth/get_bandwidth.php?';
|
var uri = 'ajax/bandwidth/get_bandwidth.php?';
|
||||||
uri += 'inet=';
|
uri += 'inet=';
|
||||||
uri += encodeURIComponent($("#cbxInterface"+timeunit+" option:selected").text());
|
uri += encodeURIComponent($('#cbxInterface'+timeunit+' option:selected').text());
|
||||||
uri += '&tu=';
|
uri += '&tu=';
|
||||||
uri += encodeURIComponent(timeunit.substr(0, 1));
|
uri += encodeURIComponent(timeunit.substr(0, 1));
|
||||||
var datasizeunits = 'mb';
|
var datasizeunits = 'mb';
|
||||||
@ -54,23 +54,24 @@
|
|||||||
url: uri,
|
url: uri,
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
beforeSend: function() {
|
beforeSend: function() {
|
||||||
$("#divLoaderBandwidth"+timeunit).removeClass("hidden");
|
$('#divLoaderBandwidth'+timeunit).removeClass('hidden');
|
||||||
}
|
}
|
||||||
}).done(function(jsondata) {
|
}).done(function(jsondata) {
|
||||||
$("#divLoaderBandwidth"+timeunit).addClass("hidden");
|
$('#divLoaderBandwidth'+timeunit).addClass('hidden');
|
||||||
barchart.setData(jsondata);
|
barchart.setData(jsondata);
|
||||||
$('#tableBandwidth'+timeunit).DataTable({
|
$('#tableBandwidth'+timeunit).DataTable({
|
||||||
searching: false,
|
'searching': false,
|
||||||
paging: false,
|
'paging': false,
|
||||||
data: jsondata,
|
'data': jsondata,
|
||||||
columns: [
|
'order': [[ 0, 'ASC' ]],
|
||||||
{ "data": "date" },
|
'columns': [
|
||||||
{ "data": "rx", "title": _t['send']+' '+datasizeunits.toUpperCase() },
|
{ 'data': 'date' },
|
||||||
{ "data": "tx", "title": _t['receive']+' '+datasizeunits.toUpperCase() }]
|
{ 'data': 'rx', "title": _t['send']+' '+datasizeunits.toUpperCase() },
|
||||||
|
{ 'data': 'tx', "title": _t['receive']+' '+datasizeunits.toUpperCase() }]
|
||||||
});
|
});
|
||||||
}).fail(function(xhr, textStatus) {
|
}).fail(function(xhr, textStatus) {
|
||||||
if (window.console) {
|
if (window.console) {
|
||||||
console.error("server error");
|
console.error('server error');
|
||||||
} else {
|
} else {
|
||||||
alert("server error");
|
alert("server error");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user