Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename a few reports js files #35513

Merged
merged 3 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion corehq/apps/export/static/export/js/download_export.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
'analytix/js/google',
'analytix/js/kissmetrix',
'reports/js/filters/bootstrap5/main',
'reports/js/reports.util',
'reports/js/util',
'export/js/utils',
'jquery.cookie/jquery.cookie', // for resuming export downloads on refresh
], function (
Expand All @@ -33,7 +33,7 @@
reportUtils,
exportUtils
) {
'use strict';

Check warning on line 36 in corehq/apps/export/static/export/js/download_export.js

View workflow job for this annotation

GitHub Actions / Lint Javascript

'use strict' is unnecessary inside of modules

var downloadFormModel = function (options) {
assertProperties.assert(options, [
Expand Down
2 changes: 1 addition & 1 deletion corehq/apps/fixtures/static/fixtures/js/view-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ hqDefine("fixtures/js/view-table", [
"jquery",
"hqwebapp/js/initial_page_data",
"reports/js/bootstrap3/standard_hq_report",
"reports/js/bootstrap3/config.dataTables.bootstrap",
"reports/js/bootstrap3/datatables_config",
"reports/js/filters/bootstrap3/main",
"datatables.fixedColumns",
], function (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
hqDefine('hqadmin/js/hqadmin_base_report', [
'jquery',
'hqwebapp/js/initial_page_data',
'reports/js/bootstrap3/config.dataTables.bootstrap',
'reports/js/bootstrap3/datatables_config',
], function (
$,
initialPageData,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
+++
@@ -1,4 +1,4 @@
-hqDefine("reports/js/bootstrap3/reports.async", function () {
+hqDefine("reports/js/bootstrap5/reports.async", function () {
-hqDefine("reports/js/bootstrap3/async", function () {
+hqDefine("reports/js/bootstrap5/async", function () {
return function (o) {
'use strict';
var self = {};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
+++
@@ -1,4 +1,4 @@
-hqDefine("reports/js/bootstrap3/config.dataTables.bootstrap", [
+hqDefine("reports/js/bootstrap5/config.dataTables.bootstrap", [
-hqDefine("reports/js/bootstrap3/datatables_config", [
+hqDefine("reports/js/bootstrap5/datatables_config", [
'jquery',
'underscore',
'analytix/js/google',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
}
);
var table;
- table = hqImport("reports/js/bootstrap3/config.dataTables.bootstrap").HQReportDataTables({
+ table = hqImport("reports/js/bootstrap5/config.dataTables.bootstrap").HQReportDataTables({
- table = hqImport("reports/js/bootstrap3/datatables_config").HQReportDataTables({
+ table = hqImport("reports/js/bootstrap5/datatables_config").HQReportDataTables({
aoColumns: colSorting,
});

Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

var reportOptions = initialPageData.get('js_options') || {};
if (reportOptions.slug && reportOptions.async) {
- var asyncHQReport = hqImport("reports/js/bootstrap3/reports.async")({
+ var asyncHQReport = hqImport("reports/js/bootstrap5/reports.async")({
- var asyncHQReport = hqImport("reports/js/bootstrap3/async")({
+ var asyncHQReport = hqImport("reports/js/bootstrap5/async")({
standardReport: getStandard(),
});
asyncHQReport.init();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
'jquery',
'underscore',
'hqwebapp/js/initial_page_data',
- 'reports/js/bootstrap3/config.dataTables.bootstrap',
- 'reports/js/bootstrap3/datatables_config',
- 'reports/js/bootstrap3/standard_hq_report',
+ 'reports/js/bootstrap5/config.dataTables.bootstrap',
+ 'reports/js/bootstrap5/datatables_config',
+ 'reports/js/bootstrap5/standard_hq_report',
], function (
$,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
{% block js %}{{ block.super }}
{% compress js %}
<script src="{% static 'hqwebapp/js/select2_knockout_bindings.ko.js' %}"></script>
- <script src="{% static 'reports/js/bootstrap3/config.dataTables.bootstrap.js' %}"></script>
+ <script src="{% static 'reports/js/bootstrap5/config.dataTables.bootstrap.js' %}"></script>
- <script src="{% static 'reports/js/bootstrap3/datatables_config.js' %}"></script>
+ <script src="{% static 'reports/js/bootstrap5/datatables_config.js' %}"></script>
<script src="{% static 'reports/js/datepicker.js' %}"></script>
- <script src="{% static 'reports/js/bootstrap3/hq_report.js' %}"></script>
+ <script src="{% static 'reports/js/bootstrap5/hq_report.js' %}"></script>
<script src="{% static 'reports/js/reports.util.js' %}"></script>
- <script src="{% static 'reports/js/bootstrap3/reports.async.js' %}"></script>
<script src="{% static 'reports/js/util.js' %}"></script>
- <script src="{% static 'reports/js/bootstrap3/async.js' %}"></script>
- <script src="{% static 'reports/js/bootstrap3/standard_hq_report.js' %}"></script>
+ <script src="{% static 'reports/js/bootstrap5/reports.async.js' %}"></script>
+ <script src="{% static 'reports/js/bootstrap5/async.js' %}"></script>
+ <script src="{% static 'reports/js/bootstrap5/standard_hq_report.js' %}"></script>
<script src="{% static 'userreports/js/report_analytix.js' %}"></script>
{% endcompress %}
Expand Down
2 changes: 1 addition & 1 deletion corehq/apps/reports/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ class GenericTabularReport(GenericReportView):
bad_request_error_text = None
exporting_as_excel = False

# Sets bSort in the datatables instance to true/false (config.dataTables.bootstrap.js)
# Sets bSort in the datatables instance to true/false (datatables_config.js)
sortable = True

# override old class properties
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
hqDefine("reports/js/bootstrap3/reports.async", function () {
hqDefine("reports/js/bootstrap3/async", function () {
return function (o) {
'use strict';

Check warning on line 3 in corehq/apps/reports/static/reports/js/bootstrap3/async.js

View workflow job for this annotation

GitHub Actions / Lint Javascript

'use strict' is unnecessary inside of modules
var self = {};
self.reportContent = $('#report-content');
self.filterForm = o.filterForm || $('#paramSelectorForm');
Expand Down Expand Up @@ -58,7 +58,7 @@
self.standardReport.filterSubmitButton.addClass('disabled');
}
self.filterForm.submit(function () {
var params = hqImport('reports/js/reports.util').urlSerialize(this);
var params = hqImport('reports/js/util').urlSerialize(this);
if (self.isCaseListRelated(pathName)) {
var url = window.location.href.replace(self.standardReport.urlRoot,
self.standardReport.urlRoot + 'async/') + "?" + "&" + params;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hqDefine("reports/js/bootstrap3/config.dataTables.bootstrap", [
hqDefine("reports/js/bootstrap3/datatables_config", [
'jquery',
'underscore',
'analytix/js/google',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
root.unselectAll();

var node = this;
while (node != null) {

Check failure on line 112 in corehq/apps/reports/static/reports/js/bootstrap3/maps_utils.js

View workflow job for this annotation

GitHub Actions / Lint Javascript

Expected '!==' and instead saw '!='
node.selected(true);
node.expanded(true);
node = node.parent;
Expand Down Expand Up @@ -142,7 +142,7 @@
},

render: function (metric) {
if (metric == null) {

Check failure on line 145 in corehq/apps/reports/static/reports/js/bootstrap3/maps_utils.js

View workflow job for this annotation

GitHub Actions / Lint Javascript

Expected '===' and instead saw '=='
this.$div.hide();
return;
}
Expand All @@ -165,17 +165,17 @@
},

setActive: function (feature, metric) {
if (feature == null ||

Check failure on line 168 in corehq/apps/reports/static/reports/js/bootstrap3/maps_utils.js

View workflow job for this annotation

GitHub Actions / Lint Javascript

Expected '===' and instead saw '=='
(metric == null && !this.options.config.name_column)) { // nothing to show

Check failure on line 169 in corehq/apps/reports/static/reports/js/bootstrap3/maps_utils.js

View workflow job for this annotation

GitHub Actions / Lint Javascript

Expected '===' and instead saw '=='
this.$div.hide();
return;
}

var cols = [];
if (metric != null) {

Check failure on line 175 in corehq/apps/reports/static/reports/js/bootstrap3/maps_utils.js

View workflow job for this annotation

GitHub Actions / Lint Javascript

Expected '!==' and instead saw '!='
forEachDimension(metric, function (type, meta) {
var col = meta.column;
if (cols.indexOf(col) == -1) {

Check failure on line 178 in corehq/apps/reports/static/reports/js/bootstrap3/maps_utils.js

View workflow job for this annotation

GitHub Actions / Lint Javascript

Expected '===' and instead saw '=='
cols.push(col);
}
});
Expand Down Expand Up @@ -263,10 +263,10 @@
});

// make a default detail view if not specified
if (config.detail_columns == null) {

Check failure on line 266 in corehq/apps/reports/static/reports/js/bootstrap3/maps_utils.js

View workflow job for this annotation

GitHub Actions / Lint Javascript

Expected '===' and instead saw '=='
config.detail_columns = getAllCols(config, data);
}
if (config.table_columns == null) {

Check failure on line 269 in corehq/apps/reports/static/reports/js/bootstrap3/maps_utils.js

View workflow job for this annotation

GitHub Actions / Lint Javascript

Expected '===' and instead saw '=='
config.table_columns = config.detail_columns.slice(0);
}

Expand Down Expand Up @@ -353,7 +353,7 @@
if (table !== undefined) {
metrics.table = table;
}
var m = new MetricsControl(metrics).addTo(map);

Check failure on line 356 in corehq/apps/reports/static/reports/js/bootstrap3/maps_utils.js

View workflow job for this annotation

GitHub Actions / Lint Javascript

'm' is assigned a value but never used

zoomToAll(map);
}
Expand Down Expand Up @@ -428,7 +428,7 @@
// generate the proper geojson styling for the given display metric
function makeDisplayContext(metric, setActiveFeature) {
return {
filter: function (feature, layer) {

Check failure on line 431 in corehq/apps/reports/static/reports/js/bootstrap3/maps_utils.js

View workflow job for this annotation

GitHub Actions / Lint Javascript

'layer' is defined but never used
if (feature.geometry.type == "Point") {
feature._conf = markerFactory(metric, feature.properties);
} else {
Expand Down Expand Up @@ -1674,7 +1674,7 @@
}
);
var table;
table = hqImport("reports/js/bootstrap3/config.dataTables.bootstrap").HQReportDataTables({
table = hqImport("reports/js/bootstrap3/datatables_config").HQReportDataTables({
aoColumns: colSorting,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ hqDefine("reports/js/bootstrap3/standard_hq_report", [

var reportOptions = initialPageData.get('js_options') || {};
if (reportOptions.slug && reportOptions.async) {
var asyncHQReport = hqImport("reports/js/bootstrap3/reports.async")({
var asyncHQReport = hqImport("reports/js/bootstrap3/async")({
standardReport: getStandard(),
});
asyncHQReport.init();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ hqDefine("reports/js/bootstrap3/tabular", [
'jquery',
'underscore',
'hqwebapp/js/initial_page_data',
'reports/js/bootstrap3/config.dataTables.bootstrap',
'reports/js/bootstrap3/datatables_config',
'reports/js/bootstrap3/standard_hq_report',
], function (
$,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
hqDefine("reports/js/bootstrap5/reports.async", function () {
hqDefine("reports/js/bootstrap5/async", function () {
return function (o) {
'use strict';

Check warning on line 3 in corehq/apps/reports/static/reports/js/bootstrap5/async.js

View workflow job for this annotation

GitHub Actions / Lint Javascript

'use strict' is unnecessary inside of modules
var self = {};
self.reportContent = $('#report-content');
self.filterForm = o.filterForm || $('#paramSelectorForm');
Expand Down Expand Up @@ -58,7 +58,7 @@
self.standardReport.filterSubmitButton.addClass('disabled');
}
self.filterForm.submit(function () {
var params = hqImport('reports/js/reports.util').urlSerialize(this);
var params = hqImport('reports/js/util').urlSerialize(this);
if (self.isCaseListRelated(pathName)) {
var url = window.location.href.replace(self.standardReport.urlRoot,
self.standardReport.urlRoot + 'async/') + "?" + "&" + params;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hqDefine("reports/js/bootstrap5/config.dataTables.bootstrap", [
hqDefine("reports/js/bootstrap5/datatables_config", [
'jquery',
'underscore',
'analytix/js/google',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1674,7 +1674,7 @@ hqDefine("reports/js/bootstrap5/maps_utils", function () {
}
);
var table;
table = hqImport("reports/js/bootstrap5/config.dataTables.bootstrap").HQReportDataTables({
table = hqImport("reports/js/bootstrap5/datatables_config").HQReportDataTables({
aoColumns: colSorting,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ hqDefine("reports/js/bootstrap5/standard_hq_report", [

var reportOptions = initialPageData.get('js_options') || {};
if (reportOptions.slug && reportOptions.async) {
var asyncHQReport = hqImport("reports/js/bootstrap5/reports.async")({
var asyncHQReport = hqImport("reports/js/bootstrap5/async")({
standardReport: getStandard(),
});
asyncHQReport.init();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ hqDefine("reports/js/bootstrap5/tabular", [
'jquery',
'underscore',
'hqwebapp/js/initial_page_data',
'reports/js/bootstrap5/config.dataTables.bootstrap',
'reports/js/bootstrap5/datatables_config',
'reports/js/bootstrap5/standard_hq_report',
], function (
$,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hqDefine('reports/js/reports.util', ['jquery'], function ($) {
hqDefine('reports/js/util', ['jquery'], function ($) {
return {
urlSerialize: function (filters, exclude) {
exclude = exclude || [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
{% block js %}{{ block.super }}
{% compress js %}
<script src="{% static 'hqwebapp/js/select2_knockout_bindings.ko.js' %}"></script>
<script src="{% static 'reports/js/bootstrap3/config.dataTables.bootstrap.js' %}"></script>
<script src="{% static 'reports/js/bootstrap3/datatables_config.js' %}"></script>
<script src="{% static 'reports/js/datepicker.js' %}"></script>
<script src="{% static 'reports/js/bootstrap3/hq_report.js' %}"></script>
<script src="{% static 'reports/js/reports.util.js' %}"></script>
<script src="{% static 'reports/js/bootstrap3/reports.async.js' %}"></script>
<script src="{% static 'reports/js/util.js' %}"></script>
<script src="{% static 'reports/js/bootstrap3/async.js' %}"></script>
<script src="{% static 'reports/js/bootstrap3/standard_hq_report.js' %}"></script>
<script src="{% static 'userreports/js/report_analytix.js' %}"></script>
{% endcompress %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
{% block js %}{{ block.super }}
{% compress js %}
<script src="{% static 'hqwebapp/js/select2_knockout_bindings.ko.js' %}"></script>
<script src="{% static 'reports/js/bootstrap5/config.dataTables.bootstrap.js' %}"></script>
<script src="{% static 'reports/js/bootstrap5/datatables_config.js' %}"></script>
<script src="{% static 'reports/js/datepicker.js' %}"></script>
<script src="{% static 'reports/js/bootstrap5/hq_report.js' %}"></script>
<script src="{% static 'reports/js/reports.util.js' %}"></script>
<script src="{% static 'reports/js/bootstrap5/reports.async.js' %}"></script>
<script src="{% static 'reports/js/util.js' %}"></script>
<script src="{% static 'reports/js/bootstrap5/async.js' %}"></script>
<script src="{% static 'reports/js/bootstrap5/standard_hq_report.js' %}"></script>
<script src="{% static 'userreports/js/report_analytix.js' %}"></script>
{% endcompress %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ <h2 id="datatables" class="pt-4">
<p>
In CommCare HQ, we have created a wrapper class around our reporting use of datatables called
<code>GenericTabularReport</code>, which takes care of generating the datatables configuration in
<code>config.dataTables.bootstrap.js</code>. This was done in an effort to reduce the amount of HTML and
<code>datatables_config.js</code>. This was done in an effort to reduce the amount of HTML and
javascript required to create a report, as generating custom reports for projects was once very common in HQ.
With the introduction of User Configurable Reports (UCRs), this need for quickly creating these hard-coded
custom reports has since been eliminated.
Expand All @@ -194,7 +194,7 @@ <h2 id="datatables" class="pt-4">
</p>
<p>
When our reporting tools were created, DataTables was still a fairly young library and had its own set of issues,
which you can see in <code>config.dataTables.bootstrap.js</code> if you examine the strangely named variables in
which you can see in <code>datatables_config.js</code> if you examine the strangely named variables in
still in "hungarian notation" style. Thankfully, the developers of dataTables have kept later versions
backwards-compatible with this older notation, but for reference here is a
<a href="https://datatables.net/upgrade/1.10-convert" target="_blank">conversion guide</a> for the older configuration
Expand All @@ -204,7 +204,7 @@ <h2 id="datatables" class="pt-4">
{# todo future developer: remove with use_bootstrap5 removal cleanup and revisit text above too #}
<strong>Important:</strong> As of the time of this writing, the Bootstrap 3 to 5 migration is still ongoing
and the Reporting section has not yet been migrated. Please ensure that during that migration, the notation in
<code>config.dataTables.bootstrap.js</code> is updated. Thank you.
<code>datatables_config.js</code> is updated. Thank you.
</div>
<h3 id="datatables-simple" class="pt-3">
Simple Example
Expand Down
2 changes: 1 addition & 1 deletion corehq/apps/toggle_ui/static/toggle_ui/js/flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ hqDefine('toggle_ui/js/flags', [
'knockout',
'underscore',
'hqwebapp/js/bootstrap3/alert_user',
'reports/js/bootstrap3/config.dataTables.bootstrap',
'reports/js/bootstrap3/datatables_config',
'hqwebapp/js/components/select_toggle',
'commcarehq',
], function (
Expand Down
2 changes: 1 addition & 1 deletion corehq/apps/userreports/static/userreports/js/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ hqDefine('userreports/js/base', function () {
}
};

var reportTables = hqImport("reports/js/bootstrap3/config.dataTables.bootstrap").HQReportDataTables({
var reportTables = hqImport("reports/js/bootstrap3/datatables_config").HQReportDataTables({
dataTableElem: '#report_table_' + initialPageData.get('report_slug'),
defaultRows: initialPageData.get('table_default_rows'),
startAtRowNum: initialPageData.get('table_start_at_row'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ hqDefine("userreports/js/configurable_report", function () {
hqImport('userreports/js/report_analytix').track.event.apply(this, e);
});

var urlSerialize = hqImport('reports/js/reports.util').urlSerialize;
var urlSerialize = hqImport('reports/js/util').urlSerialize;
var reportOptions = {
domain: initialPageData.get('domain'),
urlRoot: initialPageData.get('url_root'),
Expand Down
2 changes: 1 addition & 1 deletion corehq/apps/userreports/templates/userreports/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{% block js %}{{ block.super }}
{% compress js %}
<script src="{% static 'hqwebapp/js/select2_knockout_bindings.ko.js' %}"></script>
<script src="{% static 'reports/js/bootstrap3/config.dataTables.bootstrap.js' %}"></script>
<script src="{% static 'reports/js/bootstrap3/datatables_config.js' %}"></script>
<script src="{% static 'reports_core/js/choice_list_utils.js' %}"></script>
<script src="{% static 'reports_core/js/charts.js' %}"></script>
<script src="{% static 'userreports/js/report_analytix.js' %}"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

{% block js %}{{ block.super }}
{% compress js %}
<script src="{% static 'reports/js/reports.util.js' %}"></script>
<script src="{% static 'reports/js/util.js' %}"></script>
<script src="{% static 'reports/js/bootstrap3/hq_report.js' %}"></script>
<script src="{% static 'reports/js/bootstrap3/standard_hq_report.js' %}"></script>
<script src="{% static 'reports/js/bootstrap3/report_config_models.js' %}"></script>
Expand Down
2 changes: 1 addition & 1 deletion custom/inddex/templates/inddex/partials/report_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<script>
{% if report_table and report_table.datatables %}
$(function() {
var reportTables = hqImport("reports/js/bootstrap3/config.dataTables.bootstrap").HQReportDataTables({
var reportTables = hqImport("reports/js/bootstrap3/datatables_config").HQReportDataTables({
dataTableElem: '#report_table_{{ report_table.slug }}',
defaultRows: {{ report_table.default_rows|default:10 }},
startAtRowNum: {{ report_table.start_at_row|default:0 }},
Expand Down
Loading