<commit_before>var select = document.querySelector('.rel-schema');

xm_gen.ajax.query({file: 'fetch-schema.php'}, showSchema);

function showSchema(data) {
  data = JSON.parse(data);
  // TODO: remove log
  console.log(data);

  data.forEach(function (el) {
    var option = document.createElement('option'),
        prop = 'Tables_in_aa2000';

    option.value = el[prop];
    option.innerHTML = el[prop];

    select.append(option);
  });

  xm_gen.ajax.query({file: 'desc-relation.php?relation=' + select.value}, generateForm);
}

var formObject;

select.addEventListener('change', function () {
  xm_gen.ajax.query({file: 'desc-relation.php?relation=' + this.value}, generateForm);
});

function generateForm(data) {
  data = JSON.parse(data);
  // TODO: remove log
  console.log(data);

  formObject = {};

  var container = document.querySelector('.rel-schema-form'),
      prop;

  container.innerHTML = "";

  data.forEach(function (el) {
    var prop = el['Field'],
        type = el['Type'],
        row = document.createElement('div'),
        label = document.createElement('label'),
        input = document.createElement('input'),
        labelAutoIncremento = document.createElement('label'),
        autoIncremento = document.createElement('input');

    row.classList.add('form-row');

    label.innerHTML = prop;
    input.classList.add('form-data');
    input.type = "text";
    input.setAttribute('data-type', type);
    input.name = prop;
    input.id = prop;

    labelAutoIncremento.innerHTML = "AutoIncremento: ";
    labelAutoIncremento.setAttribute('style', 'display:none');
    labelAutoIncremento.setAttribute('class', "displayNone");

    autoIncremento.type = "checkbox";
    autoIncremento.name = prop + 'Checkbox';
    autoIncremento.id = prop + 'Checkbox';
    autoIncremento.hidden = true;
    autoIncremento.setAttribute('class', "hidden");


    row.append(label, input, labelAutoIncremento, autoIncremento);

    container.append(row);
    formObject[prop] = '';
  });

  // focus first input element
  document.querySelector('.form-data').focus();
}

var load = document.querySelector('.rel-schema-load');<commit_msg>random en insert-tuple.js<commit_after>var select = document.querySelector('.rel-schema');

xm_gen.ajax.query({file: 'fetch-schema.php'}, showSchema);

function showSchema(data) {
  data = JSON.parse(data);
  // TODO: remove log
  console.log(data);

  data.forEach(function (el) {
    var option = document.createElement('option'),
        prop = 'Tables_in_aa2000';

    option.value = el[prop];
    option.innerHTML = el[prop];

    select.append(option);
  });

  xm_gen.ajax.query({file: 'desc-relation.php?relation=' + select.value}, generateForm);
}

var formObject;

select.addEventListener('change', function () {
  xm_gen.ajax.query({file: 'desc-relation.php?relation=' + this.value}, generateForm);
});

function generateForm(data) {
  data = JSON.parse(data);
  // TODO: remove log
  console.log(data);

  formObject = {};

  var container = document.querySelector('.rel-schema-form'),
      prop;

  container.innerHTML = "";

  data.forEach(function (el) {
    var prop = el['Field'],
        type = el['Type'],
        row = document.createElement('div'),
        label = document.createElement('label'),
        input = document.createElement('input'),
        labelAutoIncremento = document.createElement('label'),
        autoIncremento = document.createElement('input'),
        labelRandom = document.createElement('label'),
        random = document.createElement('input');

    row.classList.add('form-row');

    label.innerHTML = prop;
    input.classList.add('form-data');
    input.type = "text";
    input.setAttribute('data-type', type);
    input.name = prop;
    input.id = prop;

    labelAutoIncremento.innerHTML = "AutoIncremento: ";
    labelAutoIncremento.setAttribute('style', 'display:none');
    labelAutoIncremento.setAttribute('class', "displayNone");

    autoIncremento.type = "checkbox";
    autoIncremento.name = prop + 'Checkbox';
    autoIncremento.id = prop + 'Checkbox';
    autoIncremento.hidden = true;
    autoIncremento.setAttribute('class', "hidden");

    labelRandom.innerHTML = 'Random:';
    labelRandom.setAttribute('style', 'display:none');
    labelRandom.setAttribute('class', "displayNone");

    random.type = "checkbox";
    random.name = prop + 'Random';
    random.id = prop + 'Random';
    random.hidden = true;
    random.setAttribute('class', "hidden");


    row.append(label, input, labelAutoIncremento, autoIncremento, labelRandom, random);

    container.append(row);
    formObject[prop] = '';
  });

  // focus first input element
  document.querySelector('.form-data').focus();
}

var load = document.querySelector('.rel-schema-load');
{'fraction_non_alphanumeric': 0.1590432228283676, 'fraction_numerical': 0.001678556441460344, 'mean_word_length': 3.815151515151515, 'pattern_counts': {'":': 0, '<': 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': '960573', 'n_tokens_mistral': 1433, 'n_tokens_neox': 1415, 'n_words': 251}