Skip to content

Commit

Permalink
add: comments
Browse files Browse the repository at this point in the history
  • Loading branch information
leonidastri committed Feb 5, 2025
1 parent 473381a commit b50bff3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion group_manager/static/group_manager/js/group_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ function readCsvFile (e) {
table += '<td></td></tr></thead><tbody>'

newResult.forEach(function myFunction (groupDef, i) {
// replace special characters not to cause errors to ids
const sanitizedGroupname = groupDef.groupname.replace(/[^a-zA-Z0-9-_]/g, '-')
const safeRowData = csvRowsCorrected[i].replace(/"/g, '&quot;')
table += '<tr id="' + sanitizedGroupname + '" class="import-groupname" groupname="' + groupDef.groupname + '" importRowData="' + csvHeader + '\n' + safeRowData + '">'
Expand Down Expand Up @@ -420,6 +421,7 @@ async function processImportedRow (row) {
} else {
// Row processing encountered problems => inform user and add appropriate classes.
row.addClass('import-groupname-done')
// replace special characters not to cause errors to ids
const sanitizedGroupname = groupname.replace(/[^a-zA-Z0-9-_]/g, '-')
$('#processed-indicator-' + sanitizedGroupname).html('<i class="fa-solid fa-circle-exclamation"></i>')
row.addClass('table-danger')
Expand All @@ -436,7 +438,7 @@ async function processImportedRow (row) {
}
} else {
row.addClass('table-danger')
// replace special characters
// replace special characters not to cause errors to ids
const sanitizedGroupname = groupname.replace(/[^a-zA-Z0-9-_]/g, '-')
$('#processed-indicator-' + sanitizedGroupname).html('<i class="fa-solid fa-circle-exclamation"></i>')
$('#import-' + sanitizedGroupname).html('An unexpected error occurred.')
Expand Down

0 comments on commit b50bff3

Please sign in to comment.