feat(back-end):improvement
Some checks failed
Build, Test and Deploy / test-backend (push) Successful in 1m19s
Build, Test and Deploy / build-and-push (push) Failing after 37s
Build, Test and Deploy / deploy (push) Has been skipped

This commit is contained in:
2026-02-13 16:03:44 +01:00
parent e1d9823b51
commit f165d191be
16 changed files with 260 additions and 45 deletions

View File

@@ -2,7 +2,9 @@
<h1>{{ 'CALC.TITLE' | translate }}</h1>
<p class="subtitle">{{ 'CALC.SUBTITLE' | translate }}</p>
@if (error()) {
@if (error() === 'VIRUS_DETECTED') {
<app-alert type="error">{{ 'CALC.ERROR_VIRUS' | translate }}</app-alert>
} @else if (error()) {
<app-alert type="error">{{ 'CALC.ERROR_GENERIC' | translate }}</app-alert>
}
</div>

View File

@@ -26,7 +26,7 @@ export class CalculatorPageComponent implements OnInit {
loading = signal(false);
uploadProgress = signal(0);
result = signal<QuoteResult | null>(null);
error = signal<boolean>(false);
error = signal<string | null>(null);
orderSuccess = signal(false);
@@ -141,7 +141,7 @@ export class CalculatorPageComponent implements OnInit {
this.currentRequest = req;
this.loading.set(true);
this.uploadProgress.set(0);
this.error.set(false);
this.error.set(null);
this.result.set(null);
this.orderSuccess.set(false);
@@ -175,8 +175,12 @@ export class CalculatorPageComponent implements OnInit {
}
}
},
error: () => {
this.error.set(true);
error: (err) => {
if (typeof err === 'string') {
this.error.set(err);
} else {
this.error.set('GENERIC');
}
this.loading.set(false);
}
});

View File

@@ -215,7 +215,8 @@ export class QuoteEstimatorService {
},
error: (err) => {
console.error('Item upload failed', err);
finalResponses[index] = { success: false, fileName: item.file.name };
const errorMsg = err.error?.code === 'VIRUS_DETECTED' ? 'VIRUS_DETECTED' : 'UPLOAD_FAILED';
finalResponses[index] = { success: false, fileName: item.file.name, error: errorMsg };
completedRequests++;
checkCompletion();
}
@@ -262,7 +263,13 @@ export class QuoteEstimatorService {
});
if (validCount === 0) {
observer.error('All calculations failed.');
// Check if any failed due to virus
const virusError = responses.find(r => r.error === 'VIRUS_DETECTED');
if (virusError) {
observer.error('VIRUS_DETECTED');
} else {
observer.error('All calculations failed.');
}
return;
}

View File

@@ -40,7 +40,7 @@
"CTA_START": "Start Now",
"BUSINESS": "Business",
"PRIVATE": "Private",
"MODE_EASY": "Quick",
"MODE_EASY": "Easy Print",
"MODE_ADVANCED": "Advanced",
"UPLOAD_LABEL": "Drag your 3D file here",
"UPLOAD_SUB": "Supports STL, 3MF, STEP, OBJ up to 50MB",

View File

@@ -17,7 +17,7 @@
"CTA_START": "Inizia Ora",
"BUSINESS": "Aziende",
"PRIVATE": "Privati",
"MODE_EASY": "Base",
"MODE_EASY": "Stampa Facile",
"MODE_ADVANCED": "Avanzata",
"UPLOAD_LABEL": "Trascina il tuo file 3D qui",
"UPLOAD_SUB": "Supportiamo STL, 3MF, STEP, OBJ fino a 50MB",