diff --git a/nuxt4-app/app/components/metabase/MetabaseCardDisplay.vue b/nuxt4-app/app/components/metabase/MetabaseCardDisplay.vue
index 90cdc04..56e6907 100644
--- a/nuxt4-app/app/components/metabase/MetabaseCardDisplay.vue
+++ b/nuxt4-app/app/components/metabase/MetabaseCardDisplay.vue
@@ -82,9 +82,21 @@
Resultados
-
- {{ queryResult.data?.rows?.length || 0 }} filas en {{ queryResult.running_time || 0 }}ms
-
+
+
+ {{ queryResult.data?.rows?.length || 0 }} filas en {{ queryResult.running_time || 0 }}ms
+
+
+ {{ copied ? 'Copiado!' : 'Copiar JSON' }}
+
+
@@ -99,8 +111,43 @@
-
-
{{ JSON.stringify(queryResult.data, null, 2) }}
+
+
+
+
+
+
+ |
+ {{ col.display_name || col.name }}
+ |
+
+
+
+
+ |
+ {{ formatCell(cell, queryResult.data.cols[cellIndex]) }}
+ |
+
+
+
+
+
+
+
+
+ Ver JSON completo
+
+
+ {{ JSON.stringify(queryResult.data, null, 2) }}
+
@@ -126,6 +173,7 @@ const executing = ref(false)
const executingCached = ref(false)
const queryResult = ref(null)
const error = ref(null)
+const copied = ref(false)
const exportItems = [[
{
@@ -203,4 +251,39 @@ function downloadExport(format: 'csv' | 'json' | 'xlsx') {
const url = `${window.location.origin}/api/metabase/cards/${props.card.id}/query/${format}`
window.open(url, '_blank')
}
+
+async function copyResults() {
+ try {
+ await navigator.clipboard.writeText(JSON.stringify(queryResult.value.data, null, 2))
+ copied.value = true
+ setTimeout(() => {
+ copied.value = false
+ }, 2000)
+ } catch (e) {
+ console.error('Error al copiar:', e)
+ }
+}
+
+function formatCell(value: any, col: any) {
+ if (value === null || value === undefined) return '-'
+
+ // Format numbers based on type
+ if (col.base_type === 'type/Float' || col.base_type === 'type/Decimal') {
+ return new Intl.NumberFormat('es-ES', {
+ minimumFractionDigits: 0,
+ maximumFractionDigits: 2
+ }).format(value)
+ }
+
+ if (col.base_type === 'type/Integer') {
+ return new Intl.NumberFormat('es-ES').format(value)
+ }
+
+ // Format dates
+ if (col.base_type === 'type/Date' || col.base_type === 'type/DateTime') {
+ return new Date(value).toLocaleDateString('es-ES')
+ }
+
+ return value
+}