Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,7 @@ export default class ImportCommand extends Command {
const moduleImporter = new ModuleImporter(managementAPIClient, importConfig);
const result = await moduleImporter.start();
backupDir = importConfig.backupDir;

if (!result?.noSuccessMsg) {
const successMessage = importConfig.stackName
? `Successfully imported the content to the stack named ${importConfig.stackName} with the API key ${importConfig.apiKey} .`
: `The content has been imported to the stack ${importConfig.apiKey} successfully!`;
log.success(successMessage, importConfig.context);
}

//Note: Final summary is now handled by summary manager
CLIProgressManager.printGlobalSummary();
this.logSuccessAndBackupMessages(backupDir, importConfig);
// Clear progress module setting now that import is complete
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,16 @@ export default class CLIProgressManager {
CLIProgressManager.globalSummary.printFinalSummary();
}

/**
* Check if there are any failures in the global summary
*/
static hasFailures(): boolean {
if (!CLIProgressManager.globalSummary) {
return false;
}
return CLIProgressManager.globalSummary.hasFailures();
}

/**
* Apply strategy-based corrections to module data
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,12 @@ export default class SummaryManager {

// Final Status
console.log('\n' + chalk.bold('Final Status:'));
if (failedModules === 0) {
console.log(chalk.bold.green(`🎉 ${this.operationName} completed successfully!`));
} else if (completedModules > 0) {
console.log(chalk.bold.yellow(`⚠️ ${this.operationName} completed with ${failedModules} failed modules`));
if (!this.hasFailures() && failedModules === 0) {
console.log(chalk.bold.green(`✅ ${this.operationName} completed successfully!`));
} else if (this.hasFailures() || failedModules > 0) {
console.log(
chalk.bold.yellow(`⚠️ ${this.operationName} completed with failures, see the logs for more details.`),
);
} else {
console.log(chalk.bold.red(`❌ ${this.operationName} failed`));
}
Expand All @@ -146,6 +148,13 @@ export default class SummaryManager {
this.printFailureSummaryWithLogReference();
}

/**
* Check if there are any failures across all modules
*/
hasFailures(): boolean {
return Array.from(this.modules.values()).some((m) => m.failures.length > 0 || m.failureCount > 0);
}

private printFailureSummaryWithLogReference(): void {
const modulesWithFailures = Array.from(this.modules.values()).filter((m) => m.failures.length > 0);

Expand Down
Loading