blob: bbd77352edd1897536e53b3bdbd299ece739cdc9 [file] [log] [blame]
<!-- @@@ START COPYRIGHT @@@ -->
<!-- -->
<!-- (C) Copyright 2015 Hewlett-Packard Development Company, L.P. -->
<!-- -->
<!-- Licensed under the Apache License, Version 2.0 (the "License"); -->
<!-- you may not use this file except in compliance with the License. -->
<!-- You may obtain a copy of the License at -->
<!-- -->
<!-- http://www.apache.org/licenses/LICENSE-2.0 -->
<!-- -->
<!-- Unless required by applicable law or agreed to in writing, software -->
<!-- distributed under the License is distributed on an "AS IS" BASIS, -->
<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -->
<!-- See the License for the specific language governing permissions and -->
<!-- limitations under the License. -->
<!-- -->
<!-- @@@ END COPYRIGHT @@@ -->
<head>
<link type="text/css" href="datatables/css/jquery.dataTables_themeroller.css" rel="stylesheet" />
<link type="text/css" href="datatables/css/demo_page.css" rel="stylesheet" />
<link type="text/css" href="datatables/css/demo_table_jui.css" rel="stylesheet" />
<link type="text/css" href="jquery-ui/jquery-ui.css" rel="stylesheet" />
<script type="text/javascript" src="js/lib/jquery-1.11.0.js"></script>
<script type="text/javascript" src="datatables/js/jquery.dataTables.js"></script>
</head>
<div id="progress">
<p><span style="font-family: Georgia, 'Times New Roman', Times, serif; font-size: 18px;">Fetching repository data ...</p>
<img src="img/ajax-loader.gif"/>
</div>
<div id="query-stats"></div>
<script type="text/javascript">
$(document).ready(function(){
document.body.style.cursor = 'wait';
$('#query-stats').html('').css('color','black');
var jqxhr = $.getJSON('querystats.jsp',function(result){
var keys;
$.each(result, function(i, data){
keys = Object.keys(data);
});
var sb = '<table class="display1" id="query-stats-table" style="font-size:small"><thead><tr>';
for (var r=0,len=keys.length; r<len; r++) {
sb += '<th><b></b>' + keys[r] + '</th>';
}
sb += '</tr></thead><tbody> </tbody></table>';
$('#query-stats').html( sb );
var aoColumns = [];
var aaData = [];
$.each(result, function(i, data){
var rowData = [];
$.each(keys, function(k, v) {
rowData.push(data[v]);
});
aaData.push(rowData);
});
// add needed columns
$.each(keys, function(k, v) {
obj = new Object();
obj.sTitle = v;
aoColumns.push(obj);
});
$('#query-stats-table').dataTable({"bProcessing": true,"bJQueryUI": true,"sPaginationType": "full_numbers","aaData": aaData, "aoColumns" : aoColumns });
var elem = document.getElementById('progress');
elem.parentNode.removeChild(elem);
document.body.style.cursor = 'default';
});
jqxhr.fail(function(){
$('#query-stats').html( jqxhr.responseText ).css('color','red');
var elem = document.getElementById('progress');
elem.parentNode.removeChild(elem);
document.body.style.cursor = 'default';
});
});
</script>