<div id="developerview"></div>

<div id="confirmNodeAdded" title="Added Node to Site"><p>Added Node to Site</p></div>
<div id="confirmNodeRemoved" title="Removed Node from Site"><p>Added Node to Site</p></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'];
        slivercount = rows[row]['slivercount'];
        sitecount = rows[row]['sitecount'];
        actualEntries.push(['<a href="http://{{request.get_host}}/admin/core/slice/' + sliceid + '">' + slicename + '</a>',
                            role, slivercount, sitecount]);
    }
    oTable = $('#dynamicusersliceinfo').dataTable( {
        "bJQueryUI": true,
        "aaData":  actualEntries ,
        "bStateSave": true,
        "aoColumns": [
            { "sTitle": "Slice" },
            { "sTitle": "Privilege" , sClass: "alignCenter"},
            { "sTitle": "Number of Slivers" , 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>
