<commit_before>{% extends "reports/bootstrap3/base_template.html" %}
{% load hq_shared_tags %}
{% load compress %}
{% load i18n %}
{% block stylesheets %}
<link rel="stylesheet" href="{% new_static 'codemirror/lib/codemirror.css' %}"
/>{% endblock stylesheets %}

{% compress js %}
{% block js %}{{ block.super }}
<script src="{% new_static 'codemirror/lib/codemirror.js' %}"></script>
<script src="{% new_static 'codemirror/mode/xml/xml.js' %}"></script>
<script src="{% new_static 'codemirror/mode/javascript/javascript.js' %}"></script>
{% endblock js %}
{% endcompress %}

{% block js-inline %}{{ block.super }}
<script>
    $(document).ready(function() {
        $('#view-record-payload-modal').on('shown.bs.modal', function(event) {
            var recordData = $(event.relatedTarget).data(),
                $modal = $(this);

            $.get("{% url 'repeat_record' domain %}", { record_id: recordData.recordId })
                .success(function(data) {
                    var $payload = $modal.find('.payload'),
                        codeMirror,
                        contentType = data.content_type,
                        mode = 'xml';

                    if (contentType === 'text/xml') {
                        mode = 'xml';
                    } else if (contentType === 'application/json') {
                        mode = { name: 'javascript', json: true };
                    }

                    codeMirror = CodeMirror($payload[0], {
                        value: data.payload,
                        mode: mode,
                        readOnly: true,
                        lineNumbers: true,
                        lineWrapping: true
                    });
                    codeMirror.refresh();

                })
                .fail(function(data) {
                    $modal.find('.modal-body').html('fail')
                });
        })

        $('#report-content').on('click', '.resend-record-payload', function() {
              var $btn = $(this),
                  recordId = $btn.data().recordId;
              $btn.disableButton();

              $.post("{% url 'repeat_record' domain %}", { record_id: recordId })
                  .success(function(data) {
                      $btn.removeSpinnerFromButton();
                      if (data.success) {
                          $btn.text(gettext('Success!'));
                          $btn.addClass('btn-success');
                      } else {
                          $btn.text(gettext('Failed'));
                          $btn.addClass('btn-danger');
                          $('#payload-error-modal').modal(
                              'show')
                          $(
                              '#payload-error-modal .error-message'
                          ).text(data.failure_reason);
                      }

                  })
                  .fail(function(data) {
                      $btn.removeSpinnerFromButton();
                      $btn.text(gettext('Failed to send'));
                      $btn.addClass('btn-danger');
                  });
          });
    });
</script>
{% endblock js-inline %} {% block modals %}{{ block.super }}
<!-- View Repeat Record Modal -->
<div class="modal fade" id="view-record-payload-modal" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">{% trans "Payload" %}</h4>
            </div>
            <div class="modal-body">
                <div class="payload"></div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">
                  {% trans "Close" %}<commit_msg>[ci skip] better js formatting<commit_after>{% extends "reports/bootstrap3/base_template.html" %}
{% load hq_shared_tags %}
{% load compress %}
{% load i18n %}
{% block stylesheets %}
<link rel="stylesheet" href="{% new_static 'codemirror/lib/codemirror.css' %}"
/>{% endblock stylesheets %}

{% compress js %}
{% block js %}{{ block.super }}
<script src="{% new_static 'codemirror/lib/codemirror.js' %}"></script>
<script src="{% new_static 'codemirror/mode/xml/xml.js' %}"></script>
<script src="{% new_static 'codemirror/mode/javascript/javascript.js' %}"></script>
{% endblock js %}
{% endcompress %}

{% block js-inline %}{{ block.super }}
<script>
    $(document).ready(function() {
        $('#view-record-payload-modal').on('shown.bs.modal', function(event) {
            var recordData = $(event.relatedTarget).data(),
                $modal = $(this);

            $.get("{% url 'repeat_record' domain %}", { record_id: recordData.recordId })
                .success(function(data) {
                    var $payload = $modal.find('.payload'),
                        codeMirror,
                        contentType = data.content_type,
                        mode = 'xml';

                    if (contentType === 'text/xml') {
                        mode = 'xml';
                    } else if (contentType === 'application/json') {
                        mode = { name: 'javascript', json: true };
                    }

                    codeMirror = CodeMirror($payload[0], {
                        value: data.payload,
                        mode: mode,
                        readOnly: true,
                        lineNumbers: true,
                        lineWrapping: true
                    });
                    codeMirror.refresh();

                })
                .fail(function(data) {
                    $modal.find('.modal-body').html('fail')
                });
        })

        $('#report-content').on('click', '.resend-record-payload', function() {
              var $btn = $(this),
                  recordId = $btn.data().recordId;
              $btn.disableButton();

              $.post("{% url 'repeat_record' domain %}", { record_id: recordId })
                  .success(function(data) {
                      $btn.removeSpinnerFromButton();
                      if (data.success) {
                          $btn.text(gettext('Success!'));
                          $btn.addClass('btn-success');
                      } else {
                          $btn.text(gettext('Failed'));
                          $btn.addClass('btn-danger');
                          $('#payload-error-modal').modal('show');
                          $('#payload-error-modal .error-message').text(data.failure_reason);
                      }

                  })
                  .fail(function(data) {
                      $btn.removeSpinnerFromButton();
                      $btn.text(gettext('Failed to send'));
                      $btn.addClass('btn-danger');
                  });
          });
    });
</script>
{% endblock js-inline %} {% block modals %}{{ block.super }}
<!-- View Repeat Record Modal -->
<div class="modal fade" id="view-record-payload-modal" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">{% trans "Payload" %}</h4>
            </div>
            <div class="modal-body">
                <div class="payload"></div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">
                  {% trans "Close" %}
{'fraction_non_alphanumeric': 0.16054752462581554, 'fraction_numerical': 0.0017909684022003327, 'mean_word_length': 1.4771863117870723, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 57, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 10}, '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': '13821', 'n_tokens_mistral': 2152, 'n_tokens_neox': 1965, 'n_words': 366}