wording fixes

This commit is contained in:
Roberto Treviño Cervantes
2026-11-17 02:17:24 -06:00
parent 2834fac85c
commit dc37c54938
11 changed files with 304 additions and 7 deletions
@@ -17,10 +17,14 @@ import { ModelVersion } from '../../api/governance.types';
import { ModelStatusChip } from '../model-status-chip/model-status-chip';
import { ModelVersionDialog } from '../model-version-dialog/model-version-dialog';
/** The only scenario with a trainer today (ML-cin2_logistic, CaCu): `entrenar`'s own domain and scenario. */
const TRAINABLE = { domain: 'cacu', scenario: 'cin2_logistic' };
/**
* Every registered model version with its status (desarrollo, candidata,
* en producción, retirada). The detail dialog holds the promotion
* checklist, lineage, artifacts and reports.
* checklist, lineage, artifacts and reports. The toolbar also offers
* training the one scenario with a trainer, over HTTP instead of a shell.
*/
@Component({
selector: 'app-model-versions-panel',
@@ -50,6 +54,7 @@ export class ModelVersionsPanel implements OnInit {
readonly versions = signal<ModelVersion[]>([]);
readonly loading = signal(false);
readonly loadError = signal<string | null>(null);
readonly training = signal(false);
readonly displayedColumns = ['version', 'scenario', 'environment', 'armado', 'status', 'created_at', 'acciones'];
@@ -94,4 +99,23 @@ export class ModelVersionsPanel implements OnInit {
metrics(version: ModelVersion): { key: string; value: unknown }[] {
return Object.entries(version.metrics ?? {}).map(([key, value]) => ({ key, value }));
}
train(): void {
this.training.set(true);
this.api
.trainModelVersion(TRAINABLE.domain, TRAINABLE.scenario)
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe({
next: () => {
this.training.set(false);
this.snackBar.open(`El modelo ${TRAINABLE.domain}/${TRAINABLE.scenario} se entrenó correctamente.`, 'OK', { duration: 3000 });
this.reload();
},
error: (error) => {
this.training.set(false);
this.snackBar.open(apiErrorMessage(error, 'No se pudo entrenar el modelo.'), 'OK', { duration: 5000 });
if (error?.status === 409) this.reload();
},
});
}
}