count basado en datos en memoria, ya no cuenta de manera automatica. metadatosCard puede cargar los datos de la tabla

This commit is contained in:
2025-09-29 22:37:25 -06:00
parent c531a745fe
commit ab920c355a
20 changed files with 300 additions and 106 deletions

View File

@@ -70,41 +70,11 @@
<!-- Metadata Cards -->
<section v-if="metadataStore.hasMetadata" class="flex flex-col gap-5">
<div v-if="metadataStore.allTables.length" class="grid gap-5 md:grid-cols-2">
<UCard v-for="meta in metadataStore.allTables" :key="meta.table" class="brand-card border border-transparent">
<template #header>
<div class="flex items-center justify-between">
<h2 class="text-lg font-semibold brand-section-title">Tabla {{ meta.table }}</h2>
<span class="brand-badge inline-flex items-center gap-1 rounded-full px-3 py-1 text-xs font-semibold tracking-wide">
{{ formatNumber(meta.rowCount) }} registros
</span>
</div>
</template>
<dl class="grid grid-cols-2 gap-3 text-sm text-[var(--brand-text-muted)]">
<div>
<dt class="uppercase tracking-wide text-xs">Clave primaria</dt>
<dd class="font-medium text-[var(--brand-text)]">{{ meta.primaryKey || '—' }}</dd>
</div>
<div>
<dt class="uppercase tracking-wide text-xs">Tamaño aprox.</dt>
<dd class="font-medium text-[var(--brand-text)]">{{ formatSize(meta.approxSizeBytes) }}</dd>
</div>
<div>
<dt class="uppercase tracking-wide text-xs">Creación desde</dt>
<dd class="font-medium text-[var(--brand-text)]">{{ formatDate(meta.createdAtRange?.from) }}</dd>
</div>
<div>
<dt class="uppercase tracking-wide text-xs">Creación hasta</dt>
<dd class="font-medium text-[var(--brand-text)]">{{ formatDate(meta.createdAtRange?.to) }}</dd>
</div>
</dl>
<template #footer>
<div class="brand-divider pt-3 text-xs text-[var(--brand-text-muted)]">
Columnas detectadas ({{ meta.columns?.length || 0 }}): {{ (meta.columns || []).join(', ') || 'Ninguna' }}
</div>
</template>
</UCard>
<MetadatosCard
v-for="meta in metadataStore.allTables"
:key="meta.table"
:metadata="meta"
/>
</div>
<!-- Sample Row Card (if available) -->
@@ -182,24 +152,6 @@ function formatSize(bytes: number | null | undefined): string {
return `${size.toFixed(1)} ${units[unitIndex]}`
}
function formatDate(value: string | null | undefined): string {
if (!value) {
return '—'
}
const date = new Date(value)
if (Number.isNaN(date.getTime())) {
return value
}
return date.toLocaleString('es-ES', {
year: 'numeric',
month: 'short',
day: 'numeric'
})
}
function formatNumber(value: number): string {
return new Intl.NumberFormat('es-ES').format(value)
}