<commit_before>var updating_text = "...updating...";

function build_agg_table_on_slicepg() 
{
   // (1) query the server for all a list of aggregates
   $.getJSON("aggregates.php",function(responseTxt,statusTxt,xhr){
   if(statusTxt=="success") 
   {
     var json_agg;
     var name;
     var output; 
     var status_url, listres_url;

     status_url = 'sliverstatus.php?slice_id='+slice;
     listres_url = 'listresources.php?slice_id='+slice;

     // (2) create an HTML table with one row for each aggregate
     json_agg = responseTxt;
     output = "<table id='status_table'>";
     //  output +=  "<tr><th>Status</th><th colspan='2'>Slice</th><th>Creation</th><th>Expiration</th><th>Actions</th></tr>\n";
     output +=  "<tr><th>Status</th><th colspan='6'>Slice</th></tr>\n";
     /* Slice Info */
     output +=  "<tr>";
     output +=  "<td class='$slice_status'>"+slice_status+"</td>";
     output +=  "<td colspan='5'>"+slice_name+"</td>";
     output +=  "</tr>\n";
     output += "<tr>";
     output += "<th class='notapply'>";
     output += "</th><th>";
     output += "</th><th>Status</th><th>Aggregate</th>";
     //      output += "<th>&nbsp;</th>";
     output += "<th>Expiration</th>";
     output += "<th>Actions</th></tr>\n";
     for (am_id in json_agg ) {
	    agg = json_agg[am_id];                    
	    name = agg.name;
            output += "<tr id='"+am_id+"'>";
	    output += "<td class='notapply'></td>";
	    output += "<td><button id='hello' type='button' onclick='refresh_agg_row("+am_id+")'>Reload</button>";
	    output += "</td><td id='status_"+am_id+"' class='updating'>";	
	    output += updating_text;
	    output += "</td><td>";	
	    output += name;
	    output += "</td>";	
	    // sliver expiration
	    if (renew_slice_privilege) {
                output += "<td><form method='GET' action=\"do-renew.php\">";
		output += "<input type=\"hidden\" name=\"slice_id\" value=\""+slice+"\"/>\n";
		output += "<input class='date' type='text' name='slice_expiration'";
		output += "value=\""+slice_expiration+"\"/>\n";
		output += "<input type='submit' name= 'Renew' value='Renew'/>\n";
		output += "</form></td>\n";
	    } else {
		output += "<td>"+sliver_expiration+"</td>"; 
	    }
	    // sliver actions
	    output += "<td>";
	    output += "<button onClick=\"window.location='"+status_url+"&am_id="+am_id+"'\"><b>Resource Status</b></button>";
	    output += "<button title='Login info, etc' onClick=\"window.location='"+listres_url+"&am_id="+am_id+"'\"><b>Details</b></button>\n";
	    output += "<button onClick=\"window.location='confirm-sliverdelete.php?slice_id=" + slice+ "&am_id="+am_id+"'\" "+ delete_slivers_disabled +"><b>Delete Resources</b></button>\n";
	    output += "</td></tr>";
            // (3) Get the status for this slice at this aggregate
	    update_agg_row( am_id );
     }	
     output += "</table>";
     $("#status_table_div").html(output);
   }
   if(statusTxt=="error")
     alert("Error: "+xhr.status+": "+xhr.statusText);
   });
}


function build_agg_table() 
{
   // (1) query the server for all a list of aggregates
   $.getJSON("aggregates.php",function(responseTxt,statusTxt,xhr){
   if(statusTxt=="success") 
   {
     var json_agg;
     var name;
     var output; 
     // (2) create an HTML table with one row for each aggregate
     json_agg = responseTxt;
     output = "<table id='status_table'>";
     for (am_id in json_agg ) {
	    agg = json_agg[am_id];                    
	    name = agg.name;
            output += "<tr id='"+am_id+"'>";
	    output += "<td class='notapply'></td>";
	    output += "<td><button id='hello' type='button' onclick='update_agg_row("+am_id+")'>Reload</button>";
	    output += "</td><td id='status_"+am_id+"' class='updating'>";	
	    output += "...updating...";
	    output += "</td><td>";	
	    output += name;
//	    output += "</td><td>";	
//	    output += agg.url;
	    output += "</td></tr>";
            // (3) Get the status for this slice at this aggregate
	    update_agg_row( am_id );
     }	
     output += "</table>";
     $("#status_table_div").html(output);
   }
   if(statusTxt=="error")
     alert("Error: "+xhr.status+": "+xhr.statusText);
   });
}


