debug: agregar logs para diagnosticar problema de renderizado de tabla en explorer
This commit is contained in:
@@ -245,23 +245,30 @@ const selectedTableName = computed(() => {
|
||||
})
|
||||
|
||||
const tableColumns = computed(() => {
|
||||
if (!tableData.value || tableData.value.length === 0) return []
|
||||
if (!tableData.value || tableData.value.length === 0) {
|
||||
console.log('📊 tableColumns: No data')
|
||||
return []
|
||||
}
|
||||
|
||||
const firstRow = tableData.value[0]
|
||||
return Object.keys(firstRow).map(key => ({
|
||||
const cols = Object.keys(firstRow).map(key => ({
|
||||
key,
|
||||
label: upperFirst(key)
|
||||
}))
|
||||
console.log('📊 tableColumns computed:', cols.length, 'columns')
|
||||
return cols
|
||||
})
|
||||
|
||||
const displayColumns = computed(() => {
|
||||
return tableColumns.value
|
||||
const filtered = tableColumns.value
|
||||
.filter(col => visibleColumns.value.includes(col.key))
|
||||
.map(col => ({
|
||||
key: col.key,
|
||||
label: col.label,
|
||||
sortable: true
|
||||
}))
|
||||
console.log('📊 displayColumns computed:', filtered.length, 'visible columns')
|
||||
return filtered
|
||||
})
|
||||
|
||||
const filteredData = computed(() => {
|
||||
@@ -280,7 +287,9 @@ const filteredData = computed(() => {
|
||||
const paginatedData = computed(() => {
|
||||
const start = (page.value - 1) * rowsPerPage.value
|
||||
const end = start + rowsPerPage.value
|
||||
return filteredData.value.slice(start, end)
|
||||
const paginated = filteredData.value.slice(start, end)
|
||||
console.log('📊 paginatedData computed:', paginated.length, 'rows for page', page.value)
|
||||
return paginated
|
||||
})
|
||||
|
||||
// Pagination helpers
|
||||
@@ -395,6 +404,8 @@ async function loadTableData() {
|
||||
if (result.data && result.data.rows && result.data.cols) {
|
||||
// Transform Metabase response to array of objects
|
||||
const columns = result.data.cols.map((col: any) => col.name)
|
||||
console.log('📊 Columns extracted:', columns)
|
||||
|
||||
tableData.value = result.data.rows.map((row: any[]) => {
|
||||
const obj: any = {}
|
||||
columns.forEach((col: string, index: number) => {
|
||||
@@ -403,9 +414,14 @@ async function loadTableData() {
|
||||
return obj
|
||||
})
|
||||
|
||||
console.log('📊 Table data transformed:', tableData.value.length, 'rows')
|
||||
console.log('📊 First row:', tableData.value[0])
|
||||
|
||||
// Initialize visible columns
|
||||
visibleColumns.value = columns
|
||||
console.log('📊 Visible columns set:', visibleColumns.value)
|
||||
} else {
|
||||
console.log('❌ No data structure found:', result)
|
||||
tableData.value = []
|
||||
}
|
||||
} catch (err: any) {
|
||||
|
||||
Reference in New Issue
Block a user