blob: 0319d984b16f76783ec9514dd7f9827986546eaf [file] [log] [blame]
<!--
Copyright 2017-present Open Networking Foundation
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.
-->
<div id="developerview"></div>
<script>
var oTable;
function updateUserSliceTable(){
log.debug("Should grab user slice info");
jQuery.ajax({
async:true,
dataType: 'json',
url: '/hpcdashuserslices',
success: function(data){
log.info("Got Data back for User SliceTable");
//parseData(data);
//createUserSliceTable(data);
setTimeout(function () { updateUserSliceTable() }, 5000);
},
error: function(data){
log.debug("COULDNT GET DATA BACK");
setTimeout(function () { updateUserSliceTable() }, 5000);
}
});
}
function createUserSliceTable(data) {
log.debug("Creating User Slice Table");
//Add check for #dynamicusersliceinfo_filter label-> input having focus here
$('#developerview').html( '<table cellpadding="0" cellspacing="0" border="0" class="display" id="dynamicusersliceinfo"></table>' );
var actualEntries = [];
//log.debug(data['userSliceInfo']['rows'][0]['slicename']);
var rows = data['userSliceInfo']['rows'];
for (row in rows) {
log.debug(row[0]);
slicename = rows[row]['slicename'];
sliceid = rows[row]['sliceid'];
role = rows[row]['role'];
instancecount = rows[row]['instancecount'];
sitecount = rows[row]['sitecount'];
actualEntries.push(['<a href="http://{{request.get_host}}/admin/core/slice/' + sliceid + '">' + slicename + '</a>',
role, instancecount, sitecount]);
}
oTable = $('#dynamicusersliceinfo').dataTable( {
"bJQueryUI": true,
"aaData": actualEntries ,
"bStateSave": true,
"aoColumns": [
{ "sTitle": "Slice" },
{ "sTitle": "Privilege" , sClass: "alignCenter"},
{ "sTitle": "Number of Instances" , sClass: "alignCenter"},
{ "sTitle": "Number of Sites" , sClass: "alignCenter"},
]
} );
// If the filter had focus, reapply here
setTimeout(function() {
jQuery.ajax({
url: '/hpcdashuserslices',
dataType: 'json',
success: function(data){ createUserSliceTable(data); },
complete: function(){ },
});
}, 10000);
}
function initTable(){
log.debug("Initializing Table")
jQuery.ajax({
url: '/hpcdashuserslices',
dataType: 'json',
success: function(data){ createUserSliceTable(data); },
complete: function(){
}
});
updateUserSliceTable();
}
initTable();
</script>