function refresh_agg_row(am_id) {

    geni_status = "updating"
    $("td#status_"+am_id).text( updating_text);
    $("td#status_"+am_id).attr( "class", geni_status );
    update_agg_row(am_id);
}

function update_agg_row(am_id) {
  // This queries for the json file at (for example):
  // https://sergyar.gpolab.bbn.com/secure/amstatus.php?am_id=9&slice_id=b18cb314-c4dd-4f28-a6fd-b355190e1b61
  $.getJSON("amstatus.php", { am_id:am_id, slice_id:slice },function(responseTxt,statusTxt,xhr){
     if(statusTxt=="success") 
     {
        var json_am;
        var am;
        var geni_status;
        var output=""; 
        json_am = responseTxt;
        for (new_id in json_am ) {	
           am = json_am[new_id];	   
           geni_status = am['geni_status'];
    	   output += geni_status;
        }
        $("td#status_"+am_id).text( output );
        $("td#status_"+am_id).attr( "class", geni_status );
     }
     if(statusTxt=="error")
        alert("Error: "+xhr.status+": "+xhr.statusText);
  });  
}


<commit_msg>Hide sliver action buttons when AM status is undefined.<commit_after>var updating_text = "...updating...";

function build_agg_table_on_slicepg() 
{
   // (1) query the server for all a list of aggregates
   $.getJSON("aggregates.php",function(responseTxt,statusTxt,xhr){
   if(statusTxt=="success") 
   {
     var json_agg;
     var name;
     var output; 
     var status_url, listres_url;

     status_url = 'sliverstatus.php?slice_id='+slice;
     listres_url = 'listresources.php?slice_id='+slice;

     // (2) create an HTML table with one row for each aggregate
     json_agg = responseTxt;
     output = "<table id='status_table'>";
     //  output +=  "<tr><th>Status</th><th colspan='2'>Slice</th><th>Creation</th><th>Expiration</th><th>Actions</th></tr>\n";
     output +=  "<tr><th>Status</th><th colspan='6'>Slice</th></tr>\n";
     /* Slice Info */
     output +=  "<tr>";
     output +=  "<td class='$slice_status'>"+slice_status+"</td>";
     output +=  "<td colspan='5'>"+slice_name+"</td>";
     output +=  "</tr>\n";
     output += "<tr>";
     output += "<th class='notapply'>";
     output += "</th><th>";
     output += "</th><th>Status</th><th>Aggregate</th>";
     //      output += "<th>&nbsp;</th>";
     output += "<th>Expiration</th>";
     output += "<th>Actions</th></tr>\n";
     for (am_id in json_agg ) {
	    agg = json_agg[am_id];                    
	    name = agg.name;
            output += "<tr id='"+am_id+"'>";
	    output += "<td class='notapply'></td>";
	    output += "<td><button id='reload_button_'"+am_id+" type='button' onclick='refresh_agg_row("+am_id+")'>Reload</button>";
	    output += "</td><td id='status_"+am_id+"' class='updating'>";	
	    output += updating_text;
	    output += "</td><td>";	
	    output += name;
	    output += "</td>";	
	    // sliver expiration
	    if (renew_slice_privilege) {
                output += "<td><form method='GET' action=\"do-renew.php\">";
		output += "<input type=\"hidden\" name=\"slice_id\" value=\""+slice+"\"/>\n";
		output += "<input class='date' type='text' name='slice_expiration'";
		output += "value=\""+slice_expiration+"\"/>\n";
		output += "<input type='submit' name= 'Renew' value='Renew'/>\n";
		output += "</form></td>\n";
	    } else {
		output += "<td>"+sliver_expiration+"</td>"; 
	    }
	    // sliver actions
	    output += "<td>";
	    output += "<button id='status_button_"+am_id+"' onClick=\"window.location='"+status_url+"&am_id="+am_id+"'\"><b>Resource Status</b></button>";
	    output += "<button  id='details_button_"+am_id+"' title='Login info, etc' onClick=\"window.location='"+listres_url+"&am_id="+am_id+"'\"><b>Details</b></button>\n";
	    output += "<button  id='delete_button_"+am_id+"' onClick=\"window.location='confirm-sliverdelete.php?slice_id=" + slice+ "&am_id="+am_id+"'\" "+ delete_slivers_disabled +"><b>Delete Resources</b></button>\n";
	    output += "</td></tr>";
            // (3) Get the status for this slice at this aggregate
	    update_agg_row( am_id );
     }	
     output += "</table>";
     $("#status_table_div").html(output);
   }
   if(statusTxt=="error")
     alert("Error: "+xhr.status+": "+xhr.statusText);
   });
}


