webui: Added ability for users to configure selectable times for graphs (#7193)

* feat:add links for librenms graph

* added widescreen config
This commit is contained in:
yac01
2017-08-25 21:11:01 +02:00
committed by Neil Lathwood
parent 0a5b20c452
commit 38cf424417
5 changed files with 66 additions and 17 deletions

View File

@@ -210,6 +210,44 @@ $config['int_l2tp'] = 0; # Enable L2TP Port Types
```
Enable / disable certain menus from being shown in the WebUI.
You are able to adjust the number and time frames of the quick select time options for graphs and the mini graphs shown per row.
Quick select:
```php
$config['graphs']['mini']['normal'] = array(
'day' => '24 Hours',
'week' => 'One Week',
'month' => 'One Month',
'year' => 'One Year',
);
$config['graphs']['mini']['widescreen'] = array(
'sixhour' => '6 Hours',
'day' => '24 Hours',
'twoday' => '48 Hours',
'week' => 'One Week',
'twoweek' => 'Two Weeks',
'month' => 'One Month',
'twomonth' => 'Two Months',
'year' => 'One Year',
'twoyear' => 'Two Years',
);
```
Mini graphs:
```php
$config['graphs']['row']['normal'] = array(
'sixhour' => '6 Hours',
'day' => '24 Hours',
'twoday' => '48 Hours',
'week' => 'One Week',
'twoweek' => 'Two Weeks',
'month' => 'One Month',
'twomonth' => 'Two Months',
'year' => 'One Year',
'twoyear' => 'Two Years',
);
```
```php
$config['web_mouseover'] = true;
```

View File

@@ -11,14 +11,7 @@ if ($_SESSION['widescreen']) {
$graph_array['width'] = '215';
}
$periods = array(
'sixhour',
'day',
'week',
'month',
'year',
'twoyear',
);
$periods = $config['graphs']['mini']['widescreen'];
} else {
if (!$graph_array['height']) {
$graph_array['height'] = '100';
@@ -28,12 +21,7 @@ if ($_SESSION['widescreen']) {
$graph_array['width'] = '215';
}
$periods = array(
'day',
'week',
'month',
'year',
);
$periods = $config['graphs']['mini']['normal'];
}//end if
if ($_SESSION['screen_width']) {
@@ -53,7 +41,7 @@ $graph_array['height'] = round($graph_array['width'] /2.15);
$graph_array['to'] = $config['time']['now'];
$graph_data = array();
foreach ($periods as $period) {
foreach ($periods as $period => $period_tex) {
$graph_array['from'] = $config['time'][$period];
$graph_array_zoom = $graph_array;
$graph_array_zoom['height'] = '150';

View File

@@ -73,8 +73,7 @@ if (!$auth) {
print_optionbar_start();
$thumb_array = array('sixhour' => '6 Hours', 'day' => '24 Hours', 'twoday' => '48 Hours', 'week' => 'One Week', 'twoweek' => 'Two Weeks',
'month' => 'One Month', 'twomonth' => 'Two Months','year' => 'One Year', 'twoyear' => 'Two Years');
$thumb_array = $config['graphs']['row']['normal'];
echo '<table width=100% class="thumbnail_graph_table"><tr>';

View File

@@ -354,6 +354,28 @@ $config['network_map_legend'] = array(
'100' => '#ff0000',
);
// Default mini graph time options:
$config['graphs']['mini']['widescreen'] = array(
'sixhour' => '6 Hours',
'day' => '24 Hours',
'twoday' => '48 Hours',
'week' => 'One Week',
'twoweek' => 'Two Weeks',
'month' => 'One Month',
'twomonth' => 'Two Months',
'year' => 'One Year',
'twoyear' => 'Two Years',
);
$config['graphs']['mini']['normal'] = array(
'day' => '24 Hours',
'week' => 'One Week',
'month' => 'One Month',
'year' => 'One Year',
);
$config['graphs']['row']['normal'] = $config['graphs']['mini']['widescreen'];
// Network Map Items
$config['network_map_items'] = array('xdp','mac');

View File

@@ -689,6 +689,8 @@ if (isset($_SERVER['HTTPS'])) {
// Set some times needed by loads of scripts (it's dynamic, so we do it here!)
$config['time']['now'] = time();
$config['time']['now'] -= ($config['time']['now'] % 300);
$config['time']['onehour'] = ($config['time']['now'] - 3600);
// time() - (1 * 60 * 60);
$config['time']['fourhour'] = ($config['time']['now'] - 14400);
// time() - (4 * 60 * 60);
$config['time']['sixhour'] = ($config['time']['now'] - 21600);