$(".ip_dropdown").on("change",function(){$(".modal.show .btn").removeAttr("disabled")}),$(".conf_dropdown").on("change",function(){$(".modal.show .ip_dropdown").html('Loading...'),$.ajax({url:"/get_ping_ip",method:"POST",data:"config="+$(this).children("option:selected").val(),success:function(t){$(".modal.show .ip_dropdown").html(""),$(".modal.show .ip_dropdown").append('Choose an IP'),$(".modal.show .ip_dropdown").append(t)}})}),$(".send_ping").on("click",function(){$(this).attr("disabled","disabled"),$(this).html("Pinging..."),$("#ping_modal .form-control").attr("disabled","disabled"),$.ajax({method:"POST",data:"ip="+$(":selected",$("#ping_modal .ip_dropdown")).val()+"&count="+$("#ping_modal .ping_count").val(),url:"/ping_ip",success:function(t){$(".ping_result tbody").html("");let e='Address'+t.address+'Is Alive'+t.is_alive+'Min RTT'+t.min_rtt+'msAverage RTT '+t.avg_rtt+'msMax RTT'+t.max_rtt+'msPackage Sent'+t.package_sent+'Package Received'+t.package_received+'Package Loss'+t.package_loss+"";$(".ping_result tbody").html(e),$(".send_ping").removeAttr("disabled"),$(".send_ping").html("Ping"),$("#ping_modal .form-control").removeAttr("disabled")}})}),$(".send_traceroute").on("click",function(){$(this).attr("disabled","disabled"),$(this).html("Tracing..."),$("#traceroute_modal .form-control").attr("disabled","disabled"),$.ajax({url:"/traceroute_ip",method:"POST",data:"ip="+$(":selected",$("#traceroute_modal .ip_dropdown")).val(),success:function(t){$(".traceroute_result tbody").html(""),t.forEach(t=>$(".traceroute_result tbody").append(''+t.hop+""+t.ip+""+t.avg_rtt+""+t.min_rtt+""+t.max_rtt+"")),$(".send_traceroute").removeAttr("disabled").html("Traceroute"),$("#traceroute_modal .form-control").removeAttr("disabled")}})});