Skip to content

Commit e012f18

Browse files
authored
Merge branch 'dev' into 1014-add-logs-when-importing-urls-so-we-know-how-many-were-expected-how-many-succeeded-and-how-many-failed
2 parents 016442f + 87134cc commit e012f18

File tree

2 files changed

+55
-111
lines changed

2 files changed

+55
-111
lines changed

CHANGELOG.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,19 @@ For each PR made, an entry should be added to this changelog. It should contain
3636
- Used regex to catch any HTML content comming in as an input to form fields
3737
- Called this class within the serializer for necessary fields
3838

39+
3940
- 1014-add-logs-when-importing-urls-so-we-know-how-many-were-expected-how-many-succeeded-and-how-many-failed
40-
- Description: When URLs of a given collection are imported into COSMOS, a Slack notification is sent. This notification includes the total count of the existing curated URLs, URLs imported from the server, dump URLs imported, delta URLs identified and delta URLs marked for deletion.
41+
- Description: When URLs of a given collection are imported into COSMOS, a Slack notification is sent. This notification includes the name of the collection imported,count of the existing curated URLs, total URLs count as per the server, URLs successfully imported from the server, delta URLs identified and delta URLs marked for deletion.
4142
- Changes:
42-
- Updated collection class to include the following functions: count_curated_urls(),count_dump_urls(),count_delta_urls(),count_marked_for_deletion_urls()
43-
- fetch_and_replace_full_text() triggers send_detailed_import_notification()
43+
- The get_full_texts() function in sde_collections/sinequa_api.py is updated to yeild total_count along with rows.
44+
- fetch_and_replace_full_text() function in sde_collections/tasks.py captures the total_server_count and triggers send_detailed_import_notification().
4445
- Added a function send_detailed_import_notification() in sde_collections/utils/slack_utils.py to structure the notification to be sent.
4546
- Updated the associated tests effected due to inclusion of this functionality.
47+
48+
- 3227-bugfix-title-patterns-selecting-multi-url-pattern-does-nothing
49+
- Description: When selecting options from the match pattern type filter, the system does not filter the results as expected. Instead of displaying only the chosen variety of patterns, it continues to show all patterns.
50+
- Changes:
51+
- In `title_patterns_table` definition, corrected the column reference
52+
- Made `match_pattern_type` searchable
53+
- Corrected the column references and made code consistent on all the other tables, i.e., `exclude_patterns_table`, `include_patterns_table`, `division_patterns_table` and `document_type_patterns_table`
54+

sde_indexing_helper/static/js/delta_url_list.js

Lines changed: 43 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -578,12 +578,10 @@ function initializeDataTable() {
578578
$("#exclude-patterns-dropdown-1").prop("disabled", true);
579579
} else if (index === 1) {
580580
$("#exclude-patterns-dropdown-1").on("change", function () {
581-
if ($(this).val() === "") table.columns(6).search("").draw();
581+
if ($(this).val() === "") table.columns(7).search("").draw();
582582
else {
583-
table
584-
.column(6)
585-
.search(matchPatternTypeMap[$(this).val()])
586-
.draw();
583+
const patternType = matchPatternTypeMap[$(this).val()];
584+
table.column(7).search(patternType).draw();
587585
}
588586
});
589587
}
@@ -621,7 +619,7 @@ function initializeDataTable() {
621619
},
622620
},
623621
{ data: "id", visible: false, searchable: false },
624-
{ data: "match_pattern_type", visible: false },
622+
{ data: "match_pattern_type", visible: false, searchable: true },
625623
],
626624
});
627625

@@ -671,11 +669,11 @@ function initializeDataTable() {
671669
} else {
672670
if (index === 1) {
673671
$("#include-patterns-dropdown-1").on("change", function () {
674-
if ($(this).val() === "") table.columns(5).search("").draw();
675-
table
676-
.column(5)
677-
.search(matchPatternTypeMap[$(this).val()])
678-
.draw();
672+
if ($(this).val() === "") table.columns(6).search("").draw();
673+
else {
674+
const patternType = matchPatternTypeMap[$(this).val()];
675+
table.column(6).search(patternType).draw();
676+
}
679677
});
680678
}
681679
}
@@ -707,7 +705,7 @@ function initializeDataTable() {
707705
},
708706
},
709707
{ data: "id", visible: false, searchable: false },
710-
{ data: "match_pattern_type", visible: false },
708+
{ data: "match_pattern_type", visible: false, searchable: true },
711709
],
712710
});
713711

@@ -754,12 +752,10 @@ function initializeDataTable() {
754752
$("#title-patterns-dropdown-1").prop("disabled", true);
755753
} else if (index === 1) {
756754
$("#title-patterns-dropdown-1").on("change", function () {
757-
if ($(this).val() === "") table.columns(6).search("").draw();
755+
if ($(this).val() === "") table.columns(7).search("").draw();
758756
else {
759-
table
760-
.column(6)
761-
.search(matchPatternTypeMap[$(this).val()])
762-
.draw();
757+
const patternType = matchPatternTypeMap[$(this).val()];
758+
table.column(7).search(patternType).draw();
763759
}
764760
});
765761
}
@@ -792,7 +788,7 @@ function initializeDataTable() {
792788
},
793789
},
794790
{ data: "id", visible: false, searchable: false },
795-
{ data: "match_pattern_type", visible: false },
791+
{ data: "match_pattern_type", visible: false, searchable: true },
796792
],
797793
});
798794

