Skip to content

Commit 6797ed8

Browse files
authored
YDA-6103: reset csv import instructions after reopening the import modal
1 parent 5b6322d commit 6797ed8

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

group_manager/static/group_manager/js/group_manager.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,9 @@ async function removeUserFromGroup (row, groupName) {
594594
}
595595

596596
$(function () {
597+
// Store the initial state of the CSV import instructions
598+
let initialImportCsvHtml = $('#result-import-groups-csv').html()
599+
597600
// Multiple user role change
598601
$('.users.card .update-button').on('click', function (e) {
599602
const newRole = $(this).attr('data-target-role')
@@ -645,6 +648,20 @@ $(function () {
645648
$('#dlg-import-groups-csv').modal('show')
646649
})
647650

651+
$('#dlg-import-groups-csv').on('hidden.bs.modal', function () {
652+
// Safeguard: Store initial instructions if undefined (do this once at page load)
653+
if (typeof initialImportCsvHtml === 'undefined') {
654+
initialImportCsvHtml = $('#result-import-groups-csv').html()
655+
}
656+
657+
// Restore initial state
658+
$('#result-import-groups-csv').html(initialImportCsvHtml)
659+
// Hide the process CSV button
660+
$('.div-process-results-import').addClass('hidden')
661+
$('.process-csv').prop('disabled', true)
662+
$('#file-input').val('') // Clear file input
663+
})
664+
648665
$('.process-csv').on('click', function () {
649666
// First disable the button
650667
$(this).prop('disabled', true)

0 commit comments

Comments
 (0)