<commit_before>var cur_device;
var cur_sensor;

$(document).ready(function() {
    console.log($.fn.jquery);
    get_devices();
    $(document).foundation();
});

$(document).on('click', '.device-btn', function(btnClick) {
    var device_id = btnClick.target.attributes['data-id'].value;
    get_sensors(device_id);
    $(document).foundation();
});

function get_devices() {
    var list = $('.device-list');
    var first = true;
    $.get('/api/device/getdevices', function(data) {
	data['devices'].forEach(function(device) {
	    list.append("<li><a class=\"device-btn\" data-id=" + device['id'] + ">" + device['description'] + "</a></li>");
	    if (first) {
		get_sensors(device['id']);
		first = false;
	    };
	});
    });
};

function get_sensors(device_id) {
    var tabs = $('.sensor-tabs');
    tabs.html('');
    var tab_contents = $('.sensor-tabs-content');
    tab_contents.html('');
    var first = true;
    var active = 'class="active">';

    $.get('/api/device/' + device_id + '/getsensors', function(data) {
	data['sensors'].forEach(function(sensor) {
	    tabs.append('<dd ' + (first ? active : '>') + '<a href="#sen' + sensor['id'] + '">' + sensor['description'] + '</a></dd>');
	    tab_contents.append('<div class="content ' + (first ? 'active"' : '"') + 'id="sen' + sensor['id'] + '">build graph - put here</div>');
	    first = false;
	});
    });
};<commit_msg>Display unique message on tab content for demo purpose.<commit_after>var cur_device;
var cur_sensor;

$(document).ready(function() {
    console.log($.fn.jquery);
    get_devices();
    $(document).foundation();
});

$(document).on('click', '.device-btn', function(btnClick) {
    var device_id = btnClick.target.attributes['data-id'].value;
    get_sensors(device_id);
    $(document).foundation();
});

function get_devices() {
    var list = $('.device-list');
    var first = true;
    $.get('/api/device/getdevices', function(data) {
	data['devices'].forEach(function(device) {
	    list.append("<li><a class=\"device-btn\" data-id=" + device['id'] + ">" + device['description'] + "</a></li>");
	    if (first) {
		get_sensors(device['id']);
		first = false;
	    };
	});
    });
};

function get_sensors(device_id) {
    var tabs = $('.sensor-tabs');
    tabs.html('');
    var tab_contents = $('.sensor-tabs-content');
    tab_contents.html('');
    var first = true;
    var active = 'class="active">';

    $.get('/api/device/' + device_id + '/getsensors', function(data) {
	data['sensors'].forEach(function(sensor) {
	    tabs.append('<dd ' + (first ? active : '>') + '<a href="#sen' + sensor['id'] + '">' + sensor['description'] + '</a></dd>');
	    tab_contents.append('<div class="content ' + (first ? 'active"' : '"') + 'id="sen' + sensor['id'] + '">' + sensor['description'] + ' - graph here</div>');
	    first = false;
	});
    });
};
{'fraction_non_alphanumeric': 0.23838028169014083, 'fraction_numerical': 0.0, 'mean_word_length': 3.7429048414023374, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 25, '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': '3914849', 'n_tokens_mistral': 965, 'n_tokens_neox': 924, 'n_words': 165}