@snteam/amplify-angular-core 1.0.47 → 1.0.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5275,42 +5275,27 @@ return fields;
|
|
|
5275
5275
|
async deleteAllConfigs(modelName) {
|
|
5276
5276
|
try {
|
|
5277
5277
|
console.log(`ConfigurationsComponent: Starting deleteAllConfigs for ${modelName}`);
|
|
5278
|
-
// Get all records for the model
|
|
5279
|
-
const
|
|
5280
|
-
if (
|
|
5281
|
-
this.snackBar.open(`
|
|
5278
|
+
// Get all records for the model using one-time fetch
|
|
5279
|
+
const items = await this.getItemsFromModel(modelName);
|
|
5280
|
+
if (items.length === 0) {
|
|
5281
|
+
this.snackBar.open(`No ${modelName} records found to delete`, 'Dismiss', { duration: 3000 });
|
|
5282
5282
|
return;
|
|
5283
5283
|
}
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
}
|
|
5300
|
-
catch (deleteError) {
|
|
5301
|
-
console.error(`ConfigurationsComponent: Error deleting ${modelName} records:`, deleteError);
|
|
5302
|
-
this.snackBar.open(`Error deleting ${modelName} records: ${deleteError}`, 'Dismiss', {
|
|
5303
|
-
duration: 5000
|
|
5304
|
-
});
|
|
5305
|
-
}
|
|
5306
|
-
},
|
|
5307
|
-
error: (error) => {
|
|
5308
|
-
console.error(`ConfigurationsComponent: Error getting ${modelName} records:`, error);
|
|
5309
|
-
this.snackBar.open(`Error getting ${modelName} records: ${error}`, 'Dismiss', {
|
|
5310
|
-
duration: 5000
|
|
5311
|
-
});
|
|
5312
|
-
}
|
|
5313
|
-
});
|
|
5284
|
+
console.log(`ConfigurationsComponent: Found ${items.length} ${modelName} records to delete`);
|
|
5285
|
+
// Delete all records
|
|
5286
|
+
const deletePromises = items.map((item) => this.ams.deleteItemForModel(modelName, item.id));
|
|
5287
|
+
try {
|
|
5288
|
+
const deleteResults = await Promise.all(deletePromises);
|
|
5289
|
+
const successfulDeletes = deleteResults.filter(result => result && result.data);
|
|
5290
|
+
console.log(`ConfigurationsComponent: Successfully deleted ${successfulDeletes.length} ${modelName} records`);
|
|
5291
|
+
this.snackBar.open(`Deleted ${successfulDeletes.length} ${modelName} records`, 'Dismiss', { duration: 3000 });
|
|
5292
|
+
}
|
|
5293
|
+
catch (deleteError) {
|
|
5294
|
+
console.error(`ConfigurationsComponent: Error deleting ${modelName} records:`, deleteError);
|
|
5295
|
+
this.snackBar.open(`Error deleting ${modelName} records: ${deleteError}`, 'Dismiss', {
|
|
5296
|
+
duration: 5000
|
|
5297
|
+
});
|
|
5298
|
+
}
|
|
5314
5299
|
}
|
|
5315
5300
|
catch (error) {
|
|
5316
5301
|
console.error(`ConfigurationsComponent: Error in deleteAllConfigs for ${modelName}:`, error);
|
|
@@ -5394,9 +5379,8 @@ return fields;
|
|
|
5394
5379
|
let fieldOrder = 0;
|
|
5395
5380
|
for (const field of fields) {
|
|
5396
5381
|
const fieldData = field;
|
|
5397
|
-
// Skip system fields
|
|
5398
|
-
if (skipFields.includes(fieldData.name)
|
|
5399
|
-
(fieldData.association && fieldData.association.connectionType)) {
|
|
5382
|
+
// Skip system fields only (include relationship fields)
|
|
5383
|
+
if (skipFields.includes(fieldData.name)) {
|
|
5400
5384
|
continue;
|
|
5401
5385
|
}
|
|
5402
5386
|
const formViewField = {
|