<commit_before>graoJS = angular.module('graoJS', ['ngResource', 'ui.bootstrap', 'ui.select2']);
graoJS.constant("config", {
  baseUrl: window.location.protocol+"//"+
    window.location.hostname+":"+
    window.location.port+"\:"+
    window.location.port
});

function clearObject(obj){
  for (var o in obj) {
    if (isNaN(parseInt(o))) {
      clearObject(obj[o]);
      if(typeof obj[o] == 'string')
        obj[o] = '';
      else if(typeof obj[o] == 'number' || typeof obj[o] == 'boolean')
        obj[o] = null;
      else if(obj[o] instanceof Array)
        obj[o] = new Array();
    }
  }
}

function validate(alert, errorObject, responseData, pathsIgnore){
  if(!pathsIgnore)
    pathsIgnore = new Array();

  function jumpPath(errorObject, paths, value) {
    var newPath = paths[0];
    paths.shift();
    if(!errorObject[newPath])
      errorObject[newPath] = {};

    if(paths.length == 0)
      errorObject[newPath] = value;
    else
      jumpPath(errorObject[newPath], paths, value);
  }

  clearObject(errorObject);
  var errors = responseData.data;

  if(responseData.event && responseData.event.status == false) {
    var countErrors = 0;
    var isFieldErros = false;
    if(errors) {
      for(var iField in errors){
        isFieldErros = true;
        if(!(pathsIgnore.indexOf(errors[iField].path) >= 0)) {
          countErrors++;
          if(errors[iField].path.indexOf('.') != -1)
            jumpPath(errorObject, errors[iField].path.split('.'), errors[iField].message);
          else if(typeof errorObject[errors[iField].path] != 'object') // else ?
            errorObject[errors[iField].path] = errors[iField].message;        
        }
      }
    }
    if(countErrors > 0 || !isFieldErros) {
      alert.show = true;
      alert.style = responseData.event.style;
      alert.message = responseData.event.message;
      return false;
    } else {
      return true;
    }
  } else if(responseData.event && responseData.event.status == true && responseData.event.message) { // else ?
    alert.show = true;
    alert.style = responseData.event.style;
    alert.message = responseData.event.message;
    return true;
  } else if(responseData.event.status == true) {
    return true;
  } else {
    return false;
  }
}

var DataList = function() {
  var self = this;
  this.data = [];
  this.filter = null;<commit_msg>Add allMessages in UI validate<commit_after>graoJS = angular.module('graoJS', ['ngResource', 'ui.bootstrap', 'ui.select2']);
graoJS.constant("config", {
  baseUrl: window.location.protocol+"//"+
    window.location.hostname+":"+
    window.location.port+"\:"+
    window.location.port
});

function clearObject(obj){
  for (var o in obj) {
    if (isNaN(parseInt(o))) {
      clearObject(obj[o]);
      if(typeof obj[o] == 'string')
        obj[o] = '';
      else if(typeof obj[o] == 'number' || typeof obj[o] == 'boolean')
        obj[o] = null;
      else if(obj[o] instanceof Array)
        obj[o] = new Array();
    }
  }
}

function validate(alert, errorObject, responseData, pathsIgnore){
  if(!pathsIgnore)
    pathsIgnore = new Array();

  function jumpPath(errorObject, paths, value) {
    var newPath = paths[0];
    paths.shift();
    if(!errorObject[newPath])
      errorObject[newPath] = {};

    if(paths.length == 0)
      errorObject[newPath] = value;
    else
      jumpPath(errorObject[newPath], paths, value);
  }

  clearObject(errorObject);
  var errors = responseData.data;

  if(responseData.event && responseData.event.status == false) {
    var countErrors = 0;
    var isFieldErros = false;
    var allMessages = '';
    if(errors) {
      for(var iField in errors){
        isFieldErros = true;
        if(!(pathsIgnore.indexOf(errors[iField].path) >= 0)) {
          if(errors[iField].message)
            allMessages += ", "+iField+": "+errors[iField].message;
          else
            allMessages += ", "+iField+": "+errors[iField];
          countErrors++;
          if(errors[iField].path.indexOf('.') != -1)
            jumpPath(errorObject, errors[iField].path.split('.'), errors[iField].message);
          else if(typeof errorObject[errors[iField].path] != 'object') // else ?
            errorObject[errors[iField].path] = errors[iField].message;        
        }
      }
    }
    if(countErrors > 0 || !isFieldErros) {
      alert.show = true;
      alert.style = responseData.event.style;
      alert.message = responseData.event.message+allMessages;
      return false;
    } else {
      return true;
    }
  } else if(responseData.event && responseData.event.status == true && responseData.event.message) { // else ?
    alert.show = true;
    alert.style = responseData.event.style;
    alert.message = responseData.event.message;
    return true;
  } else if(responseData.event.status == true) {
    return true;
  } else {
    return false;
  }
}

var DataList = function() {
  var self = this;
  this.data = [];
  this.filter = null;
{'fraction_non_alphanumeric': 0.15588891141293332, 'fraction_numerical': 0.0028380295965943643, 'mean_word_length': 2.8159319412219643, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 7, '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': '5557412', 'n_tokens_mistral': 1568, 'n_tokens_neox': 1556, 'n_words': 309}