<commit_before>$(function(){
	init();
});
function init () {
	listTrustedClients();
}

$(document).on('click', '#add_confirm', function(){
	var thisButton = $(this);
	thisButton.button('loading');
	var jsonData = {};
	$('#add_trusted_client_form input, #add_trusted_client_form select').each(function(){
		jsonData[$(this).attr('name')] = $(this).val();
	});
	$('#result_msg').html('').removeClass('label');
	$.ajax({
		url:base_url+'pids/add_trusted_client/', 
		type: 'POST',
		data: {jsonData:jsonData},
		success: function(data){
			if(data.errorMessages){
				$('#result_msg').html(data.errorMessages).addClass('label label-important');
				thisButton.button('reset');
			}else{
				listTrustedClients();
				$('#add_trusted_client_modal').modal('hide');
			}
		}
	});
}).on('click', '#app_id_show', function(){
	$(this).hide();
	$('#app_id_field').show();
	$('#app_id_field select').chosen();
}).on('click', '.remove', function(){
	var ip = $(this).attr('ip');
	var app_id = $(this).attr('app_id');
	if(confirm('Are you sure you want to delete this trusted ip: ')){
		$.ajax({
			url:base_url+'pids/remove_trusted_client', 
			type: 'POST',
			data: {ip:ip,app_id:app_id},
			success: function(data){
				listTrustedClients();
			}
		});
	}
});

function listTrustedClients() {
	$('#trsuted_clients').html('loading');
	$.getJSON(base_url+'pids/list_trusted_clients/', function(data) {
		var template = $('#trusted_clients-template').html();
		var output = Mustache.render(template, data);
		$('#trusted_clients').html(output).css('opacity', '1');
		$('.data-table').dataTable({
			"aaSorting": [[ 1, "desc" ]],
			"bJQueryUI": true,<commit_msg>changed from using base_url to app_url<commit_after>$(function(){
	init();
});
function init () {
	listTrustedClients();
}

$(document).on('click', '#add_confirm', function(){
	var thisButton = $(this);
	thisButton.button('loading');
	var jsonData = {};
	$('#add_trusted_client_form input, #add_trusted_client_form select').each(function(){
		jsonData[$(this).attr('name')] = $(this).val();
	});
	$('#result_msg').html('').removeClass('label');
	$.ajax({
		url:base_url+'pids/add_trusted_client/', 
		type: 'POST',
		data: {jsonData:jsonData},
		success: function(data){
			if(data.errorMessages){
				$('#result_msg').html(data.errorMessages).addClass('label label-important');
				thisButton.button('reset');
			}else{
				listTrustedClients();
				$('#add_trusted_client_modal').modal('hide');
			}
		}
	});
}).on('click', '#app_id_show', function(){
	$(this).hide();
	$('#app_id_field').show();
	$('#app_id_field select').chosen();
}).on('click', '.remove', function(){
	var ip = $(this).attr('ip');
	var app_id = $(this).attr('app_id');
	if(confirm('Are you sure you want to delete this trusted ip: ')){
		$.ajax({
			url:base_url+'pids/remove_trusted_client', 
			type: 'POST',
			data: {ip:ip,app_id:app_id},
			success: function(data){
				listTrustedClients();
			}
		});
	}
});

function listTrustedClients() {
	$('#trsuted_clients').html('loading');
	$.getJSON(apps_url+'pids/list_trusted_clients/', function(data) {
		var template = $('#trusted_clients-template').html();
		var output = Mustache.render(template, data);
		$('#trusted_clients').html(output).css('opacity', '1');
		$('.data-table').dataTable({
			"aaSorting": [[ 1, "desc" ]],
			"bJQueryUI": true,
{'fraction_non_alphanumeric': 0.22977443609022558, 'fraction_numerical': 0.0012030075187969924, 'mean_word_length': 5.547244094488189, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '3377538', 'n_tokens_mistral': 1270, 'n_tokens_neox': 1193, 'n_words': 186}