<commit_before>{% extends "reports_core/base_template_new.html" %}
{% load i18n %}
{% load hq_shared_tags %}
{% block js %}{{ block.super }}
    <script src="{% static 'hqwebapp/js/lib/jquery-ui-datepicker/jquery-ui-1.8.17.custom.datepicker.min.js' %}"></script>
    <script src="{% static 'hqwebapp/js-custom/hq.legacy.js' %}"></script>
    <script src="{% static 'reports/javascripts/reports.config.js' %}"></script>
    <script src="{% static 'reports/ko/saved_reports.js' %}"></script>
{% endblock %}
{% block js-inline %}{{ block.super }}
    <script type="text/javascript">
        $(function(){
            // Poll the status of the data source
            var retrying = false;
            (function poll() {
                $.ajax({
                    url: "{% url 'configurable_data_source_status' domain report.spec.config_id %}",
                    dataType: 'json',
                    success: function(data) {
                        if (data.isBuilt){
                            $('#built-warning').addClass('hide');
                            if (retrying){
                                location.reload();
                            } else {
                                $('#report-filters').submit();
                            }
                        } else {
                            retrying = true;
                            $('#built-warning').removeClass('hide');
                            setTimeout(poll, 5000);
                        }
                    }
                });
            })();
        });
    </script>

    <script type="text/javascript">
        var standardHQReport = new HQReport({
            domain: '{{ domain }}',
            urlRoot: '{{ report.url_root }}',
            slug: {{ report.slug|JSON }},
            subReportSlug: {{ report.sub_slug|JSON }},
            type: {{ report.type|JSON }},
            filterSet: {{ report.filter_set|JSON }},
            needsFilters: {{ report.needs_filters|JSON }},
            isExportable: {{ report.is_exportable|JSON }},
            isExportAll: {{ report.is_export_all|JSON }},
            isEmailable: {{ report.is_emailable|JSON }},
            emailDefaultSubject: {{ report.title|JSON }},
            emailSuccessMessage: "{% trans 'Report successfully emailed' %}",
            emailErrorMessage: "{% trans 'An error occurred emailing you report. Please try again.' %}",

            {% if request.datespan %}
                datespan: {
                    startdate: '{{ datespan.startdate|date:"Y-m-d" }}',
                    enddate: '{{ datespan.enddate|date:"Y-m-d" }}'
                },
            {% endif %}
        });
        standardHQReport.init();

        // Bind the ReportConfigsViewModel to the save button.
        var defaultConfig = {{ default_config|JSON }};
        {% if report.has_datespan %}
            if(!defaultConfig.date_range) {
                defaultConfig.date_range = 'last7';
            }
            defaultConfig.has_ucr_datespan = true;
            defaultConfig.datespan_filters = {{ datespan_filters|JSON }};
        {% else %}
            defaultConfig.date_range = null;
            defaultConfig.has_ucr_datespan = false;
            defaultConfig.datespan_filters = [];
        {% endif %}
        if(!defaultConfig.datespan_slug) {
            defaultConfig.datespan_slug = null;
        }
        $("#savedReports").reportUserConfigurableConfigEditor({
            filterForm: $("#report-filters"),
            items: {{ report_configs|JSON }},
            defaultItem: defaultConfig,
            saveUrl: '{% url "add_report_config" domain %}'
        });

        $('#email-enabled').tooltip({
            placement: 'right',
            html: true,
            title: '{% trans "You can email a saved version<br />of this report." %}'
        });
    </script>
{% endblock %}
{% block main_column_content %}
    <div id="built-warning" class="alert alert-info hide">
        {% blocktrans %}
        Warning! Your report is still being populated.
        What you are seeing now is just a preview, and contains some or none of your data.
        The report will refresh automatically when the data is finished being populated.
        {% endblocktrans %}
    </div>
    {% if request|toggle_enabled:"USER_CONFIGURABLE_REPORTS" and not report.spec.report_meta.created_by_builder or request|toggle_enabled:"REPORT_BUILDER" and report.spec.report_meta.created_by_builder %}
    <div class="clearfix">
        <div class="pull-right">
            <a class="btn btn-primary" href="
                {% if report.spec.report_meta.created_by_builder %}
                    {% url 'edit_report_in_builder' domain report.report_config_id %}
                {% else %}
                    {% url 'edit_configurable_report' domain report.report_config_id %}
                {% endif %}
            ">
                {% trans "Edit Report" %}
            </a>
        </div>
    </div>
    {% endif %}<commit_msg>move built-warning to appropriate template block<commit_after>{% extends "reports_core/base_template_new.html" %}
{% load i18n %}
{% load hq_shared_tags %}
{% block js %}{{ block.super }}
    <script src="{% static 'hqwebapp/js/lib/jquery-ui-datepicker/jquery-ui-1.8.17.custom.datepicker.min.js' %}"></script>
    <script src="{% static 'hqwebapp/js-custom/hq.legacy.js' %}"></script>
    <script src="{% static 'reports/javascripts/reports.config.js' %}"></script>
    <script src="{% static 'reports/ko/saved_reports.js' %}"></script>
{% endblock %}
{% block js-inline %}{{ block.super }}
    <script type="text/javascript">
        $(function(){
            // Poll the status of the data source
            var retrying = false;
            (function poll() {
                $.ajax({
                    url: "{% url 'configurable_data_source_status' domain report.spec.config_id %}",
                    dataType: 'json',
                    success: function(data) {
                        if (data.isBuilt){
                            $('#built-warning').addClass('hide');
                            if (retrying){
                                location.reload();
                            } else {
                                $('#report-filters').submit();
                            }
                        } else {
                            retrying = true;
                            $('#built-warning').removeClass('hide');
                            setTimeout(poll, 5000);
                        }
                    }
                });
            })();
        });
    </script>

    <script type="text/javascript">
        var standardHQReport = new HQReport({
            domain: '{{ domain }}',
            urlRoot: '{{ report.url_root }}',
            slug: {{ report.slug|JSON }},
            subReportSlug: {{ report.sub_slug|JSON }},
            type: {{ report.type|JSON }},
            filterSet: {{ report.filter_set|JSON }},
            needsFilters: {{ report.needs_filters|JSON }},
            isExportable: {{ report.is_exportable|JSON }},
            isExportAll: {{ report.is_export_all|JSON }},
            isEmailable: {{ report.is_emailable|JSON }},
            emailDefaultSubject: {{ report.title|JSON }},
            emailSuccessMessage: "{% trans 'Report successfully emailed' %}",
            emailErrorMessage: "{% trans 'An error occurred emailing you report. Please try again.' %}",

            {% if request.datespan %}
                datespan: {
                    startdate: '{{ datespan.startdate|date:"Y-m-d" }}',
                    enddate: '{{ datespan.enddate|date:"Y-m-d" }}'
                },
            {% endif %}
        });
        standardHQReport.init();

        // Bind the ReportConfigsViewModel to the save button.
        var defaultConfig = {{ default_config|JSON }};
        {% if report.has_datespan %}
            if(!defaultConfig.date_range) {
                defaultConfig.date_range = 'last7';
            }
            defaultConfig.has_ucr_datespan = true;
            defaultConfig.datespan_filters = {{ datespan_filters|JSON }};
        {% else %}
            defaultConfig.date_range = null;
            defaultConfig.has_ucr_datespan = false;
            defaultConfig.datespan_filters = [];
        {% endif %}
        if(!defaultConfig.datespan_slug) {
            defaultConfig.datespan_slug = null;
        }
        $("#savedReports").reportUserConfigurableConfigEditor({
            filterForm: $("#report-filters"),
            items: {{ report_configs|JSON }},
            defaultItem: defaultConfig,
            saveUrl: '{% url "add_report_config" domain %}'
        });

        $('#email-enabled').tooltip({
            placement: 'right',
            html: true,
            title: '{% trans "You can email a saved version<br />of this report." %}'
        });
    </script>
{% endblock %}
{% block report_alerts %}
    <div id="built-warning" class="alert alert-info hide">
        {% blocktrans %}
        Warning! Your report is still being populated.
        What you are seeing now is just a preview, and contains some or none of your data.
        The report will refresh automatically when the data is finished being populated.
        {% endblocktrans %}
    </div>
{% endblock %}
{% block main_column_content %}
    {% if request|toggle_enabled:"USER_CONFIGURABLE_REPORTS" and not report.spec.report_meta.created_by_builder or request|toggle_enabled:"REPORT_BUILDER" and report.spec.report_meta.created_by_builder %}
    <div class="clearfix">
        <div class="pull-right">
            <a class="btn btn-primary" href="
                {% if report.spec.report_meta.created_by_builder %}
                    {% url 'edit_report_in_builder' domain report.report_config_id %}
                {% else %}
                    {% url 'edit_configurable_report' domain report.report_config_id %}
                {% endif %}
            ">
                {% trans "Edit Report" %}
            </a>
        </div>
    </div>
    {% endif %}
{'fraction_non_alphanumeric': 0.13420214882610426, 'fraction_numerical': 0.0021886191802626344, 'mean_word_length': 1.7392370572207085, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 45, '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': '7060637', 'n_tokens_mistral': 2805, 'n_tokens_neox': 2618, 'n_words': 542}