<commit_before>/*jshint browser: true */
/*jshint unused: false */
/*global _, Backbone, templateEngine, window, setTimeout, clearTimeout, arangoHelper, Joi, $*/

(function() {
  "use strict";
  window.CollectionsView = Backbone.View.extend({
    el: '#content',
    el2: '#collectionsThumbnailsIn',

    searchTimeout: null,
    refreshRate: 2000,

    template: templateEngine.createTemplate("collectionsView.ejs"),

    checkLockedCollections: function() {

      var self = this,
      lockedCollections = window.arangoHelper.syncAndReturnUninishedAardvarkJobs('index');

      this.collection.each(function(model) {
        model.set('locked', false);
      });

      _.each(lockedCollections, function(locked) {
        var model = self.collection.findWhere({
          id: locked.collection 
        });
        model.set('locked', true);
        model.set('lockType', locked.type);
        model.set('desc', locked.desc);
      });

      this.collection.each(function(model) {
        if (model.get("locked") || model.get("status") === 'loading') {
          $('#collection_' + model.get("name")).addClass('locked');
        }
        else {
          $('#collection_' + model.get("name")).removeClass('locked');
          $('#collection_' + model.get("name") + ' .corneredBadge').text(model.get("status"));
          if ($('#collection_' + model.get("name") + ' .corneredBadge').hasClass('inProgress')) {
            $('#collection_' + model.get("name") + ' .corneredBadge').removeClass('inProgress');
            $('#collection_' + model.get("name") + ' .corneredBadge').addClass('loaded');
          }
        }
        if (model.get("status") === 'loading') {
          $('#collection_' + model.get("name")).removeClass('loading');
        }
      });

    },

    initialize: function() {
      var self = this;

      window.setInterval(function() {
        self.checkLockedCollections();
      }, self.refreshRate);

    },

    render: function () {

      this.checkLockedCollections();
      var dropdownVisible = false;

      if ($('#collectionsDropdown').is(':visible')) {
        dropdownVisible = true;
      }

      $(this.el).html(this.template.render({}));
      this.setFilterValues();
<commit_msg>pending jobs call only at colls view<commit_after>/*jshint browser: true */
/*jshint unused: false */
/*global _, Backbone, templateEngine, window, setTimeout, clearTimeout, arangoHelper, Joi, $*/

(function() {
  "use strict";
  window.CollectionsView = Backbone.View.extend({
    el: '#content',
    el2: '#collectionsThumbnailsIn',

    searchTimeout: null,
    refreshRate: 2000,

    template: templateEngine.createTemplate("collectionsView.ejs"),

    checkLockedCollections: function() {

      if (window.location.hash === '#collections') {
        var self = this,
        lockedCollections = window.arangoHelper.syncAndReturnUninishedAardvarkJobs('index');

        this.collection.each(function(model) {
          model.set('locked', false);
        });

        _.each(lockedCollections, function(locked) {
          var model = self.collection.findWhere({
            id: locked.collection 
          });
          model.set('locked', true);
          model.set('lockType', locked.type);
          model.set('desc', locked.desc);
        });

        this.collection.each(function(model) {
          if (model.get("locked") || model.get("status") === 'loading') {
            $('#collection_' + model.get("name")).addClass('locked');
          }
          else {
            $('#collection_' + model.get("name")).removeClass('locked');
            $('#collection_' + model.get("name") + ' .corneredBadge').text(model.get("status"));
            if ($('#collection_' + model.get("name") + ' .corneredBadge').hasClass('inProgress')) {
              $('#collection_' + model.get("name") + ' .corneredBadge').removeClass('inProgress');
              $('#collection_' + model.get("name") + ' .corneredBadge').addClass('loaded');
            }
          }
          if (model.get("status") === 'loading') {
            $('#collection_' + model.get("name")).removeClass('loading');
          }
        });
      }

    },

    initialize: function() {
      var self = this;

      window.setInterval(function() {
        self.checkLockedCollections();
      }, self.refreshRate);

    },

    render: function () {

      this.checkLockedCollections();
      var dropdownVisible = false;

      if ($('#collectionsDropdown').is(':visible')) {
        dropdownVisible = true;
      }

      $(this.el).html(this.template.render({}));
      this.setFilterValues();

{'fraction_non_alphanumeric': 0.1752936059156155, 'fraction_numerical': 0.002174858634188778, 'mean_word_length': 2.676258992805755, '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': '2498553', 'n_tokens_mistral': 1326, 'n_tokens_neox': 1297, 'n_words': 209}