@@ -833,53 +829,19 @@ function initializeDataTable() {
833829
pageLength: 100,
834830
ajax: `/api/document-type-patterns/?format=datatables&collection_id=${collection_id}`,
835831
initComplete: function (data) {
836-
this.api()
837-
.columns()
838-
.every(function (index) {
839-
var table = $("#document_type_patterns_table").DataTable();
840-
841-
let addDropdownSelect = {
842-
1: {
843-
columnToSearch: 6,
844-
matchPattern: {
845-
"Individual URL Pattern": 1,
846-
"Multi-URL Pattern": 2,
847-
},
848-
},
849-
2: {
850-
columnToSearch: 7,
851-
matchPattern: {
852-
Images: 1,
853-
Data: 2,
854-
Documentation: 3,
855-
"Software and Tools": 4,
856-
"Missions and Instruments": 5,
857-
},
858-
},
859-
};
860-
861-
let column = this;
862-
if (column.data().length === 0) {
863-
$(`#document-type-patterns-dropdown-${index}`).prop(
864-
"disabled",
865-
true
866-
);
867-
} else if (index in addDropdownSelect) {
868-
$("#document-type-patterns-dropdown-" + index).on(
869-
"change",
870-
function () {
871-
let col = addDropdownSelect[index].columnToSearch;
872-
let searchInput =
873-
addDropdownSelect[index].matchPattern[$(this).val()];
874-
if ($(this).val() === "" || $(this).val() === undefined)
875-
table.columns(col).search("").draw();
876-
else {
877-
table.columns(col).search(searchInput).draw();
878-
}
879-
}
880-
);
881-
}
882-
});
832+
var table = $("#document_type_patterns_table").DataTable();
833+
this.api().columns().every(function (index) {
834+
if (index === 1) {
835+
$("#document-type-patterns-dropdown-1").on("change", function () {
836+
if ($(this).val() === "") {
837+
table.column(7).search("").draw();
838+
} else {
839+
const patternType = matchPatternTypeMap[$(this).val()];
840+
table.column(7).search(patternType).draw();
841+
}
842+
});
843+
}
844+
});
883845
},
884846

885847
columns: [
@@ -909,7 +871,7 @@ function initializeDataTable() {
909871
},
910872
},
911873
{ data: "id", visible: false, searchable: false },
912-
{ data: "match_pattern_type", visible: false },
874+
{ data: "match_pattern_type", visible: false, searchable: true },
913875
{ data: "document_type", visible: false },
914876
],
915877
});
@@ -945,47 +907,20 @@ var division_patterns_table = $("#division_patterns_table").DataTable({
945907
pageLength: 100,
946908
ajax: `/api/division-patterns/?format=datatables&collection_id=${collection_id}`,
947909
initComplete: function (data) {
948-
this.api()
949-
.columns()
950-
.every(function (index) {
951-
var table = $("#division_patterns_table").DataTable();
952-
953-
let addDropdownSelect = {
954-
1: {
955-
columnToSearch: 6,
956-
matchPattern: {
957-
"Individual URL Pattern": 1,
958-
"Multi-URL Pattern": 2,
959-
},
960-
},
961-
2: {
962-
columnToSearch: 7,
963-
matchPattern: {
964-
"Astrophysics": 1,
965-
"Biological and Physical Sciences": 2,
966-
"Earth Science": 3,
967-
"Heliophysics": 4,
968-
"Planetary Science": 5,
969-
},
970-
},
971-
};
972-
973-
let column = this;
974-
if (column.data().length === 0) {
975-
$(`#division-patterns-dropdown-${index}`).prop("disabled", true);
976-
} else if (index in addDropdownSelect) {
977-
$("#division-patterns-dropdown-" + index).on("change", function () {
978-
let col = addDropdownSelect[index].columnToSearch;
979-
let searchInput =
980-
addDropdownSelect[index].matchPattern[$(this).val()];
981-
if ($(this).val() === "" || $(this).val() === undefined)
982-
table.columns(col).search("").draw();
983-
else {
984-
table.columns(col).search(searchInput).draw();
985-
}
986-
});
987-
}
988-
});
910+
var table = $("#division_patterns_table").DataTable();
911+
this.api().columns().every(function (index) {
912+
if (index === 1) {
913+
// Updated pattern type dropdown handler
914+
$("#division-patterns-dropdown-1").on("change", function () {
915+
if ($(this).val() === "") {
916+
table.column(7).search("").draw();
917+
} else {
918+
const patternType = matchPatternTypeMap[$(this).val()];
919+
table.column(7).search(patternType).draw();
920+
}
921+
});
922+
}
923+
});
989924
},
990925

991926
columns: [
@@ -1015,7 +950,7 @@ var division_patterns_table = $("#division_patterns_table").DataTable({
1015950
},
1016951
},
1017952
{ data: "id", visible: false, searchable: false },
1018-
{ data: "match_pattern_type", visible: false },
953+
{ data: "match_pattern_type", visible: false, searchable: true },
1019954
{ data: "division", visible: false },
1020955
],
1021956
});

0 commit comments

Comments
 (0)