Skip to content

Commit

Permalink
fix(ddm): Processing rule helper functions only worked with single di…
Browse files Browse the repository at this point in the history
…git IDs. Length of IDs is now unrestrained by these functions.
  • Loading branch information
Nico-AP committed Jul 17, 2024
1 parent c1be883 commit d9ef58c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
12 changes: 6 additions & 6 deletions ddm/static/ddm/js/blueprint-edit-ui-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ closeModal = function(id) {
* On OK-click in modal, update filter settings overview.
*/
$( "body" ).on("click", "button[class*='ddm-modal-ok']", function() {
const current_id = $(this).attr("id").match(/\d/)[0];
const current_id = $(this).attr("id").match(/\d+/)[0];
hideErrorMessages(current_id);
if (checkNoFieldsMissing(current_id)) {
updateRuleDescription(current_id);
Expand All @@ -93,7 +93,7 @@ $( "body" ).on("click", "button[class*='ddm-modal-ok']", function() {
});

$( "body" ).on("click", "button[class*='ddm-modal-cancel']", function() {
const current_id = $(this).attr("id").match(/\d/)[0];
const current_id = $(this).attr("id").match(/\d+/)[0];
let e = $("#execution_order-" + current_id);

if ($.trim(e.text()) === 'None') {
Expand All @@ -111,8 +111,8 @@ $( "body" ).on("click", "button[class*='ddm-modal-cancel']", function() {
$(document).ready(function() {
let IDs = new Set();
$("[id^=id_processingrule_set-]").each(function() {
if( /\d/.test($( this ).attr("id")) ) {
IDs.add($( this ).attr("id").match(/\d/)[0]);
if( /\d+/.test($( this ).attr("id")) ) {
IDs.add($( this ).attr("id").match(/\d+/)[0]);
}
});
for ( const id of IDs ) {
Expand All @@ -127,8 +127,8 @@ $(document).ready(function() {
$("#add-inline-form").on("click", function() {
let IDs = [];
$("[id^=id_processingrule_set-]").each(function() {
if( /\d/.test($(this).attr("id"))) {
IDs.push($(this).attr("id").match(/\d/)[0]);
if( /\d+/.test($(this).attr("id"))) {
IDs.push($(this).attr("id").match(/\d+/)[0]);
}
});
let formIdx;
Expand Down
7 changes: 3 additions & 4 deletions ddm/static/ddm/js/processing-rule-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@ hideOrShowReplacementAndComparisonValue = function( id ) {
}

$( "body" ).on("change", "select[id$='-comparison_operator']", function() {
const current_id = $(this).attr("id").match(/\d/)[0];
const current_id = $(this).attr("id").match(/\d+/)[0];
hideOrShowReplacementAndComparisonValue(current_id);

});

$(document).ready(function() {
let IDs = new Set();
$("[id$=-comparison_operator]").each(function() {
if( /\d/.test($( this ).attr("id")) ) {
IDs.add($( this ).attr("id").match(/\d/)[0]);
if( /\d+/.test($( this ).attr("id")) ) {
IDs.add($( this ).attr("id").match(/\d+/)[0]);
}
});
for ( const id of IDs ) {
Expand Down

0 comments on commit d9ef58c

Please sign in to comment.