Skip to content

Commit 3fd940e

Browse files
committed
Merge branch 'dev' of https://github.com/NASA-IMPACT/COSMOS into 1269-fix-celery-trigger
2 parents 4a15389 + 3a54955 commit 3fd940e

File tree

4 files changed

+40
-16
lines changed

4 files changed

+40
-16
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,14 @@ For each PR made, an entry should be added to this changelog. It should contain
137137
- Description: The feedback form API was throwing CORS errors and to rectify that, we need to add the apt https link for sde-lrm.
138138
- Changes:
139139
- Added `https://sde-lrm.nasa-impact.net` to `CORS_ALLOWED_ORIGINS` in the base settings.
140+
141+
- 1252-document-type-filter-not-working-in-delta-urls-page
142+
- Description: Fixed document type filtering functionality in the "Document Type Patterns" tab in Delta URLs page.
143+
- Changes:
144+
- Added a new event listener to the Document Type Patterns dropdown to trigger the filtering of the table results based on the selected value.
145+
146+
- 1251-column-sorting-issue-curated-urls-count-sorts-by-delta-urls-count
147+
- Description: Fixed incorrect sorting behavior in Collections table where sorting by Curated URLs column was not working as expected.
148+
- Changes:
149+
- Added `data-order` attribute to URL count columns for proper numeric sorting
150+
- Updated SearchPane comparisons to use `@data-order` values instead of string-based loose equality checks to ensure correct numeric filtering

