feat(status): ajouter statut NO_YAML pour les entrées sans fichier YAML

- shared: ajoute 'NO_YAML' à ApiStatus
- back/apis: status initial dérivé de yamlContent (PENDING si YAML, NO_YAML sinon)
- back/uploads: supprime la contrainte "fichier requis", gère le cas sans fichier
- front/api-detail: badgeClass/statusLabel gèrent NO_YAML (badge warning "Sans fichier")
- front/catalog: badgeClass ajoute le case NO_YAML → badge warning
- front/upload: fichier optionnel (canProceedFromStep1 retourne true si 0 fichier)

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
z3n
2026-06-24 08:23:03 +00:00
parent f326efb7b0
commit 3836db1e1f
6 changed files with 34 additions and 10 deletions

View File

@@ -393,7 +393,9 @@ import { ApiEntry, Category, API_CONVENTION_LABELS, ApiConvention } from '@datac
<div class="fr-col-12 fr-col-md-6">
<dt class="fr-text--bold">Fichier{{ selectedFiles().length > 1 ? 's' : '' }}</dt>
<dd>
@if (selectedFiles().length === 1) {
@if (selectedFiles().length === 0) {
<span class="fr-badge fr-badge--warning fr-badge--sm">Aucun fichier</span>
} @else if (selectedFiles().length === 1) {
{{ selectedFiles()[0].name }}
} @else {
@for (f of selectedFiles(); track f.name) {
@@ -568,7 +570,7 @@ export class UploadComponent implements OnInit {
return !!(this.metaForm.get('versionPatch')?.invalid && this.metaForm.get('versionPatch')?.touched);
}
canProceedFromStep1 = computed(() => {
if (this.selectedFiles().length === 0) return false;
if (this.selectedFiles().length === 0) return true; // fichier optionnel
if (this.validating()) return false;
return this.validationDone() && this.validationErrors().length === 0;
});
@@ -627,6 +629,7 @@ export class UploadComponent implements OnInit {
onFileChange(event: Event) {
this.fileError.set(null);
this.uploadError.set(null);
this.detectedType.set(null);
this.detectedMainFilename.set(null);
this.validationErrors.set([]);
@@ -725,7 +728,12 @@ export class UploadComponent implements OnInit {
onSubmit() {
const files = this.selectedFiles();
this.metaForm.markAllAsTouched();
if (files.length === 0 || this.metaForm.invalid) return;
if (this.metaForm.invalid) {
/* Naviguer vers l'étape avec les erreurs pour les rendre visibles */
const infoInvalid = this.INFO_FIELDS.some((f) => this.metaForm.get(f)?.invalid);
this.step.set(infoInvalid ? 2 : 3);
return;
}
this.uploading.set(true);
this.uploadError.set(null);