mirror of
https://github.com/Dictionarry-Hub/profilarr.git
synced 2026-01-26 04:42:00 +01:00
fix: update mass import handling to use selected profile indexes and add validation for empty selections
This commit is contained in:
@@ -214,13 +214,19 @@ function ProfilePage() {
|
||||
|
||||
const handleMassImport = async arr => {
|
||||
try {
|
||||
const selectedProfiles = Array.from(selectedItems).map(identifier =>
|
||||
profiles.find(p => p.content.name === identifier)
|
||||
);
|
||||
// Get array of indexes from selectedItems
|
||||
const selectedProfilesList = Array.from(selectedItems)
|
||||
.map(index => profiles[index])
|
||||
.filter(profile => profile); // Filter out any undefined entries
|
||||
|
||||
if (selectedProfilesList.length === 0) {
|
||||
Alert.error('No valid profiles selected for import');
|
||||
return;
|
||||
}
|
||||
|
||||
await importProfiles(
|
||||
arr,
|
||||
selectedProfiles.map(p => p.file_name)
|
||||
selectedProfilesList.map(p => p.file_name)
|
||||
);
|
||||
Alert.success('Profiles imported successfully');
|
||||
toggleSelectionMode();
|
||||
|
||||
Reference in New Issue
Block a user