<commit_before>// Copyright 2014 Square Inc.
//
//    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() {
  // set up the magic bugs table
  var table = new SortableTable($('#bugs'),
                                "<%= project_environment_bugs_url(@project, @environment, format: 'json') %>",
                                [
                                  { key: 'class_message', title: "Message", sortable: false, htmlGenerator: function(bug) {
                                    var sp = $('<span/>').addClass('long-words').text(bug.message_template);
                                    $('<br/>').prependTo(sp);
                                    $('<tt/>').text(bug.class_name).prependTo(sp);
                                    return sp;
                                  } },
                                  { title: "File", sortable: false, textGenerator: formatBugFile },
                                  { key: 'occurrences', title: "Counts", sortable: 'desc', htmlGenerator: function(bug) {
                                    var sp = $('<span/>');
                                    $('<span/>').text(bug.occurrences_count).addClass('occurrences_count').appendTo(sp);
                                    $('<i/>').addClass('fa fa-exclamation-circle').appendTo(sp);
                                    sp.append(' ');
                                    $('<span/>').text(bug.comments_count).addClass('comments_count').appendTo(sp);
                                    $('<i/>').addClass('fa fa-comment').appendTo(sp);
                                    return sp;
                                  } },
                                  { key: 'latest', title: "Latest", sortable: 'desc', htmlGenerator: function(bug) {
                                    return $('<time/>').attr('datetime', bug.latest_occurrence).liveUpdate();
                                  } },
                                  { title: "B#", sortable: false, textGenerator: function(bug) {
                                    // TODO link to beetil
                                    return bug.beetil_number;
                                  } },
                                  { title: "Ticket", sortable: false, htmlGenerator: function(bug) {
                                    return $('<a/>').attr('href', getJiraTicketUrl(bug.jira_issue)).text(bug.jira_issue).attr('target', '_blank');
                                  } },
                                ],
                                {
                                  sort_key:    'latest',
                                  params:      function() {
                                    return $('#filter').serializeObject();
                                  },
                                  scroll_with: 'number'
                                }
  );

  var refresh = function() {
    var spinner = $('<i/>').addClass('fa fa-refresh').appendTo($('#filter').find('>p:first-child'));
    table.refreshData(function() { spinner.remove(); }, true);
  };

  var getJiraTicketUrl = function(key) {
    return "<%= Service::JIRA.url%>/browse/" + key;
  }

  // changing a filter value refreshes the table
  $('#filter').find('select').change(refresh);
  new DynamicSearchField($('#filter_search'), refresh);
});<commit_msg>CI-147 Add hyperlink to view Beetil tickets to bugs table<commit_after>// Copyright 2014 Square Inc.
//
//    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() {
  // set up the magic bugs table
  var table = new SortableTable($('#bugs'),
                                "<%= project_environment_bugs_url(@project, @environment, format: 'json') %>",
                                [
                                  { key: 'class_message', title: "Message", sortable: false, htmlGenerator: function(bug) {
                                    var sp = $('<span/>').addClass('long-words').text(bug.message_template);
                                    $('<br/>').prependTo(sp);
                                    $('<tt/>').text(bug.class_name).prependTo(sp);
                                    return sp;
                                  } },
                                  { title: "File", sortable: false, textGenerator: formatBugFile },
                                  { key: 'occurrences', title: "Counts", sortable: 'desc', htmlGenerator: function(bug) {
                                    var sp = $('<span/>');
                                    $('<span/>').text(bug.occurrences_count).addClass('occurrences_count').appendTo(sp);
                                    $('<i/>').addClass('fa fa-exclamation-circle').appendTo(sp);
                                    sp.append(' ');
                                    $('<span/>').text(bug.comments_count).addClass('comments_count').appendTo(sp);
                                    $('<i/>').addClass('fa fa-comment').appendTo(sp);
                                    return sp;
                                  } },
                                  { key: 'latest', title: "Latest", sortable: 'desc', htmlGenerator: function(bug) {
                                    return $('<time/>').attr('datetime', bug.latest_occurrence).liveUpdate();
                                  } },
                                  { title: "B#", sortable: false, htmlGenerator: function(bug) {
                                    return $('<a/>').attr('href', getBeetilTicketUrl(bug.beetil_number)).text(bug.beetil_number).attr('target', '_blank');
                                  } },
                                  { title: "Ticket", sortable: false, htmlGenerator: function(bug) {
                                    return $('<a/>').attr('href', getJiraTicketUrl(bug.jira_issue)).text(bug.jira_issue).attr('target', '_blank');
                                  } },
                                ],
                                {
                                  sort_key:    'latest',
                                  params:      function() {
                                    return $('#filter').serializeObject();
                                  },
                                  scroll_with: 'number'
                                }
  );

  var refresh = function() {
    var spinner = $('<i/>').addClass('fa fa-refresh').appendTo($('#filter').find('>p:first-child'));
    table.refreshData(function() { spinner.remove(); }, true);
  };

  var getJiraTicketUrl = function(key) {
    return "<%= Service::JIRA.url%>/browse/" + key;
  }

  var getBeetilTicketUrl = function(number) {
    return "https://desk.gotoassist.com/goto?q=" + number;
  }

  // changing a filter value refreshes the table
  $('#filter').find('select').change(refresh);
  new DynamicSearchField($('#filter_search'), refresh);
});
{'fraction_non_alphanumeric': 0.13627152988855115, 'fraction_numerical': 0.0024062816616008107, 'mean_word_length': 1.3329394387001476, 'pattern_counts': {'":': 0, '<': 30, '<?xml version=': 0, '>': 32, 'https://': 1, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 72, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3714633', 'n_tokens_mistral': 1946, 'n_tokens_neox': 1834, 'n_words': 427}