function build_agg_table() 
{
   // (1) query the server for all a list of aggregates
   $.getJSON("aggregates.php",function(responseTxt,statusTxt,xhr){
   if(statusTxt=="success") 
   {
     var json_agg;
     var name;
     var output; 
     // (2) create an HTML table with one row for each aggregate
     json_agg = responseTxt;
     output = "<table id='status_table'>";
     for (am_id in json_agg ) {
	    agg = json_agg[am_id];                    
	    name = agg.name;
            output += "<tr id='"+am_id+"'>";
	    output += "<td class='notapply'></td>";
	    output += "<td><button id='button_'"+am_id+" type='button' onclick='update_agg_row("+am_id+")'>Reload</button>";
	    output += "</td><td id='status_"+am_id+"' class='updating'>";	
	    output += "...updating...";
	    output += "</td><td>";	
	    output += name;
//	    output += "</td><td>";	
//	    output += agg.url;
	    output += "</td></tr>";
            // (3) Get the status for this slice at this aggregate
	    update_agg_row( am_id );
     }	
     output += "</table>";
     $("#status_table_div").html(output);
   }
   if(statusTxt=="error")
     alert("Error: "+xhr.status+": "+xhr.statusText);
   });
}


function refresh_agg_row(am_id) {
 
    geni_status = "updating"
    $("td#status_"+am_id).text( updating_text);
    $("td#status_"+am_id).attr( "class", geni_status );
    update_agg_row(am_id);
}

function update_agg_row(am_id) {
  // This queries for the json file at (for example):
  // https://sergyar.gpolab.bbn.com/secure/amstatus.php?am_id=9&slice_id=b18cb314-c4dd-4f28-a6fd-b355190e1b61
  $("button#reload_button_"+am_id).prop( "disabled", true ); 
  $.getJSON("amstatus.php", { am_id:am_id, slice_id:slice },function(responseTxt,statusTxt,xhr){
     if(statusTxt=="success") 
     {
        var json_am;
        var am;
        var geni_status;
        var output=""; 
        json_am = responseTxt;
        for (new_id in json_am ) {	
           am = json_am[new_id];	   
           geni_status = am['geni_status'];
    	   output += geni_status;
        }
        $("td#status_"+am_id).text( output );
        $("td#status_"+am_id).attr( "class", geni_status );

	if (geni_status == undefined){
	    $("button#status_button_"+am_id).prop( "disabled", true ); 
	    $("button#details_button_"+am_id).prop( "disabled", true ); 
	    $("button#delete_button_"+am_id).prop( "disabled", true ); 
	} else {
	    $("button#status_button_"+am_id).removeProp( "disabled"); 
	    $("button#details_button_"+am_id).removeProp( "disabled"); 
	    $("button#delete_button_"+am_id).removeProp( "disabled"); 
	}
     }
     if(statusTxt=="error")
        alert("Error: "+xhr.status+": "+xhr.statusText);
  });  
}



{'fraction_non_alphanumeric': 0.20986765103088142, 'fraction_numerical': 0.005221932114882507, 'mean_word_length': 3.0748349229640497, 'pattern_counts': {'":': 6, '<': 189, '<?xml version=': 0, '>': 189, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2611995', 'n_tokens_mistral': 3993, 'n_tokens_neox': 3836, 'n_words': 693}