<commit_before>/**
 * Copyright 2015 IBM Corp. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 $(document).ready(function() {

  $('#myTab a').click(function (e) {
    e.preventDefault()
    $(this).tab('show')
  });

  $('#job-new-btn').click(function(){
    $('#job-new-btn').blur();
    $('#job-add-div').show();
    $('#code').val('');
    $('#title').val('');
    $('#description').val('');
    cleanMessages();
  });
  $('#job-cancel-btn').click(function(){
    $('#job-cancel-btn').blur();
    $('#job-add-div').hide();
  });
  $('#candidate-new-btn').click(function(){
    $('#candidate-new-btn').blur();
    $('#candidate-add-form').show();
    $('#name').val('');
    $('#profile').val('');
    cleanMessages();
  });
  $('#candidate-cancel-btn').click(function(){
    $('#candidate-cancel-btn').blur();
    $('#candidate-add-form').hide();
  });


  loadJobs();
  loadCandidates();

  $('#candidate-add-btn').click(function(){
    // $('#candidate-add-btn').blur();
    // showSuccess('Not implemented yet');
    handleCreation();
  });

  /**
   * 1. Create the request
   * 2. Call the API
   * 3. Call the methods to display the results
   */
  //$('.job-add-form').submit(function( event ){

});

function loadJobs() {
  $('#jobs-loading').show();
  $("#jobs-table").empty();
  $("#pending-jobs-table").empty();

  // TODO get all jobs without concepts numbers and update them all

  $.ajax({
      type: 'GET',
      url: '/db/jobs/?select=concept_id%20title%20code%20requiredConcepts%20concepts&sort=code',
      dataType: 'json',
      success: function(data) {
        $('#num-jobs').html(data.length + ' jobs');
        data.forEach(function(job) {
          // TODO alanbraz: ignore pending list for demo
          //var list = (job.requiredConcepts.length>0)?'#jobs-list':'#pending-jobs-list';

          job.id = (job.concept_id || job._id);

          if (!job.concepts) {
            var ciJob = getJob(job.id);
            //console.log(JSON.stringify(ciJob));
            job.concepts = ciJob.annotations["0"].length;
            updateJob(job);
          }

          $('<tr><td>'+job.code+'</td> '+
            '<td>'+ '<a href=\'/candidatesearch/'+job.id+'\'>'+job.title+'</a>' + '</td>'+
            '<td> '+job.concepts + '' + '</td>' + ' ' +
            //(list != '#jobs-list'?'[<a href="/concepts/required/'+job._id+'">SET REQUIRED CONCEPTS</a>]':'') +
            //(list == '#jobs-list'?'[<a href=\'/candidatesearch/'+job.code+'\' target=\'_blank\'>'+'find candidates'+'</a>]':'') +
            '<td>[<a href=\'javascript:delJob(\"'+job._id+'\",\"'+(job.concept_id || job._id)+'\")\'>delete</a>]</td>' +
            '</tr>')
          .appendTo($('#jobs-table'));
        });
        //handleJobs(data);
      },
      error: function(err) {<commit_msg>add link to job code<commit_after>/**
 * Copyright 2015 IBM Corp. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 $(document).ready(function() {

  $('#myTab a').click(function (e) {
    e.preventDefault()
    $(this).tab('show')
  });

  $('#job-new-btn').click(function(){
    $('#job-new-btn').blur();
    $('#job-add-div').show();
    $('#code').val('');
    $('#title').val('');
    $('#description').val('');
    cleanMessages();
  });
  $('#job-cancel-btn').click(function(){
    $('#job-cancel-btn').blur();
    $('#job-add-div').hide();
  });
  $('#candidate-new-btn').click(function(){
    $('#candidate-new-btn').blur();
    $('#candidate-add-form').show();
    $('#name').val('');
    $('#profile').val('');
    cleanMessages();
  });
  $('#candidate-cancel-btn').click(function(){
    $('#candidate-cancel-btn').blur();
    $('#candidate-add-form').hide();
  });


  loadJobs();
  loadCandidates();

  $('#candidate-add-btn').click(function(){
    // $('#candidate-add-btn').blur();
    // showSuccess('Not implemented yet');
    handleCreation();
  });

  /**
   * 1. Create the request
   * 2. Call the API
   * 3. Call the methods to display the results
   */
  //$('.job-add-form').submit(function( event ){

});

function loadJobs() {
  $('#jobs-loading').show();
  $("#jobs-table").empty();
  $("#pending-jobs-table").empty();

  // TODO get all jobs without concepts numbers and update them all

  $.ajax({
      type: 'GET',
      url: '/db/jobs/?select=concept_id%20title%20code%20requiredConcepts%20concepts&sort=code',
      dataType: 'json',
      success: function(data) {
        $('#num-jobs').html(data.length + ' jobs');
        data.forEach(function(job) {
          // TODO alanbraz: ignore pending list for demo
          //var list = (job.requiredConcepts.length>0)?'#jobs-list':'#pending-jobs-list';

          job.id = (job.concept_id || job._id);

          if (!job.concepts) {
            var ciJob = getJob(job.id);
            //console.log(JSON.stringify(ciJob));
            job.concepts = ciJob.annotations["0"].length;
            updateJob(job);
          }
          
          $('<tr>'+ 
            '<td>'+ '<a href=\'https://jobs3.netmedia1.com/cp/faces/job_summary?job_id='+job.code+'\' target=\'_blank\'>'+job.code+'</a>' + '</td> '+
            '<td>'+ '<a href=\'/candidatesearch/'+job.id+'\'>'+job.title+'</a>' + '</td>'+
            '<td> '+job.concepts + '' + '</td>' + ' ' +
            //(list != '#jobs-list'?'[<a href="/concepts/required/'+job._id+'">SET REQUIRED CONCEPTS</a>]':'') +
            //(list == '#jobs-list'?'[<a href=\'/candidatesearch/'+job.code+'\' target=\'_blank\'>'+'find candidates'+'</a>]':'') +
            '<td>[<a href=\'javascript:delJob(\"'+job._id+'\",\"'+(job.concept_id || job._id)+'\")\'>delete</a>]</td>' +
            '</tr>')
          .appendTo($('#jobs-table'));
        });
        //handleJobs(data);
      },
      error: function(err) {
{'fraction_non_alphanumeric': 0.2313235294117647, 'fraction_numerical': 0.006470588235294118, 'mean_word_length': 2.8186412128017966, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 43, 'https://': 1, 'lorem ipsum': 0, 'www.': 2, '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': '6496695', 'n_tokens_mistral': 2234, 'n_tokens_neox': 2177, 'n_words': 435}