sde_indexing_helper/static/js/collection_list.js

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -138,43 +138,47 @@ let table = $("#collection_table").DataTable({
138138
{
139139
label: "0 URLs",
140140
value: function (rowData, rowIdx) {
141-
return $(rowData[COLUMNS.DELTA_URLS]).text() == 0;
141+
return parseInt(rowData[COLUMNS.DELTA_URLS]['@data-order']) === 0;
142142
},
143143
},
144144
{
145145
label: "1 solo URL",
146146
value: function (rowData, rowIdx) {
147-
return $(rowData[COLUMNS.DELTA_URLS]).text() == 1;
147+
return parseInt(rowData[COLUMNS.DELTA_URLS]['@data-order']) === 1;
148148
},
149149
},
150150
{
151151
label: "1 to 100 URLs",
152152
value: function (rowData, rowIdx) {
153-
return $(rowData[COLUMNS.DELTA_URLS]).text() <= 100 && $(rowData[COLUMNS.DELTA_URLS]).text() > 1;
153+
const value = parseInt(rowData[COLUMNS.DELTA_URLS]['@data-order']);
154+
return value > 1 && value <= 100;
154155
},
155156
},
156157
{
157158
label: "100 to 1,000 URLs",
158159
value: function (rowData, rowIdx) {
159-
return $(rowData[COLUMNS.DELTA_URLS]).text() <= 1000 && $(rowData[COLUMNS.DELTA_URLS]).text() > 100;
160+
const value = parseInt(rowData[COLUMNS.DELTA_URLS]['@data-order']);
161+
return value > 100 && value <= 1000;
160162
},
161163
},
162164
{
163165
label: "1,000 to 10,000 URLs",
164166
value: function (rowData, rowIdx) {
165-
return $(rowData[COLUMNS.DELTA_URLS]).text() <= 10000 && $(rowData[COLUMNS.DELTA_URLS]).text() > 1000;
167+
const value = parseInt(rowData[COLUMNS.DELTA_URLS]['@data-order']);
168+
return value > 1000 && value <= 10000;
166169
},
167170
},
168171
{
169172
label: "10,000 to 100,000 URLs",
170173
value: function (rowData, rowIdx) {
171-
return $(rowData[COLUMNS.DELTA_URLS]).text() <= 100000 && $(rowData[COLUMNS.DELTA_URLS]).text() > 10000;
174+
const value = parseInt(rowData[COLUMNS.DELTA_URLS]['@data-order']);
175+
return value > 10000 && value <= 100000;
172176
},
173177
},
174178
{
175179
label: "Over 100,000 URLs",
176180
value: function (rowData, rowIdx) {
177-
return $(rowData[COLUMNS.DELTA_URLS]).text() > 100000;
181+
return parseInt(rowData[COLUMNS.DELTA_URLS]['@data-order']) > 100000;
178182
},
179183
},
180184
],
@@ -189,43 +193,47 @@ let table = $("#collection_table").DataTable({
189193
{
190194
label: "0 URLs",
191195
value: function (rowData, rowIdx) {
192-
return $(rowData[COLUMNS.CURATED_URLS]).text() == 0;
196+
return parseInt(rowData[COLUMNS.CURATED_URLS]['@data-order']) === 0;
193197
},
194198
},
195199
{
196200
label: "1 solo URL",
197201
value: function (rowData, rowIdx) {
198-
return $(rowData[COLUMNS.CURATED_URLS]).text() == 1;
202+
return parseInt(rowData[COLUMNS.CURATED_URLS]['@data-order']) === 1;
199203
},
200204
},
201205
{
202206
label: "1 to 100 URLs",
203207
value: function (rowData, rowIdx) {
204-
return $(rowData[COLUMNS.CURATED_URLS]).text() <= 100 && $(rowData[COLUMNS.CURATED_URLS]).text() > 1;
208+
const value = parseInt(rowData[COLUMNS.CURATED_URLS]['@data-order']);
209+
return value > 1 && value <= 100;
205210
},
206211
},
207212
{
208213
label: "100 to 1,000 URLs",
209214
value: function (rowData, rowIdx) {
210-
return $(rowData[COLUMNS.CURATED_URLS]).text() <= 1000 && $(rowData[COLUMNS.CURATED_URLS]).text() > 100;
215+
const value = parseInt(rowData[COLUMNS.CURATED_URLS]['@data-order']);
216+
return value > 100 && value <= 1000;
211217
},
212218
},
213219
{
214220
label: "1,000 to 10,000 URLs",
215221
value: function (rowData, rowIdx) {
216-
return $(rowData[COLUMNS.CURATED_URLS]).text() <= 10000 && $(rowData[COLUMNS.CURATED_URLS]).text() > 1000;
222+
const value = parseInt(rowData[COLUMNS.CURATED_URLS]['@data-order']);
223+
return value > 1000 && value <= 10000;
217224
},
218225
},
219226
{
220227
label: "10,000 to 100,000 URLs",
221228
value: function (rowData, rowIdx) {
222-
return $(rowData[COLUMNS.CURATED_URLS]).text() <= 100000 && $(rowData[COLUMNS.CURATED_URLS]).text() > 10000;
229+
const value = parseInt(rowData[COLUMNS.CURATED_URLS]['@data-order']);
230+
return value > 10000 && value <= 100000;
223231
},
224232
},
225233
{
226234
label: "Over 100,000 URLs",
227235
value: function (rowData, rowIdx) {
228-
return $(rowData[COLUMNS.CURATED_URLS]).text() > 100000;
236+
return parseInt(rowData[COLUMNS.CURATED_URLS]['@data-order']) > 100000;
229237
},
230238
},
231239
],

sde_indexing_helper/static/js/delta_url_list.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -881,6 +881,11 @@ function initializeDataTable() {
881881
$("#deltaDocTypeMatchPatternFilter").on("beforeinput", function (val) {
882882
document_type_patterns_table.columns(0).search(this.value).draw();
883883
});
884+
885+
$("#document-type-patterns-dropdown-2").on("change", function () {
886+
document_type_patterns_table.columns(2).search(this.value).draw();
887+
});
888+
884889
}
885890

886891
var division_patterns_table = $("#division_patterns_table").DataTable({

sde_indexing_helper/templates/sde_collections/collection_list.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,14 @@ <h2 class="title">Welcome back!</h2>
151151
<td class="whiteText noBorder">{{ collection.get_division_display }}</td>
152152

153153
<!-- Delta URLs Column - Shows count and links if >= 0 -->
154-
<td class="noBorder centerAlign">
154+
<td class="noBorder centerAlign" data-order="{{ collection.num_delta_urls }}">
155155
<a href=" {% if collection.num_delta_urls >= 0 %} {% url 'sde_collections:delta_urls' collection.pk %} {% endif %} "
156156
class="btn btn-sm {% if collection.num_delta_urls >= 0 %}btn-primary {% else %}disabled{% endif %}candidateCount"
157157
role="button">{{ collection.num_delta_urls|intcomma }}</a>
158158
</td>
159159

160160
<!-- Curated URLs Column - Shows count and links if >= 0 -->
161-
<td class="noBorder centerAlign">
161+
<td class="noBorder centerAlign" data-order="{{ collection.num_curated_urls }}">
162162
<a href=" {% if collection.num_curated_urls >= 0 %} {% url 'sde_collections:delta_urls' collection.pk %} {% endif %} "
163163
class="btn btn-sm {% if collection.num_curated_urls >= 0 %}btn-primary {% else %}disabled{% endif %}candidateCount"
164164
role="button">{{ collection.num_curated_urls|intcomma }}</a>

0 commit comments

Comments
 (0)