Minor corrections to memory bootgrid

This commit is contained in:
Rosiak
2015-06-04 00:08:53 +02:00
parent f9322a29c6
commit 250b58ea8b
2 changed files with 9 additions and 6 deletions

View File

@ -31,8 +31,8 @@ $sql = "SELECT * $sql";
foreach (dbFetchRows($sql,$param) as $mempool) { foreach (dbFetchRows($sql,$param) as $mempool) {
$perc = round($mempool['mempool_perc'], 0); $perc = round($mempool['mempool_perc'], 0);
$total = formatStorage($mempool['mempool_total']); $total = formatStorage($mempool['mempool_total']);
$used = formatStorage($mempool['mempool_used']);
$free = formatStorage($mempool['mempool_free']); $free = formatStorage($mempool['mempool_free']);
$used = formatStorage($mempool['mempool_used']);
$graph_array['type'] = $graph_type; $graph_array['type'] = $graph_type;
$graph_array['id'] = $mempool['mempool_id']; $graph_array['id'] = $mempool['mempool_id'];
$graph_array['from'] = $config['time']['day']; $graph_array['from'] = $config['time']['day'];
@ -45,12 +45,13 @@ foreach (dbFetchRows($sql,$param) as $mempool) {
$link = "graphs/id=" . $graph_array['id'] . "/type=" . $graph_array['type'] . "/from=" . $graph_array['from'] . "/to=" . $graph_array['to'] . "/"; $link = "graphs/id=" . $graph_array['id'] . "/type=" . $graph_array['type'] . "/from=" . $graph_array['from'] . "/to=" . $graph_array['to'] . "/";
$mini_graph = overlib_link($link, generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL); $mini_graph = overlib_link($link, generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL);
$background = get_percentage_colours($perc); $background = get_percentage_colours($perc);
$bar_link = overlib_link($link, print_percentage_bar (400, 20, $perc, "$used / $total", "ffffff", $background['left'], $free , "ffffff", $background['right']), generate_graph_tag($graph_array_zoom), NULL); $bar_link = overlib_link($link, print_percentage_bar (400, 20, $perc, "$used / $total", "ffffff", $background['left'], $free, "ffffff", $background['right']), generate_graph_tag($graph_array_zoom), NULL);
$response[] = array('hostname' => generate_device_link($mempool), $response[] = array('hostname' => generate_device_link($mempool),
'mempool_descr' => $mempool['mempool_descr'], 'mempool_descr' => $mempool['mempool_descr'],
'graph' => $mini_graph, 'graph' => $mini_graph,
'mempool_usage' => $bar_link); 'mempool_used' => $bar_link,
'mempool_perc' => $perc . "%");
if ($_POST['view'] == "graphs") { if ($_POST['view'] == "graphs") {
$graph_array['height'] = "100"; $graph_array['height'] = "100";
$graph_array['width'] = "216"; $graph_array['width'] = "216";
@ -63,7 +64,8 @@ foreach (dbFetchRows($sql,$param) as $mempool) {
$response[] = array('hostname' => $graph_data[0], $response[] = array('hostname' => $graph_data[0],
'mempool_descr' => $graph_data[1], 'mempool_descr' => $graph_data[1],
'graph' => $graph_data[2], 'graph' => $graph_data[2],
'mempool_usage' => $graph_data[3]); 'mempool_used' => $graph_data[3],
'mempool_perc' => '');
} # endif graphs } # endif graphs
} }
$output = array('current'=>$current,'rowCount'=>$rowCount,'rows'=>$response,'total'=>$total); $output = array('current'=>$current,'rowCount'=>$rowCount,'rows'=>$response,'total'=>$total);

View File

@ -5,7 +5,8 @@
<th data-column-id="hostname">Device</th> <th data-column-id="hostname">Device</th>
<th data-column-id="mempool_descr">Memory</th> <th data-column-id="mempool_descr">Memory</th>
<th data-column-id="graph" data-sortable="false" data-searchable="false"></th> <th data-column-id="graph" data-sortable="false" data-searchable="false"></th>
<th data-column-id="mempool_usage" data-searchable="false">Usage</th> <th data-column-id="mempool_used" data-searchable="false">Used</th>
<th data-column-id="mempool_perc" data-searchable="false">Usage</th>
</tr> </tr>
</thead> </thead>
</table> </table>
@ -14,7 +15,7 @@
<script> <script>
var grid = $("#mempool").bootgrid({ var grid = $("#mempool").bootgrid({
ajax: true, ajax: true,
rowCount: [50,100,250,-1], rowCount: [25,50,100,250,-1],
post: function () post: function ()
{ {
return { return {