Admin Option for Ajax Refresh Interval

* Allow admins to change the refresh interval for Ajax calls
 * Only Gauges affected for now

Further Addresses #444 with more goodies
This commit is contained in:
Sebastian Grewe 2013-09-14 19:35:30 +02:00
parent 727ed1f79a
commit b66c3eafec
4 changed files with 22 additions and 8 deletions

View File

@ -95,6 +95,13 @@ $aSettings['website'][] = array(
'name' => 'website_chaininfo_disabled', 'value' => $setting->getValue('website_chaininfo_disabled'),
'tooltip' => 'Enabled or disable the chainfo URL feature. Will remove any links using the chaininfo URL.'
);
$aSettings['statistics'][] = array(
'display' => 'Ajax Refresh Interval', 'type' => 'select',
'options' => array('5' => '5', '10' => '10', '15' => '15', '30' => '30', '60' => '60' ),
'default' => 10,
'name' => 'statistics_ajax_refresh_interval', 'value' => $setting->getValue('statistics_ajax_refresh_interval'),
'tooltip' => 'How often to refresh data via ajax in seconds.'
);
$aSettings['statistics'][] = array(
'display' => 'Block Statistics Count', 'type' => 'text',
'size' => 25,

View File

@ -49,6 +49,9 @@ $iCurrentPoolShareRate = $statistics->getCurrentShareRate();
// Active workers
if (!$iCurrentActiveWorkers = $worker->getCountAllActiveWorkers()) $iCurrentActiveWorkers = 0;
// Some settings to propagate to template
if (! $statistics_ajax_refresh_interval = $setting->getValue('statistics_ajax_refresh_interval')) $statistics_ajax_refresh_interval = 10;
// Small helper array
$aHashunits = array( '1' => 'KH/s', '0.001' => 'MH/s', '0.000001' => 'GH/s' );
@ -70,6 +73,7 @@ $aGlobal = array(
'accounts' => $config['accounts'],
'disable_invitations' => $setting->getValue('disable_invitations'),
'disable_notifications' => $setting->getValue('disable_notifications'),
'statistics_ajax_refresh_interval' => $statistics_ajax_refresh_interval,
'price' => array( 'currency' => $config['price']['currency'] ),
'targetdiff' => $config['difficulty'],
'currency' => $config['currency'],

View File

@ -1,4 +1,4 @@
<article class="module width_half">
<article class="module width_quarter">
<header><h3>Dashboard</h3></header>
<div class="module_content">
<table width="100%">

View File

@ -1,12 +1,15 @@
<article class="module width_half">
<article class="module width_3_quarter">
<header><h3>Gauges</h3></header>
<div class="module_content">
<div id="hashrate" style="width:150px; height:120px; float: left;"></div>
<div id="poolhashrate" style="width:150px; height:120px; float: left;"></div>
<div id="nethashrate" style="width:150px; height:120px; float: left;"></div>
<div id="sharerate" style="width:150px; height:120px; float: left;"></div>
<div id="querytime" style="width:150px; height:120px; float: left;"></div>
<div style="display: inline-block; min-height: 250px;">
<div id="hashrate" style="width:150px; height:120px; float: left;"></div>
<div id="poolhashrate" style="width:150px; height:120px; float: left;"></div>
<div id="nethashrate" style="width:150px; height:120px; float: left;"></div>
<div id="sharerate" style="width:150px; height:120px; float: left;"></div>
<div id="querytime" style="width:150px; height:120px; float: left;"></div>
</div>
</div>
<footer><p style="margin-left: 25px">Refresh interval: {$GLOBAL.config.statistics_ajax_refresh_interval|default:"10"} seconds</p></footer>
</article>
<script>
@ -40,7 +43,7 @@ $(document).ready(function(){
g5.refresh(parseFloat(data.getdashboarddata.datatime).toFixed(2));
}
});
}, 10000);
}, {/literal}{($GLOBAL.config.statistics_ajax_refresh_interval * 1000)|default:"10000"}{literal});
});
{/literal}
</script>